Ejemplo n.º 1
0
        void SettingsPage_LoadAsync(object sender, DoWorkEventArgs e)
        {
            ServerConfigAdapter sca = LocalContext.Default.CreateAdapter <ServerConfigAdapter>();

            iisIpBindingSource.DataSource = sca.AvailableIisSiteIPs;
            dnsIpBindingSource.DataSource = (new string[] { customDnsIp }).Union(sca.AvailableDnsIPs).Where(ip => !string.IsNullOrEmpty(ip)).Distinct();
            dnsServerArray = sca.AvailableDnsServers;
        }
Ejemplo n.º 2
0
        private void openDirectoryBackgroundWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            OpenDirectoryArgument argument = (OpenDirectoryArgument)e.Argument;
            ServerConfigAdapter   sca      = CreateAdapter <ServerConfigAdapter>();

            OpenDirectoryResult result = new OpenDirectoryResult {
                StatusGuid = argument.StatusGuid
            };

            if (sca.WindowsServerName == Environment.MachineName)
            {
                result.DirectoryIsLocal = true;
                result.DirectoryPath    = argument.SelectedWebsite.GetDirectory(sca.WebsiteDirectory.FullName);
            }
            e.Result = result;
        }
        public void LegacyModeTest()
        {
            ServerConfigAdapter adapter = CreateAdapter <ServerConfigAdapter>();

            // Remember the original result for comparison.
            bool originalResult = adapter.EnableLegacyMode;

            // Set the mode to the opposite of what it was.
            adapter.EnableLegacyMode = !originalResult;

            // Ensure that it has in fact changed.
            if (adapter.EnableLegacyMode == originalResult)
            {
                Assert.Fail("Legacy mode valid was unchanged.");
            }
        }
Ejemplo n.º 4
0
        private void testBackgroundWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            TestArgs            args      = (TestArgs)e.Argument;
            DiagnosticAdapter   dAdapter  = args.Context.CreateAdapter <DiagnosticAdapter>();
            ServerConfigAdapter scAdapter = args.Context.CreateAdapter <ServerConfigAdapter>();

            ConnectionTestResult result = dAdapter.TestConnection();

            if (result.Success)
            {
                // Set to class var for collection in CreateClientContext.
                encryptorSecret = scAdapter.EncryptorSecret;
            }

            e.Result = new TestResult()
            {
                Success = result.Success,
                Message = result.Message
            };
        }
Ejemplo n.º 5
0
        public override bool ProcessOption(UpdateStatusDelegate updateStatus)
        {
            if (!base.ProcessOption(updateStatus))
            {
                return(false);
            }

            updateStatus(this, SetupStatus.InProgress, "Starting service...");
            ServiceController sc = new ServiceController("Rensoft.Hosting.Server");
            bool started         = sc.Start(TimeSpan.FromSeconds(10));

            if (!started)
            {
                updateStatus(this, SetupStatus.Failure, "Service start failed");
                return(false);
            }

            updateStatus(this, SetupStatus.InProgress, "Configuring...");

            ServerConfigAdapter adapter = LocalContext.Default.CreateAdapter <ServerConfigAdapter>();

            adapter.EnableLegacyMode       = EnableLegacyMode;
            adapter.LegacyConnectionString = LegacyConnectionString;
            adapter.WindowsServerName      = WindowsServerName;
            adapter.AvailableIisSiteIPs    = AvailableIisIPs.Split(',');
            adapter.AvailableDnsServers    = DnsSuggestServers.Split(',');
            adapter.AvailableDnsIPs        = DnsSuggestAIPs.Split(',');
            adapter.FirstDnsNameServer     = DnsSoaPrimaryServer;
            adapter.DnsHostmasterName      = DnsSoaHostmaster;
            adapter.WebsiteDirectory       = new DirectoryInfo(WebsiteDirectory);

            if (EncryptorSecretChange)
            {
                // Only change if forced (could mean loosing passwords).
                adapter.EncryptorSecret = EncryptionSecret;
            }

            return(true);
        }