Exemplo n.º 1
0
        public Form1()
        {
            Cursor cursor = new Cursor(GetType(), "Ankh.CUR");

            this.Icon = global::Library.Properties.Resources.potm;

            this.manager = UpdateManager.Instance;
            this.conf = Configuration.Load();

            InitializeComponent();
            this.Cursor = cursor;

            lblPlayers.BackColor = Color.Transparent;
            lblPlayers.ForeColor = Color.White;
            lblPlayers.Cursor = cursor;

            txtPlayers.BackColor = Color.Transparent;
            txtPlayers.ForeColor = Color.White;
            txtPlayers.Cursor = cursor;

            lblServerIP.BackColor = Color.Transparent;
            lblServerIP.ForeColor = Color.White;
            lblServerIP.Cursor = cursor;

            txtServerIP.BackColor = Color.Transparent;
            txtServerIP.ForeColor = Color.White;
            txtServerIP.Cursor = cursor;

            lblServerStatus.BackColor = Color.Transparent;
            lblServerStatus.ForeColor = Color.White;
            lblServerStatus.Cursor = cursor;

            txtServerStatus.BackColor = Color.Transparent;
            txtServerStatus.ForeColor = Color.White;
            txtServerStatus.Cursor = cursor;

            CenterToScreen();

            this.txtServerIP.Text = ip + ":" + port;

            this.picClickOnline(null, null);
            this.txtPlayers.Text = "";
            this.txtServerStatus.Text = "";

            this.PopulateCheckbox();
            this.checkGameInstall();

            if (this._gameFound == false)
            {
                this.picUpdateClient.Enabled = false;
                this.picJoinServer.Enabled = false;
            }

            this.Width = formMinWidth;
        }
Exemplo n.º 2
0
        public static Configuration Load()
        {
            Configuration conf = new Configuration();

            try
            {
                using (FileStream reader = new FileStream("configuration.xml", FileMode.Open, FileAccess.Read))
                {
                    XmlSerializer xmlSerializer = new XmlSerializer(typeof(Configuration));

                    conf = xmlSerializer.Deserialize(reader) as Configuration;
                }
            }
            catch (FileNotFoundException ex) { }
            catch (Exception ex) { MessageBox.Show("Error; " + ex.Message); }

            conf.Save();

            return conf;
        }