public void Read(Stream input, Encoding encoding, Dictionary <uint, string> subtitleIdDictionary) { BinaryReader reader = new BinaryReader(input, Encoding.Default, true); short magicNumber = reader.ReadInt16(); short entryCount = reader.ReadInt16(); List <SubpIndex> indices = new List <SubpIndex>(); for (int i = 0; i < entryCount; i++) { indices.Add(SubpIndex.ReadSubpIndex(input)); } foreach (var index in indices) { input.Position = index.Offset; var entry = SubpEntry.ReadSubpEntry(input, encoding); entry.SubtitleIdHash = index.SubtitleIdHash; string subtitleId; if (subtitleIdDictionary.TryGetValue(entry.SubtitleIdHash, out subtitleId)) { entry.SubtitleId = subtitleId; } Entries.Add(entry); } }
public static SubpIndex ReadSubpIndex(Stream input) { SubpIndex subpIndex = new SubpIndex(); subpIndex.Read(input); return(subpIndex); }
public void Read(Stream input, Encoding encoding) { BinaryReader reader = new BinaryReader(input, Encoding.Default, true); short magicNumber = reader.ReadInt16(); short entryCount = reader.ReadInt16(); List <SubpIndex> indices = new List <SubpIndex>(); for (int i = 0; i < entryCount; i++) { indices.Add(SubpIndex.ReadSubpIndex(input)); } foreach (var index in indices) { input.Position = index.Offset; var entry = SubpEntry.ReadSubpEntry(input, encoding); entry.SubtitleId = index.SubtitleId; Entries.Add(entry); } }
public static SubpIndex ReadSubpIndex(Stream input) { SubpIndex subpIndex = new SubpIndex(); subpIndex.Read(input); return subpIndex; }