예제 #1
0
        /// <summary>
        /// Authorize an app to firewall.
        /// </summary>
        public void AddAuthorizeApp(AuthorizeApp authorizeApp)
        {
            // Create the type from prog id
            var type            = Type.GetTypeFromProgID("HNetCfg.FwAuthorizedApplication");
            var fireWallAuthApp = Tools.Convert(() => (INetFwAuthorizedApplication)Activator.CreateInstance(type), authorizeApp);

            _iNetFwMgr.LocalPolicy.CurrentProfile.AuthorizedApplications.Add(fireWallAuthApp);
        }
예제 #2
0
        public static INetFwAuthorizedApplication Convert(Func <INetFwAuthorizedApplication> func, AuthorizeApp item)
        {
            var result = func();

            result.Enabled              = item.Enabled;
            result.IpVersion            = Convert(item.IpVersion);
            result.Name                 = item.Name;
            result.ProcessImageFileName = item.ProcessImageFileName;
            result.RemoteAddresses      = item.RemoteAddresses;
            result.Scope                = Convert(item.Scope);

            return(result);
        }