当前位置: 首页>>代码示例>>C#>>正文


C# wmib.config类代码示例

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


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


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