Beispiel #1
0
        // On click of big boyo!
        private void soloplayButton_Click(object sender, RoutedEventArgs e)
        {
            // If the rule is indeed active. Remove FW rule. Check if still is active. Then do UI changed based on that.
            if (isActive)
            {
                Soloplay.RemoveFirewallRule(fwRuleName);
                isActive = Soloplay.DoesFWRuleExist(fwRuleName);
                statusHandling(isActive);
            }

            // If the rule is not active. We then add the FW rules. Check if they now exist. Then do UI changed based on that.
            else
            {
                // Name. Portrange. Outbound yes/no. UDP yes/no.
                Soloplay.CreateFWRule(ruleName: fwRuleName, portValue: portRangeToBlock, isOut: true, isUDP: true);
                Soloplay.CreateFWRule(ruleName: fwRuleName, portValue: portRangeToBlock, isOut: true, isUDP: false);
                Soloplay.CreateFWRule(ruleName: fwRuleName, portValue: portRangeToBlock, isOut: false, isUDP: true);
                Soloplay.CreateFWRule(ruleName: fwRuleName, portValue: portRangeToBlock, isOut: false, isUDP: false);

                isActive = true;
                statusHandling(isActive);
            }
        }
Beispiel #2
0
        private void OnIsSoloPlayActiveChanged()
        {
            if (_initializing)
            {
                return;
            }

            // If the rule is indeed active. Remove FW rule. Check if still is active. Then do UI changed based on that.
            if (IsSoloPlayActive)
            {
                // Name. Portrange. Outbound yes/no. UDP yes/no.
                Soloplay.CreateFWRule(ruleName: fwRuleName, portValue: portRangeToBlock, isOut: true, isUDP: true);
                Soloplay.CreateFWRule(ruleName: fwRuleName, portValue: portRangeToBlock, isOut: true, isUDP: false);
                Soloplay.CreateFWRule(ruleName: fwRuleName, portValue: portRangeToBlock, isOut: false, isUDP: true);
                Soloplay.CreateFWRule(ruleName: fwRuleName, portValue: portRangeToBlock, isOut: false, isUDP: false);
            }

            // If the rule is not active. We then add the FW rules. Check if they now exist. Then do UI changed based on that.
            else
            {
                Soloplay.RemoveFirewallRule(fwRuleName);
                IsSoloPlayActive = Soloplay.DoesFWRuleExist(fwRuleName);
            }
        }