本文整理汇总了C#中Terraria.Main.autoShut方法的典型用法代码示例。如果您正苦于以下问题:C# Main.autoShut方法的具体用法?C# Main.autoShut怎么用?C# Main.autoShut使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Terraria.Main
的用法示例。
在下文中一共展示了Main.autoShut方法的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
{
//.........这里部分代码省略.........
示例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();
}