Advertisement
mcstuffins

autogenerated

Nov 27th, 2016
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 184.26 KB | None | 0 0
  1. // C:\Users\xxx\Documents\cs_code\MSFT_NetFirewallRule.cs  [11/27/2016 5:58:07 AM]  ./
  2. using Hydra.Types;  
  3. using System;  
  4. using System.Collections;  
  5. using System.Collections.Generic;  
  6. using System.Data;  
  7. using System.Data.SqlClient;  
  8. using System.Diagnostics;  
  9. using System.Management;  
  10. using System.Text;  
  11. namespace Hydra.Objects  
  12. {  
  13.  
  14.    //|=-=<OO>=-==-=<OO>=----=<OO>=----=<OO>=----=<OO>=----=<OO>=----=<OO>=----=<OO>=----=<OO>=----=<OO>=----=<OO>=----=<OO>=----=<OO>=-|
  15.    //|                                                                                                                                 |
  16.    //|  This C# and MSSQL Code was generated by -=<( HydraCodeGen, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null )>=-          |
  17.    //|                                                                                                                                 |
  18.    //|  Version 2.0.0.0on 11-27-2016 05:58:06.998                                                                                      |
  19.    //|                                                                                                                                 |
  20.    //|  Code Generation Complete! (4,411.00) lines of code generated in 468.78 milliseconds.                                           |
  21.    //|                                                                                                                                 |
  22.    //|=-=<OO>=-==-=<OO>=----=<OO>=----=<OO>=----=<OO>=----=<OO>=----=<OO>=----=<OO>=----=<OO>=----=<OO>=----=<OO>=----=<OO>=----=<OO>=-|
  23.  
  24.  
  25.     ///<summary>  
  26.     /// Represents a Windows firewall rule.  
  27.     ///</summary>  
  28.  
  29.     public partial class MSFT_NetFirewallRule  
  30.     {  
  31.  
  32.         #region (Constructor)  public MSFT_NetFirewallRule() {}  
  33.         ///  <summary>  
  34.         ///  Default constructor  
  35.         ///  </summary>  
  36.         public MSFT_NetFirewallRule( )  
  37.         {  
  38.             _load_Key_Properties();  
  39.         }  
  40.         #endregion  
  41.  
  42.         #region (constructor) public MSFT_NetFirewallRule(string hostname, string namespace, bool preload)  
  43.         /// <summary>  
  44.         /// Creates an instance of the (MSFT_NetFirewallRule) class and  
  45.         /// collects all instances immediately  
  46.         /// </summary>  
  47.         /// <param name-"preload">Set to true if you want the wmi data loaded immediately</param>  
  48.         public MSFT_NetFirewallRule( bool preload, string p_hostname, string p_namespace, string p_wmiquery )  
  49.         {    
  50.             _load_Key_Properties();  
  51.             this.HostName = p_hostname;  
  52.             this.NameSpace = p_namespace;  
  53.             this._wmiquery = p_wmiquery;  
  54.             if (preload)  
  55.             {  
  56.                 this.ALLInstances = Get_All_MSFT_NetFirewallRule_Objects();  
  57.             }  
  58.         }  
  59.            
  60.         #endregion  
  61.  
  62.         #region (constructor) public MSFT_NetFirewallRule(string p_hostname, string p_username, string p_password, long p_KnownHostID )  
  63.         /// <summary>  
  64.         /// Creates an instance of the MSFT_NetFirewallRule class, connects to wmi, scans the object(s) and stores the data in the database (otional)  
  65.         /// </summary>    
  66.         /// <param name="p_host">Hostname to scan. if "" or null localhoist is assumed</param>  
  67.         /// <param name="p_user">Username to scan with. only used on remote connections</param>  
  68.         /// <param name="p_pas">password to scan with. only used on remote connections</param>  
  69.         /// <param name="customquery">Custom wmi query to use (if so desired) if null or "" then SELECT * FROM [CLASSNAME] is assumed</param>  
  70.         /// <param name="pKHID">Known Host ID from the ___HydraKnownHost table</param>  
  71.         /// <param name="p_isLocal">set to true for local connections</param>  
  72.         /// <param name="p_UpdateDB">Update the database with all instances returned</param>  
  73.         /// <param name="deleteoldrecordsfirst">Delete all instances of classname before uploading all new instances (disable this for perf classes)</param>  
  74.         public MSFT_NetFirewallRule(string p_host, string p_user, string p_pas, string customquery, long pKHID, bool p_isLocal, bool p_UpdateDB, bool deleteoldrecordsfirst)  
  75.         {                                                                                                        
  76.             try                                                                                                      
  77.             {                                                                                                        
  78.                 this._knownhostid = pKHID;                                                                      
  79.                 this._hostname = p_host;                                                                        
  80.                 if (!p_isLocal)                                                                                  
  81.                 {                                                                                                
  82.                     this._hostname = p_host;                                                                    
  83.                     this._username = p_user;                                                                    
  84.                     this._password = p_pas;                                                                      
  85.                     this._islocalconnection = p_isLocal;                                                        
  86.                 }                                                                                                
  87.                 if (customquery != null)                                                                        
  88.                 {                                                                                                
  89.                     if (customquery != "" )                                                                    
  90.                     {                                                                                            
  91.                         this._wmiquery = customquery;                                                            
  92.                     }                                                                                            
  93.                 }                                                                                                
  94.                 int instanceindex = 0;                                                                          
  95.                 this.ALLInstances = Get_All_MSFT_NetFirewallRule_Objects();                                
  96.                 if (p_UpdateDB)                                                                                  
  97.                 {                                                                                                
  98.                     foreach (MSFT_NetFirewallRule o in this.ALLInstances)                                  
  99.                     {                                                                                            
  100.                         if(instanceindex == 0 && deleteoldrecordsfirst)                                          
  101.                         {                                                                                        
  102.                             MSFT_NetFirewallRule_DELETE_BY_KNOWN_HOST_ID(pKHID, Config.DBCONN_HYDRA_DB);    
  103.                         }                                                                                        
  104.                         o._hostname = this._hostname;                                                            
  105.                         o._username = this._username;                                                            
  106.                         o._password = this._password;                                                            
  107.                         o.InsertIntoDatabase(Config.DBCONN_HYDRA_DB);                                            
  108.                         instanceindex++;                                                                        
  109.                         System.Threading.Thread.Sleep(3);    //rest                                                                      
  110.                     }                                                                                            
  111.                 }                                                                                                
  112.                 else                                                                                            
  113.                 {                                                                                                
  114.                     Logging.LogEventlogException(new ApplicationException("HydraB is Offline!!!!"),"MSFT_NetFirewallRule", 911);  
  115.                 }                                                                                                
  116.             }                                                                                                    
  117.             catch(Exception xxl)                                                                                    
  118.             {                                                                                                        
  119.                 Logging.LogEventlogException(xxl, "MSFT_NetFirewallRule", 911);                              
  120.             }                                                                                                        
  121.         }                                                                                                        
  122.         #endregion  
  123.  
  124.  
  125.  
  126.         #region Properties  
  127.  
  128.  
  129.         #region Property: Key Properties  
  130.         /// <summary>  
  131.         /// ArrayList to hold property names that uniquely identify the instances in the collection  
  132.         /// </summary>  
  133.         private ArrayList _key_properties = new ArrayList();  
  134.         public ArrayList KeyProperties  
  135.         {  
  136.             get  
  137.             {  
  138.                 return _key_properties;  
  139.             }  
  140.             set  
  141.             {  
  142.                 _key_properties = value;  
  143.             }  
  144.          }  
  145.         #endregion    
  146.  
  147.  
  148.  
  149.         #region Property: ALLInstances  
  150.         /// <summary>  
  151.         /// ArrayList to hold objects  
  152.         /// </summary>  
  153.         private ArrayList _ALLinstances;  
  154.         public ArrayList ALLInstances  
  155.         {  
  156.             get  
  157.             {  
  158.                 return _ALLinstances;  
  159.             }  
  160.             set  
  161.             {  
  162.                 _ALLinstances = value;  
  163.             }  
  164.          }  
  165.         #endregion Property: ALLInstances  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.         #region Property: List<Property_Data> Properties  
  172.  
  173.  
  174.         /// <summary>  
  175.         /// Holds the collective properties of this class or instance  
  176.         ///    
  177.         /// </summary>  
  178.         private List<Property_Data> _properties = new List<Property_Data>();  
  179.         /// <summary>  
  180.         /// Holds the collective properties of this class or instance  
  181.         ///    
  182.         /// </summary>  
  183.         public List<Property_Data> Properties  
  184.         {  
  185.             get  
  186.             {  
  187.                 return _properties;  
  188.             }  
  189.             set  
  190.             {  
  191.                 _properties = value;  
  192.             }  
  193.          }  
  194.         #endregion Property: List<Property_Data>  
  195.  
  196.  
  197.  
  198.         #region Property: ISLocalConnection  
  199.  
  200.  
  201.         /// <summary>  
  202.         /// KnownHostID is the value that uniquely identifies a host in the hydra database  
  203.         /// </summary>  
  204.         private bool _islocalconnection = true;  
  205.         public bool ISLocalConnection  
  206.         {  
  207.             get  
  208.             {  
  209.                 return _islocalconnection;  
  210.             }  
  211.             set  
  212.             {  
  213.                 _islocalconnection = value;  
  214.             }  
  215.          }  
  216.         #endregion Property: HydraID  
  217.  
  218.  
  219.  
  220.         #region Property: KnownHostID  
  221.  
  222.  
  223.         /// <summary>  
  224.         /// KnownHostID is the value that uniquely identifies a host in the hydra database  
  225.         /// </summary>  
  226.         private Int64 _knownhostid = -9;  
  227.         public Int64 KnownHostID  
  228.         {  
  229.             get  
  230.             {  
  231.                 return _knownhostid;  
  232.             }  
  233.             set  
  234.             {  
  235.                 _knownhostid = value;  
  236.             }  
  237.          }  
  238.         #endregion Property: HydraID  
  239.  
  240.  
  241.  
  242.         #region Property: HydraID  
  243.  
  244.  
  245.         /// <summary>  
  246.         /// HydraID is a value that is created in the sql database when you add a record to a table  
  247.         /// it is extremely helpful when trying to create relationships between tables in the database server  
  248.         /// </summary>  
  249.         private Int64 _hydraid;  
  250.         public Int64 HydraID  
  251.         {  
  252.             get  
  253.             {  
  254.                 return _hydraid;  
  255.             }  
  256.             set  
  257.             {  
  258.                 _hydraid = value;  
  259.             }  
  260.          }  
  261.         #endregion Property: HydraID  
  262.  
  263.  
  264.  
  265.         #region Property: WMIQuery                                                            
  266.         /// <summary>                                                                  
  267.         /// The WMI Query that was run against the WMI Provider                                
  268.         /// Example: "SELECT * FROM WIN32_PROCESS"                                          
  269.         /// </summary>                                                                      
  270.         private string _wmiquery = "SELECT * FROM MSFT_NetFirewallRule";                
  271.         public string WMIQuery  
  272.         {                                                  
  273.             get                                                  
  274.             {                                                  
  275.                 return _wmiquery;                                                  
  276.             }                                                  
  277.             set                                                  
  278.             {                                                  
  279.                 _wmiquery = value;                                                  
  280.             }                                                  
  281.          }                                                                                    
  282.         #endregion Property: WMIQuery                                                  
  283.  
  284.  
  285.  
  286.         #region Property: HostName  
  287.         /// <summary>  
  288.         /// Hostname is the host you want to run the query against.  
  289.         /// Example: dns_server.mycompany.com or 10.10.220.18  
  290.         /// </summary>  
  291.         private string _hostname = Environment.MachineName;  
  292.         public string HostName  
  293.         {  
  294.             get  
  295.             {  
  296.                 return _hostname;  
  297.             }  
  298.             set  
  299.             {  
  300.                 _hostname = value;  
  301.             }  
  302.         }  
  303.         #endregion Property: HostName  
  304.  
  305.  
  306.  
  307.         #region Property: UserName  
  308.  
  309.         /// <summary>  
  310.         /// UserName is the username you want to use to run the query  
  311.         /// </summary>  
  312.         private string _username = "";  
  313.         public string UserName  
  314.         {  
  315.             get  
  316.             {  
  317.                 return _username;  
  318.             }  
  319.             set  
  320.             {  
  321.                 _username = value;  
  322.             }  
  323.         }  
  324.  
  325.         #endregion  
  326.  
  327.  
  328.  
  329.         #region Property: Password  
  330.  
  331.         /// <summary>  
  332.         /// password to use when connecting to remote hosts  
  333.         /// leave blank to use integrated security  
  334.         /// </summary>  
  335.         private string _password = "";  
  336.         public string Password  
  337.         {  
  338.             get  
  339.             {  
  340.                 return _password;  
  341.             }  
  342.             set  
  343.             {  
  344.                 _password = value;  
  345.             }  
  346.         }  
  347.  
  348.         #endregion  
  349.  
  350.  
  351.  
  352.         #region Property: NameSpace  
  353.         /// <summary>        
  354.         /// WMI Namespace    
  355.         /// </summary>      
  356.         private string _namespace = "ROOT\\StandardCimv2";  
  357.         public string NameSpace  
  358.         {  
  359.             get  
  360.             {  
  361.                 return _namespace;  
  362.             }  
  363.             set  
  364.             {  
  365.                 _namespace = value;  
  366.             }  
  367.         }  
  368.         #endregion Property: NameSpace  
  369.  
  370.  
  371.  
  372.         #region Property: WMICLASS  
  373.         /// <summary>        
  374.         /// WMICLASS    
  375.         /// </summary>      
  376.         private string _wmiclass = "MSFT_NetFirewallRule";  
  377.         public string WMIClass  
  378.         {  
  379.             get  
  380.             {  
  381.                 return _wmiclass;  
  382.             }  
  383.             set  
  384.             {  
  385.                 _wmiclass = value;  
  386.             }  
  387.         }  
  388.         #endregion Property: WMICLASS  
  389.  
  390.  
  391.  
  392.         #region Property: RelPath  
  393.         /// <summary>        
  394.         /// Relative Path    
  395.         /// </summary>      
  396.         private string _relpath = "MSFT_NetFirewallRule";  
  397.         public string RelPath  
  398.         {  
  399.             get  
  400.             {  
  401.                 return _relpath;  
  402.             }  
  403.             set  
  404.             {  
  405.                 _relpath = value;  
  406.             }  
  407.         }  
  408.         #endregion Property: NameSpace  
  409.  
  410.  
  411.  
  412.         #region Property: InstancePath  
  413.         /// <summary>        
  414.         /// This.InstancePath    
  415.         /// </summary>      
  416.         private string _instancepath = "";  
  417.         public string InstancePath  
  418.         {  
  419.             get  
  420.             {  
  421.                 return _instancepath;  
  422.             }  
  423.             set  
  424.             {  
  425.                 _instancepath = value;  
  426.             }  
  427.         }  
  428.         #endregion Property: NameSpace  
  429.  
  430.  
  431.  
  432.         #region Property: DatabaseConnectionString  
  433.         /// <summary>  
  434.         /// this field holds the  DatabaseConnectionString for saving WMI Data to a mssql database  
  435.         /// </summary>  
  436.         private string _databaseconnectionstring;  
  437.         public string DatabaseConnectionString  
  438.         {  
  439.             get  
  440.             {  
  441.                 return _databaseconnectionstring;  
  442.             }  
  443.             set  
  444.             {  
  445.                 _databaseconnectionstring = value;  
  446.             }  
  447.         }  
  448.         #endregion Property: DatabaseConnectionString  
  449.  
  450.  
  451.  
  452.         #region Property: Action    
  453.  
  454.         ///|----------------------------------------------------------------------------------------------------|  
  455.         ///|                                                                                                    |  
  456.         ///|   -=( Property: "Action"  CimType:UInt16  )=-                                                      |  
  457.         ///|                                                                                                    |  
  458.         ///|----------------------------------------------------------------------------------------------------|  
  459.         ///| Key | CIMKEY | Values | ValueMap | Read | Write | Units | MaxLen | Desc | Array | Quals | Local    |  
  460.         ///|----------------------------------------------------------------------------------------------------|  
  461.         ///| No  |  No    |  Yes   |    Yes   |  No  |  No   |  No   |  No    |  Yes |  No   |   4   |   Yes    |  
  462.         ///|----------------------------------------------------------------------------------------------------|  
  463.         /// <summary>  
  464.         ///  Specifies the action to take on traffic that matches this rule.    
  465.         /// </summary>  
  466.         public ushort varAction  
  467.  
  468.         {  
  469.             set  
  470.             {  
  471.                _varaction = value;  
  472.             }  
  473.             get  
  474.             {  
  475.                 return _varaction;  
  476.             }  
  477.         }  
  478.         private ushort _varaction = new ushort();    
  479.  
  480.         #endregion Property: varAction    
  481.  
  482.  
  483.         #region Property: Caption    
  484.  
  485.         ///|----------------------------------------------------------------------------------------------------|  
  486.         ///|                                                                                                    |  
  487.         ///|   -=( Property: "Caption"  CimType:String  )=-                                                     |  
  488.         ///|                                                                                                    |  
  489.         ///|----------------------------------------------------------------------------------------------------|  
  490.         ///| Key | CIMKEY | Values | ValueMap | Read | Write | Units | MaxLen | Desc | Array | Quals | Local    |  
  491.         ///|----------------------------------------------------------------------------------------------------|  
  492.         ///| No  |  No    |  No    |    No    |  Yes |  No   |  No   |  Yes   |  Yes |  No   |   5   |   No     |  
  493.         ///|----------------------------------------------------------------------------------------------------|  
  494.         /// <summary>  
  495.         ///  The Caption property is a short textual description (one- line string) of the object.    
  496.         /// </summary>  
  497.         public string varCaption  
  498.  
  499.         {  
  500.             set  
  501.             {  
  502.                _varcaption = value;  
  503.             }  
  504.             get  
  505.             {  
  506.                 return _varcaption;  
  507.             }  
  508.         }  
  509.         private string _varcaption =  "";    
  510.  
  511.         public bool CaptionIsReadable = true;  
  512.         public double CaptionMaxLength = 64;    
  513.         #endregion Property: varCaption    
  514.  
  515.  
  516.         #region Property: CommonName    
  517.  
  518.         ///|----------------------------------------------------------------------------------------------------|  
  519.         ///|                                                                                                    |  
  520.         ///|   -=( Property: "CommonName"  CimType:String  )=-                                                  |  
  521.         ///|                                                                                                    |  
  522.         ///|----------------------------------------------------------------------------------------------------|  
  523.         ///| Key | CIMKEY | Values | ValueMap | Read | Write | Units | MaxLen | Desc | Array | Quals | Local    |  
  524.         ///|----------------------------------------------------------------------------------------------------|  
  525.         ///| No  |  No    |  No    |    No    |  Yes |  No   |  No   |  No    |  Yes |  No   |   4   |   No     |  
  526.         ///|----------------------------------------------------------------------------------------------------|  
  527.         /// <summary>  
  528.         ///  This field is ignored.    
  529.         /// </summary>  
  530.         public string varCommonName  
  531.  
  532.         {  
  533.             set  
  534.             {  
  535.                _varcommonname = value;  
  536.             }  
  537.             get  
  538.             {  
  539.                 return _varcommonname;  
  540.             }  
  541.         }  
  542.         private string _varcommonname =  "";    
  543.  
  544.         public bool CommonNameIsReadable = true;  
  545.         #endregion Property: varCommonName    
  546.  
  547.  
  548.         #region Property: ConditionListType    
  549.  
  550.         ///|----------------------------------------------------------------------------------------------------|  
  551.         ///|                                                                                                    |  
  552.         ///|   -=( Property: "ConditionListType"  CimType:UInt16  )=-                                           |  
  553.         ///|                                                                                                    |  
  554.         ///|----------------------------------------------------------------------------------------------------|  
  555.         ///| Key | CIMKEY | Values | ValueMap | Read | Write | Units | MaxLen | Desc | Array | Quals | Local    |  
  556.         ///|----------------------------------------------------------------------------------------------------|  
  557.         ///| No  |  No    |  Yes   |    Yes   |  Yes |  No   |  No   |  No    |  Yes |  No   |   6   |   No     |  
  558.         ///|----------------------------------------------------------------------------------------------------|  
  559.         /// <summary>  
  560.         ///  This field is ignored.    
  561.         /// </summary>  
  562.         public ushort varConditionListType  
  563.  
  564.         {  
  565.             set  
  566.             {  
  567.                _varconditionlisttype = value;  
  568.             }  
  569.             get  
  570.             {  
  571.                 return _varconditionlisttype;  
  572.             }  
  573.         }  
  574.         private ushort _varconditionlisttype = new ushort();    
  575.  
  576.         public bool ConditionListTypeIsReadable = true;  
  577.         #endregion Property: varConditionListType    
  578.  
  579.  
  580.         #region Property: CreationClassName    
  581.  
  582.         ///|----------------------------------------------------------------------------------------------------|  
  583.         ///|                                                                                                    |  
  584.         ///|   -=( Property: "CreationClassName"  CimType:String  )=-                                           |  
  585.         ///|                                                                                                    |  
  586.         ///|----------------------------------------------------------------------------------------------------|  
  587.         ///| Key | CIMKEY | Values | ValueMap | Read | Write | Units | MaxLen | Desc | Array | Quals | Local    |  
  588.         ///|----------------------------------------------------------------------------------------------------|  
  589.         ///| Yes |  No    |  No    |    No    |  Yes |  No   |  No   |  Yes   |  Yes |  No   |   6   |   No     |  
  590.         ///|----------------------------------------------------------------------------------------------------|  
  591.         /// <summary>  
  592.         ///  Reserved for internal use by the WMI provider only.    
  593.         /// </summary>  
  594.         public string varCreationClassName  
  595.  
  596.         {  
  597.             set  
  598.             {  
  599.                _varcreationclassname = value;  
  600.             }  
  601.             get  
  602.             {  
  603.                 return _varcreationclassname;  
  604.             }  
  605.         }  
  606.         private string _varcreationclassname =  "";    
  607.  
  608.         public bool CreationClassNameIsReadable = true;  
  609.         public double CreationClassNameMaxLength = 256;    
  610.         #endregion Property: varCreationClassName    
  611.  
  612.  
  613.         #region Property: Description    
  614.  
  615.         ///|----------------------------------------------------------------------------------------------------|  
  616.         ///|                                                                                                    |  
  617.         ///|   -=( Property: "Description"  CimType:String  )=-                                                 |  
  618.         ///|                                                                                                    |  
  619.         ///|----------------------------------------------------------------------------------------------------|  
  620.         ///| Key | CIMKEY | Values | ValueMap | Read | Write | Units | MaxLen | Desc | Array | Quals | Local    |  
  621.         ///|----------------------------------------------------------------------------------------------------|  
  622.         ///| No  |  No    |  No    |    No    |  No  |  No   |  No   |  No    |  Yes |  No   |   3   |   No     |  
  623.         ///|----------------------------------------------------------------------------------------------------|  
  624.         /// <summary>  
  625.         ///  A brief description of the rule.  May be an indirect string.  If it is an indirect string,  
  626.         ///  then it may not be overwritten.    
  627.         /// </summary>  
  628.         public string varDescription  
  629.  
  630.         {  
  631.             set  
  632.             {  
  633.                _vardescription = value;  
  634.             }  
  635.             get  
  636.             {  
  637.                 return _vardescription;  
  638.             }  
  639.         }  
  640.         private string _vardescription =  "";    
  641.  
  642.         #endregion Property: varDescription    
  643.  
  644.  
  645.         #region Property: Direction    
  646.  
  647.         ///|----------------------------------------------------------------------------------------------------|  
  648.         ///|                                                                                                    |  
  649.         ///|   -=( Property: "Direction"  CimType:UInt16  )=-                                                   |  
  650.         ///|                                                                                                    |  
  651.         ///|----------------------------------------------------------------------------------------------------|  
  652.         ///| Key | CIMKEY | Values | ValueMap | Read | Write | Units | MaxLen | Desc | Array | Quals | Local    |  
  653.         ///|----------------------------------------------------------------------------------------------------|  
  654.         ///| No  |  No    |  Yes   |    Yes   |  No  |  No   |  No   |  No    |  Yes |  No   |   4   |   Yes    |  
  655.         ///|----------------------------------------------------------------------------------------------------|  
  656.         /// <summary>  
  657.         ///  Specifies which direction of traffic to match with this rule.    
  658.         /// </summary>  
  659.         public ushort varDirection  
  660.  
  661.         {  
  662.             set  
  663.             {  
  664.                _vardirection = value;  
  665.             }  
  666.             get  
  667.             {  
  668.                 return _vardirection;  
  669.             }  
  670.         }  
  671.         private ushort _vardirection = new ushort();    
  672.  
  673.         #endregion Property: varDirection    
  674.  
  675.  
  676.         #region Property: DisplayGroup    
  677.  
  678.         ///|----------------------------------------------------------------------------------------------------|  
  679.         ///|                                                                                                    |  
  680.         ///|   -=( Property: "DisplayGroup"  CimType:String  )=-                                                |  
  681.         ///|                                                                                                    |  
  682.         ///|----------------------------------------------------------------------------------------------------|  
  683.         ///| Key | CIMKEY | Values | ValueMap | Read | Write | Units | MaxLen | Desc | Array | Quals | Local    |  
  684.         ///|----------------------------------------------------------------------------------------------------|  
  685.         ///| No  |  No    |  No    |    No    |  Yes |  No   |  No   |  No    |  Yes |  No   |   3   |   Yes    |  
  686.         ///|----------------------------------------------------------------------------------------------------|  
  687.         /// <summary>  
  688.         ///  The group that this rule belongs to.  This field is based on the value of RuleGroup and changes  
  689.         ///  to this field are ignored.    
  690.         /// </summary>  
  691.         public string varDisplayGroup  
  692.  
  693.         {  
  694.             set  
  695.             {  
  696.                _vardisplaygroup = value;  
  697.             }  
  698.             get  
  699.             {  
  700.                 return _vardisplaygroup;  
  701.             }  
  702.         }  
  703.         private string _vardisplaygroup =  "";    
  704.  
  705.         public bool DisplayGroupIsReadable = true;  
  706.         #endregion Property: varDisplayGroup    
  707.  
  708.  
  709.         #region Property: DisplayName    
  710.  
  711.         ///|----------------------------------------------------------------------------------------------------|  
  712.         ///|                                                                                                    |  
  713.         ///|   -=( Property: "DisplayName"  CimType:String  )=-                                                 |  
  714.         ///|                                                                                                    |  
  715.         ///|----------------------------------------------------------------------------------------------------|  
  716.         ///| Key | CIMKEY | Values | ValueMap | Read | Write | Units | MaxLen | Desc | Array | Quals | Local    |  
  717.         ///|----------------------------------------------------------------------------------------------------|  
  718.         ///| No  |  No    |  No    |    No    |  Yes |  No   |  No   |  No    |  Yes |  No   |   3   |   Yes    |  
  719.         ///|----------------------------------------------------------------------------------------------------|  
  720.         /// <summary>  
  721.         ///  The localized name of this rule.  This field's value is based on the value of ElementName.  
  722.         ///   Changes to this field are ignored.    
  723.         /// </summary>  
  724.         public string varDisplayName  
  725.  
  726.         {  
  727.             set  
  728.             {  
  729.                _vardisplayname = value;  
  730.             }  
  731.             get  
  732.             {  
  733.                 return _vardisplayname;  
  734.             }  
  735.         }  
  736.         private string _vardisplayname =  "";    
  737.  
  738.         public bool DisplayNameIsReadable = true;  
  739.         #endregion Property: varDisplayName    
  740.  
  741.  
  742.         #region Property: EdgeTraversalPolicy    
  743.  
  744.         ///|----------------------------------------------------------------------------------------------------|  
  745.         ///|                                                                                                    |  
  746.         ///|   -=( Property: "EdgeTraversalPolicy"  CimType:UInt16  )=-                                         |  
  747.         ///|                                                                                                    |  
  748.         ///|----------------------------------------------------------------------------------------------------|  
  749.         ///| Key | CIMKEY | Values | ValueMap | Read | Write | Units | MaxLen | Desc | Array | Quals | Local    |  
  750.         ///|----------------------------------------------------------------------------------------------------|  
  751.         ///| No  |  No    |  Yes   |    Yes   |  No  |  No   |  No   |  No    |  Yes |  No   |   4   |   Yes    |  
  752.         ///|----------------------------------------------------------------------------------------------------|  
  753.         /// <summary>  
  754.         ///  Specifies how this firewall rule will handle edge traversal cases.    
  755.         /// </summary>  
  756.         public ushort varEdgeTraversalPolicy  
  757.  
  758.         {  
  759.             set  
  760.             {  
  761.                _varedgetraversalpolicy = value;  
  762.             }  
  763.             get  
  764.             {  
  765.                 return _varedgetraversalpolicy;  
  766.             }  
  767.         }  
  768.         private ushort _varedgetraversalpolicy = new ushort();    
  769.  
  770.         #endregion Property: varEdgeTraversalPolicy    
  771.  
  772.  
  773.         #region Property: ElementName    
  774.  
  775.         ///|----------------------------------------------------------------------------------------------------|  
  776.         ///|                                                                                                    |  
  777.         ///|   -=( Property: "ElementName"  CimType:String  )=-                                                 |  
  778.         ///|                                                                                                    |  
  779.         ///|----------------------------------------------------------------------------------------------------|  
  780.         ///| Key | CIMKEY | Values | ValueMap | Read | Write | Units | MaxLen | Desc | Array | Quals | Local    |  
  781.         ///|----------------------------------------------------------------------------------------------------|  
  782.         ///| No  |  No    |  No    |    No    |  No  |  No   |  No   |  No    |  Yes |  No   |   3   |   No     |  
  783.         ///|----------------------------------------------------------------------------------------------------|  
  784.         /// <summary>  
  785.         ///  The locale-independent name of the rule.  May be an indirect string.    
  786.         /// </summary>  
  787.         public string varElementName  
  788.  
  789.         {  
  790.             set  
  791.             {  
  792.                _varelementname = value;  
  793.             }  
  794.             get  
  795.             {  
  796.                 return _varelementname;  
  797.             }  
  798.         }  
  799.         private string _varelementname =  "";    
  800.  
  801.         #endregion Property: varElementName    
  802.  
  803.  
  804.         #region Property: Enabled    
  805.  
  806.         ///|----------------------------------------------------------------------------------------------------|  
  807.         ///|                                                                                                    |  
  808.         ///|   -=( Property: "Enabled"  CimType:UInt16  )=-                                                     |  
  809.         ///|                                                                                                    |  
  810.         ///|----------------------------------------------------------------------------------------------------|  
  811.         ///| Key | CIMKEY | Values | ValueMap | Read | Write | Units | MaxLen | Desc | Array | Quals | Local    |  
  812.         ///|----------------------------------------------------------------------------------------------------|  
  813.         ///| No  |  No    |  Yes   |    Yes   |  Yes |  No   |  No   |  No    |  Yes |  No   |   6   |   No     |  
  814.         ///|----------------------------------------------------------------------------------------------------|  
  815.         /// <summary>  
  816.         ///  Indicates whether this rule is administratively enabled or disabled.    
  817.         /// </summary>  
  818.         public ushort varEnabled  
  819.  
  820.         {  
  821.             set  
  822.             {  
  823.                _varenabled = value;  
  824.             }  
  825.             get  
  826.             {  
  827.                 return _varenabled;  
  828.             }  
  829.         }  
  830.         private ushort _varenabled = new ushort();    
  831.  
  832.         public bool EnabledIsReadable = true;  
  833.         #endregion Property: varEnabled    
  834.  
  835.  
  836.         #region Property: EnforcementStatus    
  837.  
  838.         ///|----------------------------------------------------------------------------------------------------|  
  839.         ///|                                                                                                    |  
  840.         ///|   -=( Property: "EnforcementStatus"  CimType:UInt16  )=-                                           |  
  841.         ///|                                                                                                    |  
  842.         ///|----------------------------------------------------------------------------------------------------|  
  843.         ///| Key | CIMKEY | Values | ValueMap | Read | Write | Units | MaxLen | Desc | Array | Quals | Local    |  
  844.         ///|----------------------------------------------------------------------------------------------------|  
  845.         ///| No  |  No    |  Yes   |    Yes   |  No  |  No   |  No   |  No    |  Yes |  Yes  |   4   |   Yes    |  
  846.         ///|----------------------------------------------------------------------------------------------------|  
  847.         /// <summary>  
  848.         ///  If this object is retrieved from the ActiveStore, describes the current enforcement status  
  849.         ///  of the rule.    
  850.         /// </summary>  
  851.         public ushort[] varEnforcementStatus  
  852.  
  853.         {  
  854.             set  
  855.             {  
  856.                _varenforcementstatus = value;  
  857.             }  
  858.             get  
  859.             {  
  860.                 return _varenforcementstatus;  
  861.             }  
  862.         }  
  863.         private ushort[] _varenforcementstatus = new ushort[1];    
  864.  
  865.         #endregion Property: varEnforcementStatus    
  866.  
  867.  
  868.         #region Property: ExecutionStrategy    
  869.  
  870.         ///|----------------------------------------------------------------------------------------------------|  
  871.         ///|                                                                                                    |  
  872.         ///|   -=( Property: "ExecutionStrategy"  CimType:UInt16  )=-                                           |  
  873.         ///|                                                                                                    |  
  874.         ///|----------------------------------------------------------------------------------------------------|  
  875.         ///| Key | CIMKEY | Values | ValueMap | Read | Write | Units | MaxLen | Desc | Array | Quals | Local    |  
  876.         ///|----------------------------------------------------------------------------------------------------|  
  877.         ///| No  |  No    |  Yes   |    Yes   |  Yes |  No   |  No   |  No    |  Yes |  No   |   6   |   No     |  
  878.         ///|----------------------------------------------------------------------------------------------------|  
  879.         /// <summary>  
  880.         ///  This field is ignored.    
  881.         /// </summary>  
  882.         public ushort varExecutionStrategy  
  883.  
  884.         {  
  885.             set  
  886.             {  
  887.                _varexecutionstrategy = value;  
  888.             }  
  889.             get  
  890.             {  
  891.                 return _varexecutionstrategy;  
  892.             }  
  893.         }  
  894.         private ushort _varexecutionstrategy = new ushort();    
  895.  
  896.         public bool ExecutionStrategyIsReadable = true;  
  897.         #endregion Property: varExecutionStrategy    
  898.  
  899.  
  900.         #region Property: InstanceID    
  901.  
  902.         ///|----------------------------------------------------------------------------------------------------|  
  903.         ///|                                                                                                    |  
  904.         ///|   -=( Property: "InstanceID"  CimType:String  )=-                                                  |  
  905.         ///|                                                                                                    |  
  906.         ///|----------------------------------------------------------------------------------------------------|  
  907.         ///| Key | CIMKEY | Values | ValueMap | Read | Write | Units | MaxLen | Desc | Array | Quals | Local    |  
  908.         ///|----------------------------------------------------------------------------------------------------|  
  909.         ///| No  |  No    |  No    |    No    |  Yes |  No   |  No   |  No    |  Yes |  No   |   4   |   No     |  
  910.         ///|----------------------------------------------------------------------------------------------------|  
  911.         /// <summary>  
  912.         ///  A string that uniquely identifies this instance within the PolicyStore.    
  913.         /// </summary>  
  914.         public string varInstanceID  
  915.  
  916.         {  
  917.             set  
  918.             {  
  919.                _varinstanceid = value;  
  920.             }  
  921.             get  
  922.             {  
  923.                 return _varinstanceid;  
  924.             }  
  925.         }  
  926.         private string _varinstanceid =  "";    
  927.  
  928.         public bool InstanceIDIsReadable = true;  
  929.         #endregion Property: varInstanceID    
  930.  
  931.  
  932.         #region Property: LocalOnlyMapping    
  933.  
  934.         ///|----------------------------------------------------------------------------------------------------|  
  935.         ///|                                                                                                    |  
  936.         ///|   -=( Property: "LocalOnlyMapping"  CimType:Boolean  )=-                                           |  
  937.         ///|                                                                                                    |  
  938.         ///|----------------------------------------------------------------------------------------------------|  
  939.         ///| Key | CIMKEY | Values | ValueMap | Read | Write | Units | MaxLen | Desc | Array | Quals | Local    |  
  940.         ///|----------------------------------------------------------------------------------------------------|  
  941.         ///| No  |  No    |  No    |    No    |  No  |  No   |  No   |  No    |  Yes |  No   |   2   |   Yes    |  
  942.         ///|----------------------------------------------------------------------------------------------------|  
  943.         /// <summary>  
  944.         ///  Whether to group UDP packets into conversations based only upon the local address and port.  
  945.         ///   Applies only to UDP.    
  946.         /// </summary>  
  947.         public bool varLocalOnlyMapping  
  948.  
  949.         {  
  950.             set  
  951.             {  
  952.                _varlocalonlymapping = value;  
  953.             }  
  954.             get  
  955.             {  
  956.                 return _varlocalonlymapping;  
  957.             }  
  958.         }  
  959.         private bool _varlocalonlymapping = new bool();    
  960.  
  961.         #endregion Property: varLocalOnlyMapping    
  962.  
  963.  
  964.         #region Property: LooseSourceMapping    
  965.  
  966.         ///|----------------------------------------------------------------------------------------------------|  
  967.         ///|                                                                                                    |  
  968.         ///|   -=( Property: "LooseSourceMapping"  CimType:Boolean  )=-                                         |  
  969.         ///|                                                                                                    |  
  970.         ///|----------------------------------------------------------------------------------------------------|  
  971.         ///| Key | CIMKEY | Values | ValueMap | Read | Write | Units | MaxLen | Desc | Array | Quals | Local    |  
  972.         ///|----------------------------------------------------------------------------------------------------|  
  973.         ///| No  |  No    |  No    |    No    |  No  |  No   |  No   |  No    |  Yes |  No   |   2   |   Yes    |  
  974.         ///|----------------------------------------------------------------------------------------------------|  
  975.         /// <summary>  
  976.         ///  Whether to group UDP packets into conversations based upon the local address, local port, and  
  977.         ///  remote port.  Applies only to UDP.    
  978.         /// </summary>  
  979.         public bool varLooseSourceMapping  
  980.  
  981.         {  
  982.             set  
  983.             {  
  984.                _varloosesourcemapping = value;  
  985.             }  
  986.             get  
  987.             {  
  988.                 return _varloosesourcemapping;  
  989.             }  
  990.         }  
  991.         private bool _varloosesourcemapping = new bool();    
  992.  
  993.         #endregion Property: varLooseSourceMapping    
  994.  
  995.  
  996.         #region Property: Mandatory    
  997.  
  998.         ///|----------------------------------------------------------------------------------------------------|  
  999.         ///|                                                                                                    |  
  1000.         ///|   -=( Property: "Mandatory"  CimType:Boolean  )=-                                                  |  
  1001.         ///|                                                                                                    |  
  1002.         ///|----------------------------------------------------------------------------------------------------|  
  1003.         ///| Key | CIMKEY | Values | ValueMap | Read | Write | Units | MaxLen | Desc | Array | Quals | Local    |  
  1004.         ///|----------------------------------------------------------------------------------------------------|  
  1005.         ///| No  |  No    |  No    |    No    |  Yes |  No   |  No   |  No    |  Yes |  No   |   4   |   No     |  
  1006.         ///|----------------------------------------------------------------------------------------------------|  
  1007.         /// <summary>  
  1008.         ///  This field is ignored.    
  1009.         /// </summary>  
  1010.         public bool varMandatory  
  1011.  
  1012.         {  
  1013.             set  
  1014.             {  
  1015.                _varmandatory = value;  
  1016.             }  
  1017.             get  
  1018.             {  
  1019.                 return _varmandatory;  
  1020.             }  
  1021.         }  
  1022.         private bool _varmandatory = new bool();    
  1023.  
  1024.         public bool MandatoryIsReadable = true;  
  1025.         #endregion Property: varMandatory    
  1026.  
  1027.  
  1028.         #region Property: Owner    
  1029.  
  1030.         ///|----------------------------------------------------------------------------------------------------|  
  1031.         ///|                                                                                                    |  
  1032.         ///|   -=( Property: "Owner"  CimType:String  )=-                                                       |  
  1033.         ///|                                                                                                    |  
  1034.         ///|----------------------------------------------------------------------------------------------------|  
  1035.         ///| Key | CIMKEY | Values | ValueMap | Read | Write | Units | MaxLen | Desc | Array | Quals | Local    |  
  1036.         ///|----------------------------------------------------------------------------------------------------|  
  1037.         ///| No  |  No    |  No    |    No    |  No  |  No   |  No   |  No    |  Yes |  No   |   2   |   Yes    |  
  1038.         ///|----------------------------------------------------------------------------------------------------|  
  1039.         /// <summary>  
  1040.         ///  The owner of the firewall rule, as a SID.    
  1041.         /// </summary>  
  1042.         public string varOwner  
  1043.  
  1044.         {  
  1045.             set  
  1046.             {  
  1047.                _varowner = value;  
  1048.             }  
  1049.             get  
  1050.             {  
  1051.                 return _varowner;  
  1052.             }  
  1053.         }  
  1054.         private string _varowner =  "";    
  1055.  
  1056.         #endregion Property: varOwner    
  1057.  
  1058.  
  1059.         #region Property: Platforms    
  1060.  
  1061.         ///|----------------------------------------------------------------------------------------------------|  
  1062.         ///|                                                                                                    |  
  1063.         ///|   -=( Property: "Platforms"  CimType:String  )=-                                                   |  
  1064.         ///|                                                                                                    |  
  1065.         ///|----------------------------------------------------------------------------------------------------|  
  1066.         ///| Key | CIMKEY | Values | ValueMap | Read | Write | Units | MaxLen | Desc | Array | Quals | Local    |  
  1067.         ///|----------------------------------------------------------------------------------------------------|  
  1068.         ///| No  |  No    |  No    |    No    |  No  |  No   |  No   |  No    |  Yes |  Yes  |   2   |   Yes    |  
  1069.         ///|----------------------------------------------------------------------------------------------------|  
  1070.         /// <summary>  
  1071.         ///  Specifies which platforms the rule is applicable on.  If null, the rule applies to all platforms  
  1072.         ///  (the default).  Each entry takes the form Major.Minor+, for instance 6.0, 6.1+, or 6.2.  If  
  1073.         ///  + is specified, then it means that the rule applies to that version or greater.  For instance,  
  1074.         ///  Windows Vista could be represented as 6 or 6.0, and Windows 7 or later would be represented  
  1075.         ///  as 6.1+.  + may only be attached to the final item in the list.  6.0+ is not valid because  
  1076.         ///  it means the same thing as null (all platforms).    
  1077.         /// </summary>  
  1078.         public string[] varPlatforms  
  1079.  
  1080.         {  
  1081.             set  
  1082.             {  
  1083.                _varplatforms = value;  
  1084.             }  
  1085.             get  
  1086.             {  
  1087.                 return _varplatforms;  
  1088.             }  
  1089.         }  
  1090.         private string[] _varplatforms = new string[1];    
  1091.  
  1092.         #endregion Property: varPlatforms    
  1093.  
  1094.  
  1095.         #region Property: PolicyDecisionStrategy    
  1096.  
  1097.         ///|----------------------------------------------------------------------------------------------------|  
  1098.         ///|                                                                                                    |  
  1099.         ///|   -=( Property: "PolicyDecisionStrategy"  CimType:UInt16  )=-                                      |  
  1100.         ///|                                                                                                    |  
  1101.         ///|----------------------------------------------------------------------------------------------------|  
  1102.         ///| Key | CIMKEY | Values | ValueMap | Read | Write | Units | MaxLen | Desc | Array | Quals | Local    |  
  1103.         ///|----------------------------------------------------------------------------------------------------|  
  1104.         ///| No  |  No    |  Yes   |    Yes   |  Yes |  No   |  No   |  No    |  Yes |  No   |   6   |   No     |  
  1105.         ///|----------------------------------------------------------------------------------------------------|  
  1106.         /// <summary>  
  1107.         ///  This field is ignored.    
  1108.         /// </summary>  
  1109.         public ushort varPolicyDecisionStrategy  
  1110.  
  1111.         {  
  1112.             set  
  1113.             {  
  1114.                _varpolicydecisionstrategy = value;  
  1115.             }  
  1116.             get  
  1117.             {  
  1118.                 return _varpolicydecisionstrategy;  
  1119.             }  
  1120.         }  
  1121.         private ushort _varpolicydecisionstrategy = new ushort();    
  1122.  
  1123.         public bool PolicyDecisionStrategyIsReadable = true;  
  1124.         #endregion Property: varPolicyDecisionStrategy    
  1125.  
  1126.  
  1127.         #region Property: PolicyKeywords    
  1128.  
  1129.         ///|----------------------------------------------------------------------------------------------------|  
  1130.         ///|                                                                                                    |  
  1131.         ///|   -=( Property: "PolicyKeywords"  CimType:String  )=-                                              |  
  1132.         ///|                                                                                                    |  
  1133.         ///|----------------------------------------------------------------------------------------------------|  
  1134.         ///| Key | CIMKEY | Values | ValueMap | Read | Write | Units | MaxLen | Desc | Array | Quals | Local    |  
  1135.         ///|----------------------------------------------------------------------------------------------------|  
  1136.         ///| No  |  No    |  No    |    No    |  Yes |  No   |  No   |  No    |  Yes |  Yes  |   4   |   No     |  
  1137.         ///|----------------------------------------------------------------------------------------------------|  
  1138.         /// <summary>  
  1139.         ///  This field is ignored.    
  1140.         /// </summary>  
  1141.         public string[] varPolicyKeywords  
  1142.  
  1143.         {  
  1144.             set  
  1145.             {  
  1146.                _varpolicykeywords = value;  
  1147.             }  
  1148.             get  
  1149.             {  
  1150.                 return _varpolicykeywords;  
  1151.             }  
  1152.         }  
  1153.         private string[] _varpolicykeywords = new string[1];    
  1154.  
  1155.         public bool PolicyKeywordsIsReadable = true;  
  1156.         #endregion Property: varPolicyKeywords    
  1157.  
  1158.  
  1159.         #region Property: PolicyRoles    
  1160.  
  1161.         ///|----------------------------------------------------------------------------------------------------|  
  1162.         ///|                                                                                                    |  
  1163.         ///|   -=( Property: "PolicyRoles"  CimType:String  )=-                                                 |  
  1164.         ///|                                                                                                    |  
  1165.         ///|----------------------------------------------------------------------------------------------------|  
  1166.         ///| Key | CIMKEY | Values | ValueMap | Read | Write | Units | MaxLen | Desc | Array | Quals | Local    |  
  1167.         ///|----------------------------------------------------------------------------------------------------|  
  1168.         ///| No  |  No    |  No    |    No    |  Yes |  No   |  No   |  No    |  Yes |  Yes  |   4   |   No     |  
  1169.         ///|----------------------------------------------------------------------------------------------------|  
  1170.         /// <summary>  
  1171.         ///  This field is ignored.    
  1172.         /// </summary>  
  1173.         public string[] varPolicyRoles  
  1174.  
  1175.         {  
  1176.             set  
  1177.             {  
  1178.                _varpolicyroles = value;  
  1179.             }  
  1180.             get  
  1181.             {  
  1182.                 return _varpolicyroles;  
  1183.             }  
  1184.         }  
  1185.         private string[] _varpolicyroles = new string[1];    
  1186.  
  1187.         public bool PolicyRolesIsReadable = true;  
  1188.         #endregion Property: varPolicyRoles    
  1189.  
  1190.  
  1191.         #region Property: PolicyRuleName    
  1192.  
  1193.         ///|----------------------------------------------------------------------------------------------------|  
  1194.         ///|                                                                                                    |  
  1195.         ///|   -=( Property: "PolicyRuleName"  CimType:String  )=-                                              |  
  1196.         ///|                                                                                                    |  
  1197.         ///|----------------------------------------------------------------------------------------------------|  
  1198.         ///| Key | CIMKEY | Values | ValueMap | Read | Write | Units | MaxLen | Desc | Array | Quals | Local    |  
  1199.         ///|----------------------------------------------------------------------------------------------------|  
  1200.         ///| Yes |  No    |  No    |    No    |  Yes |  No   |  No   |  Yes   |  Yes |  No   |   6   |   No     |  
  1201.         ///|----------------------------------------------------------------------------------------------------|  
  1202.         /// <summary>  
  1203.         ///  Reserved for internal use by the WMI provider only.    
  1204.         /// </summary>  
  1205.         public string varPolicyRuleName  
  1206.  
  1207.         {  
  1208.             set  
  1209.             {  
  1210.                _varpolicyrulename = value;  
  1211.             }  
  1212.             get  
  1213.             {  
  1214.                 return _varpolicyrulename;  
  1215.             }  
  1216.         }  
  1217.         private string _varpolicyrulename =  "";    
  1218.  
  1219.         public bool PolicyRuleNameIsReadable = true;  
  1220.         public double PolicyRuleNameMaxLength = 256;    
  1221.         #endregion Property: varPolicyRuleName    
  1222.  
  1223.  
  1224.         #region Property: PolicyStoreSource    
  1225.  
  1226.         ///|----------------------------------------------------------------------------------------------------|  
  1227.         ///|                                                                                                    |  
  1228.         ///|   -=( Property: "PolicyStoreSource"  CimType:String  )=-                                           |  
  1229.         ///|                                                                                                    |  
  1230.         ///|----------------------------------------------------------------------------------------------------|  
  1231.         ///| Key | CIMKEY | Values | ValueMap | Read | Write | Units | MaxLen | Desc | Array | Quals | Local    |  
  1232.         ///|----------------------------------------------------------------------------------------------------|  
  1233.         ///| No  |  No    |  No    |    No    |  No  |  No   |  No   |  No    |  Yes |  No   |   2   |   Yes    |  
  1234.         ///|----------------------------------------------------------------------------------------------------|  
  1235.         /// <summary>  
  1236.         ///  If this object is retrieved from the ActiveStore, with the TracePolicyStoreSource option set,  
  1237.         ///  contains the path to the PolicyStore where this rule originally came from.    
  1238.         /// </summary>  
  1239.         public string varPolicyStoreSource  
  1240.  
  1241.         {  
  1242.             set  
  1243.             {  
  1244.                _varpolicystoresource = value;  
  1245.             }  
  1246.             get  
  1247.             {  
  1248.                 return _varpolicystoresource;  
  1249.             }  
  1250.         }  
  1251.         private string _varpolicystoresource =  "";    
  1252.  
  1253.         #endregion Property: varPolicyStoreSource    
  1254.  
  1255.  
  1256.         #region Property: PolicyStoreSourceType    
  1257.  
  1258.         ///|----------------------------------------------------------------------------------------------------|  
  1259.         ///|                                                                                                    |  
  1260.         ///|   -=( Property: "PolicyStoreSourceType"  CimType:UInt16  )=-                                       |  
  1261.         ///|                                                                                                    |  
  1262.         ///|----------------------------------------------------------------------------------------------------|  
  1263.         ///| Key | CIMKEY | Values | ValueMap | Read | Write | Units | MaxLen | Desc | Array | Quals | Local    |  
  1264.         ///|----------------------------------------------------------------------------------------------------|  
  1265.         ///| No  |  No    |  No    |    No    |  No  |  No   |  No   |  No    |  Yes |  No   |   2   |   Yes    |  
  1266.         ///|----------------------------------------------------------------------------------------------------|  
  1267.         /// <summary>  
  1268.         ///  If this object is retrieved from the ActiveStore, with the TracePolicyStoreSource option set,  
  1269.         ///  describes the type of PolicyStore where this rule originally came from.    
  1270.         /// </summary>  
  1271.         public ushort varPolicyStoreSourceType  
  1272.  
  1273.         {  
  1274.             set  
  1275.             {  
  1276.                _varpolicystoresourcetype = value;  
  1277.             }  
  1278.             get  
  1279.             {  
  1280.                 return _varpolicystoresourcetype;  
  1281.             }  
  1282.         }  
  1283.         private ushort _varpolicystoresourcetype = new ushort();    
  1284.  
  1285.         #endregion Property: varPolicyStoreSourceType    
  1286.  
  1287.  
  1288.         #region Property: PrimaryStatus    
  1289.  
  1290.         ///|----------------------------------------------------------------------------------------------------|  
  1291.         ///|                                                                                                    |  
  1292.         ///|   -=( Property: "PrimaryStatus"  CimType:UInt16  )=-                                               |  
  1293.         ///|                                                                                                    |  
  1294.         ///|----------------------------------------------------------------------------------------------------|  
  1295.         ///| Key | CIMKEY | Values | ValueMap | Read | Write | Units | MaxLen | Desc | Array | Quals | Local    |  
  1296.         ///|----------------------------------------------------------------------------------------------------|  
  1297.         ///| No  |  No    |  Yes   |    Yes   |  No  |  No   |  No   |  No    |  Yes |  No   |   4   |   Yes    |  
  1298.         ///|----------------------------------------------------------------------------------------------------|  
  1299.         /// <summary>  
  1300.         ///  PrimaryStatus provides a high level status value, intended to align with Red-Yellow-Green type  
  1301.         ///  representation of status. It should be used in conjunction with DetailedStatus to provide high  
  1302.         ///  level and detailed health status of the ManagedElement and its subcomponents. PrimaryStatus  
  1303.         ///  consists of one of the following values: Unknown, OK, Degraded or Error. "Unknown" indicates  
  1304.         ///  the implementation is in general capable of returning this property, but is unable to do so  
  1305.         ///  at this time. "OK" indicates the ManagedElement is functioning normally. "Degraded" indicates  
  1306.         ///  the ManagedElement is functioning below normal. "Error" indicates the ManagedElement is in  
  1307.         ///  an Error condition.    
  1308.         /// </summary>  
  1309.         public ushort varPrimaryStatus  
  1310.  
  1311.         {  
  1312.             set  
  1313.             {  
  1314.                _varprimarystatus = value;  
  1315.             }  
  1316.             get  
  1317.             {  
  1318.                 return _varprimarystatus;  
  1319.             }  
  1320.         }  
  1321.         private ushort _varprimarystatus = new ushort();    
  1322.  
  1323.         #endregion Property: varPrimaryStatus    
  1324.  
  1325.  
  1326.         #region Property: Priority    
  1327.  
  1328.         ///|----------------------------------------------------------------------------------------------------|  
  1329.         ///|                                                                                                    |  
  1330.         ///|   -=( Property: "Priority"  CimType:UInt16  )=-                                                    |  
  1331.         ///|                                                                                                    |  
  1332.         ///|----------------------------------------------------------------------------------------------------|  
  1333.         ///| Key | CIMKEY | Values | ValueMap | Read | Write | Units | MaxLen | Desc | Array | Quals | Local    |  
  1334.         ///|----------------------------------------------------------------------------------------------------|  
  1335.         ///| No  |  No    |  No    |    No    |  Yes |  No   |  No   |  No    |  Yes |  No   |   4   |   No     |  
  1336.         ///|----------------------------------------------------------------------------------------------------|  
  1337.         /// <summary>  
  1338.         ///  This field is ignored.    
  1339.         /// </summary>  
  1340.         public ushort varPriority  
  1341.  
  1342.         {  
  1343.             set  
  1344.             {  
  1345.                _varpriority = value;  
  1346.             }  
  1347.             get  
  1348.             {  
  1349.                 return _varpriority;  
  1350.             }  
  1351.         }  
  1352.         private ushort _varpriority = new ushort();    
  1353.  
  1354.         public bool PriorityIsReadable = true;  
  1355.         #endregion Property: varPriority    
  1356.  
  1357.  
  1358.         #region Property: Profiles    
  1359.  
  1360.         ///|----------------------------------------------------------------------------------------------------|  
  1361.         ///|                                                                                                    |  
  1362.         ///|   -=( Property: "Profiles"  CimType:UInt16  )=-                                                    |  
  1363.         ///|                                                                                                    |  
  1364.         ///|----------------------------------------------------------------------------------------------------|  
  1365.         ///| Key | CIMKEY | Values | ValueMap | Read | Write | Units | MaxLen | Desc | Array | Quals | Local    |  
  1366.         ///|----------------------------------------------------------------------------------------------------|  
  1367.         ///| No  |  No    |  Yes   |    Yes   |  No  |  No   |  No   |  No    |  Yes |  No   |   4   |   Yes    |  
  1368.         ///|----------------------------------------------------------------------------------------------------|  
  1369.         /// <summary>  
  1370.         ///  Which profiles this rule is active on.    
  1371.         /// </summary>  
  1372.         public ushort varProfiles  
  1373.  
  1374.         {  
  1375.             set  
  1376.             {  
  1377.                _varprofiles = value;  
  1378.             }  
  1379.             get  
  1380.             {  
  1381.                 return _varprofiles;  
  1382.             }  
  1383.         }  
  1384.         private ushort _varprofiles = new ushort();    
  1385.  
  1386.         #endregion Property: varProfiles    
  1387.  
  1388.  
  1389.         #region Property: RuleGroup    
  1390.  
  1391.         ///|----------------------------------------------------------------------------------------------------|  
  1392.         ///|                                                                                                    |  
  1393.         ///|   -=( Property: "RuleGroup"  CimType:String  )=-                                                   |  
  1394.         ///|                                                                                                    |  
  1395.         ///|----------------------------------------------------------------------------------------------------|  
  1396.         ///| Key | CIMKEY | Values | ValueMap | Read | Write | Units | MaxLen | Desc | Array | Quals | Local    |  
  1397.         ///|----------------------------------------------------------------------------------------------------|  
  1398.         ///| No  |  No    |  No    |    No    |  No  |  No   |  No   |  No    |  Yes |  No   |   2   |   Yes    |  
  1399.         ///|----------------------------------------------------------------------------------------------------|  
  1400.         /// <summary>  
  1401.         ///  The locale-independent name for the group that this rule belongs to.  If this field is non-null,  
  1402.         ///  then Windows Firewall with Advanced Security assumes that this rule belongs to a Windows component  
  1403.         ///  or an installed application, and some parts of the rule are protected (including but not limited  
  1404.         ///  to the Name, Description, Program, and Service).    
  1405.         /// </summary>  
  1406.         public string varRuleGroup  
  1407.  
  1408.         {  
  1409.             set  
  1410.             {  
  1411.                _varrulegroup = value;  
  1412.             }  
  1413.             get  
  1414.             {  
  1415.                 return _varrulegroup;  
  1416.             }  
  1417.         }  
  1418.         private string _varrulegroup =  "";    
  1419.  
  1420.         #endregion Property: varRuleGroup    
  1421.  
  1422.  
  1423.         #region Property: RuleUsage    
  1424.  
  1425.         ///|----------------------------------------------------------------------------------------------------|  
  1426.         ///|                                                                                                    |  
  1427.         ///|   -=( Property: "RuleUsage"  CimType:String  )=-                                                   |  
  1428.         ///|                                                                                                    |  
  1429.         ///|----------------------------------------------------------------------------------------------------|  
  1430.         ///| Key | CIMKEY | Values | ValueMap | Read | Write | Units | MaxLen | Desc | Array | Quals | Local    |  
  1431.         ///|----------------------------------------------------------------------------------------------------|  
  1432.         ///| No  |  No    |  No    |    No    |  Yes |  No   |  No   |  No    |  Yes |  No   |   4   |   No     |  
  1433.         ///|----------------------------------------------------------------------------------------------------|  
  1434.         /// <summary>  
  1435.         ///  This field is ignored.    
  1436.         /// </summary>  
  1437.         public string varRuleUsage  
  1438.  
  1439.         {  
  1440.             set  
  1441.             {  
  1442.                _varruleusage = value;  
  1443.             }  
  1444.             get  
  1445.             {  
  1446.                 return _varruleusage;  
  1447.             }  
  1448.         }  
  1449.         private string _varruleusage =  "";    
  1450.  
  1451.         public bool RuleUsageIsReadable = true;  
  1452.         #endregion Property: varRuleUsage    
  1453.  
  1454.  
  1455.         #region Property: SequencedActions    
  1456.  
  1457.         ///|----------------------------------------------------------------------------------------------------|  
  1458.         ///|                                                                                                    |  
  1459.         ///|   -=( Property: "SequencedActions"  CimType:UInt16  )=-                                            |  
  1460.         ///|                                                                                                    |  
  1461.         ///|----------------------------------------------------------------------------------------------------|  
  1462.         ///| Key | CIMKEY | Values | ValueMap | Read | Write | Units | MaxLen | Desc | Array | Quals | Local    |  
  1463.         ///|----------------------------------------------------------------------------------------------------|  
  1464.         ///| No  |  No    |  Yes   |    Yes   |  Yes |  No   |  No   |  No    |  Yes |  No   |   6   |   No     |  
  1465.         ///|----------------------------------------------------------------------------------------------------|  
  1466.         /// <summary>  
  1467.         ///  This field is ignored.    
  1468.         /// </summary>  
  1469.         public ushort varSequencedActions  
  1470.  
  1471.         {  
  1472.             set  
  1473.             {  
  1474.                _varsequencedactions = value;  
  1475.             }  
  1476.             get  
  1477.             {  
  1478.                 return _varsequencedactions;  
  1479.             }  
  1480.         }  
  1481.         private ushort _varsequencedactions = new ushort();    
  1482.  
  1483.         public bool SequencedActionsIsReadable = true;  
  1484.         #endregion Property: varSequencedActions    
  1485.  
  1486.  
  1487.         #region Property: Status    
  1488.  
  1489.         ///|----------------------------------------------------------------------------------------------------|  
  1490.         ///|                                                                                                    |  
  1491.         ///|   -=( Property: "Status"  CimType:String  )=-                                                      |  
  1492.         ///|                                                                                                    |  
  1493.         ///|----------------------------------------------------------------------------------------------------|  
  1494.         ///| Key | CIMKEY | Values | ValueMap | Read | Write | Units | MaxLen | Desc | Array | Quals | Local    |  
  1495.         ///|----------------------------------------------------------------------------------------------------|  
  1496.         ///| No  |  No    |  No    |    No    |  No  |  No   |  No   |  No    |  Yes |  No   |   2   |   Yes    |  
  1497.         ///|----------------------------------------------------------------------------------------------------|  
  1498.         /// <summary>  
  1499.         ///  The detailed status of the rule, as a string.    
  1500.         /// </summary>  
  1501.         public string varStatus  
  1502.  
  1503.         {  
  1504.             set  
  1505.             {  
  1506.                _varstatus = value;  
  1507.             }  
  1508.             get  
  1509.             {  
  1510.                 return _varstatus;  
  1511.             }  
  1512.         }  
  1513.         private string _varstatus =  "";    
  1514.  
  1515.         #endregion Property: varStatus    
  1516.  
  1517.  
  1518.         #region Property: StatusCode    
  1519.  
  1520.         ///|----------------------------------------------------------------------------------------------------|  
  1521.         ///|                                                                                                    |  
  1522.         ///|   -=( Property: "StatusCode"  CimType:UInt32  )=-                                                  |  
  1523.         ///|                                                                                                    |  
  1524.         ///|----------------------------------------------------------------------------------------------------|  
  1525.         ///| Key | CIMKEY | Values | ValueMap | Read | Write | Units | MaxLen | Desc | Array | Quals | Local    |  
  1526.         ///|----------------------------------------------------------------------------------------------------|  
  1527.         ///| No  |  No    |  No    |    No    |  No  |  No   |  No   |  No    |  Yes |  No   |   2   |   Yes    |  
  1528.         ///|----------------------------------------------------------------------------------------------------|  
  1529.         /// <summary>  
  1530.         ///  The detailed status of the rule, as a numeric error code.    
  1531.         /// </summary>  
  1532.         public uint varStatusCode  
  1533.  
  1534.         {  
  1535.             set  
  1536.             {  
  1537.                _varstatuscode = value;  
  1538.             }  
  1539.             get  
  1540.             {  
  1541.                 return _varstatuscode;  
  1542.             }  
  1543.         }  
  1544.         private uint _varstatuscode = new uint();    
  1545.  
  1546.         #endregion Property: varStatusCode    
  1547.  
  1548.  
  1549.         #region Property: SystemCreationClassName    
  1550.  
  1551.         ///|----------------------------------------------------------------------------------------------------|  
  1552.         ///|                                                                                                    |  
  1553.         ///|   -=( Property: "SystemCreationClassName"  CimType:String  )=-                                     |  
  1554.         ///|                                                                                                    |  
  1555.         ///|----------------------------------------------------------------------------------------------------|  
  1556.         ///| Key | CIMKEY | Values | ValueMap | Read | Write | Units | MaxLen | Desc | Array | Quals | Local    |  
  1557.         ///|----------------------------------------------------------------------------------------------------|  
  1558.         ///| Yes |  No    |  No    |    No    |  Yes |  No   |  No   |  Yes   |  Yes |  No   |   7   |   No     |  
  1559.         ///|----------------------------------------------------------------------------------------------------|  
  1560.         /// <summary>  
  1561.         ///  Reserved for internal use by the WMI provider only.    
  1562.         /// </summary>  
  1563.         public string varSystemCreationClassName  
  1564.  
  1565.         {  
  1566.             set  
  1567.             {  
  1568.                _varsystemcreationclassname = value;  
  1569.             }  
  1570.             get  
  1571.             {  
  1572.                 return _varsystemcreationclassname;  
  1573.             }  
  1574.         }  
  1575.         private string _varsystemcreationclassname =  "";    
  1576.  
  1577.         public bool SystemCreationClassNameIsReadable = true;  
  1578.         public double SystemCreationClassNameMaxLength = 256;    
  1579.         #endregion Property: varSystemCreationClassName    
  1580.  
  1581.  
  1582.         #region Property: SystemName    
  1583.  
  1584.         ///|----------------------------------------------------------------------------------------------------|  
  1585.         ///|                                                                                                    |  
  1586.         ///|   -=( Property: "SystemName"  CimType:String  )=-                                                  |  
  1587.         ///|                                                                                                    |  
  1588.         ///|----------------------------------------------------------------------------------------------------|  
  1589.         ///| Key | CIMKEY | Values | ValueMap | Read | Write | Units | MaxLen | Desc | Array | Quals | Local    |  
  1590.         ///|----------------------------------------------------------------------------------------------------|  
  1591.         ///| Yes |  No    |  No    |    No    |  Yes |  No   |  No   |  Yes   |  Yes |  No   |   7   |   No     |  
  1592.         ///|----------------------------------------------------------------------------------------------------|  
  1593.         /// <summary>  
  1594.         ///  Reserved for internal use by the WMI provider only.    
  1595.         /// </summary>  
  1596.         public string varSystemName  
  1597.  
  1598.         {  
  1599.             set  
  1600.             {  
  1601.                _varsystemname = value;  
  1602.             }  
  1603.             get  
  1604.             {  
  1605.                 return _varsystemname;  
  1606.             }  
  1607.         }  
  1608.         private string _varsystemname =  "";    
  1609.  
  1610.         public bool SystemNameIsReadable = true;  
  1611.         public double SystemNameMaxLength = 256;    
  1612.         #endregion Property: varSystemName    
  1613.  
  1614.  
  1615.         #region Load Key Properties  
  1616.         private void _load_Key_Properties()  
  1617.         {  
  1618.                     /// varCreationClassName is a Key Property                    
  1619.                     _key_properties.Add("varCreationClassName");                
  1620.                     /// varPolicyRuleName is a Key Property                    
  1621.                     _key_properties.Add("varPolicyRuleName");                
  1622.                     /// varSystemCreationClassName is a Key Property                    
  1623.                     _key_properties.Add("varSystemCreationClassName");                
  1624.                     /// varSystemName is a Key Property                    
  1625.                     _key_properties.Add("varSystemName");                
  1626.              
  1627.         }  
  1628.         #endregion  
  1629.         #endregion  
  1630.         #region public int Execute_Enable_Method()  
  1631.  
  1632.         ///-=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=-  
  1633.         ///                                                                                                                  
  1634.         ///  public int Execute_Enable_Method()                                                                              
  1635.         ///                                                                                                                  
  1636.         ///-=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=-  
  1637.         ///<summary>                                                                                                                      
  1638.         ///   Execute_Enable_Method()                                                                                        
  1639.         ///</summary>                                                                                                                    
  1640.         ///<returns>int ReturnValue</returns>                                                                                            
  1641.         public int Execute_Enable_Method( string instancepath )                                                              
  1642.         {                                                                                              
  1643.             int i = -1;                                            
  1644.             try{                                                                                                                          
  1645.                 string ip = instancepath;                                                                                                                          
  1646.                 if (this.InstancePath != "") { ip = this.InstancePath; }                                                                                                                        
  1647.                 else { ip = "MSFT_NetFirewallRule=@"; }                                                                                                                          
  1648.                 ManagementScope scope = new ManagementScope("ROOT\\StandardCimv2");  
  1649.                 ManagementObject mo = new ManagementObject(scope, new ManagementPath(ip), new ObjectGetOptions());  
  1650.                 mo.Scope.Options.EnablePrivileges = true;                                                  
  1651.                 ManagementBaseObject param = mo.InvokeMethod( "Enable" , null , null );                                            
  1652.                 i = Convert.ToInt32(param[ "ReturnValue" ].ToString());                                                                      
  1653.                 mo.Dispose();                                                                                                                
  1654.             } catch (Exception ex) { LogError(ex); }                                                      
  1655.             return i;                                                                                                                    
  1656.         }                                                                                                                                
  1657.  
  1658.         #endregion public int Execute_Enable_Method()  
  1659.  
  1660.         #region public int Execute_Disable_Method()  
  1661.  
  1662.         ///-=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=-  
  1663.         ///                                                                                                                  
  1664.         ///  public int Execute_Disable_Method()                                                                            
  1665.         ///                                                                                                                  
  1666.         ///-=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=-  
  1667.         ///<summary>                                                                                                                      
  1668.         ///   Execute_Disable_Method()                                                                                        
  1669.         ///</summary>                                                                                                                    
  1670.         ///<returns>int ReturnValue</returns>                                                                                            
  1671.         public int Execute_Disable_Method( string instancepath )                                                              
  1672.         {                                                                                              
  1673.             int i = -1;                                            
  1674.             try{                                                                                                                          
  1675.                 string ip = instancepath;                                                                                                                          
  1676.                 if (this.InstancePath != "") { ip = this.InstancePath; }                                                                                                                        
  1677.                 else { ip = "MSFT_NetFirewallRule=@"; }                                                                                                                          
  1678.                 ManagementScope scope = new ManagementScope("ROOT\\StandardCimv2");  
  1679.                 ManagementObject mo = new ManagementObject(scope, new ManagementPath(ip), new ObjectGetOptions());  
  1680.                 mo.Scope.Options.EnablePrivileges = true;                                                  
  1681.                 ManagementBaseObject param = mo.InvokeMethod( "Disable" , null , null );                                            
  1682.                 i = Convert.ToInt32(param[ "ReturnValue" ].ToString());                                                                      
  1683.                 mo.Dispose();                                                                                                                
  1684.             } catch (Exception ex) { LogError(ex); }                                                      
  1685.             return i;                                                                                                                    
  1686.         }                                                                                                                                
  1687.  
  1688.         #endregion public int Execute_Disable_Method()  
  1689.  
  1690.         #region public int Execute_Rename_Method()  
  1691.  
  1692.         ///-=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=-  
  1693.         ///                                                                                                                  
  1694.         ///  Execute_Rename_Method(string instancepath, String _newname )                                                    
  1695.         ///                                                                                                                  
  1696.         ///-=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=-  
  1697.         ///<summary>                                                                                                                      
  1698.         ///   Execute_Rename_Method( string instancepath, String _newname  )                                                                                      
  1699.         ///</summary>                                                                                                                    
  1700.         ///<returns>int ReturnValue</returns>                                                                                            
  1701.         public int Execute_Rename_Method( string instancepath, String _newname  )                                                              
  1702.         {                                                                                              
  1703.             int i = -1;                                            
  1704.             try {                                                                                                                          
  1705.                 string ip = instancepath;                                                                                                                          
  1706.                 if (this.InstancePath != "") { ip = this.InstancePath; }                                                                                                                          
  1707.                 else { ip = "=@"; }                                                                                                                          
  1708.                 ManagementScope scope = new ManagementScope("ROOT\\StandardCimv2");  
  1709.                 ManagementObject mo = new ManagementObject(scope, new ManagementPath(ip), new ObjectGetOptions());  
  1710.                 mo.Scope.Options.EnablePrivileges = true;                                                  
  1711.                 mo.Scope.Connect();    
  1712.                 ManagementBaseObject inparams = mo.GetMethodParameters(  "Rename" );      
  1713.                 inparams["NewName"] = (String)_newname;      
  1714.                 ManagementBaseObject param = mo.InvokeMethod( "Rename" , inparams , null );                                            
  1715.                 i = Convert.ToInt32(param[ "ReturnValue" ].ToString());                                                                      
  1716.                 mo.Dispose();                                                                                                                
  1717.             } catch (Exception ex) { LogError(ex); }                                                      
  1718.             return i;                                                                                                                    
  1719.         }                                                                                                                                
  1720.  
  1721.         #endregion public int Execute_Rename_Method()  
  1722.  
  1723.  
  1724.         #region public int Execute_CloneObject_Method()  
  1725.  
  1726.         ///-=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=-  
  1727.         ///                                                                                                                  
  1728.         ///  Execute_CloneObject_Method(string instancepath, String _newgposession, String _newname, String _newpolicystore  
  1729.         ///                                                                                                                  
  1730.         ///-=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=-  
  1731.         ///<summary>                                                                                                                      
  1732.         ///   Execute_CloneObject_Method( string instancepath, String _newgposession, String _newname, String _newpolicystore  )                                                                                      
  1733.         ///</summary>                                                                                                                    
  1734.         ///<returns>int ReturnValue</returns>                                                                                            
  1735.         public int Execute_CloneObject_Method( string instancepath, String _newgposession, String _newname, String _newpolicystore  )                                                              
  1736.         {                                                                                              
  1737.             int i = -1;                                            
  1738.             try {                                                                                                                          
  1739.                 string ip = instancepath;                                                                                                                          
  1740.                 if (this.InstancePath != "") { ip = this.InstancePath; }                                                                                                                          
  1741.                 else { ip = "=@"; }                                                                                                                          
  1742.                 ManagementScope scope = new ManagementScope("ROOT\\StandardCimv2");  
  1743.                 ManagementObject mo = new ManagementObject(scope, new ManagementPath(ip), new ObjectGetOptions());  
  1744.                 mo.Scope.Options.EnablePrivileges = true;                                                  
  1745.                 mo.Scope.Connect();    
  1746.                 ManagementBaseObject inparams = mo.GetMethodParameters(  "CloneObject" );      
  1747.                 inparams["NewGPOSession"] = (String)_newgposession;      
  1748.                 inparams["NewName"] = (String)_newname;      
  1749.                 inparams["NewPolicyStore"] = (String)_newpolicystore;      
  1750.                 ManagementBaseObject param = mo.InvokeMethod( "CloneObject" , inparams , null );                                            
  1751.                 i = Convert.ToInt32(param[ "ReturnValue" ].ToString());                                                                      
  1752.                 mo.Dispose();                                                                                                                
  1753.             } catch (Exception ex) { LogError(ex); }                                                      
  1754.             return i;                                                                                                                    
  1755.         }                                                                                                                                
  1756.  
  1757.         #endregion public int Execute_CloneObject_Method()  
  1758.  
  1759.  
  1760.         #region public int Execute_EnumerateFull_Method()  
  1761.  
  1762.         ///-=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=-  
  1763.         ///                                                                                                                  
  1764.         ///  public int Execute_EnumerateFull_Method()                                                                      
  1765.         ///                                                                                                                  
  1766.         ///-=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=-  
  1767.         ///<summary>                                                                                                                      
  1768.         ///   Execute_EnumerateFull_Method()                                                                                        
  1769.         ///</summary>                                                                                                                    
  1770.         ///<returns>int ReturnValue</returns>                                                                                            
  1771.         public int Execute_EnumerateFull_Method( string instancepath )                                                              
  1772.         {                                                                                              
  1773.             int i = -1;                                            
  1774.             try{                                                                                                                          
  1775.                 string ip = instancepath;                                                                                                                          
  1776.                 if (this.InstancePath != "") { ip = this.InstancePath; }                                                                                                                        
  1777.                 else { ip = "MSFT_NetFirewallRule=@"; }                                                                                                                          
  1778.                 ManagementScope scope = new ManagementScope("ROOT\\StandardCimv2");  
  1779.                 ManagementObject mo = new ManagementObject(scope, new ManagementPath(ip), new ObjectGetOptions());  
  1780.                 mo.Scope.Options.EnablePrivileges = true;                                                  
  1781.                 ManagementBaseObject param = mo.InvokeMethod( "EnumerateFull" , null , null );                                            
  1782.                 i = Convert.ToInt32(param[ "ReturnValue" ].ToString());                                                                      
  1783.                 mo.Dispose();                                                                                                                
  1784.             } catch (Exception ex) { LogError(ex); }                                                      
  1785.             return i;                                                                                                                    
  1786.         }                                                                                                                                
  1787.  
  1788.         #endregion public int Execute_EnumerateFull_Method()  
  1789.  
  1790.  
  1791.  
  1792.  
  1793.         #region Get_All_MSFT_NetFirewallRule_Objects()  
  1794.         ///===================================================================================================  
  1795.         ///                                                                                                    
  1796.         ///    Get_All_MSFT_NetFirewallRule_Objects()                                                
  1797.         ///                                                                                                    
  1798.         ///===================================================================================================  
  1799.         ///  <summary>  
  1800.         ///    Returns an ArrayList of 'MSFT_NetFirewallRule' objects with all fields filled  
  1801.         ///  </summary>  
  1802.         /// <returns>ArrayList of 'MSFT_NetFirewallRule' objects</returns>  
  1803.         public ArrayList Get_All_MSFT_NetFirewallRule_Objects()  
  1804.         {  
  1805.  
  1806.             ArrayList the_ArrayList = new ArrayList();  
  1807.  
  1808.             ConnectionOptions co = new ConnectionOptions();  
  1809.  
  1810.             co.EnablePrivileges = true;  
  1811.             co.Impersonation = ImpersonationLevel.Impersonate;  
  1812.             co.Authentication = AuthenticationLevel.PacketPrivacy;  
  1813.             co.Timeout = new TimeSpan(0, 0, 10);                          
  1814.  
  1815.             if(!this._islocalconnection)  
  1816.             {  
  1817.                 co.Username = this._username;    
  1818.                 co.Password = this._password;    
  1819.                 co.Authority = "ntlmdomain:" + this._hostname;  
  1820.             }  
  1821.  
  1822.             ManagementScope ms = new ManagementScope("\\\\"+ this._hostname + "\\" + this._namespace , co);  
  1823.  
  1824.             ms.Connect();                                                              
  1825.  
  1826.             while (!ms.IsConnected)  
  1827.             {  
  1828.                 System.Threading.Thread.Sleep(1);    
  1829.             }    
  1830.             if( !ms.IsConnected )                                                    
  1831.             {                                                                        
  1832.                 LogWarning( "Could not connect to management scope!" + ms.Path );  
  1833.             }                                                                        
  1834.             else                                                                        
  1835.             {                                                                        
  1836.                 ObjectQuery oQuery = new ObjectQuery(this._wmiquery);  
  1837.                 ManagementObjectSearcher searcher = new ManagementObjectSearcher(ms, oQuery);  
  1838.                 searcher.Options.UseAmendedQualifiers = false;  
  1839.                 ManagementObjectCollection moc = searcher.Get();  
  1840.                 foreach (ManagementObject mo in moc)  
  1841.                 {  
  1842.                     MSFT_NetFirewallRule x = new MSFT_NetFirewallRule();  
  1843.                     x._instancepath =  mo.Path.RelativePath;  
  1844.                     x._knownhostid = this.KnownHostID;    
  1845.                     x._hostname = this._hostname;  
  1846.  
  1847.  
  1848.                     try  
  1849.                     {  
  1850.                         x.varAction = Convert.ToUInt16(mo.GetPropertyValue("Action")); //todo: 4779  Type:UInt16 Array?:False  
  1851.                     }  
  1852.                     catch(Exception ex)  
  1853.                     {  
  1854.                         LogError(ex);  
  1855.                     }  
  1856.                     try  
  1857.                     {  
  1858.                         x.varCaption = Convert.ToString(mo.GetPropertyValue("Caption")); //todo: 4779  Type:String Array?:False  
  1859.                     }  
  1860.                     catch(Exception ex)  
  1861.                     {  
  1862.                         LogError(ex);  
  1863.                     }  
  1864.                     try  
  1865.                     {  
  1866.                         x.varCommonName = Convert.ToString(mo.GetPropertyValue("CommonName")); //todo: 4779  Type:String Array?:False  
  1867.                     }  
  1868.                     catch(Exception ex)  
  1869.                     {  
  1870.                         LogError(ex);  
  1871.                     }  
  1872.                     try  
  1873.                     {  
  1874.                         x.varConditionListType = Convert.ToUInt16(mo.GetPropertyValue("ConditionListType")); //todo: 4779  Type:UInt16 Array?:False  
  1875.                     }  
  1876.                     catch(Exception ex)  
  1877.                     {  
  1878.                         LogError(ex);  
  1879.                     }  
  1880.                     try  
  1881.                     {  
  1882.                         x.varCreationClassName = Convert.ToString(mo.GetPropertyValue("CreationClassName")); //todo: 4779  Type:String Array?:False  
  1883.                     }  
  1884.                     catch(Exception ex)  
  1885.                     {  
  1886.                         LogError(ex);  
  1887.                     }  
  1888.                     try  
  1889.                     {  
  1890.                         x.varDescription = Convert.ToString(mo.GetPropertyValue("Description")); //todo: 4779  Type:String Array?:False  
  1891.                     }  
  1892.                     catch(Exception ex)  
  1893.                     {  
  1894.                         LogError(ex);  
  1895.                     }  
  1896.                     try  
  1897.                     {  
  1898.                         x.varDirection = Convert.ToUInt16(mo.GetPropertyValue("Direction")); //todo: 4779  Type:UInt16 Array?:False  
  1899.                     }  
  1900.                     catch(Exception ex)  
  1901.                     {  
  1902.                         LogError(ex);  
  1903.                     }  
  1904.                     try  
  1905.                     {  
  1906.                         x.varDisplayGroup = Convert.ToString(mo.GetPropertyValue("DisplayGroup")); //todo: 4779  Type:String Array?:False  
  1907.                     }  
  1908.                     catch(Exception ex)  
  1909.                     {  
  1910.                         LogError(ex);  
  1911.                     }  
  1912.                     try  
  1913.                     {  
  1914.                         x.varDisplayName = Convert.ToString(mo.GetPropertyValue("DisplayName")); //todo: 4779  Type:String Array?:False  
  1915.                     }  
  1916.                     catch(Exception ex)  
  1917.                     {  
  1918.                         LogError(ex);  
  1919.                     }  
  1920.                     try  
  1921.                     {  
  1922.                         x.varEdgeTraversalPolicy = Convert.ToUInt16(mo.GetPropertyValue("EdgeTraversalPolicy")); //todo: 4779  Type:UInt16 Array?:False  
  1923.                     }  
  1924.                     catch(Exception ex)  
  1925.                     {  
  1926.                         LogError(ex);  
  1927.                     }  
  1928.                     try  
  1929.                     {  
  1930.                         x.varElementName = Convert.ToString(mo.GetPropertyValue("ElementName")); //todo: 4779  Type:String Array?:False  
  1931.                     }  
  1932.                     catch(Exception ex)  
  1933.                     {  
  1934.                         LogError(ex);  
  1935.                     }  
  1936.                     try  
  1937.                     {  
  1938.                         x.varEnabled = Convert.ToUInt16(mo.GetPropertyValue("Enabled")); //todo: 4779  Type:UInt16 Array?:False  
  1939.                     }  
  1940.                     catch(Exception ex)  
  1941.                     {  
  1942.                         LogError(ex);  
  1943.                     }  
  1944.                     try  
  1945.                     {  
  1946.                     UInt16[] var = new UInt16[1];  
  1947.                     var = (UInt16[])mo.GetPropertyValue("EnforcementStatus");   //4762  Type:UInt16 Array?:True  
  1948.                         x.varEnforcementStatus = var;  
  1949.                     }  
  1950.                     catch(Exception ex)  
  1951.                     {  
  1952.                         LogError(ex);  
  1953.                     }  
  1954.                     try  
  1955.                     {  
  1956.                         x.varExecutionStrategy = Convert.ToUInt16(mo.GetPropertyValue("ExecutionStrategy")); //todo: 4779  Type:UInt16 Array?:False  
  1957.                     }  
  1958.                     catch(Exception ex)  
  1959.                     {  
  1960.                         LogError(ex);  
  1961.                     }  
  1962.                     try  
  1963.                     {  
  1964.                         x.varInstanceID = Convert.ToString(mo.GetPropertyValue("InstanceID")); //todo: 4779  Type:String Array?:False  
  1965.                     }  
  1966.                     catch(Exception ex)  
  1967.                     {  
  1968.                         LogError(ex);  
  1969.                     }  
  1970.                     try  
  1971.                     {  
  1972.                         x.varLocalOnlyMapping = Convert.ToBoolean(mo.GetPropertyValue("LocalOnlyMapping")); //todo: 4779  Type:Boolean Array?:False  
  1973.                     }  
  1974.                     catch(Exception ex)  
  1975.                     {  
  1976.                         LogError(ex);  
  1977.                     }  
  1978.                     try  
  1979.                     {  
  1980.                         x.varLooseSourceMapping = Convert.ToBoolean(mo.GetPropertyValue("LooseSourceMapping")); //todo: 4779  Type:Boolean Array?:False  
  1981.                     }  
  1982.                     catch(Exception ex)  
  1983.                     {  
  1984.                         LogError(ex);  
  1985.                     }  
  1986.                     try  
  1987.                     {  
  1988.                         x.varMandatory = Convert.ToBoolean(mo.GetPropertyValue("Mandatory")); //todo: 4779  Type:Boolean Array?:False  
  1989.                     }  
  1990.                     catch(Exception ex)  
  1991.                     {  
  1992.                         LogError(ex);  
  1993.                     }  
  1994.                     try  
  1995.                     {  
  1996.                         x.varOwner = Convert.ToString(mo.GetPropertyValue("Owner")); //todo: 4779  Type:String Array?:False  
  1997.                     }  
  1998.                     catch(Exception ex)  
  1999.                     {  
  2000.                         LogError(ex);  
  2001.                     }  
  2002.                     try  
  2003.                     {  
  2004.                         x.varPlatforms = ConvertType.MakeStorableArrayFromManagementBaseObject( mo.GetPropertyValue("Platforms") ).Split('|');  //4768 Type:String Array?:True  
  2005.                     }  
  2006.                     catch(Exception ex)  
  2007.                     {  
  2008.                         LogError(ex);  
  2009.                     }  
  2010.                     try  
  2011.                     {  
  2012.                         x.varPolicyDecisionStrategy = Convert.ToUInt16(mo.GetPropertyValue("PolicyDecisionStrategy")); //todo: 4779  Type:UInt16 Array?:False  
  2013.                     }  
  2014.                     catch(Exception ex)  
  2015.                     {  
  2016.                         LogError(ex);  
  2017.                     }  
  2018.                     try  
  2019.                     {  
  2020.                         x.varPolicyKeywords = ConvertType.MakeStorableArrayFromManagementBaseObject( mo.GetPropertyValue("PolicyKeywords") ).Split('|');  //4768 Type:String Array?:True  
  2021.                     }  
  2022.                     catch(Exception ex)  
  2023.                     {  
  2024.                         LogError(ex);  
  2025.                     }  
  2026.                     try  
  2027.                     {  
  2028.                         x.varPolicyRoles = ConvertType.MakeStorableArrayFromManagementBaseObject( mo.GetPropertyValue("PolicyRoles") ).Split('|');  //4768 Type:String Array?:True  
  2029.                     }  
  2030.                     catch(Exception ex)  
  2031.                     {  
  2032.                         LogError(ex);  
  2033.                     }  
  2034.                     try  
  2035.                     {  
  2036.                         x.varPolicyRuleName = Convert.ToString(mo.GetPropertyValue("PolicyRuleName")); //todo: 4779  Type:String Array?:False  
  2037.                     }  
  2038.                     catch(Exception ex)  
  2039.                     {  
  2040.                         LogError(ex);  
  2041.                     }  
  2042.                     try  
  2043.                     {  
  2044.                         x.varPolicyStoreSource = Convert.ToString(mo.GetPropertyValue("PolicyStoreSource")); //todo: 4779  Type:String Array?:False  
  2045.                     }  
  2046.                     catch(Exception ex)  
  2047.                     {  
  2048.                         LogError(ex);  
  2049.                     }  
  2050.                     try  
  2051.                     {  
  2052.                         x.varPolicyStoreSourceType = Convert.ToUInt16(mo.GetPropertyValue("PolicyStoreSourceType")); //todo: 4779  Type:UInt16 Array?:False  
  2053.                     }  
  2054.                     catch(Exception ex)  
  2055.                     {  
  2056.                         LogError(ex);  
  2057.                     }  
  2058.                     try  
  2059.                     {  
  2060.                         x.varPrimaryStatus = Convert.ToUInt16(mo.GetPropertyValue("PrimaryStatus")); //todo: 4779  Type:UInt16 Array?:False  
  2061.                     }  
  2062.                     catch(Exception ex)  
  2063.                     {  
  2064.                         LogError(ex);  
  2065.                     }  
  2066.                     try  
  2067.                     {  
  2068.                         x.varPriority = Convert.ToUInt16(mo.GetPropertyValue("Priority")); //todo: 4779  Type:UInt16 Array?:False  
  2069.                     }  
  2070.                     catch(Exception ex)  
  2071.                     {  
  2072.                         LogError(ex);  
  2073.                     }  
  2074.                     try  
  2075.                     {  
  2076.                         x.varProfiles = Convert.ToUInt16(mo.GetPropertyValue("Profiles")); //todo: 4779  Type:UInt16 Array?:False  
  2077.                     }  
  2078.                     catch(Exception ex)  
  2079.                     {  
  2080.                         LogError(ex);  
  2081.                     }  
  2082.                     try  
  2083.                     {  
  2084.                         x.varRuleGroup = Convert.ToString(mo.GetPropertyValue("RuleGroup")); //todo: 4779  Type:String Array?:False  
  2085.                     }  
  2086.                     catch(Exception ex)  
  2087.                     {  
  2088.                         LogError(ex);  
  2089.                     }  
  2090.                     try  
  2091.                     {  
  2092.                         x.varRuleUsage = Convert.ToString(mo.GetPropertyValue("RuleUsage")); //todo: 4779  Type:String Array?:False  
  2093.                     }  
  2094.                     catch(Exception ex)  
  2095.                     {  
  2096.                         LogError(ex);  
  2097.                     }  
  2098.                     try  
  2099.                     {  
  2100.                         x.varSequencedActions = Convert.ToUInt16(mo.GetPropertyValue("SequencedActions")); //todo: 4779  Type:UInt16 Array?:False  
  2101.                     }  
  2102.                     catch(Exception ex)  
  2103.                     {  
  2104.                         LogError(ex);  
  2105.                     }  
  2106.                     try  
  2107.                     {  
  2108.                         x.varStatus = Convert.ToString(mo.GetPropertyValue("Status")); //todo: 4779  Type:String Array?:False  
  2109.                     }  
  2110.                     catch(Exception ex)  
  2111.                     {  
  2112.                         LogError(ex);  
  2113.                     }  
  2114.                     try  
  2115.                     {  
  2116.                         x.varStatusCode = Convert.ToUInt32(mo.GetPropertyValue("StatusCode")); //todo: 4779  Type:UInt32 Array?:False  
  2117.                     }  
  2118.                     catch(Exception ex)  
  2119.                     {  
  2120.                         LogError(ex);  
  2121.                     }  
  2122.                     try  
  2123.                     {  
  2124.                         x.varSystemCreationClassName = Convert.ToString(mo.GetPropertyValue("SystemCreationClassName")); //todo: 4779  Type:String Array?:False  
  2125.                     }  
  2126.                     catch(Exception ex)  
  2127.                     {  
  2128.                         LogError(ex);  
  2129.                     }  
  2130.                     try  
  2131.                     {  
  2132.                         x.varSystemName = Convert.ToString(mo.GetPropertyValue("SystemName")); //todo: 4779  Type:String Array?:False  
  2133.                     }  
  2134.                     catch(Exception ex)  
  2135.                     {  
  2136.                         LogError(ex);  
  2137.                     }  
  2138.                     the_ArrayList.Add(x);  
  2139.                 }  
  2140.  
  2141.                 searcher.Dispose();  
  2142.                 moc.Dispose();  
  2143.             }  
  2144.  
  2145.         return the_ArrayList;  
  2146.  
  2147.         }  
  2148.  
  2149.         #endregion  
  2150.  
  2151.  
  2152.  
  2153.         ///====================================================================================================  
  2154.         ///                                                                                                      
  2155.         ///     public ManagementObjectCollection GetInstances( ManagementClass m )                              
  2156.         ///                                                                                                      
  2157.         ///====================================================================================================  
  2158.         ///<summary>                                                                                            
  2159.         ///  Get a managementobjectcollection from the selected class                                          
  2160.         ///</summary>                                                                                          
  2161.         ///<param name="m">ManagementClass</param>                                                            
  2162.         ///<returns>ManagementObjectCollection</returns>                                                        
  2163.         public ManagementObjectCollection GetInstances( ManagementClass m )                                    
  2164.         {                                                                                                      
  2165.             ManagementPath mgtPath = new ManagementPath(m.Path.Path);                                          
  2166.             ConnectionOptions co = new ConnectionOptions();                                              
  2167.             co.Authentication = AuthenticationLevel.Packet;                                              
  2168.             co.EnablePrivileges = true;                                                                  
  2169.             co.Timeout = TimeSpan.MaxValue;                                                              
  2170.             if(this._username != ""){ co.Username = this._username;  }  
  2171.             if(this._password != ""){ co.Password = this._password;  }  
  2172.             ManagementScope ms = new ManagementScope("\\\\"+ this._hostname + "\\" + this._namespace , co);  
  2173.             ms.Options.Timeout = TimeSpan.MaxValue;                                                        
  2174.             ms.Options.Impersonation = ImpersonationLevel.Impersonate;                                      
  2175.             ms.Options.EnablePrivileges = true;                                                            
  2176.             ms.Connect();                                                            
  2177.             if( !ms.IsConnected )                                                    
  2178.             {                                                                        
  2179.                 LogWarning( "Could not connect to management scope!" + ms.Path );  
  2180.             }                                                                        
  2181.             SelectQuery selQuery = new SelectQuery( m.Path.ClassName );                                        
  2182.             ManagementObjectSearcher s = new ManagementObjectSearcher( ms , selQuery );                    
  2183.             s.Options.UseAmendedQualifiers = true;                                                              
  2184.             s.Options.DirectRead = true;                                                                        
  2185.             s.Options.EnumerateDeep = true;                                                                    
  2186.             return s.Get();                                                                                    
  2187.         }                                                                                                      
  2188.         ///====================================================================================================  
  2189.         ///===================================================================================================  
  2190.         ///                                                                                                    
  2191.         ///    public ManagementObject GetFirstInstance( string p_classname,  string p_SysRelPath )            
  2192.         ///                                                                                                    
  2193.         ///===================================================================================================  
  2194.         ///<summary>                                                                                            
  2195.         ///  Get a ManagementObject by its key property value                                                  
  2196.         ///</summary>                                                                                          
  2197.         ///  Win32_DiskDrive, DeviceID="\\.\PHYSICALDRIVE0"                                                
  2198.         ///  Win32_NetworkAdapter, DeviceID="0"                                                              
  2199.         ///  <param name="p_ClassName">WMI Class Name</param>                                                
  2200.         ///  <param name="p_RelPath">DeviceID="CPU0" (Example)</param>                                      
  2201.         ///<returns>ManagementObject</returns>                                                                  
  2202.         public ManagementObject GetFirstInstance( string p_classname,  string p_SysRelPath )                    
  2203.         {                                                                                                      
  2204.             ManagementPath mgtPath = new ManagementPath(p_classname);                                          
  2205.             ConnectionOptions co = new ConnectionOptions();                                              
  2206.             co.Authentication = AuthenticationLevel.Packet;                                              
  2207.             co.EnablePrivileges = true;                                                                  
  2208.             co.Timeout = TimeSpan.MaxValue;                                                              
  2209.             if(this._username != ""){ co.Username = this._username;  }  
  2210.             if(this._password != ""){ co.Password = this._password;  }  
  2211.             ManagementScope ms = new ManagementScope("\\\\"+ this._hostname + "\\" + this._namespace , co);  
  2212.             ms.Options.Timeout = TimeSpan.MaxValue;                                                        
  2213.             ms.Options.Impersonation = ImpersonationLevel.Impersonate;                                      
  2214.             ms.Options.EnablePrivileges = true;                                                            
  2215.             ms.Connect();                                                            
  2216.             if( !ms.IsConnected )                                                    
  2217.             {                                                                        
  2218.                 LogWarning( "Could not connect to management scope!" + ms.Path );  
  2219.             }                                                                        
  2220.             SelectQuery selQuery = new SelectQuery( p_classname , p_SysRelPath  );                              
  2221.             ManagementObjectSearcher moSearcher = new ManagementObjectSearcher( ms , selQuery );            
  2222.             moSearcher.Options.UseAmendedQualifiers = false;                                                    
  2223.             ManagementObject mo = new ManagementObject();                                                      
  2224.             foreach( ManagementObject mob in moSearcher.Get() )                                                
  2225.             {                                                                                                  
  2226.                 mo = mob;                                                                                      
  2227.                 break;                                                                                          
  2228.             }                                                                                                  
  2229.             return mo;                                                                                          
  2230.         }                                                                                                      
  2231.         ///===================================================================================================  
  2232.         ///                                                                                                    
  2233.         ///    public ManagementObject GetByPath( string p_SysFullPath )                                        
  2234.         ///                                                                                                    
  2235.         ///===================================================================================================  
  2236.         ///<summary>                                                                                            
  2237.         ///  Get a ManagementObject by its key property value                                                  
  2238.         ///</summary>                                                                                          
  2239.         ///  Win32_DiskDrive, DeviceID="\\.\PHYSICALDRIVE0"                                                
  2240.         ///  Win32_NetworkAdapter, DeviceID="0"                                                              
  2241.         ///  etc...                                                                                            
  2242.         ///  <param name="p_ClassName">WMI Class Name</param>                                                
  2243.         ///  <param name="p_SysRelPath">DeviceID="CPU0" (Example)</param>                                      
  2244.         ///<returns>ManagementObject</returns>                                                                  
  2245.         public ManagementObject GetInstanceByPath(string p_classname, string p_SysRelPath )                    
  2246.         {                                                                                                      
  2247.             ManagementPath mgtPath = new ManagementPath(p_classname);                                          
  2248.             ConnectionOptions co = new ConnectionOptions();                                              
  2249.             co.Authentication = AuthenticationLevel.Packet;                                              
  2250.             co.EnablePrivileges = true;                                                                  
  2251.             co.Timeout = TimeSpan.MaxValue;                                                              
  2252.             if(this._username != ""){ co.Username = this._username;  }  
  2253.             if(this._password != ""){ co.Password = this._password;  }  
  2254.             ManagementScope ms = new ManagementScope("\\\\"+ this._hostname + "\\" + this._namespace , co);  
  2255.             ms.Options.Timeout = TimeSpan.MaxValue;                                                        
  2256.             ms.Options.Impersonation = ImpersonationLevel.Impersonate;                                      
  2257.             ms.Options.EnablePrivileges = true;                                                            
  2258.             ms.Connect();                                                            
  2259.             if( !ms.IsConnected )                                                    
  2260.             {                                                                        
  2261.                 LogWarning( "Could not connect to management scope!" + ms.Path );  
  2262.             }                                                                        
  2263.             SelectQuery selQuery = new SelectQuery( p_classname , p_SysRelPath  );                              
  2264.             ManagementObjectSearcher moSearcher = new ManagementObjectSearcher( ms , selQuery );            
  2265.             moSearcher.Options.UseAmendedQualifiers = true;                                                              
  2266.             ManagementObject mob = new ManagementObject();                                                      
  2267.             foreach( ManagementObject mo in moSearcher.Get() )                                                  
  2268.             {                                                                                                  
  2269.                 mob = mo;                                                                                      
  2270.             }                                                                                                  
  2271.             return mob;                                                                                        
  2272.         }                                                                                                      
  2273.         ///====================================================================================================  
  2274.         #region InstancesToHTML()    
  2275.         ///===================================================================================================  
  2276.         ///                                                                                                    
  2277.         ///    public static string InstancesToHTML()                                                          
  2278.         ///                                                                                                    
  2279.         ///===================================================================================================  
  2280.         ///  <summary>  
  2281.         ///    Returns a html string of all instances of this class  
  2282.         ///  </summary>  
  2283.         /// <returns>string html</returns>  
  2284.         public static string InstancesToHtml()  
  2285.         {                                                                            
  2286.  
  2287.         ConnectionOptions co = new ConnectionOptions();  
  2288.             co.EnablePrivileges = true;  
  2289.             co.Impersonation = ImpersonationLevel.Impersonate;  
  2290.             co.Authentication = AuthenticationLevel.PacketPrivacy;  
  2291.         ManagementScope ms = new ManagementScope( "\\\\.\\\\root\\StandardCimv2", co );  
  2292.         ObjectQuery oQuery = new ObjectQuery( "select * from MSFT_NetFirewallRule" );  
  2293.         ManagementObjectSearcher searcher = new ManagementObjectSearcher( ms , oQuery );  
  2294.         ManagementObjectCollection moc = searcher.Get();  
  2295.  
  2296.          System.Text.StringBuilder sb = new System.Text.StringBuilder();  
  2297.          sb.AppendLine();  
  2298.          sb.AppendLine( "<!-- generated by hydra-->" );  
  2299.          sb.AppendLine( " < table border=1 cellpadding=5 cellspacing=0>" );  
  2300.          sb.AppendLine( " < tr><td colspan=2><strong>" + searcher.Scope.Path.Path + "</strong></td></tr>" );  
  2301.  
  2302.         foreach( ManagementObject mo in moc )  
  2303.         {  
  2304.             sb.AppendLine( "" );  
  2305.             sb.AppendLine( " < tr><td colspan=2><strong>" + mo.Path.Path.ToString() + "</strong></td></tr>" );  
  2306.             sb.AppendLine( " < tr><td>Action</td><td>" + ConvertType.ManagementBaseObjectToString( mo.GetPropertyValue("Action") ) + "</td></tr>" );    
  2307.             sb.AppendLine( " < tr><td>Caption</td><td>" + ConvertType.ManagementBaseObjectToString( mo.GetPropertyValue("Caption") ) + "</td></tr>" );    
  2308.             sb.AppendLine( " < tr><td>CommonName</td><td>" + ConvertType.ManagementBaseObjectToString( mo.GetPropertyValue("CommonName") ) + "</td></tr>" );    
  2309.             sb.AppendLine( " < tr><td>ConditionListType</td><td>" + ConvertType.ManagementBaseObjectToString( mo.GetPropertyValue("ConditionListType") ) + "</td></tr>" );    
  2310.             sb.AppendLine( " < tr><td>CreationClassName</td><td>" + ConvertType.ManagementBaseObjectToString( mo.GetPropertyValue("CreationClassName") ) + "</td></tr>" );    
  2311.             sb.AppendLine( " < tr><td>Description</td><td>" + ConvertType.ManagementBaseObjectToString( mo.GetPropertyValue("Description") ) + "</td></tr>" );    
  2312.             sb.AppendLine( " < tr><td>Direction</td><td>" + ConvertType.ManagementBaseObjectToString( mo.GetPropertyValue("Direction") ) + "</td></tr>" );    
  2313.             sb.AppendLine( " < tr><td>DisplayGroup</td><td>" + ConvertType.ManagementBaseObjectToString( mo.GetPropertyValue("DisplayGroup") ) + "</td></tr>" );    
  2314.             sb.AppendLine( " < tr><td>DisplayName</td><td>" + ConvertType.ManagementBaseObjectToString( mo.GetPropertyValue("DisplayName") ) + "</td></tr>" );    
  2315.             sb.AppendLine( " < tr><td>EdgeTraversalPolicy</td><td>" + ConvertType.ManagementBaseObjectToString( mo.GetPropertyValue("EdgeTraversalPolicy") ) + "</td></tr>" );    
  2316.             sb.AppendLine( " < tr><td>ElementName</td><td>" + ConvertType.ManagementBaseObjectToString( mo.GetPropertyValue("ElementName") ) + "</td></tr>" );    
  2317.             sb.AppendLine( " < tr><td>Enabled</td><td>" + ConvertType.ManagementBaseObjectToString( mo.GetPropertyValue("Enabled") ) + "</td></tr>" );    
  2318.             sb.AppendLine( " < tr><td>EnforcementStatus</td><td>" + ConvertType.ManagementBaseObjectToString( mo.GetPropertyValue("EnforcementStatus") ) + "</td></tr>" );    
  2319.             sb.AppendLine( " < tr><td>ExecutionStrategy</td><td>" + ConvertType.ManagementBaseObjectToString( mo.GetPropertyValue("ExecutionStrategy") ) + "</td></tr>" );    
  2320.             sb.AppendLine( " < tr><td>InstanceID</td><td>" + ConvertType.ManagementBaseObjectToString( mo.GetPropertyValue("InstanceID") ) + "</td></tr>" );    
  2321.             sb.AppendLine( " < tr><td>LocalOnlyMapping</td><td>" + ConvertType.ManagementBaseObjectToString( mo.GetPropertyValue("LocalOnlyMapping") ) + "</td></tr>" );    
  2322.             sb.AppendLine( " < tr><td>LooseSourceMapping</td><td>" + ConvertType.ManagementBaseObjectToString( mo.GetPropertyValue("LooseSourceMapping") ) + "</td></tr>" );    
  2323.             sb.AppendLine( " < tr><td>Mandatory</td><td>" + ConvertType.ManagementBaseObjectToString( mo.GetPropertyValue("Mandatory") ) + "</td></tr>" );    
  2324.             sb.AppendLine( " < tr><td>Owner</td><td>" + ConvertType.ManagementBaseObjectToString( mo.GetPropertyValue("Owner") ) + "</td></tr>" );    
  2325.             sb.AppendLine( " < tr><td>Platforms</td><td>" + ConvertType.ManagementBaseObjectToString( mo.GetPropertyValue("Platforms") ) + "</td></tr>" );    
  2326.             sb.AppendLine( " < tr><td>PolicyDecisionStrategy</td><td>" + ConvertType.ManagementBaseObjectToString( mo.GetPropertyValue("PolicyDecisionStrategy") ) + "</td></tr>" );    
  2327.             sb.AppendLine( " < tr><td>PolicyKeywords</td><td>" + ConvertType.ManagementBaseObjectToString( mo.GetPropertyValue("PolicyKeywords") ) + "</td></tr>" );    
  2328.             sb.AppendLine( " < tr><td>PolicyRoles</td><td>" + ConvertType.ManagementBaseObjectToString( mo.GetPropertyValue("PolicyRoles") ) + "</td></tr>" );    
  2329.             sb.AppendLine( " < tr><td>PolicyRuleName</td><td>" + ConvertType.ManagementBaseObjectToString( mo.GetPropertyValue("PolicyRuleName") ) + "</td></tr>" );    
  2330.             sb.AppendLine( " < tr><td>PolicyStoreSource</td><td>" + ConvertType.ManagementBaseObjectToString( mo.GetPropertyValue("PolicyStoreSource") ) + "</td></tr>" );    
  2331.             sb.AppendLine( " < tr><td>PolicyStoreSourceType</td><td>" + ConvertType.ManagementBaseObjectToString( mo.GetPropertyValue("PolicyStoreSourceType") ) + "</td></tr>" );    
  2332.             sb.AppendLine( " < tr><td>PrimaryStatus</td><td>" + ConvertType.ManagementBaseObjectToString( mo.GetPropertyValue("PrimaryStatus") ) + "</td></tr>" );    
  2333.             sb.AppendLine( " < tr><td>Priority</td><td>" + ConvertType.ManagementBaseObjectToString( mo.GetPropertyValue("Priority") ) + "</td></tr>" );    
  2334.             sb.AppendLine( " < tr><td>Profiles</td><td>" + ConvertType.ManagementBaseObjectToString( mo.GetPropertyValue("Profiles") ) + "</td></tr>" );    
  2335.             sb.AppendLine( " < tr><td>RuleGroup</td><td>" + ConvertType.ManagementBaseObjectToString( mo.GetPropertyValue("RuleGroup") ) + "</td></tr>" );    
  2336.             sb.AppendLine( " < tr><td>RuleUsage</td><td>" + ConvertType.ManagementBaseObjectToString( mo.GetPropertyValue("RuleUsage") ) + "</td></tr>" );    
  2337.             sb.AppendLine( " < tr><td>SequencedActions</td><td>" + ConvertType.ManagementBaseObjectToString( mo.GetPropertyValue("SequencedActions") ) + "</td></tr>" );    
  2338.             sb.AppendLine( " < tr><td>Status</td><td>" + ConvertType.ManagementBaseObjectToString( mo.GetPropertyValue("Status") ) + "</td></tr>" );    
  2339.             sb.AppendLine( " < tr><td>StatusCode</td><td>" + ConvertType.ManagementBaseObjectToString( mo.GetPropertyValue("StatusCode") ) + "</td></tr>" );    
  2340.             sb.AppendLine( " < tr><td>SystemCreationClassName</td><td>" + ConvertType.ManagementBaseObjectToString( mo.GetPropertyValue("SystemCreationClassName") ) + "</td></tr>" );    
  2341.             sb.AppendLine( " < tr><td>SystemName</td><td>" + ConvertType.ManagementBaseObjectToString( mo.GetPropertyValue("SystemName") ) + "</td></tr>" );    
  2342.             sb.AppendLine( " < tr><td colspan=2>&nbsp;</td></tr>" );    
  2343.         }  
  2344.         sb.AppendLine("</table>" );  
  2345.         sb.AppendLine();  
  2346.         searcher.Dispose();  
  2347.         moc.Dispose();  
  2348.         return sb.ToString();  
  2349.         }  
  2350.         #endregion    
  2351.  
  2352.  
  2353.         #region LogError( Exception ex)  
  2354.  
  2355.         ///-=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=-  
  2356.         ///                                                                                                                  
  2357.         ///  public static void LogError(Exception ex)                                                                      
  2358.         ///                                                                                                                  
  2359.         ///-=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=-  
  2360.         /// <summary>                                                                                                                              
  2361.         /// Log Errors                                                                                                                            
  2362.         /// </summary>                                                                                                                            
  2363.         public static void LogError(Exception ex)                                                                                                  
  2364.         {                                                                                                                                          
  2365.             EventLog Log = new EventLog( "Hydra" , ".", "MSFT_NetFirewallRule");  
  2366.             if (!EventLog.SourceExists("MSFT_NetFirewallRule"))    
  2367.             {  
  2368.                 EventLog.CreateEventSource("MSFT_NetFirewallRule", "Hydra");  
  2369.             }  
  2370.             Log.Source = "MSFT_NetFirewallRule";  
  2371.             Log.WriteEntry(ex.ToString(), EventLogEntryType.Error, 420 );  
  2372.         }  
  2373.  
  2374.         #endregion  
  2375.  
  2376.  
  2377.         #region LogError(Exception ex, int evt_id )  
  2378.  
  2379.         ///-=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=-  
  2380.         ///                                                                                                                  
  2381.         ///  public static void LogError(Exception ex, int evt_id)                                                          
  2382.         ///                                                                                                                  
  2383.         ///-=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=-  
  2384.         public static void LogError(Exception ex, int evt_id)  
  2385.         {  
  2386.             EventLog Log = new EventLog( "Hydra" , ".", "MSFT_NetFirewallRule");  
  2387.             if (!EventLog.SourceExists("MSFT_NetFirewallRule"))    
  2388.             {  
  2389.                 EventLog.CreateEventSource("MSFT_NetFirewallRule", "Hydra");  
  2390.             }  
  2391.             Log.Source = "MSFT_NetFirewallRule";  
  2392.             Log.WriteEntry(ex.ToString(), EventLogEntryType.Error, evt_id );  
  2393.         }  
  2394.  
  2395.         #endregion  
  2396.  
  2397.  
  2398.         #region LogWarning(string info)  
  2399.  
  2400.  
  2401.         ///-=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=-  
  2402.         ///                                                                                                                  
  2403.         ///  public static void LogWarning(string info)                                                                      
  2404.         ///                                                                                                                  
  2405.         ///-=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=-  
  2406.         /// <summary>                                                                                                                              
  2407.         /// Log Warning                                                                                                                            
  2408.         /// </summary>                                                                                                                            
  2409.         public static void LogWarning(string info)  
  2410.         {  
  2411.             EventLog Log = new EventLog("Hydra",".", "Hydra");  
  2412.             if (!EventLog.SourceExists("MSFT_NetFirewallRule"))    
  2413.             {      
  2414.                 EventLog.CreateEventSource("MSFT_NetFirewallRule", "Hydra");  
  2415.             }      
  2416.             Log.Source = "MSFT_NetFirewallRule";  
  2417.             Log.WriteEntry(info, EventLogEntryType.Warning, 420 );  
  2418.         }  
  2419.  
  2420.         #endregion  
  2421.  
  2422.  
  2423.         #region LogWarning(string info, int evt_id)  
  2424.  
  2425.         ///-=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=-  
  2426.         ///                                                                                                                  
  2427.         ///  public static void LogWarning(string info, int evt_id)                                                          
  2428.         ///                                                                                                                  
  2429.         ///-=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=-  
  2430.         /// <summary>                                                                                                                              
  2431.         /// Log Warning                                                                                                                            
  2432.         /// </summary>                                                                                                                            
  2433.         public static void LogWarning(string info, int evt_id)  
  2434.         {  
  2435.             EventLog Log = new EventLog("Hydra",".", "Hydra");  
  2436.             if (!EventLog.SourceExists("MSFT_NetFirewallRule"))    
  2437.             {      
  2438.                 EventLog.CreateEventSource("MSFT_NetFirewallRule", "Hydra");  
  2439.             }      
  2440.             Log.Source = "MSFT_NetFirewallRule";  
  2441.             Log.WriteEntry(info, EventLogEntryType.Warning, evt_id );  
  2442.         }  
  2443.  
  2444.         #endregion  
  2445.  
  2446.  
  2447.         #region LogInfo(string info)  
  2448.  
  2449.  
  2450.         ///-=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=-  
  2451.         ///                                                                                                                  
  2452.         ///  public static void LogInfo(string info)                                                                        
  2453.         ///                                                                                                                  
  2454.         ///-=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=-  
  2455.         /// <summary>                                                                                                                              
  2456.         /// Log Information                                                                                                                        
  2457.         /// </summary>                                                                                                                            
  2458.         public static void LogInfo(string info)  
  2459.         {  
  2460.             EventLog Log = new EventLog("Hydra",".", "Hydra");  
  2461.             if (!EventLog.SourceExists("MSFT_NetFirewallRule"))    
  2462.             {      
  2463.                 EventLog.CreateEventSource("MSFT_NetFirewallRule", "Hydra");  
  2464.             }      
  2465.             Log.Source = "MSFT_NetFirewallRule";  
  2466.             Log.WriteEntry(info, EventLogEntryType.Information, 420 );  
  2467.         }  
  2468.  
  2469.         #endregion  
  2470.  
  2471.  
  2472.         #region LogInfo(string info, int evt_id)  
  2473.  
  2474.  
  2475.         ///-=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=-  
  2476.         ///                                                                                                                  
  2477.         ///  public static void LogInfo(string info, int evt_id)                                                            
  2478.         ///                                                                                                                  
  2479.         ///-=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=--=<oo>=-  
  2480.         /// <summary>                                                                                                                              
  2481.         /// Log Information                                                                                                                        
  2482.         /// </summary>                                                                                                                            
  2483.         public static void LogInfo(string info, int evt_id)  
  2484.         {  
  2485.             EventLog Log = new EventLog("Hydra",".", "Hydra");  
  2486.             if (!EventLog.SourceExists("MSFT_NetFirewallRule"))    
  2487.             {      
  2488.                 EventLog.CreateEventSource("MSFT_NetFirewallRule", "Hydra");  
  2489.             }      
  2490.             Log.Source = "MSFT_NetFirewallRule";  
  2491.             Log.WriteEntry(info, EventLogEntryType.Information, evt_id );  
  2492.         }  
  2493.  
  2494.         #endregion  
  2495.  
  2496.  
  2497.         #region Database Helper Methods  
  2498.         ///====================================================================================================  
  2499.         ///                                                                                                      
  2500.         ///  public void InsertIntoDatabase(string  DatabaseConnectionString )                                  
  2501.         ///                                                                                                      
  2502.         ///====================================================================================================  
  2503.         ///<summary>  
  2504.         /// insert this "MSFT_NetFirewallRule" into the database  
  2505.         ///</summary>  
  2506.         public void InsertIntoDatabase(string  DatabaseConnectionString )  
  2507.         {  
  2508.         System.Data.SqlClient.SqlParameter[] p = new SqlParameter[38];  
  2509.         p[0] = new SqlParameter("@HostName", SqlDbType.NVarChar, 255);    
  2510.         try    
  2511.         {      
  2512.             p[0].Value = this.HostName;    
  2513.         }      
  2514.         catch(Exception exp)    
  2515.         {    
  2516.             LogError(exp);    
  2517.         }    
  2518.         p[1] = new SqlParameter("@KnownHostID", SqlDbType.BigInt);    
  2519.         if(this.KnownHostID == -9 )  
  2520.         { throw new ApplicationException("Known Host ID was not set when trying to insert into the database");  }  
  2521.         try    
  2522.         {      
  2523.             p[1].Value = this.KnownHostID;    
  2524.         }      
  2525.         catch(Exception exp)    
  2526.         {    
  2527.             LogError(exp);    
  2528.         }    
  2529.         p[2] = new SqlParameter("@Action", SqlDbType.BigInt);    
  2530.         try    
  2531.         {      
  2532.             p[2].Value = Convert.ToInt64(this.varAction);    
  2533.         }      
  2534.         catch(Exception exp)    
  2535.         {    
  2536.             LogError(exp);    
  2537.             p[2].Value = 0;    
  2538.         }    
  2539.         p[3] = new SqlParameter("@Caption", SqlDbType.NVarChar, 255 );    
  2540.         try    
  2541.         {      
  2542.             p[3].Value =  this.varCaption;    
  2543.         }      
  2544.         catch(Exception exp)    
  2545.         {    
  2546.             LogError(exp);    
  2547.             p[3].Value =  "";    
  2548.         }    
  2549.         p[4] = new SqlParameter("@CommonName", SqlDbType.NVarChar, 255 );    
  2550.         try    
  2551.         {      
  2552.             p[4].Value =  this.varCommonName;    
  2553.         }      
  2554.         catch(Exception exp)    
  2555.         {    
  2556.             LogError(exp);    
  2557.             p[4].Value =  "";    
  2558.         }    
  2559.         p[5] = new SqlParameter("@ConditionListType", SqlDbType.BigInt);    
  2560.         try    
  2561.         {      
  2562.             p[5].Value = Convert.ToInt64(this.varConditionListType);    
  2563.         }      
  2564.         catch(Exception exp)    
  2565.         {    
  2566.             LogError(exp);    
  2567.             p[5].Value = 0;    
  2568.         }    
  2569.         p[6] = new SqlParameter("@CreationClassName", SqlDbType.NVarChar, 255 );    
  2570.         try    
  2571.         {      
  2572.             p[6].Value =  this.varCreationClassName;    
  2573.         }      
  2574.         catch(Exception exp)    
  2575.         {    
  2576.             LogError(exp);    
  2577.             p[6].Value =  "";    
  2578.         }    
  2579.         p[7] = new SqlParameter("@Description", SqlDbType.NVarChar, 255 );    
  2580.         try    
  2581.         {      
  2582.             p[7].Value =  this.varDescription;    
  2583.         }      
  2584.         catch(Exception exp)    
  2585.         {    
  2586.             LogError(exp);    
  2587.             p[7].Value =  "";    
  2588.         }    
  2589.         p[8] = new SqlParameter("@Direction", SqlDbType.BigInt);    
  2590.         try    
  2591.         {      
  2592.             p[8].Value = Convert.ToInt64(this.varDirection);    
  2593.         }      
  2594.         catch(Exception exp)    
  2595.         {    
  2596.             LogError(exp);    
  2597.             p[8].Value = 0;    
  2598.         }    
  2599.         p[9] = new SqlParameter("@DisplayGroup", SqlDbType.NVarChar, 255 );    
  2600.         try    
  2601.         {      
  2602.             p[9].Value =  this.varDisplayGroup;    
  2603.         }      
  2604.         catch(Exception exp)    
  2605.         {    
  2606.             LogError(exp);    
  2607.             p[9].Value =  "";    
  2608.         }    
  2609.         p[10] = new SqlParameter("@DisplayName", SqlDbType.NVarChar, 255 );    
  2610.         try    
  2611.         {      
  2612.             p[10].Value =  this.varDisplayName;    
  2613.         }      
  2614.         catch(Exception exp)    
  2615.         {    
  2616.             LogError(exp);    
  2617.             p[10].Value =  "";    
  2618.         }    
  2619.         p[11] = new SqlParameter("@EdgeTraversalPolicy", SqlDbType.BigInt);    
  2620.         try    
  2621.         {      
  2622.             p[11].Value = Convert.ToInt64(this.varEdgeTraversalPolicy);    
  2623.         }      
  2624.         catch(Exception exp)    
  2625.         {    
  2626.             LogError(exp);    
  2627.             p[11].Value = 0;    
  2628.         }    
  2629.         p[12] = new SqlParameter("@ElementName", SqlDbType.NVarChar, 255 );    
  2630.         try    
  2631.         {      
  2632.             p[12].Value =  this.varElementName;    
  2633.         }      
  2634.         catch(Exception exp)    
  2635.         {    
  2636.             LogError(exp);    
  2637.             p[12].Value =  "";    
  2638.         }    
  2639.         p[13] = new SqlParameter("@Enabled", SqlDbType.BigInt);    
  2640.         try    
  2641.         {      
  2642.             p[13].Value = Convert.ToInt64(this.varEnabled);    
  2643.         }      
  2644.         catch(Exception exp)    
  2645.         {    
  2646.             LogError(exp);    
  2647.             p[13].Value = 0;    
  2648.         }    
  2649.         p[14] = new SqlParameter("@EnforcementStatus", SqlDbType.NVarChar, 255 );    
  2650.         try    
  2651.         {      
  2652.             p[14].Value = ConvertType.MakeStorableArrayFromManagementBaseObject( this.varEnforcementStatus ) ;      
  2653.         }      
  2654.         catch(Exception exp)    
  2655.         {    
  2656.             LogError(exp);    
  2657.             p[14].Value =  "";    
  2658.         }    
  2659.         p[15] = new SqlParameter("@ExecutionStrategy", SqlDbType.BigInt);    
  2660.         try    
  2661.         {      
  2662.             p[15].Value = Convert.ToInt64(this.varExecutionStrategy);    
  2663.         }      
  2664.         catch(Exception exp)    
  2665.         {    
  2666.             LogError(exp);    
  2667.             p[15].Value = 0;    
  2668.         }    
  2669.         p[16] = new SqlParameter("@InstanceID", SqlDbType.NVarChar, 255 );    
  2670.         try    
  2671.         {      
  2672.             p[16].Value =  this.varInstanceID;    
  2673.         }      
  2674.         catch(Exception exp)    
  2675.         {    
  2676.             LogError(exp);    
  2677.             p[16].Value =  "";    
  2678.         }    
  2679.         p[17] = new SqlParameter("@LocalOnlyMapping", SqlDbType.Bit);    
  2680.         try    
  2681.         {      
  2682.             if(Convert.ToBoolean(this.varLocalOnlyMapping) == true)    
  2683.             {      
  2684.                 p[17].Value = 1;    
  2685.             }      
  2686.             else    
  2687.             {    
  2688.                 p[17].Value = 0;    
  2689.             }    
  2690.         }    
  2691.         catch(Exception exp)    
  2692.         {    
  2693.             LogError(exp);    
  2694.                 p[17].Value = 0;    
  2695.         }    
  2696.         p[18] = new SqlParameter("@LooseSourceMapping", SqlDbType.Bit);    
  2697.         try    
  2698.         {      
  2699.             if(Convert.ToBoolean(this.varLooseSourceMapping) == true)    
  2700.             {      
  2701.                 p[18].Value = 1;    
  2702.             }      
  2703.             else    
  2704.             {    
  2705.                 p[18].Value = 0;    
  2706.             }    
  2707.         }    
  2708.         catch(Exception exp)    
  2709.         {    
  2710.             LogError(exp);    
  2711.                 p[18].Value = 0;    
  2712.         }    
  2713.         p[19] = new SqlParameter("@Mandatory", SqlDbType.Bit);    
  2714.         try    
  2715.         {      
  2716.             if(Convert.ToBoolean(this.varMandatory) == true)    
  2717.             {      
  2718.                 p[19].Value = 1;    
  2719.             }      
  2720.             else    
  2721.             {    
  2722.                 p[19].Value = 0;    
  2723.             }    
  2724.         }    
  2725.         catch(Exception exp)    
  2726.         {    
  2727.             LogError(exp);    
  2728.                 p[19].Value = 0;    
  2729.         }    
  2730.         p[20] = new SqlParameter("@Owner", SqlDbType.NVarChar, 255 );    
  2731.         try    
  2732.         {      
  2733.             p[20].Value =  this.varOwner;    
  2734.         }      
  2735.         catch(Exception exp)    
  2736.         {    
  2737.             LogError(exp);    
  2738.             p[20].Value =  "";    
  2739.         }    
  2740.         p[21] = new SqlParameter("@Platforms", SqlDbType.NVarChar, 255 );    
  2741.         try    
  2742.         {      
  2743.             p[21].Value = ConvertType.MakeStorableArrayFromManagementBaseObject( this.varPlatforms ) ;      
  2744.         }      
  2745.         catch(Exception exp)    
  2746.         {    
  2747.             LogError(exp);    
  2748.             p[21].Value =  "";    
  2749.         }    
  2750.         p[22] = new SqlParameter("@PolicyDecisionStrategy", SqlDbType.BigInt);    
  2751.         try    
  2752.         {      
  2753.             p[22].Value = Convert.ToInt64(this.varPolicyDecisionStrategy);    
  2754.         }      
  2755.         catch(Exception exp)    
  2756.         {    
  2757.             LogError(exp);    
  2758.             p[22].Value = 0;    
  2759.         }    
  2760.         p[23] = new SqlParameter("@PolicyKeywords", SqlDbType.NVarChar, 255 );    
  2761.         try    
  2762.         {      
  2763.             p[23].Value = ConvertType.MakeStorableArrayFromManagementBaseObject( this.varPolicyKeywords ) ;      
  2764.         }      
  2765.         catch(Exception exp)    
  2766.         {    
  2767.             LogError(exp);    
  2768.             p[23].Value =  "";    
  2769.         }    
  2770.         p[24] = new SqlParameter("@PolicyRoles", SqlDbType.NVarChar, 255 );    
  2771.         try    
  2772.         {      
  2773.             p[24].Value = ConvertType.MakeStorableArrayFromManagementBaseObject( this.varPolicyRoles ) ;      
  2774.         }      
  2775.         catch(Exception exp)    
  2776.         {    
  2777.             LogError(exp);    
  2778.             p[24].Value =  "";    
  2779.         }    
  2780.         p[25] = new SqlParameter("@PolicyRuleName", SqlDbType.NVarChar, 255 );    
  2781.         try    
  2782.         {      
  2783.             p[25].Value =  this.varPolicyRuleName;    
  2784.         }      
  2785.         catch(Exception exp)    
  2786.         {    
  2787.             LogError(exp);    
  2788.             p[25].Value =  "";    
  2789.         }    
  2790.         p[26] = new SqlParameter("@PolicyStoreSource", SqlDbType.NVarChar, 255 );    
  2791.         try    
  2792.         {      
  2793.             p[26].Value =  this.varPolicyStoreSource;    
  2794.         }      
  2795.         catch(Exception exp)    
  2796.         {    
  2797.             LogError(exp);    
  2798.             p[26].Value =  "";    
  2799.         }    
  2800.         p[27] = new SqlParameter("@PolicyStoreSourceType", SqlDbType.BigInt);    
  2801.         try    
  2802.         {      
  2803.             p[27].Value = Convert.ToInt64(this.varPolicyStoreSourceType);    
  2804.         }      
  2805.         catch(Exception exp)    
  2806.         {    
  2807.             LogError(exp);    
  2808.             p[27].Value = 0;    
  2809.         }    
  2810.         p[28] = new SqlParameter("@PrimaryStatus", SqlDbType.BigInt);    
  2811.         try    
  2812.         {      
  2813.             p[28].Value = Convert.ToInt64(this.varPrimaryStatus);    
  2814.         }      
  2815.         catch(Exception exp)    
  2816.         {    
  2817.             LogError(exp);    
  2818.             p[28].Value = 0;    
  2819.         }    
  2820.         p[29] = new SqlParameter("@Priority", SqlDbType.BigInt);    
  2821.         try    
  2822.         {      
  2823.             p[29].Value = Convert.ToInt64(this.varPriority);    
  2824.         }      
  2825.         catch(Exception exp)    
  2826.         {    
  2827.             LogError(exp);    
  2828.             p[29].Value = 0;    
  2829.         }    
  2830.         p[30] = new SqlParameter("@Profiles", SqlDbType.BigInt);    
  2831.         try    
  2832.         {      
  2833.             p[30].Value = Convert.ToInt64(this.varProfiles);    
  2834.         }      
  2835.         catch(Exception exp)    
  2836.         {    
  2837.             LogError(exp);    
  2838.             p[30].Value = 0;    
  2839.         }    
  2840.         p[31] = new SqlParameter("@RuleGroup", SqlDbType.NVarChar, 255 );    
  2841.         try    
  2842.         {      
  2843.             p[31].Value =  this.varRuleGroup;    
  2844.         }      
  2845.         catch(Exception exp)    
  2846.         {    
  2847.             LogError(exp);    
  2848.             p[31].Value =  "";    
  2849.         }    
  2850.         p[32] = new SqlParameter("@RuleUsage", SqlDbType.NVarChar, 255 );    
  2851.         try    
  2852.         {      
  2853.             p[32].Value =  this.varRuleUsage;    
  2854.         }      
  2855.         catch(Exception exp)    
  2856.         {    
  2857.             LogError(exp);    
  2858.             p[32].Value =  "";    
  2859.         }    
  2860.         p[33] = new SqlParameter("@SequencedActions", SqlDbType.BigInt);    
  2861.         try    
  2862.         {      
  2863.             p[33].Value = Convert.ToInt64(this.varSequencedActions);    
  2864.         }      
  2865.         catch(Exception exp)    
  2866.         {    
  2867.             LogError(exp);    
  2868.             p[33].Value = 0;    
  2869.         }    
  2870.         p[34] = new SqlParameter("@Status", SqlDbType.NVarChar, 255 );    
  2871.         try    
  2872.         {      
  2873.             p[34].Value =  this.varStatus;    
  2874.         }      
  2875.         catch(Exception exp)    
  2876.         {    
  2877.             LogError(exp);    
  2878.             p[34].Value =  "";    
  2879.         }    
  2880.         p[35] = new SqlParameter("@StatusCode", SqlDbType.BigInt);    
  2881.         try    
  2882.         {      
  2883.             p[35].Value = Convert.ToInt64(this.varStatusCode);    
  2884.         }      
  2885.         catch(Exception exp)    
  2886.         {    
  2887.             LogError(exp);    
  2888.             p[35].Value = 0;    
  2889.         }    
  2890.         p[36] = new SqlParameter("@SystemCreationClassName", SqlDbType.NVarChar, 255 );    
  2891.         try    
  2892.         {      
  2893.             p[36].Value =  this.varSystemCreationClassName;    
  2894.         }      
  2895.         catch(Exception exp)    
  2896.         {    
  2897.             LogError(exp);    
  2898.             p[36].Value =  "";    
  2899.         }    
  2900.         p[37] = new SqlParameter("@SystemName", SqlDbType.NVarChar, 255 );    
  2901.         try    
  2902.         {      
  2903.             p[37].Value =  this.varSystemName;    
  2904.         }      
  2905.         catch(Exception exp)    
  2906.         {    
  2907.             LogError(exp);    
  2908.             p[37].Value =  "";    
  2909.         }    
  2910.         if(!Data.HydraDatabase.DatabaseIsOnline())  
  2911.         {  
  2912.             Logging.LogWarning("Hydra Database is Offline!!!", 911);  
  2913.         }  
  2914.         else  
  2915.         {  
  2916.             Data.SqlHelper.ExecuteNonQuery( DatabaseConnectionString , CommandType.StoredProcedure,"MSFT_NetFirewallRule_INSERT", p);  
  2917.         }  
  2918.     }  
  2919.  
  2920.  
  2921.  
  2922.         ///====================================================================================================  
  2923.         ///                                                                                                      
  2924.         ///    public void UpdateToDatabase( string DatabaseConnectionString )                                  
  2925.         ///                                                                                                      
  2926.         ///====================================================================================================  
  2927.         ///<summary>  
  2928.         /// update this instance in the database  
  2929.         ///</summary>  
  2930.         public void UpdateToDatabase( string DatabaseConnectionString )  
  2931.         {  
  2932.         System.Data.SqlClient.SqlParameter[] p = new SqlParameter[38];  
  2933.         p[0] = new SqlParameter("@HydraID", SqlDbType.BigInt);  
  2934.         p[0].Value = this.HydraID;  
  2935.         p[1] = new SqlParameter("@HostName", SqlDbType.NVarChar, 255);  
  2936.         p[1].Value = this.HostName;  
  2937.         p[2] = new SqlParameter("@Action", SqlDbType.BigInt);    
  2938.         try    
  2939.         {      
  2940.             p[2].Value = Convert.ToInt64(this.varAction);    
  2941.         }      
  2942.         catch(Exception exp)    
  2943.         {    
  2944.             LogError(exp);    
  2945.         }    
  2946.  
  2947.         p[3] = new SqlParameter("@Caption", SqlDbType.NVarChar, 255 );    
  2948.         try    
  2949.         {      
  2950.             p[3].Value = this.varCaption;    
  2951.         }      
  2952.         catch(Exception exp)    
  2953.         {    
  2954.             LogError(exp);    
  2955.         }    
  2956.  
  2957.         p[4] = new SqlParameter("@CommonName", SqlDbType.NVarChar, 255 );    
  2958.         try    
  2959.         {      
  2960.             p[4].Value = this.varCommonName;    
  2961.         }      
  2962.         catch(Exception exp)    
  2963.         {    
  2964.             LogError(exp);    
  2965.         }    
  2966.  
  2967.         p[5] = new SqlParameter("@ConditionListType", SqlDbType.BigInt);    
  2968.         try    
  2969.         {      
  2970.             p[5].Value = Convert.ToInt64(this.varConditionListType);    
  2971.         }      
  2972.         catch(Exception exp)    
  2973.         {    
  2974.             LogError(exp);    
  2975.         }    
  2976.  
  2977.         p[6] = new SqlParameter("@CreationClassName", SqlDbType.NVarChar, 255 );    
  2978.         try    
  2979.         {      
  2980.             p[6].Value = this.varCreationClassName;    
  2981.         }      
  2982.         catch(Exception exp)    
  2983.         {    
  2984.             LogError(exp);    
  2985.         }    
  2986.  
  2987.         p[7] = new SqlParameter("@Description", SqlDbType.NVarChar, 255 );    
  2988.         try    
  2989.         {      
  2990.             p[7].Value = this.varDescription;    
  2991.         }      
  2992.         catch(Exception exp)    
  2993.         {    
  2994.             LogError(exp);    
  2995.         }    
  2996.  
  2997.         p[8] = new SqlParameter("@Direction", SqlDbType.BigInt);    
  2998.         try    
  2999.         {      
  3000.             p[8].Value = Convert.ToInt64(this.varDirection);    
  3001.         }      
  3002.         catch(Exception exp)    
  3003.         {    
  3004.             LogError(exp);    
  3005.         }    
  3006.  
  3007.         p[9] = new SqlParameter("@DisplayGroup", SqlDbType.NVarChar, 255 );    
  3008.         try    
  3009.         {      
  3010.             p[9].Value = this.varDisplayGroup;    
  3011.         }      
  3012.         catch(Exception exp)    
  3013.         {    
  3014.             LogError(exp);    
  3015.         }    
  3016.  
  3017.         p[10] = new SqlParameter("@DisplayName", SqlDbType.NVarChar, 255 );    
  3018.         try    
  3019.         {      
  3020.             p[10].Value = this.varDisplayName;    
  3021.         }      
  3022.         catch(Exception exp)    
  3023.         {    
  3024.             LogError(exp);    
  3025.         }    
  3026.  
  3027.         p[11] = new SqlParameter("@EdgeTraversalPolicy", SqlDbType.BigInt);    
  3028.         try    
  3029.         {      
  3030.             p[11].Value = Convert.ToInt64(this.varEdgeTraversalPolicy);    
  3031.         }      
  3032.         catch(Exception exp)    
  3033.         {    
  3034.             LogError(exp);    
  3035.         }    
  3036.  
  3037.         p[12] = new SqlParameter("@ElementName", SqlDbType.NVarChar, 255 );    
  3038.         try    
  3039.         {      
  3040.             p[12].Value = this.varElementName;    
  3041.         }      
  3042.         catch(Exception exp)    
  3043.         {    
  3044.             LogError(exp);    
  3045.         }    
  3046.  
  3047.         p[13] = new SqlParameter("@Enabled", SqlDbType.BigInt);    
  3048.         try    
  3049.         {      
  3050.             p[13].Value = Convert.ToInt64(this.varEnabled);    
  3051.         }      
  3052.         catch(Exception exp)    
  3053.         {    
  3054.             LogError(exp);    
  3055.         }    
  3056.  
  3057.         p[14] = new SqlParameter("@EnforcementStatus", SqlDbType.NVarChar, 255 );    
  3058.         try    
  3059.         {      
  3060.             p[14].Value = this.varEnforcementStatus;    
  3061.         }      
  3062.         catch(Exception exp)    
  3063.         {    
  3064.             LogError(exp);    
  3065.         }    
  3066.  
  3067.         p[15] = new SqlParameter("@ExecutionStrategy", SqlDbType.BigInt);    
  3068.         try    
  3069.         {      
  3070.             p[15].Value = Convert.ToInt64(this.varExecutionStrategy);    
  3071.         }      
  3072.         catch(Exception exp)    
  3073.         {    
  3074.             LogError(exp);    
  3075.         }    
  3076.  
  3077.         p[16] = new SqlParameter("@InstanceID", SqlDbType.NVarChar, 255 );    
  3078.         try    
  3079.         {      
  3080.             p[16].Value = this.varInstanceID;    
  3081.         }      
  3082.         catch(Exception exp)    
  3083.         {    
  3084.             LogError(exp);    
  3085.         }    
  3086.  
  3087.         p[17] = new SqlParameter("@LocalOnlyMapping", SqlDbType.Bit);    
  3088.         try    
  3089.         {      
  3090.             if(Convert.ToBoolean(this.varLocalOnlyMapping) == true)    
  3091.             {      
  3092.                 p[17].Value = 1;    
  3093.             }      
  3094.             else    
  3095.             {    
  3096.                 p[17].Value = 0;    
  3097.             }    
  3098.         }    
  3099.         catch(Exception exp)    
  3100.         {    
  3101.             LogError(exp);    
  3102.         }    
  3103.  
  3104.         p[18] = new SqlParameter("@LooseSourceMapping", SqlDbType.Bit);    
  3105.         try    
  3106.         {      
  3107.             if(Convert.ToBoolean(this.varLooseSourceMapping) == true)    
  3108.             {      
  3109.                 p[18].Value = 1;    
  3110.             }      
  3111.             else    
  3112.             {    
  3113.                 p[18].Value = 0;    
  3114.             }    
  3115.         }    
  3116.         catch(Exception exp)    
  3117.         {    
  3118.             LogError(exp);    
  3119.         }    
  3120.  
  3121.         p[19] = new SqlParameter("@Mandatory", SqlDbType.Bit);    
  3122.         try    
  3123.         {      
  3124.             if(Convert.ToBoolean(this.varMandatory) == true)    
  3125.             {      
  3126.                 p[19].Value = 1;    
  3127.             }      
  3128.             else    
  3129.             {    
  3130.                 p[19].Value = 0;    
  3131.             }    
  3132.         }    
  3133.         catch(Exception exp)    
  3134.         {    
  3135.             LogError(exp);    
  3136.         }    
  3137.  
  3138.         p[20] = new SqlParameter("@Owner", SqlDbType.NVarChar, 255 );    
  3139.         try    
  3140.         {      
  3141.             p[20].Value = this.varOwner;    
  3142.         }      
  3143.         catch(Exception exp)    
  3144.         {    
  3145.             LogError(exp);    
  3146.         }    
  3147.  
  3148.         p[21] = new SqlParameter("@Platforms", SqlDbType.NVarChar, 255 );    
  3149.         try    
  3150.         {      
  3151.             p[21].Value = this.varPlatforms;    
  3152.         }      
  3153.         catch(Exception exp)    
  3154.         {    
  3155.             LogError(exp);    
  3156.         }    
  3157.  
  3158.         p[22] = new SqlParameter("@PolicyDecisionStrategy", SqlDbType.BigInt);    
  3159.         try    
  3160.         {      
  3161.             p[22].Value = Convert.ToInt64(this.varPolicyDecisionStrategy);    
  3162.         }      
  3163.         catch(Exception exp)    
  3164.         {    
  3165.             LogError(exp);    
  3166.         }    
  3167.  
  3168.         p[23] = new SqlParameter("@PolicyKeywords", SqlDbType.NVarChar, 255 );    
  3169.         try    
  3170.         {      
  3171.             p[23].Value = this.varPolicyKeywords;    
  3172.         }      
  3173.         catch(Exception exp)    
  3174.         {    
  3175.             LogError(exp);    
  3176.         }    
  3177.  
  3178.         p[24] = new SqlParameter("@PolicyRoles", SqlDbType.NVarChar, 255 );    
  3179.         try    
  3180.         {      
  3181.             p[24].Value = this.varPolicyRoles;    
  3182.         }      
  3183.         catch(Exception exp)    
  3184.         {    
  3185.             LogError(exp);    
  3186.         }    
  3187.  
  3188.         p[25] = new SqlParameter("@PolicyRuleName", SqlDbType.NVarChar, 255 );    
  3189.         try    
  3190.         {      
  3191.             p[25].Value = this.varPolicyRuleName;    
  3192.         }      
  3193.         catch(Exception exp)    
  3194.         {    
  3195.             LogError(exp);    
  3196.         }    
  3197.  
  3198.         p[26] = new SqlParameter("@PolicyStoreSource", SqlDbType.NVarChar, 255 );    
  3199.         try    
  3200.         {      
  3201.             p[26].Value = this.varPolicyStoreSource;    
  3202.         }      
  3203.         catch(Exception exp)    
  3204.         {    
  3205.             LogError(exp);    
  3206.         }    
  3207.  
  3208.         p[27] = new SqlParameter("@PolicyStoreSourceType", SqlDbType.BigInt);    
  3209.         try    
  3210.         {      
  3211.             p[27].Value = Convert.ToInt64(this.varPolicyStoreSourceType);    
  3212.         }      
  3213.         catch(Exception exp)    
  3214.         {    
  3215.             LogError(exp);    
  3216.         }    
  3217.  
  3218.         p[28] = new SqlParameter("@PrimaryStatus", SqlDbType.BigInt);    
  3219.         try    
  3220.         {      
  3221.             p[28].Value = Convert.ToInt64(this.varPrimaryStatus);    
  3222.         }      
  3223.         catch(Exception exp)    
  3224.         {    
  3225.             LogError(exp);    
  3226.         }    
  3227.  
  3228.         p[29] = new SqlParameter("@Priority", SqlDbType.BigInt);    
  3229.         try    
  3230.         {      
  3231.             p[29].Value = Convert.ToInt64(this.varPriority);    
  3232.         }      
  3233.         catch(Exception exp)    
  3234.         {    
  3235.             LogError(exp);    
  3236.         }    
  3237.  
  3238.         p[30] = new SqlParameter("@Profiles", SqlDbType.BigInt);    
  3239.         try    
  3240.         {      
  3241.             p[30].Value = Convert.ToInt64(this.varProfiles);    
  3242.         }      
  3243.         catch(Exception exp)    
  3244.         {    
  3245.             LogError(exp);    
  3246.         }    
  3247.  
  3248.         p[31] = new SqlParameter("@RuleGroup", SqlDbType.NVarChar, 255 );    
  3249.         try    
  3250.         {      
  3251.             p[31].Value = this.varRuleGroup;    
  3252.         }      
  3253.         catch(Exception exp)    
  3254.         {    
  3255.             LogError(exp);    
  3256.         }    
  3257.  
  3258.         p[32] = new SqlParameter("@RuleUsage", SqlDbType.NVarChar, 255 );    
  3259.         try    
  3260.         {      
  3261.             p[32].Value = this.varRuleUsage;    
  3262.         }      
  3263.         catch(Exception exp)    
  3264.         {    
  3265.             LogError(exp);    
  3266.         }    
  3267.  
  3268.         p[33] = new SqlParameter("@SequencedActions", SqlDbType.BigInt);    
  3269.         try    
  3270.         {      
  3271.             p[33].Value = Convert.ToInt64(this.varSequencedActions);    
  3272.         }      
  3273.         catch(Exception exp)    
  3274.         {    
  3275.             LogError(exp);    
  3276.         }    
  3277.  
  3278.         p[34] = new SqlParameter("@Status", SqlDbType.NVarChar, 255 );    
  3279.         try    
  3280.         {      
  3281.             p[34].Value = this.varStatus;    
  3282.         }      
  3283.         catch(Exception exp)    
  3284.         {    
  3285.             LogError(exp);    
  3286.         }    
  3287.  
  3288.         p[35] = new SqlParameter("@StatusCode", SqlDbType.BigInt);    
  3289.         try    
  3290.         {      
  3291.             p[35].Value = Convert.ToInt64(this.varStatusCode);    
  3292.         }      
  3293.         catch(Exception exp)    
  3294.         {    
  3295.             LogError(exp);    
  3296.         }    
  3297.  
  3298.         p[36] = new SqlParameter("@SystemCreationClassName", SqlDbType.NVarChar, 255 );    
  3299.         try    
  3300.         {      
  3301.             p[36].Value = this.varSystemCreationClassName;    
  3302.         }      
  3303.         catch(Exception exp)    
  3304.         {    
  3305.             LogError(exp);    
  3306.         }    
  3307.  
  3308.         p[37] = new SqlParameter("@SystemName", SqlDbType.NVarChar, 255 );    
  3309.         try    
  3310.         {      
  3311.             p[37].Value = this.varSystemName;    
  3312.         }      
  3313.         catch(Exception exp)    
  3314.         {    
  3315.             LogError(exp);    
  3316.         }    
  3317.  
  3318.  
  3319.        Hydra.Data.SqlHelper.ExecuteNonQuery( DatabaseConnectionString , CommandType.StoredProcedure, "MSFT_NetFirewallRule_UPDATE", p);  
  3320.  
  3321.         }  
  3322.  
  3323.  
  3324.  
  3325.         ///====================================================================================================  
  3326.         ///                                                                                                      
  3327.         ///     public static void DELETE_BY_HYDRA_ID( string DatabaseConnectionString, Int64 HydraID )        
  3328.         ///                                                                                                      
  3329.         ///====================================================================================================  
  3330.         ///<summary>  
  3331.         /// Delete this instance from the database  
  3332.         ///</summary>  
  3333.         public static void DELETE_BY_HYDRA_ID( string DatabaseConnectionString, Int64 HydraID )  
  3334.         {  
  3335.             SqlParameter[] p = new SqlParameter[1];  
  3336.             p[0] = new SqlParameter("@HydraID", SqlDbType.BigInt);  
  3337.             try    
  3338.             {      
  3339.                 p[0].Value = HydraID;    
  3340.             }      
  3341.             catch(Exception exp)    
  3342.             {    
  3343.                 LogError(exp);    
  3344.             }    
  3345.             try    
  3346.             {      
  3347.                Hydra.Data.SqlHelper.ExecuteNonQuery( DatabaseConnectionString , CommandType.StoredProcedure,"MSFT_NETFIREWALLRULE_DELETE_BY_HYDRA_ID", p);  
  3348.             }      
  3349.             catch(Exception exp)    
  3350.             {    
  3351.                 LogError(exp);    
  3352.             }    
  3353.         }  
  3354.          
  3355.          
  3356.  
  3357.  
  3358.         ///====================================================================================================  
  3359.         ///                                                                                                      
  3360.         ///     public static void MSFT_NetFirewallRule_DELETE_BY_KNOWN_HOST_ID( double HostID, string DatabaseConnectionString )        
  3361.         ///                                                                                                      
  3362.         ///====================================================================================================  
  3363.         ///<summary>  
  3364.         /// Delete this instance from the database  
  3365.         ///</summary>  
  3366.         public static void MSFT_NetFirewallRule_DELETE_BY_KNOWN_HOST_ID( double HostID, string DatabaseConnectionString )  
  3367.         {  
  3368.             SqlParameter[] p = new SqlParameter[1];  
  3369.             p[0] = new SqlParameter("@KnownHostID", SqlDbType.BigInt);  
  3370.             try    
  3371.             {      
  3372.                 p[0].Value = HostID;    
  3373.             }      
  3374.             catch(Exception exp)    
  3375.             {    
  3376.                 LogError(exp);    
  3377.             }    
  3378.             try    
  3379.             {      
  3380.                Data.SqlHelper.ExecuteNonQuery( DatabaseConnectionString , CommandType.StoredProcedure,"MSFT_NetFirewallRule_DELETE_BY_KNOWN_HOST_ID", p);  
  3381.             }      
  3382.             catch(Exception exp)    
  3383.             {    
  3384.                 LogError(exp);    
  3385.             }    
  3386.         }  
  3387.          
  3388.          
  3389.  
  3390.  
  3391.         ///====================================================================================================  
  3392.         ///                                                                                                      
  3393.         ///   public static void Delete_From_Database_By_HostName( string DatabaseConnectionString, string HostName )  
  3394.         ///                                                                                                      
  3395.         ///====================================================================================================  
  3396.         ///<summary>  
  3397.         /// Delete this instance from the database  
  3398.         ///</summary>  
  3399.         public static void Delete_From_Database_By_HostName( string DatabaseConnectionString, string HostName )  
  3400.         {  
  3401.             SqlParameter[] p = new SqlParameter[1];  
  3402.             p[0] = new SqlParameter("@HostName", SqlDbType.NVarChar, 255);  
  3403.             try    
  3404.             {    
  3405.                 p[0].Value = HostName;    
  3406.             }    
  3407.             catch(Exception exp)    
  3408.             {    
  3409.                 LogError(exp);    
  3410.             }    
  3411.             try    
  3412.             {    
  3413.                Hydra.Data.SqlHelper.ExecuteNonQuery( DatabaseConnectionString , CommandType.StoredProcedure,"MSFT_NETFIREWALLRULE_DELETE_BY_HOSTNAME", p);  
  3414.             }    
  3415.             catch(Exception exp)    
  3416.             {    
  3417.                 LogError(exp);    
  3418.             }    
  3419.         }  
  3420.  
  3421.  
  3422.  
  3423.         ///====================================================================================================  
  3424.         ///                                                                                                      
  3425.         ///     public static void DELETE_ALL( string DatabaseConnectionString )        
  3426.         ///                                                                                                      
  3427.         ///====================================================================================================  
  3428.         ///<summary>  
  3429.         /// Delete this instance from the database  
  3430.         ///</summary>  
  3431.         public static void DELETE_ALL_FROM_DATABASE( string DatabaseConnectionString )  
  3432.         {  
  3433.             try    
  3434.             {      
  3435.                Hydra.Data.SqlHelper.ExecuteNonQuery( DatabaseConnectionString , CommandType.StoredProcedure,"MSFT_NETFIREWALLRULE_DELETE_ALL");  
  3436.             }      
  3437.             catch(Exception exp)    
  3438.             {    
  3439.                 LogError(exp);    
  3440.             }    
  3441.         }  
  3442.          
  3443.          
  3444.  
  3445.  
  3446.         ///====================================================================================================  
  3447.         ///                                                                                                      
  3448.         ///    public static DataSet Get_DataSet_By_HydraID( int HydraID, string DatabaseConnectionString )            
  3449.         ///                                                                                                      
  3450.         ///====================================================================================================  
  3451.         ///<summary>  
  3452.         /// Get a DataSet representing this instance from the database  
  3453.         ///</summary>  
  3454.         public static DataSet Get_DataSet_By_Hydra_ID(int HydraID, string  DatabaseConnectionString )  
  3455.         {  
  3456.             DataSet ds = new DataSet();  
  3457.             SqlParameter[] p = new SqlParameter[1];  
  3458.             p[0] = new SqlParameter("@HydraID", SqlDbType.BigInt);  
  3459.             try    
  3460.             {      
  3461.                 p[0].Value = HydraID;  
  3462.             }      
  3463.             catch(Exception exp)    
  3464.             {    
  3465.                 LogError(exp);    
  3466.             }    
  3467.             try    
  3468.             {      
  3469.                 ds =Hydra.Data.SqlHelper.ExecuteDataset( DatabaseConnectionString , CommandType.StoredProcedure,"MSFT_NETFIREWALLRULE_SELECTBYID", p);  
  3470.             }    
  3471.             catch(Exception exp)    
  3472.             {    
  3473.                 LogError(exp);    
  3474.             }    
  3475.             return ds;    
  3476.         }  
  3477.          
  3478.          
  3479.  
  3480.  
  3481.        ///====================================================================================================  
  3482.        ///                                                                                                      
  3483.        ///    public static DataSet Get_DataSet_By_HOST_ID( double HostID, string DatabaseConnectionString )            
  3484.        ///                                                                                                      
  3485.        ///====================================================================================================  
  3486.        ///<summary>  
  3487.        /// Get a DataSet representing this instance from the database  
  3488.        ///</summary>  
  3489.        public static DataSet Get_DataSet_By_Host_ID(double HostID, string  DatabaseConnectionString )  
  3490.        {  
  3491.            DataSet ds = new DataSet();  
  3492.            SqlParameter[] p = new SqlParameter[1];  
  3493.            p[0] = new SqlParameter("@HostID", SqlDbType.BigInt);  
  3494.            try    
  3495.            {      
  3496.                p[0].Value = HostID;  
  3497.            }      
  3498.            catch(Exception exp)    
  3499.            {    
  3500.                LogError(exp);    
  3501.            }    
  3502.            try    
  3503.            {      
  3504.                ds = Hydra.Data.SqlHelper.ExecuteDataset( DatabaseConnectionString , CommandType.StoredProcedure,"MSFT_NETFIREWALLRULE_SELECT_BY_HOST_ID", p);  
  3505.            }    
  3506.            catch(Exception exp)    
  3507.            {    
  3508.                LogError(exp);    
  3509.            }    
  3510.            return ds;    
  3511.        }  
  3512.          
  3513.          
  3514.  
  3515.  
  3516.         ///====================================================================================================  
  3517.         ///                                                                                                      
  3518.         ///    public static DataSet Get_DataSet_ALL( string  DatabaseConnectionString )                                
  3519.         ///                                                                                                      
  3520.         ///====================================================================================================  
  3521.         ///<summary>  
  3522.         /// Get a static DataSet representing all instances from the database  
  3523.         ///</summary>  
  3524.         public static DataSet Get_DataSet_ALL( string  DatabaseConnectionString )  
  3525.         {  
  3526.             DataSet ds = new DataSet();  
  3527.             try    
  3528.             {      
  3529.                 ds =Hydra.Data.SqlHelper.ExecuteDataset( DatabaseConnectionString , CommandType.StoredProcedure,"MSFT_NETFIREWALLRULE_SELECT_ALL" );  
  3530.             }    
  3531.             catch(Exception exp)    
  3532.             {    
  3533.                 LogError(exp);    
  3534.             }    
  3535.             return ds;    
  3536.         }  
  3537.  
  3538.  
  3539.         ///====================================================================================================  
  3540.         ///                                                                                                      
  3541.         ///    public static  DataSet Get_DataSet_By_HostName( string phostname, string DatabaseConnectionString )        
  3542.         ///                                                                                                      
  3543.         ///====================================================================================================  
  3544.         ///<summary>  
  3545.         /// Get a DataSet representing this instance from the database  
  3546.         ///</summary>  
  3547.         public static DataSet Get_DataSet_By_HostName( string phostname, string DatabaseConnectionString )  
  3548.         {  
  3549.             DataSet ds = new DataSet();  
  3550.             SqlParameter[] p = new SqlParameter[1];  
  3551.             p[0] = new SqlParameter("@HostName", SqlDbType.NVarChar, 255);  
  3552.             try    
  3553.             {      
  3554.                 p[0].Value = phostname;  
  3555.             }      
  3556.             catch(Exception exp)    
  3557.             {    
  3558.                 LogError(exp);    
  3559.             }    
  3560.             try    
  3561.             {      
  3562.                 ds =Hydra.Data.SqlHelper.ExecuteDataset( DatabaseConnectionString , CommandType.StoredProcedure,"MSFT_NETFIREWALLRULE_SELECT_BY_HOSTNAME", p);  
  3563.             }    
  3564.             catch(Exception exp)    
  3565.             {    
  3566.                 LogError(exp);    
  3567.             }    
  3568.             return ds;    
  3569.         }  
  3570.  
  3571.  
  3572.         ///====================================================================================================  
  3573.         ///                                                                                                      
  3574.         ///    public double Get_Count_By_KNOWN_Host_ID( double hostid, string DatabaseConnectionString )        
  3575.         ///                                                                                                      
  3576.         ///====================================================================================================  
  3577.         ///<summary>  
  3578.         /// Get a double representing the number of instances in the database  
  3579.         ///</summary>  
  3580.         public static double Get_Count_By_KNOWN_Host_ID( double hostid, string DatabaseConnectionString )  
  3581.         {  
  3582.             double i = 0;  
  3583.             SqlParameter[] p = new SqlParameter[1];  
  3584.             p[0] = new SqlParameter("@HostID", SqlDbType.BigInt);  
  3585.             try    
  3586.             {      
  3587.                 p[0].Value = hostid;  
  3588.             }      
  3589.             catch(Exception exp)    
  3590.             {    
  3591.                 LogError(exp);    
  3592.             }    
  3593.             try    
  3594.             {      
  3595.                 i = Convert.ToInt64(Hydra.Data.SqlHelper.ExecuteScalar( DatabaseConnectionString , CommandType.StoredProcedure,"MSFT_NETFIREWALLRULE_COUNT_BY_KNOWN_HOST_ID", p) ) ;  
  3596.             }    
  3597.             catch(Exception exp)    
  3598.             {    
  3599.                 LogError(exp);    
  3600.             }    
  3601.             return i;    
  3602.         }  
  3603.  
  3604.  
  3605.         ///====================================================================================================  
  3606.         ///                                                                                                      
  3607.         ///    public static double GetCount( string DatabaseConnectionString )        
  3608.         ///                                                                                                      
  3609.         ///====================================================================================================  
  3610.         ///<summary>  
  3611.         /// Get a int representing the number of rec in the table  
  3612.         ///</summary>  
  3613.         public static long GetCount( string DatabaseConnectionString )  
  3614.         {  
  3615.             Int64 i = 0;  
  3616.             try    
  3617.             {      
  3618.                 i = Convert.ToInt64(Hydra.Data.SqlHelper.ExecuteScalar( DatabaseConnectionString , CommandType.StoredProcedure,"MSFT_NETFIREWALLRULE_COUNT") ) ;  
  3619.             }    
  3620.             catch(Exception exp)    
  3621.             {    
  3622.                 LogError(exp);    
  3623.             }    
  3624.             return i;    
  3625.         }  
  3626.  
  3627.  
  3628.  
  3629.         #endregion  
  3630.  
  3631.         #region Generate SQL Strings  
  3632.         #endregion  
  3633.     }    
  3634.  
  3635. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement