internal FirewallField(FWPM_FIELD0 field)
 {
     Key      = FirewallUtils.ReadGuid(field.fieldKey) ?? Guid.Empty;
     KeyName  = NamedGuidDictionary.ConditionGuids.Value.GetName(Key);
     Type     = field.type;
     DataType = field.dataType;
 }
        private static object SpecializeValue(FirewallDataType type, object value, Guid condition_key)
        {
            if (condition_key == Guid.Empty)
            {
                return(value);
            }

            if (FirewallConditionGuids.IsIpAddressCondition(condition_key))
            {
                if (value is byte[] ba && (ba.Length == 4 || ba.Length == 16))
                {
                    return(new IPAddress(ba));
                }
                else if (value is uint ui)
                {
                    ba = BitConverter.GetBytes(ui);
                    Array.Reverse(ba);
                    return(new IPAddress(ba));
                }
                else if (!(value is FirewallRange) && !(value is FirewallAddressAndMask))
                {
                    System.Diagnostics.Trace.Write($"Invalid IP Address type: {value.GetType().FullName}");
                }
            }