Пример #1
0
        /// <summary>
        /// Loads all settings from ShowMiiWads.cfg
        /// </summary>
        private void LoadSettings()
        {
            if (File.Exists(CfgPath))
            {
                DataSet ds = new DataSet("ShowMiiWads");

                ds.ReadXmlSchema(CfgPath);
                ds.ReadXml(CfgPath);

                try
                {
                    if (ds.Tables["Settings"].Rows[0]["Version"].ToString() == version)
                    {
                        langfile = ds.Tables["Settings"].Rows[0]["LangFile"].ToString();
                        addsub = ds.Tables["Settings"].Rows[0]["AddSub"].ToString();
                        savefolders = ds.Tables["Settings"].Rows[0]["SaveFolders"].ToString();
                        language = ds.Tables["Settings"].Rows[0]["Language"].ToString();
                        autosize = ds.Tables["Settings"].Rows[0]["AutoSize"].ToString();
                        accepted = ds.Tables["Settings"].Rows[0]["Accepted"].ToString();
                        backup = ds.Tables["Settings"].Rows[0]["CreateBackups"].ToString();
                        splash = ds.Tables["Settings"].Rows[0]["SplashScreen"].ToString();
                        NandPath = ds.Tables["Settings"].Rows[0]["NandPath"].ToString();
                        showpath = ds.Tables["Settings"].Rows[0]["ShowPath"].ToString();
                        bool showMiiNand = ds.Tables["Settings"].Rows[0]["View"].ToString() == "ShowMiiNand";
                        wwidth = ds.Tables["Window"].Rows[0]["WindowWidth"].ToString();
                        wheight = ds.Tables["Window"].Rows[0]["WindowHeight"].ToString();
                        locx = ds.Tables["Window"].Rows[0]["LocationX"].ToString();
                        locy = ds.Tables["Window"].Rows[0]["LocationY"].ToString();
                        wstate = ds.Tables["Window"].Rows[0]["WindowState"].ToString();
                        mru[0] = ds.Tables["Folders"].Rows[0]["MRU0"].ToString();
                        mru[1] = ds.Tables["Folders"].Rows[0]["MRU1"].ToString();
                        mru[2] = ds.Tables["Folders"].Rows[0]["MRU2"].ToString();
                        mru[3] = ds.Tables["Folders"].Rows[0]["MRU3"].ToString();
                        mru[4] = ds.Tables["Folders"].Rows[0]["MRU4"].ToString();

                        try { portable = Convert.ToBoolean(ds.Tables["Settings"].Rows[0]["Portable"].ToString()); }
                        catch { portable = false; }

                        int foldercount = Convert.ToInt32(ds.Tables["Folders"].Rows[0]["Foldercount"]);

                        if (portable) NandPath = NandPath.Remove(0, 1).Insert(0, Application.StartupPath.Substring(0, 1));
                        btnPortableMode.Checked = portable;

                        LoadLanguage();
                        SetWindowProperties(wwidth, wheight, locx, locy, wstate);

                        if (showMiiNand)
                        {
                            btnShowMiiNand.Checked = true;
                            btnShowMiiNand_Click(null, null);
                        }

                        switch (autosize)
                        {
                            case "false":
                                btnAutoResize.Checked = false;
                                break;
                            default:
                                btnAutoResize.Checked = true;
                                break;
                        }

                        switch (backup)
                        {
                            case "true":
                                btnCreateBackups.Checked = true;
                                break;
                            default:
                                btnCreateBackups.Checked = false;
                                break;
                        }

                        switch (savefolders)
                        {
                            case "false":
                                btnSaveFolders.Checked = false;
                                break;
                            default:
                                btnSaveFolders.Checked = true;
                                break;
                        }

                        switch (showpath)
                        {
                            case "false":
                                btnShowPath.Checked = false;
                                break;
                            default:
                                btnShowPath.Checked = true;
                                break;
                        }

                        switch (addsub)
                        {
                            case "true":
                                btnAddSub.Checked = true;
                                break;
                            default:
                                btnAddSub.Checked = false;
                                break;
                        }

                        switch (accepted)
                        {
                            case "true":
                                accepted = "true";
                                EditFeatures(true);
                                break;
                            case "nouse":
                                EditFeatures(false);
                                break;
                            default:
                                ShowMiiWads_Disclaimer dcl = new ShowMiiWads_Disclaimer();
                                dcl.firststart = true;
                                dcl.ShowDialog();
                                if (accepted == "true")
                                {
                                    EditFeatures(true);
                                }
                                else
                                {
                                    EditFeatures(false);
                                }
                                break;
                        }

                        switch (splash)
                        {
                            case "false":
                                btnShowSplash.Checked = false;
                                break;
                            default:
                                btnShowSplash.Checked = true;
                                break;
                        }

                        if (splash == "false")
                        {
                            if (foldercount > 0)
                            {
                                for (int x = 0; x < foldercount; x++)
                                {
                                    if (Directory.Exists(ds.Tables["Folders"].Rows[0]["Folder" + x.ToString()].ToString()))
                                    {
                                        if (!portable)
                                            AddWads(ds.Tables["Folders"].Rows[0]["Folder" + x.ToString()].ToString());
                                        else
                                            AddWads(ds.Tables["Folders"].Rows[0]["Folder" + x.ToString()].ToString().Remove(0, 1).Insert(0, Application.StartupPath.Substring(0, 1)));
                                    }
                                }
                            }
                        }
                        else LoadNew();
                    }
                    else
                    {
                        File.Delete(CfgPath);
                        LoadSettings();
                    }
                }
                catch
                {
                    File.Delete(CfgPath);
                    LoadSettings();
                }
            }
            else
            {
                LoadLanguage();

                SetWindowProperties(wwidth, wheight, "", "", "Normal");

                ShowMiiWads_Disclaimer dcl = new ShowMiiWads_Disclaimer();
                dcl.firststart = true;
                dcl.ShowDialog();
                if (accepted == "true")
                {
                    EditFeatures(true);
                }
                else
                {
                    EditFeatures(false);
                }
            }
        }
Пример #2
0
        private void btnDisclaimer_Click(object sender, EventArgs e)
        {
            ShowMiiWads_Disclaimer dcl = new ShowMiiWads_Disclaimer();

            switch (accepted)
            {
                case "true":
                    dcl.rbAccept.Checked = true;
                    dcl.rbNoUse.Checked = false;
                    break;
                default:
                    dcl.rbAccept.Checked = false;
                    dcl.rbNoUse.Checked = true;
                    break;
            }

            dcl.ShowDialog();
            if (accepted == "true")
            {
                EditFeatures(true);
            }
            else
            {
                EditFeatures(false);
            }
        }