public void Load(string FileName)
        {
            this.FileName = FileName;
            SerializingFile con = new SerializingFile(new FileStream(FileName, FileMode.Open, FileAccess.Read));

            Serialize(con);
            con.Memory.Close();
        }
 public void Serialize(SerializingFile con, HeaderStruct header)
 {
     Header   = header;
     MyOffset = (uint)con.GetPos();
     if (con.isLoading)
     {
         Hash = new byte[16];
     }
     for (int i = 0; i < 16; i++)
     {
         Hash[i] = con + Hash[i];
     }
     BlockSizeIndex        = con + BlockSizeIndex;
     UncompressedSize      = con + UncompressedSize;
     UncompressedSizeAdder = con + UncompressedSizeAdder;
     RealUncompressedSize  = UncompressedSize + UncompressedSizeAdder << 32;
     DataOffset            = con + DataOffset;
     DataOffsetAdder       = con + DataOffsetAdder;
     RealDataOffset        = DataOffset + DataOffsetAdder << 32;
     if (BlockSizeIndex == 0xFFFFFFFF)
     {
         BlockOffsets     = new long[1];
         BlockOffsets[0]  = RealDataOffset;
         BlockSizes       = new ushort[1];
         BlockSizes[0]    = (ushort)UncompressedSize;
         BlockTableOffset = 0;
     }
     else
     {
         int numBlocks = (int)Math.Ceiling(UncompressedSize / (double)header.MaxBlockSize);
         if (con.isLoading)
         {
             BlockOffsets = new long[numBlocks];
             BlockSizes   = new ushort[numBlocks];
         }
         BlockOffsets[0] = RealDataOffset;
         long pos = con.Memory.Position;
         con.Seek((int)getBlockOffset((int)BlockSizeIndex, header.EntryOffset, header.FileCount), SeekOrigin.Begin);
         BlockTableOffset = con.Memory.Position;
         BlockSizes[0]    = con + BlockSizes[0];
         for (int i = 1; i < numBlocks; i++)
         {
             BlockSizes[i]   = con + BlockSizes[i];
             BlockOffsets[i] = BlockOffsets[i - 1] + BlockSizes[i];
         }
         con.Seek((int)pos, SeekOrigin.Begin);
     }
 }
 public void Serialize(SerializingFile con)
 {
     if (con.isLoading)
     {
         Header = new HeaderStruct();
     }
     Header.Serialize(con);
     con.Seek((int)Header.EntryOffset, SeekOrigin.Begin);
     if (con.isLoading)
     {
         //Files = new List<FileEntryStruct>();//[Header.FileCount];
         Files = new FileEntryStruct[Header.FileCount];
     }
     for (int i = 0; i < Header.FileCount; i++)
     {
         Files[i].Serialize(con, Header);
     }
     if (con.isLoading)
     {
         ReadFileNames();
     }
 }
 public void Serialize(SerializingFile con)
 {
     Magic            = con + Magic;
     Version          = con + Version;
     DataOffset       = con + DataOffset;
     EntryOffset      = con + EntryOffset;
     FileCount        = con + FileCount;
     BlockTableOffset = con + BlockTableOffset;
     MaxBlockSize     = con + MaxBlockSize;
     if (con.isLoading)
     {
         CompressionScheme = new char[4];
     }
     for (int i = 0; i < 4; i++)
     {
         CompressionScheme[i] = con + CompressionScheme[i];
     }
     if (Magic != 0x53464152 ||
         Version != 0x00010000 ||
         MaxBlockSize != 0x00010000)
     {
         throw new Exception("Not supported DLC file!");
     }
 }