示例#1
0
 internal static System.Collections.Generic.List <Els_kom_Core.Classes.EntryVer> Make_entries_v2(this Els_kom_Core.Classes.KOMStream kOMStream, int entrycount, System.IO.BinaryReader reader)
 {
     System.Collections.Generic.List <Els_kom_Core.Classes.EntryVer> entries = new System.Collections.Generic.List <Els_kom_Core.Classes.EntryVer>();
     for (int i = 0; i < entrycount; i++)
     {
         kOMStream.ReadInFile(reader, out string key, 60, System.Text.Encoding.ASCII);
         kOMStream.ReadInFile(reader, out int originalsize);
         kOMStream.ReadInFile(reader, out int compressedSize);
         kOMStream.ReadInFile(reader, out int offset);
         var entry = new Els_kom_Core.Classes.EntryVer(kOMStream.GetSafeString(key), originalsize, compressedSize, offset);
         entries.Add(entry);
     }
     return(entries);
 }
示例#2
0
 public void Unpack(string in_path, string out_path, string KOMFileName)
 {
     System.IO.BinaryReader reader = new System.IO.BinaryReader(System.IO.File.OpenRead(in_path), System.Text.Encoding.ASCII);
     reader.BaseStream.Position = 52;
     Els_kom_Core.Classes.KOMStream kOMStream = new Els_kom_Core.Classes.KOMStream();
     kOMStream.ReadInFile(reader, out int entry_count);
     // without this dummy read the entry instances would not get the correct
     // data leading to an crash when tring to make an file with the entry name in the output path.
     kOMStream.ReadInFile(reader, out int size);
     System.Collections.Generic.List <Els_kom_Core.Classes.EntryVer> entries = kOMStream.Make_entries_v2(entry_count, reader);
     foreach (var entry in entries)
     {
         // we iterate through every entry here and unpack the data.
         kOMStream.WriteOutput(reader, out_path, entry, SupportedKOMVersion);
     }
     kOMStream.Dispose();
     reader.Dispose();
 }