• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# wmib.config类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中wmib.config的典型用法代码示例。如果您正苦于以下问题:C# config类的具体用法?C# config怎么用?C# config使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



config类属于wmib命名空间,在下文中一共展示了config类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Extension_DumpHtml

 public override string Extension_DumpHtml(config.channel channel)
 {
     string HTML = "";
     if (GetConfig(channel, "Rss.Enable", false))
     {
         Feed list = (Feed)channel.RetrieveObject("rss");
         if (list == null)
         {
             return "";
         }
         if (GetConfig(channel, "Rss.Enable", false) != true)
         {
             return HTML;
         }
         HTML += "<h4>Rss feed</h4><br>";
         HTML += "\n<br>\n<h4>Rss</h4>\n<br>\n\n<table class=\"infobot\" width=100% border=1>";
         HTML += "<tr><th>Name</th><th>URL</th><th>Text</th><th>Enabled</th></tr>";
         lock (list.Content)
         {
             foreach (Feed.item feed in list.Content)
             {
                 HTML += "\n<tr><td>" + feed.name + "</td><td><a href=\"" + feed.URL + "\">" + feed.URL + "</a></td><td>" + feed.message + "</td><td>" + (!feed.disabled).ToString() + "</td></tr>";
             }
         }
         HTML += "</table>\n";
     }
     return HTML;
 }
开发者ID:atdt,项目名称:wikimedia-bot,代码行数:28,代码来源:Module.cs


示例2: Hook_Channel

 public override void Hook_Channel(config.channel channel)
 {
     if (channel.RetrieveObject("Statistics") == null)
     {
         channel.RegisterObject(new Statistics(channel), NAME);
     }
 }
开发者ID:atdt,项目名称:wikimedia-bot,代码行数:7,代码来源:Statistics.cs


示例3: Hook_PRIV

 public override void Hook_PRIV(config.channel channel, User invoker, string message)
 {
     if (message.StartsWith("!") && message.Contains("|"))
     {
         DebugLog("Parsing: " + message, 6);
         string user = message.Substring(message.IndexOf("|") + 1);
         user = user.Trim();
         DebugLog("Parsed user - " + user, 6);
         if (user.Contains(" "))
         {
             user = user.Substring(0, user.IndexOf(" "));
         }
         if (user != "")
         {
             DebugLog("Adding user to list " + user, 6);
             Ring.Add(new Buffer.Item(invoker.Nick, user));
         }
     }
     else
     {
         message = message.ToLower();
         if (message.Contains(channel.instance.Nick) && !message.Contains("thanks to") && (message.Contains("thanks") || message.Contains("thank you")) && !message.Contains("no thank"))
         {
             string response = "Hey " + invoker.Nick + ", you are welcome!";
             Buffer.Item x = Ring.getUser(invoker.Nick);
             DebugLog("Checking if user was recently informed using infobot");
             if (x != null)
             {
                 response = "Hey " + invoker.Nick + ", you are welcome, but keep in mind I am just a stupid bot, it was actually " + x.User + " who helped you :-)";
                 Ring.Delete(x);
             }
             core.irc._SlowQueue.DeliverMessage(response, channel);
         }
     }
 }
开发者ID:Krenair,项目名称:wikimedia-bot,代码行数:35,代码来源:Class1.cs


示例4: Hook_Channel

 public override void Hook_Channel(config.channel channel)
 {
     if (channel.RetrieveObject("RC") == null)
     {
         channel.RegisterObject(new RecentChanges(channel), "RC");
     }
 }
开发者ID:reedy,项目名称:wikimedia-bot,代码行数:7,代码来源:RegularModule.cs


示例5: Hook_Channel

 public override void Hook_Channel(config.channel channel)
 {
     if (channel.RetrieveObject("rss") == null)
     {
         channel.RegisterObject(new Feed(channel), "rss");
     }
 }
开发者ID:atdt,项目名称:wikimedia-bot,代码行数:7,代码来源:Module.cs


