Example #1
0
        /// <summary>
        /// Sets the network protocols on a <see cref="RasEntry"/> for the flags specified.
        /// </summary>
        /// <param name="entry">The entry whose options to set.</param>
        /// <param name="value">The flags of the entry.</param>
        public static void SetRasNetworkProtocols(RasEntry entry, NativeMethods.RASNP value)
        {
            if (entry != null)
            {
                RasNetworkProtocols protocols = entry.NetworkProtocols;

#pragma warning disable 0618
                protocols.NetBeui = Utilities.HasFlag(value, NativeMethods.RASNP.NetBeui);
#pragma warning restore 0618
                protocols.Ipx = Utilities.HasFlag(value, NativeMethods.RASNP.Ipx);
                protocols.IP  = Utilities.HasFlag(value, NativeMethods.RASNP.IP);
#if (WIN2K8 || WIN7 || WIN8)
                protocols.IPv6 = Utilities.HasFlag(value, NativeMethods.RASNP.IPv6);
#endif
            }
        }
Example #2
0
        /// <summary>
        /// Retrieves the <see cref="NativeMethods.RASNP"/> flags for the network protocols specified.
        /// </summary>
        /// <param name="value">The network protocols whose flags to retrieve.</param>
        /// <returns>The <see cref="NativeMethods.RASNP"/> flags.</returns>
        public static NativeMethods.RASNP GetRasNetworkProtocols(RasNetworkProtocols value)
        {
            NativeMethods.RASNP protocols = NativeMethods.RASNP.None;

            if (value != null)
            {
#pragma warning disable 0618
                protocols |= (NativeMethods.RASNP)Utilities.SetFlag(value.NetBeui, NativeMethods.RASNP.NetBeui);
#pragma warning restore 0618
                protocols |= (NativeMethods.RASNP)Utilities.SetFlag(value.Ipx, NativeMethods.RASNP.Ipx);
                protocols |= (NativeMethods.RASNP)Utilities.SetFlag(value.IP, NativeMethods.RASNP.IP);
#if (WIN2K8 || WIN7 || WIN8)
                protocols |= (NativeMethods.RASNP)Utilities.SetFlag(value.IPv6, NativeMethods.RASNP.IPv6);
#endif
            }

            return(protocols);
        }