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


C# Server.StartServer方法代码示例

本文整理汇总了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());
            }
        }
开发者ID:tempdban,项目名称:UCR-1,代码行数:31,代码来源:Program.cs

示例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();
        }
开发者ID:DeathlyEnterprises,项目名称:De.ChatService,代码行数:12,代码来源:ChatServiceIntegrationTests.cs

示例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);
            }
        }
开发者ID:jopitan,项目名称:SE-Community-Mod-API,代码行数:96,代码来源:Program.cs


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