void SetRules() { string remoteAddresses = RangeCalculator.GetRemoteAddresses(addresses); // If the firewall rules aren't set yet. if (!set) { FirewallRule.CreateInbound(remoteAddresses, true, false); FirewallRule.CreateOutbound(remoteAddresses, true, false); active = true; set = true; UpdateActive(); return; } // If they are set but not enabled. if (set && !active) { FirewallRule.CreateInbound(remoteAddresses, true, true); FirewallRule.CreateOutbound(remoteAddresses, true, true); active = true; UpdateActive(); return; } // If they are active and set. if (active && set) { FirewallRule.CreateInbound(remoteAddresses, false, true); FirewallRule.CreateOutbound(remoteAddresses, false, true); UpdateNotActive(); active = false; } }
internal virtual void UpdateActualRange(AxisUpdateContext context) { // TODO: Do not calculate auto-range if both min and max are user-defined this.pointMinMax = this.CalculateRange(context); this.actualRange = this.pointMinMax; object userMin = this.GetValue(MinimumPropertyKey); if (userMin != null) { this.actualRange.minimum = this.TransformValue((double)userMin); } object userMax = this.GetValue(MaximumPropertyKey); if (userMax != null) { this.actualRange.maximum = this.TransformValue((double)userMax); } this.actualRange.maximum = Math.Max(this.actualRange.minimum, this.actualRange.maximum); RangeCalculator calculator = new RangeCalculator(this, userMin != null, userMax != null); if (!context.IsStacked100) { this.actualRange = calculator.Extend(); } object userStep = this.GetValue(MajorStepPropertyKey); if (userStep != null) { // LogarithmicAxis.ExponentStep now specifies the actual exponent so we should not "transform" the step value here. this.majorStep = (double)userStep; } else { this.majorStep = this.CalculateAutoStep(this.actualRange); } this.actualRange = calculator.RoundToMajorStep(this.majorStep); if (this.userTickCount > 0 && userStep == null) { this.RoundToUserTicks(); } }
void SetRules() { string remoteAddresses = RangeCalculator.GetRemoteAddresses(addresses); // If the firewall rules aren't set yet. if (!getSelectedGame().Created) { if (FirewallRule.CreateInbound(remoteAddresses, this.getSelectedGame(), true, false) && FirewallRule.CreateOutbound(remoteAddresses, this.getSelectedGame(), true, false)) { getSelectedGame().Active = true; getSelectedGame().Created = true; UpdateActive(); } return; } // If they are set but not enabled. if (getSelectedGame().Created&& !getSelectedGame().Active) { if (FirewallRule.CreateInbound(remoteAddresses, this.getSelectedGame(), true, true) && FirewallRule.CreateOutbound(remoteAddresses, this.getSelectedGame(), true, true)) { getSelectedGame().Active = true; UpdateActive(); } return; } // If they are active and set. if (getSelectedGame().Created&& getSelectedGame().Active) { if (FirewallRule.CreateInbound(remoteAddresses, this.getSelectedGame(), false, true) && FirewallRule.CreateOutbound(remoteAddresses, this.getSelectedGame(), false, true)) { getSelectedGame().Active = false; UpdateActive(); } return; } }