internal static object ProcessSubRecord(SubRecordOperationType operation, ISubRecordOperationContext context) { var key = new SubRecordProcessKey(context.RecordName, context.SubRecordName, operation); if (!SubRecordProcessingDefinitions.ContainsKey(key)) { throw new ArgumentException($"Unrecognized sub-record operation: {key}"); } if (operation == SubRecordOperationType.Read) { var readContext = (SubRecordReadContext)context; if (readContext.buf.Length < readContext.header.Size) { var buf0 = new byte[readContext.header.Size + REALLOCATION_STEP_SIZE]; Array.Copy(readContext.buf, buf0, readContext.buf.Length); readContext.buf = buf0; } readContext.stream.Read(readContext.buf, 0, readContext.header.Size); } return(SubRecordProcessingDefinitions[key].Invoke(null, new object[] { context })); }
internal SubRecordProcessKey(string recordName, string subRecordName, SubRecordOperationType type) { this.recordName = recordName; this.subRecordName = subRecordName; this.type = type; }
internal HandlesOperation(SubRecordOperationType operation) { SubRecordOperation = operation; }