private void MultiplayerOpenBtn_Click(object sender, RoutedEventArgs e)
        {
            IsEnabled = false;
            try
            {
                //inbound_udp
                var rule = FirewallHelper.RuleExist("celeste_port1000_inbound_udp");
                if (rule)
                {
                    FirewallHelper.RemoveRules("celeste_port1000_inbound_udp");
                }

                FirewallHelper.AddPortRule("celeste_port1000_inbound_udp", 1000,
                                           FirewallDirection.Inbound, FirewallProtocol.UDP);

                //outbound_udp
                rule = FirewallHelper.RuleExist("celeste_port1000_outbound_udp");
                if (rule)
                {
                    FirewallHelper.RemoveRules("celeste_port1000_outbound_udp");
                }

                FirewallHelper.AddPortRule("celeste_port1000_outbound_udp", 1000,
                                           FirewallDirection.Outbound, FirewallProtocol.UDP);
            }
            catch (Exception ex)
            {
                Logger.Error(ex, ex.Message);
                GenericMessageDialog.Show(Celeste_Launcher_Gui.Properties.Resources.GenericUnexpectedErrorMessage, DialogIcon.Error, DialogOptions.Ok);
            }

            LoadFirewallRules();

            IsEnabled = true;
        }
Esempio n. 2
0
        private void Btn_Fix_MPRules_Click(object sender, EventArgs e)
        {
            Enabled = false;
            try
            {
                //inbound_udp
                var rule = FirewallHelper.RuleExist("celeste_port1000_inbound_udp");
                if (rule)
                {
                    FirewallHelper.RemoveRules("celeste_port1000_inbound_udp");
                }

                FirewallHelper.AddPortRule("celeste_port1000_inbound_udp", 1000,
                                           FirewallDirection.Inbound, FirewallProtocol.UDP);

                //outbound_udp
                rule = FirewallHelper.RuleExist("celeste_port1000_outbound_udp");
                if (rule)
                {
                    FirewallHelper.RemoveRules("celeste_port1000_outbound_udp");
                }

                FirewallHelper.AddPortRule("celeste_port1000_outbound_udp", 1000,
                                           FirewallDirection.Outbound, FirewallProtocol.UDP);
            }
            catch (Exception ex)
            {
                MsgBox.ShowMessage(
                    $"Error: {ex.Message}",
                    @"Celeste Fan Project",
                    MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            RefreshForm();

            Enabled = true;
        }