/// <summary>
        /// Loads the settings.
        /// </summary>
        void LoadSettings()
        {
            ModifyRegistry myRegistry = new ModifyRegistry();

            myRegistry.BaseRegistryKey = Registry.CurrentUser;
            myRegistry.SubKey          = regSubKey;

            txt_base_url.Text = myRegistry.Read("BASE_URL", "https://manage.velasystems.com");

            txt_login_name.Text = myRegistry.Read("LOGIN_NAME", "");

            string loadPW = myRegistry.Read("USER_PASSWORD");

            if (loadPW != null)
            {
                byte[] decbuff = Convert.FromBase64String(loadPW);
                string decPW   = System.Text.Encoding.UTF8.GetString(decbuff);
                txt_password.Text = decPW;
            }

            //txt_auth_token.Text = myRegistry.Read("AUTH_TOKEN", "");

            //if (txt_auth_token.Text != "")
            //{
            //    buttonLogin.Enabled = false;
            //    buttonLogout.Enabled = true;
            //}
            //else
            //{
            //    buttonLogin.Enabled = true;
            //    buttonLogout.Enabled = false;
            //}
        }
Example #2
0
        private void CheckRegistry()
        {
            ModifyRegistry myRegistry = new ModifyRegistry();
            string         ret        = myRegistry.Read("Installation Date");

            if (ret == null)
            {
                myRegistry.Write("Installation Date", System.DateTime.Now.ToLongDateString());
                myRegistry.Write("Year", System.DateTime.Now.Year.ToString());
                myRegistry.Write("Month", System.DateTime.Now.Month.ToString());
                myRegistry.Write("Day", System.DateTime.Now.Day.ToString());
            }
            else
            {
                int             year    = int.Parse(myRegistry.Read("YEAR"));
                int             month   = int.Parse(myRegistry.Read("MONTH"));
                int             day     = int.Parse(myRegistry.Read("DAY"));
                System.DateTime newdate = new DateTime(year, month, day);
                System.TimeSpan day0    = System.DateTime.Now.Subtract(newdate);
                if (day0.Days > 120)
                {
                    //MessageBox.Show (@"You have exceeded the 120 days trial period
                    //      Please contact [email protected] for a copy");
                    //Application.Exit();
                }
            }
        }
Example #3
0
        public Form1()
        {
            InitializeComponent();
            autoCopyPwd.Checked = bool.Parse(ConfigAppSettings.GetValue("AutoCopyPwd", "false"));
            msPath.Text         = ConfigAppSettings.GetValue("msPath", "");
            if (msPath.Text == "")
            {
                string dir_reg_0 = dir_reg.Replace("HKEY_LOCAL_MACHINE\\", "").Replace("HKEY_CURRENT_USER\\", "");

                try
                {
                    ModifyRegistry myRegistry = new ModifyRegistry();
                    myRegistry.BaseRegistryKey = Registry.CurrentUser;
                    myRegistry.SubKey          = dir_reg_0;
                    if (myRegistry.Read(dir_value_name) != "")
                    {
                        ConfigAppSettings.SetValue("msPath", myRegistry.Read(dir_value_name));
                        msPath.Text = myRegistry.Read(dir_value_name);
                    }
                    else
                    {
                        myRegistry.BaseRegistryKey = Registry.LocalMachine;
                        myRegistry.SubKey          = dir_reg_0;
                        if (myRegistry.Read(dir_value_name) != "")
                        {
                            ConfigAppSettings.SetValue("msPath", myRegistry.Read(dir_value_name));
                            msPath.Text = myRegistry.Read(dir_value_name);
                        }
                    }
                }
                catch
                {
                }
            }
        }
Example #4
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            System.Windows.Forms.OpenFileDialog openFileDialog = new System.Windows.Forms.OpenFileDialog();
            openFileDialog.Multiselect        = true;
            openFileDialog.AutoUpgradeEnabled = true;
            openFileDialog.CheckFileExists    = true;
            openFileDialog.CheckPathExists    = true;
            string initial_directory_join_file = new ModifyRegistry().Read("initial_directory_join_file");

            if (initial_directory_join_file != null)
            {
                openFileDialog.InitialDirectory = initial_directory_join_file;
            }
            if (openFileDialog.ShowDialog() != System.Windows.Forms.DialogResult.OK)
            {
                return;
            }
            if (openFileDialog.FileNames.Length == 0)
            {
                return;
            }
            new ModifyRegistry().Write("initial_directory_join_file", System.IO.Path.GetDirectoryName(openFileDialog.FileNames[0]));
            foreach (string s in openFileDialog.FileNames)
            {
                AddFile(s, new FileInfo(s).Length.ToString());
            }
        }
Example #5
0
        /*
         * read ciphertext from File
         * decrypt it and return
         */
        private string readRawData()
        {
            try
            {
                if (File.Exists(dataPath))
                {
                    try
                    {
                        Byte[]         cipher     = File.ReadAllBytes(dataPath);
                        ModifyRegistry myRegistry = new ModifyRegistry();
                        myRegistry.BaseRegistryKey = Microsoft.Win32.Registry.CurrentUser;
                        myRegistry.SubKey          = "Software\\Beanfun";
                        string entropy   = myRegistry.Read("Entropy");
                        byte[] plaintext = ProtectedData.Unprotect(cipher, Encoding.UTF8.GetBytes(entropy), DataProtectionScope.CurrentUser);
                        return(System.Text.Encoding.UTF8.GetString(plaintext));
                    }
                    catch
                    {
                        File.Delete(dataPath);
                    }
                }

                return(null);
            }
            catch { return(null); }
        }
Example #6
0
        private void LoadRegistry(object state)
        {
            _reg = new ModifyRegistry(util.LoadProjectResource("REG_SUBKEY_CALLRECORDER", "COMMONRES", "").ToString());
            byte[] __bytes = (byte[])_reg.GetValue(RegKind.LocalMachine, "CR");
            _option = (CRAgentOption)util.ByteArrayToObject(__bytes);

            Thread.Sleep(1000);
            ThreadPool.QueueUserWorkItem(new WaitCallback(LoadRegistry));
        }