示例6: Hook_Nick

 public override void Hook_Nick(config.channel channel, User Target, string OldNick)
 {
     Notification result = Notification.RetrieveTarget(Target.Nick);
     while (result != null)
     {
         core.irc._SlowQueue.DeliverMessage(result.Source_Name + "! " + OldNick + " just changed nicknames to " + Target.Nick + " which you wanted to talk with, in " + channel.Name + ". This message was delivered to you because you asked me to notify you about this user's activity. For more information, see http://meta.wikimedia.org/wiki/WM-Bot", result.Source_Name, IRC.priority.low);
         lock (Notification.NotificationList)
         {
             Notification.NotificationList.Remove(result);
         }
         result = Notification.RetrieveTarget(Target.Nick);
     }
     result = Notification.RetrieveTarget(OldNick);
     while (result != null)
     {
         core.irc._SlowQueue.DeliverMessage(result.Source_Name + "! " + OldNick + " just changed a nickname to " + Target.Nick + " which you wanted to talk with, in " + channel.Name + ". This message was delivered to you because you asked me to notify you about this user's activity. For more information, see http://meta.wikimedia.org/wiki/WM-Bot", result.Source_Name, IRC.priority.low);
         lock (Notification.NotificationList)
         {
             Notification.NotificationList.Remove(result);
         }
         result = Notification.RetrieveTarget(OldNick);
     }
     if (Target.Nick.ToLower() != OldNick.ToLower())
     {
         result = Notification.RetrieveSource(OldNick);
         while (result != null)
         {
             result.Source_Name = Target.Nick;
             result = Notification.RetrieveSource(OldNick);
         }
     }
 }
开发者ID:Krenair,项目名称:wikimedia-bot,代码行数:32,代码来源:NotifyUs.cs


示例7: addChannel

 /// <summary>
 /// Join channel
 /// </summary>
 /// <param name="chan">Channel</param>
 /// <param name="user">User</param>
 /// <param name="host">Host</param>
 /// <param name="message">Message</param>
 public static void addChannel(config.channel chan, string user, string host, string message)
 {
     try
     {
         if (message.StartsWith(config.CommandPrefix + "add"))
         {
             if (chan.Users.IsApproved(user, host, "admin"))
             {
                 while (!core.FinishedJoining)
                 {
                     core.Log("Postponing request to join because bot is still loading", true);
                     Thread.Sleep(2000);
                 }
                 if (message.Contains(" "))
                 {
                     string channel = message.Substring(message.IndexOf(" ") + 1);
                     if (!validFile(channel) || (channel.Contains("#") == false))
                     {
                         irc._SlowQueue.DeliverMessage(messages.get("InvalidName", chan.Language), chan.Name);
                         return;
                     }
                     lock (config.channels)
                     {
                         foreach (config.channel cu in config.channels)
                         {
                             if (channel == cu.Name)
                             {
                                 irc._SlowQueue.DeliverMessage(messages.get("ChannelIn", chan.Language), chan.Name);
                                 return;
                             }
                         }
                     }
                     bool existing = config.channel.channelExist(channel);
                     config.channel xx = new config.channel(channel);
                     lock (config.channels)
                     {
                         config.channels.Add(xx);
                     }
                     config.Save();
                     xx.instance.irc.SendData("JOIN " + channel);
                     Thread.Sleep(100);
                     config.channel Chan = getChannel(channel);
                     if (!existing)
                     {
                         Chan.Users.addUser("admin", IRCTrust.normalize(user) + "!.*@" + IRCTrust.normalize(host));
                     }
                     return;
                 }
                 irc.Message(messages.get("InvalidName", chan.Language), chan.Name);
                 return;
             }
             irc._SlowQueue.DeliverMessage(messages.get("PermissionDenied", chan.Language), chan.Name);
         }
     }
     catch (Exception b)
     {
         handleException(b);
     }
 }
开发者ID:Krenair,项目名称:wikimedia-bot,代码行数:66,代码来源:Channels_Core.cs


示例8: Hook_PRIV

 public override void Hook_PRIV(config.channel channel, User invoker, string message)
 {
     if (message == "@replag")
     {
         core.irc._SlowQueue.DeliverMessage("Replication lag is approximately " + GetReplag(), channel);
         return;
     }
 }
开发者ID:johnduhart,项目名称:wikimedia-bot,代码行数:8,代码来源:Class1.cs


