Example #1
0
        /// <summary>
        /// Creates a copy of this object.
        /// </summary>
        /// <returns>A new <see cref="DotRas.RasEntryOptions"/> object.</returns>
        public object Clone()
        {
            RasEntryOptions retval = new RasEntryOptions();

            retval.UseCountryAndAreaCodes     = this.UseCountryAndAreaCodes;
            retval.IPHeaderCompression        = this.IPHeaderCompression;
            retval.RemoteDefaultGateway       = this.RemoteDefaultGateway;
            retval.DisableLcpExtensions       = this.DisableLcpExtensions;
            retval.TerminalBeforeDial         = this.TerminalBeforeDial;
            retval.TerminalAfterDial          = this.TerminalAfterDial;
            retval.ModemLights                = this.ModemLights;
            retval.SoftwareCompression        = this.SoftwareCompression;
            retval.RequireEncryptedPassword   = this.RequireEncryptedPassword;
            retval.RequireMSEncryptedPassword = this.RequireMSEncryptedPassword;
            retval.RequireDataEncryption      = this.RequireDataEncryption;
            retval.NetworkLogOn               = this.NetworkLogOn;
            retval.UseLogOnCredentials        = this.UseLogOnCredentials;
            retval.PromoteAlternates          = this.PromoteAlternates;
            retval.SecureLocalFiles           = this.SecureLocalFiles;
            retval.RequireEap          = this.RequireEap;
            retval.RequirePap          = this.RequirePap;
            retval.RequireSpap         = this.RequireSpap;
            retval.CustomEncryption    = this.CustomEncryption;
            retval.PreviewPhoneNumber  = this.PreviewPhoneNumber;
            retval.SharedPhoneNumbers  = this.SharedPhoneNumbers;
            retval.PreviewUserPassword = this.PreviewUserPassword;
            retval.PreviewDomain       = this.PreviewDomain;
            retval.ShowDialingProgress = this.ShowDialingProgress;
            retval.RequireChap         = this.RequireChap;
            retval.RequireMSChap       = this.RequireMSChap;
            retval.RequireMSChap2      = this.RequireMSChap2;
            retval.RequireWin95MSChap  = this.RequireWin95MSChap;
            retval.CustomScript        = this.CustomScript;

#if (WINXP || WIN2K8 || WIN7 || WIN8)
            retval.SecureFileAndPrint      = this.SecureFileAndPrint;
            retval.SecureClientForMSNet    = this.SecureClientForMSNet;
            retval.DoNotNegotiateMultilink = this.DoNotNegotiateMultilink;
            retval.DoNotUseRasCredentials  = this.DoNotUseRasCredentials;
            retval.UsePreSharedKey         = this.UsePreSharedKey;
            retval.Internet                = this.Internet;
            retval.DisableNbtOverIP        = this.DisableNbtOverIP;
            retval.UseGlobalDeviceSettings = this.UseGlobalDeviceSettings;
            retval.ReconnectIfDropped      = this.ReconnectIfDropped;
            retval.SharePhoneNumbers       = this.SharePhoneNumbers;
#endif
#if (WIN2K8 || WIN7 || WIN8)
            retval.SecureRoutingCompartment    = this.SecureRoutingCompartment;
            retval.UseTypicalSettings          = this.UseTypicalSettings;
            retval.IPv6RemoteDefaultGateway    = this.IPv6RemoteDefaultGateway;
            retval.RegisterIPWithDns           = this.RegisterIPWithDns;
            retval.UseDnsSuffixForRegistration = this.UseDnsSuffixForRegistration;
            retval.DisableIkeNameEkuCheck      = this.DisableIkeNameEkuCheck;
#endif
#if (WIN7 || WIN8)
            retval.DisableClassBasedStaticRoute = this.DisableClassBasedStaticRoute;
            retval.DisableMobility            = this.DisableMobility;
            retval.RequireMachineCertificates = this.RequireMachineCertificates;
#endif
#if (WIN8)
            retval.UsePreSharedKeyForIkeV2Initiator = this.UsePreSharedKeyForIkeV2Initiator;
            retval.UsePreSharedKeyForIkeV2Responder = this.UsePreSharedKeyForIkeV2Responder;
            retval.CacheCredentials = this.CacheCredentials;
#endif

            return(retval);
        }
Example #2
0
        public void OptionsDefaultTest()
        {
            string name = "Test Entry";

            RasEntryOptions expected = new RasEntryOptions();

            RasEntry target = new RasEntry(name);
            RasEntryOptions actual = target.Options;

            TestUtilities.AssertRasEntryOptions(expected, actual);
        }
