private ContinuationSystemUseEntry Parse(IsoContext context, byte[] data, int offset) { ContinuationSystemUseEntry contEntry = null; SuspExtension extension = null; if (context.SuspExtensions != null && context.SuspExtensions.Count > 0) { extension = context.SuspExtensions[0]; } int pos = offset; while (data.Length - pos > 4) { int len; SystemUseEntry entry = SystemUseEntry.Parse(data, pos, context.VolumeDescriptor.CharacterEncoding, extension, out len); pos += len; if (entry == null) { // Skip if unknown continue; } switch (entry.Name) { case "ST": // Abort return(contEntry); case "CE": contEntry = (ContinuationSystemUseEntry)entry; break; case "ES": ExtensionSelectSystemUseEntry esEntry = (ExtensionSelectSystemUseEntry)entry; extension = context.SuspExtensions[esEntry.SelectedExtension]; break; case "PD": break; case "SP": case "ER": StoreEntry(null, entry); break; default: StoreEntry(extension, entry); break; } } return(contEntry); }
private void StoreEntry(SuspExtension extension, SystemUseEntry entry) { string extensionId = extension == null ? string.Empty : extension.Identifier; Dictionary <string, List <SystemUseEntry> > extensionEntries; if (!_records.TryGetValue(extensionId, out extensionEntries)) { extensionEntries = new Dictionary <string, List <SystemUseEntry> >(); _records.Add(extensionId, extensionEntries); } List <SystemUseEntry> entries; if (!extensionEntries.TryGetValue(entry.Name, out entries)) { entries = new List <SystemUseEntry>(); extensionEntries.Add(entry.Name, entries); } entries.Add(entry); }
public static SystemUseEntry Parse(byte[] data, int offset, Encoding encoding, SuspExtension extension, out int length) { string name = Utilities.BytesToString(data, offset, 2); length = data[offset + 2]; switch (name) { case "CE": return new ContinuationSystemUseEntry(data, offset); case "PD": return new PaddingSystemUseEntry(data, offset); case "SP": return new SharingProtocolSystemUseEntry(data, offset); case "ST": return new TerminatorSystemUseEntry(data, offset); case "ER": return new ExtensionSystemUseEntry(data, offset, encoding); case "ES": return new ExtensionSelectSystemUseEntry(data, offset); default: if (extension == null) { return new GenericSystemUseEntry(data, offset); } else { return extension.Parse(name, data, offset, length, encoding); } } }
public static SystemUseEntry Parse(byte[] data, int offset, Encoding encoding, SuspExtension extension, out int length) { string name = Utilities.BytesToString(data, offset, 2); length = data[offset + 2]; switch (name) { case "CE": return(new ContinuationSystemUseEntry(data, offset)); case "PD": return(new PaddingSystemUseEntry(data, offset)); case "SP": return(new SharingProtocolSystemUseEntry(data, offset)); case "ST": return(new TerminatorSystemUseEntry(data, offset)); case "ER": return(new ExtensionSystemUseEntry(data, offset, encoding)); case "ES": return(new ExtensionSelectSystemUseEntry(data, offset)); default: if (extension == null) { return(new GenericSystemUseEntry(data, offset)); } else { return(extension.Parse(name, data, offset, length, encoding)); } } }