Ejemplo n.º 1
0
        /// <summary>
        /// Constructs the wrapper(Opens/decryptes the effect data file and starts the logger)
        /// </summary>
        public EffectWrapper()
        {
            bLogger = new BasicLogger(elog);
            _effectEncrypter = new EncrypterDecrypter(_key);
            string decryptedResults = _effectEncrypter.decryptFile(epath);
            int numOfEffects = 0;
            if (decryptedResults.Length > 0)
            {
                numOfEffects = ParseItems.parseIntFrom(decryptedResults, 4);
                decryptedResults = decryptedResults.Substring(4);
            }

            int i = 0;
            while (i < numOfEffects)
            {
                int length = ParseItems.parseIntFrom(decryptedResults, 3);
                decryptedResults = decryptedResults.Substring(3);
                string currentEffect = ParseItems.parseStringFrom(decryptedResults, length);
                _listOfEffects.Add(new Effect(currentEffect));
                _usedIDs.Add(_listOfEffects.Last().id);
                decryptedResults = decryptedResults.Substring(length);
                i++;
            }
        }
        public AbilityWrapper()
        {
            bLogger = new BasicLogger(alog);
            _abilityEncrypter = new EncrypterDecrypter(_key);
            string decryptedResults = _abilityEncrypter.decryptFile(apath);
            int numOfAbilities = 0;
            if (decryptedResults.Length > 0)
            {
                numOfAbilities = ParseItems.parseIntFrom(decryptedResults, 4);
                decryptedResults = decryptedResults.Substring(4);
            }

            int i = 0;
            while (i < numOfAbilities)
            {
                int length = ParseItems.parseIntFrom(decryptedResults, 3);
                decryptedResults = decryptedResults.Substring(3);
                string currentAbility = ParseItems.parseStringFrom(decryptedResults, length);
                _listOfAbilities.Add(new Ability(currentAbility));
                _usedIDs.Add(_listOfAbilities.Last().id);
                decryptedResults = decryptedResults.Substring(length);
                i++;
            }
        }