예제 #1
0
        private void WelcomeForm_Load(object sender, System.EventArgs e)
        {
            Language.LoadControlNames(this);

            this.BringToFront();

            langSel.Items.AddRange(Language.GetPackNames());
            langSel.SelectedItem = Language.Current;

            showAtStart.Checked = Config.GetAppSetting <int>("ShowWelcome") == 1;

            uoClient.Text = Config.GetAppSetting <string>("UOClient");
            dataDir.Text  = Config.GetAppSetting <string>("UODataDir");

            IsValidClientAndDataDir();

            patchEncy.Checked = Config.GetAppSetting <int>("PatchEncy") != 0;

            LoginCFG_SE lse = new LoginCFG_SE();
            Custom_SE   cse;

            serverList.BeginUpdate();

            AddUORServers();

            // Load any custom servers they might have added
            NameValueCollection servers =
                (NameValueCollection)ConfigurationManager.GetSection("Servers");

            foreach (string server in servers.AllKeys)
            {
                string[] serverHostAndPort = servers[server].Split(',');
                string   serverHost        = serverHostAndPort[0];
                string   serverPort        = serverHostAndPort[1];

                serverList.Items.Add(new Custom_SE(server, serverHost, Convert.ToInt32(serverPort)));
            }

            serverList.EndUpdate();
            serverList.Refresh();

            // Set it to the last used one, or just set it to default UOR Prod
            try
            {
                serverList.SelectedIndex = Config.GetAppSetting <int>("LastServerId");
            }
            catch
            {
                serverList.SelectedIndex = 0;
            }

            WindowState = FormWindowState.Normal;
            this.BringToFront();
            this.TopMost = true;

            _ShowTimer          = new System.Windows.Forms.Timer();
            _ShowTimer.Interval = 250;
            _ShowTimer.Enabled  = true;
            _ShowTimer.Tick    += new EventHandler(timer_Tick);


            if (Config.GetAppSetting <bool>("ImportProfilesAndMacros"))
            {
                string appDataDir = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Razor");

                if (Directory.Exists(appDataDir))
                {
                    if (MessageBox.Show(Language.GetString(LocString.ImportFromPrevious), "Import Razor Profiles and Macros",
                                        MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        Config.ImportProfilesMacros(appDataDir);

                        MessageBox.Show("Import complete", "Import Razor Profiles and Macros", MessageBoxButtons.OK);
                    }
                }

                Config.SetAppSetting("ImportProfilesAndMacros", "false");
            }
        }