示例9: Hook_ChannelDrop

 public override void Hook_ChannelDrop(config.channel chan)
 {
     if (File.Exists(variables.config + Path.DirectorySeparatorChar + chan.Name + ".list"))
     {
         core.Log("RC: Removing db of " + chan.Name + " RC feed");
         File.Delete(variables.config + Path.DirectorySeparatorChar + chan.Name + ".list");
     }
 }
开发者ID:reedy,项目名称:wikimedia-bot,代码行数:8,代码来源:RegularModule.cs


示例10: Format

        public string Format(string name_url, string url, string page, string username, string link, string summary, config.channel chan)
        {
            if (GetConfig(chan, "RC.Template", "") == "")
            {
                return messages.get("fl", chan.Language, new List<string> { "12" + name_url + "", "" + page + "", "" + username + "", url + "?diff=" + link, summary });
            }

            return GetConfig(chan, "RC.Template", "").Replace("$wiki", name_url).Replace("$url", url).Replace("$link", link).Replace("$username", username).Replace("$page", page).Replace("$summary", summary);
        }
开发者ID:reedy,项目名称:wikimedia-bot,代码行数:9,代码来源:RegularModule.cs


示例11: RecentChanges

 public RecentChanges(config.channel _channel)
 {
     channel = _channel;
     changed = false;
     Load();
     lock (rc)
     {
         rc.Add(this);
     }
 }
开发者ID:atdt,项目名称:wikimedia-bot,代码行数:10,代码来源:RC.cs


示例12: HtmlDump

 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="channel"></param>
 public HtmlDump(config.channel channel)
 {
     dumpname = config.DumpDir + "/" + channel.Name + ".htm";
     if (!System.IO.Directory.Exists(config.DumpDir))
     {
         core.Log("Creating a directory for dump");
         System.IO.Directory.CreateDirectory(config.DumpDir);
     }
     Channel = channel;
 }
开发者ID:reedy,项目名称:wikimedia-bot,代码行数:14,代码来源:HtmlDump.cs


示例13: addChannel

 /// <summary>
 /// 
 /// </summary>
 /// <param name="chan">Channel</param>
 /// <param name="user">User</param>
 /// <param name="host">Host</param>
 /// <param name="message">Message</param>
 public static void addChannel(config.channel chan, string user, string host, string message)
 {
     try
     {
         if (message.StartsWith("@add"))
         {
             if (chan.Users.isApproved(user, host, "admin"))
             {
                 if (message.Contains(" "))
                 {
                     string channel = message.Substring(message.IndexOf(" ") + 1);
                     if (!validFile(channel) || (channel.Contains("#") == false))
                     {
                         irc._SlowQueue.DeliverMessage(messages.get("InvalidName", chan.Language), chan.Name);
                         return;
                     }
                     lock (config.channels)
                     {
                         foreach (config.channel cu in config.channels)
                         {
                             if (channel == cu.Name)
                             {
                                 irc._SlowQueue.DeliverMessage(messages.get("ChannelIn", chan.Language), chan.Name);
                                 return;
                             }
                         }
                     }
                     bool existing = config.channel.channelExist(channel);
                     lock (config.channels)
                     {
                         config.channels.Add(new config.channel(channel));
                     }
                     config.Save();
                     irc.wd.WriteLine("JOIN " + channel);
                     irc.wd.Flush();
                     Thread.Sleep(100);
                     config.channel Chan = getChannel(channel);
                     if (!existing)
                     {
                         Chan.Users.addUser("admin", IRCTrust.normalize(user) + "!.*@" + IRCTrust.normalize(host));
                     }
                     return;
                 }
                 irc.Message(messages.get("InvalidName", chan.Language), chan.Name);
                 return;
             }
             irc._SlowQueue.DeliverMessage(messages.get("PermissionDenied", chan.Language), chan.Name);
             return;
         }
     }
     catch (Exception b)
     {
         handleException(b);
     }
 }
开发者ID:Giftpflanze,项目名称:wikimedia-bot,代码行数:62,代码来源:Core.cs


