當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。