Exemplo n.º 1
0
        private void Initialize()
        {
            this.Log("");
            this.Log("\t- WvsCenter v{0}.{1} -", Constants.MapleVersion, Constants.PatchLocation);
            this.Log("");

            try
            {
                this.Loga("Initializing Center Server... ");
                CenterServer.Initialize();
                this.Log("Done.");

                this.Loga("Initializing Ranking Calculator... ");
                this.Log("Done.");

                new Delay(15 * 1000, () =>
                {
                    GC.Collect(GC.MaxGeneration, GCCollectionMode.Optimized);
                }).Execute();

                this.Log("");

                this.Invoke(new MethodInvoker(() =>
                {
                    this.Text += string.Format(" ({0})", Program.ConfigurationFile);
                    this.RefreshServerList();
                }));
            }
            catch (Exception e)
            {
                this.Log("Unable to initialize.");
                this.Log(e.ToString());
            }
        }
Exemplo n.º 2
0
        public static void ConnectCenterServer()
        {
            if (CenterServer == null)
            {
                CenterServer = new CenterServer(string.Format("中心服务器({0}:{1})", GSConfigMgr.Configuration.CenterServerIP, GSConfigMgr.Configuration.CenterServerPort));
            }

            CenterServer.Connect(GSConfigMgr.Configuration.CenterServerIP, GSConfigMgr.Configuration.CenterServerPort);
        }
Exemplo n.º 3
0
 public bool StartCenter()
 {
     if (!CenterStatus)
     {
         new Thread(() => { CenterServer.StartServer(); }).Start();
         return(true);
     }
     else
     {
         return(false);
     }
 }
Exemplo n.º 4
0
        public void OnAction(System.Collections.Hashtable parameters)
        {
            System.Console.WriteLine("This server GunnyII, edit and build by MrPhuong!");
            System.Console.WriteLine("Starting GameServer ... please wait a moment!");
            CenterServer.CreateInstance(new CenterServerConfig());
            ConsoleStart.StartServer();
            ConsoleClient client = new ConsoleClient();
            bool          flag   = true;

            while (flag)
            {
                try
                {
                    System.Console.Write("> ");
                    string   text  = System.Console.ReadLine();
                    string[] array = text.Split(new char[]
                    {
                        '&'
                    });
                    string key;
                    switch (key = array[0].ToLower())
                    {
                    case "exit":
                        flag = false;
                        continue;

                    case "notice":
                        if (array.Length < 2)
                        {
                            System.Console.WriteLine("公告需要公告内容,用&隔开!");
                            continue;
                        }
                        CenterServer.Instance.SendSystemNotice(array[1]);
                        continue;

                    case "reload":
                        if (array.Length < 2)
                        {
                            System.Console.WriteLine("加载需要指定表,用&隔开!");
                            continue;
                        }
                        CenterServer.Instance.SendReload(array[1]);
                        continue;

                    case "shutdown":
                        CenterServer.Instance.SendShutdown();
                        continue;

                    case "help":
                        System.Console.WriteLine(this.HelpStr);
                        continue;

                    case "AAS":
                        if (array.Length < 2)
                        {
                            System.Console.WriteLine("加载需要指定状态true or false,用&隔开!");
                            continue;
                        }
                        CenterServer.Instance.SendAAS(bool.Parse(array[1]));
                        continue;
                    }
                    if (text.Length > 0)
                    {
                        if (text[0] == '/')
                        {
                            text = text.Remove(0, 1);
                            text = text.Insert(0, "&");
                        }
                        try
                        {
                            if (!CommandMgr.HandleCommandNoPlvl(client, text))
                            {
                                System.Console.WriteLine("Unknown command: " + text);
                            }
                        }
                        catch (System.Exception ex)
                        {
                            System.Console.WriteLine(ex.ToString());
                        }
                    }
                }
                catch (System.Exception ex2)
                {
                    System.Console.WriteLine("Error:" + ex2.ToString());
                }
            }
            if (CenterServer.Instance != null)
            {
                CenterServer.Instance.Stop();
            }
        }
Exemplo n.º 5
0
 void Awake()
 {
     centerServer = GameObject.Find("Center").GetComponent <CenterServer>();
     faceControl  = GameObject.Find("Face").GetComponent <FaceControl>();
     startClient("192.168.1.168", 5002);
 }
Exemplo n.º 6
0
        /// <summary>
        /// Handles the server action
        /// </summary>
        /// <param name="parameters"></param>
        public void OnAction(Hashtable parameters)
        {
            Console.WriteLine("Starting GameServer ... please wait a moment!");
            CenterServer.CreateInstance(new CenterServerConfig());
            StartServer();

            ConsoleClient client = new ConsoleClient();
            bool          run    = true;

            while (run)
            {
                try
                {
                    Console.Write("> ");
                    string   line = Console.ReadLine();
                    string[] para = line.Split('&');

                    switch (para[0].ToLower())
                    {
                    case "exit": run = false; break;

                    case "notice":
                        if (para.Length < 2)
                        {
                            Console.WriteLine("公告需要公告内容,用&隔开!");
                        }
                        else
                        {
                            CenterServer.Instance.SendSystemNotice(para[1]);
                        }
                        break;

                    case "reload":
                        if (para.Length < 2)
                        {
                            Console.WriteLine("加载需要指定表,用&隔开!");
                        }
                        else
                        {
                            CenterServer.Instance.SendReload(para[1]);
                        }
                        //ServerMgr.ReLoadServerList();
                        break;

                    case "shutdown":
                        CenterServer.Instance.SendShutdown();
                        break;

                    case "help":
                        Console.WriteLine(HelpStr);
                        break;

                    case "AAS":
                        if (para.Length < 2)
                        {
                            Console.WriteLine("加载需要指定状态true or false,用&隔开!");
                        }
                        else
                        {
                            CenterServer.Instance.SendAAS(bool.Parse(para[1]));
                        }
                        break;

                    default:
                        if (line.Length <= 0)
                        {
                            break;
                        }
                        if (line[0] == '/')
                        {
                            line = line.Remove(0, 1);
                            line = line.Insert(0, "&");
                        }

                        try
                        {
                            bool res = CommandMgr.HandleCommandNoPlvl(client, line);
                            if (!res)
                            {
                                Console.WriteLine("Unknown command: " + line);
                            }
                        }
                        catch (Exception e)
                        {
                            Console.WriteLine(e.ToString());
                        }
                        break;
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine("Error:" + ex.ToString());
                }
            }

            if (CenterServer.Instance != null)
            {
                CenterServer.Instance.Stop();
            }
        }
Exemplo n.º 7
0
 void Awake()
 {
     centerServer = GameObject.Find("Center").GetComponent <CenterServer>();
     faceControl  = GameObject.Find("Face").GetComponent <FaceControl>();
     startServer(5001);
 }
Exemplo n.º 8
0
 private static void ConnectCenter()
 {
     Center = new CenterServer(CenterIP.ToString(), CenterPort);
     Center.Connect();
 }
Exemplo n.º 9
0
 private static void ConnectCenter()
 {
     Center = new CenterServer(PrivateIP.ToString(), 8383); // NOTE: Is a constant value needed for this?
     Center.Connect();
 }