示例14: Extension_DumpHtml

 public override string Extension_DumpHtml(config.channel channel)
 {
     string HTML = "";
     if (Module.GetConfig(channel, "Statistics.Enabled", false))
     {
         Statistics list = (Statistics)channel.RetrieveObject(NAME);
         if (list != null)
         {
             HTML += "\n<br>\n<h4>Most active users :)</h4>\n<br>\n\n<table class=\"infobot\" width=100% border=1>";
             HTML += "<tr><td>N.</td><th>Nick</th><th>Messages (average / day)</th><th>Number of posted messages</th><th>Active since</th></tr>";
             int id = 0;
             int totalms = 0;
             DateTime startime = DateTime.Now;
             lock (list.data)
             {
                 list.data.Sort();
                 list.data.Reverse();
                 foreach (Statistics.list user in list.data)
                 {
                     id++;
                     totalms += user.messages;
                     if (id > 100)
                     {
                         continue;
                     }
                     if (startime > user.logging_since)
                     {
                         startime = user.logging_since;
                     }
                     System.TimeSpan uptime = System.DateTime.Now - user.logging_since;
                     float average = user.messages;
                     average = ((float)user.messages / (float)(uptime.Days + 1));
                     if (user.URL != "")
                     {
                         HTML += "<tr><td>" + id.ToString() + ".</td><td><a target=\"_blank\" href=\"" + user.URL + "\">" + user.user + "</a></td><td>" + average.ToString() + "</td><td>" + user.messages.ToString() + "</td><td>" + user.logging_since.ToString() + "</td></tr>";
                     }
                     else
                     {
                         HTML += "<tr><td>" + id.ToString() + ".</td><td>" + user.user + "</td><td>" + average.ToString() + "</td><td>" + user.messages.ToString() + "</td><td>" + user.logging_since.ToString() + "</td></tr>";
                     }
                     HTML += "  \n";
                 }
             }
             System.TimeSpan uptime_total = System.DateTime.Now - startime;
             float average2 = totalms;
             average2 = (float)totalms / (1 + uptime_total.Days);
             HTML += "<tr><td>N/A</td><th>Total:</th><th>" + average2.ToString() + "</th><th>" + totalms.ToString() + "</th><td>N/A</td></tr>";
             HTML += "  \n";
             HTML += "</table>";
         }
     }
     return HTML;
 }
开发者ID:atdt,项目名称:wikimedia-bot,代码行数:53,代码来源:Statistics.cs


示例15: Hook_Kick

 public override void Hook_Kick(config.channel channel, User source, User user)
 {
     Notification result = Notification.RetrieveTarget(user.Nick);
     while (result != null)
     {
         core.irc._SlowQueue.DeliverMessage(result.Source_Name + "! " + user.Nick + " just got kicked from " + channel.Name + ". This message was delivered to you because you asked me to notify you about this user's activity. For more information, see http://meta.wikimedia.org/wiki/WM-Bot", result.Source_Name, IRC.priority.low);
         lock (Notification.NotificationList)
         {
             Notification.NotificationList.Remove(result);
         }
         result = Notification.RetrieveTarget(user.Nick);
     }
 }
开发者ID:Krenair,项目名称:wikimedia-bot,代码行数:13,代码来源:NotifyUs.cs


示例16: Extension_DumpHtml

        public override string Extension_DumpHtml(config.channel channel)
        {
            string HTML = "";

            if (GetConfig(channel, "RC.Enabled", false))
            {
                RecentChanges rc = (RecentChanges)channel.RetrieveObject("RC");
                if (rc != null)
                {
                    HTML = rc.ToTable();
                }
            }
            return HTML;
        }
开发者ID:reedy,项目名称:wikimedia-bot,代码行数:14,代码来源:RegularModule.cs


示例17: Linkable

 public static bool Linkable(config.channel host, config.channel guest)
 {
     if (host == null)
     {
         return false;
     }
     if (guest == null)
     {
         return false;
     }
     if (host.sharedlink.Contains(guest))
     {
         return true;
     }
     return false;
 }
开发者ID:atdt,项目名称:wikimedia-bot,代码行数:16,代码来源:Infobot.cs


