Example #1
0
        static StartInfo()
        {
            if (ConfigEx.GetElement(true, "ShowWelcome"))
            {
                WelcomeFormEx form = new WelcomeFormEx();
                if (form.ShowDialog() != DialogResult.OK)
                    Environment.Exit(0);

                ConfigEx.SetElement(form.Client, "Client");
                ConfigEx.SetElement(form.Server, "Server");
                ConfigEx.SetElement(form.Port, "Port");
            }

            ClientPath = ConfigEx.GetElement(string.Empty, "Client");
            if (!File.Exists(ClientPath) || Path.GetExtension(ClientPath) != ".exe")
                throw new Exception("Selected client path not found!");

            Port = ConfigEx.GetElement(-1, "Port");
            if (Port < 0 || Port > 0xFFFF)
                throw new Exception("Invalid port!");

            Server = Engine.Resolve(ConfigEx.GetElement(string.Empty, "Server"));
            if (Equals(Server, IPAddress.None))
                throw new Exception("Invalid server address!");
        }
Example #2
0
        static StartInfo()
        {
            if (ConfigEx.GetElement(true, "ShowWelcome"))
            {
                WelcomeFormEx form = new WelcomeFormEx();
                if (form.ShowDialog() != DialogResult.OK)
                {
                    Environment.Exit(0);
                }

                ConfigEx.SetElement(form.Client, "Client");
                ConfigEx.SetElement(form.Server, "Server");
                ConfigEx.SetElement(form.Port, "Port");
            }

            ClientPath = ConfigEx.GetElement(string.Empty, "Client");
            if (!File.Exists(ClientPath) || Path.GetExtension(ClientPath) != ".exe")
            {
                throw new Exception("Selected client path not found!");
            }

            Port = ConfigEx.GetElement(-1, "Port");
            if (Port < 0 || Port > 0xFFFF)
            {
                throw new Exception("Invalid port!");
            }

            Server = Engine.Resolve(ConfigEx.GetElement(string.Empty, "Server"));
            if (Equals(Server, IPAddress.None))
            {
                throw new Exception("Invalid server address!");
            }
        }