CheckFirewallAccess() public static method

Checks if the firewall has been configured.
public static CheckFirewallAccess ( string executablePath, StringCollection baseAddresses ) : bool
executablePath string
baseAddresses StringCollection
return bool
コード例 #1
0
ファイル: FirewallAccessDlg.cs プロジェクト: fr830/OPCUA.NET
        private void ApplicationAccessGrantedCK_CheckedChanged(object sender, EventArgs e)
        {
            try
            {
                if (m_application != null)
                {
                    bool accessible = ConfigUtils.CheckFirewallAccess(m_application.ExecutablePath, null);

                    if (ApplicationAccessGrantedCK.Checked)
                    {
                        if (!accessible)
                        {
                            ConfigUtils.SetFirewallAccess(m_application.ExecutablePath, null);
                        }
                    }
                    else
                    {
                        if (accessible)
                        {
                            ConfigUtils.RemoveFirewallAccess(m_application.ExecutablePath, null);
                        }
                    }
                }

                PortsLV.Enabled   = ApplicationAccessGrantedCK.Checked;
                AddBTN.Enabled    = PortsLV.Enabled;
                RemoveBTN.Enabled = PortsLV.Enabled;
            }
            catch (Exception exception)
            {
                GuiUtils.HandleException(this.Text, System.Reflection.MethodBase.GetCurrentMethod(), exception);
            }
        }
コード例 #2
0
ファイル: FirewallAccessDlg.cs プロジェクト: fr830/OPCUA.NET
        /// <summary>
        /// Displays the dialog.
        /// </summary>
        public bool ShowDialog(ManagedApplication application)
        {
            m_application = application;

            if (m_application != null)
            {
                ApplicationAccessGrantedCK.Checked = ConfigUtils.CheckFirewallAccess(m_application.ExecutablePath, null);
            }

            UpdatePorts();

            if (ShowDialog() != DialogResult.OK)
            {
                return(false);
            }

            return(true);
        }