Exemplo n.º 1
0
        private void LoLManager_Load(object sender, EventArgs e)
        {
            ManagerINI = new CFGFile(Directory.GetCurrentDirectory() + "\\LoLManager.ini");
            RootPath = ManagerINI.GetValue("Init", "Path");
            if (RootPath != "" && !Directory.Exists(RootPath))
            {
                RootPath = "";
                ManagerINI.SetValue("Init", "Path", "");
            }
            if (RootPath == "")
            {
                if (HaveReg("SOFTWARE\\Wow6432Node\\Garena\\LoLTW"))
                {
                    RootPath = ReadReg("SOFTWARE\\Wow6432Node\\Garena\\LoLTW", "Path");
                }
            }
            if (RootPath == "")
            {
                if (HaveReg("SOFTWARE\\Wow6432Node\\Riot Games\\League of Legends"))
                {
                    RootPath = ReadReg("SOFTWARE\\Wow6432Node\\Riot Games\\League of Legends", "Path");
                }
            }
            if (RootPath == "")
            {
                if (HaveReg("SOFTWARE\\Garena\\LoLTW"))
                {
                    RootPath = ReadReg("SOFTWARE\\Garena\\LoLTW", "Path");
                }
            }
            if (RootPath == "")
            {
                if (HaveReg("SOFTWARE\\Riot Games\\League of Legends"))
                {
                    RootPath = ReadReg("SOFTWARE\\Riot Games\\League of Legends", "Path");
                }
            }
            if (RootPath == "")
            {
                MessageBox.Show("手動設定\n請選擇您安裝的路徑\nGarena/GameData/Apps/LoLTW", "無法抓取LOL安裝位置");
                FindLOL();
            }
            if (RootPath != "")
            {
                if (Directory.Exists(RootPath + "\\Game\\DATA\\") == false)
                {
                    MessageBox.Show("重新設定LOL位置", "遺失LOL位置");
                    FindLOL();
                }

                UpdateCheck = new UpdateCheck(RootPath);

                // 開啟時必定進入Pack自動比對
                BackupEx.Pack(RootPath, UpdateCheck.GetLoLVersion().ToString());
                UpdateCheck.SetMainVersion();
                foreach (string it in BackupEx.GetListString())
                {
                    BackupExListBox.Items.Add(it);
                }

                if (UpdateCheck.CheakLoLVersion())
                {
                    if (MessageBox.Show("偵測到LoL版本有更新\n是否需要匯入上次匯出的資料?", "匯入系統", MessageBoxButtons.OKCancel) == DialogResult.OK)
                    {
                        Import();
                    }
                }
                FontControl = new FontControl(RootPath + "\\Game\\DATA\\");
                ChatControl = new ChatControl(RootPath + "\\Game\\DATA\\");
                //BarSetting = new BarSetting(RootPath + "\\Game\\DATA\\");
                LoLVersionLabel.Text = UpdateCheck.GetLoLVersion().ToString();
                SaveVersionLabel.Text = UpdateCheck.GetSaveVersion().ToString();

                CheckVersionCheckBox.Checked = Int32.Parse(ManagerINI.GetValue("Option", "CheckSaveVersion")) == 0 ? false : true;
                FontNameComboBox.SelectedIndex = 0;
                ReflashFontTypeList();
                NewFontTypeComboBox.SelectedIndex = 0;
                FontSettingComboBox.SelectedIndex = 0;
                ChatSettingComboBox.SelectedIndex = 0;
                HealthBarComboBox.SelectedIndex = 0;
                MpBarLoag();
                LOLPathLabel.Text = RootPath;

                linkLabel1.Links.Add(0, linkLabel1.Text.Length, linkLabel1.Text);
                linkLabel2.Links.Add(0, linkLabel2.Text.Length, linkLabel2.Text);
                linkLabel5.Links.Add(0, linkLabel5.Text.Length, linkLabel5.Text);
                linkLabel6.Links.Add(0, linkLabel6.Text.Length, linkLabel6.Text);
            }
        }