Example #7
0
        private void props_etc_01_Unchecked(object sender, RoutedEventArgs e)
        {
            ModifyRegistry __reg = new ModifyRegistry(util.LoadProjectResource("REG_MAIN_RUN", "COMMONRES", "").ToString());

            __reg.DeleteValue(RegKind.LocalMachine, "CdrAgent");

            _runstart = false;
            this.SaveProps();
        }
Example #8
0
        private void props_etc_01_Checked(object sender, RoutedEventArgs e)
        {
            ModifyRegistry __reg          = new ModifyRegistry(util.LoadProjectResource("REG_MAIN_RUN", "COMMONRES", "").ToString());
            string         __curDirectory = Directory.GetCurrentDirectory();

            __reg.SetValue(RegKind.LocalMachine, "CdrAgent", string.Format("{0}\\CdrAgent.exe", __curDirectory));

            _runstart = true;
            this.SaveProps();
        }
Example #9
0
        private void DBConfiguration_Load(object sender, EventArgs e)
        {
            ModifyRegistry reg = new ModifyRegistry();

            txtIP.Text       = String.IsNullOrEmpty(reg.Read("DBServerName")) ? BHConstant.INIT_IP : reg.Read("DBServerName");
            txtPort.Text     = String.IsNullOrEmpty(reg.Read("Port")) ? BHConstant.INIT_PORT : reg.Read("Port");
            txtNet.Text      = String.IsNullOrEmpty(reg.Read("NetworkLibrary")) ? BHConstant.INIT_NETWORK_LIBRARY : reg.Read("NetworkLibrary");
            txtDataName.Text = String.IsNullOrEmpty(reg.Read("DatabaseName")) ? BHConstant.INIT_DATABASE_NAME : reg.Read("DatabaseName");
            txtUsername.Text = String.IsNullOrEmpty(reg.Read("DatabaseUserID")) ? BHConstant.INIT_USER_ID : reg.Read("DatabaseUserID");
            txtPass.Text     = String.IsNullOrEmpty(reg.Read("DatabasePwd")) ? BHConstant.INIT_PW : reg.Read("DatabasePwd");
        }
        private void SettingDialog_Load(object sender, EventArgs e)
        {
            Assembly _assembly = Assembly.GetExecutingAssembly();
            String   thankyou  = smbx_npc_editor.Properties.Resources.thankyou;

            richTextBox1.Rtf = thankyou;
            //
            //Load in settings here
            ModifyRegistry mr             = new ModifyRegistry();
            string         runPortableStr = mr.Read("runPortable");

            if (runPortableStr == null)
            {//
            }
            else if (runPortableStr == "true")
            {
                runPortable_CheckBox.Checked = true;
                runPortable_original         = true;
            }
            else if (runPortableStr == "false")
            {
                runPortable_CheckBox.Checked = false;
                runPortable_original         = false;
            }
            string showAnimation = settingsFile.ReadValue("Settings", "showAnimation");

            if (showAnimation == "true")
            {
                npcPreview_CheckBox.Checked = true;
            }
            else if (showAnimation == "false")
            {
                npcPreview_CheckBox.Checked = false;
            }
            //Enable the proper controls
            if (npcPreview)
            {
                npcPreview_CheckBox.Checked = true;
            }
            else if (!npcPreview)
            {
                npcPreview_CheckBox.Checked = false;
            }

            if (runPortable)
            {
                runPortable_CheckBox.Checked = true;
            }
            else if (!runPortable)
            {
                runPortable_CheckBox.Checked = false;
            }
        }
Example #11
0
        private void button4_Click(object sender, EventArgs e)
        {
            RegistryKey    bk  = Registry.ClassesRoot;
            RegistryKey    sk  = bk.CreateSubKey("*\\shell\\RightClickDeposit");
            ModifyRegistry reg = new ModifyRegistry();

            reg.BaseRegistryKey = bk;
            reg.SubKey          = "*\\shell\\RightClickDeposit";
            reg.Write("MUIVerb", "Deposit to");
            string commandList = "";

            foreach (KeyValuePair <int, Profile> p in profiles)
            {
                if (p.Value.IsDefault())
                {
                    string commandName = "RightClickDeposit.deposit." + p.Value.GetId();
                    commandList += commandName + "; ";
                    RegistryKey    cbk    = Registry.LocalMachine;
                    RegistryKey    ck     = cbk.CreateSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\CommandStore\\shell\\" + commandName);
                    ModifyRegistry regcmd = new ModifyRegistry();
                    regcmd.BaseRegistryKey = cbk;
                    regcmd.SubKey          = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\CommandStore\\shell\\" + commandName;
                    regcmd.Write("MUIVerb", p.Value.GetName());
                    MessageBox.Show(regcmd.Read("MUIVerb"));
                    RegistryKey cck = cbk.CreateSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\CommandStore\\shell\\" + commandName + "\\command");
                    regcmd.SubKey = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\CommandStore\\shell\\" + commandName + "\\command";
                    regcmd.Write("", "C:\\RightClickDeposit.exe " + p.Value.GetId() + " create \"%1\"");
                }
            }


            RegistryKey    ubk  = Registry.LocalMachine;
            RegistryKey    uk   = ubk.CreateSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\CommandStore\\shell\\RightClickDeposit.update");
            ModifyRegistry regu = new ModifyRegistry();

            regu.BaseRegistryKey = ubk;
            regu.SubKey          = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\CommandStore\\shell\\RightClickDeposit.update";
            regu.Write("MUIVerb", "Update or delete previous deposit");

            RegistryKey cuk = ubk.CreateSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\CommandStore\\shell\\RightClickDeposit.update\\command");

            regu.SubKey = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\CommandStore\\shell\\RightClickDeposit.update\\command";
            regu.Write("", "C:\\RightClickDeposit.exe 0 update \"%1\"");

            commandList += "RightClickDeposit.update";

            reg.Write("SubCommands", commandList);
        }
