本文整理汇总了C#中Terraria.Main.AutoHost方法的典型用法代码示例。如果您正苦于以下问题:C# Main.AutoHost方法的具体用法?C# Main.AutoHost怎么用?C# Main.AutoHost使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Terraria.Main
的用法示例。
在下文中一共展示了Main.AutoHost方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
private static void Main(string[] args)
{
using (Main main = new Main())
{
try
{
for (int i = 0; i < args.Length; i++)
{
if (args[i].ToLower() == "-port" || args[i].ToLower() == "-p")
{
i++;
try
{
int serverPort = Convert.ToInt32(args[i]);
Netplay.serverPort = serverPort;
}
catch
{
}
}
if (args[i].ToLower() == "-join" || args[i].ToLower() == "-j")
{
i++;
try
{
main.AutoJoin(args[i]);
}
catch
{
}
}
if (args[i].ToLower() == "-pass" || args[i].ToLower() == "-password")
{
i++;
Netplay.password = args[i];
main.AutoPass();
}
if (args[i].ToLower() == "-host")
{
main.AutoHost();
}
if (args[i].ToLower() == "-loadlib")
{
i++;
string path = args[i];
main.loadLib(path);
}
}
Steam.Init();
if (Steam.SteamInit)
{
main.Run();
}
else
{
MessageBox.Show("Please launch the game from your Steam client.", "Error");
}
}
catch (Exception ex)
{
try
{
using (StreamWriter streamWriter = new StreamWriter("client-crashlog.txt", true))
{
streamWriter.WriteLine(DateTime.Now);
streamWriter.WriteLine(ex);
streamWriter.WriteLine("/n");
}
MessageBox.Show(ex.ToString(), "Terraria: Error");
}
catch
{
}
}
}
}
示例2: Main
private static void Main(string[] args)
{
if (1 == 1)
{
PlayerStates test = new PlayerStates(null);
//DedicatedConfig.test();
return;
}
using (Main main = new Main())
{
try
{
for (int i = 0; i < args.Length; i++)
{
if (args[i].ToLower() == "-port" || args[i].ToLower() == "-p")
{
i++;
try
{
int serverPort = Convert.ToInt32(args[i]);
Netplay.serverPort = serverPort;
}
catch
{
}
}
if (args[i].ToLower() == "-join" || args[i].ToLower() == "-j")
{
i++;
try
{
main.AutoJoin(args[i]);
}
catch
{
}
}
if (args[i].ToLower() == "-pass" || args[i].ToLower() == "-password")
{
i++;
Netplay.password = args[i];
main.AutoPass();
}
if (args[i].ToLower() == "-host")
{
main.AutoHost();
}
if (args[i].ToLower() == "-loadlib")
{
i++;
string path = args[i];
main.loadLib(path);
}
}
main.Run();
}
catch (Exception ex)
{
try
{
using (StreamWriter streamWriter = new StreamWriter("client-crashlog.txt", true))
{
streamWriter.WriteLine(DateTime.Now);
streamWriter.WriteLine(ex);
streamWriter.WriteLine("");
}
MessageBox.Show(ex.ToString(), "Terraria: Error");
}
catch
{
}
}
}
}
示例3: Main
public static void Main(string[] args)
{
try
{
using (Main main = new Main())
{
Program.LaunchParameters = Utils.ParseArguements(args);
for (int i = 0; i < args.Length; i++)
{
if (args[i].ToLower() == "-port" || args[i].ToLower() == "-p")
{
i++;
try
{
int listenPort = Convert.ToInt32(args[i]);
Netplay.ListenPort = listenPort;
}
catch { }
}
if (args[i].ToLower() == "-join" || args[i].ToLower() == "-j")
{
i++;
try
{
main.AutoJoin(args[i]);
}
catch { }
}
if (args[i].ToLower() == "-pass" || args[i].ToLower() == "-password")
{
i++;
Netplay.ServerPassword = args[i];
main.AutoPass();
}
if (args[i].ToLower() == "-host")
{
main.AutoHost();
}
if (args[i].ToLower() == "-loadlib")
{
i++;
string path = args[i];
main.loadLib(path);
}
}
main.Run();
}
}
catch (Exception ex)
{
try
{
using (StreamWriter streamWriter = new StreamWriter("client-crashlog.txt", true))
{
streamWriter.WriteLine(DateTime.Now);
streamWriter.WriteLine(ex);
streamWriter.WriteLine("");
}
MessageBox.Show(ex.ToString(), "Terraria: Error");
}
catch { }
}
}