Пример #1
0
        private void Form1_Load(object sender, EventArgs e) {
            #if DEBUG_BUILD // Use to parse a language file from text to code.
                System.IO.StreamReader fsr = new System.IO.StreamReader("French Uwizard 2parse.txt");
                string ret = "";
                int index = 0;
                while (!fsr.EndOfStream) {
                    if (index != 0) ret = ret + ", \r\n";
                    ret = ret + "\"" + fsr.ReadLine() + "\" /* " + index + " */ ";
                    index++;
                }
                ret = ret + "\r\n";
                fsr.Close();
                fsr.Dispose();
                System.Windows.Forms.Clipboard.SetText(ret);
                System.IO.File.WriteAllText("frenchcode.txt", ret);//*/
                //this.Close();
            #endif

            string[] cla = Environment.GetCommandLineArgs();
            
            try {
                Environment.CurrentDirectory = System.IO.Path.GetDirectoryName(cla[0]);
            } catch (Exception ex) {}

            uwiz_langtext = Langs.texts[0];

            /*if (cla.Length > 1) {
                System.Diagnostics.Debug.WriteLine("Uwizard " + Form1.getVerText(Form1.myversion));
                System.Diagnostics.Debug.WriteLine("");
                if (cla[1] == "-h" || cla[1] == "/?" || cla[1] == "-help") {
                    System.Diagnostics.Debug.WriteLine("You may use the command line to access all Uwizard features:");
                }
                return;
            }//*/
            
            duout.BringToFront();
            //rThread.RunWorkerAsync();
            this.DoubleBuffered = true;
            gtkey.Tag = "";
            gid.Tag = -1;
            gregion.Tag = wud.regcode.USA;
            loaddatabase();
            savedatabase();

            if (System.IO.Directory.Exists("uwiz_newverfiles")) {
                try {
                    usleep(1000, false);
                    System.IO.File.Delete("uwiz_newverfiles/Updater.exe");
                    if (System.IO.File.Exists("uwiz_newverfiles/uwiz_lver.txt")) {
                        int lver = int.Parse(System.IO.File.ReadAllText("uwiz_newverfiles/uwiz_lver.txt"));
                        switch (lver) {
                            case 110:
                                loadUwizardSettings();
                                saveUwizardSettings();
                                break;
                            case 111:
                                loadUwizardSettings();
                                uwiz_settings_language = uwiz_lang.notselected;
                                saveUwizardSettings();
                                break;
                            case 112:
                                goto case 111;
                            case 113:
                                goto case 111;
                        }
                    } else { // Updating from v1.0.0 or v1.0.1
                        System.IO.File.Move("uwiz_newverfiles/extracted/settings.bin", "settings.bin");
                        loadUwizardSettings();
                        System.IO.StreamReader sr = new System.IO.StreamReader("uwiz_newverfiles/doNOTopen.txt");
                        sr.ReadLine();
                        sr.ReadLine();
                        uwiz_settings_key_common = EncDec(sr.ReadLine());
                        uwiz_settings_key_ancast_starbuck = EncDec(sr.ReadLine());
                        uwiz_settings_key_ancast_espresso = EncDec(sr.ReadLine());
                        sr.Close();
                        sr.Dispose();
                        saveUwizardSettings();
                        //msgbox("Uwizard has been successfully updated to version " + getVerText(myversion) + ", but because of an incompatibility issue, if you updated from version 1.0.0, then your system keys are mangled and need to be re-entered.");
                    }
                    msgbox(uwiz_langtext[25] + getVerText(myversion)); // "Uwizard has been successfully updated to version " + getVerText(myversion)
                } catch (Exception ex) {
                    msgbox(string.Format(uwiz_langtext[26], getVerText(myversion))); // "Uwizard has been updated to version " + getVerText(myversion) + ", but because of an error in the update process, some of your data may not be intact."
                }
                System.IO.Directory.Delete("uwiz_newverfiles", true);
            }

#if LANG_LOAD
            loadUwizardSettings();
#else
            loadUwizardSettings();
            uwiz_settings_language = 0;
            saveUwizardSettings();
            Environment.Exit(0);
#endif
            Langs.loadlang(this);

            if (uwiz_settings_language == uwiz_lang.english)
                hideKeys.Font = new Font(nus_usecdecrypt.Font.FontFamily, 8.25f);
            else
                hideKeys.Font = new Font(nus_usecdecrypt.Font.FontFamily, 6.25f);

            if (uwiz_settings_language == uwiz_lang.english || uwiz_settings_language == uwiz_lang.portuguese)
                nus_usecdecrypt.Font = new Font(nus_usecdecrypt.Font.FontFamily, 8.25f);
            else
                nus_usecdecrypt.Font = new Font(nus_usecdecrypt.Font.FontFamily, 6.25f);

            if (uwiz_settings_language == uwiz_lang.english)
                button7.Font = new Font(button7.Font.FontFamily, 7f);
            else
                button7.Font = new Font(button7.Font.FontFamily, 6f);

            ckey_prev.Text = uwiz_settings_key_common;
            aekey_prev.Text = uwiz_settings_key_ancast_espresso;
            askey_prev.Text = uwiz_settings_key_ancast_starbuck;

            ckey_prev_TextChanged(ckey_prev, null);
            aekey_prev_TextChanged(aekey_prev, null);
            askey_prev_TextChanged(aekey_prev, null);

            splitContainer1_SplitterMoved(splitContainer1, null);

            /*System.Net.WebClient wc = new System.Net.WebClient();
            wc.DownloadFile("http://wiiubrew.net/?smd_process_download=1&download_id=531", "uwizard.tmp");
            if (System.IO.File.Exists("uwizard.tmp")) System.IO.File.Delete("uwizard.tmp");
            wc.Dispose();*/

            if (ckey_prev.Text == "" && System.IO.File.Exists("ckey.bin"))
                ckey_prev.Text = byte2hex(System.IO.File.ReadAllBytes("ckey.bin"));

            ticktock_refreshinator.Start();
        }
