當前位置: 首頁>>代碼示例>>C#>>正文


C# config.Remove方法代碼示例

本文整理匯總了C#中wmib.config.Remove方法的典型用法代碼示例。如果您正苦於以下問題:C# config.Remove方法的具體用法?C# config.Remove怎麽用?C# config.Remove使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在wmib.config的用法示例。


在下文中一共展示了config.Remove方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: partChannel

 /// <summary>
 /// Part a channel
 /// </summary>
 /// <param name="chan">Channel object</param>
 /// <param name="user">User</param>
 /// <param name="host">Host</param>
 /// <param name="message">Message</param>
 /// <param name="origin"></param>
 public static void partChannel(config.channel chan, string user, string host, string message, string origin = "NULL")
 {
     try
     {
         if (origin == "NULL")
         {
             origin = chan.Name;
         }
         if (message == config.CommandPrefix + "drop")
         {
             if (chan.Users.IsApproved(user, host, "admin"))
             {
                 while (!core.FinishedJoining)
                 {
                     core.Log("Postponing request to part " + chan.Name + " because bot is still loading", true);
                     Thread.Sleep(2000);
                 }
                 chan.instance.irc.SendData("PART " + chan.Name + " :" + "dropped by " + user + " from " + origin);
                 Program.Log("Dropped " + chan.Name + " dropped by " + user + " from " + origin);
                 Thread.Sleep(100);
                 try
                 {
                     if (Directory.Exists(chan.LogDir))
                     {
                         Directory.Delete(chan.LogDir, true);
                     }
                 }
                 catch (Exception fail)
                 {
                     Log(fail.ToString(), true);
                 }
                 try
                 {
                     File.Delete(variables.config + Path.DirectorySeparatorChar + chan.Name + ".setting");
                     File.Delete(chan.Users.File);
                     if (File.Exists(variables.config + Path.DirectorySeparatorChar + chan.Name + ".list"))
                     {
                         File.Delete(variables.config + Path.DirectorySeparatorChar + chan.Name + ".list");
                     }
                     if (File.Exists(variables.config + Path.DirectorySeparatorChar + chan.Name + ".statistics"))
                     {
                         File.Delete(variables.config + Path.DirectorySeparatorChar + chan.Name + ".statistics");
                     }
                     lock (Module.module)
                     {
                         foreach (Module curr in Module.module)
                         {
                             try
                             {
                                 if (curr.working)
                                 {
                                     curr.Hook_ChannelDrop(chan);
                                 }
                             }
                             catch (Exception fail)
                             {
                                 core.Log("MODULE: exception at Hook_ChannelDrop in " + curr.Name, true);
                                 core.handleException(fail);
                             }
                         }
                     }
                 }
                 catch (Exception error)
                 {
                     Log(error.ToString(), true);
                 }
                 lock (config.channels)
                 {
                     chan.Remove();
                     config.channels.Remove(chan);
                 }
                 config.Save();
                 return;
             }
             irc._SlowQueue.DeliverMessage(messages.get("PermissionDenied", chan.Language), origin);
             return;
         }
         if (message == config.CommandPrefix + "part")
         {
             if (chan.Users.IsApproved(user, host, "admin"))
             {
                 while (!core.FinishedJoining)
                 {
                     core.Log("Postponing request to part " + chan.Name + " because bot is still loading", true);
                     Thread.Sleep(2000);
                 }
                 chan.instance.irc.SendData("PART " + chan.Name + " :" + "removed by " + user + " from " + origin);
                 Program.Log("Removed " + chan.Name + " removed by " + user + " from " + origin);
                 Thread.Sleep(100);
                 config.channels.Remove(chan);
                 config.Save();
                 return;
//.........這裏部分代碼省略.........
開發者ID:Krenair,項目名稱:wikimedia-bot,代碼行數:101,代碼來源:Channels_Core.cs


注:本文中的wmib.config.Remove方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。