/// <summary> /// Parse the RuleAction structure. /// </summary> /// <param name="s">A stream containing the RuleAction structure</param> public override void Parse(System.IO.Stream s) { base.Parse(s); HelpMethod help = new HelpMethod(); this.NoOfActions = help.ReadCount(this.countWide, s); List <ActionBlock> tempActionBlocks = new List <ActionBlock>(); for (int i = 0; i < NoOfActions.GetHashCode(); i++) { ActionBlock tempActionBlock = new ActionBlock(CountWideEnum.twoBytes); tempActionBlock.Parse(s); tempActionBlocks.Add(tempActionBlock); } this.ActionBlocks = tempActionBlocks.ToArray(); }
/// <summary> /// Parse the ActionBlock structure. /// </summary> /// <param name="s">A stream containing the ActionBlock structure</param> public override void Parse(Stream s) { base.Parse(s); HelpMethod help = new HelpMethod(); this.ActionLength = help.ReadCount(this.countWide, s); this.ActionType = (ActionType)ReadByte(); switch (ActionType) { case ActionType.OP_REPLY: { ActionFlavor_Reply action = new ActionFlavor_Reply(); action.Parse(s); this.ActionFlavor = action; break; } case ActionType.OP_OOF_REPLY: { ActionFlavor_Reply action = new ActionFlavor_Reply(); action.Parse(s); this.ActionFlavor = action; break; } case ActionType.OP_FORWARD: { ActionFlavor_Forward action = new ActionFlavor_Forward(); action.Parse(s); this.ActionFlavor = action; break; } default: { ActionFlavor_Reserved action = new ActionFlavor_Reserved(); action.Parse(s); this.ActionFlavor = action; break; } } this.ActionFlags = ReadUint(); if ((ActionLength.GetHashCode() > 9)) { if ((ActionType.OP_MOVE == ActionType || ActionType.OP_COPY == ActionType) && countWide.Equals(CountWideEnum.twoBytes)) { OP_MOVE_and_OP_COPY_ActionData_forStandard actionData = new OP_MOVE_and_OP_COPY_ActionData_forStandard(); actionData.Parse(s); this.ActionData = actionData; } else if ((ActionType.OP_MOVE == ActionType || ActionType.OP_COPY == ActionType) && countWide.Equals(CountWideEnum.fourBytes)) { OP_MOVE_and_OP_COPY_ActionData_forExtended actionData = new OP_MOVE_and_OP_COPY_ActionData_forExtended(); actionData.Parse(s); this.ActionData = actionData; } else if ((ActionType.OP_REPLY == ActionType || ActionType.OP_OOF_REPLY == ActionType) && countWide.Equals(CountWideEnum.twoBytes)) { OP_REPLY_and_OP_OOF_REPLY_ActionData_forStandard actionData = new OP_REPLY_and_OP_OOF_REPLY_ActionData_forStandard(); actionData.Parse(s); this.ActionData = actionData; } else if ((ActionType.OP_REPLY == ActionType || ActionType.OP_OOF_REPLY == ActionType) && countWide.Equals(CountWideEnum.fourBytes)) { OP_REPLY_and_OP_OOF_REPLY_ActionData_forExtended actionData = new OP_REPLY_and_OP_OOF_REPLY_ActionData_forExtended(); actionData.Parse(s); this.ActionData = actionData; } else if (ActionType.OP_FORWARD == ActionType || ActionType.OP_DELEGATE == ActionType) { OP_FORWARD_and_OP_DELEGATE_ActionData actionData = new OP_FORWARD_and_OP_DELEGATE_ActionData(); actionData.Parse(s); this.ActionData = actionData; } else if (ActionType.OP_BOUNCE == ActionType) { OP_BOUNCE_ActionData actionData = new OP_BOUNCE_ActionData(); actionData.Parse(s); this.ActionData = actionData; } else if (ActionType.OP_TAG == ActionType) { OP_TAG_ActionData actionData = new OP_TAG_ActionData(); actionData.Parse(s); this.ActionData = actionData; } else if (ActionType.OP_DEFER_ACTION == ActionType) { OP_DEFER_ACTION actionData = new OP_DEFER_ACTION(ActionLength.GetHashCode()); actionData.Parse(s); this.ActionData = actionData; } } }