public static string Format(PSApplicationGatewayFirewallRule rule, int depth = 0) { string prefix = new string(' ', depth *ApplicationGatewayPowerShellFormatting.TabSize); return(string.Format( ApplicationGatewayPowerShellFormatting.RuleFormat, prefix, ApplicationGatewayPowerShellFormatting.NormalizeStringLength(Convert.ToString(rule.RuleId), ApplicationGatewayPowerShellFormatting.MaxRuleIdLength), rule.Description)); }
public static string Format(PSApplicationGatewayFirewallRuleGroup ruleGroup, int depth = 0) { string prefix = new string(' ', depth *ApplicationGatewayPowerShellFormatting.TabSize); StringBuilder output = new StringBuilder(); output.AppendFormat("{0}{1}:\n", prefix, ruleGroup.RuleGroupName); depth++; prefix = new string(' ', depth *ApplicationGatewayPowerShellFormatting.TabSize); output.AppendFormat("{0}{1}\n", prefix, "Description:"); depth++; prefix = new string(' ', depth *ApplicationGatewayPowerShellFormatting.TabSize); output.AppendFormat("{0}{1}\n", prefix, ruleGroup.Description); depth--; prefix = new string(' ', depth *ApplicationGatewayPowerShellFormatting.TabSize); output.AppendFormat("{0}{1}\n", prefix, "Rules:"); depth++; prefix = new string(' ', depth *ApplicationGatewayPowerShellFormatting.TabSize); output.AppendFormat( ApplicationGatewayPowerShellFormatting.RuleFormat, prefix, ApplicationGatewayPowerShellFormatting.NormalizeStringLength("RuleId", ApplicationGatewayPowerShellFormatting.MaxRuleIdLength), "Description"); output.AppendFormat( ApplicationGatewayPowerShellFormatting.RuleFormat, prefix, ApplicationGatewayPowerShellFormatting.NormalizeStringLength("------", ApplicationGatewayPowerShellFormatting.MaxRuleIdLength), "-----------"); foreach (var rule in ruleGroup.Rules) { output.Append(ApplicationGatewayPowerShellFormatting.Format(rule, depth)); } return(output.ToString()); }