/// <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); }
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); }