public bool Parse(int start, byte[] buffer, int size, ref int processed) { processed = 0; if (size < 38) return false; VolumeTag tag = new VolumeTag(); tag.Parse(start, buffer, size); if (tag.Identifier != (short)VolumeDescriptorType.FileId) return false; _fileCharacteristics = buffer[start + 18]; int idLen = buffer[start + 19]; this.Icb.Parse(start + 20, buffer); int impLen = UdfHelper.Get16(start + 36, buffer); if (size < 38 + idLen + impLen) return false; processed = 38; processed += impLen; this.Identifier.Parse(start + processed, buffer, idLen); processed += idLen; for (; (processed & 3) != 0; processed++) if (buffer[start + processed] != 0) return false; return (processed <= size); }
public bool Parse(int start, byte[] buffer, int size, ref int processed) { processed = 0; if (size < 38) { return(false); } VolumeTag tag = new VolumeTag(); tag.Parse(start, buffer, size); if (tag.Identifier != (short)VolumeDescriptorType.FileId) { return(false); } _fileCharacteristics = buffer[start + 18]; int idLen = buffer[start + 19]; this.Icb.Parse(start + 20, buffer); int impLen = UdfHelper.Get16(start + 36, buffer); if (size < 38 + idLen + impLen) { return(false); } processed = 38; processed += impLen; this.Identifier.Parse(start + processed, buffer, idLen); processed += idLen; for (; (processed & 3) != 0; processed++) { if (buffer[start + processed] != 0) { return(false); } } return(processed <= size); }