Example #12
0
        /*
         * encrypt plaintext and store to File
         * and save key in Program Setting
         */
        private void writeRawData(string plaintext)
        {
            using (BinaryWriter writer = new BinaryWriter(File.Open(dataPath, FileMode.Create)))
            {
                // Create random entropy of 8 characters.
                var    chars   = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
                var    random  = new Random();
                string entropy = new string(Enumerable.Repeat(chars, 8).Select(s => s[random.Next(s.Length)]).ToArray());

                ModifyRegistry myRegistry = new ModifyRegistry();
                myRegistry.BaseRegistryKey = Microsoft.Win32.Registry.CurrentUser;
                myRegistry.SubKey          = "Software\\Beanfun";
                myRegistry.Write("Entropy", entropy);

                writer.Write(ciphertext(plaintext, entropy));
            }
        }
        /// <summary>
        /// Stores the settings.
        /// </summary>
        void StoreSettings()
        {
            // Setup Registry Save
            // work in progress -MV
            ModifyRegistry myRegistry = new ModifyRegistry();

            myRegistry.BaseRegistryKey = Registry.CurrentUser;
            myRegistry.SubKey          = regSubKey;

            myRegistry.Write("BASE_URL", txt_base_url.Text);
            myRegistry.Write("LOGIN_NAME", txt_login_name.Text);
            myRegistry.Write("AUTH_TOKEN", txt_auth_token.Text);

            // Password - Yes, this should really be encrypted, but we are going to just do something simple
            // to "scramble" the text
            myRegistry.Write("USER_PASSWORD", Convert.ToBase64String(System.Text.Encoding.ASCII.GetBytes(txt_password.Text)));
        }
