private void DecodeIndexableConfigCommand(IndexableConfigCommand command) { var maybeIndex = IndexAsInt(command); switch (command.Op) { case ConfigOp.Option when command.ModeFlag: DecodeOption(maybeIndex); break; case ConfigOp.Option when !command.ModeFlag: DecodeOptionCount(); break; case ConfigOp.ConfigSetting when command.ModeFlag: DecodeConfigSetting(maybeIndex); break; case ConfigOp.ConfigSetting when !command.ModeFlag: DecodeConfigSettingCount(); break; case ConfigOp.ConfigResult: DecodeConfigResult(maybeIndex); break; // See above for why this is here. case ConfigOp.IpRestriction when command.ModeFlag: DecodeIpRestriction(command.HasIndex); break; case ConfigOp.IpRestriction when !command.ModeFlag: DecodeIpRestrictionCount(); break; default: ReportMalformedCommand(CommandGroup.Config); break; } }
private static int IndexAsInt(IndexableConfigCommand c) { return(c.HasIndex ? c.Index : -1); }