Example #3
0
        /// <summary>
        /// Creates a copy of this object.
        /// </summary>
        /// <returns>A new <see cref="DotRas.RasEntryOptions"/> object.</returns>
        public object Clone()
        {
            RasEntryOptions retval = new RasEntryOptions();

            retval.UseCountryAndAreaCodes = this.UseCountryAndAreaCodes;
            retval.IPHeaderCompression = this.IPHeaderCompression;
            retval.RemoteDefaultGateway = this.RemoteDefaultGateway;
            retval.DisableLcpExtensions = this.DisableLcpExtensions;
            retval.TerminalBeforeDial = this.TerminalBeforeDial;
            retval.TerminalAfterDial = this.TerminalAfterDial;
            retval.ModemLights = this.ModemLights;
            retval.SoftwareCompression = this.SoftwareCompression;
            retval.RequireEncryptedPassword = this.RequireEncryptedPassword;
            retval.RequireMSEncryptedPassword = this.RequireMSEncryptedPassword;
            retval.RequireDataEncryption = this.RequireDataEncryption;
            retval.NetworkLogOn = this.NetworkLogOn;
            retval.UseLogOnCredentials = this.UseLogOnCredentials;
            retval.PromoteAlternates = this.PromoteAlternates;
            retval.SecureLocalFiles = this.SecureLocalFiles;
            retval.RequireEap = this.RequireEap;
            retval.RequirePap = this.RequirePap;
            retval.RequireSpap = this.RequireSpap;
            retval.CustomEncryption = this.CustomEncryption;
            retval.PreviewPhoneNumber = this.PreviewPhoneNumber;
            retval.SharedPhoneNumbers = this.SharedPhoneNumbers;
            retval.PreviewUserPassword = this.PreviewUserPassword;
            retval.PreviewDomain = this.PreviewDomain;
            retval.ShowDialingProgress = this.ShowDialingProgress;
            retval.RequireChap = this.RequireChap;
            retval.RequireMSChap = this.RequireMSChap;
            retval.RequireMSChap2 = this.RequireMSChap2;
            retval.RequireWin95MSChap = this.RequireWin95MSChap;
            retval.CustomScript = this.CustomScript;

#if (WINXP || WIN2K8 || WIN7 || WIN8)

            retval.SecureFileAndPrint = this.SecureFileAndPrint;
            retval.SecureClientForMSNet = this.SecureClientForMSNet;
            retval.DoNotNegotiateMultilink = this.DoNotNegotiateMultilink;
            retval.DoNotUseRasCredentials = this.DoNotUseRasCredentials;
            retval.UsePreSharedKey = this.UsePreSharedKey;
            retval.Internet = this.Internet;
            retval.DisableNbtOverIP = this.DisableNbtOverIP;
            retval.UseGlobalDeviceSettings = this.UseGlobalDeviceSettings;
            retval.ReconnectIfDropped = this.ReconnectIfDropped;
            retval.SharePhoneNumbers = this.SharePhoneNumbers;

#endif
#if (WIN2K8 || WIN7 || WIN8)

            retval.SecureRoutingCompartment = this.SecureRoutingCompartment;
            retval.UseTypicalSettings = this.UseTypicalSettings;
            retval.IPv6RemoteDefaultGateway = this.IPv6RemoteDefaultGateway;
            retval.RegisterIPWithDns = this.RegisterIPWithDns;
            retval.UseDnsSuffixForRegistration = this.UseDnsSuffixForRegistration;
            retval.DisableIkeNameEkuCheck = this.DisableIkeNameEkuCheck;

#endif
#if (WIN7 || WIN8)

            retval.DisableClassBasedStaticRoute = this.DisableClassBasedStaticRoute;
            retval.DisableMobility = this.DisableMobility;
            retval.RequireMachineCertificates = this.RequireMachineCertificates;

#endif
#if (WIN8)

            retval.UsePreSharedKeyForIkeV2Initiator = this.UsePreSharedKeyForIkeV2Initiator;
            retval.UsePreSharedKeyForIkeV2Responder = this.UsePreSharedKeyForIkeV2Responder;
            retval.CacheCredentials = this.CacheCredentials;

#endif

            return retval;
        }
Example #4
0
        public void addVpnConfiguration(string serverdescription, string servername)
        {
            this.AllUsersPhoneBook = new RasPhoneBook();
            this.AllUsersPhoneBook.Open(true);
            string serverAddress = this.getipaddressbyname(servername);
            RasEntryOptions options = new RasEntryOptions();
            options.PreviewDomain = false;
            options.UsePreSharedKey = true;
            options.ShowDialingProgress = true;
            options.RemoteDefaultGateway = true;
            options.DoNotNegotiateMultilink = true;
            options.UseLogOnCredentials = true;
            //RasDevice deviceByName = RasDevice.GetDeviceByName("(PPTP)", RasDeviceType.Vpn);
            RasDevice deviceByName = RasDevice.GetDeviceByName("(L2TP)", RasDeviceType.Vpn);
            RasEntry item;
            if (this.AllUsersPhoneBook.Entries.Contains(serverdescription))
            {
                //'entry' must have the PhoneNumber, DeviceType, DeviceName, FramingProtocol, and EntryType properties set as a minimum.
                item = this.AllUsersPhoneBook.Entries[serverdescription];
                item.PhoneNumber = serverAddress;
                item.Device = deviceByName;
                item.Options = options;
                
                item.UpdateCredentials(RasPreSharedKey.Client, "51sync");
                item.Update();
            }
            else
            {
                item = RasEntry.CreateVpnEntry(serverdescription, serverAddress, RasVpnStrategy.L2tpFirst, deviceByName);
                item.Options = options;
                this.AllUsersPhoneBook.Entries.Add(item);
                item.UpdateCredentials(RasPreSharedKey.Client, "51sync");
            }

        }