/// <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;
            //}
        }
示例#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();
                }
            }
        }
示例#3
0
        private void parseRegistryVals()
        {
            regedit.BaseRegistryKey = Registry.CurrentUser;
            regedit.SubKey          = AppController.APP_KEY;
            updateDirectory         = regedit.Read("UpdateDirectory");

            String tmpUpdate = regedit.Read("Update");

            if (tmpUpdate == "1")
            {
                update = true;
            }
            else
            {
                update = false;
            }

            regedit.SubKey = AppController.HKCU_RUN;

            if (regedit.Read(Application.ProductName) != null)
            {
                startup = true;
            }
            else
            {
                startup = false;
            }
        }
示例#4
0
        private void GetSettings()
        {
            txtAddress.Text    = ModReg.Read("Address", "224.0.0.3");
            txtAdapter.Text    = ModReg.Read("Adapter", "192.168.1.1");
            txtPortSend.Text   = ModReg.Read("PortSend", "8001");
            txtPortListen.Text = ModReg.Read("PortListen", "8002");
            txtMulticast.Text  = ModReg.Read("MulticastAddress", "224.0.0.3");
            txtTTL.Text        = ModReg.Read("TTL", "5");
            if (ModReg.Read("MultiCast", "Y") == "Y")
            {
                chkMulticast.Checked = true;
            }
            else
            {
                chkMulticast.Checked = false;
            }
            PathName = ModReg.Read("PathName", "");

            txrPathName.Text = PathName;
            if (File.Exists(PathName))
            {
                rtxtThreatCmd.Text = CreateThreat();
                PopulateTxt();
            }
            txtUID.Text = ModReg.Read("UID");
            if (txtUID.Text == "")
            {
                txtUID.Text = "0";
            }
            if (!(int.TryParse(txtUID.Text, out ThreatUID)))
            {
                txtUID.Text = "0";
                ThreatUID   = 0;
            }
        }
示例#5
0
        public static bool CountExpired()
        {
            m_myReg.SubKey = m_supKey;
            string already = m_myReg.Read(m_Index);

            if (String.IsNullOrEmpty(already))
            {
                m_myReg.Write(m_Index, StringCipher.Encrypt("" + 0, m_pd));
                return(false);
            }
            string old = "";

            try {
                old = StringCipher.Decrypt(already, m_pd);
            }
            catch (Exception ex) {
                return(true);
            }
            int newIdx = int.Parse(old) + 1;

            if (m_count < newIdx)
            {
                return(true);
            }
            m_myReg.Write(m_Index, StringCipher.Encrypt($"{newIdx}", m_pd));
            return(false);
        }
示例#6
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); }
        }
示例#7
0
        private void parseRegistryVals()
        {
            regedit.BaseRegistryKey = Registry.CurrentUser;
            regedit.SubKey          = APP_KEY;
            updateDirectory         = regedit.Read("UpdateDirectory");
            String tmpUpdate = regedit.Read("Update");

            if (tmpUpdate == "1")
            {
                update = true;
            }
            else
            {
                update = false;
            }
        }
示例#8
0
 public static void loadValues()
 {
     windowsLogin = ((int)reg.Read("windowsLogin", 1) == 1);
     serverLogin  = ((int)reg.Read("serverLogin", 1) == 1);
     dbType       = (string)reg.Read("dbType", "MSSQL");
     SqlHost      = (string)reg.Read("SqlHost", "localhost");
     SqlDatabase  = (string)reg.Read("SqlDatabase", "email2sms");
     SqlUsername  = (string)reg.Read("SqlUsername", "root");
     SqlPassword  = Cryptho.Decrypt((string)reg.Read("SqlPassword", Cryptho.Encrypt("adminadmin")));
     loggingLevel = (string)reg.Read("loggingLevel", "Normal");
 }
        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;
            }
        }
示例#10
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
                {
                }
            }
        }
示例#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);
        }
示例#12
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");
        }
示例#13
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);
            }
        }
示例#14
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));
            }
        }
示例#15
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();
        }
示例#16
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();
            }
        }
示例#17
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");
 }
示例#18
0
文件: Conf.cs 项目: WinnieP/HSTracker
 public string LogPath()
 {
     return(uninstallRegistry.Read("InstallLocation") + @"\Hearthstone_Data\output_log.txt");
 }
示例#19
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)); }
        }