Exemplo n.º 1
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            string s = Environment.CommandLine;
            if (!File.Exists("FFXI_ME_v2.chm"))
            {
                this.helpMainToolStripMenuItem.Visible = false;
                this.toolStripSeparator3.Visible = false;
            }

            int i = s.IndexOf('\"', 1); // file names are probably in quotes when run from Windows.
            if ((i != -1) && (i < (s.Length - 1)))
                s = s.Remove(i + 1);
            LogMessage.LogF("## Running {0} on {1} {2}", s,
                DateTime.Now.ToShortDateString(), DateTime.Now.ToLongTimeString());
            LogMessage.LogF("{0}", (Preferences.ShowDebugInfo == true) ? "Debugging Active!" : "Normal Operation Active.");
            LogMessage.LogF("Checking if East Asian Support is installed.");

            RegistryKey codepages = Registry.LocalMachine.OpenSubKey(@"SYSTEM\CurrentControlSet\Control\Nls\CodePage");
            if (codepages == null)
            {
                LogMessage.LogF("..No Code Pages In The Registry Could Be Found, Attempting to continue");
            }
            else
            {
                string _932 = (string)codepages.GetValue("932"); // check for shift-jis
                string _1251 = (string)codepages.GetValue("1251");
                string _1252 = (string)codepages.GetValue("1252");
                bool notfound = false;
                if ((_932 == null) || (_932 == String.Empty))
                {
                    LogMessage.LogF("..Japanese (Shift-JIS) support not found");
                    notfound = true;
                }
                else LogMessage.LogF("..Japanese (Shift-JIS) support found");
                if ((_1251 == null) || (_1251 == String.Empty))
                {
                    LogMessage.LogF("..Cyrillic (Windows) support not found");
                    notfound = true;
                }
                else LogMessage.LogF("..Cyrillic (Windows) support found");

                if ((_1252 == null) || (_1252 == String.Empty))
                {
                    LogMessage.LogF("..Western European (Windows) support not found");
                    notfound = true;
                }
                else LogMessage.LogF("..Western European (Windows) support found");
                if (notfound)
                {
                    if (DialogResult.Cancel == MessageBox.Show(
                        "Japanese, Cyrillic, or Western European support not found.\r\n" +
                        "Please install East Asian Language Support via the Control Panel\r\n" +
                        "under \"Regional and Language Options\" on the \"Language\" tab.\r\n" +
                        "Hit OK to run FFXI ME!, Cancel to Exit.", "Language Support not installed.", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2))
                    {
                        LogMessage.LogF("..East Asian support not found, User chose to exit");
                        this.Close();
                        return;
                    }
                }
            }

            this.CursorCopy = null;
            this.CursorLink = null;
            this.CreateCursors();
            SystemEvents.UserPreferenceChanged += new UserPreferenceChangedEventHandler(SystemEvents_UserPreferenceChanged);

            //MessageBox.Show("Download .NET 2.0 here\r\n" + @"http://www.microsoft.com/downloads/details.aspx?FamilyID=0856EACB-4362-4B0D-8EDD-AAB15C5E04F5&displaylang=en");

            LogMessage.LogF("Loading Preferences...");
            LoadPreferences();
            LogMessage.LogF("..Done Loading Preferences.");

            if (MainForm.ShowOptionsDialog)
            {
                LogMessage.LogF("Options Requested...");
                OptionsDialog od = new OptionsDialog("FFXI ME! v2 Options");
                od.StartPosition = FormStartPosition.CenterScreen;
                if (od.ShowDialog() == DialogResult.OK)
                {
                    SavePreferences();
                    LogMessage.LogF("Options screen loaded and saved");
                }
                LogMessage.LogF("Exiting application");
                this.Close();
                return;
            }

            try
            {
                _ATPhraseLoader = new FFXIATPhraseLoader(Preferences.Language,
                    Preferences.LoadItems,
                    Preferences.LoadKeyItems,
                    Preferences.LoadAutoTranslatePhrases,
                    String.Format("Yekyaa's FFXI ME! v{0}",
                        System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString()));
            }
            catch (FileNotFoundException exception)
            {
                LogMessage.LogF("Missing file in FFXI directory installation: ", exception.FileName);
                LogMessage.LogF("...Attempting to continue without the Auto-Translate Phrases.");
            }

            atphraseBW.DoWork += BuildATBackground;
            atphraseBW.RunWorkerAsync("buildATMenu");

            specialsBW.DoWork += BuildSpecialsBackground;
            specialsBW.RunWorkerAsync("buildSpecialsMenu");


            if (_ATPhraseLoader != null)
            {
                this._FFXIInstallPath = this.ATPhraseLoader.GetRegistryKey();// MainFormGetRegistryKey();
            }

            if (buttons == null)
                buttons = new Button[20];
            buttons[0] = buttonCtrl1;
            buttons[1] = buttonCtrl2;
            buttons[2] = buttonCtrl3;
            buttons[3] = buttonCtrl4;
            buttons[4] = buttonCtrl5;
            buttons[5] = buttonCtrl6;
            buttons[6] = buttonCtrl7;
            buttons[7] = buttonCtrl8;
            buttons[8] = buttonCtrl9;
            buttons[9] = buttonCtrl0;
            buttons[10] = buttonAlt1;
            buttons[11] = buttonAlt2;
            buttons[12] = buttonAlt3;
            buttons[13] = buttonAlt4;
            buttons[14] = buttonAlt5;
            buttons[15] = buttonAlt6;
            buttons[16] = buttonAlt7;
            buttons[17] = buttonAlt8;
            buttons[18] = buttonAlt9;
            buttons[19] = buttonAlt0;
        }
Exemplo n.º 2
0
 private void optionsToolStripMenuItem_Click(object sender, EventArgs e)
 {
     OptionsDialog od = new OptionsDialog();
     od.StartPosition = FormStartPosition.CenterParent;
     if (od.ShowDialog() == DialogResult.OK)
     {
         SavePreferences();
     }
 }