Esempio n. 1
0
        private void CheckDBPassword()
        {
            DataBaseConfig DBc  = new DataBaseConfig();
            Boolean        pass = DBc.CheckRegex(this.DBPasswd.Text);

            if (pass)
            {
                bNext.Enabled = true;
            }
            else
            {
                bNext.Enabled = false;
            }
        }
Esempio n. 2
0
        public void LoadServerData(bool WebServer = false, bool PHP = false, bool DataBase = false)
        {
            Globals.Servers = new ServerType();

            // Load/Update WebServer data.
            WebServerConfig LoadVH = new WebServerConfig();

            LoadVH.LoadVirtualHosts();

            // Load active modules of the selected servers.
            Globals.Servers.WebServer.ActiveModules = LoadVH.LoadActiveModules(Globals.Servers.WebServer.Type.ToString());
            Globals.Servers.PHP.ActiveModules       = LoadVH.LoadActiveModules("PHP");
            LoadVH.LoadModulesSettings();
            LoadVH.LoadCustomSettings(Globals.Servers.WebServer.Type.ToString());

            // Load/Update PHP data.
            PHPConfig LoadPHP = new PHPConfig();

            // Load/Update DataBase data.
            DataBaseConfig LoadDB = new DataBaseConfig();
        }
Esempio n. 3
0
        private void StartConfiguringServers()
        {
            if (this.CheckboxWS.Checked && this.RadiobuttonWSConfigTrue.Checked)
            {
                Step++;
                this.p7label3.Text = "Step " + Step + " of " + Steps + "...";
                this.p7label4.Text = "Configuring WebServer...";
                WebServerConfig WSConfig = new WebServerConfig();

                if (this.CheckboxPHP.Checked && this.CheckboxDB.Checked)
                {   // With phpMyAdmin.
                    WSConfig.SetDefaultConfig(this.wwwFolder.Text, true);
                }
                else
                {   // Without it.
                    WSConfig.SetDefaultConfig(this.wwwFolder.Text, false);
                }
            }
            if (this.CheckboxPHP.Checked && this.RadiobuttonPHPConfigTrue.Checked)
            {
                Step++;
                this.p7label3.Text = "Step " + Step + " of " + Steps + "...";
                this.p7label4.Text = "Configuring PHP Module...";
                PHPConfig PHPConfig = new PHPConfig();
                PHPConfig.SetDefaultConfig();
            }
            if (this.CheckboxDB.Checked && this.RadiobuttonDBConfigTrue.Checked)
            {
                Step++;
                this.p7label3.Text = "Step " + Step + " of " + Steps + "...";
                this.p7label4.Text = "Configuring Database...";
                DataBaseConfig DBConfig = new DataBaseConfig();
                DBConfig.SetDefaultConfig(this.DBPasswd.Text);
            }

            this.Tab++;
            Next_Back();
        }
Esempio n. 4
0
        private void Main_Load(object sender, EventArgs e)
        {
            CheckForIllegalCrossThreadCalls = false;
            // Need to modify manually inside the AssemblyInfo.cs file (AssemblyFileVersion).
            this.Text = String.Format("Web Development Server {0}", Application.ProductVersion);

            // Add the link to GitHub in the About tab.
            LinkLabel.Link link = new LinkLabel.Link();
            link.LinkData = "https://github.com/mongui";
            tGithub.Links.Add(link);

            Globals.list = this.LogList;
            Globals.AddToLog("Thanks for using Web Development Server v." + Application.ProductVersion + ".");
            Globals.AddToLog("------------------------------------------------------------------------------");

#if DEBUG
            Globals.AppFolder = @"c:\tests\";
#else
            this.NetworkStatus();
            Globals.AppFolder = AppDomain.CurrentDomain.BaseDirectory;
#endif

            // Check if the databases are available.
            DataBaseFiles dbFiles = new DataBaseFiles();
            if (!dbFiles.LoadDataBase(Globals.AppFolder + @"config.db", ref Globals.dbConn))
            {
                if (!dbFiles.CreateConfigFile())
                {
                    this.Close();
                    return;
                }
                dbFiles.LoadDataBase(Globals.AppFolder + @"config.db", ref Globals.dbConn);
            }

            if (Config.LoadSettings() < 0)
            {
                this.Close();
                return;
            }
            if (Globals.DataBasePass.Length < 8)
            {
                Globals.DataBasePass = "******";
                Config.SaveSetting("DataBasePass", Globals.DataBasePass);

                DataBaseConfig DBConfig = new DataBaseConfig();
                DBConfig.SetDefaultConfig(Globals.DataBasePass);
            }

            Boolean isDownloading = false;
#if !DEBUG
            if (!File.Exists(Globals.AppFolder + @"servers.db") || dbFiles.CheckLastModified())
            {
                isDownloading = dbFiles.DownloadUpdate();
            }
#endif

            if (!isDownloading && !dbFiles.LoadDataBase(Globals.AppFolder + @"servers.db", ref Globals.dbServ))
            {
                this.Close();
                return;
            }

            if (!Directory.Exists(Globals.AppFolder + @"bin"))
            {
                Directory.CreateDirectory(Globals.AppFolder + @"bin");
            }
            if (!Directory.Exists(Globals.AppFolder + @"bin\WebServer"))
            {
                Directory.CreateDirectory(Globals.AppFolder + @"bin\WebServer");
            }
            if (!Directory.Exists(Globals.AppFolder + @"bin\PHP"))
            {
                Directory.CreateDirectory(Globals.AppFolder + @"bin\PHP");
            }
            if (!Directory.Exists(Globals.AppFolder + @"bin\MySQL"))
            {
                Directory.CreateDirectory(Globals.AppFolder + @"bin\MySQL");
            }

            this.LoadCombos();
            this.LoadCheckboxes();
            this.ChecksActive();

            this.LoadServerData(true, true, true);

            if (Globals.Processes.ProcessesPIDs.Count == 0)
            {
                this.NotifyIcon.Icon = WDS.Properties.Resources.ServerRed;
            }

            // Start in the systray and start servers if the options are checked.
            if (Globals.StartInSystray == "1")
            {
                this.WindowState = FormWindowState.Minimized;
            }
            if (Globals.StartOnLaunch == "1")
            {
                this.bstart_Click(null, null);
            }

            // Check if there is any non-wanted service running.
            Services Svc     = new Services();
            String   SvcName = Svc.DoesServiceExist("Apache");
            if (Svc.StopService(SvcName))
            {
                Globals.AddToLog("Found an Apache service running. Shutting down the webserver...");
            }

            SvcName = Svc.DoesServiceExist("MySQL");
            if (Svc.StopService(SvcName))
            {
                Globals.AddToLog("Found an MySQLd service running. Shutting down the database manager...");
            }
        }