public ThirdGenLanguage(ThirdGenLanguageGlobals languageGlobals, StructureValueCollection values, IndexOffsetConverter converter, BuildInformation buildInfo)
 {
     _languageGlobals = languageGlobals;
     _pointerLayout = buildInfo.GetLayout("locale index table entry");
     _encryptionKey = buildInfo.LocaleKey;
     _symbols = buildInfo.LocaleSymbols;
     _converter = converter;
     _pageSize = buildInfo.LocaleAlignment;
     Load(values, converter);
 }
        private IReader DecryptData(IReader reader, Pointer dataLocation, int tableSize, AESKey key)
        {
            // Round the table size to an AES block size
            tableSize = (tableSize + 0xF) & ~0xF;

            reader.SeekTo(dataLocation.AsOffset());
            byte[] data = reader.ReadBlock(tableSize);
            if (key != null)
                data = AES.Decrypt(data, key.Key, key.IV);
            return new EndianReader(new MemoryStream(data), Endian.BigEndian);
        }
        public ThirdGenStringTable(IReader reader, int count, int tableSize, Pointer indexTableLocation, Pointer dataLocation, AESKey key)
        {
            int[] offsets = ReadOffsets(reader, indexTableLocation, count);
            IReader stringReader = DecryptData(reader, dataLocation, tableSize, key);

            // Read each string
            stringReader.SeekTo(0);
            for (int i = 0; i < offsets.Length; i++)
            {
                stringReader.SeekTo(offsets[i]);
                _strings.Add(stringReader.ReadAscii());
            }
        }
 public BuildInformation(string game, string localeKey, string stringidKey, IStringIDResolver stringIDResolver, string filenameKey, int headerSize, bool loadStrings, string layoutFile, string shortName, string pluginFolder, string scriptDefsFile, int localeAlignment)
 {
     _gameName = game;
     if (localeKey != null)
         _localeKey = new AESKey(localeKey);
     if (stringidKey != null)
         _stringidKey = new AESKey(stringidKey);
     _stringIDResolver = stringIDResolver;
     if (filenameKey != null)
         _filenameKey = new AESKey(filenameKey);
     _headerSize = headerSize;
     _loadStrings = loadStrings;
     _layoutFile = layoutFile;
     _shortName = shortName;
     _pluginFolder = pluginFolder;
     _scriptDefsFile = scriptDefsFile;
     _localeAlignment = localeAlignment;
 }