Пример #2
0
        void loadUwizardSettings() {
            if (!System.IO.File.Exists("settings.bin")) {
                msgbox(uwiz_langtext[4]); // The settings file is missing! Your settings and system keys are now lost.
                return;
            }

            //string tset = System.IO.Path.GetTempFileName();
            //System.IO.File.Delete(tset);
            //System.IO.File.Copy("settings.bin", tset);

            //System.IO.StreamReader sr = new System.IO.StreamReader(tset);
            System.IO.StreamReader sr = new System.IO.StreamReader("settings.bin");

            string ver = sr.ReadLine();

            if (Microsoft.VisualBasic.Strings.Right(ver, "DEBUG_BUILD".Length) != "DEBUG_BUILD") {
                sr.Close();
                sr.Dispose();
                //System.IO.File.WriteAllBytes(tset, Dec(System.IO.File.ReadAllBytes(tset)));
                sr = new System.IO.StreamReader(new System.IO.MemoryStream(Dec(System.IO.File.ReadAllBytes("settings.bin"))));
                ver = sr.ReadLine();
            }

            int veri = int.Parse(ver[0].ToString() + ver[2].ToString() + ver[4].ToString());
            sr.ReadLine();

            uwiz_settings_language = uwiz_lang.notselected;

            switch (veri) {
                case 110:
                    uwiz_settings_key_common = sr.ReadLine();
                    uwiz_settings_key_ancast_espresso = sr.ReadLine();
                    uwiz_settings_key_ancast_starbuck = sr.ReadLine();
                    veri = int.Parse(sr.ReadLine());
                    wudlist_clearfolers_Click(null, null);
                    for (int c = 0; c < veri; c++) {
                        addwudfolder(sr.ReadLine());
                    }
                    bfstm_curdir = sr.ReadLine();
                    parsebfstmdir();

                    veri = int.Parse(sr.ReadLine());

                    nus_dlist.Items.Clear();
                    nus_dlist_abs.Clear();

                    for (int c = 0; c < veri; c++) {
                        nus_dlist.Items.Add(sr.ReadLine());
                        nus_dlist_abs.Add(sr.ReadLine());
                    }
                    hideKeys.Checked = sr.ReadLine() == "yeshidekeys";

                    break;
                case 111:
                    uwiz_settings_language = (uwiz_lang)byte.Parse(sr.ReadLine());
                    goto case 110;
                case 112:
                    goto case 111;
                case 113:
                    goto case 111;
                case 114:
                    goto case 111;
            }

            sr.Close();
            sr.Dispose();

            //System.IO.File.Delete(tset);

            #if LANG_LOAD
                if (uwiz_settings_language == uwiz_lang.notselected) {
                    uwiz_settings_language = (new LangSel()).ShowDialog(uwiz_lang.english);
                }
                uwiz_langtext = Langs.texts[(int)uwiz_settings_language-1];
            #endif
        }