diff --git a/Properties/Settings.Designer.cs b/Properties/Settings.Designer.cs index f5d8981e..6950339c 100644 --- a/Properties/Settings.Designer.cs +++ b/Properties/Settings.Designer.cs @@ -26,12 +26,12 @@ public static Settings Default { [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("")] - public string LocationRecent { + public string InstallBaseFolderRecent { get { - return ((string)(this["LocationRecent"])); + return ((string)(this["InstallBaseFolderRecent"])); } set { - this["LocationRecent"] = value; + this["InstallBaseFolderRecent"] = value; } } @@ -49,13 +49,13 @@ public string LocalInstallPackageRecent { [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("MySite.local")] - public string SiteNameRecent { + [global::System.Configuration.DefaultSettingValueAttribute("MySite")] + public string SiteNamePrefixRecent { get { - return ((string)(this["SiteNameRecent"])); + return ((string)(this["SiteNamePrefixRecent"])); } set { - this["SiteNameRecent"] = value; + this["SiteNamePrefixRecent"] = value; } } @@ -130,5 +130,17 @@ public bool LocationDoNotWarnAgain { this["LocationDoNotWarnAgain"] = value; } } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute(".dnndev.me")] + public string SiteNameSuffixRecent { + get { + return ((string)(this["SiteNameSuffixRecent"])); + } + set { + this["SiteNameSuffixRecent"] = value; + } + } } } diff --git a/Properties/Settings.settings b/Properties/Settings.settings index 90b3b268..0892673c 100644 --- a/Properties/Settings.settings +++ b/Properties/Settings.settings @@ -2,14 +2,14 @@ - + - - MySite.local + + MySite True @@ -29,5 +29,8 @@ False + + .dnndev.me + \ No newline at end of file diff --git a/Start.Designer.cs b/Start.Designer.cs index 70bd9885..88f38b88 100644 --- a/Start.Designer.cs +++ b/Start.Designer.cs @@ -32,12 +32,12 @@ private void InitializeComponent() this.btnSiteInfoBack = new MetroFramework.Controls.MetroButton(); this.btnSiteInfoNext = new MetroFramework.Controls.MetroButton(); this.btnLocation = new MetroFramework.Controls.MetroButton(); - this.lblLocation = new MetroFramework.Controls.MetroLabel(); - this.txtLocation = new MetroFramework.Controls.MetroTextBox(); + this.lblInstallBaseFolder = new MetroFramework.Controls.MetroLabel(); + this.txtInstallBaseFolder = new MetroFramework.Controls.MetroTextBox(); this.chkDeleteSiteIfExists = new MetroFramework.Controls.MetroCheckBox(); this.chkSiteSpecificAppPool = new MetroFramework.Controls.MetroCheckBox(); this.lblSiteName = new MetroFramework.Controls.MetroLabel(); - this.txtSiteName = new MetroFramework.Controls.MetroTextBox(); + this.txtSiteNamePrefix = new MetroFramework.Controls.MetroTextBox(); this.toggleSiteInfoRemember = new MetroFramework.Controls.MetroToggle(); this.tabInstallPackage = new MetroFramework.Controls.MetroTabPage(); this.progressBarDownload = new MetroFramework.Controls.MetroProgressBar(); @@ -73,6 +73,9 @@ private void InitializeComponent() this.tileDNNDocumentationCenter = new MetroFramework.Controls.MetroTile(); this.tileDNNCommunityForums = new MetroFramework.Controls.MetroTile(); this.lblRemember = new MetroFramework.Controls.MetroLabel(); + this.txtSiteNameSuffix = new MetroFramework.Controls.MetroTextBox(); + this.txtInstallSubFolder = new MetroFramework.Controls.MetroTextBox(); + this.lblInstallSubFolder = new MetroFramework.Controls.MetroLabel(); this.tabSiteInfo.SuspendLayout(); this.tabInstallPackage.SuspendLayout(); this.tabControl.SuspendLayout(); @@ -82,15 +85,18 @@ private void InitializeComponent() // // tabSiteInfo // + this.tabSiteInfo.Controls.Add(this.lblInstallSubFolder); + this.tabSiteInfo.Controls.Add(this.txtInstallSubFolder); + this.tabSiteInfo.Controls.Add(this.txtSiteNameSuffix); this.tabSiteInfo.Controls.Add(this.btnSiteInfoBack); this.tabSiteInfo.Controls.Add(this.btnSiteInfoNext); this.tabSiteInfo.Controls.Add(this.btnLocation); - this.tabSiteInfo.Controls.Add(this.lblLocation); - this.tabSiteInfo.Controls.Add(this.txtLocation); + this.tabSiteInfo.Controls.Add(this.lblInstallBaseFolder); + this.tabSiteInfo.Controls.Add(this.txtInstallBaseFolder); this.tabSiteInfo.Controls.Add(this.chkDeleteSiteIfExists); this.tabSiteInfo.Controls.Add(this.chkSiteSpecificAppPool); this.tabSiteInfo.Controls.Add(this.lblSiteName); - this.tabSiteInfo.Controls.Add(this.txtSiteName); + this.tabSiteInfo.Controls.Add(this.txtSiteNamePrefix); this.tabSiteInfo.HorizontalScrollbarBarColor = true; this.tabSiteInfo.Location = new System.Drawing.Point(4, 35); this.tabSiteInfo.Name = "tabSiteInfo"; @@ -121,7 +127,7 @@ private void InitializeComponent() // btnLocation // this.btnLocation.Highlight = true; - this.btnLocation.Location = new System.Drawing.Point(559, 169); + this.btnLocation.Location = new System.Drawing.Point(278, 169); this.btnLocation.Name = "btnLocation"; this.btnLocation.Size = new System.Drawing.Size(38, 23); this.btnLocation.Style = MetroFramework.MetroColorStyle.Blue; @@ -129,22 +135,22 @@ private void InitializeComponent() this.btnLocation.Text = "..."; this.btnLocation.Click += new System.EventHandler(this.btnLocation_Click); // - // lblLocation + // lblInstallBaseFolder // - this.lblLocation.AutoSize = true; - this.lblLocation.Location = new System.Drawing.Point(0, 144); - this.lblLocation.Name = "lblLocation"; - this.lblLocation.Size = new System.Drawing.Size(58, 19); - this.lblLocation.TabIndex = 7; - this.lblLocation.Text = "Location"; + this.lblInstallBaseFolder.AutoSize = true; + this.lblInstallBaseFolder.Location = new System.Drawing.Point(0, 144); + this.lblInstallBaseFolder.Name = "lblInstallBaseFolder"; + this.lblInstallBaseFolder.Size = new System.Drawing.Size(114, 19); + this.lblInstallBaseFolder.TabIndex = 7; + this.lblInstallBaseFolder.Text = "Install Base Folder"; // - // txtLocation + // txtInstallBaseFolder // - this.txtLocation.FontWeight = MetroFramework.MetroTextBoxWeight.Light; - this.txtLocation.Location = new System.Drawing.Point(0, 169); - this.txtLocation.Name = "txtLocation"; - this.txtLocation.Size = new System.Drawing.Size(540, 23); - this.txtLocation.TabIndex = 6; + this.txtInstallBaseFolder.FontWeight = MetroFramework.MetroTextBoxWeight.Light; + this.txtInstallBaseFolder.Location = new System.Drawing.Point(0, 169); + this.txtInstallBaseFolder.Name = "txtInstallBaseFolder"; + this.txtInstallBaseFolder.Size = new System.Drawing.Size(272, 23); + this.txtInstallBaseFolder.TabIndex = 6; // // chkDeleteSiteIfExists // @@ -179,15 +185,16 @@ private void InitializeComponent() this.lblSiteName.TabIndex = 3; this.lblSiteName.Text = "Site Name (URL)"; // - // txtSiteName + // txtSiteNamePrefix // - this.txtSiteName.FontWeight = MetroFramework.MetroTextBoxWeight.Light; - this.txtSiteName.Location = new System.Drawing.Point(0, 37); - this.txtSiteName.Name = "txtSiteName"; - this.txtSiteName.Size = new System.Drawing.Size(540, 23); - this.txtSiteName.TabIndex = 2; - this.txtSiteName.Text = "MySite.local"; - this.txtSiteName.UseStyleColors = true; + this.txtSiteNamePrefix.FontWeight = MetroFramework.MetroTextBoxWeight.Light; + this.txtSiteNamePrefix.Location = new System.Drawing.Point(0, 37); + this.txtSiteNamePrefix.Name = "txtSiteNamePrefix"; + this.txtSiteNamePrefix.Size = new System.Drawing.Size(316, 23); + this.txtSiteNamePrefix.TabIndex = 2; + this.txtSiteNamePrefix.Text = "MySite"; + this.txtSiteNamePrefix.UseStyleColors = true; + this.txtSiteNamePrefix.TextChanged += new System.EventHandler(this.txtSiteNamePrefix_TextChanged); // // toggleSiteInfoRemember // @@ -321,7 +328,7 @@ private void InitializeComponent() this.tabControl.Location = new System.Drawing.Point(3, 14); this.tabControl.Multiline = true; this.tabControl.Name = "tabControl"; - this.tabControl.SelectedIndex = 0; + this.tabControl.SelectedIndex = 1; this.tabControl.Size = new System.Drawing.Size(607, 294); this.tabControl.TabIndex = 26; // @@ -570,6 +577,31 @@ private void InitializeComponent() this.lblRemember.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; this.lblRemember.Visible = false; // + // txtSiteNameSuffix + // + this.txtSiteNameSuffix.FontWeight = MetroFramework.MetroTextBoxWeight.Light; + this.txtSiteNameSuffix.Location = new System.Drawing.Point(323, 37); + this.txtSiteNameSuffix.Name = "txtSiteNameSuffix"; + this.txtSiteNameSuffix.Size = new System.Drawing.Size(217, 23); + this.txtSiteNameSuffix.TabIndex = 12; + this.txtSiteNameSuffix.Text = ".dnndev.me"; + // + // txtInstallSubFolder + // + this.txtInstallSubFolder.Location = new System.Drawing.Point(323, 169); + this.txtInstallSubFolder.Name = "txtInstallSubFolder"; + this.txtInstallSubFolder.Size = new System.Drawing.Size(217, 23); + this.txtInstallSubFolder.TabIndex = 13; + // + // lblInstallSubFolder + // + this.lblInstallSubFolder.AutoSize = true; + this.lblInstallSubFolder.Location = new System.Drawing.Point(323, 144); + this.lblInstallSubFolder.Name = "lblInstallSubFolder"; + this.lblInstallSubFolder.Size = new System.Drawing.Size(109, 19); + this.lblInstallSubFolder.TabIndex = 14; + this.lblInstallSubFolder.Text = "Install Sub Folder"; + // // Start // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -609,11 +641,11 @@ private void InitializeComponent() private MetroFramework.Controls.MetroTabControl tabControl; private MetroFramework.Controls.MetroTile tileQuickStartGuide; private MetroFramework.Controls.MetroTile tileDNNDevSpark; - private MetroFramework.Controls.MetroTextBox txtSiteName; + private MetroFramework.Controls.MetroTextBox txtSiteNamePrefix; private MetroFramework.Controls.MetroLabel lblSiteName; private MetroFramework.Controls.MetroButton btnLocation; - private MetroFramework.Controls.MetroLabel lblLocation; - private MetroFramework.Controls.MetroTextBox txtLocation; + private MetroFramework.Controls.MetroLabel lblInstallBaseFolder; + private MetroFramework.Controls.MetroTextBox txtInstallBaseFolder; private MetroFramework.Controls.MetroCheckBox chkDeleteSiteIfExists; private MetroFramework.Controls.MetroCheckBox chkSiteSpecificAppPool; private MetroFramework.Controls.MetroButton btnLocalInstallPackage; @@ -643,5 +675,8 @@ private void InitializeComponent() private MetroFramework.Controls.MetroProgressBar progressBarDownload; private MetroFramework.Controls.MetroToggle toggleSiteInfoRemember; private MetroFramework.Controls.MetroLabel lblRemember; + private MetroFramework.Controls.MetroTextBox txtSiteNameSuffix; + private MetroFramework.Controls.MetroLabel lblInstallSubFolder; + private MetroFramework.Controls.MetroTextBox txtInstallSubFolder; } } diff --git a/Start.cs b/Start.cs index 10a4cbe4..aabef4d3 100644 --- a/Start.cs +++ b/Start.cs @@ -90,9 +90,11 @@ public Start() if (Properties.Settings.Default.RememberFieldValues) { - txtSiteName.Text = Properties.Settings.Default.SiteNameRecent; + txtSiteNamePrefix.Text = Properties.Settings.Default.SiteNamePrefixRecent; + txtSiteNameSuffix.Text = Properties.Settings.Default.SiteNameSuffixRecent; chkSiteSpecificAppPool.Checked = Properties.Settings.Default.AppPoolRecent; chkDeleteSiteIfExists.Checked = Properties.Settings.Default.DeleteSiteInIISRecent; + txtInstallBaseFolder.Text = Properties.Settings.Default.InstallBaseFolderRecent; txtDBServerName.Text = Properties.Settings.Default.DatabaseServerNameRecent; txtDBName.Text = Properties.Settings.Default.DatabaseNameRecent; @@ -257,13 +259,13 @@ private void openFolderDiag() { VistaFolderBrowserDialog diag = new VistaFolderBrowserDialog(); diag.RootFolder = Environment.SpecialFolder.MyComputer; - diag.SelectedPath = Properties.Settings.Default.LocationRecent; + diag.SelectedPath = Properties.Settings.Default.InstallBaseFolderRecent; DialogResult result = diag.ShowDialog(); if (result == DialogResult.OK) { - txtLocation.Text = diag.SelectedPath; - Properties.Settings.Default.LocationRecent = diag.SelectedPath; + txtInstallBaseFolder.Text = diag.SelectedPath; + Properties.Settings.Default.InstallBaseFolderRecent = diag.SelectedPath; Properties.Settings.Default.Save(); } } @@ -276,24 +278,32 @@ private void btnSiteInfoBack_Click(object sender, EventArgs e) tabControl.SelectedIndex = 0; } + private void txtSiteNamePrefix_TextChanged(object sender, EventArgs e) + { + txtInstallSubFolder.Text = txtSiteNamePrefix.Text; + txtDBName.Text = txtSiteNamePrefix.Text; + } + private void btnSiteInfoNext_Click(object sender, EventArgs e) { bool proceed = false; - if (txtLocation.Text != "" && txtSiteName.Text != "") + if (txtInstallBaseFolder.Text != "" && txtInstallSubFolder.Text != "" && txtSiteNamePrefix.Text != "") { - if (!Directory.Exists(txtLocation.Text)) + string installFolder = txtInstallBaseFolder.Text + "\\" + txtInstallSubFolder.Text; + + if (!Directory.Exists(installFolder)) { var dialogMessage = "The entered location does not exist. Do you wish to create it?"; var dialogIcon = SystemIcons.Warning.ToBitmap(); var doNotWarnAgain = Properties.Settings.Default.LocationDoNotWarnAgain; var msgBoxYesNoIgnore = new MsgBoxYesNoIgnore(doNotWarnAgain, dialogMessage, dialogIcon); - var result = msgBoxYesNoIgnore.ShowDialog(); - if (!msgBoxYesNoIgnore.DoNotWarnAgain) + if (!doNotWarnAgain) { + var result = msgBoxYesNoIgnore.ShowDialog(); if (result == DialogResult.Yes) { - Directory.CreateDirectory(txtLocation.Text); + Directory.CreateDirectory(installFolder); proceed = true; } else @@ -303,7 +313,7 @@ private void btnSiteInfoNext_Click(object sender, EventArgs e) } else { - Directory.CreateDirectory(txtLocation.Text); + Directory.CreateDirectory(installFolder); proceed = true; } @@ -317,7 +327,7 @@ private void btnSiteInfoNext_Click(object sender, EventArgs e) if (proceed) { - if (!DirectoryEmpty(txtLocation.Text)) + if (!DirectoryEmpty(installFolder)) { var confirmResult = MessageBox.Show("All files and folders at this location will be deleted prior to installation of the new DNN instance. Do you wish to proceed?", "Confirm Installation", @@ -347,7 +357,8 @@ private void btnSiteInfoNext_Click(object sender, EventArgs e) tabControl.SelectedIndex = 2; if (Properties.Settings.Default.RememberFieldValues) { - Properties.Settings.Default.SiteNameRecent = txtSiteName.Text; + Properties.Settings.Default.SiteNamePrefixRecent = txtSiteNamePrefix.Text; + Properties.Settings.Default.SiteNameSuffixRecent = txtSiteNameSuffix.Text; Properties.Settings.Default.AppPoolRecent = chkSiteSpecificAppPool.Checked; Properties.Settings.Default.DeleteSiteInIISRecent = chkDeleteSiteIfExists.Checked; Properties.Settings.Default.Save(); @@ -428,7 +439,7 @@ private void btnDatabaseInfoNext_Click(object sender, EventArgs e) Properties.Settings.Default.Save(); } - if (ReadAndExtract(txtLocalInstallPackage.Text, txtLocation.Text + "\\Website")) + if (ReadAndExtract(txtLocalInstallPackage.Text, txtInstallBaseFolder.Text + "\\" + txtInstallSubFolder.Text + "\\Website")) { if (ModifyConfig()) { @@ -457,16 +468,17 @@ private bool CreateSiteInIIS() { //Create website in IIS ServerManager iisManager = new ServerManager(); - var siteName = txtSiteName.Text; + var siteName = txtSiteNamePrefix.Text + txtSiteNameSuffix.Text; var bindingInfo = "*:80:" + siteName; + string installFolder = txtInstallBaseFolder.Text + "\\" + txtInstallSubFolder.Text; Boolean siteExists = SiteExists(siteName); if (!siteExists) { - Site mySite = iisManager.Sites.Add(siteName, "http", bindingInfo, txtLocation.Text + "\\Website"); + Site mySite = iisManager.Sites.Add(siteName, "http", bindingInfo, installFolder + "\\Website"); mySite.TraceFailedRequestsLogging.Enabled = true; - mySite.TraceFailedRequestsLogging.Directory = txtLocation.Text + "\\Logs"; - mySite.LogFile.Directory = txtLocation.Text + "\\Logs" + "\\W3svc" + mySite.Id.ToString(); + mySite.TraceFailedRequestsLogging.Directory = installFolder + "\\Logs"; + mySite.LogFile.Directory = installFolder + "\\Logs" + "\\W3svc" + mySite.Id.ToString(); if (chkSiteSpecificAppPool.Checked) { @@ -536,7 +548,7 @@ private bool UpdateHostsFile() { string hostsFile = Environment.GetFolderPath(Environment.SpecialFolder.System) + @"\drivers\etc\hosts"; - var newEntry = "\t127.0.0.1 \t" + txtSiteName.Text; + var newEntry = "\t127.0.0.1 \t" + txtSiteNamePrefix.Text + txtSiteNameSuffix.Text; if (!File.ReadAllLines(hostsFile).Contains(newEntry)) { if (File.ReadAllText(hostsFile).EndsWith(Environment.NewLine)) @@ -567,9 +579,11 @@ private bool CreateDirectories() { try { - var websiteDir = txtLocation.Text + "\\Website"; - var logsDir = txtLocation.Text + "\\Logs"; - var databaseDir = txtLocation.Text + "\\Database"; + string installFolder = txtInstallBaseFolder.Text + "\\" + txtInstallSubFolder.Text; + + var websiteDir = installFolder + "\\Website"; + var logsDir = installFolder + "\\Logs"; + var databaseDir = installFolder + "\\Database"; var appPoolName = @"IIS APPPOOL\DefaultAppPool"; var dbServiceAccount = @"NT Service\MSSQLSERVER"; @@ -577,7 +591,7 @@ private bool CreateDirectories() if (chkSiteSpecificAppPool.Checked) { - appPoolName = @"IIS APPPOOL\" + txtSiteName.Text + "_nvQuickSite"; + appPoolName = @"IIS APPPOOL\" + txtSiteNamePrefix.Text + txtSiteNameSuffix.Text + "_nvQuickSite"; } if (!Directory.Exists(websiteDir)) @@ -666,9 +680,11 @@ private static void SetFolderPermission(String accountName, String folderPath) private void RemoveDirectories() { - var websiteDir = txtLocation.Text + "\\Website"; - var logsDir = txtLocation.Text + "\\Logs"; - var databaseDir = txtLocation.Text + "\\Database"; + string installFolder = txtInstallBaseFolder.Text + "\\" + txtInstallSubFolder.Text; + + var websiteDir = installFolder + "\\Website"; + var logsDir = installFolder + "\\Logs"; + var databaseDir = installFolder + "\\Database"; Directory.Delete(websiteDir, true); Directory.Delete(logsDir, true); @@ -692,13 +708,14 @@ private bool CreateDatabase() SqlConnection myConn = new SqlConnection("Server=" + myDBServerName + "; Initial Catalog=master;" + connectionStringAuthSection + connectionTimeout); string myDBName = txtDBName.Text; + string installFolder = txtInstallBaseFolder.Text + "\\" + txtInstallSubFolder.Text; string str = "CREATE DATABASE [" + myDBName + "] ON PRIMARY " + "(NAME = [" + myDBName + "_Data], " + - "FILENAME = '" + txtLocation.Text + "\\Database\\" + myDBName + "_Data.mdf', " + + "FILENAME = '" + installFolder + "\\Database\\" + myDBName + "_Data.mdf', " + "SIZE = 20MB, MAXSIZE = 200MB, FILEGROWTH = 10%) " + "LOG ON (NAME = [" + myDBName + "_Log], " + - "FILENAME = '" + txtLocation.Text + "\\Database\\" + myDBName + "_Log.ldf', " + + "FILENAME = '" + installFolder + "\\Database\\" + myDBName + "_Log.ldf', " + "SIZE = 13MB, " + "MAXSIZE = 50MB, " + "FILEGROWTH = 10%)"; @@ -794,8 +811,8 @@ private bool SetDatabasePermissions() if (chkSiteSpecificAppPool.Checked) { - appPoolNameFull = @"IIS APPPOOL\" + txtSiteName.Text + "_nvQuickSite"; - appPoolName = txtSiteName.Text + "_nvQuickSite"; + appPoolNameFull = @"IIS APPPOOL\" + txtSiteNamePrefix.Text + txtSiteNameSuffix.Text + "_nvQuickSite"; + appPoolName = txtSiteNamePrefix.Text + txtSiteNameSuffix.Text + "_nvQuickSite"; } string str1 = "USE master"; @@ -941,7 +958,8 @@ private bool ModifyConfig() connectionStringAuthSection; //string providerName = "System.Data.SqlClient"; - string path = txtLocation.Text + @"\Website\web.config"; + string installFolder = txtInstallBaseFolder.Text + "\\" + txtInstallSubFolder.Text; + string path = installFolder + @"\Website\web.config"; var config = XDocument.Load(path); var targetNode = config.Root.Element("connectionStrings").Element("add").Attribute("connectionString"); @@ -973,7 +991,7 @@ where appNode.Attribute("key").Value == key private void btnVisitSite_Click(object sender, EventArgs e) { - Process.Start("http://" + txtSiteName.Text); + Process.Start("http://" + txtSiteNamePrefix.Text + txtSiteNameSuffix.Text); Main.ActiveForm.Close(); } diff --git a/app.config b/app.config index 34e5b908..954a118e 100644 --- a/app.config +++ b/app.config @@ -7,14 +7,14 @@ - + - - MySite.local + + MySite True @@ -34,6 +34,9 @@ False + + .dnndev.me +