Пример #1
0
        public LicenseManager()
        {
            //IniParser ini = new IniParser(@"chocobot.ini");
            IniParserLegacy.IniFile ini = new IniParserLegacy.IniFile(System.Windows.Forms.Application.StartupPath + "\\chocobot.ini");

            string user = "";
            string password = "";

            try
            {
                user = ini.IniReadValue("Credentials", "UserName");
                password = ini.IniReadValue("Credentials", "Password");
            }
            catch (Exception)
            {
            }

            if(user == "" || password == "")
            {

                clsCredentials userinput = new clsCredentials();
                clsCredentials.Credentials credentials = userinput.Show();

                try
                {
                    user = credentials.User;
                    password = GetMd5Hash(CleanPassword(credentials.Password));
                }catch (Exception)
                {
                    user = "";
                    password = "";
                }

            }

            _user = user;
            _pass = password;
        }
Пример #2
0
        private void btn_LoadRecipe_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog dlg = new OpenFileDialog();
            dlg.Filter = "Crafting Recipe (*.crft)|*.crft";
            if (dlg.ShowDialog() == false)
                return;

            IniParserLegacy.IniFile ini = new IniParserLegacy.IniFile(dlg.FileName);

            int keycount = int.Parse(ini.IniReadValue("Main", "KeyCount"));

            _keyConditions.Clear();

            for(int i = 0 ; i < keycount ; i++)
            {
                CraftingKey newkey = new CraftingKey();
                newkey.Key = (Keys)Enum.Parse(typeof(Keys), ini.IniReadValue("Key" + (i + 1), "key"), true);
                newkey.CP = short.Parse(ini.IniReadValue("Key" + (i + 1), "cp"));
                newkey.CPCondition = bool.Parse(ini.IniReadValue("Key" + (i + 1), "cpcondition"));

                newkey.Durability = short.Parse(ini.IniReadValue("Key" + (i + 1), "durability"));
                newkey.DurabilityCondition = bool.Parse(ini.IniReadValue("Key" + (i + 1), "durabilitycondition"));

                try
                {
                    newkey.ControlKey = bool.Parse(ini.IniReadValue("Key" + (i + 1), "controlkey"));
                } catch (Exception ex)
                {
                    newkey.ControlKey = false;
                }

                newkey.Condition = ini.IniReadValue("Key" + (i + 1), "condition");
                try
                {
                    newkey.ConditionCondition = bool.Parse(ini.IniReadValue("Key" + (i + 1), "conditioncondition"));
                } catch (Exception ex)
                {
                    newkey.ConditionCondition = false;
                }

                newkey.Progress = short.Parse(ini.IniReadValue("Key" + (i + 1), "progress"));
                newkey.ProgressCondition = bool.Parse(ini.IniReadValue("Key" + (i + 1), "progresscondition"));

                _keyConditions.Add(newkey);
            }
        }