public void Add(AmtEncodingInstruction inst) { var currentIndex = (uint)mInstructions.Count; mInstructions.Add(new AmtRecordInstruction { Index = inst.Index, Operation = inst.Operation, }); if (mCurrentContext == null) { InitializeNewContext(inst, currentIndex); } else { if (mCurrentContext.Category == inst.Category) { mCurrentContext.Last = currentIndex; } else { InitializeNewContext(inst, currentIndex); } } }
void InitializeNewContext(AmtEncodingInstruction inst, uint currentIndex) { mCurrentContext = new AmtEncoderContext { Category = inst.Category, First = currentIndex, Last = currentIndex, }; mContexts.Add(mCurrentContext); }