Пример #1
0
        public CacheFile(GameCache cacheContext, FileInfo file, CacheVersion version, bool memory)
        {
            CacheContext = cacheContext;
            File         = file;
            Version      = version;
            Deserializer = new TagDeserializer(Version);

            Stream = memory ? new MemoryStream() : (Stream)file.OpenRead();

            if (memory)
            {
                using (var fileStream = file.OpenRead())
                {
                    fileStream.Seek(0, SeekOrigin.Begin);
                    fileStream.CopyTo(Stream);
                }
            }

            Reader = new EndianReader(Stream, EndianFormat.LittleEndian);

            Reader.SeekTo(0);
            if (Reader.ReadTag() == "daeh")
            {
                Reader.Format = EndianFormat.BigEndian;
            }

            Reader.SeekTo(0);
            Header = Deserializer.Deserialize <CacheFileHeader>(new DataSerializationContext(Reader));
        }
Пример #2
0
 public virtual void Close()
 {
     Reader.Close();
     Reader.Dispose();
     LocaleTables.Clear();
     Strings.Clear();
     IndexItems.Clear();
     Header      = null;
     IndexHeader = null;
 }
Пример #3
0
 public virtual void Close()
 {
     Reader.Close();
     Reader.Dispose();
     LocaleTables.Clear();
     Strings.Clear();
     IndexItems.Clear();
     ResourceLayoutTable = null;
     ResourceGestalt     = null;
     Header      = null;
     IndexHeader = null;
 }