internal static T NewIPListEntry <T>(IPFilterRange range) where T : IConfigurable, new() { IPListEntry iplistEntry = (IPListEntry)((object)((default(T) == null) ? Activator.CreateInstance <T>() : default(T))); IPRange.Format format = (IPRange.Format)(range.Flags & 15); IPListEntryType iplistEntryType = (IPListEntryType)(range.Flags >> 4 & 15); IPListEntry.AuthorType authorType = (IPListEntry.AuthorType)(range.Flags >> 8 & 15); iplistEntry.identity = new IPListEntryIdentity(range.Identity); ulong high; ulong low; range.GetLowerBound(out high, out low); IPvxAddress startAddress = new IPvxAddress(high, low); range.GetUpperBound(out high, out low); IPvxAddress endAddress = new IPvxAddress(high, low); iplistEntry.range = new IPRange(startAddress, endAddress, format); iplistEntry.expirationTimeUtc = range.ExpiresOn.ToUniversalTime(); iplistEntry.isMachineGenerated = (authorType == IPListEntry.AuthorType.Automatic); iplistEntry.listType = iplistEntryType; iplistEntry.comment = range.Comment; return((T)((object)iplistEntry)); }
internal IPFilterRange ToIPFilterRange() { IPFilterRange ipfilterRange = new IPFilterRange(); ipfilterRange.ExpiresOn = this.expirationTimeUtc; IPvxAddress pvxAddress = this.IPRange.LowerBound; ipfilterRange.SetLowerBound((ulong)(pvxAddress >> 64), (ulong)pvxAddress); pvxAddress = this.IPRange.UpperBound; ipfilterRange.SetUpperBound((ulong)(pvxAddress >> 64), (ulong)pvxAddress); ipfilterRange.Flags = (int)this.IPRange.RangeFormat; ipfilterRange.Comment = this.comment; return(ipfilterRange); }