本文整理汇总了C#中Server.StartServer方法的典型用法代码示例。如果您正苦于以下问题:C# Server.StartServer方法的具体用法?C# Server.StartServer怎么用?C# Server.StartServer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Server
的用法示例。
在下文中一共展示了Server.StartServer方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
private static void Main()
{
Console.Title = "Ultrapowa Clash Proxy v" + Assembly.GetExecutingAssembly().GetName().Version;
Console.WriteLine(
@"
888 888 888 88888888888 8888888b. d8888 8888888b. .d88888b. 888 888 d8888
888 888 888 888 888 Y88b d88888 888 Y88b d88P' 'Y88b 888 o 888 d88888
888 888 888 888 888 888 d88P888 888 888 888 888 888 d8b 888 d88P888
888 888 888 888 888 d88P d88P 888 888 d88P 888 888 888 d888b 888 d88P 888
888 888 888 888 8888888P' d88P 888 8888888P' 888 888 888d88888b888 d88P 888
888 888 888 888 888 T88b d88P 888 888 888 888 88888P Y88888 d88P 888
Y88b. .d88P 888 888 888 T88b d8888888888 888 Y88b. .d88P 8888P Y8888 d8888888888
'Y88888P' 88888888 888 888 T88b d88P 888 888 'Y88888P' 888P Y888 d88P 888
");
Console.WriteLine("[UCR] -> This Program is made by the Ultrapowa Network Developer Team!");
Console.WriteLine(
"[UCR] -> You can find the source at www.ultrapowa.com and www.github.com/ultrapowa/ucs");
Console.WriteLine("[UCR] -> Don't forget to visit www.ultrapowa.com daily for news update !");
Console.WriteLine("[UCR] -> UCS Proxy is now starting...");
Console.WriteLine();
try
{
var server = new Server(port);
server.StartServer();
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
}
}
示例2: ConnectAndPing
public void ConnectAndPing()
{
var server = new Server<Server.ChatService, IChatService>("localhost", "12345", "IntegrationTest");
server.StartServer();
var client = new Client<IChatService>("localhost", "12345", "IntegrationTest");
client.Connect();
client.GetService().Ping();
client.Disconnect();
server.StopServer();
}
示例3: Main
static void Main(string[] args)
{
try
{
//Setup error handling for unmanaged exceptions
AppDomain.CurrentDomain.UnhandledException += AppDomain_UnhandledException;
Application.ThreadException += Application_ThreadException;
Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
//Setup the default args
CommandLineArgs extenderArgs = new CommandLineArgs();
extenderArgs.autoStart = false;
extenderArgs.worldName = "";
extenderArgs.instanceName = "";
extenderArgs.noGUI = false;
extenderArgs.noConsole = false;
extenderArgs.debug = false;
extenderArgs.gamePath = "";
//Process the args
foreach (string arg in args)
{
if (arg.Split('=').Length > 1)
{
string argName = arg.Split('=')[0];
string argValue = arg.Split('=')[1];
Console.WriteLine("Name-Value Arg: name='" + argName + "' value='" + argValue + "'");
if (argName.ToLower().Equals("instance"))
{
extenderArgs.instanceName = argValue;
}
if (argName.ToLower().Equals("gamepath"))
{
extenderArgs.gamePath = argValue;
}
}
else
{
if (arg.ToLower().Equals("autostart"))
{
extenderArgs.autoStart = true;
}
if (arg.ToLower().Equals("nogui"))
{
extenderArgs.noGUI = true;
//Implies autostart
extenderArgs.autoStart = true;
}
if (arg.ToLower().Equals("noconsole"))
{
extenderArgs.noGUI = true;
//Implies nogui and autostart
extenderArgs.noGUI = true;
extenderArgs.autoStart = true;
}
if (arg.ToLower().Equals("debug"))
{
extenderArgs.debug = true;
}
}
}
m_server = new Server(extenderArgs);
if (extenderArgs.autoStart)
{
m_server.StartServer();
}
if (!extenderArgs.noGUI)
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
m_serverExtenderForm = new SEServerExtender(m_server);
Application.Run(m_serverExtenderForm);
}
}
catch (AutoException eEx)
{
Console.WriteLine("AutoException - " + eEx.AdditionnalInfo + "\n\r" + eEx.GetDebugString());
MessageBox.Show(eEx.AdditionnalInfo + "\n\r" + eEx.GetDebugString(), @"SEServerExtender", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
catch (TargetInvocationException ex)
{
Console.WriteLine("TargetInvocationException - " + ex.ToString() + "\n\r" + ex.InnerException.ToString());
MessageBox.Show(ex.ToString() + "\n\r" + ex.InnerException.ToString(), @"SEServerExtender", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
catch (Exception ex)
{
Console.WriteLine("Exception - " + ex.ToString());
MessageBox.Show(ex.ToString(), @"SEServerExtender", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}