BitCollectors.QfgCharacterEditor.Library.GameInfo.Qfg1GameInfo.LoadCharacterString C# (CSharp) Method

LoadCharacterString() public method

public LoadCharacterString ( string characterString, QfgCharacter character ) : void
characterString string
character QfgCharacter
return void
        public void LoadCharacterString(string characterString, QfgCharacter character)
        {
            character.QfgClass = QfgClasses.Fighter;
            character.QfgGame = QfgGames.QFG1;

            string hexString = characterString;
            List<int> hexArray = new List<int>();

            while (hexString.Length > 0)
            {
                string hexValue = hexString.Substring(hexString.Length - 2, 2);
                hexString = hexString.Substring(0, hexString.Length - 2);
                hexArray.Add(Convert.ToInt32(hexValue.Trim(), 16));
            }

            hexArray.Add(0x53);
            hexArray.Reverse();

            int prev = 0;// x53;
            int index = 0;
            int total1 = 0xce;
            int total2 = 0;

            List<int> decodedValues = new List<int>();
            string decodedStr = "";
            foreach (int val in hexArray)
            {
                int decoded = val;
                decoded ^= prev & 127;

                decodedStr += decoded.ToString() + "-";
                decodedValues.Add(decoded);

                this.LoadMappings(index, decoded, character);

                prev = val;
                index++;
            }

            string total1Str = "";

            for (int i = 0; i < 35; i += 2)
            {
                total1 += decodedValues[i + 1];

                total1Str += decodedValues[i + 1].ToString() + "-";
            }

            for (int i = 1; i < 35; i += 2)
            {
                total2 += decodedValues[i + 1];
            }

            total1 &= 127;
            total2 &= 127;

            if (character.CheckSum1 != total1 || character.CheckSum2 != total2)
            {
                //throw new Exception("Invalid Character Checksums");
            }
        }