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


C# Main.SetWorldName方法代碼示例

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


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

示例1: Main

 private static void Main(string[] args)
 {
     try
     {
         Game = new Main();
         for (int i = 0; i < args.Length; i++)
         {
             switch (args[i].ToLower())
             {
                 case "-config":
                     i++;
                     Game.LoadDedConfig(args[i]);
                     break;
                 case "-port":
                     i++;
                     try
                     {
                         int serverPort = Convert.ToInt32(args[i]);
                         Netplay.serverPort = serverPort;
                     }
                     catch
                     {
                     }
                     break;
                 case "-world":
                     i++;
                     Game.SetWorld(args[i]);
                     break;
                 case "-worldname":
                     i++;
                     Game.SetWorldName(args[i]);
                     break;
                 case "-autoshutdown":
                     Game.autoShut();
                     break;
                 case "-autocreate":
                     i++;
                     string newOpt = args[i];
                     Game.autoCreate(newOpt);
                     break;
                 case "-ip":
                     IPAddress ip;
                     if (IPAddress.TryParse(args[++i], out ip))
                     {
                         Netplay.serverListenIP = ip;
                         Console.Write("Using IP: {0}", ip);
                     }
                     else
                         Console.WriteLine("Bad IP: {0}", args[i]);
                     break;
                 case "-connperip":
                     int limit;
                     if (int.TryParse(args[++i], out limit))
                     {
                         Netplay.connectionLimit = limit;
                         Console.WriteLine("Each IP is now limited to {0} connections", limit);
                     }
                     else
                     Console.WriteLine("Bad int for -connperip");
                     break;
                 case "-killinactivesocket":
                     Netplay.killInactive = true;
                     break;
                 case "-lang":
                     Lang.lang = Convert.ToInt32(args[++i]);
                     break;
                 case "-ignoreversion":
                     IgnoreVersion = true;
                     Console.WriteLine("WARNING: Versions are no longer being regarded!");
                     Console.WriteLine("You are on your own! If problems arise, TShock developers will not help you with issues regarding this.");
                     break;
             }
         }
         if (Environment.OSVersion.Platform == PlatformID.Unix)
             Terraria.Main.SavePath = "Terraria";
         else
             Terraria.Main.SavePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), "My Games", "Terraria");
         Terraria.Main.WorldPath = Path.Combine(Terraria.Main.SavePath, "Worlds");
         Terraria.Main.PlayerPath = Path.Combine(Terraria.Main.SavePath, "Players");
         Initialize(Game);
         Game.DedServ();
         DeInitialize();
     }
     catch (Exception value)
     {
         try
         {
             using (var streamWriter = new StreamWriter("crashlog.txt", true))
             {
                 streamWriter.WriteLine(DateTime.Now);
                 streamWriter.WriteLine(value);
                 streamWriter.WriteLine("");
             }
             Console.WriteLine("Server crash: " + DateTime.Now);
             Console.WriteLine(value);
             Console.WriteLine("");
             Console.WriteLine("Please send crashlog.txt to [email protected]");
         }
         catch
         {
//.........這裏部分代碼省略.........
開發者ID:k0rd,項目名稱:TerrariaAPI-Server,代碼行數:101,代碼來源:ProgramServer.cs

示例2: Main

 private static void Main(string[] args)
 {
     //Process currentProcess = Process.GetCurrentProcess();
     //currentProcess.PriorityClass = ProcessPriorityClass.High;
     game = new Main();
     for (int i = 0; i < args.Length; i++)
     {
         if (args[i].ToLower() == "-config")
         {
             i++;
             game.LoadDedConfig(args[i]);
         }
         if (args[i].ToLower() == "-port")
         {
             i++;
             try
             {
                 int serverPort = Convert.ToInt32(args[i]);
                 Netplay.ListenPort = serverPort;
             }
             catch
             {
             }
         }
         if (args[i].ToLower() == "-players" || args[i].ToLower() == "-maxplayers")
         {
             i++;
             try
             {
                 int netPlayers = Convert.ToInt32(args[i]);
                 game.SetNetPlayers(netPlayers);
             }
             catch
             {
             }
         }
         if (args[i].ToLower() == "-pass" || args[i].ToLower() == "-password")
         {
             i++;
             Netplay.ServerPassword = args[i];
         }
         if (args[i].ToLower() == "-lang")
         {
             i++;
             Lang.lang = Convert.ToInt32(args[i]);
         }
         if (args[i].ToLower() == "-world")
         {
             i++;
             game.SetWorld(args[i], false);
         }
         if (args[i].ToLower() == "-worldname")
         {
             i++;
             game.SetWorldName(args[i]);
         }
         if (args[i].ToLower() == "-motd")
         {
             i++;
             game.NewMOTD(args[i]);
         }
         if (args[i].ToLower() == "-banlist")
         {
             i++;
             Netplay.BanFilePath = args[i];
         }
         if (args[i].ToLower() == "-autoshutdown")
         {
             game.autoShut();
         }
         if (args[i].ToLower() == "-secure")
         {
             Netplay.spamCheck = true;
         }
         if (args[i].ToLower() == "-autocreate")
         {
             i++;
             string newOpt = args[i];
             game.autoCreate(newOpt);
         }
         if (args[i].ToLower() == "-loadlib")
         {
             i++;
             string path = args[i];
             game.loadLib(path);
         }
         if (args[i].ToLower() == "-noupnp")
         {
             Netplay.UseUPNP = false;
         }
     }
     game.DedServ();
 }
開發者ID:VanixxGraphix,項目名稱:Terraria-s-Dedicated-Server-Mod,代碼行數:93,代碼來源:ServerEntry.cs


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