示例18: GetOp

 public void GetOp(config.channel chan)
 {
     if (!GetConfig(chan, "OP.Permanent", false))
     {
         chan.instance.irc._SlowQueue.Send("CS op " + chan.Name, IRC.priority.high);
         return;
     }
     // get our user
     User user = chan.RetrieveUser(chan.instance.Nick);
     if (user == null)
     {
         chan.instance.irc._SlowQueue.Send("CS op " + chan.Name, IRC.priority.high);
         return;
     }
     if (!user.IsOperator)
     {
         chan.instance.irc._SlowQueue.Send("CS op " + chan.Name, IRC.priority.high);
     }
 }
开发者ID:Krenair,项目名称:wikimedia-bot,代码行数:19,代码来源:Tool.cs


示例19: Extension_DumpHtml

 public override string Extension_DumpHtml(config.channel channel)
 {
     string HTML = "";
     infobot_core info = (infobot_core)channel.RetrieveObject("Infobot");
     if (info != null)
     {
         HTML += "\n<table border=1 class=\"infobot\" width=100%>\n<tr><th width=10%>Key</th><th>Value</th></tr>\n";
         List<infobot_core.InfobotKey> list = new List<infobot_core.InfobotKey>();
         info.locked = true;
         lock (info.Keys)
         {
             if (Module.GetConfig(channel, "Infobot.Sorted", false) != false)
             {
                 list = info.SortedItem();
             }
             else
             {
                 list.AddRange(info.Keys);
             }
         }
         if (info.Keys.Count > 0)
         {
             foreach (infobot_core.InfobotKey Key in list)
             {
                 HTML += core.HTML.AddKey(Key.Key, Key.Text);
             }
         }
         HTML += "</table>\n";
         HTML += "<h4>Aliases</h4>\n<table class=\"infobot\" border=1 width=100%>\n";
         lock (info.Alias)
         {
             foreach (infobot_core.InfobotAlias data in info.Alias)
             {
                 HTML += core.HTML.AddLink(data.Name, data.Key);
             }
         }
         HTML += "</table><br>\n";
         info.locked = false;
     }
     return HTML;
 }
开发者ID:atdt,项目名称:wikimedia-bot,代码行数:41,代码来源:Plugin.cs


示例20: Hook_PRIV

        public override void Hook_PRIV(config.channel channel, User invoker, string message)
        {
            chanLog(message, channel, invoker.Nick, invoker.Host);
            if (message == "@logon")
            {
                if (channel.Users.isApproved(invoker.Nick, invoker.Host, "admin"))
                {
                    if (Module.GetConfig(channel, "Logging.Enabled", false))
                    {
                        core.irc._SlowQueue.DeliverMessage(messages.get("ChannelLogged", channel.Language), channel.Name);
                        return;
                    }
                    else
                    {
                        core.irc._SlowQueue.DeliverMessage(messages.get("LoggingOn", channel.Language), channel.Name);
                        Module.SetConfig(channel, "Logging.Enabled", true);
                        channel.SaveConfig();
                        return;
                    }
                }
                if (!channel.suppress_warnings)
                {
                    core.irc._SlowQueue.DeliverMessage(messages.get("PermissionDenied", channel.Language), channel.Name, IRC.priority.low);
                }
                return;
            }

            if (message == "@logoff")
            {
                if (channel.Users.isApproved(invoker.Nick, invoker.Host, "admin"))
                {
                    if (!Module.GetConfig(channel, "Logging.Enabled", false))
                    {
                        core.irc._SlowQueue.DeliverMessage(messages.get("LogsE1", channel.Language), channel.Name);
                        return;
                    }
                    else
                    {
                        Module.SetConfig(channel, "Logging.Enabled", false);
                        channel.SaveConfig();
                        core.irc._SlowQueue.DeliverMessage(messages.get("NotLogged", channel.Language), channel.Name);
                        return;
                    }
                }
                if (!channel.suppress_warnings)
                {
                    core.irc._SlowQueue.DeliverMessage(messages.get("PermissionDenied", channel.Language), channel.Name, IRC.priority.low);
                }
                return;
            }
        }
开发者ID:reedy,项目名称:wikimedia-bot,代码行数:51,代码来源:Plugin.cs



注:本文中的wmib.config类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Service.ContentPostService类代码示例发布时间:2022-05-26
下一篇:
C# wmib.User类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap