Exemple #1
0
        public IniParser(FileSystemEntry entry, AssetStore assetStore, SageGame sageGame, IniDataContext dataContext, Encoding localeSpecificEncoding)
        {
            var iniEncoding = Encoding.ASCII;

            {
                // Use locale specific encoding if a "9x ini file" is present:
                // https://github.com/OpenSAGE/OpenSAGE/issues/405
                var localeSpecificFileName = Path.ChangeExtension(entry.FilePath, null) + "9x.ini";
                var localeSpecificEntry    = entry.FileSystem.GetFile(localeSpecificFileName);
                if (localeSpecificEntry != null)
                {
                    entry       = localeSpecificEntry;
                    iniEncoding = localeSpecificEncoding;
                }
            }

            _directory   = Path.GetDirectoryName(entry.FilePath);
            _dataContext = dataContext;
            _fileSystem  = entry.FileSystem;
            _assetStore  = assetStore;
            SageGame     = sageGame;
            _encoding    = iniEncoding;

            _tokenReader = CreateTokenReader(entry, _encoding);

            _currentBlockOrFieldStack = new Stack <string>();
        }
        public IniParser(FileSystemEntry entry, AssetStore assetStore, SageGame sageGame, IniDataContext dataContext)
        {
            _directory   = Path.GetDirectoryName(entry.FilePath);
            _dataContext = dataContext;
            _fileSystem  = entry.FileSystem;
            _assetStore  = assetStore;
            SageGame     = sageGame;

            _tokenReader = CreateTokenReader(entry);

            _currentBlockOrFieldStack = new Stack <string>();
        }