public RuleVM(Rule rule, HttpServerConfigVM parentVM) { this.Enable = rule.Enable; this.Name = rule.Name; this.RequestMatch.CheckHostName = rule.RequestMatch.CheckHostName; this.RequestMatch.HostNameMatch = rule.RequestMatch.HostNameMatch; this.RequestMatch.HostNameMatchType = rule.RequestMatch.HostNameMatchType; this.RequestMatch.CheckPort = rule.RequestMatch.CheckPort; this.RequestMatch.Port = rule.RequestMatch.Port; this.RequestMatch.CheckPath = rule.RequestMatch.CheckPath; this.RequestMatch.PathMatch = rule.RequestMatch.PathMatch; this.RequestMatch.PathMatchType = rule.RequestMatch.PathMatchType; if (rule.ResponseAction is RedirectAction redirectAction) { this.ResponseAction.ActionType = ActionType.Redirect; this.ResponseAction.SetRedirectScheme = redirectAction.SetScheme; this.ResponseAction.RedirectScheme = redirectAction.Scheme; this.ResponseAction.SetRedirectHostName = redirectAction.SetHostName; this.ResponseAction.RedirectHostName = redirectAction.HostName; this.ResponseAction.SetRedirectPort = redirectAction.SetPort; this.ResponseAction.RedirectPort = redirectAction.Port; this.ResponseAction.SetRedirectPath = redirectAction.SetPath; this.ResponseAction.RedirectPath = redirectAction.Path; } if (rule.ResponseAction is AlternativeWWWDirectoryAction alternativeWWWDirectoryAction) { this.ResponseAction.ActionType = ActionType.AlternativeWWWDirectory; this.ResponseAction.AlternativeWWWDirectory = alternativeWWWDirectoryAction.AlternativeWWWDirectory; } if (rule.ResponseAction is DenyAction denyAction) { this.ResponseAction.ActionType = ActionType.Deny; } if (rule.ResponseAction is ReverseProxyAction reverseProxyAction) { this.ResponseAction.ActionType = ActionType.ReverseProxy; this.ResponseAction.SetReverseProxyScheme = reverseProxyAction.SetScheme; this.ResponseAction.ReverseProxyScheme = reverseProxyAction.Scheme; this.ResponseAction.SetReverseProxyHostName = reverseProxyAction.SetHostName; this.ResponseAction.ReverseProxyHostName = reverseProxyAction.HostName; this.ResponseAction.SetReverseProxyPort = reverseProxyAction.SetPort; this.ResponseAction.ReverseProxyPort = reverseProxyAction.Port; this.ResponseAction.ReverseProxyUsePathVariable = reverseProxyAction.UsePathVariable; this.ResponseAction.SetReverseProxyPath = reverseProxyAction.SetPath; this.ResponseAction.ReverseProxyPathAndQuery = reverseProxyAction.PathAndQuery; } this.ParentVM = parentVM; }
public RuleVM(HttpServerConfigVM parentVM) { this.ParentVM = parentVM; }