Example #14
0
        protected void LoadSerialization()
        {
            try {
                ModifyRegistry reg = new ModifyRegistry();

                RegexString.Text = reg.Read("Pattern") ?? "";
                InputString.Text = reg.Read("Input") ?? "";
                ReplaceString.Text = reg.Read("Replace") ?? "";

                IgnoreCase.Checked = (reg.Read("IgnoreCase") ?? "") == "True" ? true : false;
                SingleLine.Checked = (reg.Read("SingleLine") ?? "") == "True" ? true : false;
                MultiLine.Checked = (reg.Read("MultiLine") ?? "") == "True" ? true : false;
                Replace.Checked = (reg.Read("ReplaceOn") ?? "") == "True" ? true : false;
            }
            catch (Exception ex) {
                MessageBox.Show("Error Loading Form from Registry", ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #15
0
        protected void Serialize()
        {
            try {
                ModifyRegistry reg = new ModifyRegistry();

                reg.Write("Pattern", RegexString.Text);
                reg.Write("Input", InputString.Text);
                reg.Write("Replace", ReplaceString.Text);

                reg.Write("IgnoreCase", IgnoreCase.Checked);
                reg.Write("SingleLine", SingleLine.Checked);
                reg.Write("MultiLine", MultiLine.Checked);
                reg.Write("ReplaceOn", Replace.Checked);
            }
            catch (Exception ex) {
                MessageBox.Show("Error Saving Form to Registry", ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #16
0
        private void configBFSX()
        {
            ModifyRegistry myRegistry = new ModifyRegistry();

            myRegistry.BaseRegistryKey = Microsoft.Win32.Registry.CurrentUser;

            // 允許運行BFServiceX的域名
            myRegistry.SubKey = "Software\\Microsoft\\Windows\\CurrentVersion\\Ext\\Stats\\{8AFB38D0-67A4-49D3-8822-401755FC6573}\\iexplore\\AllowedDomains\\beanfun.com";
            myRegistry.CreateSubKey();
            myRegistry.SubKey = "Software\\Microsoft\\Windows\\CurrentVersion\\Ext\\Stats\\{8AFB38D0-67A4-49D3-8822-401755FC6573}\\iexplore";
            myRegistry.DeleteKey("Blocked");
            myRegistry.DeleteKey("Flags");

            // 啟用BFServiceX元件
            myRegistry.SubKey = "Software\\Microsoft\\Windows\\CurrentVersion\\Ext\\Settings\\{8AFB38D0-67A4-49D3-8822-401755FC6573}";
            myRegistry.DeleteSubKeyTree();

            // 相容性視圖的域名
            myRegistry.SubKey = "Software\\Policies\\Microsoft\\Internet Explorer\\BrowserEmulation\\PolicyList";
            myRegistry.Write("beanfun.com", "beanfun.com");
        }
Example #17
0
        private void setHKBFEnvironment_Click(object sender, EventArgs e)
        {
            ModifyRegistry myRegistry = new ModifyRegistry();

            myRegistry.BaseRegistryKey = Registry.CurrentUser;

            // 允許運行BFServiceX的域名
            myRegistry.SubKey = "Software\\Microsoft\\Windows\\CurrentVersion\\Ext\\Stats\\{8AFB38D0-67A4-49D3-8822-401755FC6573}\\iexplore\\AllowedDomains\\beanfun.com";
            myRegistry.CreateSubKey();
            myRegistry.SubKey = "Software\\Microsoft\\Windows\\CurrentVersion\\Ext\\Stats\\{8AFB38D0-67A4-49D3-8822-401755FC6573}\\iexplore";
            myRegistry.DeleteKey("Blocked");
            myRegistry.DeleteKey("Flags");

            // 啟用BFServiceX元件
            myRegistry.SubKey = "Software\\Microsoft\\Windows\\CurrentVersion\\Ext\\Settings\\{8AFB38D0-67A4-49D3-8822-401755FC6573}";
            myRegistry.DeleteSubKeyTree();

            // 相容性視圖的域名
            myRegistry.SubKey = "Software\\Policies\\Microsoft\\Internet Explorer\\BrowserEmulation\\PolicyList";
            myRegistry.Write("beanfun.com", "beanfun.com");

            MessageBox.Show("配置完成。");
        }
Example #18
0
        private void setAccountTool_Click(object sender, EventArgs e)
        {
            string accountToolPath = string.Format("{0}\\MapleStory.exe", System.Environment.CurrentDirectory);

            if (accountToolPath == "" || !File.Exists(accountToolPath))
            {
                MessageBox.Show("帳密工具檔案丟失,請嘗試重新下載。");
                return;
            }
            string         dir_reg_0  = dir_reg.Replace("HKEY_LOCAL_MACHINE\\", "").Replace("HKEY_CURRENT_USER\\", "");
            ModifyRegistry myRegistry = new ModifyRegistry();

            // HongKong Beanfun
            myRegistry.BaseRegistryKey = Registry.LocalMachine;
            myRegistry.SubKey          = dir_reg_0;
            myRegistry.Write(dir_value_name, accountToolPath);
            // Taiwan Beanfun
            myRegistry.BaseRegistryKey = Registry.CurrentUser;
            myRegistry.SubKey          = dir_reg_0;
            myRegistry.Write(dir_value_name, accountToolPath);

            MessageBox.Show("配置完成。");
        }
        //Save and exit
        private void button1_Click(object sender, EventArgs e)
        {
            switch (runPortable)
            {
            case (true):
                ModifyRegistry mr = new ModifyRegistry();
                mr.Write("runPortable", true);
                break;

            case (false):
                mr = new ModifyRegistry();
                mr.Write("runPortable", true);
                break;
            }

            switch (npcPreview)
            {
            case (true):
                settingsFile.WriteValue("Settings", "showAnimation", "true");
                break;

            case (false):
                settingsFile.WriteValue("Settings", "showAnimation", "false");
                break;
            }

            if (runPortable != runPortable_original)
            {
                MessageBox.Show("Changes made to the run portable values will take effect on a restart of the application.",
                                "Warning",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Warning);
            }

            Console.WriteLine("Settings saved!");
            this.Close();
        }
Example #20
0
        public AppController()
        {
            MenuItem settingsMenuItem = new MenuItem("Settings", new EventHandler(ShowSettings));
            MenuItem updaterMenuItem  = new MenuItem("Single File Updater", new EventHandler(ShowUpdater));
            MenuItem exitMenuItem     = new MenuItem("Exit", new EventHandler(Exit));

            notifyIcon              = new NotifyIcon();
            notifyIcon.Icon         = VolvoChecksumMonitor.Properties.Resources.ME7Flasher;
            notifyIcon.ContextMenu  = new ContextMenu(new MenuItem[] { settingsMenuItem, updaterMenuItem, exitMenuItem });
            notifyIcon.DoubleClick += notifyIcon_DoubleClick;
            notifyIcon.Visible      = true;

            regedit = new ModifyRegistry();
            parseRegistryVals();

            if (updateDirectory == "" || !update)
            {
                frmShowSettings();
            }
            else
            {
                initializeUpdate();
            }
        }
Example #21
0
        public bool init()
        {
            try
            {
                this.Text           = "BeanfunLogin - v" + currentVersion;
                this.AcceptButton   = this.loginButton;
                this.bfClient       = null;
                this.accountManager = new AccountManager();

                bool res = accountManager.init();
                if (res == false)
                {
                    errexit("帳號記錄初始化失敗,未知的錯誤。", 0);
                }
                refreshAccountList();
                // Properties.Settings.Default.Reset(); //SetToDefault.

                // Handle settings.
                if (Properties.Settings.Default.rememberAccount == true)
                {
                    this.accountInput.Text = Properties.Settings.Default.AccountID;
                }
                if (Properties.Settings.Default.rememberPwd == true)
                {
                    this.rememberAccount.Enabled = false;
                    // Load password.
                    if (File.Exists("UserState.dat"))
                    {
                        try
                        {
                            Byte[] cipher    = File.ReadAllBytes("UserState.dat");
                            string entropy   = Properties.Settings.Default.entropy;
                            byte[] plaintext = ProtectedData.Unprotect(cipher, Encoding.UTF8.GetBytes(entropy), DataProtectionScope.CurrentUser);
                            this.passwdInput.Text = System.Text.Encoding.UTF8.GetString(plaintext);
                        }
                        catch
                        {
                            File.Delete("UserState.dat");
                        }
                    }
                }
                if (Properties.Settings.Default.autoLogin == true)
                {
                    this.UseWaitCursor    = true;
                    this.panel2.Enabled   = false;
                    this.loginButton.Text = "請稍後...";
                    this.loginWorker.RunWorkerAsync(Properties.Settings.Default.loginMethod);
                }
                if (gamePaths.Get("新楓之谷") == "")
                {
                    ModifyRegistry myRegistry = new ModifyRegistry();
                    myRegistry.BaseRegistryKey = Registry.CurrentUser;
                    myRegistry.SubKey          = "Software\\Gamania\\MapleStory";
                    if (myRegistry.Read("Path") != "")
                    {
                        gamePaths.Set("新楓之谷", myRegistry.Read("Path"));
                        gamePaths.Save();
                    }
                }

                this.loginMethodInput.SelectedIndex = Properties.Settings.Default.loginMethod;
                this.textBox3.Text = "";

                if (this.accountInput.Text == "")
                {
                    this.ActiveControl = this.accountInput;
                }
                else if (this.passwdInput.Text == "")
                {
                    this.ActiveControl = this.passwdInput;
                }

                // .NET textbox full mode bug.
                //this.accountInput.ImeMode = ImeMode.OnHalf;
                //this.passwdInput.ImeMode = ImeMode.OnHalf;
                return(true);
            }
            catch (Exception e)
            {
                return(errexit("初始化失敗,未知的錯誤。" + e.Message, 0));
            }
        }
Example #22
0
        private void frm_master_Load(object sender, EventArgs e)
        {
            noti();
            //RegistryKey key = Registry.LocalMachine.OpenSubKey(@"Software\Depple",true);
            //string nnmm = key.GetValue("name").ToString();
            //if (key.GetValue("name").ToString() == "CMS")
            //{
            //    if (key.GetValue("days" ).ToString() == "1")
            //    {
            //        key.SetValue("regdate", System.DateTime.Now.ToString("dd/MM/yyyy"));
            //        key.SetValue("hardiskno", CryptorEngine.Encrypt(DeppleSoftwareLib.ValidationForm.Validation.getUniqueID("C"), true));
            //        key.SetValue("days", CryptorEngine.Encrypt("2", true));
            //    }
            //    else
            //    {
            //        string hdNo = CryptorEngine.Decrypt(key.GetValue("hardiskno").ToString(), true);
            //        if (hdNo == DeppleSoftwareLib.ValidationForm.Validation.getUniqueID("C"))
            //        {
            //            string d1 = CryptorEngine.Decrypt(key.GetValue("days").ToString(), true);
            //            if (Convert.ToInt32(d1) > 40)
            //            {
            //                MessageBox.Show("Cylinder Software Licence is Expire.  Please Contact Priyank Patel(9409544924).");
            //                Application.Exit();
            //            }
            //            else
            //            {
            //                int d2 = Convert.ToInt32(d1) + 1;
            //                key.SetValue("days", CryptorEngine.Encrypt(d2.ToString(), true));
            //            }
            //        }
            //        else
            //        {
            //            MessageBox.Show("This is Not Your Software. Please Contact Priyank Patel(9409544924).");
            //            Application.Exit();
            //        }
            //    }
            //}
            //else
            //{
            //    MessageBox.Show("This is Not Your Software. Please Contact Priyank Patel(9409544924).");
            //    Application.Exit();
            //}

            ModifyRegistry mr = new ModifyRegistry();
            string         nm = mr.Read("name");

            if (nm == "CMS")
            {
                if (mr.Read("days") == "1")
                {
                    mr.Write("regdate", System.DateTime.Now.ToString("dd/MM/yyyy"));
                    mr.Write("hardiskno", CryptorEngine.Encrypt(DeppleSoftwareLib.ValidationForm.Validation.getUniqueID("C"), true));
                    mr.Write("days", CryptorEngine.Encrypt("2", true));
                }
                else
                {
                    string hdNo = CryptorEngine.Decrypt(mr.Read("hardiskno"), true);
                    if (hdNo == DeppleSoftwareLib.ValidationForm.Validation.getUniqueID("C"))
                    {
                        string d1 = CryptorEngine.Decrypt(mr.Read("days"), true);

                        if (Convert.ToInt32(d1) > 500)
                        {
                            MessageBox.Show("Cylinder Software Licence is Expire.  Please Contact Priyank Patel(9409544924).");
                            Application.Exit();
                        }
                        else
                        {
                            int d2 = Convert.ToInt32(d1) + 1;
                            mr.Write("days", CryptorEngine.Encrypt(d2.ToString(), true));
                        }
                    }
                    else
                    {
                        MessageBox.Show("This is Not Your Software. Please Contact Priyank Patel(9409544924).");
                        Application.Exit();
                    }
                }
                //mr.Read("ACTIVE");
            }
            else
            {
                MessageBox.Show("This is Not Your Software. Please Contact Priyank Patel(9409544924).");
                Application.Exit();
            }
        }
        public MainWindow()
        {
            InitializeComponent();
            g.myStartWin = this;
            //
            System.Reflection.Assembly         assembly = System.Reflection.Assembly.GetExecutingAssembly();
            System.Diagnostics.FileVersionInfo fvi      = System.Diagnostics.FileVersionInfo.GetVersionInfo(assembly.Location);
            string version = fvi.FileVersion;

            this.Title += " ver." + version + " beta";

            ////////////////////////////////////////////////////////////
            //
            System.Globalization.CultureInfo ci = System.Globalization.CultureInfo.InstalledUICulture;
            //ci.ThreeLetterISOLanguageName
            g.last_lang_programm = new ModifyRegistry().Read("last_lang");
            if (g.last_lang_programm == null || g.last_lang_programm.Length == 0)
            {
                g.last_lang_programm = "eng";
                foreach (MenuItem li in lngs_MenuItem.Items)
                {
                    if (li.Name.Substring(0, 3) == ci.ThreeLetterISOLanguageName)
                    {
                        g.last_lang_programm = ci.ThreeLetterISOLanguageName;
                        break;
                    }
                }
            }

            foreach (MenuItem li in lngs_MenuItem.Items)
            {
                if (li.Name == g.last_lang_programm + "_MenuItem")
                {
                    li.IsChecked = true;
                }
            }
            Set_lng(g.last_lang_programm);

            ////////////////////////////////////////////////////////////
            //
            string latest_mode_programm = new ModifyRegistry().Read("last_mode_programm", "");

            if (latest_mode_programm.Length == 0)
            {
                latest_mode_programm = menu_item_Split.Name;
            }
            if (latest_mode_programm == menu_item_Split.Name)
            {
                select_mode(menu_item_Split, null);
            }
            else if (latest_mode_programm == menu_item_Join.Name)
            {
                select_mode(menu_item_Join, null);
            }
            else
            {
                select_mode(menu_item_MD5, null);
            }

            ////////////////////////////////////////////////////////////
            //
            my_ucSplit.CachSize = new ModifyRegistry().Read("cach_size", "1024");
            if (my_ucSplit.CachSize == null)
            {
                my_ucSplit.CachSize = "1024";
            }
            my_ucSplit.CacheSizeMenuItemMouseWheel(null, null);
            g.CacheSize = Convert.ToInt32(my_ucSplit.CachSize, CultureInfo.CurrentCulture);

            ////////////////////////////////////////////////////////////
            //
            my_ucSplit.DisplayFormat = new ModifyRegistry().Read("DISPLAY_FORMAT");
        }
        private void button4_Click(object sender, EventArgs e)
        {
            RegistryKey    bk  = Registry.ClassesRoot;
            RegistryKey    sk  = bk.CreateSubKey("*\\shell\\RightClickDeposit");
            ModifyRegistry reg = new ModifyRegistry();

            reg.BaseRegistryKey = bk;
            reg.SubKey          = "*\\shell\\RightClickDeposit";
            reg.Write("MUIVerb", "Deposit to");
            reg.Write("Icon", Application.StartupPath + "\\icons\\rcd.ico");
            string commandList = "";

            foreach (KeyValuePair <int, Profile> p in profiles)
            {
                if (p.Value.IsDefault())
                {
                    string commandName = "RightClickDeposit.deposit." + p.Value.GetId();
                    commandList += commandName + "; ";
                    RegistryKey    cbk    = Registry.LocalMachine;
                    RegistryKey    ck     = cbk.CreateSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\CommandStore\\shell\\" + commandName);
                    ModifyRegistry regcmd = new ModifyRegistry();
                    regcmd.BaseRegistryKey = cbk;
                    regcmd.SubKey          = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\CommandStore\\shell\\" + commandName;
                    regcmd.Write("MUIVerb", p.Value.GetName());
                    regcmd.Write("Icon", Application.StartupPath + "\\icons\\add.ico");
                    //MessageBox.Show(regcmd.Read("MUIVerb"));
                    RegistryKey cck = cbk.CreateSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\CommandStore\\shell\\" + commandName + "\\command");
                    regcmd.SubKey = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\CommandStore\\shell\\" + commandName + "\\command";
                    regcmd.Write("", Application.StartupPath + "\\RightClickDeposit.exe " + p.Value.GetId() + " create \"%1\"");
                }
            }


            RegistryKey    ubk  = Registry.LocalMachine;
            RegistryKey    uk   = ubk.CreateSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\CommandStore\\shell\\RightClickDeposit.update");
            ModifyRegistry regu = new ModifyRegistry();

            regu.BaseRegistryKey = ubk;
            regu.SubKey          = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\CommandStore\\shell\\RightClickDeposit.update";
            regu.Write("MUIVerb", "Update or delete previous deposits");
            regu.Write("Icon", Application.StartupPath + "\\icons\\update.ico");

            RegistryKey cuk = ubk.CreateSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\CommandStore\\shell\\RightClickDeposit.update\\command");

            regu.SubKey = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\CommandStore\\shell\\RightClickDeposit.update\\command";
            regu.Write("", Application.StartupPath + "\\RightClickDeposit.exe 0 update \"%1\"");

            RegistryKey    pbk  = Registry.LocalMachine;
            RegistryKey    pk   = pbk.CreateSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\CommandStore\\shell\\RightClickDeposit.profiles");
            ModifyRegistry regp = new ModifyRegistry();

            regp.BaseRegistryKey = pbk;
            regp.SubKey          = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\CommandStore\\shell\\RightClickDeposit.profiles";
            regp.Write("MUIVerb", "Manage profiles (admin-only)");
            regp.Write("Icon", Application.StartupPath + "\\icons\\manage.ico");

            RegistryKey puk = pbk.CreateSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\CommandStore\\shell\\RightClickDeposit.profiles\\command");

            regp.SubKey = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\CommandStore\\shell\\RightClickDeposit.profiles\\command";
            regp.Write("", Application.StartupPath + "\\RightClickDeposit.exe profiles");

            commandList += "RightClickDeposit.update; RightClickDeposit.profiles";

            reg.Write("SubCommands", commandList);

            MessageBox.Show("Right-click explorer context menus updated successfully", "Menu update successful");
        }
Example #25
0
 private void Application_Startup(object sender, StartupEventArgs e)
 {
     Define.Fonts = ExCss.ReadFile(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"Asset\Fonts\font-awesome.min.css"));
     if (!File.Exists(FileName))
     {
         MessageBox.Show("Không tìm thấy file cấu hình!");
         Application.Current.Shutdown();
         return;
     }
     Registry = new ModifyRegistry();
     key      = Registry.Read("MTC_KEY");
     if (string.IsNullOrEmpty(key))
     {
         this.MainWindow = new MTC();
         this.MainWindow.Show();
         return;
     }
     setting = Config.Read(FileName, key);
     if (setting == null || setting.EndDate.Date < DateTime.Now.Date)
     {
         MessageBox.Show("Phần mềm đã hết hạn sử dụng.");
         this.MainWindow = new MTC();
         this.MainWindow.Show();
         return;
     }
     if (setting.temp_folder.IndexOf(@"://") < 0 || setting.temp_folder.IndexOf(@"\\") < 0)
     {
         setting.temp_folder = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, setting.temp_folder);
     }
     if (!System.IO.Directory.Exists(setting.temp_folder))
     {
         System.IO.Directory.CreateDirectory(setting.temp_folder);
     }
     cache       = AltaCache.Read(CacheName);
     TypeUsers   = MysqlHelper.getTypeUserAll();
     TypeMedias  = new MediaTypeArray(TypeMedia.getList());
     TypeDevices = new DeviceTypeArray(TypeDevice.getList());
     initVLC();
     if (cache.autoLogin && !string.IsNullOrEmpty(cache.hashUserName))
     {
         int     tmpResult = UserData.getUserIdByHash(cache.hashUserName);
         UILogin form      = new UILogin();
         if (tmpResult != -1)
         {
             byte[] tmp = UserData.getFingerPrinter(tmpResult);
             form.cacheName = UserData.getUserName(tmpResult);
             if (tmp != null)
             {
                 form.Template = new DPFP.Template();
                 form.Template.DeSerialize(tmp);
             }
             form.Show();
         }
         else
         {
             form.Show();
         }
         return;
     }
     this.MainWindow = new UILogin();
     this.MainWindow.Show();
     Console.WriteLine("Debug");
 }
Example #26
0
        /// <summary>
        /// Tries to find game pathes etc. in the registry or other places
        /// and stores them in a Dictionary.
        /// Must be called before pathes are accessed through GetPath.
        /// </summary>
        public void GatherPathes()
        {
            // =======================================
            // Misc
            // =======================================
            string pathToProgramFiles = Environment.GetEnvironmentVariable("ProgramFiles");
            string pathToTempFiles    = Path.GetTempPath();
            string pathToAppData      = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
            string pathToAppDataLocal = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
            string pathToDocuments    = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);

            DictPathIdentifiers.Add("%PROGRAM_FILES%", pathToProgramFiles);
            DictPathIdentifiers.Add("%TEMP%", pathToTempFiles);
            DictPathIdentifiers.Add("%APP_DATA%", pathToAppData);
            DictPathIdentifiers.Add("%APP_DATA_LOCAL%", pathToAppDataLocal);
            DictPathIdentifiers.Add("%DOCUMENTS%", pathToDocuments);

            // =======================================
            // STARCRAFT II
            // =======================================
            // Install Path + add modifyregistry

            if (string.IsNullOrEmpty(Properties.Client.Default.SC2_INSTALL_PATH))
            {
                var mysc2Registry = new ModifyRegistry
                                        {
                                            SubKey = "Software\\Blizzard Entertainment\\Starcraft II\\",
                                            ShowError = true
                                        };

                // 1a. Try Registry LocalMachine
                string pathToStarcraft2Folder = mysc2Registry.Read("InstallPath");

                // 1b. Try Registry CurrentUser
                if (string.IsNullOrEmpty(pathToStarcraft2Folder))
                {
                    mysc2Registry.BaseRegistryKey = Registry.CurrentUser;
                    pathToStarcraft2Folder = mysc2Registry.Read("InstallPath");
                }

                if (string.IsNullOrEmpty(pathToStarcraft2Folder))
                {
                    pathToStarcraft2Folder = "";
                }

                // 2. Try Default Path
                if (string.IsNullOrEmpty(pathToStarcraft2Folder))
                {
                    string sc2DefaultPath = pathToProgramFiles + "/" + "StarCraft II/";
                    if (File.Exists(pathToProgramFiles + "StarCraft II.exe")) pathToStarcraft2Folder = sc2DefaultPath;
                }

                // 3. Try Default Path (Beta)
                if (string.IsNullOrEmpty(pathToStarcraft2Folder))
                {
                    string defaultPath = pathToProgramFiles + "/" + "StarCraft II Beta/";
                    if (File.Exists(pathToProgramFiles + "StarCraft II.exe")) pathToStarcraft2Folder = defaultPath;
                }

                // 4. Default to empty path
                if (string.IsNullOrEmpty(pathToStarcraft2Folder))
                {
                    pathToStarcraft2Folder = "";
                }

                Properties.Client.Default.SC2_INSTALL_PATH = pathToStarcraft2Folder;
            }
            DictPathIdentifiers.Add("%SC2_INSTALL_PATH%", Properties.Client.Default.SC2_INSTALL_PATH);

            // =======================================
            // STARCRAFT I
            // =======================================

            if (string.IsNullOrEmpty(Properties.Client.Default.SC1_INSTALL_PATH))
            {
                var mysc1Registry = new ModifyRegistry
                                        {
                                            SubKey = "Software\\Blizzard Entertainment\\Starcraft\\",
                                            ShowError = true
                                        };

                // 1a. Try Registry LocalMachine (no idea if localmachine is used, dont think so, but i let it stay)
                string pathToStarcraft1Folder = mysc1Registry.Read("InstallPath");

                // 1b. Try Registry CurrentUser
                if (string.IsNullOrEmpty(pathToStarcraft1Folder))
                {
                    mysc1Registry.BaseRegistryKey = Registry.CurrentUser;
                    pathToStarcraft1Folder = mysc1Registry.Read("InstallPath");
                }

                if (string.IsNullOrEmpty(pathToStarcraft1Folder))
                {
                    pathToStarcraft1Folder = "";
                }

                // 2. Try Default Path
                if (string.IsNullOrEmpty(pathToStarcraft1Folder))
                {
                    string sc1DefaultPath = pathToProgramFiles + "/" + "StarCraft/";

                    if (File.Exists(pathToProgramFiles + "StarCraft.exe")) pathToStarcraft1Folder = sc1DefaultPath;
                }

                // 3. Default to empty path
                if (string.IsNullOrEmpty(pathToStarcraft1Folder))
                {
                    pathToStarcraft1Folder = "";
                }
                Properties.Client.Default.SC1_INSTALL_PATH = pathToStarcraft1Folder;
            }
            DictPathIdentifiers.Add("%SC1_INSTALL_PATH%", Properties.Client.Default.SC1_INSTALL_PATH);

            //=====================
            //Warcraft 3
            //=====================

            if (string.IsNullOrEmpty(Properties.Client.Default.WC3_INSTALL_PATH))
            {
                var mywc3Registry = new ModifyRegistry
                                        {
                                            SubKey = "Software\\Blizzard Entertainment\\Warcraft III\\",
                                            ShowError = true
                                        };

                // 1a. Try Registry LocalMachine (no idea if localmachine is used, dont think so, but i let it stay)
                string pathToWarcraft3Folder = mywc3Registry.Read("InstallPath");

                // 1b. Try Registry CurrentUser
                if (string.IsNullOrEmpty(pathToWarcraft3Folder))
                {
                    mywc3Registry.BaseRegistryKey = Registry.CurrentUser;
                    pathToWarcraft3Folder = mywc3Registry.Read("InstallPath");
                }

                if (string.IsNullOrEmpty(pathToWarcraft3Folder))
                {
                    pathToWarcraft3Folder = "";
                }

                Properties.Client.Default.WC3_INSTALL_PATH = pathToWarcraft3Folder;
            }
            DictPathIdentifiers.Add("%WC3_INSTALL_PATH%", Properties.Client.Default.WC3_INSTALL_PATH);

            // TODO: this isnt always nescesary
            Properties.Client.Default.Save();
        }
Example #27
0
 public void InitializeProperties()
 {
     _reg = new ModifyRegistry(util.LoadProjectResource("REG_SUBKEY_CDR", "COMMONRES", "").ToString());
 }
Example #28
0
 public frmSettings()
 {
     InitializeComponent();
     regedit = new ModifyRegistry();
     parseRegistryVals();
 }
Example #29
0
        static void Main(string[] args)
        {
            Console.Title = "Bridge auto configuration";
            string cmnDocPath  = Environment.GetFolderPath(Environment.SpecialFolder.CommonDocuments);
            var    logFilePath = Path.Combine(cmnDocPath, "BpOmniaBridge", "autoConfigLog.txt");
            Log    log         = new Log(logFilePath);

            log.CreateUtilityFolders();
            log.CreateLogFile();

            try
            {
                Console.WriteLine("BpOmniaBridge is setting up Omnia ACS file:");
                log.WriteLog("BpOmniaBridge is setting up Omnia ACS file:", true);

                // OMNIA settings
                var       acsFile        = Path.Combine(cmnDocPath, "Cosmed", "CosmedLab", "acs.xml");
                var       bridgeTempFile = Path.Combine(cmnDocPath, "BpOmniaBridge", "temp_files");
                XDocument doc            = XDocument.Load(acsFile);
                XElement  bridgeControl  = doc.Element("ExtendedConfiguration").Element("Bridge").Element("Control");
                bridgeControl.Attribute("ID").Value = "file";
                Console.WriteLine("  ID -> file  ");
                log.WriteLog("ID -> file");
                Thread.Sleep(500);
                bridgeControl.Attribute("Value").Value = "xml";
                Console.WriteLine("  Value -> xml  ");
                log.WriteLog("Value -> xml");
                Thread.Sleep(500);
                bridgeControl.Attribute("Item2").Value = "utf-8";
                Console.WriteLine("  Item2 -> utf-8  ");
                log.WriteLog("Item2 -> utf-8");
                Thread.Sleep(500);
                bridgeControl.Attribute("Item3").Value = bridgeTempFile;
                Console.WriteLine("  Item3 -> " + bridgeTempFile + "  ");
                log.WriteLog("Item3 -> " + bridgeTempFile);
                Thread.Sleep(500);
                bridgeControl.Attribute("Item4").Value = "OmniaXB";
                Console.WriteLine("  Item4 -> OmniaXB  ");
                log.WriteLog("Item4 -> OmniaXB");
                Thread.Sleep(500);

                doc.Save(acsFile);

                Console.WriteLine("Omnia settings updated - please create User as per documentation");
                Console.WriteLine(" ");
                Console.WriteLine("....please wait....");
                Console.WriteLine(" ");
                Thread.Sleep(1000);

                // Best Practice settings
                Console.WriteLine("BpOmniaBridge is setting up Best Practice register:");
                log.WriteLog("BpOmniaBridge is setting up Best Practice register:");
                string progFolder;
                try
                {
                    progFolder = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86);
                }
                catch
                {
                    progFolder = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles);
                }
                string bridgePath = Path.Combine(progFolder, "COSMED", "BpOmniaBridge", "BpOmniaBridge.exe");

                if (!File.Exists(bridgePath))
                {
                    throw new Exception("Bridge software not found. Please restart the installation leaving the default installation folder.");
                }

                ModifyRegistry bpRegestry = new ModifyRegistry();
                string         subKey1    = "SOFTWARE\\Best Practice Software\\Best Practice\\Device";
                string         subKey2    = "SOFTWARE\\Wow6432Node\\Best Practice Software\\Best Practice\\Device";

                try
                {
                    bpRegestry.SubKey = subKey1;
                    bpRegestry.Write("SpiroPath", bridgePath);
                }
                catch
                {
                    bpRegestry.SubKey = subKey2;

                    bpRegestry.Write("SpiroPath", bridgePath);
                }

                Console.WriteLine("  SpiroPath -> " + bridgePath + "  ");
                log.WriteLog("SpiroPath -> " + bridgePath);
                Thread.Sleep(500);

                bpRegestry.Write("SpiroClass", "WindowsForms10.Window.8.app.0.13965fa_r11_ad1");
                Console.WriteLine("  SpiroClass -> WindowsForms10.Window.8.app.0.13965fa_r11_ad1 ");
                log.WriteLog("SpiroClass -> WindowsForms10.Window.8.app.0.13965fa_r11_ad1");
                Thread.Sleep(500);
                var fileVersion = FileVersionInfo.GetVersionInfo(bridgePath).FileVersion;
                bpRegestry.Write("SpiroName", "BP/Omnia Bridge v" + fileVersion);
                Console.WriteLine("  SpiroName -> BP/Omnia Bridge v" + fileVersion + " ");
                log.WriteLog("SpiroName -> BP/Omnia Bridge v" + fileVersion);
                Thread.Sleep(500);

                Console.WriteLine("");
                Console.WriteLine("Configuration's process successfully done!");
                log.WriteLog("Configuration's process successfully done!");
                Console.WriteLine("");
                Console.WriteLine("...Click enter to close this...");
                Console.ReadLine();
            }
            catch (Exception ex)
            {
                Console.WriteLine("");
                Console.WriteLine("");
                Console.WriteLine("..........AN ERROR OCCURED.........");
                log.WriteLog("..........AN ERROR OCCURED.........");
                Console.WriteLine("Here more details:");
                log.WriteLog("Here more details:");
                Console.WriteLine(ex.Message);
                log.WriteLog(ex.Message);
                Console.WriteLine("");
                Console.WriteLine("");
                if (ex.Message.Contains("denied"))
                {
                    Console.WriteLine("Please try to run the installation again as Administrator");
                    Console.WriteLine("");
                    Console.WriteLine("");
                }
                Console.WriteLine("...Click enter to close this...");
                Console.ReadLine();
            }
        }
Example #30
0
        public bool init()
        {
            try
            {
                this.Text         = "BeanfunLogin - v" + Properties.Settings.Default.currentVersion.ToString().Insert(1, ".").Insert(3, ".");
                this.AcceptButton = this.button1;
                this.bfClient     = null;
                //Properties.Settings.Default.Reset(); //SetToDefault.

                // Handle settings.
                if (Properties.Settings.Default.rememberAccount == true)
                {
                    this.textBox1.Text = Properties.Settings.Default.AccountID;
                }
                if (Properties.Settings.Default.rememberPwd == true && Properties.Settings.Default.loginMethod != 2)
                {
                    this.checkBox1.Enabled = false;
                    // Load password.
                    if (File.Exists("UserState.dat"))
                    {
                        Byte[] cipher    = File.ReadAllBytes("UserState.dat");
                        string entropy   = Properties.Settings.Default.entropy;
                        byte[] plaintext = ProtectedData.Unprotect(cipher, Encoding.UTF8.GetBytes(entropy), DataProtectionScope.CurrentUser);
                        this.textBox2.Text = System.Text.Encoding.UTF8.GetString(plaintext);
                    }
                }
                if (Properties.Settings.Default.autoLogin == true && Properties.Settings.Default.loginMethod != 2 && Properties.Settings.Default.loginMethod != 4)
                {
                    this.UseWaitCursor  = true;
                    this.panel2.Enabled = false;
                    this.button1.Text   = "請稍後...";
                    this.backgroundWorker2.RunWorkerAsync(Properties.Settings.Default.loginMethod);
                }
                if (Properties.Settings.Default.gamePath == "")
                {
                    ModifyRegistry myRegistry = new ModifyRegistry();
                    myRegistry.BaseRegistryKey = Registry.CurrentUser;
                    myRegistry.SubKey          = "Software\\Gamania\\MapleStory";
                    if (myRegistry.Read("Path") != "")
                    {
                        Properties.Settings.Default.gamePath = myRegistry.Read("Path");
                    }
                }

                this.comboBox1.SelectedIndex = Properties.Settings.Default.loginMethod;
                this.textBox3.Text           = "";

                if (this.textBox1.Text == "")
                {
                    this.ActiveControl = this.textBox1;
                }
                else if (this.textBox2.Text == "")
                {
                    this.ActiveControl = this.textBox2;
                }

                // .NET textbox full mode bug.
                this.textBox1.ImeMode = ImeMode.OnHalf;
                this.textBox2.ImeMode = ImeMode.OnHalf;
                return(true);
            }
            catch { return(errexit("初始化失敗,未知的錯誤。", 0)); }
        }