Example #1
0
        public void LoadIniFile(FileSystemEntry entry, bool included = false)
        {
            using (GameTrace.TraceDurationEvent($"LoadIniFile('{entry.FilePath}'"))
            {
                if (!included && !entry.FilePath.ToLowerInvariant().EndsWith(".ini"))
                {
                    return;
                }

                if (_alreadyLoaded.Contains(entry.FilePath))
                {
                    return;
                }

                string source;

                using (var stream = entry.Open())
                    using (var reader = new StreamReader(stream, Encoding.ASCII))
                    {
                        source = reader.ReadToEnd();
                    }

                var parser = new IniParser(source, entry, this, _game);
                parser.ParseFile();

                _alreadyLoaded.Add(entry.FilePath);
            }
        }
Example #2
0
        public void LoadIniFile(FileSystemEntry entry)
        {
            if (_alreadyLoaded.Contains(entry.FilePath))
            {
                return;
            }

            string source;

            using (var stream = entry.Open())
                using (var reader = new StreamReader(stream, Encoding.ASCII))
                {
                    source = reader.ReadToEnd();
                }

            var parser = new IniParser(source, entry, this);

            parser.ParseFile();

            _alreadyLoaded.Add(entry.FilePath);
        }