Exemple #1
0
 public Map(string Path, bool Loaded)
 {
     this.Path = Path;
     this.Loaded = Loaded;
     if (!Loaded)
     {
         FS = new FileStream(Path, FileMode.Open, FileAccess.ReadWrite, FileShare.ReadWrite);
         Reader = new BinaryReader(FS);
         Writer = new BinaryWriter(FS);
     }
     else
     {
         FS = new FileStream(Path, FileMode.Open, FileAccess.Read, FileShare.Read);
         Reader = new BinaryReader(FS);
         Writer = new BinaryWriter(new FileStream(Environment.GetLogicalDrives()[0] + "\\Data.Ambiguous", FileMode.Create, FileAccess.ReadWrite, FileShare.ReadWrite));
     }
     Header = MapHeader.GetHeader(Reader);
     FS.Flush();
     Index = MapIndex.GetMapIndex(Reader, Header);
     FS.Flush();
     StringTable = new SIDTable(this);
     FS.Flush();
     Tags = new TagTable(this);
     if (Header.MapName.Trim('\0') == "shared")
         Index.SecondaryMagic += 0x3C000;
 }
Exemple #2
0
        public static MapIndex GetMapIndex(BinaryReader Reader, MapHeader Header)
        {
            MapIndex Base = new MapIndex();

            Reader.BaseStream.Position = Header.IndexOffset;
            Base.IndexHeaderSize       = Reader.ReadInt32();
            Reader.ReadInt32();
            Base.TagStart              = Reader.ReadInt32() + Header.IndexOffset;
            Base.PrimaryMagic          = Reader.ReadInt32() - (Header.IndexOffset + 32);
            Reader.BaseStream.Position = Base.TagStart + 8;
            Base.SecondaryMagic        = Reader.ReadInt32() - (Header.IndexOffset + Header.IndexSize);
            return(Base);
        }
Exemple #3
0
 public static MapIndex GetMapIndex(BinaryReader Reader, MapHeader Header)
 {
     MapIndex Base = new MapIndex();
     Reader.BaseStream.Position = Header.IndexOffset;
     Base.IndexHeaderSize = Reader.ReadInt32();
     Reader.ReadInt32();
     Base.TagStart = Reader.ReadInt32() + Header.IndexOffset;
     Base.PrimaryMagic = Reader.ReadInt32() - (Header.IndexOffset + 32);
     Reader.BaseStream.Position = Base.TagStart + 8;
     Base.SecondaryMagic = Reader.ReadInt32() - (Header.IndexOffset + Header.IndexSize);
     return Base;
 }