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


C# Mod.Save方法代码示例

本文整理汇总了C#中Mod.Save方法的典型用法代码示例。如果您正苦于以下问题:C# Mod.Save方法的具体用法?C# Mod.Save怎么用?C# Mod.Save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mod的用法示例。


在下文中一共展示了Mod.Save方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SimpleConsoleInputHandler

 public void SimpleConsoleInputHandler()
 {
     MinecraftModUpdater.Logger.Log(Logger.Level.Info,"Simple Console Input Handler is online and ready.  \r\nEnter \"help\" for a list of commands.");
     while (Online)
     {
         string input = Console.ReadLine();
         if (!Online) break;
         switch (input)
         {
             case "connected":
                 MinecraftModUpdater.Logger.Log(Logger.Level.Info,"There are {0} connected clients.", Clients.Count);
                 if (Clients.Count > 0)
                 {
                     MinecraftModUpdater.Logger.Log(Logger.Level.Info,"Connected Clients:");
                     foreach (Client c in Clients)
                     {
                         MinecraftModUpdater.Logger.Log(Logger.Level.Info,c.ToString());
                     }
                 }
                 break;
             case "exit":
             case "stop":
                 foreach (Client c in Clients)
                 {
                     Packet.Send(new MetadataPacket { SData = new string[] { "shutdown", "The Server is shutting down." } }, c.PacketHandler.Stream);
                 }
                 if (Clients.Count > 0) MinecraftModUpdater.Logger.Log(Logger.Level.Info,"Waiting for {0} clients to exit.", Clients.Count);
                 while (Clients.Count > 0) Thread.Sleep(500);
                 Dispose();
                 break;
             case "populate":
                 foreach(string s in Directory.GetFiles(Config.ModsPath + "/mods"))
                 {
                     Mod m = new Mod
                     {
                         Author = "null",
                         Description = "",
                         FileSize = 0,
                         ModFile = "mods/" + Path.GetFileName(s),
                         ModName = Path.GetFileName(s),
                         BlacklistedUsers = new List<string>(),
                         WhitelistedUsers = new List<string>(),
                         PostDownloadCLI = new string[0],
                         Identifier = Extras.GenerateHashFromString(Path.GetFileName(s)),
                         ConfigFile = Config.ModsPath + "/xml/" + Path.GetFileName(s) + ".xml",
                         RequiredMods = new List<Mod>()
                     };
                     m.Save();
                 }
                 Mods.Clear();
                 ModImages.Clear();
                 LoadMods();
                 break;
             case "help":
             case "?":
             default:
                 MinecraftModUpdater.Logger.Log(Logger.Level.Info,"exit, stop - Safely stops the update server after all clients exit.");
                 MinecraftModUpdater.Logger.Log(Logger.Level.Info,"connected - Shows a list of connected clients.");
                 MinecraftModUpdater.Logger.Log(Logger.Level.Info,"populate - Automagicly reads all of the files in the mods folder and creates XML files for them.");
                 break;
         }
     }
 }
开发者ID:seaboy1234,项目名称:Minecraft-Mod-Updater,代码行数:63,代码来源:Server.cs


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