Initial project's source code check-in.

This commit is contained in:
ptsurbeleu 2011-07-13 16:07:32 -07:00
commit b03b0b373f
4573 changed files with 981205 additions and 0 deletions

View file

@ -0,0 +1,134 @@
// Copyright (c) 2011, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
namespace WebsitePanel.Setup
{
//[Designer(typeof(WizardPageDesigner))]
public class BannerWizardPage : WizardPageBase
{
public BannerWizardPage()
{
this.description = "Description.";
this.proceedText = "";
this.textColor = SystemColors.WindowText;
this.descriptionColor = SystemColors.WindowText;
this.Text = "Wizard Page";
}
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
using (StringFormat format = new StringFormat(StringFormat.GenericDefault))
{
using (SolidBrush brush = new SolidBrush(this.ForeColor))
{
format.Alignment = StringAlignment.Near;
format.LineAlignment = StringAlignment.Far;
Rectangle rect = base.ClientRectangle;
rect.Inflate(-Control.DefaultFont.Height * 2, 0);
e.Graphics.DrawString(this.ProceedText, this.Font, brush, (RectangleF) rect, format);
}
}
}
public string Description
{
get
{
return this.description;
}
set
{
this.description = value;
if (base.IsCurrentPage)
{
((Wizard) base.Parent).Redraw();
}
}
}
public Color DescriptionColor
{
get
{
return this.descriptionColor;
}
set
{
this.descriptionColor = value;
if (base.IsCurrentPage)
{
base.Parent.Invalidate();
}
}
}
[DefaultValue("")]
public virtual string ProceedText
{
get
{
return this.proceedText;
}
set
{
this.proceedText = value;
base.Invalidate();
}
}
[DefaultValue(typeof(Color), "WindowText")]
public Color TextColor
{
get
{
return this.textColor;
}
set
{
this.textColor = value;
if (base.IsCurrentPage)
{
base.Parent.Invalidate();
}
}
}
private string description;
private string proceedText;
private Color textColor;
private Color descriptionColor;
}
}

View file

@ -0,0 +1,153 @@
namespace WebsitePanel.Setup
{
partial class ConfigurationCheckPage
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ConfigurationCheckPage));
this.lvCheck = new System.Windows.Forms.ListView();
this.colImage = new System.Windows.Forms.ColumnHeader();
this.colAction = new System.Windows.Forms.ColumnHeader();
this.colStatus = new System.Windows.Forms.ColumnHeader();
this.colDetails = new System.Windows.Forms.ColumnHeader();
this.smallImages = new System.Windows.Forms.ImageList(this.components);
this.imgOk = new System.Windows.Forms.PictureBox();
this.lblResult = new System.Windows.Forms.Label();
this.imgError = new System.Windows.Forms.PictureBox();
((System.ComponentModel.ISupportInitialize)(this.imgOk)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.imgError)).BeginInit();
this.SuspendLayout();
//
// lvCheck
//
this.lvCheck.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.lvCheck.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.colImage,
this.colAction,
this.colStatus,
this.colDetails});
this.lvCheck.FullRowSelect = true;
this.lvCheck.GridLines = true;
this.lvCheck.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable;
this.lvCheck.Location = new System.Drawing.Point(0, 55);
this.lvCheck.MultiSelect = false;
this.lvCheck.Name = "lvCheck";
this.lvCheck.Size = new System.Drawing.Size(457, 145);
this.lvCheck.SmallImageList = this.smallImages;
this.lvCheck.TabIndex = 4;
this.lvCheck.UseCompatibleStateImageBehavior = false;
this.lvCheck.View = System.Windows.Forms.View.Details;
//
// colImage
//
this.colImage.Text = "";
this.colImage.Width = 30;
//
// colAction
//
this.colAction.Text = "Action";
this.colAction.Width = 186;
//
// colStatus
//
this.colStatus.Text = "Status";
this.colStatus.Width = 99;
//
// colDetails
//
this.colDetails.Text = "Details";
this.colDetails.Width = 135;
//
// smallImages
//
this.smallImages.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("smallImages.ImageStream")));
this.smallImages.TransparentColor = System.Drawing.Color.Transparent;
this.smallImages.Images.SetKeyName(0, "Run.ico");
this.smallImages.Images.SetKeyName(1, "Ok.ico");
this.smallImages.Images.SetKeyName(2, "warning.ico");
this.smallImages.Images.SetKeyName(3, "error.ico");
//
// imgOk
//
this.imgOk.Image = ((System.Drawing.Image)(resources.GetObject("imgOk.Image")));
this.imgOk.Location = new System.Drawing.Point(12, 12);
this.imgOk.Name = "imgOk";
this.imgOk.Size = new System.Drawing.Size(32, 32);
this.imgOk.TabIndex = 5;
this.imgOk.TabStop = false;
//
// lblResult
//
this.lblResult.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.lblResult.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.lblResult.Location = new System.Drawing.Point(50, 16);
this.lblResult.Name = "lblResult";
this.lblResult.Size = new System.Drawing.Size(404, 24);
this.lblResult.TabIndex = 6;
this.lblResult.Text = "Success";
//
// imgError
//
this.imgError.Image = ((System.Drawing.Image)(resources.GetObject("imgError.Image")));
this.imgError.Location = new System.Drawing.Point(12, 12);
this.imgError.Name = "imgError";
this.imgError.Size = new System.Drawing.Size(32, 32);
this.imgError.TabIndex = 7;
this.imgError.TabStop = false;
//
// ConfigurationCheckPage
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.imgError);
this.Controls.Add(this.lblResult);
this.Controls.Add(this.imgOk);
this.Controls.Add(this.lvCheck);
this.Name = "ConfigurationCheckPage";
this.Size = new System.Drawing.Size(457, 228);
((System.ComponentModel.ISupportInitialize)(this.imgOk)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.imgError)).EndInit();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.ListView lvCheck;
private System.Windows.Forms.ColumnHeader colAction;
private System.Windows.Forms.ColumnHeader colStatus;
private System.Windows.Forms.ColumnHeader colDetails;
private System.Windows.Forms.ImageList smallImages;
private System.Windows.Forms.ColumnHeader colImage;
private System.Windows.Forms.PictureBox imgOk;
private System.Windows.Forms.Label lblResult;
private System.Windows.Forms.PictureBox imgError;
}
}

View file

@ -0,0 +1,608 @@
// Copyright (c) 2011, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System;
using System.Diagnostics;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using System.Threading;
using System.DirectoryServices;
using WebsitePanel.Setup.Web;
using System.IO;
using System.Management;
using WebsitePanel.Setup.Actions;
namespace WebsitePanel.Setup
{
public partial class ConfigurationCheckPage : BannerWizardPage
{
public const string AspNet40HasBeenInstalledMessage = "ASP.NET 4.0 has been installed.";
private Thread thread;
private List<ConfigurationCheck> checks;
public ConfigurationCheckPage()
{
InitializeComponent();
checks = new List<ConfigurationCheck>();
this.CustomCancelHandler = true;
}
public List<ConfigurationCheck> Checks
{
get
{
return checks;
}
}
protected override void InitializePageInternal()
{
base.InitializePageInternal();
this.Text = "System Configuration Check";
this.Description = "Wait while the system is checked for potential installation problems.";
this.imgError.Visible = false;
this.imgOk.Visible = false;
this.lblResult.Visible = false;
}
protected internal override void OnBeforeDisplay(EventArgs e)
{
base.OnBeforeDisplay(e);
this.AllowMoveBack = false;
this.AllowMoveNext = false;
}
protected internal override void OnAfterDisplay(EventArgs e)
{
base.OnAfterDisplay(e);
thread = new Thread(new ThreadStart(this.Start));
thread.Start();
}
/// <summary>
/// Displays process progress.
/// </summary>
public void Start()
{
bool pass = true;
try
{
lvCheck.Items.Clear();
this.imgError.Visible = false;
this.imgOk.Visible = false;
this.lblResult.Visible = false;
foreach (ConfigurationCheck check in Checks)
{
AddListViewItem(check);
}
this.Update();
CheckStatuses status = CheckStatuses.Success;
string details = string.Empty;
//
foreach (ListViewItem item in lvCheck.Items)
{
ConfigurationCheck check = (ConfigurationCheck)item.Tag;
item.ImageIndex = 0;
item.SubItems[2].Text = "Running";
this.Update();
#region Previous Prereq Verification
switch (check.CheckType)
{
case CheckTypes.OperationSystem:
status = CheckOS(out details);
break;
case CheckTypes.IISVersion:
status = CheckIISVersion(out details);
break;
case CheckTypes.ASPNET:
status = CheckASPNET(out details);
break;
case CheckTypes.WPServer:
status = CheckWPServer(check.SetupVariables, out details);
break;
case CheckTypes.WPEnterpriseServer:
status = CheckWPEnterpriseServer(check.SetupVariables, out details);
break;
case CheckTypes.WPPortal:
status = CheckWPPortal(check.SetupVariables, out details);
break;
default:
status = CheckStatuses.Warning;
break;
}
#endregion
switch (status)
{
case CheckStatuses.Success:
item.ImageIndex = 1;
item.SubItems[2].Text = "Success";
break;
case CheckStatuses.Warning:
item.ImageIndex = 2;
item.SubItems[2].Text = "Warning";
break;
case CheckStatuses.Error:
item.ImageIndex = 3;
item.SubItems[2].Text = "Error";
pass = false;
break;
}
item.SubItems[3].Text = details;
this.Update();
}
//
//actionManager.PrerequisiteComplete += new EventHandler<ActionProgressEventArgs<bool>>((object sender, ActionProgressEventArgs<bool> e) =>
//{
//
//});
//
//actionManager.VerifyDistributivePrerequisites();
ShowResult(pass);
if (pass)
{
//unattended setup
if (!string.IsNullOrEmpty(Wizard.SetupVariables.SetupXml) && AllowMoveNext)
Wizard.GoNext();
}
}
catch (Exception ex)
{
if (Utils.IsThreadAbortException(ex))
return;
ShowError();
return;
}
}
private void ShowResult(bool success)
{
this.AllowMoveNext = success;
this.imgError.Visible = !success;
this.imgOk.Visible = success;
this.lblResult.Text = success ? "Success" : "Error";
this.lblResult.Visible = true;
Update();
}
private void AddListViewItem(ConfigurationCheck check)
{
lvCheck.BeginUpdate();
ListViewItem item = new ListViewItem(string.Empty);
item.SubItems.AddRange(new string[] { check.Action, string.Empty, string.Empty });
item.Tag = check;
lvCheck.Items.Add(item);
lvCheck.EndUpdate();
Update();
}
private CheckStatuses CheckOS(out string details)
{
details = string.Empty;
try
{
//check OS version
OS.WindowsVersion version = OS.GetVersion();
details = OS.GetName(version);
if (Utils.IsWin64())
details += " x64";
Log.WriteInfo(string.Format("OS check: {0}", details));
if (!(version == OS.WindowsVersion.WindowsServer2003 ||
version == OS.WindowsVersion.WindowsServer2008))
{
details = "Windows Server 2003 or Windows Server 2008 required.";
Log.WriteError(string.Format("OS check: {0}", details), null);
#if DEBUG
return CheckStatuses.Warning;
#endif
#if !DEBUG
return CheckStatuses.Error;
#endif
}
return CheckStatuses.Success;
}
catch (Exception ex)
{
if (!Utils.IsThreadAbortException(ex))
Log.WriteError("Check error", ex);
details = "Unexpected error";
return CheckStatuses.Error;
}
}
private CheckStatuses CheckIISVersion(out string details)
{
details = string.Empty;
try
{
details = string.Format("IIS {0}", SetupVariables.IISVersion.ToString(2));
if (SetupVariables.IISVersion.Major == 6 &&
Utils.IsWin64() && Utils.IIS32Enabled())
{
details += " (32-bit mode)";
}
Log.WriteInfo(string.Format("IIS check: {0}", details));
if (SetupVariables.IISVersion.Major < 6)
{
details = "IIS 6.0 or greater required.";
Log.WriteError(string.Format("IIS check: {0}", details), null);
return CheckStatuses.Error;
}
return CheckStatuses.Success;
}
catch (Exception ex)
{
if (!Utils.IsThreadAbortException(ex))
Log.WriteError("Check error", ex);
details = "Unexpected error";
return CheckStatuses.Error;
}
}
private CheckStatuses CheckASPNET(out string details)
{
details = "ASP.NET 4.0 is installed.";
CheckStatuses ret = CheckStatuses.Success;
try
{
// IIS 6
if (SetupVariables.IISVersion.Major == 6)
{
//
if (Utils.CheckAspNet40Registered(SetupVariables) == false)
{
// Register ASP.NET 4.0
Utils.RegisterAspNet40(SetupVariables);
//
ret = CheckStatuses.Warning;
details = AspNet40HasBeenInstalledMessage;
}
// Enable ASP.NET 4.0 Web Server Extension if it is prohibited
if (Utils.GetAspNetWebExtensionStatus_Iis6(SetupVariables) == WebExtensionStatus.Prohibited)
{
Utils.EnableAspNetWebExtension_Iis6();
}
}
// IIS 7 on Windows 2008 and higher
else
{
if (!IsWebServerRoleInstalled())
{
details = "Web Server (IIS) role is not installed on your server. Run Server Manager to add Web Server (IIS) role.";
Log.WriteInfo(string.Format("ASP.NET check: {0}", details));
return CheckStatuses.Error;
}
if (!IsAspNetRoleServiceInstalled())
{
details = "ASP.NET role service is not installed on your server. Run Server Manager to add ASP.NET role service.";
Log.WriteInfo(string.Format("ASP.NET check: {0}", details));
return CheckStatuses.Error;
}
// Register ASP.NET 4.0
if (Utils.CheckAspNet40Registered(SetupVariables) == false)
{
// Register ASP.NET 4.0
Utils.RegisterAspNet40(SetupVariables);
//
ret = CheckStatuses.Warning;
details = AspNet40HasBeenInstalledMessage;
}
}
// Log details
Log.WriteInfo(string.Format("ASP.NET check: {0}", details));
//
return ret;
}
catch (Exception ex)
{
if (!Utils.IsThreadAbortException(ex))
Log.WriteError("Check error", ex);
details = "Unexpected error";
#if DEBUG
return CheckStatuses.Warning;
#endif
#if !DEBUG
return CheckStatuses.Error;
#endif
}
}
private CheckStatuses CheckIIS32Mode(out string details)
{
details = string.Empty;
CheckStatuses ret = CheckIISVersion(out details);
if (ret == CheckStatuses.Error)
return ret;
try
{
//IIS 6
if (SetupVariables.IISVersion.Major == 6)
{
//x64
if (Utils.IsWin64())
{
if (!Utils.IIS32Enabled())
{
Log.WriteInfo("IIS 32-bit mode disabled");
EnableIIS32Mode();
details = "IIS 32-bit mode has been enabled.";
Log.WriteInfo(string.Format("IIS 32-bit mode check: {0}", details));
return CheckStatuses.Warning;
}
}
}
return CheckStatuses.Success;
}
catch (Exception ex)
{
if (!Utils.IsThreadAbortException(ex))
Log.WriteError("Check error", ex);
details = "Unexpected error";
return CheckStatuses.Error;
}
}
private bool SiteBindingsExist(SetupVariables setupVariables)
{
bool iis7 = (setupVariables.IISVersion.Major == 7);
string ip = setupVariables.WebSiteIP;
string port = setupVariables.WebSitePort;
string domain = setupVariables.WebSiteDomain;
string siteId = iis7 ?
WebUtils.GetIIS7SiteIdByBinding(ip, port, domain) :
WebUtils.GetSiteIdByBinding(ip, port, domain);
return (siteId != null);
}
private bool AccountExists(SetupVariables setupVariables)
{
string domain = setupVariables.UserDomain;
string username = setupVariables.UserAccount;
return SecurityUtils.UserExists(domain, username);
}
private CheckStatuses CheckWPServer(SetupVariables setupVariables, out string details)
{
details = "";
try
{
if (SiteBindingsExist(setupVariables))
{
details = string.Format("Site with specified bindings already exists (ip: {0}, port: {1}, domain: {2})",
setupVariables.WebSiteIP, setupVariables.WebSitePort, setupVariables.WebSiteDomain);
Log.WriteError(string.Format("Site bindings check: {0}", details), null);
return CheckStatuses.Error;
}
if (AccountExists(setupVariables))
{
details = string.Format("Windows account already exists: {0}\\{1}",
setupVariables.UserDomain, setupVariables.UserAccount);
Log.WriteError(string.Format("Account check: {0}", details), null);
return CheckStatuses.Error;
}
if (!CheckDiskSpace(setupVariables, out details))
{
Log.WriteError(string.Format("Disk space check: {0}", details), null);
return CheckStatuses.Error;
}
return CheckStatuses.Success;
}
catch (Exception ex)
{
if (!Utils.IsThreadAbortException(ex))
Log.WriteError("Check error", ex);
details = "Unexpected error";
return CheckStatuses.Error;
}
}
private bool CheckDiskSpace(SetupVariables setupVariables, out string details)
{
details = string.Empty;
long spaceRequired = FileUtils.CalculateFolderSize(setupVariables.InstallerFolder);
if (string.IsNullOrEmpty(setupVariables.InstallationFolder))
{
details = "Installation folder is not specified.";
return false;
}
string drive = null;
try
{
drive = Path.GetPathRoot(Path.GetFullPath(setupVariables.InstallationFolder));
}
catch
{
details = "Installation folder is invalid.";
return false;
}
ulong freeBytesAvailable, totalBytes, freeBytes;
if (FileUtils.GetDiskFreeSpaceEx(drive, out freeBytesAvailable, out totalBytes, out freeBytes))
{
long freeSpace = Convert.ToInt64(freeBytesAvailable);
if (spaceRequired > freeSpace)
{
details = string.Format("There is not enough space on the disk ({0} required, {1} available)",
FileUtils.SizeToMB(spaceRequired), FileUtils.SizeToMB(freeSpace));
return false;
}
}
else
{
details = "I/O error";
return false;
}
return true;
}
private CheckStatuses CheckWPEnterpriseServer(SetupVariables setupVariables, out string details)
{
details = "";
try
{
if (SiteBindingsExist(setupVariables))
{
details = string.Format("Site with specified bindings already exists (ip: {0}, port: {1}, domain: {2})",
setupVariables.WebSiteIP, setupVariables.WebSitePort, setupVariables.WebSiteDomain);
Log.WriteError(string.Format("Site bindings check: {0}", details), null);
return CheckStatuses.Error;
}
if (AccountExists(setupVariables))
{
details = string.Format("Windows account already exists: {0}\\{1}",
setupVariables.UserDomain, setupVariables.UserAccount);
Log.WriteError(string.Format("Account check: {0}", details), null);
return CheckStatuses.Error;
}
if (!CheckDiskSpace(setupVariables, out details))
{
Log.WriteError(string.Format("Disk space check: {0}", details), null);
return CheckStatuses.Error;
}
return CheckStatuses.Success;
}
catch (Exception ex)
{
if (!Utils.IsThreadAbortException(ex))
Log.WriteError("Check error", ex);
details = "Unexpected error";
return CheckStatuses.Error;
}
}
private CheckStatuses CheckWPPortal(SetupVariables setupVariables, out string details)
{
details = "";
try
{
if (AccountExists(setupVariables))
{
details = string.Format("Windows account already exists: {0}\\{1}",
setupVariables.UserDomain, setupVariables.UserAccount);
Log.WriteError(string.Format("Account check: {0}", details), null);
return CheckStatuses.Error;
}
if (!CheckDiskSpace(setupVariables, out details))
{
Log.WriteError(string.Format("Disk space check: {0}", details), null);
return CheckStatuses.Error;
}
return CheckStatuses.Success;
}
catch (Exception ex)
{
if (!Utils.IsThreadAbortException(ex))
Log.WriteError("Check error", ex);
details = "Unexpected error";
return CheckStatuses.Error;
}
}
private static void EnableIIS32Mode()
{
Log.WriteStart("Enabling IIS 32-bit mode");
using (DirectoryEntry iisService = new DirectoryEntry("IIS://LocalHost/W3SVC/AppPools"))
{
Utils.SetObjectProperty(iisService, "Enable32bitAppOnWin64", true);
iisService.CommitChanges();
}
Log.WriteEnd("Enabled IIS 32-bit mode");
}
private static void InstallASPNET()
{
Log.WriteStart("Starting aspnet_regiis -i");
string util = (Utils.IsWin64() && !Utils.IIS32Enabled()) ?
@"Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis.exe" :
@"Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe";
string path = Path.Combine(OS.GetWindowsDirectory(), util);
ProcessStartInfo info = new ProcessStartInfo(path, "-i");
info.WindowStyle = ProcessWindowStyle.Minimized;
Process process = Process.Start(info);
process.WaitForExit();
Log.WriteEnd("Finished aspnet_regiis -i");
}
private static bool IsWebServerRoleInstalled()
{
WmiHelper wmi = new WmiHelper("root\\cimv2");
using (ManagementObjectCollection roles = wmi.ExecuteQuery("SELECT NAME FROM Win32_ServerFeature WHERE ID=2"))
{
return (roles.Count > 0);
}
}
private static bool IsAspNetRoleServiceInstalled()
{
WmiHelper wmi = new WmiHelper("root\\cimv2");
using (ManagementObjectCollection roles = wmi.ExecuteQuery("SELECT NAME FROM Win32_ServerFeature WHERE ID=148"))
{
return (roles.Count > 0);
}
}
}
}

View file

@ -0,0 +1,296 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="smallImages.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<data name="smallImages.ImageStream" mimetype="application/x-microsoft.net.object.binary.base64">
<value>
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj0yLjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAABU
FQAAAk1TRnQBSQFMAgEBBAEAAQwBAAEEAQABEAEAARABAAT/ASEBAAj/AUIBTQE2BwABNgMAASgDAAFA
AwABIAMAAQEBAAEgBgABIP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8ALgADBAEFATQBNQE0
AVUBUwFVAVMBrgFXAYABUwHxAVcBhgFRAfoBXAGKAVwB+AFQAY0BRwH9AVUBagFQAeIBSAFJAUgBiAMX
ASADAgEDSAADBwEKAU8BUAFRAZsBCQF1AYkB/AEJAWwBkgH9AQkBbAGSAf0BCQFsAZEB/QEJAWwBkgH9
AQkBcAGVAf0BCAFwAZUB/QEIAW4BkwH9AQgBbAGRAf0BCQFsAZEB/QEJAWwBkgH9AQkBbAGSAf0BCAFv
AZQB/QFHAWYBbgHgSAADEgEYAVQBVgFSAbQBQAGAAToB/gG6AcgBtQH/AeMB3wHiAf8B6QHkAeoB/wHk
AeEB5QH/A9gB/wHFAcsBxQH/AXEBnwFsAf8BSAFqAUYB6QMzAVMDBAEGFAADOAFdAVUBWgFXAcABPwFi
AUgB7wEnAVYBMQH+ASUBUQEvAf4BPAFYAUIB7wFVAVoBVQHAAzgBXRAAAyMBMwEeAYgBoQH3AQYBvAHi
Af8BAQHDAegB/wEAAbsB5AH/AQABuAHiAf8BAAHCAecB/wEAAYsBpwH/AUEBXwF1Af8BMQGsAc8B/wEA
AbwB4wH/AQABtAHcAf8BAAG1Ad8B/wEAAboB4gH/AQABvgHoAf8BLAF6AY4B8hAAAyMBNAJGAUcBgAJV
AVoBwAE/AUUBZwHtAT0BQQFfAe0CVAFYAcACRgFHAYADIwE0FAADDQESAVIBVAFSAaYBTwGVAUoB/wH1
Ae4B9AL/AfQC/wHaAeMB2gH/AeAB5gHgAf8B7wHrAe8B/wHoAeUB6AH/AecB4QHnAf8B8QHjAfIB/wG6
AcIBtwH/AUEBdAE8AfkDLgFIAwEBAgwAAVABUgFQAaQBPQFlAUgB9gEtAYABQAH/ASYBhwFAAf8BHwGN
AT0B/wEZAYkBOAH/ARYBdgExAf8BGAFkAS0B/wExAU4BNAH2AVABUgFQAaQMAAMXASABUwFjAWcBygEW
AdwB9wH/ARUB8wL/AQEB2gL/AQAB2gL/AQAB5gH3Af8BAAEwATUB/wFZAgAB/wFcAV8BbgH/AQAB6AL/
AQABzQH6Af8BAAHOAfcB/wEMAeQB/AH/AQABwQHlAf8BUgFdAV8B0gwAATwCPQFnAVQBWQFtAdoBEgEx
AaYB/wEFAS0BtQH/AQABLAHDAf8BAAErAcIB/wEAASUBqgH/AQMBGgGEAf8BTQFPAVwB2gM8AWcMAAMC
AQMDSwGOAUcBkwFBAv0B+gH8Av8B/QP/AfsC/wF1AbsBdQH/AUYBpQFGAf8B0AHnAdAB/wH9AfoB/QH/
A+0B/wHdAeAB3gH/AfMB5AHzAf8BqgG8AacB/wFRAWEBUQHYAxIBGQgAAVACUgGkAUYBiAFPAfkBQQGg
AVgB/wE6AaIBVQH/ATEBnQFNAf8BKAGXAUYB/wEgAZIBPwH/ARoBjgE5Af8BFAGKATUB/wETAXkBMQH/
ASYBYQE6AfkBUAFSAVABpAwAAzUBVwEjAbUBzAH5ATQB/wH+Af8BFwHyAv8BAgHgAv8BAAHsAf4B/wEA
AZYBowH/AQIBSAFKAf8BAgGhAbIB/wEAAeYC/wEAAc4B+gH/AQcB2gH1Af8BEAHtAf0B/wEIAYYBpAH9
AVMCVQGtCAABPAI9AWcBOwFQAZIB9AEKATQBvQH/AQABLgHRAf8BAAEuAc8B/wEAAS4BzgH/AQABLQHL
Af8BAAEtAcsB/wEAAS0BywH/AQABIQGhAf8BJAEqAV4B9AM8AWcIAAMhATABSAFyAUUB7QHbAekB1gb/
Af4G/wFvAbkBbwH/AQABbQEAAf8BOQGfATkB/wHYAe4B2AL/AfwC/wHwAfEB8AH/AuEB3wH/AesB4QHt
Af8BWgGZAVgB/wNDAXcEAAM4AV0BSQF9AVAB9gFWAa4BaQH/AVEBsQFoAf8BRwGrAV8B/wE9AaQBVwH/
ATQBnwFQAf8BKwGZAUgB/wEjAZQBQgH/ARwBjwE8Af8BFQGLATcB/wEUAXoBMQH/ATEBVgE1AfYDOAFd
CAADCwEPAVQBXwFiAcABRQHzAfcB/wFBA/8BEwHzAv8BAAHpAv8BAAHzAv8BBAHOAeYB/wEAAe0C/wEA
AdwC/wEAAdQB+QH/ARQB7wH6Af8BBAHPAeUB/wEcAW0BhgH3AwwBEAQAAyMBNAFXAVsBcgHaAQ4BOQHI
Af8BAAEyAeAB/wEAATIB4gH/AQABMgHgAf8BAAEwAdwB/wEAATAB1gH/AQABLgHPAf8BAAEtAcsB/wEA
AS0BywH/AQABIQGhAf8BTQFPAVwB2gMjATQEAANIAYUBXwGiAVgR/wF5Ab8BeQH/AQABdAEAAf8BAAFv
AQAB/wFGAacBRgH/AdgB7gHYAf8B/gH8Af4B/wLrAeoB/wHrAeQB6wH/AbIBwQGwAf8BVAFmAVQB2gQA
AVoBXgFaAcABWgGqAWcB/wFoAb8BgQH/AV4BuQFzAf8BVQGzAWsF/wFBAaYBWwH/ATcBoAFSAf8BLgGb
AUsB/wEmAZYBQwH/AR4BkQE+Af8BFwGMATgB/wEaAWkBMAH/AVUBWgFVAcAMAAM2AVkBQAG6AcwB+QFp
A/8BOwP/AQoB/QL/AQUB0AHVAf8BJwFEAVsB/wEBAdkB5wH/AQAB5gL/AQgB4gH5Af8BDwHwAfwB/wEC
AYMBnwH+AVIBVAFVAa4IAAFGAkcBgAEhAUcBxQH/AQABNgHvAf8BAAE3AfQB/wH8Af4B/AH/AfwB/gH8
Af8BQgFtAfMB/wE2AWIB7AH/AfwB/gH8Af8B/AH+AfwB/wEAAS0BywH/AQABLQHLAf8BAwEaAYQB/wJG
AUcBgAQAAVUBWQFVAbcBywHhAccF/wH+Af0B/gn/AXgBvgF4Af8BAQF1AQEB/wEAAXUBAAH/AQABdAEA
Af8BRAGlAUQB/wHYAewB2AH/AfgB9AH4Af8B5wHkAegB/wHbAdYB2QH/AVkBbQFWAeEEAAFYAYYBYgHv
AXQBwwGHAf8BdAHHAYsB/wFrAcEBgw3/AUQBqQFdAf8BOgGiAVUB/wExAZwBTQH/ASgBmAFGAf8BIAGS
AUAB/wEcAYEBNwH/AT8BWgFGAe8MAAMKAQ4BUwFjAWYBxgFuAfYB+gH/AWkD/wEhA/8BEAHCAcQB/wFZ
ARoBJwH/AQwB1AHdAf8BAAHwAv8BEAHwAfoB/wEBAdcB7AH/ARMBbQF/AfoDHAEoCAABVwFaAV8BwAET
AUMB4AH/AQABPgL/AQcBQwL/AXEBmAH+Af8B/AH+AfwB/wH8Af4B/AH/AfwB/gH8Af8B/AH+AfwB/wFa
AYIB6wH/AQABLwHTAf8BAAEtAcsB/wEAASUBqgH/AlQBWAHABAABVgFhAVYBzwHwAfcB7wX/A/0J/wF4
Ab0BeAH/AQABdwEAAf8BAAF5AQAB/wEAAXEBAAH/AQABdQEAAf8BpQHTAaUB/wH7AfkB+wH/AegB5wHo
Af8B6gHgAesB/wFaAWcBWgHVBAABVwGeAWAB/gGZAdwBpQH/AY0B1QGdCf8BQwGeAU8J/wFHAasBYAH/
AT4BpQFYAf8BNAGeAVAB/wErAZkBSQH/ASMBjwFAAf8BLAFeATYB/hAAAzsBZAFHAdoB7AH/AY0D/wFA
A/8BGQGyAboB/wGBAQoBGwH/AR0BxAHRAf8BAAH8Av8BEgH3Af0B/wEHAYkBpwH8AVQBXAFgAcgMAAFQ
AV0BkAHtAUUBbgH5Af8BRgFzAv8BKgFeAv8BIwFYAv8BsgHGAf0B/wH8Af4B/AH/AfwB/gH8Af8BnQG2
Af0B/wEAATUB7QH/AQABMQHdAf8BAAEuAc8B/wEAASsBwgH/AT0BQQFfAe0EAAFYAWIBVQHOAeIB7gHh
Bf8D/Qn/AXgBvgF4Af8BAQF3AQEB/wEAAW8BAAH/AQkBdgEJAf8BdwG8AXcB/wHtAfYB7QH/AfgB9wH4
Af8B6wHqAewB/wHkAd8B4wH/AVkBaAFXAdoEAAFbAaUBZAH+AacB5wGyAf8BoQHjAa4B/wFDAZ4BTwH/
AUMBngFPAf8BcQHFAYgB/wFDAZ4BTwn/AUoBrQFiAf8BQQGnAVsB/wE3AaABUwH/AS4BlwFKAf8BMQFl
AToB/hAAAwoBDgFTAWoBbgHPAYIB+gH+Af8BZAP/ASwBhgGLAf8BWwIAAf8BIgGLAZoB/wEKA/8BBgHp
AfUB/wEUAW4BgAH6AykBPgwAAVEBXgGSAe0BTgF2AfkB/wFSAYAC/wFMAXYC/wE8AWsC/wGxAcUB/QH/
AfwB/gH8Af8B/AH+AfwB/wGlAbsB/QH/AQABOAH6Af8BAAE0AecB/wEAATAB1gH/AQABLAHDAf8BPwFF
AWcB7QQAAVIBVAFSAaYBfwGqAXwB/gT/A/4J/wF3Ab0BdwH/AQABbQEAAf8BBwFwAQcB/wGBAcABgQH/
AfoB/gH6Bf8B8gH0AfIB/wHzAe4B9AH/AckB0QHGAf8BUQFpAVAB4AQAAWIBjgFkAe8BmgHdAaUB/wGw
Ae4BvAH/AaIB4wGwAf8BkgHXAaAB/wGCAc0BkgH/AXQBxwGLAf8BQwGeAU8J/wFOAa4BZQH/AUMBqAFd
Af8BOAGWAU8B/wFHAWYBTAHvFAABPQI+AWoBSAHfAfIB/wF4A/8BNwFeAVwB/wFIAgAB/wE2AUUBTwH/
AQ0D/wEAAawBvwH/AU0BXwFlAdkQAAFYAVoBXwHAAU0BcgHsAf8BYgGNAv8BagGSAv8BlQGvAf4B/wH8
Af4B/AH/AfwB/gH8Af8B/AH+AfwB/wH8Af4B/AH/AWwBlAH+Af8BAAE2Ae8B/wEAATAB3AH/AQYBLQG2
Af8CVQFaAcAEAAMzAVMBPQF+ATkB/AHsAfEB6gH+Bf8B/gb/AWkBtAFpAf8BBQFxAQUB/wF4AbsBeAH/
AfkB/QH5Bf8D/QH/A/IC/wH0Av8BZQGiAV8B/QNEAXkEAAFaAV8BWgHAAYEBzQGLAf8BtwH0AcMB/wGw
Ae8BvAH/AaQB5QGwAf8BlAHZAaIB/wGFAc4BlAH/AXcByQGNAf8BQwGeAU8J/wFRAbEBaAH/AT8BkQFQ
Af8BVwFcAVgBwBQAAxMBGgFRAXABdQHUAWsB/QL/AUkBogGgAf8BJgEaARwB/wErAYsBjgH/AQkD/wEX
AWoBjAH5ATUCNgFYEAADRwGAAUIBZgHcAf8BcgGYAv8BhgGjAv8B/AH+AfwB/wH8Af4B/AH/AYMBoQH+
Af8BdQGbAf4B/wH8Af4B/AH/AfwB/gH8Af8BAAE3AfQB/wEAATIB4AH/ARMBMgGnAf8CRgFHAYAEAAMK
AQ0BWAFnAVYB2AFVAZIBTwH7Cf8B/gL/AZoByQGaAf8BhwHBAYcB/wHyAfkB8gX/A/0B/wH9Af4B/QL/
Af0C/wHPAdMBzAH+AVgBYgFVAc4DCgEOBAADOAFdAWkBpgFtAfcBoAHjAawB/wG3AfQBwwH/AbEB7wG9
Af8BpQHlAbIB/wGWAdoBowH/AYcB0AGWAf8BegHKAY8B/wFDAZ4BTwH/AUMBngFPAf8BWQGxAWwB/wFI
AXsBTAH2AzgBXRgAA0EBcgFAAdAB4QH9AVAB/wH+Af8BGAHgAeIB/wEdAfUB9AH+AQ8BpQGzAfsBSAFh
AWgB3BQAAyMBNAFaAWEBeAHaAVUBeAHtAf8BhwGlAv8BlwGwAv8BeAGdAv8BUwGBAv8BPAFrAv8BIwFY
Av8BCgFEAv8BAAE4AfYB/wENATcBxwH/AVQBWQFtAdoDIwE0CAADJAE1AVMBdAFRAeoBwAHRAb8B+Aj/
AfIB+AHyAf8B/gH/Af4R/wHgAeoB3QH/AVIBcQFPAegDIQEwDAABUgFTAVIBpAFzAbEBewH6AaEB4wGs
Af8BtwH0AcMB/wGxAe8BvQH/AaYB5gGzAf8BmAHcAaUB/wGJAdEBmQH/AYIBzQGSAf8BbQG/AYIB/wFY
AZEBZAH5A1IBpBwAAwsBDwFPAXABdwHXATwB/AH+Af8BRAP/ARQD/wEZAWoBiwH5ATwCPQFnGAADPQFn
AVIBZQGrAfQBVwF6AewB/wF3AZwC/wGHAaQC/wF2AZsC/wFeAYkC/wEnAVsC/wEHAUMC/wESAT8B1QH/
AT0BUQGSAfQBPAI9AWcQAAMzAVIBTQF7AUkB8QGIAaABhAHyAfcB/wH1Ef8B8AH1AewB/wGbAcEBlQH/
AVEBdQFOAe0DMAFLAwEBAhAAAVIBUwFSAaQBawGnAW0B9wGCAc8BjAH/AZoB3wGlAf8BqQHpAbUB/wGg
AeIBrAH/AYcBzgGSAf8BawG6AXYB/wFZAZABYgH2AVIBUwFSAaQkAAM/AW0BHwHiAfAB/wFMAfYB+AH/
AREBvAHGAf0BOQFoAXcB6wMEAQUcAAM9AWcBWgFhAXgB2gFKAWwB3gH/AUwBcgHsAf8BUgF6AfoB/wFN
AXUB+AH/ASoBVwHmAf8BJwFNAcwB/wFXAVwBcgHaATwCPQFnGAADEwEaA0oBigFXAWUBVwHWAVkBbQFW
AeEBWQFmAVcB0wFZAWQBWQHPAVUBcQFSAegBVwFcAVcBwgNOAZgDEgEYAwABARgAAzgBXQFaAV8BWgHA
AWMBkgFmAe8BYQGvAWgB/gFfAawBZgH+AWIBjAFkAe8BWgFfAVoBwAM4AV0oAAMUARsBPgGxAcUB+QE0
Ac0B5gH/AVQBYgFmAckDOAFdJAADIwE0A0cBgAFYAVoBXwHAAVEBXgGSAe0BUAFdAZAB7QFXAVoBXwHA
AUYCRwGAAyMBNCAAAwEBAgMIAQsDDwEUAwgBCwMGAQgDBgEIAwUBBwMBAQLQAAFCAU0BPgcAAT4DAAEo
AwABQAMAASADAAEBAQABAQYAAQEWAAP/gQAB4AEDAv8CAAL/AcABAQHwAQ8CAAHwAQ8BgAEAAeABBwIA
AeABBwIAAcABAwGAAQABwAEDAgABgAEBAYABAAGAAQECAAGAAQEBwAEBAYABAQIAAYABAQHAAQEBgAEB
AgABgAEBAeABAwGAAQECAAGAAQEB4AEDAYABAQIAAYABAQHwAQcBgAEBAgABgAEBAfABBwGAAQECAAGA
AQEB+AEPAYABAQGAAQEBwAEDAfgBDwHAAQMBwAEBAeABBwH8AQ8B4AEHAeABAwHwAQ8B/AEfAfABDwHw
AQ8G/ws=
</value>
</data>
<assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="imgOk.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAB2dJREFUWEfFl4lT
E2Yaxnf9SzqzO23dWg8URQRCwBCOkIRDEMMlUAOIcge5D5EjHAmBcAeQU1cKiOsFVLCKWBVLsbrr6rqj
iMNaC+o61iLx2ff7omxTiUNn3TFMZjIhk9/7PO/7vN+X3wP43Qd9sAI+5PODwrn7y1WvaJevCOzwyt7e
4nnRr8l9zr1S8FJW4wxPvRBedaIFjyrHR+5VghF5vUjla3BbsdzvXVYBQR3ejd714n/taJFCNRAN7bV8
tM7o0TXbgIMP9Ci7lgvVmd0I6vTG1vLNcFRvmPbQO2qWU8Q7CwhslwuDO3zuKP+seFU3WY5Lr4YxitMY
RB/6X3Th0KwBLQ+qUP/PMuj+VoCyyTwUjmdC2aOAWLvF6FS2aVxSLRS8qxCLBRB8R1Cb91zWUAKu/DyC
CZzHRQzhDI7iGIPPNXJ43Z0yVN4s4i4Uf5uJA5dTkTuajPThWPg1ecCucN2Ue6WDv6UilixA0SZzDG73
eVw0moFJ4wV8R7ov4iv668fRn9rR+UM9Gu9pob+thvZ6Pkoms1F0leCXUpFzIQkZX8cj9cweqAajQd+F
LQVrp1x1dks6sWQBoZ2+dzOH4vE9xjh8jEwfRC96n7VR76tRe6cUFX89APVkFgqupiP/8j7kXVQhezTR
BB/eg2SCJ55SIu54BGQ1W+FQaDW+lAtvFRDc4W1Qdge+uvxyGN/iHIcPoAfdTw+ieboSVbeKUTqZg4Lx
dOR9o+KKs0YTkHEuDqln9yJxMBJyvQiJpyMRS/CY/lAouxVwKFpvFJZsfGswzQpgUaOYzVZcLcAVjOAC
oQdIeffTFjQRvPJmIdQTWdhPinMuJCPrXALSzsZi33AMUr6KQfzpXXDXCJDSuxcPn80gfSAekT1B2HVE
QVF1waa8VdOUErOImhWwo02WQRnn4PM4xW3/8t+tXLnuZgGKJzJJdQq3Ou1rAo/sQQrFL3koCntPhMOj
whFxR5RYeLVAbgNzz39ExqlEhB/ejtCObbDJ+xyOxdaqX7bCrAC/ZvexxIFI0n6MwtaDvuemnuv/Xgz1
d1nc8szzpJrBSXXyUDSS6PN7j4dDohNid1fYIpwV8I8fbyG2LwIhBKdEwbnUBrb5a0YsFuDdIJ5lUTpp
PII+mvaOh3WooYErncxF/jf7eK+Z5SlnTHBWbOyJCEgqhIjqDMH8ws9cOXtMPb7L4aFdvggm+I4WOdx1
AmzIXjljsQBxhd3L+nvl6KFp73rUwKOmvXEAhVfSuY27aJjYxksiyxMHlDRk4fCsdMIXbQoz+IMn903K
D5HydgaXwb9JCnmNCGvS/zhvsQCrrE/Q/rAWHZTz5vtV0N9Sc+tbb9Th3O1huJTY0lTv5HBmu0zvjNDm
bWbw6SdTSOiPQkjXa3irHAHNnvBr9IB3rSs+S/mIGbTYerMZWJ32Bxju6WC4ryPrS6C5vh99dw4t9rV1
zMCnfM9fwiCrckaQwccM/sOzh6/hPqDzAwqCbyf4NoL71LlCXi16dwE2+z+fL6aYVdOGqyDr2eum63rM
G5lrpkfS4RiIS+0Q0CDF45/mFt+fpYlP6I8k5T4IbPciuAwUaa7cp57gNS5wo5SsSXtHC2hRzCQOKrly
9UQO7fU0ilwSDk7WLoJevHyBMMN23J+7awZPPhaNkE6Cd3iB4myCG9zh0+AGr2oXSGk5OattYJX5ieUh
dNPZj9Ay+u+hMpZMqzWOlsxu9N/sXgSyFwtGU9Znnz9C6ol4BNNRzOGtUpPtdBBx20m5VL+VD+uW/LWw
zvmT5RhKa5xVzmU2yL9k2nRv9nrSYBTiTkZg6PZJsyKevniCtOMMzmyXL8LZKejT4AqvWoLTrEgqnPiS
ssr8lC0jy4vIq160wqF4/XR4dwDSz9Jup/WaNBCF+JNf8MGLORaGazMTvIjjN3oRdtjfNGxtJrh/s4R6
TraznhOcpUSic4K7VgBBoTWzf9o2f7XlVczi4VZprxFpbI1MdRIdKHEnTPDooyF00QhEdG8I9OfLEdpJ
MeNwGQLopuRPqn0J7s0HTkTwrZBUCuFBcNdye2zIWmncmPuZ5pcRZK+XPI4dS6zHmYWxBGe5j+oLhvJL
BSKOBGDnIT++3diCURykYWuW8ouHb6Mb5VxMR6+Ieu4Mj9fK3TQOsN2/FuuzPl3ecWxywUHALhHsi6N6
g/kGZJtwZ5cf6IqGwFaKGW03Nmx80utp0hmcVEtp2Ni5wPYFgzscsMK6jI+nqPeCX6u36AD7h4t2i//m
/NVTdNs1qSbLg7lq02bzN0howZDlNOleNOmyKrK8ioZNK4Sb1gHiMjuu3ARf9duuZG8qFWk2MyfG7QrW
GT31TqSa4E1suUjg20BwUs22G7NcQso5nJQ7FKznPWe2W1L+hrGsazklQ0MDNL0pdxWEamuINXYEdOSW
e1LMxBp7CIs2kuI1bNJhlfHx9MactwfuN7Xg1x+mLbnCvtBKRYpGSNkMW6nsYGFPOkPmCTpjnb1yhG49
Kmrd+/1hslTl7+u9ZbXgfcH+pxb8v4r4D3QRmLe5k804AAAAAElFTkSuQmCC
</value>
</data>
<data name="imgError.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAABrtJREFUWEftV2lQ
k1cUdfqvM/3ZaafTuqAEcGUnmBBUkEUDCYKIEdyK4L5L3bBjrXWwVutC25lqraMVx9YfVqodq1XrdLQu
gJAQCFkISUB2RQKBfIHT+74QCYWA7d/6Zt58AfK+c+659577GDXq9XqtgJsCAEZ52tqYaT5aach6vTy8
xJw6s7N+UbTDnBLB1ciEdpM0tL1S7PNnVaRvFm2f4d7D/uZxDXWwaobfW5Yls2+156Q7kL8LOHfIuU/Q
5y8/Ag5tRecKKcxzgqEMm4DioLG2igjBWW2Ez/ueiLwyAUOyMMW2JY3DqU+Bi0eB+5cB1R3g4TXgxgWg
IB84thvYkwmsmwd7Zhxa5otQGemHJ8HjGjQSH8VQJF6JQM2CyBP2LQt7cXgr8ICAzY+A6vvofXwNvXcu
oqfwJHrOfQ7H8R3gPlsD+64lsG9OhW1dEp4rJDDFB6AocEw3qbH3nyRGJGBaIE7s2rygFyfprPYuUF8K
qG8BRb86wa98C8fZg07w/ath35EB+8YUdKyWoXOtHC+y56J1eSzqZCF4EubVVSHypnz119ewBKiI3mzN
nNONo5RfBt5UBtvtAui2JkO7IQHalTFoyF0CxzEC35cNbns6WrJioU+aBp18KnSyKXiqEKMpIwr1CyNh
nBuIooDR1kqJj9RFYlgCNWkzrmDvCoq2EGgsoZzfguX0QXDPm9Fp0sGqVUGdswiNWTGwb5oP6+pEKJfO
hLVKxe925UM0bFSgMU2MulQRapOE0ERPQmmYl5KCe2fYLtDF+3/QmB5jx+WvKecPePDex1fRXnAIjloD
ne1fqrQwtCyPhi5NCJu5/29cvRkNWVJYUsWwEHhtUihM0iCUhI7jKsTeO4nEGx4VMCWLsiwZcUDZdcBA
8j+62p/zn75CT8eLlwxa//odepLcdJpa0m09z9tGKYhEbZoE5pTpRCIUNUkhqJjpx6tA7TnaIwGdNPT2
s30rgSfX0VvkrPZeVnBnDoDLW0+V/8MAMANrQbfVUXgB9ekzUbtQwitgIgLm5DCYZMHQxk/D44DRnZUR
AoVHAhWz/Z9yR5xt13vzPHp+dlY7l7cB3KZUdFGlc+XFA0BdP3Tr1QQ+g4/cQrk3pYTDmBQGoywUxsRg
6OcG8B1RHj4h3yMBlWSilXe46+fQc+kEehj4kW2w717Gg9vIbDo+zkZPe9sgEs27s/jIzQRe0wdukIfA
QOBGORFIDIJS5N1VJhx/wyOB8nCBFXkbgR/z4fj+APX5TnC5y9G1IRm2tUnoWCNDnUIE85nDAwg0/nYJ
2kR/Ahf3g1PkegLXJgSihsCZAn0E7nokQF5uxfYMstedTnBmMjkKdJK7WdckksQSlEr9wLW1DlKgbJUU
1fNCUE2ys8hZxFqqfq00ENUJQdDRs4/AH54VEAkabYtjgNwPwX2SDTuR6dqygO/1tmwpqhImgVX/UIuR
KoqdAAO5n47AdRQ5A2dPAz2ZEiMqUBEuuFcnDQFWycHlpPP2aiVrbSNrrVNEoPr4ngHYbee/GZSKslle
fLQMnG09ATM1NHHTUCr2bqMauO5RAU2k79ZykQD2FXE8+IuVFPlKKYGLoVw2a4D0HfduwkST79lZmohu
S7t/HZTR3v0EmAq01VGTURwytpm64IBHAuRSXsWBY7paqJi6qfAYgWeZ8aic64d2ddFLGNYFlqWxMCYL
KeehsJEFuxZLxWMyKF5+tin6KipAlcTXXhIy1lgpFswadhbQ5CrQRPjiGY3U5uXxqEsnu92TNSDKpi92
wTiPwOXOSjdvSh/Qmk2njjjBqRhZ7tVkQqXC8a3KMK9ftBKfd0eahl4lQWNbzQnBaFpGI5UIWBRRqON7
3OluzGCclU4AfZXuyrkrcj19h32ulFL0URM7Sf4auhssHXYWuMYlybSWhkd3nZyAUiQwpojJ16n/k8Pd
2oz1uLPNBoGTOux3TPry2ZMdxUKvBpXI+9SI09BFgD3V071PkGzdBgLRyJxDxUJRm2hXk7fr3cBZq/HV
3pdzJrtmjj8PTu94StIX0vUs0PX+EW9Eri8SiTwaIDZN1CR+oLDNfJ1ZK3M3ZjDVsiC+z53GQ1GT5BVx
U52yU+R94EL34F6ZADtE6VDQGNVQShwVdNnUUWT6OQE8IFOB73kWMfW5OmYKX+2s4FjOmezukf9rBVwH
2BWbLhO5NM3KmSJEqLssQsCpIn1RPsOPU0kENmYyBNrCWo1FTQW3mHL+tnvk/5mA6yDzCXrxIpVw/Hfk
aLefCL2U1DEGIvSAORyZzCGa9/EU9XtDAY9I4H/5b+LfOtkpCIxKEREAAAAASUVORK5CYII=
</value>
</data>
</root>

View file

@ -0,0 +1,91 @@
namespace WebsitePanel.Setup
{
partial class ConfirmUninstallPage
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.txtActions = new System.Windows.Forms.RichTextBox();
this.lblIntro = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// txtActions
//
this.txtActions.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.txtActions.BackColor = System.Drawing.SystemColors.Window;
this.txtActions.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.txtActions.Location = new System.Drawing.Point(0, 23);
this.txtActions.Name = "txtActions";
this.txtActions.ReadOnly = true;
this.txtActions.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.Vertical;
this.txtActions.Size = new System.Drawing.Size(457, 181);
this.txtActions.TabIndex = 4;
this.txtActions.Text = "";
//
// lblIntro
//
this.lblIntro.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.lblIntro.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.lblIntro.Location = new System.Drawing.Point(0, 0);
this.lblIntro.Name = "lblIntro";
this.lblIntro.Size = new System.Drawing.Size(457, 20);
this.lblIntro.TabIndex = 5;
this.lblIntro.Text = "Setup Wizard is ready to:";
//
// label1
//
this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.label1.Location = new System.Drawing.Point(0, 207);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(457, 20);
this.label1.TabIndex = 6;
this.label1.Text = "Click \"Next\" to continue.";
//
// ConfirmUninstallPage
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.label1);
this.Controls.Add(this.lblIntro);
this.Controls.Add(this.txtActions);
this.Name = "ConfirmUninstallPage";
this.Size = new System.Drawing.Size(457, 228);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.RichTextBox txtActions;
private System.Windows.Forms.Label lblIntro;
private System.Windows.Forms.Label label1;
}
}

View file

@ -0,0 +1,88 @@
// Copyright (c) 2011, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System;
using System.IO;
using System.Diagnostics;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
namespace WebsitePanel.Setup
{
public partial class ConfirmUninstallPage : BannerWizardPage
{
public ConfirmUninstallPage()
{
InitializeComponent();
}
public UninstallPage UninstallPage { get; set; }
protected override void InitializePageInternal()
{
base.InitializePageInternal();
this.Text = "Confirm Removal";
string name = Wizard.SetupVariables.ComponentFullName;
this.Description = string.Format("Setup Wizard is ready to uninstall {0}.", name);
}
protected internal override void OnBeforeDisplay(EventArgs e)
{
base.OnBeforeDisplay(e);
string componentId = Wizard.SetupVariables.ComponentId;
this.txtActions.Text = GetUninstallActions(componentId);
}
private string GetUninstallActions(string componentId)
{
StringBuilder sb = new StringBuilder();
try
{
List<InstallAction> actions = UninstallPage.GetUninstallActions(componentId);
foreach (InstallAction action in actions)
{
sb.AppendLine(action.Log);
}
//add external currentScenario
foreach (InstallAction extAction in UninstallPage.Actions)
{
sb.AppendLine(extAction.Log);
}
}
catch (Exception ex)
{
Log.WriteError("Uninstall error", ex);
}
return sb.ToString();
}
}
}

View file

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View file

@ -0,0 +1,180 @@
namespace WebsitePanel.Setup
{
partial class DatabasePage
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.txtSqlServer = new System.Windows.Forms.TextBox();
this.lblPassword = new System.Windows.Forms.Label();
this.lblLogin = new System.Windows.Forms.Label();
this.txtLogin = new System.Windows.Forms.TextBox();
this.lblAuthentication = new System.Windows.Forms.Label();
this.lblSqlServer = new System.Windows.Forms.Label();
this.txtPassword = new System.Windows.Forms.TextBox();
this.lblIntro = new System.Windows.Forms.Label();
this.txtDatabase = new System.Windows.Forms.TextBox();
this.lblDatabase = new System.Windows.Forms.Label();
this.cbAuthentication = new System.Windows.Forms.ComboBox();
this.SuspendLayout();
//
// txtSqlServer
//
this.txtSqlServer.Location = new System.Drawing.Point(147, 36);
this.txtSqlServer.Name = "txtSqlServer";
this.txtSqlServer.Size = new System.Drawing.Size(248, 20);
this.txtSqlServer.TabIndex = 2;
this.txtSqlServer.Text = "localhost\\SQLExpress";
//
// lblPassword
//
this.lblPassword.Location = new System.Drawing.Point(55, 118);
this.lblPassword.Name = "lblPassword";
this.lblPassword.Size = new System.Drawing.Size(100, 23);
this.lblPassword.TabIndex = 7;
this.lblPassword.Text = "Password:";
//
// lblLogin
//
this.lblLogin.Location = new System.Drawing.Point(55, 92);
this.lblLogin.Name = "lblLogin";
this.lblLogin.Size = new System.Drawing.Size(100, 23);
this.lblLogin.TabIndex = 5;
this.lblLogin.Text = "Login name:";
//
// txtLogin
//
this.txtLogin.Enabled = false;
this.txtLogin.Location = new System.Drawing.Point(187, 89);
this.txtLogin.Name = "txtLogin";
this.txtLogin.Size = new System.Drawing.Size(208, 20);
this.txtLogin.TabIndex = 6;
//
// lblAuthentication
//
this.lblAuthentication.Location = new System.Drawing.Point(41, 65);
this.lblAuthentication.Name = "lblAuthentication";
this.lblAuthentication.Size = new System.Drawing.Size(100, 23);
this.lblAuthentication.TabIndex = 3;
this.lblAuthentication.Text = "Authentication:";
//
// lblSqlServer
//
this.lblSqlServer.Location = new System.Drawing.Point(41, 39);
this.lblSqlServer.Name = "lblSqlServer";
this.lblSqlServer.Size = new System.Drawing.Size(100, 23);
this.lblSqlServer.TabIndex = 1;
this.lblSqlServer.Text = "SQL Server:";
//
// txtPassword
//
this.txtPassword.Enabled = false;
this.txtPassword.Location = new System.Drawing.Point(187, 115);
this.txtPassword.Name = "txtPassword";
this.txtPassword.PasswordChar = '*';
this.txtPassword.Size = new System.Drawing.Size(208, 20);
this.txtPassword.TabIndex = 8;
//
// lblIntro
//
this.lblIntro.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.lblIntro.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.lblIntro.Location = new System.Drawing.Point(0, 0);
this.lblIntro.Name = "lblIntro";
this.lblIntro.Size = new System.Drawing.Size(457, 33);
this.lblIntro.TabIndex = 0;
this.lblIntro.Text = "The connection information will be used by the Setup Wizard to install the databa" +
"se objects only. ";
//
// txtDatabase
//
this.txtDatabase.Location = new System.Drawing.Point(147, 144);
this.txtDatabase.MaxLength = 128;
this.txtDatabase.Name = "txtDatabase";
this.txtDatabase.Size = new System.Drawing.Size(248, 20);
this.txtDatabase.TabIndex = 10;
//
// lblDatabase
//
this.lblDatabase.Location = new System.Drawing.Point(41, 147);
this.lblDatabase.Name = "lblDatabase";
this.lblDatabase.Size = new System.Drawing.Size(100, 23);
this.lblDatabase.TabIndex = 9;
this.lblDatabase.Text = "Database:";
//
// cbAuthentication
//
this.cbAuthentication.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cbAuthentication.FormattingEnabled = true;
this.cbAuthentication.Items.AddRange(new object[] {
"Windows Authentication",
"SQL Server Authentication"});
this.cbAuthentication.Location = new System.Drawing.Point(147, 62);
this.cbAuthentication.Name = "cbAuthentication";
this.cbAuthentication.Size = new System.Drawing.Size(248, 21);
this.cbAuthentication.TabIndex = 4;
this.cbAuthentication.SelectedIndexChanged += new System.EventHandler(this.OnAuthenticationChanged);
//
// DatabasePage
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.cbAuthentication);
this.Controls.Add(this.txtDatabase);
this.Controls.Add(this.lblDatabase);
this.Controls.Add(this.txtSqlServer);
this.Controls.Add(this.lblPassword);
this.Controls.Add(this.lblLogin);
this.Controls.Add(this.txtLogin);
this.Controls.Add(this.lblAuthentication);
this.Controls.Add(this.lblSqlServer);
this.Controls.Add(this.txtPassword);
this.Controls.Add(this.lblIntro);
this.Name = "DatabasePage";
this.Size = new System.Drawing.Size(457, 228);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.TextBox txtSqlServer;
private System.Windows.Forms.Label lblPassword;
private System.Windows.Forms.Label lblLogin;
private System.Windows.Forms.TextBox txtLogin;
private System.Windows.Forms.Label lblAuthentication;
private System.Windows.Forms.Label lblSqlServer;
private System.Windows.Forms.TextBox txtPassword;
private System.Windows.Forms.Label lblIntro;
private System.Windows.Forms.TextBox txtDatabase;
private System.Windows.Forms.Label lblDatabase;
private System.Windows.Forms.ComboBox cbAuthentication;
}
}

View file

@ -0,0 +1,244 @@
// Copyright (c) 2011, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System;
using System.IO;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Threading;
using System.Windows.Forms;
namespace WebsitePanel.Setup
{
public partial class DatabasePage : BannerWizardPage
{
public DatabasePage()
{
InitializeComponent();
}
protected override void InitializePageInternal()
{
base.InitializePageInternal();
this.Text = "Database Settings";
string component = SetupVariables.ComponentFullName;
this.Description = string.Format("Enter the connection information for the {0} database.", component);
this.lblIntro.Text = "The connection information will be used by the Setup Wizard to install the database objects only. Click Next to continue.";
this.txtDatabase.Text = SetupVariables.Database;
this.txtSqlServer.Text = SetupVariables.DatabaseServer;
this.AllowMoveBack = true;
this.AllowMoveNext = true;
this.AllowCancel = true;
cbAuthentication.SelectedIndex = 0;
ParseConnectionString();
}
private void ParseConnectionString()
{
bool windowsAuthentication = false;
if ( !string.IsNullOrEmpty(SetupVariables.DbInstallConnectionString ))
{
string[] pairs = SetupVariables.DbInstallConnectionString.Split(';');
foreach (string pair in pairs)
{
string[] keyValue = pair.Split('=');
if (keyValue.Length == 2)
{
string key = keyValue[0].Trim().ToLower();
string value = keyValue[1];
switch (key)
{
case "server":
this.txtSqlServer.Text = value;
break;
case "database":
this.txtDatabase.Text = value;
break;
case "integrated security":
if (value.Trim().ToLower() == "sspi")
windowsAuthentication = true;
break;
case "user":
case "user id":
txtLogin.Text = value;
break;
case "password":
txtPassword.Text = value;
break;
}
}
}
cbAuthentication.SelectedIndex = windowsAuthentication ? 0 : 1;
}
}
protected internal override void OnAfterDisplay(EventArgs e)
{
base.OnAfterDisplay(e);
//unattended setup
if (!string.IsNullOrEmpty(SetupVariables.SetupXml))
Wizard.GoNext();
}
protected internal override void OnBeforeMoveNext(CancelEventArgs e)
{
try
{
if (!CheckFields())
{
e.Cancel = true;
return;
}
string connectionString = CreateConnectionString();
string component = SetupVariables.ComponentFullName;
if (CheckConnection(connectionString))
{
// check SQL server version
string sqlVersion = GetSqlServerVersion(connectionString);
if (!sqlVersion.StartsWith("9.") && !sqlVersion.StartsWith("10."))
{
// SQL Server 2005 engine required
e.Cancel = true;
ShowWarning("This program can be installed on SQL Server 2005/2008 only.");
return;
}
int securityMode = GetSqlServerSecurityMode(connectionString);
if (securityMode != 0)
{
// mixed mode required
e.Cancel = true;
ShowWarning("Please switch SQL Server authentication to mixed SQL Server and Windows Authentication mode.");
return;
}
}
else
{
e.Cancel = true;
ShowWarning("SQL Server does not exist or access denied");
return;
}
string database = this.txtDatabase.Text;
if (SqlUtils.DatabaseExists(connectionString, database))
{
e.Cancel = true;
ShowWarning(string.Format("{0} database already exists.", database));
return;
}
string server = this.txtSqlServer.Text;
Log.WriteInfo(string.Format("Sql server \"{0}\" selected for {1}", server, component));
SetupVariables.Database = database;
SetupVariables.DatabaseServer = server;
SetupVariables.DbInstallConnectionString = connectionString;
//AppConfig.SetComponentSettingStringValue(SetupVariables.ComponentId, "Database", database);
//AppConfig.SetComponentSettingStringValue(SetupVariables.ComponentId, "DatabaseServer", server);
//AppConfig.SetComponentSettingStringValue(SetupVariables.ComponentId, "InstallConnectionString", connectionString);
}
catch
{
e.Cancel = true;
ShowError("Unable to configure the database server.");
return;
}
base.OnBeforeMoveNext(e);
}
private void OnAuthenticationChanged(object sender, System.EventArgs e)
{
UpdateFields();
}
private void UpdateFields()
{
bool winAuthentication = (cbAuthentication.SelectedIndex == 0);
txtLogin.Enabled = !winAuthentication;
txtPassword.Enabled = !winAuthentication;
lblLogin.Enabled = !winAuthentication;
lblPassword.Enabled = !winAuthentication;
Update();
}
private bool CheckFields()
{
if (txtSqlServer.Text.Trim().Length == 0)
{
ShowWarning("Please enter valid SQL Server name.");
return false;
}
if (cbAuthentication.SelectedIndex == 1)
{
if (txtLogin.Text.Trim().Length == 0)
{
ShowWarning("Please enter valid Login name.");
return false;
}
}
string database = txtDatabase.Text;
if (database.Trim().Length == 0 || !SqlUtils.IsValidDatabaseName(database))
{
ShowWarning("Please enter valid database name.");
return false;
}
return true;
}
private bool CheckConnection(string connectionString)
{
return SqlUtils.CheckSqlConnection(connectionString);
}
private string GetSqlServerVersion(string connectionString)
{
return SqlUtils.GetSqlServerVersion(connectionString);
}
private int GetSqlServerSecurityMode(string connectionString)
{
return SqlUtils.GetSqlServerSecurityMode(connectionString);
}
private string CreateConnectionString()
{
if (cbAuthentication.SelectedIndex == 0)
{
return SqlUtils.BuildDbServerMasterConnectionString(txtSqlServer.Text, null, null);
}
else
{
return SqlUtils.BuildDbServerMasterConnectionString(txtSqlServer.Text, txtLogin.Text, txtPassword.Text);
}
}
}
}

View file

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View file

@ -0,0 +1,92 @@
namespace WebsitePanel.Setup
{
partial class ExpressInstallPage
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.grpFiles = new System.Windows.Forms.GroupBox();
this.progressBar = new System.Windows.Forms.ProgressBar();
this.lblProcess = new System.Windows.Forms.Label();
this.lblIntro = new System.Windows.Forms.Label();
this.grpFiles.SuspendLayout();
this.SuspendLayout();
//
// grpFiles
//
this.grpFiles.Controls.Add(this.progressBar);
this.grpFiles.Controls.Add(this.lblProcess);
this.grpFiles.Location = new System.Drawing.Point(0, 43);
this.grpFiles.Name = "grpFiles";
this.grpFiles.Size = new System.Drawing.Size(457, 88);
this.grpFiles.TabIndex = 4;
this.grpFiles.TabStop = false;
//
// progressBar
//
this.progressBar.Location = new System.Drawing.Point(16, 40);
this.progressBar.Name = "progressBar";
this.progressBar.Size = new System.Drawing.Size(427, 23);
this.progressBar.Step = 1;
this.progressBar.Style = System.Windows.Forms.ProgressBarStyle.Continuous;
this.progressBar.TabIndex = 1;
//
// lblProcess
//
this.lblProcess.Location = new System.Drawing.Point(16, 24);
this.lblProcess.Name = "lblProcess";
this.lblProcess.Size = new System.Drawing.Size(427, 16);
this.lblProcess.TabIndex = 0;
//
// lblIntro
//
this.lblIntro.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.lblIntro.Location = new System.Drawing.Point(3, 0);
this.lblIntro.Name = "lblIntro";
this.lblIntro.Size = new System.Drawing.Size(451, 40);
this.lblIntro.TabIndex = 5;
//
// ExpressInstallPage
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.grpFiles);
this.Controls.Add(this.lblIntro);
this.Name = "ExpressInstallPage";
this.Size = new System.Drawing.Size(457, 228);
this.grpFiles.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.GroupBox grpFiles;
private System.Windows.Forms.ProgressBar progressBar;
private System.Windows.Forms.Label lblProcess;
private System.Windows.Forms.Label lblIntro;
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View file

@ -0,0 +1,92 @@
namespace WebsitePanel.Setup
{
partial class ExpressInstallPage2
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.grpFiles = new System.Windows.Forms.GroupBox();
this.progressBar = new System.Windows.Forms.ProgressBar();
this.lblProcess = new System.Windows.Forms.Label();
this.lblIntro = new System.Windows.Forms.Label();
this.grpFiles.SuspendLayout();
this.SuspendLayout();
//
// grpFiles
//
this.grpFiles.Controls.Add(this.progressBar);
this.grpFiles.Controls.Add(this.lblProcess);
this.grpFiles.Location = new System.Drawing.Point(0, 43);
this.grpFiles.Name = "grpFiles";
this.grpFiles.Size = new System.Drawing.Size(457, 88);
this.grpFiles.TabIndex = 4;
this.grpFiles.TabStop = false;
//
// progressBar
//
this.progressBar.Location = new System.Drawing.Point(16, 40);
this.progressBar.Name = "progressBar";
this.progressBar.Size = new System.Drawing.Size(427, 23);
this.progressBar.Step = 1;
this.progressBar.Style = System.Windows.Forms.ProgressBarStyle.Continuous;
this.progressBar.TabIndex = 1;
//
// lblProcess
//
this.lblProcess.Location = new System.Drawing.Point(16, 24);
this.lblProcess.Name = "lblProcess";
this.lblProcess.Size = new System.Drawing.Size(427, 16);
this.lblProcess.TabIndex = 0;
//
// lblIntro
//
this.lblIntro.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.lblIntro.Location = new System.Drawing.Point(3, 0);
this.lblIntro.Name = "lblIntro";
this.lblIntro.Size = new System.Drawing.Size(451, 40);
this.lblIntro.TabIndex = 5;
//
// ExpressInstallPage
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.grpFiles);
this.Controls.Add(this.lblIntro);
this.Name = "ExpressInstallPage";
this.Size = new System.Drawing.Size(457, 228);
this.grpFiles.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.GroupBox grpFiles;
private System.Windows.Forms.ProgressBar progressBar;
private System.Windows.Forms.Label lblProcess;
private System.Windows.Forms.Label lblIntro;
}
}

View file

@ -0,0 +1,218 @@
// Copyright (c) 2011, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System;
using System.IO;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Text.RegularExpressions;
using System.Xml;
using System.Threading;
using System.Windows.Forms;
using WebsitePanel.Setup.Common;
using WebsitePanel.Setup.Web;
using WebsitePanel.Setup.Windows;
using System.Data.SqlClient;
using WebsitePanel.EnterpriseServer;
using WebsitePanel.Providers.Common;
using WebsitePanel.Providers.ResultObjects;
using System.Reflection;
using System.Collections.Specialized;
using WebsitePanel.Setup.Actions;
namespace WebsitePanel.Setup
{
public partial class ExpressInstallPage2 : BannerWizardPage
{
private Thread thread;
public ExpressInstallPage2()
{
InitializeComponent();
//
this.CustomCancelHandler = true;
}
delegate void StringCallback(string value);
delegate void IntCallback(int value);
private void SetProgressValue(int value)
{
//thread safe call
if (InvokeRequired)
{
IntCallback callback = new IntCallback(SetProgressValue);
Invoke(callback, new object[] { value });
}
else
{
progressBar.Value = value;
Update();
}
}
private void SetProgressText(string text)
{
//thread safe call
if (InvokeRequired)
{
StringCallback callback = new StringCallback(SetProgressText);
Invoke(callback, new object[] { text });
}
else
{
lblProcess.Text = text;
Update();
}
}
protected internal override void OnBeforeDisplay(EventArgs e)
{
base.OnBeforeDisplay(e);
string name = Wizard.SetupVariables.ComponentFullName;
this.Text = string.Format("Installing {0}", name);
this.Description = string.Format("Please wait while {0} is being installed.", name);
this.AllowMoveBack = false;
this.AllowMoveNext = false;
this.AllowCancel = false;
}
protected internal override void OnAfterDisplay(EventArgs e)
{
base.OnAfterDisplay(e);
thread = new Thread(new ThreadStart(this.Start));
thread.Start();
}
/// <summary>
/// Displays process progress.
/// </summary>
public void Start()
{
SetProgressValue(0);
string component = Wizard.SetupVariables.ComponentFullName;
string componentName = Wizard.SetupVariables.ComponentName;
try
{
SetProgressText("Creating installation script...");
Wizard.ActionManager.ActionProgressChanged += new EventHandler<ActionProgressEventArgs<int>>((object sender, ActionProgressEventArgs<int> e) =>
{
SetProgressText(e.StatusMessage);
});
Wizard.ActionManager.TotalProgressChanged += new EventHandler<ProgressEventArgs>((object sender, ProgressEventArgs e) =>
{
SetProgressValue(e.Value);
});
Wizard.ActionManager.ActionError += new EventHandler<ActionErrorEventArgs>((object sender, ActionErrorEventArgs e) =>
{
ShowError();
Rollback();
//
return;
});
Wizard.ActionManager.Start();
//this.progressBar.EventData = 100;
}
catch (Exception ex)
{
if (Utils.IsThreadAbortException(ex))
return;
return;
}
SetProgressText("Completed. Click Next to continue.");
this.AllowMoveNext = true;
this.AllowCancel = false;
//unattended setup
if (!string.IsNullOrEmpty(SetupVariables.SetupXml))
Wizard.GoNext();
}
private void InitSetupVaribles(SetupVariables setupVariables)
{
try
{
Wizard.SetupVariables = setupVariables.Clone();
}
catch (Exception ex)
{
if (Utils.IsThreadAbortException(ex))
return;
}
}
protected override void InitializePageInternal()
{
base.InitializePageInternal();
if (this.Wizard != null)
{
this.Wizard.Cancel += new EventHandler(OnWizardCancel);
}
Form parentForm = FindForm();
parentForm.FormClosing += new FormClosingEventHandler(OnFormClosing);
}
void OnFormClosing(object sender, FormClosingEventArgs e)
{
AbortProcess();
}
private void OnWizardCancel(object sender, EventArgs e)
{
AbortProcess();
this.CustomCancelHandler = false;
Wizard.Close();
}
private void AbortProcess()
{
if (this.thread != null)
{
if (this.thread.IsAlive)
{
this.thread.Abort();
}
this.thread.Join();
}
}
}
}

View file

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View file

@ -0,0 +1,64 @@
namespace WebsitePanel.Setup
{
partial class FinishPage
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.txtLog = new System.Windows.Forms.RichTextBox();
this.SuspendLayout();
//
// txtLog
//
this.txtLog.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.txtLog.BackColor = System.Drawing.SystemColors.Window;
this.txtLog.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.txtLog.Location = new System.Drawing.Point(0, 55);
this.txtLog.Name = "txtLog";
this.txtLog.ReadOnly = true;
this.txtLog.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.Vertical;
this.txtLog.Size = new System.Drawing.Size(457, 145);
this.txtLog.TabIndex = 4;
this.txtLog.Text = "";
this.txtLog.LinkClicked += new System.Windows.Forms.LinkClickedEventHandler(this.OnLinkClicked);
//
// FinishPage
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.txtLog);
this.Name = "FinishPage";
this.Size = new System.Drawing.Size(457, 228);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.RichTextBox txtLog;
}
}

View file

@ -0,0 +1,75 @@
// Copyright (c) 2011, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System;
using System.Diagnostics;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
namespace WebsitePanel.Setup
{
public partial class FinishPage : BannerWizardPage
{
public FinishPage()
{
InitializeComponent();
}
protected internal override void OnBeforeDisplay(EventArgs e)
{
base.OnBeforeDisplay(e);
this.Text = "Setup complete";
this.Description = "Click Finish to exit the wizard.";
this.AllowMoveBack = false;
this.AllowCancel = false;
this.txtLog.Text = InstallLog.ToString();
}
protected internal override void OnAfterDisplay(EventArgs e)
{
base.OnAfterDisplay(e);
//unattended setup
if (!string.IsNullOrEmpty(SetupVariables.SetupXml))
Wizard.GoNext();
}
private void OnLinkClicked(object sender, LinkClickedEventArgs e)
{
Process.Start(e.LinkText);
}
private void OnViewLogLinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
Log.ShowLogFile();
}
}
}

View file

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View file

@ -0,0 +1,151 @@
namespace WebsitePanel.Setup
{
partial class InstallFolderPage
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.grpFolder = new System.Windows.Forms.GroupBox();
this.txtFolder = new System.Windows.Forms.TextBox();
this.btnBrowse = new System.Windows.Forms.Button();
this.lblIntro = new System.Windows.Forms.Label();
this.lblSpaceRequired = new System.Windows.Forms.Label();
this.lblSpaceAvailable = new System.Windows.Forms.Label();
this.lblSpaceAvailableValue = new System.Windows.Forms.Label();
this.lblSpaceRequiredValue = new System.Windows.Forms.Label();
this.grpFolder.SuspendLayout();
this.SuspendLayout();
//
// grpFolder
//
this.grpFolder.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.grpFolder.Controls.Add(this.txtFolder);
this.grpFolder.Controls.Add(this.btnBrowse);
this.grpFolder.Location = new System.Drawing.Point(0, 82);
this.grpFolder.Name = "grpFolder";
this.grpFolder.Size = new System.Drawing.Size(454, 64);
this.grpFolder.TabIndex = 4;
this.grpFolder.TabStop = false;
this.grpFolder.Text = "Destination Folder";
//
// txtFolder
//
this.txtFolder.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.txtFolder.Location = new System.Drawing.Point(24, 24);
this.txtFolder.Name = "txtFolder";
this.txtFolder.Size = new System.Drawing.Size(332, 20);
this.txtFolder.TabIndex = 1;
this.txtFolder.TextChanged += new System.EventHandler(this.OnFolderChanged);
//
// btnBrowse
//
this.btnBrowse.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnBrowse.Location = new System.Drawing.Point(362, 22);
this.btnBrowse.Name = "btnBrowse";
this.btnBrowse.Size = new System.Drawing.Size(75, 23);
this.btnBrowse.TabIndex = 0;
this.btnBrowse.Text = "B&rowse...";
this.btnBrowse.Click += new System.EventHandler(this.OnBrowseClick);
//
// lblIntro
//
this.lblIntro.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.lblIntro.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.lblIntro.Location = new System.Drawing.Point(0, 0);
this.lblIntro.Name = "lblIntro";
this.lblIntro.Size = new System.Drawing.Size(457, 56);
this.lblIntro.TabIndex = 5;
this.lblIntro.Text = "Setup will install WebsitePanel in the following folder. To install in a different" +
" folder, click Browse and select another folder. Click Next to continue.";
//
// lblSpaceRequired
//
this.lblSpaceRequired.Location = new System.Drawing.Point(3, 164);
this.lblSpaceRequired.Name = "lblSpaceRequired";
this.lblSpaceRequired.Size = new System.Drawing.Size(144, 16);
this.lblSpaceRequired.TabIndex = 6;
this.lblSpaceRequired.Text = "Total disk space required:";
//
// lblSpaceAvailable
//
this.lblSpaceAvailable.Location = new System.Drawing.Point(3, 183);
this.lblSpaceAvailable.Name = "lblSpaceAvailable";
this.lblSpaceAvailable.Size = new System.Drawing.Size(144, 16);
this.lblSpaceAvailable.TabIndex = 7;
this.lblSpaceAvailable.Text = "Space available on disk:";
//
// lblSpaceAvailableValue
//
this.lblSpaceAvailableValue.Location = new System.Drawing.Point(153, 183);
this.lblSpaceAvailableValue.Name = "lblSpaceAvailableValue";
this.lblSpaceAvailableValue.Size = new System.Drawing.Size(134, 16);
this.lblSpaceAvailableValue.TabIndex = 9;
this.lblSpaceAvailableValue.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
// lblSpaceRequiredValue
//
this.lblSpaceRequiredValue.Location = new System.Drawing.Point(153, 164);
this.lblSpaceRequiredValue.Name = "lblSpaceRequiredValue";
this.lblSpaceRequiredValue.Size = new System.Drawing.Size(134, 16);
this.lblSpaceRequiredValue.TabIndex = 8;
this.lblSpaceRequiredValue.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
// InstallFolderPage
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.lblSpaceAvailableValue);
this.Controls.Add(this.lblSpaceRequiredValue);
this.Controls.Add(this.lblSpaceAvailable);
this.Controls.Add(this.lblSpaceRequired);
this.Controls.Add(this.grpFolder);
this.Controls.Add(this.lblIntro);
this.Name = "InstallFolderPage";
this.Size = new System.Drawing.Size(457, 228);
this.grpFolder.ResumeLayout(false);
this.grpFolder.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.GroupBox grpFolder;
private System.Windows.Forms.TextBox txtFolder;
private System.Windows.Forms.Button btnBrowse;
private System.Windows.Forms.Label lblIntro;
private System.Windows.Forms.Label lblSpaceRequired;
private System.Windows.Forms.Label lblSpaceAvailable;
private System.Windows.Forms.Label lblSpaceAvailableValue;
private System.Windows.Forms.Label lblSpaceRequiredValue;
}
}

View file

@ -0,0 +1,163 @@
// Copyright (c) 2011, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System;
using System.IO;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Threading;
using System.Windows.Forms;
namespace WebsitePanel.Setup
{
public partial class InstallFolderPage : BannerWizardPage
{
public InstallFolderPage()
{
InitializeComponent();
}
private long spaceRequired = 0;
protected override void InitializePageInternal()
{
this.Text = "Choose Install Location";
string component = Wizard.SetupVariables.ComponentFullName;
this.Description = string.Format("Choose the folder in which to install {0}.", component);
this.lblIntro.Text = string.Format("Setup will install {0} in the following folder. To install in a different folder, click Browse and select another folder. Click Next to continue.", component);
this.AllowMoveBack = false;
this.AllowMoveNext = true;
this.AllowCancel = true;
UpdateSpaceRequiredInformation();
if ( !string.IsNullOrEmpty(Wizard.SetupVariables.InstallationFolder))
{
txtFolder.Text = Wizard.SetupVariables.InstallationFolder;
}
}
private void UpdateSpaceRequiredInformation()
{
try
{
spaceRequired = 0;
lblSpaceRequiredValue.Text = string.Empty;
if (!string.IsNullOrEmpty(Wizard.SetupVariables.InstallerFolder))
{
spaceRequired = FileUtils.CalculateFolderSize(Wizard.SetupVariables.InstallerFolder);
lblSpaceRequiredValue.Text = FileUtils.SizeToMB(spaceRequired);
}
}
catch (Exception ex)
{
Log.WriteError("I/O error:", ex);
}
}
protected internal override void OnAfterDisplay(EventArgs e)
{
base.OnAfterDisplay(e);
////unattended setup
if (!string.IsNullOrEmpty(Wizard.SetupVariables.SetupXml) && AllowMoveNext)
Wizard.GoNext();
}
private void OnBrowseClick(object sender, System.EventArgs e)
{
FolderBrowserDialog dialog = new FolderBrowserDialog();
dialog.RootFolder = Environment.SpecialFolder.MyComputer;
dialog.SelectedPath = txtFolder.Text;
if (dialog.ShowDialog() == DialogResult.OK)
{
txtFolder.Text = dialog.SelectedPath;
}
}
protected internal override void OnBeforeMoveNext(CancelEventArgs e)
{
try
{
string installFolder = this.txtFolder.Text;
Log.WriteInfo(string.Format("Destination folder \"{0}\" selected", installFolder));
if (!Directory.Exists(installFolder))
{
Log.WriteStart(string.Format("Creating a new folder \"{0}\"", installFolder));
Directory.CreateDirectory(installFolder);
Log.WriteStart("Created a new folder");
}
Wizard.SetupVariables.InstallationFolder = installFolder;
base.OnBeforeMoveNext(e);
}
catch (Exception ex)
{
Log.WriteError("Folder create error", ex);
e.Cancel = true;
ShowError("Unable to create the folder.");
}
}
private void OnFolderChanged(object sender, EventArgs e)
{
UpdateFreeSpaceInformation();
}
private void UpdateFreeSpaceInformation()
{
lblSpaceAvailableValue.Text = string.Empty;
this.AllowMoveNext = false;
try
{
if ( string.IsNullOrEmpty(txtFolder.Text))
return;
string path = Path.GetFullPath(txtFolder.Text);
string drive = Path.GetPathRoot(path);
ulong freeBytesAvailable, totalBytes, freeBytes;
if (FileUtils.GetDiskFreeSpaceEx(drive, out freeBytesAvailable, out totalBytes, out freeBytes))
{
long freeSpace = Convert.ToInt64(freeBytesAvailable);
lblSpaceAvailableValue.Text = FileUtils.SizeToMB(freeSpace);
this.AllowMoveNext = (freeSpace >= spaceRequired);
}
}
catch (Exception ex)
{
Log.WriteError("I/O error:", ex);
this.AllowMoveNext = false;
}
}
}
}

View file

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View file

@ -0,0 +1,93 @@
// Copyright (c) 2011, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
namespace WebsitePanel.Setup
{
public class IntroductionPage : MarginWizardPage
{
public IntroductionPage()
{
}
protected override void InitializePageInternal()
{
string product = Wizard.SetupVariables.Product;
if (string.IsNullOrEmpty(product))
product = "WebsitePanel";
this.introductionText = string.Format("This wizard will guide you through the installation of {0} product.\n\n" +
"It is recommended that you close all other applications before starting Setup. This will make it possible to update relevant system files without having to reboot your computer.",
product);
this.Text = string.Format("Welcome to the {0} Setup Wizard", product);
}
protected internal override void OnAfterDisplay(EventArgs e)
{
base.OnAfterDisplay(e);
//unattended setup
if (!string.IsNullOrEmpty(Wizard.SetupVariables.SetupXml) && AllowMoveNext)
Wizard.GoNext();
}
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
using (StringFormat format = new StringFormat(StringFormat.GenericDefault))
{
using (SolidBrush brush = new SolidBrush(this.ForeColor))
{
format.Alignment = StringAlignment.Near;
format.LineAlignment = StringAlignment.Near;
e.Graphics.DrawString(this.IntroductionText, this.Font, brush, (RectangleF) base.ClientRectangle, format);
}
}
}
public string IntroductionText
{
get
{
return this.introductionText;
}
set
{
this.introductionText = value;
base.Invalidate();
}
}
private string introductionText;
}
}

View file

@ -0,0 +1,91 @@
namespace WebsitePanel.Setup
{
partial class LicenseAgreementPage
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.txtLicense = new System.Windows.Forms.RichTextBox();
this.lblIntro = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// txtLicense
//
this.txtLicense.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.txtLicense.BackColor = System.Drawing.SystemColors.Window;
this.txtLicense.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.txtLicense.Location = new System.Drawing.Point(0, 23);
this.txtLicense.Name = "txtLicense";
this.txtLicense.ReadOnly = true;
this.txtLicense.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.Vertical;
this.txtLicense.Size = new System.Drawing.Size(457, 181);
this.txtLicense.TabIndex = 4;
this.txtLicense.Text = "";
//
// lblIntro
//
this.lblIntro.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.lblIntro.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.lblIntro.Location = new System.Drawing.Point(0, 0);
this.lblIntro.Name = "lblIntro";
this.lblIntro.Size = new System.Drawing.Size(457, 20);
this.lblIntro.TabIndex = 5;
this.lblIntro.Text = "Press Page Down to see the rest of the agreement.";
//
// label1
//
this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.label1.Location = new System.Drawing.Point(0, 207);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(457, 20);
this.label1.TabIndex = 6;
this.label1.Text = "If you accept the terms of the agreement, click I Agree to continue.";
//
// LicensePage
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.label1);
this.Controls.Add(this.lblIntro);
this.Controls.Add(this.txtLicense);
this.Name = "LicensePage";
this.Size = new System.Drawing.Size(457, 228);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.RichTextBox txtLicense;
private System.Windows.Forms.Label lblIntro;
private System.Windows.Forms.Label label1;
}
}

View file

@ -0,0 +1,100 @@
// Copyright (c) 2011, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System;
using System.IO;
using System.Diagnostics;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
namespace WebsitePanel.Setup
{
public partial class LicenseAgreementPage : BannerWizardPage
{
private string nextText;
public LicenseAgreementPage()
{
InitializeComponent();
}
protected override void InitializePageInternal()
{
base.InitializePageInternal();
this.Text = "License Agreement";
this.Description = "Please review the license terms before installing the product";
try
{
using (Stream stream = Utils.GetResourceStream("WebsitePanel.Setup.EULA.rtf"))
{
using (StreamReader sr = new StreamReader(stream))
{
this.txtLicense.Rtf = sr.ReadToEnd();
}
}
}
catch (Exception ex)
{
Log.WriteError("License agreement error", ex);
}
}
protected internal override void OnBeforeDisplay(EventArgs e)
{
base.OnBeforeDisplay(e);
nextText = this.Wizard.NextText;
}
protected internal override void OnAfterDisplay(EventArgs e)
{
base.OnAfterDisplay(e);
this.Wizard.NextText = "I &Agree";
//unattended setup
if (!string.IsNullOrEmpty(Wizard.SetupVariables.SetupXml) && AllowMoveNext)
Wizard.GoNext();
}
protected internal override void OnBeforeMoveNext(CancelEventArgs e)
{
this.Wizard.NextText = nextText;
base.OnBeforeMoveNext(e);
}
protected internal override void OnBeforeMoveBack(CancelEventArgs e)
{
this.Wizard.NextText = nextText;
base.OnBeforeMoveBack(e);
}
}
}

View file

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View file

@ -0,0 +1,110 @@
// Copyright (c) 2011, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
namespace WebsitePanel.Setup
{
public abstract class MarginWizardPage : WizardPageBase
{
protected MarginWizardPage()
{
this.proceedText = "To continue, click Next.";
this.BackColor = SystemColors.Window;
}
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
using (StringFormat format = new StringFormat(StringFormat.GenericDefault))
{
using (SolidBrush brush = new SolidBrush(this.ForeColor))
{
format.Alignment = StringAlignment.Near;
format.LineAlignment = StringAlignment.Far;
e.Graphics.DrawString(this.ProceedText, this.Font, brush, (RectangleF) base.ClientRectangle, format);
}
}
}
[DefaultValue(typeof(Color), "Window")]
public override Color BackColor
{
get
{
return base.BackColor;
}
set
{
base.BackColor = value;
if (base.IsCurrentPage)
{
base.Parent.Invalidate();
}
}
}
public override Color ForeColor
{
get
{
return base.ForeColor;
}
set
{
base.ForeColor = value;
if (base.IsCurrentPage)
{
base.Parent.Invalidate();
}
}
}
[DefaultValue("To continue, click Next.")]
public virtual string ProceedText
{
get
{
return this.proceedText;
}
set
{
this.proceedText = value;
base.Invalidate();
}
}
private string proceedText;
}
}

View file

@ -0,0 +1,92 @@
namespace WebsitePanel.Setup
{
partial class RollBackPage
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.grpFiles = new System.Windows.Forms.GroupBox();
this.progressBar = new System.Windows.Forms.ProgressBar();
this.lblProcess = new System.Windows.Forms.Label();
this.lblIntro = new System.Windows.Forms.Label();
this.grpFiles.SuspendLayout();
this.SuspendLayout();
//
// grpFiles
//
this.grpFiles.Controls.Add(this.progressBar);
this.grpFiles.Controls.Add(this.lblProcess);
this.grpFiles.Location = new System.Drawing.Point(0, 43);
this.grpFiles.Name = "grpFiles";
this.grpFiles.Size = new System.Drawing.Size(457, 88);
this.grpFiles.TabIndex = 4;
this.grpFiles.TabStop = false;
//
// progressBar
//
this.progressBar.Location = new System.Drawing.Point(16, 40);
this.progressBar.Name = "progressBar";
this.progressBar.Size = new System.Drawing.Size(427, 23);
this.progressBar.Step = 1;
this.progressBar.Style = System.Windows.Forms.ProgressBarStyle.Continuous;
this.progressBar.TabIndex = 1;
//
// lblProcess
//
this.lblProcess.Location = new System.Drawing.Point(16, 24);
this.lblProcess.Name = "lblProcess";
this.lblProcess.Size = new System.Drawing.Size(427, 16);
this.lblProcess.TabIndex = 0;
//
// lblIntro
//
this.lblIntro.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.lblIntro.Location = new System.Drawing.Point(3, 0);
this.lblIntro.Name = "lblIntro";
this.lblIntro.Size = new System.Drawing.Size(451, 40);
this.lblIntro.TabIndex = 5;
//
// RollBackPage
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.grpFiles);
this.Controls.Add(this.lblIntro);
this.Name = "RollBackPage";
this.Size = new System.Drawing.Size(457, 228);
this.grpFiles.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.GroupBox grpFiles;
private System.Windows.Forms.ProgressBar progressBar;
private System.Windows.Forms.Label lblProcess;
private System.Windows.Forms.Label lblIntro;
}
}

View file

@ -0,0 +1,101 @@
// Copyright (c) 2011, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Threading;
using System.Windows.Forms;
using WebsitePanel.Setup.Web;
using WebsitePanel.Setup.Windows;
using WebsitePanel.Setup.Actions;
namespace WebsitePanel.Setup
{
public partial class RollBackPage : BannerWizardPage
{
private Thread thread;
public RollBackPage()
{
InitializeComponent();
}
protected override void InitializePageInternal()
{
base.InitializePageInternal();
string name = Wizard.SetupVariables.ComponentFullName;
this.Text = "Rolling back";
this.Description = string.Format("Please wait while {0} is being rolled back.", name);
this.AllowMoveBack = false;
this.AllowMoveNext = false;
this.AllowCancel = false;
thread = new Thread(new ThreadStart(this.Start));
thread.Start();
}
/// <summary>
/// Displays process progress.
/// </summary>
public void Start()
{
this.Update();
try
{
this.progressBar.Value = 0;
this.lblProcess.Text = "Rolling back...";
Log.WriteStart("Rolling back");
//
Wizard.ActionManager.TotalProgressChanged += new EventHandler<ProgressEventArgs>((object sender, ProgressEventArgs e) =>
{
this.progressBar.Value = e.Value;
});
//
Wizard.ActionManager.Rollback();
//
Log.WriteEnd("Rolled back");
this.progressBar.Value = 100;
}
catch(Exception ex)
{
if (Utils.IsThreadAbortException(ex))
return;
ShowError();
this.Wizard.Close();
}
this.lblProcess.Text = "Rollback completed. Click Finish to exit setup.";
this.AllowMoveNext = true;
this.AllowCancel = true;
}
}
}

View file

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View file

@ -0,0 +1,105 @@
namespace WebsitePanel.Setup
{
partial class SQLServersPage
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.grdServers = new System.Windows.Forms.DataGridView();
this.lblWarning = new System.Windows.Forms.Label();
this.colServer = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colName = new System.Windows.Forms.DataGridViewTextBoxColumn();
((System.ComponentModel.ISupportInitialize)(this.grdServers)).BeginInit();
this.SuspendLayout();
//
// grdServers
//
this.grdServers.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.grdServers.BackgroundColor = System.Drawing.SystemColors.Window;
this.grdServers.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.grdServers.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.colServer,
this.colName});
this.grdServers.Location = new System.Drawing.Point(39, 40);
this.grdServers.MultiSelect = false;
this.grdServers.Name = "grdServers";
this.grdServers.RowHeadersWidth = 21;
this.grdServers.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
this.grdServers.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.grdServers.Size = new System.Drawing.Size(379, 149);
this.grdServers.TabIndex = 3;
//
// lblWarning
//
this.lblWarning.Location = new System.Drawing.Point(36, 15);
this.lblWarning.Name = "lblWarning";
this.lblWarning.Size = new System.Drawing.Size(396, 22);
this.lblWarning.TabIndex = 2;
this.lblWarning.Text = "Please specify SQL servers that will be accessible in myLittle Admin.";
//
// colServer
//
this.colServer.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
this.colServer.DataPropertyName = "Server";
this.colServer.HeaderText = "Server";
this.colServer.MinimumWidth = 60;
this.colServer.Name = "colServer";
//
// colName
//
this.colName.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCells;
this.colName.DataPropertyName = "Name";
this.colName.HeaderText = "Name";
this.colName.MinimumWidth = 60;
this.colName.Name = "colName";
this.colName.Width = 60;
//
// SQLServersPage
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.grdServers);
this.Controls.Add(this.lblWarning);
this.Name = "SQLServersPage";
this.Size = new System.Drawing.Size(457, 228);
((System.ComponentModel.ISupportInitialize)(this.grdServers)).EndInit();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.DataGridView grdServers;
private System.Windows.Forms.Label lblWarning;
private System.Windows.Forms.DataGridViewTextBoxColumn colServer;
private System.Windows.Forms.DataGridViewTextBoxColumn colName;
}
}

View file

@ -0,0 +1,143 @@
// Copyright (c) 2011, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System;
using System.Management;
using System.IO;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Xml;
using System.Text;
using System.Text.RegularExpressions;
using System.Windows.Forms;
using WebsitePanel.Setup.Web;
using WebsitePanel.Setup.Common;
namespace WebsitePanel.Setup
{
public partial class SQLServersPage : BannerWizardPage
{
public SQLServersPage()
{
InitializeComponent();
}
protected override void InitializePageInternal()
{
base.InitializePageInternal();
this.Text = "SQL Servers";
this.Description = "Specify SQL servers to manage with myLittleAdmin.";
this.AllowMoveBack = true;
this.AllowMoveNext = true;
this.AllowCancel = true;
PopulateServers();
}
private void PopulateServers()
{
try
{
Log.WriteStart("Populating SQL servers");
ServerItem[] servers = null;
if (Wizard.SetupVariables.SetupAction == SetupActions.Setup)
{
servers = LoadServersFromConfigFile();
}
else
{
if (Wizard.SetupVariables.SQLServers != null)
servers = Wizard.SetupVariables.SQLServers;
}
if ( servers == null )
servers = new ServerItem[] { };
DataSet ds = new DataSet();
DataTable dt = new DataTable("Servers");
ds.Tables.Add(dt);
DataColumn colServer = new DataColumn("Server", typeof(string));
DataColumn colName = new DataColumn("Name", typeof(string));
dt.Columns.AddRange(new DataColumn[]{colServer, colName});
foreach (ServerItem item in servers)
{
dt.Rows.Add(item.Server, item.Name);
}
grdServers.DataSource = ds;
grdServers.DataMember = "Servers";
Log.WriteEnd("Populated SQL servers");
}
catch (Exception ex)
{
Log.WriteError("Configuration error", ex);
}
}
private ServerItem[] LoadServersFromConfigFile()
{
string path = Path.Combine(Wizard.SetupVariables.InstallationFolder, "config.xml");
if (!File.Exists(path))
{
Log.WriteInfo(string.Format("File {0} not found", path));
return null;
}
List<ServerItem> list = new List<ServerItem>();
XmlDocument doc = new XmlDocument();
doc.Load(path);
XmlNodeList servers = doc.SelectNodes("//myLittleAdmin/sqlservers/sqlserver");
foreach (XmlElement serverNode in servers)
{
list.Add(
new ServerItem(
serverNode.GetAttribute("address"),
serverNode.GetAttribute("name")));
}
return list.ToArray();
}
protected internal override void OnBeforeMoveNext(CancelEventArgs e)
{
List<ServerItem> list = new List<ServerItem>();
DataSet ds = grdServers.DataSource as DataSet;
foreach (DataRow row in ds.Tables[0].Rows)
{
list.Add(new ServerItem(row["Server"].ToString(), row["Name"].ToString()));
}
Wizard.SetupVariables.SQLServers = list.ToArray();
base.OnBeforeMoveNext(e);
}
}
}

View file

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View file

@ -0,0 +1,120 @@
namespace WebsitePanel.Setup
{
partial class ServerAdminPasswordPage
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.lblConfirmPassword = new System.Windows.Forms.Label();
this.txtConfirmPassword = new System.Windows.Forms.TextBox();
this.lblPassword = new System.Windows.Forms.Label();
this.txtPassword = new System.Windows.Forms.TextBox();
this.chkChangePassword = new System.Windows.Forms.CheckBox();
this.lblNote = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// lblConfirmPassword
//
this.lblConfirmPassword.Location = new System.Drawing.Point(53, 124);
this.lblConfirmPassword.Name = "lblConfirmPassword";
this.lblConfirmPassword.Size = new System.Drawing.Size(106, 23);
this.lblConfirmPassword.TabIndex = 4;
this.lblConfirmPassword.Text = "Confirm password:";
//
// txtConfirmPassword
//
this.txtConfirmPassword.Location = new System.Drawing.Point(165, 124);
this.txtConfirmPassword.Name = "txtConfirmPassword";
this.txtConfirmPassword.PasswordChar = '*';
this.txtConfirmPassword.Size = new System.Drawing.Size(170, 20);
this.txtConfirmPassword.TabIndex = 5;
//
// lblPassword
//
this.lblPassword.Location = new System.Drawing.Point(53, 92);
this.lblPassword.Name = "lblPassword";
this.lblPassword.Size = new System.Drawing.Size(106, 23);
this.lblPassword.TabIndex = 2;
this.lblPassword.Text = "Password:";
//
// txtPassword
//
this.txtPassword.Location = new System.Drawing.Point(165, 92);
this.txtPassword.Name = "txtPassword";
this.txtPassword.PasswordChar = '*';
this.txtPassword.Size = new System.Drawing.Size(170, 20);
this.txtPassword.TabIndex = 3;
//
// chkChangePassword
//
this.chkChangePassword.Checked = true;
this.chkChangePassword.CheckState = System.Windows.Forms.CheckState.Checked;
this.chkChangePassword.Location = new System.Drawing.Point(56, 52);
this.chkChangePassword.Name = "chkChangePassword";
this.chkChangePassword.Size = new System.Drawing.Size(279, 25);
this.chkChangePassword.TabIndex = 1;
this.chkChangePassword.Text = "Reset Serveradmin Password";
this.chkChangePassword.UseVisualStyleBackColor = true;
this.chkChangePassword.CheckedChanged += new System.EventHandler(this.OnChangePasswordChecked);
//
// lblNote
//
this.lblNote.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.lblNote.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.lblNote.Location = new System.Drawing.Point(0, 184);
this.lblNote.Name = "lblNote";
this.lblNote.Size = new System.Drawing.Size(457, 38);
this.lblNote.TabIndex = 6;
//
// ServerAdminPasswordPage
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.lblNote);
this.Controls.Add(this.chkChangePassword);
this.Controls.Add(this.lblConfirmPassword);
this.Controls.Add(this.txtConfirmPassword);
this.Controls.Add(this.lblPassword);
this.Controls.Add(this.txtPassword);
this.Name = "ServerAdminPasswordPage";
this.Size = new System.Drawing.Size(457, 228);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label lblConfirmPassword;
private System.Windows.Forms.TextBox txtConfirmPassword;
private System.Windows.Forms.Label lblPassword;
private System.Windows.Forms.TextBox txtPassword;
private System.Windows.Forms.CheckBox chkChangePassword;
private System.Windows.Forms.Label lblNote;
}
}

View file

@ -0,0 +1,156 @@
// Copyright (c) 2011, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System;
using System.IO;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Threading;
using System.Windows.Forms;
namespace WebsitePanel.Setup
{
public partial class ServerAdminPasswordPage : BannerWizardPage
{
public ServerAdminPasswordPage()
{
InitializeComponent();
}
public string NoteText
{
get { return lblNote.Text; }
set { lblNote.Text = value; }
}
protected override void InitializePageInternal()
{
base.InitializePageInternal();
this.Text = "Set Administrator Password";
this.Description = "Specify a new password for the serveradmin account.";
chkChangePassword.Checked = true;
txtPassword.Text = SetupVariables.ServerAdminPassword;
txtConfirmPassword.Text = SetupVariables.ServerAdminPassword;
if (SetupVariables.SetupAction == SetupActions.Setup)
{
chkChangePassword.Visible = true;
}
else
{
SetupVariables.UpdateServerAdminPassword = true;
chkChangePassword.Visible = false;
}
if (!string.IsNullOrEmpty(SetupVariables.ServerAdminPassword))
{
txtPassword.Text = SetupVariables.ServerAdminPassword;
txtConfirmPassword.Text = SetupVariables.ServerAdminPassword;
}
}
protected internal override void OnAfterDisplay(EventArgs e)
{
base.OnAfterDisplay(e);
//unattended setup
if (!string.IsNullOrEmpty(SetupVariables.SetupXml))
Wizard.GoNext();
}
protected internal override void OnBeforeDisplay(EventArgs e)
{
base.OnBeforeDisplay(e);
this.AllowMoveBack = true;
this.AllowMoveNext = true;
this.AllowCancel = true;
}
protected internal override void OnBeforeMoveNext(CancelEventArgs e)
{
try
{
if (!chkChangePassword.Checked)
{
//if we don't want to change password during setup
SetupVariables.UpdateServerAdminPassword = false;
e.Cancel = false;
return;
}
if (!CheckFields())
{
e.Cancel = true;
return;
}
// Use the same password for peer account
SetupVariables.ServerAdminPassword = SetupVariables.PeerAdminPassword = txtPassword.Text;
//
SetupVariables.UpdateServerAdminPassword = true;
}
catch
{
this.AllowMoveNext = false;
ShowError("Unable to reset password.");
return;
}
base.OnBeforeMoveNext(e);
}
private bool CheckFields()
{
string password = txtPassword.Text;
if (string.IsNullOrEmpty(password) || password.Trim().Length == 0)
{
ShowWarning("Please enter password");
return false;
}
if (password != txtConfirmPassword.Text)
{
ShowWarning("The password was not correctly confirmed. Please ensure that the password and confirmation match exactly.");
return false;
}
return true;
}
private void OnChangePasswordChecked(object sender, EventArgs e)
{
bool enabled = chkChangePassword.Checked;
txtPassword.Enabled = enabled;
txtConfirmPassword.Enabled = enabled;
}
}
}

View file

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View file

@ -0,0 +1,122 @@
namespace WebsitePanel.Setup
{
partial class ServerPasswordPage
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.lblConfirmPassword = new System.Windows.Forms.Label();
this.txtConfirmPassword = new System.Windows.Forms.TextBox();
this.lblPassword = new System.Windows.Forms.Label();
this.txtPassword = new System.Windows.Forms.TextBox();
this.lblIntro = new System.Windows.Forms.Label();
this.chkChangePassword = new System.Windows.Forms.CheckBox();
this.SuspendLayout();
//
// lblConfirmPassword
//
this.lblConfirmPassword.Location = new System.Drawing.Point(53, 124);
this.lblConfirmPassword.Name = "lblConfirmPassword";
this.lblConfirmPassword.Size = new System.Drawing.Size(106, 23);
this.lblConfirmPassword.TabIndex = 4;
this.lblConfirmPassword.Text = "Confirm password:";
//
// txtConfirmPassword
//
this.txtConfirmPassword.Location = new System.Drawing.Point(165, 124);
this.txtConfirmPassword.Name = "txtConfirmPassword";
this.txtConfirmPassword.PasswordChar = '*';
this.txtConfirmPassword.Size = new System.Drawing.Size(170, 20);
this.txtConfirmPassword.TabIndex = 5;
//
// lblPassword
//
this.lblPassword.Location = new System.Drawing.Point(53, 92);
this.lblPassword.Name = "lblPassword";
this.lblPassword.Size = new System.Drawing.Size(106, 23);
this.lblPassword.TabIndex = 2;
this.lblPassword.Text = "Password:";
//
// txtPassword
//
this.txtPassword.Location = new System.Drawing.Point(165, 92);
this.txtPassword.Name = "txtPassword";
this.txtPassword.PasswordChar = '*';
this.txtPassword.Size = new System.Drawing.Size(170, 20);
this.txtPassword.TabIndex = 3;
//
// lblIntro
//
this.lblIntro.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.lblIntro.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.lblIntro.Location = new System.Drawing.Point(0, 0);
this.lblIntro.Name = "lblIntro";
this.lblIntro.Size = new System.Drawing.Size(457, 58);
this.lblIntro.TabIndex = 0;
this.lblIntro.Text = "Please, specify a password which will be used to access this Server from the Ente" +
"rprise Server component. Click Next to continue.";
//
// chkChangePassword
//
this.chkChangePassword.Checked = true;
this.chkChangePassword.CheckState = System.Windows.Forms.CheckState.Checked;
this.chkChangePassword.Location = new System.Drawing.Point(56, 52);
this.chkChangePassword.Name = "chkChangePassword";
this.chkChangePassword.Size = new System.Drawing.Size(279, 25);
this.chkChangePassword.TabIndex = 1;
this.chkChangePassword.Text = "Reset Server Password";
this.chkChangePassword.UseVisualStyleBackColor = true;
this.chkChangePassword.CheckedChanged += new System.EventHandler(this.OnChangePasswordChecked);
//
// ServerPasswordPage
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.chkChangePassword);
this.Controls.Add(this.lblConfirmPassword);
this.Controls.Add(this.txtConfirmPassword);
this.Controls.Add(this.lblPassword);
this.Controls.Add(this.txtPassword);
this.Controls.Add(this.lblIntro);
this.Name = "ServerPasswordPage";
this.Size = new System.Drawing.Size(457, 228);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label lblConfirmPassword;
private System.Windows.Forms.TextBox txtConfirmPassword;
private System.Windows.Forms.Label lblPassword;
private System.Windows.Forms.TextBox txtPassword;
private System.Windows.Forms.Label lblIntro;
private System.Windows.Forms.CheckBox chkChangePassword;
}
}

View file

@ -0,0 +1,151 @@
// Copyright (c) 2011, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System;
using System.IO;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Threading;
using System.Windows.Forms;
namespace WebsitePanel.Setup
{
public partial class ServerPasswordPage : BannerWizardPage
{
public ServerPasswordPage()
{
InitializeComponent();
}
protected override void InitializePageInternal()
{
base.InitializePageInternal();
this.Text = "Set Server Password";
this.Description = "Specify a new password for this server.";
chkChangePassword.Checked = true;
if (Wizard.SetupVariables.SetupAction == SetupActions.Setup)
{
chkChangePassword.Visible = true;
}
else
{
Wizard.SetupVariables.UpdateServerPassword = true;
chkChangePassword.Visible = false;
}
if (!string.IsNullOrEmpty(Wizard.SetupVariables.ServerPassword))
{
txtPassword.Text = Wizard.SetupVariables.ServerPassword;
txtConfirmPassword.Text = Wizard.SetupVariables.ServerPassword;
}
}
protected internal override void OnBeforeDisplay(EventArgs e)
{
base.OnBeforeDisplay(e);
this.AllowMoveBack = true;
this.AllowMoveNext = true;
this.AllowCancel = true;
}
protected internal override void OnAfterDisplay(EventArgs e)
{
base.OnAfterDisplay(e);
//unattended setup
if (!string.IsNullOrEmpty(Wizard.SetupVariables.SetupXml) && AllowMoveNext)
Wizard.GoNext();
}
protected internal override void OnBeforeMoveNext(CancelEventArgs e)
{
try
{
if (!chkChangePassword.Checked)
{
//if we don't want to change password during setup
Wizard.SetupVariables.UpdateServerPassword = false;
e.Cancel = false;
return;
}
if (!CheckFields())
{
e.Cancel = true;
return;
}
//
if (Wizard.SetupVariables.SetupAction == SetupActions.Setup)
{
Wizard.SetupVariables.ServerPassword = Utils.ComputeSHA1(txtPassword.Text);
}
else
{
Wizard.SetupVariables.ServerPassword = txtPassword.Text;
}
Wizard.SetupVariables.UpdateServerPassword = true;
}
catch
{
this.AllowMoveNext = false;
ShowError("Unable to set server password.");
return;
}
base.OnBeforeMoveNext(e);
}
private bool CheckFields()
{
string password = txtPassword.Text;
if (password.Trim().Length == 0)
{
ShowWarning("Please enter password");
return false;
}
if (password != txtConfirmPassword.Text)
{
ShowWarning("The password was not correctly confirmed. Please ensure that the password and confirmation match exactly.");
return false;
}
return true;
}
private void OnChangePasswordChecked(object sender, EventArgs e)
{
bool enabled = chkChangePassword.Checked;
txtPassword.Enabled = enabled;
txtConfirmPassword.Enabled = enabled;
}
}
}

View file

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View file

@ -0,0 +1,122 @@
namespace WebsitePanel.Setup
{
partial class ServiceAddressPage
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.grpSettings = new System.Windows.Forms.GroupBox();
this.cbIP = new System.Windows.Forms.ComboBox();
this.lblTcpPort = new System.Windows.Forms.Label();
this.txtTcpPort = new System.Windows.Forms.TextBox();
this.lblIP = new System.Windows.Forms.Label();
this.txtAddress = new System.Windows.Forms.TextBox();
this.grpSettings.SuspendLayout();
this.SuspendLayout();
//
// grpSettings
//
this.grpSettings.Controls.Add(this.cbIP);
this.grpSettings.Controls.Add(this.lblTcpPort);
this.grpSettings.Controls.Add(this.txtTcpPort);
this.grpSettings.Controls.Add(this.lblIP);
this.grpSettings.Location = new System.Drawing.Point(30, 37);
this.grpSettings.Name = "grpSettings";
this.grpSettings.Size = new System.Drawing.Size(396, 76);
this.grpSettings.TabIndex = 1;
this.grpSettings.TabStop = false;
this.grpSettings.Text = "Address Settings";
//
// cbIP
//
this.cbIP.Location = new System.Drawing.Point(140, 19);
this.cbIP.Name = "cbIP";
this.cbIP.Size = new System.Drawing.Size(220, 21);
this.cbIP.TabIndex = 3;
this.cbIP.TextChanged += new System.EventHandler(this.OnAddressChanged);
//
// lblTcpPort
//
this.lblTcpPort.Location = new System.Drawing.Point(30, 50);
this.lblTcpPort.Name = "lblTcpPort";
this.lblTcpPort.Size = new System.Drawing.Size(96, 16);
this.lblTcpPort.TabIndex = 4;
this.lblTcpPort.Text = "TCP Port:";
//
// txtTcpPort
//
this.txtTcpPort.Location = new System.Drawing.Point(140, 46);
this.txtTcpPort.Name = "txtTcpPort";
this.txtTcpPort.Size = new System.Drawing.Size(48, 20);
this.txtTcpPort.TabIndex = 5;
this.txtTcpPort.TextChanged += new System.EventHandler(this.OnAddressChanged);
//
// lblIP
//
this.lblIP.Location = new System.Drawing.Point(30, 22);
this.lblIP.Name = "lblIP";
this.lblIP.Size = new System.Drawing.Size(104, 16);
this.lblIP.TabIndex = 0;
this.lblIP.Text = "IP Address:";
//
// txtAddress
//
this.txtAddress.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.txtAddress.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.txtAddress.Location = new System.Drawing.Point(28, 11);
this.txtAddress.Name = "txtAddress";
this.txtAddress.ReadOnly = true;
this.txtAddress.Size = new System.Drawing.Size(398, 13);
this.txtAddress.TabIndex = 0;
//
// ServiceAddressPage
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.grpSettings);
this.Controls.Add(this.txtAddress);
this.Name = "ServiceAddressPage";
this.Size = new System.Drawing.Size(457, 228);
this.grpSettings.ResumeLayout(false);
this.grpSettings.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.GroupBox grpSettings;
private System.Windows.Forms.Label lblTcpPort;
private System.Windows.Forms.TextBox txtTcpPort;
private System.Windows.Forms.Label lblIP;
private System.Windows.Forms.TextBox txtAddress;
private System.Windows.Forms.ComboBox cbIP;
}
}

View file

@ -0,0 +1,258 @@
// Copyright (c) 2011, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System;
using System.Management;
using System.DirectoryServices;
using System.DirectoryServices.ActiveDirectory;
using System.IO;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Text.RegularExpressions;
using System.Windows.Forms;
using System.Xml;
using WebsitePanel.Setup.Web;
namespace WebsitePanel.Setup
{
public partial class ServiceAddressPage : BannerWizardPage
{
public ServiceAddressPage()
{
InitializeComponent();
}
protected override void InitializePageInternal()
{
base.InitializePageInternal();
this.Text = "Service Settings";
string component = Wizard.SetupVariables.ComponentFullName;
this.Description = string.Format("Specify {0} address settings.", component);
this.AllowMoveBack = true;
this.AllowMoveNext = true;
this.AllowCancel = true;
if (Wizard.SetupVariables.SetupAction == SetupActions.Setup)
{
LoadServiceConfigSettings();
}
// init fields
PopulateIPs();
this.txtTcpPort.Text = Wizard.SetupVariables.ServicePort;
UpdateApplicationAddress();
}
private void LoadServiceConfigSettings()
{
try
{
string path = Path.Combine(Wizard.SetupVariables.InstallationFolder, Wizard.SetupVariables.ConfigurationFile);
if (!File.Exists(path))
{
Log.WriteInfo(string.Format("File {0} not found", path));
return;
}
Log.WriteStart("Loading configuration file (service settings)");
XmlDocument doc = new XmlDocument();
doc.Load(path);
XmlElement ipNode = doc.SelectSingleNode("//configuration/appSettings/add[@key='WebsitePanel.HostIP']") as XmlElement;
if (ipNode != null)
{
Wizard.SetupVariables.ServiceIP = ipNode.GetAttribute("value");
}
else
{
Log.WriteInfo("Service host IP setting not found");
}
XmlElement portNode = doc.SelectSingleNode("//configuration/appSettings/add[@key='WebsitePanel.HostPort']") as XmlElement;
if (portNode != null)
{
Wizard.SetupVariables.ServicePort = portNode.GetAttribute("value");
}
else
{
Log.WriteInfo("Service host post setting not found");
}
Log.WriteEnd("Loaded configuration file");
}
catch (Exception ex)
{
Log.WriteError("Configuration file error", ex);
}
}
private void PopulateIPs()
{
try
{
Log.WriteStart("Loading IPs");
cbIP.Items.Clear();
string[] ips = WebUtils.GetIPs();
foreach (string ip in ips)
{
cbIP.Items.Add(ip);
}
Log.WriteEnd("Loaded IPs");
if (string.IsNullOrEmpty(Wizard.SetupVariables.ServiceIP))
{
//select first available
if (cbIP.Items.Count > 0)
{
cbIP.Text = cbIP.Items[0].ToString();
}
}
else
{
//add 127.0.0.1
if (!cbIP.Items.Contains(Wizard.SetupVariables.ServiceIP))
{
cbIP.Items.Insert(0, Wizard.SetupVariables.ServiceIP);
}
cbIP.Text = Wizard.SetupVariables.ServiceIP;
}
}
catch (Exception ex)
{
Log.WriteError("WMI error", ex);
}
}
private void OnAddressChanged(object sender, System.EventArgs e)
{
UpdateApplicationAddress();
}
private void UpdateApplicationAddress()
{
string address = "soap.tcp://";
string ip = string.Empty;
string port = string.Empty;
//ip
if (cbIP.Text.Trim().Length > 0)
{
ip = cbIP.Text.Trim();
}
//port
if (ip.Length > 0 && txtTcpPort.Text.Trim().Length > 0 )
{
port = ":" + txtTcpPort.Text.Trim();
}
//address string
address += ip + port;
txtAddress.Text = address;
}
private bool CheckAddress()
{
string ip = cbIP.Text;
string port = txtTcpPort.Text;
if (ip.Trim().Length == 0)
{
ShowWarning("Please enter IP address");
return false;
}
if (!Regex.IsMatch(ip, @"^(?:(?:25[0-5]|2[0-4]\d|[01]\d\d|\d?\d)(?(?=\.?\d)\.)){4}$"))
{
ShowWarning("Please enter valid IP address (for example, 192.168.1.42)");
return false;
}
if (port.Trim().Length == 0)
{
ShowWarning("Please enter TCP port");
return false;
}
for (int i = 0; i < port.Length; i++)
{
if (!Char.IsNumber(port, i))
{
ShowWarning("Please enter valid TCP port (for example, 80).");
return false;
}
}
return true;
}
private bool IsEqualString(string s1, string s2)
{
bool ret = false;
if (string.IsNullOrEmpty(s1) && string.IsNullOrEmpty(s2))
{
ret = true;
}
else
{
ret = (s1 == s2);
}
return ret;
}
private bool ProcessAddressSettings()
{
if (!CheckAddress())
{
return false;
}
return true;
}
protected internal override void OnBeforeMoveNext(CancelEventArgs e)
{
if (!ProcessAddressSettings())
{
e.Cancel = true;
return;
}
Wizard.SetupVariables.ServiceIP = this.cbIP.Text;
Wizard.SetupVariables.ServicePort = this.txtTcpPort.Text;
base.OnBeforeMoveNext(e);
}
}
}

View file

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View file

@ -0,0 +1,162 @@
namespace WebsitePanel.Setup
{
partial class SetupCompletePage
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.lblViewLog = new System.Windows.Forms.Label();
this.lnkViewSetupLog = new System.Windows.Forms.LinkLabel();
this.lblAccounts = new System.Windows.Forms.Label();
this.linkLabel1 = new System.Windows.Forms.LinkLabel();
this.lblServeradmin = new System.Windows.Forms.Label();
this.lblAdmin = new System.Windows.Forms.Label();
this.lblServeradminDescription = new System.Windows.Forms.Label();
this.lblAdminDescription = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// lblViewLog
//
this.lblViewLog.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.lblViewLog.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.lblViewLog.Location = new System.Drawing.Point(0, 4);
this.lblViewLog.Name = "lblViewLog";
this.lblViewLog.Size = new System.Drawing.Size(457, 33);
this.lblViewLog.TabIndex = 1;
this.lblViewLog.Text = "Refer to the setup log for information describing any failure(s) that occurred du" +
"ring setup. Click Finish to exit the Setup Wizard.\r\n\r\n";
//
// lnkViewSetupLog
//
this.lnkViewSetupLog.AutoSize = true;
this.lnkViewSetupLog.Location = new System.Drawing.Point(4, 37);
this.lnkViewSetupLog.Name = "lnkViewSetupLog";
this.lnkViewSetupLog.Size = new System.Drawing.Size(82, 13);
this.lnkViewSetupLog.TabIndex = 2;
this.lnkViewSetupLog.TabStop = true;
this.lnkViewSetupLog.Text = "View Setup Log";
this.lnkViewSetupLog.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.OnViewLogLinkClicked);
//
// lblAccounts
//
this.lblAccounts.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.lblAccounts.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.lblAccounts.Location = new System.Drawing.Point(0, 60);
this.lblAccounts.Name = "lblAccounts";
this.lblAccounts.Size = new System.Drawing.Size(457, 22);
this.lblAccounts.TabIndex = 3;
this.lblAccounts.Text = "Use one of the following administrator accounts to log on to WebsitePanel:\r\n";
//
// linkLabel1
//
this.linkLabel1.AutoSize = true;
this.linkLabel1.Location = new System.Drawing.Point(3, 206);
this.linkLabel1.Name = "linkLabel1";
this.linkLabel1.Size = new System.Drawing.Size(116, 13);
this.linkLabel1.TabIndex = 4;
this.linkLabel1.TabStop = true;
this.linkLabel1.Text = "Log on to WebsitePanel";
this.linkLabel1.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.OnLoginClicked);
//
// lblServeradmin
//
this.lblServeradmin.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.lblServeradmin.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.lblServeradmin.Location = new System.Drawing.Point(4, 82);
this.lblServeradmin.Name = "lblServeradmin";
this.lblServeradmin.Size = new System.Drawing.Size(113, 22);
this.lblServeradmin.TabIndex = 5;
this.lblServeradmin.Text = "serveradmin";
//
// lblAdmin
//
this.lblAdmin.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.lblAdmin.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.lblAdmin.Location = new System.Drawing.Point(3, 137);
this.lblAdmin.Name = "lblAdmin";
this.lblAdmin.Size = new System.Drawing.Size(113, 22);
this.lblAdmin.TabIndex = 6;
this.lblAdmin.Text = "admin";
//
// lblServeradminDescription
//
this.lblServeradminDescription.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.lblServeradminDescription.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.lblServeradminDescription.Location = new System.Drawing.Point(0, 103);
this.lblServeradminDescription.Name = "lblServeradminDescription";
this.lblServeradminDescription.Size = new System.Drawing.Size(457, 34);
this.lblServeradminDescription.TabIndex = 7;
this.lblServeradminDescription.Text = "The built-in serveradmin user account has a high level of access privileges. It i" +
"s used for top-level administration and configuring.";
//
// lblAdminDescription
//
this.lblAdminDescription.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.lblAdminDescription.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.lblAdminDescription.Location = new System.Drawing.Point(4, 159);
this.lblAdminDescription.Name = "lblAdminDescription";
this.lblAdminDescription.Size = new System.Drawing.Size(453, 29);
this.lblAdminDescription.TabIndex = 8;
this.lblAdminDescription.Text = "Admin user account is used for managing hosting resources.";
//
// SetupCompletePage
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.lblAdminDescription);
this.Controls.Add(this.lblServeradminDescription);
this.Controls.Add(this.lblAdmin);
this.Controls.Add(this.lblServeradmin);
this.Controls.Add(this.linkLabel1);
this.Controls.Add(this.lblAccounts);
this.Controls.Add(this.lnkViewSetupLog);
this.Controls.Add(this.lblViewLog);
this.Name = "SetupCompletePage";
this.Size = new System.Drawing.Size(457, 228);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label lblViewLog;
private System.Windows.Forms.LinkLabel lnkViewSetupLog;
private System.Windows.Forms.Label lblAccounts;
private System.Windows.Forms.LinkLabel linkLabel1;
private System.Windows.Forms.Label lblServeradmin;
private System.Windows.Forms.Label lblAdmin;
private System.Windows.Forms.Label lblServeradminDescription;
private System.Windows.Forms.Label lblAdminDescription;
}
}

View file

@ -0,0 +1,95 @@
// Copyright (c) 2011, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System;
using System.Diagnostics;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
namespace WebsitePanel.Setup
{
public partial class SetupCompletePage : BannerWizardPage
{
public SetupCompletePage()
{
InitializeComponent();
}
protected internal override void OnBeforeDisplay(EventArgs e)
{
base.OnBeforeDisplay(e);
this.Text = "Completing WebsitePanel Setup";
this.Description = "Setup has finished configuration of WebsitePanel";
this.AllowMoveBack = false;
this.AllowCancel = false;
}
protected internal override void OnAfterDisplay(EventArgs e)
{
base.OnAfterDisplay(e);
//unattended setup
if (!string.IsNullOrEmpty(SetupVariables.SetupXml))
Wizard.GoNext();
}
private void OnViewLogLinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
Log.ShowLogFile();
}
private void OnLoginClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
string ip = SetupVariables.WebSiteIP;
string domain = SetupVariables.WebSiteDomain;
string port = SetupVariables.WebSitePort;
string url = GetApplicationUrl(ip, domain, port);
Process.Start(url);
}
private string GetApplicationUrl(string ip, string domain, string port)
{
string url = ip;
if (String.IsNullOrEmpty(domain))
{
if (!String.IsNullOrEmpty(port) && port != "80")
url += ":" + port;
}
else
{
url = domain;
if (!String.IsNullOrEmpty(port) && port != "80")
url += ":" + port;
}
return "http://"+url;
}
}
}

View file

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View file

@ -0,0 +1,92 @@
namespace WebsitePanel.Setup
{
partial class UninstallPage
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.grpFiles = new System.Windows.Forms.GroupBox();
this.progressBar = new System.Windows.Forms.ProgressBar();
this.lblProcess = new System.Windows.Forms.Label();
this.lblIntro = new System.Windows.Forms.Label();
this.grpFiles.SuspendLayout();
this.SuspendLayout();
//
// grpFiles
//
this.grpFiles.Controls.Add(this.progressBar);
this.grpFiles.Controls.Add(this.lblProcess);
this.grpFiles.Location = new System.Drawing.Point(0, 43);
this.grpFiles.Name = "grpFiles";
this.grpFiles.Size = new System.Drawing.Size(457, 88);
this.grpFiles.TabIndex = 4;
this.grpFiles.TabStop = false;
//
// progressBar
//
this.progressBar.Location = new System.Drawing.Point(16, 40);
this.progressBar.Name = "progressBar";
this.progressBar.Size = new System.Drawing.Size(418, 23);
this.progressBar.Step = 1;
this.progressBar.Style = System.Windows.Forms.ProgressBarStyle.Continuous;
this.progressBar.TabIndex = 1;
//
// lblProcess
//
this.lblProcess.Location = new System.Drawing.Point(16, 24);
this.lblProcess.Name = "lblProcess";
this.lblProcess.Size = new System.Drawing.Size(418, 16);
this.lblProcess.TabIndex = 0;
//
// lblIntro
//
this.lblIntro.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.lblIntro.Location = new System.Drawing.Point(3, 0);
this.lblIntro.Name = "lblIntro";
this.lblIntro.Size = new System.Drawing.Size(454, 40);
this.lblIntro.TabIndex = 5;
//
// UninstallPage
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.grpFiles);
this.Controls.Add(this.lblIntro);
this.Name = "UninstallPage";
this.Size = new System.Drawing.Size(457, 228);
this.grpFiles.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.GroupBox grpFiles;
private System.Windows.Forms.ProgressBar progressBar;
private System.Windows.Forms.Label lblProcess;
private System.Windows.Forms.Label lblIntro;
}
}

View file

@ -0,0 +1,753 @@
// Copyright (c) 2011, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System;
using System.IO;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Threading;
using System.Windows.Forms;
namespace WebsitePanel.Setup
{
public partial class UninstallPage : BannerWizardPage
{
private Thread thread;
private List<InstallAction> actions;
public UninstallPage()
{
InitializeComponent();
actions = new List<InstallAction>();
}
public List<InstallAction> Actions
{
get
{
return actions;
}
}
protected override void InitializePageInternal()
{
string name = Wizard.SetupVariables.ComponentFullName;
this.Text = string.Format("Uninstalling {0}", name);
this.Description = string.Format("Please wait while {0} is being uninstalled.", name);
this.AllowMoveBack = false;
this.AllowMoveNext = false;
this.AllowCancel = false;
}
protected internal override void OnAfterDisplay(EventArgs e)
{
base.OnAfterDisplay(e);
thread = new Thread(new ThreadStart(this.Start));
thread.Start();
}
/// <summary>
/// Displays process progress.
/// </summary>
public void Start()
{
this.progressBar.Value = 0;
string component = Wizard.SetupVariables.ComponentFullName;
string componentId = Wizard.SetupVariables.ComponentId;
Version iisVersion = Wizard.SetupVariables.IISVersion;
bool iis7 = (iisVersion.Major == 7);
try
{
this.lblProcess.Text = "Creating uninstall script...";
this.Update();
//default actions
List<InstallAction> actions = GetUninstallActions(componentId);
//add external actions
foreach (InstallAction extAction in Actions)
{
actions.Add(extAction);
}
//process actions
for (int i = 0, progress = 1; i < actions.Count; i++, progress++)
{
InstallAction action = actions[i];
this.lblProcess.Text = action.Description;
this.progressBar.Value = progress * 100 / actions.Count;
this.Update();
try
{
switch (action.ActionType)
{
case ActionTypes.DeleteRegistryKey:
DeleteRegistryKey(action.Key, action.Empty);
break;
case ActionTypes.DeleteDirectory:
DeleteDirectory(action.Path);
break;
case ActionTypes.DeleteDatabase:
DeleteDatabase(
action.ConnectionString,
action.Name);
break;
case ActionTypes.DeleteDatabaseUser:
DeleteDatabaseUser(
action.ConnectionString,
action.UserName);
break;
case ActionTypes.DeleteDatabaseLogin:
DeleteDatabaseLogin(
action.ConnectionString,
action.UserName);
break;
case ActionTypes.DeleteWebSite:
if (iis7)
DeleteIIS7WebSite(action.SiteId);
else
DeleteWebSite(action.SiteId);
break;
case ActionTypes.DeleteVirtualDirectory:
DeleteVirtualDirectory(
action.SiteId,
action.Name);
break;
case ActionTypes.DeleteUserMembership:
DeleteUserMembership(action.Domain, action.Name, action.Membership);
break;
case ActionTypes.DeleteUserAccount:
DeleteUserAccount(action.Domain, action.Name);
break;
case ActionTypes.DeleteApplicationPool:
if (iis7)
DeleteIIS7ApplicationPool(action.Name);
else
DeleteApplicationPool(action.Name);
break;
case ActionTypes.UpdateConfig:
UpdateSystemConfiguration(action.Key);
break;
case ActionTypes.DeleteShortcuts:
DeleteShortcuts(action.Name);
break;
case ActionTypes.UnregisterWindowsService:
UnregisterWindowsService(action.Path, action.Name);
break;
}
}
catch (Exception ex)
{
if (!Utils.IsThreadAbortException(ex))
Log.WriteError("Uninstall error", ex);
}
}
this.progressBar.Value = 100;
}
catch (Exception ex)
{
if (Utils.IsThreadAbortException(ex))
return;
ShowError();
this.Wizard.Close();
}
this.lblProcess.Text = "Completed. Click Next to continue.";
this.AllowMoveNext = true;
this.AllowCancel = true;
}
private void UnregisterWindowsService(string path, string serviceName)
{
try
{
Log.WriteStart(string.Format("Removing \"{0}\" Windows service", serviceName));
Log.WriteStart(string.Format("Stopping \"{0}\" Windows service", serviceName));
try
{
Utils.StopService(serviceName);
Log.WriteEnd("Stopped Windows service");
}
catch (Exception ex)
{
if (!Utils.IsThreadAbortException(ex))
Log.WriteError("Windows service stop error", ex);
}
int exitCode = Utils.RunProcess(path, "/u");
if (exitCode == 0)
{
Log.WriteEnd("Removed Windows service");
InstallLog.AppendLine(string.Format("- Removed \"{0}\" Windows service", serviceName));
}
else
{
Log.WriteError(string.Format("Unable to remove \"{0}\" Windows service. Error code: {1}", serviceName, exitCode), null);
InstallLog.AppendLine(string.Format("- Failed to remove \"{0}\" Windows service", serviceName));
}
}
catch (Exception ex)
{
if (Utils.IsThreadAbortException(ex))
return;
Log.WriteError("Windows service error", ex);
InstallLog.AppendLine(string.Format("- Failed to remove \"{0}\" Windows service", serviceName));
throw;
}
}
private void DeleteShortcuts(string fileName)
{
try
{
Log.WriteStart("Deleting menu shortcut");
string programs = Environment.GetFolderPath(Environment.SpecialFolder.Programs);
string path = Path.Combine(programs, "WebsitePanel Software");
path = Path.Combine(path, fileName);
if (File.Exists(path))
{
File.Delete(path);
}
Log.WriteEnd("Deleted menu shortcut");
Log.WriteStart("Deleting desktop shortcut");
string desktop = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
path = Path.Combine(desktop, fileName);
if (File.Exists(path))
{
File.Delete(path);
}
Log.WriteEnd("Deleted desktop shortcut");
InstallLog.AppendLine("- Deleted application shortcuts");
}
catch (Exception ex)
{
if (Utils.IsThreadAbortException(ex))
return;
Log.WriteError("Delete shortcut error", ex);
InstallLog.AppendLine("- Failed to delete application shortcuts");
throw;
}
}
internal List<InstallAction> GetUninstallActions(string componentId)
{
List<InstallAction> list = new List<InstallAction>();
InstallAction action = null;
//windows service
string serviceName = AppConfig.GetComponentSettingStringValue(componentId, "ServiceName");
string serviceFile = AppConfig.GetComponentSettingStringValue(componentId, "ServiceFile");
string installFolder = AppConfig.GetComponentSettingStringValue(componentId, "InstallFolder");
if (!string.IsNullOrEmpty(serviceName) && !string.IsNullOrEmpty(serviceFile))
{
action = new InstallAction(ActionTypes.UnregisterWindowsService);
action.Path = Path.Combine(installFolder, serviceFile);
action.Name = serviceName;
action.Description = "Removing Windows service...";
action.Log = string.Format("- Remove {0} Windows service", serviceName);
list.Add(action);
}
//database
bool deleteDatabase = AppConfig.GetComponentSettingBooleanValue(componentId, "NewDatabase");
if (deleteDatabase)
{
string connectionString = AppConfig.GetComponentSettingStringValue(componentId, "InstallConnectionString");
string database = AppConfig.GetComponentSettingStringValue(componentId, "Database");
action = new InstallAction(ActionTypes.DeleteDatabase);
action.ConnectionString = connectionString;
action.Name = database;
action.Description = "Deleting database...";
action.Log = string.Format("- Delete {0} database", database);
list.Add(action);
}
//database user
bool deleteDatabaseUser = AppConfig.GetComponentSettingBooleanValue(componentId, "NewDatabaseUser");
if (deleteDatabaseUser)
{
string connectionString = AppConfig.GetComponentSettingStringValue(componentId, "InstallConnectionString");
string username = AppConfig.GetComponentSettingStringValue(componentId, "DatabaseUser");
action = new InstallAction(ActionTypes.DeleteDatabaseUser);
action.ConnectionString = connectionString;
action.UserName = username;
action.Description = "Deleting database user...";
action.Log = string.Format("- Delete {0} database user", username);
list.Add(action);
}
//database login (from standalone setup)
string loginName = AppConfig.GetComponentSettingStringValue(componentId, "DatabaseLogin");
if (!string.IsNullOrEmpty(loginName))
{
string connectionString = AppConfig.GetComponentSettingStringValue(componentId, "InstallConnectionString");
action = new InstallAction(ActionTypes.DeleteDatabaseLogin);
action.ConnectionString = connectionString;
action.UserName = loginName;
action.Description = "Deleting database login...";
action.Log = string.Format("- Delete {0} database login", loginName);
list.Add(action);
}
//virtual directory
bool deleteVirtualDirectory = AppConfig.GetComponentSettingBooleanValue(componentId, "NewVirtualDirectory");
if (deleteVirtualDirectory)
{
string virtualDirectory = AppConfig.GetComponentSettingStringValue(componentId, "VirtualDirectory");
string virtualDirectorySiteId = AppConfig.GetComponentSettingStringValue(componentId, "WebSiteId");
action = new InstallAction(ActionTypes.DeleteVirtualDirectory);
action.SiteId = virtualDirectorySiteId;
action.Name = virtualDirectory;
action.Description = "Deleting virtual directory...";
action.Log = string.Format("- Delete {0} virtual directory...", virtualDirectory);
list.Add(action);
}
//web site
bool deleteWebSite = AppConfig.GetComponentSettingBooleanValue(componentId, "NewWebSite");
if (deleteWebSite)
{
string siteId = AppConfig.GetComponentSettingStringValue(componentId, "WebSiteId");
action = new InstallAction(ActionTypes.DeleteWebSite);
action.SiteId = siteId;
action.Description = "Deleting web site...";
action.Log = string.Format("- Delete {0} web site", siteId);
list.Add(action);
}
//application pool
bool deleteAppPool = AppConfig.GetComponentSettingBooleanValue(componentId, "NewApplicationPool");
if (deleteAppPool)
{
string appPoolName = AppConfig.GetComponentSettingStringValue(componentId, "ApplicationPool");
if (string.IsNullOrEmpty(appPoolName))
appPoolName = WebUtils.WEBSITEPANEL_ADMIN_POOL;
action = new InstallAction(ActionTypes.DeleteApplicationPool);
action.Name = appPoolName;
action.Description = "Deleting application pool...";
action.Log = string.Format("- Delete {0} application pool", appPoolName);
list.Add(action);
}
//user account
bool deleteUserAccount = AppConfig.GetComponentSettingBooleanValue(componentId, "NewUserAccount");
if (deleteUserAccount)
{
string username = AppConfig.GetComponentSettingStringValue(componentId, "UserAccount");
string domain = AppConfig.GetComponentSettingStringValue(componentId, "Domain");
//membership
if (Wizard.SetupVariables.UserMembership != null && Wizard.SetupVariables.UserMembership.Length > 0)
{
action = new InstallAction(ActionTypes.DeleteUserMembership);
action.Name = username;
action.Domain = domain;
action.Membership = Wizard.SetupVariables.UserMembership;
action.Description = "Removing user account membership...";
action.Log = string.Format("- Remove {0} user account membership", username);
list.Add(action);
}
action = new InstallAction(ActionTypes.DeleteUserAccount);
action.Name = username;
action.Domain = domain;
action.Description = "Deleting user account...";
action.Log = string.Format("- Delete {0} user account", username);
list.Add(action);
}
//directory
string path = AppConfig.GetComponentSettingStringValue(componentId, "InstallFolder");
if (!string.IsNullOrEmpty(path))
{
action = new InstallAction(ActionTypes.DeleteDirectory);
action.Path = path;
action.Description = "Deleting application folder...";
action.Log = string.Format("- Delete {0} folder", path);
list.Add(action);
}
//config
action = new InstallAction(ActionTypes.UpdateConfig);
action.Key = componentId;
action.Description = "Updating configuration settings...";
action.Log = "- Update configuration settings";
list.Add(action);
return list;
}
private void DeleteDirectory(string path)
{
try
{
Log.WriteStart("Deleting folder");
Log.WriteInfo(string.Format("Deleting \"{0}\" folder", path));
if (FileUtils.DirectoryExists(path))
{
FileUtils.DeleteDirectory(path);
Log.WriteEnd("Deleted folder");
}
InstallLog.AppendLine(string.Format("- Deleted \"{0}\" folder", path));
}
catch (Exception ex)
{
if (Utils.IsThreadAbortException(ex))
return;
Log.WriteError("I/O error", ex);
InstallLog.AppendLine(string.Format("- Failed to delete \"{0}\" folder", path));
//throw;
}
}
private void DeleteRegistryKey(string subkey, bool deleteEmptyOnly)
{
try
{
Log.WriteStart("Deleting registry key");
if (RegistryUtils.RegistryKeyExist(subkey))
{
if (deleteEmptyOnly && RegistryUtils.GetSubKeyCount(subkey) != 0)
{
Log.WriteEnd(string.Format("Registry key \"{0}\" is not empty", subkey));
return;
}
Log.WriteInfo(string.Format("Deleting registry key \"{0}\"", subkey));
RegistryUtils.DeleteRegistryKey(subkey);
Log.WriteEnd("Deleted registry key");
InstallLog.AppendLine(string.Format("- Deleted registry key \"{0}\"", subkey));
}
else
{
Log.WriteEnd(string.Format("Registry key \"{0}\" not found", subkey));
}
}
catch (Exception ex)
{
if (Utils.IsThreadAbortException(ex))
return;
Log.WriteError("Registry key delete error", ex);
InstallLog.AppendLine(string.Format("- Failed to delete registry key \"{0}\"", subkey));
throw;
}
}
private void UpdateSystemConfiguration(string componentId)
{
try
{
Log.WriteStart("Updating system configuration");
string componentName = AppConfig.GetComponentSettingStringValue(componentId, "ComponentName");
Log.WriteInfo(string.Format("Deleting \"{0}\" component settings ", componentName));
XmlUtils.RemoveXmlNode(AppConfig.GetComponentConfig(componentId));
Log.WriteInfo("Saving system configuration");
AppConfig.SaveConfiguration();
Log.WriteEnd("Updated system configuration");
InstallLog.AppendLine("- Updated system configuration");
}
catch (Exception ex)
{
if (Utils.IsThreadAbortException(ex))
return;
Log.WriteError("Config error", ex);
InstallLog.AppendLine("- Failed to update system configuration");
throw;
}
}
private void DeleteDatabase(string connectionString, string database)
{
try
{
Log.WriteStart("Deleting SQL server database");
Log.WriteInfo(string.Format("Deleting \"{0}\" SQL server database", database));
if (SqlUtils.DatabaseExists(connectionString, database))
{
SqlUtils.DeleteDatabase(connectionString, database);
Log.WriteEnd("Deleted database");
InstallLog.AppendLine(string.Format("- Deleted \"{0}\" SQL server database ", database));
}
}
catch (Exception ex)
{
if (Utils.IsThreadAbortException(ex))
return;
Log.WriteError("Database delete error", ex);
InstallLog.AppendLine(string.Format("- Failed to delete \"{0}\" SQL server database ", database));
throw;
}
}
private void DeleteDatabaseUser(string connectionString, string username)
{
try
{
Log.WriteStart("Deleting SQL server user");
Log.WriteInfo(string.Format("Deleting \"{0}\" SQL server user", username));
if (SqlUtils.UserExists(connectionString, username))
{
SqlUtils.DeleteUser(connectionString, username);
Log.WriteEnd("Deleted SQL server user");
InstallLog.AppendLine(string.Format("- Deleted \"{0}\" SQL server user ", username));
}
}
catch (Exception ex)
{
if (Utils.IsThreadAbortException(ex))
return;
Log.WriteError("Database user delete error", ex);
InstallLog.AppendLine(string.Format("- Failed to delete \"{0}\" SQL server user ", username));
throw;
}
}
private void DeleteDatabaseLogin(string connectionString, string loginName)
{
try
{
Log.WriteStart("Deleting SQL server login");
Log.WriteInfo(string.Format("Deleting \"{0}\" SQL server login", loginName));
if (SqlUtils.LoginExists(connectionString, loginName))
{
SqlUtils.DeleteLogin(connectionString, loginName);
Log.WriteEnd("Deleted SQL server login");
InstallLog.AppendLine(string.Format("- Deleted \"{0}\" SQL server login ", loginName));
}
}
catch (Exception ex)
{
if (Utils.IsThreadAbortException(ex))
return;
Log.WriteError("Database login delete error", ex);
InstallLog.AppendLine(string.Format("- Failed to delete \"{0}\" SQL server login ", loginName));
throw;
}
}
private void DeleteUserMembership(string domain, string username, string[] membership)
{
try
{
Log.WriteStart("Removing user membership");
if (SecurityUtils.UserExists(domain, username))
{
Log.WriteInfo(string.Format("Removing user \"{0}\" membership", username));
SecurityUtils.RemoveUserFromGroups(domain, username, membership);
Log.WriteEnd("Removed user membership");
}
}
catch (Exception ex)
{
if (Utils.IsThreadAbortException(ex))
return;
Log.WriteError("User membership delete error", ex);
throw;
}
}
private void DeleteUserAccount(string domain, string username)
{
try
{
Log.WriteStart("Deleting user account");
Log.WriteInfo(string.Format("Deleting \"{0}\" user account", username));
if (SecurityUtils.UserExists(domain, username))
{
SecurityUtils.DeleteUser(domain, username);
Log.WriteEnd("Deleted user account");
InstallLog.AppendLine(string.Format("- Deleted \"{0}\" user account ", username));
}
}
catch (Exception ex)
{
if (Utils.IsThreadAbortException(ex))
return;
Log.WriteError("User account delete error", ex);
InstallLog.AppendLine(string.Format("- Failed to delete \"{0}\" user account ", username));
throw;
}
}
private void DeleteApplicationPool(string name)
{
try
{
Log.WriteStart("Deleting application pool");
Log.WriteInfo(string.Format("Deleting \"{0}\" application pool", name));
if (WebUtils.ApplicationPoolExists(name))
{
int count = WebUtils.GetApplicationPoolSitesCount(name);
if (count > 0)
{
Log.WriteEnd("Application pool is not empty");
}
else
{
WebUtils.DeleteApplicationPool(name);
Log.WriteEnd("Deleted application pool");
InstallLog.AppendLine(string.Format("- Deleted \"{0}\" application pool ", name));
}
}
}
catch (Exception ex)
{
if (Utils.IsThreadAbortException(ex))
return;
Log.WriteError("Application pool delete error", ex);
InstallLog.AppendLine(string.Format("- Failed to delete \"{0}\" application pool ", name));
throw;
}
}
private void DeleteIIS7ApplicationPool(string name)
{
try
{
Log.WriteStart("Deleting application pool");
Log.WriteInfo(string.Format("Deleting \"{0}\" application pool", name));
if (WebUtils.IIS7ApplicationPoolExists(name))
{
int count = WebUtils.GetIIS7ApplicationPoolSitesCount(name);
if (count > 0)
{
Log.WriteEnd("Application pool is not empty");
}
else
{
WebUtils.DeleteIIS7ApplicationPool(name);
Log.WriteEnd("Deleted application pool");
InstallLog.AppendLine(string.Format("- Deleted \"{0}\" application pool ", name));
}
}
}
catch (Exception ex)
{
if (Utils.IsThreadAbortException(ex))
return;
Log.WriteError("Application pool delete error", ex);
InstallLog.AppendLine(string.Format("- Failed to delete \"{0}\" application pool ", name));
throw;
}
}
private void DeleteWebSite(string siteId)
{
try
{
Log.WriteStart("Deleting web site");
Log.WriteInfo(string.Format("Deleting \"{0}\" web site", siteId));
if (WebUtils.SiteIdExists(siteId))
{
WebUtils.DeleteSite(siteId);
Log.WriteEnd("Deleted web site");
InstallLog.AppendLine(string.Format("- Deleted \"{0}\" web site ", siteId));
}
}
catch (Exception ex)
{
if (Utils.IsThreadAbortException(ex))
return;
Log.WriteError("Web site delete error", ex);
InstallLog.AppendLine(string.Format("- Failed to delete \"{0}\" web site ", siteId));
throw;
}
}
private void DeleteIIS7WebSite(string siteId)
{
try
{
Log.WriteStart("Deleting web site");
Log.WriteInfo(string.Format("Deleting \"{0}\" web site", siteId));
if (WebUtils.IIS7SiteExists(siteId))
{
WebUtils.DeleteIIS7Site(siteId);
Log.WriteEnd("Deleted web site");
InstallLog.AppendLine(string.Format("- Deleted \"{0}\" web site ", siteId));
}
}
catch (Exception ex)
{
if (Utils.IsThreadAbortException(ex))
return;
Log.WriteError("Web site delete error", ex);
InstallLog.AppendLine(string.Format("- Failed to delete \"{0}\" web site ", siteId));
throw;
}
}
private void DeleteVirtualDirectory(string siteId, string name)
{
try
{
Log.WriteStart("Deleting virtual directory");
Log.WriteInfo(string.Format("Deleting virtual directory \"{0}\" for the site \"{1}\"", name, siteId));
if (WebUtils.VirtualDirectoryExists(siteId, name))
{
WebUtils.DeleteVirtualDirectory(siteId, name);
Log.WriteEnd("Deleted virtual directory");
InstallLog.AppendLine(string.Format("- Deleted \"{0}\" virtual directory ", name));
}
}
catch (Exception ex)
{
if (Utils.IsThreadAbortException(ex))
return;
Log.WriteError("Virtual directory delete error", ex);
InstallLog.AppendLine(string.Format("- Failed to delete \"{0}\" virtual directory ", name));
throw;
}
}
}
}

View file

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View file

@ -0,0 +1,84 @@
namespace WebsitePanel.Setup
{
partial class UrlPage
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.lblURL = new System.Windows.Forms.Label();
this.txtURL = new System.Windows.Forms.TextBox();
this.lblIntro = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// lblURL
//
this.lblURL.Location = new System.Drawing.Point(3, 92);
this.lblURL.Name = "lblURL";
this.lblURL.Size = new System.Drawing.Size(139, 23);
this.lblURL.TabIndex = 13;
this.lblURL.Text = "Enterprise Server URL:";
//
// txtURL
//
this.txtURL.Location = new System.Drawing.Point(148, 92);
this.txtURL.Name = "txtURL";
this.txtURL.Size = new System.Drawing.Size(306, 20);
this.txtURL.TabIndex = 14;
//
// lblIntro
//
this.lblIntro.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.lblIntro.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.lblIntro.Location = new System.Drawing.Point(0, 0);
this.lblIntro.Name = "lblIntro";
this.lblIntro.Size = new System.Drawing.Size(457, 58);
this.lblIntro.TabIndex = 12;
this.lblIntro.Text = "Please, specify URL which will be used to access the Enterprise Server from the P" +
"ortal. Click Next to continue.";
//
// UrlPage
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.lblURL);
this.Controls.Add(this.txtURL);
this.Controls.Add(this.lblIntro);
this.Name = "UrlPage";
this.Size = new System.Drawing.Size(457, 228);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label lblURL;
private System.Windows.Forms.TextBox txtURL;
private System.Windows.Forms.Label lblIntro;
}
}

View file

@ -0,0 +1,148 @@
// Copyright (c) 2011, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System;
using System.IO;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Windows.Forms;
using System.Xml;
namespace WebsitePanel.Setup
{
public partial class UrlPage : BannerWizardPage
{
public UrlPage()
{
InitializeComponent();
}
protected override void InitializePageInternal()
{
base.InitializePageInternal();
this.Text = "Enterprise Server URL";
this.Description = "Enter the Enterprise Server URL";
if (Wizard.SetupVariables.SetupAction == SetupActions.Setup)
{
LoadUrl();
}
this.txtURL.Text = Wizard.SetupVariables.EnterpriseServerURL;
this.AllowMoveBack = true;
this.AllowMoveNext = true;
this.AllowCancel = true;
}
protected internal override void OnAfterDisplay(EventArgs e)
{
base.OnAfterDisplay(e);
//unattended setup
if (!string.IsNullOrEmpty(Wizard.SetupVariables.SetupXml) && AllowMoveNext)
Wizard.GoNext();
}
private void LoadUrl()
{
try
{
Wizard.SetupVariables.EnterpriseServerURL = string.Empty;
string installFolder = Wizard.SetupVariables.InstallationFolder;
string path = Path.Combine(installFolder, @"App_Data\SiteSettings.config");
if (!File.Exists(path))
{
Log.WriteInfo(string.Format("File {0} not found", path));
return;
}
XmlDocument doc = new XmlDocument();
doc.Load(path);
XmlElement urlNode = doc.SelectSingleNode("SiteSettings/EnterpriseServer") as XmlElement;
if (urlNode == null)
{
Log.WriteInfo("EnterpriseServer setting not found");
return;
}
Wizard.SetupVariables.EnterpriseServerURL = urlNode.InnerText;
}
catch(Exception ex)
{
Log.WriteError("Site settings error", ex);
}
}
protected internal override void OnBeforeMoveNext(CancelEventArgs e)
{
try
{
if (!CheckFields())
{
e.Cancel = true;
return;
}
Wizard.SetupVariables.EnterpriseServerURL = txtURL.Text;
}
catch
{
this.AllowMoveNext = false;
ShowError("Unable to set enterprise server URL.");
return;
}
base.OnBeforeMoveNext(e);
}
private bool CheckFields()
{
string url = txtURL.Text;
if (url.Trim().Length == 0)
{
return true;
}
Regex r = new Regex(@"(http|https)://([\w-]+\.)+[\w-]+(/[\w- ./?%&=]*)?");
Match m = r.Match(url);
if (!m.Success)
{
ShowWarning("Please enter valid URL");
return false;
}
return true;
}
}
}

View file

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View file

@ -0,0 +1,173 @@
namespace WebsitePanel.Setup
{
partial class UserAccountPage
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.chkUseActiveDirectory = new System.Windows.Forms.CheckBox();
this.txtDomain = new System.Windows.Forms.TextBox();
this.lblDomain = new System.Windows.Forms.Label();
this.lblWarning = new System.Windows.Forms.Label();
this.txtConfirmPassword = new System.Windows.Forms.TextBox();
this.txtUserName = new System.Windows.Forms.TextBox();
this.lblConfirmPassword = new System.Windows.Forms.Label();
this.lblUserName = new System.Windows.Forms.Label();
this.lblPassword = new System.Windows.Forms.Label();
this.txtPassword = new System.Windows.Forms.TextBox();
this.SuspendLayout();
//
// chkUseActiveDirectory
//
this.chkUseActiveDirectory.AutoSize = true;
this.chkUseActiveDirectory.Location = new System.Drawing.Point(62, 41);
this.chkUseActiveDirectory.Name = "chkUseActiveDirectory";
this.chkUseActiveDirectory.Size = new System.Drawing.Size(177, 17);
this.chkUseActiveDirectory.TabIndex = 11;
this.chkUseActiveDirectory.Text = "Create Active Directory account";
this.chkUseActiveDirectory.UseVisualStyleBackColor = true;
this.chkUseActiveDirectory.CheckedChanged += new System.EventHandler(this.OnActiveDirectoryChanged);
//
// txtDomain
//
this.txtDomain.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.txtDomain.Location = new System.Drawing.Point(188, 63);
this.txtDomain.Name = "txtDomain";
this.txtDomain.Size = new System.Drawing.Size(201, 20);
this.txtDomain.TabIndex = 13;
//
// lblDomain
//
this.lblDomain.Location = new System.Drawing.Point(59, 67);
this.lblDomain.Name = "lblDomain";
this.lblDomain.Size = new System.Drawing.Size(123, 16);
this.lblDomain.TabIndex = 12;
this.lblDomain.Text = "Domain:";
//
// lblWarning
//
this.lblWarning.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.lblWarning.Location = new System.Drawing.Point(3, 0);
this.lblWarning.Name = "lblWarning";
this.lblWarning.Size = new System.Drawing.Size(451, 38);
this.lblWarning.TabIndex = 10;
this.lblWarning.Text = "Please specify a new Windows user account for the web site anonymous access and a" +
"pplication pool identity.";
//
// txtConfirmPassword
//
this.txtConfirmPassword.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.txtConfirmPassword.Location = new System.Drawing.Point(188, 141);
this.txtConfirmPassword.Name = "txtConfirmPassword";
this.txtConfirmPassword.PasswordChar = '*';
this.txtConfirmPassword.Size = new System.Drawing.Size(201, 20);
this.txtConfirmPassword.TabIndex = 19;
//
// txtUserName
//
this.txtUserName.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.txtUserName.Location = new System.Drawing.Point(188, 89);
this.txtUserName.Name = "txtUserName";
this.txtUserName.Size = new System.Drawing.Size(201, 20);
this.txtUserName.TabIndex = 15;
//
// lblConfirmPassword
//
this.lblConfirmPassword.Location = new System.Drawing.Point(59, 145);
this.lblConfirmPassword.Name = "lblConfirmPassword";
this.lblConfirmPassword.Size = new System.Drawing.Size(123, 16);
this.lblConfirmPassword.TabIndex = 18;
this.lblConfirmPassword.Text = "Confirm Password:";
//
// lblUserName
//
this.lblUserName.Location = new System.Drawing.Point(59, 93);
this.lblUserName.Name = "lblUserName";
this.lblUserName.Size = new System.Drawing.Size(123, 16);
this.lblUserName.TabIndex = 14;
this.lblUserName.Text = "User Name:";
//
// lblPassword
//
this.lblPassword.Location = new System.Drawing.Point(59, 119);
this.lblPassword.Name = "lblPassword";
this.lblPassword.Size = new System.Drawing.Size(123, 16);
this.lblPassword.TabIndex = 16;
this.lblPassword.Text = "Password:";
//
// txtPassword
//
this.txtPassword.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.txtPassword.Location = new System.Drawing.Point(188, 115);
this.txtPassword.Name = "txtPassword";
this.txtPassword.PasswordChar = '*';
this.txtPassword.Size = new System.Drawing.Size(201, 20);
this.txtPassword.TabIndex = 17;
//
// WebSecurityPage
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.chkUseActiveDirectory);
this.Controls.Add(this.txtDomain);
this.Controls.Add(this.lblDomain);
this.Controls.Add(this.lblWarning);
this.Controls.Add(this.txtConfirmPassword);
this.Controls.Add(this.txtUserName);
this.Controls.Add(this.lblConfirmPassword);
this.Controls.Add(this.lblUserName);
this.Controls.Add(this.lblPassword);
this.Controls.Add(this.txtPassword);
this.Name = "WebSecurityPage";
this.Size = new System.Drawing.Size(457, 228);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.CheckBox chkUseActiveDirectory;
private System.Windows.Forms.TextBox txtDomain;
private System.Windows.Forms.Label lblDomain;
private System.Windows.Forms.Label lblWarning;
private System.Windows.Forms.TextBox txtConfirmPassword;
private System.Windows.Forms.TextBox txtUserName;
private System.Windows.Forms.Label lblConfirmPassword;
private System.Windows.Forms.Label lblUserName;
private System.Windows.Forms.Label lblPassword;
private System.Windows.Forms.TextBox txtPassword;
}
}

View file

@ -0,0 +1,291 @@
// Copyright (c) 2011, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System;
using System.Management;
using System.IO;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Text.RegularExpressions;
using System.Windows.Forms;
using WebsitePanel.Setup.Web;
using WebsitePanel.Setup.Windows;
namespace WebsitePanel.Setup
{
public partial class UserAccountPage : BannerWizardPage
{
public UserAccountPage()
{
InitializeComponent();
}
public string WarningText
{
get { return lblWarning.Text; }
set { lblWarning.Text = value; }
}
protected override void InitializePageInternal()
{
base.InitializePageInternal();
this.Text = "Security Settings";
string component = Wizard.SetupVariables.ComponentFullName;
this.Description = string.Format("Specify {0} security settings.", component);
this.AllowMoveBack = true;
this.AllowMoveNext = true;
this.AllowCancel = true;
if (!string.IsNullOrEmpty(Wizard.SetupVariables.UserAccount))
{
txtUserName.Text = Wizard.SetupVariables.UserAccount;
txtDomain.Text = Wizard.SetupVariables.UserDomain;
txtPassword.Text = Wizard.SetupVariables.UserPassword;
txtConfirmPassword.Text = Wizard.SetupVariables.UserPassword;
chkUseActiveDirectory.Checked = !string.IsNullOrEmpty(Wizard.SetupVariables.UserDomain);
}
else
{
//creating user account
string userName = component.Replace(" ", string.Empty);
userName = userName.Replace("WebsitePanel", "WP");
txtUserName.Text = userName;
txtDomain.Text = "mydomain.com";
string password = Guid.NewGuid().ToString("P");
this.txtPassword.Text = password;
this.txtConfirmPassword.Text = password;
if (Environment.UserDomainName != Environment.MachineName)
{
chkUseActiveDirectory.Checked = true;
string domainName = SecurityUtils.GetFullDomainName(Environment.UserDomainName);
if (!string.IsNullOrEmpty(domainName))
{
txtDomain.Text = domainName;
}
}
else
{
chkUseActiveDirectory.Checked = false;
}
}
UpdateControls();
}
protected internal override void OnAfterDisplay(EventArgs e)
{
base.OnAfterDisplay(e);
//unattended setup
if (!string.IsNullOrEmpty(Wizard.SetupVariables.SetupXml) && AllowMoveNext)
Wizard.GoNext();
}
private bool CheckSettings()
{
string name = txtUserName.Text;
string password = txtPassword.Text;
string confirm = txtConfirmPassword.Text;
string domain = txtDomain.Text;
if (chkUseActiveDirectory.Checked)
{
if (domain.Trim().Length == 0)
{
ShowWarning("Please enter domain name");
return false;
}
string users = SecurityUtils.GetDomainUsersContainer(domain);
if (string.IsNullOrEmpty(users))
{
ShowWarning("Domain not found or access denied.");
return false;
}
if (!SecurityUtils.ADObjectExists(users))
{
ShowWarning("Domain not found or access denied.");
return false;
}
}
if (name.Trim().Length == 0)
{
ShowWarning("Please enter user name");
return false;
}
if (password.Trim().Length == 0)
{
ShowWarning("Please enter password");
return false;
}
if (password != confirm)
{
ShowWarning("The password was not correctly confirmed. Please ensure that the password and confirmation match exactly.");
return false;
}
return true;
}
private bool ProcessSettings()
{
if (!CheckSettings())
{
return false;
}
if (!CheckUserAccount())
{
return false;
}
return true;
}
private bool CheckUserAccount()
{
string userName = txtUserName.Text;
string password = txtPassword.Text;
string domain = (chkUseActiveDirectory.Checked ? txtDomain.Text : null);
if (SecurityUtils.UserExists(domain, userName))
{
ShowWarning(string.Format("{0} user account already exists.", userName));
return false;
}
bool created = false;
try
{
// create account
Log.WriteStart(string.Format("Creating temp user account \"{0}\"", userName));
SystemUserItem user = new SystemUserItem();
user.Name = userName;
user.FullName = userName;
user.Description = string.Empty;
user.MemberOf = null;
user.Password = password;
user.PasswordCantChange = true;
user.PasswordNeverExpires = true;
user.AccountDisabled = false;
user.System = true;
user.Domain = domain;
SecurityUtils.CreateUser(user);
//update log
Log.WriteEnd("Created temp local user account");
created = true;
}
catch (Exception ex)
{
System.Runtime.InteropServices.COMException e = ex.InnerException as System.Runtime.InteropServices.COMException;
Log.WriteError("Create temp local user account error", ex);
string errorMessage = "Unable to create Windows user account";
if (e != null )
{
string errorCode = string.Format("{0:x}", e.ErrorCode);
switch (errorCode)
{
case "8007089a":
errorMessage = "Invalid username";
break;
case "800708c5":
errorMessage = "The password does not meet the password policy requirements. Check the minimum password length, password complexity and password history requirements.";
break;
case "800708b0":
errorMessage = "The account already exists.";
break;
}
}
ShowWarning(errorMessage);
return false;
}
if (created)
{
Log.WriteStart(string.Format("Deleting temp local user account \"{0}\"", userName));
try
{
SecurityUtils.DeleteUser(domain, userName);
}
catch (Exception ex)
{
Log.WriteError("Delete temp local user account error", ex);
}
Log.WriteEnd("Deleted temp local user account");
}
return true;
}
protected internal override void OnBeforeMoveNext(CancelEventArgs e)
{
string userName = txtUserName.Text;
string password = txtPassword.Text;
string domain = (chkUseActiveDirectory.Checked ? txtDomain.Text : null);
Log.WriteInfo(string.Format("Domain: {0}", domain));
Log.WriteInfo(string.Format("User name: {0}", userName));
if (!ProcessSettings())
{
e.Cancel = true;
return;
}
Wizard.SetupVariables.UserAccount = userName;
Wizard.SetupVariables.UserPassword = password;
Wizard.SetupVariables.UserDomain = domain;
base.OnBeforeMoveNext(e);
}
private void OnActiveDirectoryChanged(object sender, EventArgs e)
{
UpdateControls();
}
private void UpdateControls()
{
bool useAD = chkUseActiveDirectory.Checked;
lblDomain.Visible = useAD;
txtDomain.Visible = useAD;
Update();
}
}
}

View file

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View file

@ -0,0 +1,179 @@
namespace WebsitePanel.Setup
{
partial class WebPage
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.grpWebSiteSettings = new System.Windows.Forms.GroupBox();
this.lblHint = new System.Windows.Forms.Label();
this.cbWebSiteIP = new System.Windows.Forms.ComboBox();
this.lblWebSiteTcpPort = new System.Windows.Forms.Label();
this.txtWebSiteTcpPort = new System.Windows.Forms.TextBox();
this.lblWebSiteIP = new System.Windows.Forms.Label();
this.lblWebSiteDomain = new System.Windows.Forms.Label();
this.txtWebSiteDomain = new System.Windows.Forms.TextBox();
this.txtAddress = new System.Windows.Forms.TextBox();
this.lblWarning = new System.Windows.Forms.Label();
this.grpWebSiteSettings.SuspendLayout();
this.SuspendLayout();
//
// grpWebSiteSettings
//
this.grpWebSiteSettings.Controls.Add(this.lblHint);
this.grpWebSiteSettings.Controls.Add(this.cbWebSiteIP);
this.grpWebSiteSettings.Controls.Add(this.lblWebSiteTcpPort);
this.grpWebSiteSettings.Controls.Add(this.txtWebSiteTcpPort);
this.grpWebSiteSettings.Controls.Add(this.lblWebSiteIP);
this.grpWebSiteSettings.Controls.Add(this.lblWebSiteDomain);
this.grpWebSiteSettings.Controls.Add(this.txtWebSiteDomain);
this.grpWebSiteSettings.Location = new System.Drawing.Point(40, 33);
this.grpWebSiteSettings.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.grpWebSiteSettings.Name = "grpWebSiteSettings";
this.grpWebSiteSettings.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.grpWebSiteSettings.Size = new System.Drawing.Size(528, 174);
this.grpWebSiteSettings.TabIndex = 0;
this.grpWebSiteSettings.TabStop = false;
this.grpWebSiteSettings.Text = "Web Site Settings";
//
// lblHint
//
this.lblHint.Location = new System.Drawing.Point(40, 143);
this.lblHint.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.lblHint.Name = "lblHint";
this.lblHint.Size = new System.Drawing.Size(440, 20);
this.lblHint.TabIndex = 6;
this.lblHint.Text = "Example: www.contoso.com or panel.contoso.com";
//
// cbWebSiteIP
//
this.cbWebSiteIP.Location = new System.Drawing.Point(44, 50);
this.cbWebSiteIP.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.cbWebSiteIP.Name = "cbWebSiteIP";
this.cbWebSiteIP.Size = new System.Drawing.Size(292, 24);
this.cbWebSiteIP.TabIndex = 1;
this.cbWebSiteIP.TextChanged += new System.EventHandler(this.OnAddressChanged);
//
// lblWebSiteTcpPort
//
this.lblWebSiteTcpPort.Location = new System.Drawing.Point(352, 27);
this.lblWebSiteTcpPort.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.lblWebSiteTcpPort.Name = "lblWebSiteTcpPort";
this.lblWebSiteTcpPort.Size = new System.Drawing.Size(128, 20);
this.lblWebSiteTcpPort.TabIndex = 2;
this.lblWebSiteTcpPort.Text = "Port:";
//
// txtWebSiteTcpPort
//
this.txtWebSiteTcpPort.Location = new System.Drawing.Point(356, 50);
this.txtWebSiteTcpPort.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.txtWebSiteTcpPort.Name = "txtWebSiteTcpPort";
this.txtWebSiteTcpPort.Size = new System.Drawing.Size(63, 22);
this.txtWebSiteTcpPort.TabIndex = 3;
this.txtWebSiteTcpPort.TextChanged += new System.EventHandler(this.OnAddressChanged);
//
// lblWebSiteIP
//
this.lblWebSiteIP.Location = new System.Drawing.Point(40, 27);
this.lblWebSiteIP.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.lblWebSiteIP.Name = "lblWebSiteIP";
this.lblWebSiteIP.Size = new System.Drawing.Size(139, 20);
this.lblWebSiteIP.TabIndex = 0;
this.lblWebSiteIP.Text = "IP address:";
//
// lblWebSiteDomain
//
this.lblWebSiteDomain.Location = new System.Drawing.Point(40, 91);
this.lblWebSiteDomain.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.lblWebSiteDomain.Name = "lblWebSiteDomain";
this.lblWebSiteDomain.Size = new System.Drawing.Size(112, 20);
this.lblWebSiteDomain.TabIndex = 4;
this.lblWebSiteDomain.Text = "Host name:";
//
// txtWebSiteDomain
//
this.txtWebSiteDomain.Location = new System.Drawing.Point(44, 114);
this.txtWebSiteDomain.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.txtWebSiteDomain.Name = "txtWebSiteDomain";
this.txtWebSiteDomain.Size = new System.Drawing.Size(435, 22);
this.txtWebSiteDomain.TabIndex = 5;
this.txtWebSiteDomain.TextChanged += new System.EventHandler(this.OnAddressChanged);
//
// txtAddress
//
this.txtAddress.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.txtAddress.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.txtAddress.Location = new System.Drawing.Point(40, 10);
this.txtAddress.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.txtAddress.Name = "txtAddress";
this.txtAddress.ReadOnly = true;
this.txtAddress.Size = new System.Drawing.Size(528, 16);
this.txtAddress.TabIndex = 2;
//
// lblWarning
//
this.lblWarning.Location = new System.Drawing.Point(40, 210);
this.lblWarning.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.lblWarning.Name = "lblWarning";
this.lblWarning.Size = new System.Drawing.Size(528, 44);
this.lblWarning.TabIndex = 1;
this.lblWarning.Text = "Make sure the specified host name is pointed to this web site; otherwise y" +
"ou might not be able to access the application.\r\n";
//
// WebPage
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.lblWarning);
this.Controls.Add(this.grpWebSiteSettings);
this.Controls.Add(this.txtAddress);
this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.Name = "WebPage";
this.Size = new System.Drawing.Size(609, 281);
this.grpWebSiteSettings.ResumeLayout(false);
this.grpWebSiteSettings.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.GroupBox grpWebSiteSettings;
private System.Windows.Forms.Label lblWebSiteTcpPort;
private System.Windows.Forms.TextBox txtWebSiteTcpPort;
private System.Windows.Forms.Label lblWebSiteIP;
private System.Windows.Forms.Label lblWebSiteDomain;
private System.Windows.Forms.TextBox txtWebSiteDomain;
private System.Windows.Forms.TextBox txtAddress;
private System.Windows.Forms.Label lblWarning;
private System.Windows.Forms.ComboBox cbWebSiteIP;
private System.Windows.Forms.Label lblHint;
}
}

View file

@ -0,0 +1,395 @@
// Copyright (c) 2011, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System;
using System.Management;
using System.DirectoryServices;
using System.DirectoryServices.ActiveDirectory;
using System.IO;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Text.RegularExpressions;
using System.Windows.Forms;
using WebsitePanel.Setup.Web;
namespace WebsitePanel.Setup
{
public partial class WebPage : BannerWizardPage
{
public WebPage()
{
InitializeComponent();
}
protected override void InitializePageInternal()
{
base.InitializePageInternal();
this.Text = "Web Settings";
string component = SetupVariables.ComponentFullName;
this.Description = string.Format("Specify {0} web settings.", component);
this.AllowMoveBack = true;
this.AllowMoveNext = true;
this.AllowCancel = true;
// init fields
PopulateIPs();
this.txtWebSiteDomain.Text = SetupVariables.WebSiteDomain;
this.txtWebSiteTcpPort.Text = SetupVariables.WebSitePort;
if (SetupVariables.NewVirtualDirectory)
{
this.txtWebSiteDomain.Enabled = false;
this.cbWebSiteIP.Enabled = false;
this.txtWebSiteTcpPort.Enabled = false;
}
UpdateApplicationAddress();
Update();
}
protected internal override void OnAfterDisplay(EventArgs e)
{
base.OnAfterDisplay(e);
//unattended setup
if (!string.IsNullOrEmpty(Wizard.SetupVariables.SetupXml) && AllowMoveNext)
Wizard.GoNext();
}
private void PopulateIPs()
{
try
{
Log.WriteStart("Loading IPs");
cbWebSiteIP.Items.Clear();
string[] ips = WebUtils.GetIPv4Addresses();
foreach (string ip in ips)
{
cbWebSiteIP.Items.Add(ip);
}
Log.WriteEnd("Loaded IPs");
if (string.IsNullOrEmpty(SetupVariables.WebSiteIP))
{
//select first available
if (cbWebSiteIP.Items.Count > 0)
{
cbWebSiteIP.Text = cbWebSiteIP.Items[0].ToString();
}
}
else
{
//add 127.0.0.1
if (!cbWebSiteIP.Items.Contains(SetupVariables.WebSiteIP))
{
cbWebSiteIP.Items.Insert(0, SetupVariables.WebSiteIP);
}
cbWebSiteIP.Text = SetupVariables.WebSiteIP;
}
Update();
}
catch (Exception ex)
{
Log.WriteError("WMI error", ex);
}
}
private void OnAddressChanged(object sender, System.EventArgs e)
{
UpdateApplicationAddress();
}
private void UpdateApplicationAddress()
{
/*if (SetupVariables.NewVirtualDirectory)
{
this.txtAddress.StatusMessage = string.Empty;
return;
}*/
string address = "http://";
string server = string.Empty;
string port = string.Empty;
string virtualDir = string.Empty;
//server
if (txtWebSiteDomain.Text.Trim().Length > 0)
{
//domain
server = txtWebSiteDomain.Text.Trim();
}
else
{
//ip
if (cbWebSiteIP.Text.Trim().Length > 0)
{
server = cbWebSiteIP.Text.Trim();
}
}
//port
if (server.Length > 0 &&
txtWebSiteTcpPort.Text.Trim().Length > 0 &&
txtWebSiteTcpPort.Text.Trim() != "80")
{
port = ":" + txtWebSiteTcpPort.Text.Trim();
}
//virtual dir
if (server.Length > 0 &&
(!string.IsNullOrEmpty(SetupVariables.VirtualDirectory)))
{
virtualDir = "/" + SetupVariables.VirtualDirectory;
}
//address string
address += server + port + virtualDir;
txtAddress.Text = address;
}
private bool CheckWebExtensions()
{
bool ret = true;
try
{
if (SetupVariables.IISVersion.Major < 7)
{
DirectoryEntry iis = new DirectoryEntry("IIS://LocalHost/W3SVC");
WebExtensionStatus status = WebExtensionStatus.NotInstalled;
foreach (string propertyName in iis.Properties.PropertyNames)
{
if (propertyName.Equals("WebSvcExtRestrictionList", StringComparison.InvariantCultureIgnoreCase))
{
PropertyValueCollection valueCollection = iis.Properties[propertyName];
foreach (object objVal in valueCollection)
{
if (objVal != null && !string.IsNullOrEmpty(objVal.ToString()))
{
string strVal = objVal.ToString().ToLower();
if (strVal.Contains(@"\v2.0.50727\aspnet_isapi.dll".ToLower()))
{
if (strVal[0] == '1')
{
status = WebExtensionStatus.Allowed;
}
else if (status == WebExtensionStatus.NotInstalled)
{
status = WebExtensionStatus.Prohibited;
}
}
}
}
}
}
if (status == WebExtensionStatus.NotInstalled)
{
ShowWarning("ASP.NET 2.0 is not installed in the Web Service Extensions in IIS. Please install ASP.NET 2.0 Web Service Extension and click Next button to continue with the installation.");
ret = false;
}
else if (status == WebExtensionStatus.Prohibited)
{
ShowWarning("ASP.NET 2.0 is not allowed in the Web Service Extensions in IIS. Please allow ASP.NET 2.0 Web Service Extension and click Next button to continue with the installation.");
ret = false;
}
}
}
catch (Exception ex)
{
// you cannot enumerate metabase properties unless you are using Windows XP Professional with Service Pack 2 or Windows Server 2003 with Service Pack 1.
Log.WriteError("IIS metabase error", ex);
ret = true;
}
return ret;
}
private bool IsValidIPv4(string address)
{
return Regex.IsMatch(address, @"^(?:(?:25[0-5]|2[0-4]\d|[01]\d\d|\d?\d)(?(?=\.?\d)\.)){4}$");
}
private bool CheckWebSite()
{
string ip = cbWebSiteIP.Text;
string port = txtWebSiteTcpPort.Text;
string domain = txtWebSiteDomain.Text;
if (ip.Trim().Length == 0)
{
ShowWarning("Please enter web site IP address");
return false;
}
if (!IsValidIPv4(ip))
{
ShowWarning("Please enter valid IP address (for example, 192.168.1.42)");
return false;
}
if (domain.Trim().Length > 0)
{
if (!Regex.IsMatch(domain, @"^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,6}$"))
{
ShowWarning("Please enter valid domain name (for example, mydomain.com)");
return false;
}
}
if (port.Trim().Length == 0)
{
ShowWarning("Please enter TCP port");
return false;
}
for (int i = 0; i < port.Length; i++)
{
if (!Char.IsNumber(port, i))
{
ShowWarning("Please enter valid TCP port (for example, 80).");
return false;
}
}
return true;
}
private bool IsEqualString(string s1, string s2)
{
bool ret = false;
if (string.IsNullOrEmpty(s1) && string.IsNullOrEmpty(s2))
{
ret = true;
}
else
{
ret = (s1 == s2);
}
return ret;
}
private bool CheckServerBindings()
{
try
{
string newIP = cbWebSiteIP.Text;
string newPort = txtWebSiteTcpPort.Text;
string newDomain = txtWebSiteDomain.Text;
if (SetupVariables.SetupAction == SetupActions.Setup)
{
SetupVariables.UpdateWebSite = true;
//load old settings from config
string componentId = SetupVariables.ComponentId;
string ip = SetupVariables.WebSiteIP;
string port = SetupVariables.WebSitePort;
string domain = SetupVariables.WebSiteDomain;
//
/*string ip = AppConfig.GetComponentSettingStringValue(componentId, "WebSiteIP");
string port = AppConfig.GetComponentSettingStringValue(componentId, "WebSitePort");
string domain = AppConfig.GetComponentSettingStringValue(componentId, "WebSiteDomain");*/
if (newIP == ip && newPort == port && IsEqualString(newDomain,domain))
{
//settings were not changed
SetupVariables.UpdateWebSite = false;
return true;
}
}
bool iis7 = (SetupVariables.IISVersion.Major == 7);
string siteId = iis7 ?
WebUtils.GetIIS7SiteIdByBinding(newIP, newPort, newDomain) :
WebUtils.GetSiteIdByBinding(newIP, newPort, newDomain);
if (siteId == null)
return true;
// get site name
string siteName = iis7 ? siteId : WebUtils.GetSite(siteId).Name;
ShowWarning(String.Format("'{0}' web site already has server binding with specified IP, Port and Domain.\nPlease, provide another combination of IP, Port and Domain.",
siteName));
return false;
}
catch (Exception ex)
{
Log.WriteError("Web error", ex);
ShowError("Unable to load IIS data.");
return true;
}
}
private bool ProcessWebSettings()
{
if (!CheckWebExtensions())
{
return false;
}
if (!CheckWebSite())
{
return false;
}
if (!CheckServerBindings())
{
return false;
}
return true;
}
protected internal override void OnBeforeMoveNext(CancelEventArgs e)
{
if (SetupVariables.NewVirtualDirectory)
{
//virtual directory is not supported
if (SetupVariables.SetupAction == SetupActions.Setup)
{
SetupVariables.UpdateWebSite = false;
}
}
else
{
if (!ProcessWebSettings())
{
e.Cancel = true;
return;
}
SetupVariables.WebSiteIP = this.cbWebSiteIP.Text;
SetupVariables.WebSiteDomain = this.txtWebSiteDomain.Text;
SetupVariables.WebSitePort = this.txtWebSiteTcpPort.Text;
}
base.OnBeforeMoveNext(e);
}
}
}

View file

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View file

@ -0,0 +1,867 @@
// Copyright (c) 2011, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System;
using System.Configuration;
using System.Xml;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Runtime.CompilerServices;
using System.Windows.Forms;
using WebsitePanel.Setup.Actions;
namespace WebsitePanel.Setup
{
//[Designer(typeof(WizardDesigner)), ToolboxBitmap(typeof(Wizard)), DefaultEvent("Cancel")]
public class Wizard : ContainerControl
{
// Events
public event EventHandler Cancel;
public event EventHandler Finish;
private string prevText;
private string nextText;
private string cancelText;
private string finishText;
private string helpText;
private int bottomMargin;
private int topMargin;
private Size buttonSize;
private Button prevButton;
private Button nextButton;
private Button cancelButton;
private Button helpButton;
private WizardPageBase selectedPage;
private bool disabled;
private bool helpVisible;
private Image marginImage;
private Image bannerImage;
private Font textFont;
delegate void VoidCallback();
public Wizard()
{
this.prevText = "< &Back";
this.nextText = "&Next >";
this.cancelText = "&Cancel";
this.finishText = "&Finish";
this.helpText = "&Help";
this.disabled = false;
this.helpVisible = false;
base.SetStyle(ControlStyles.DoubleBuffer | ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint, true);
base.SetStyle(ControlStyles.ResizeRedraw, true);
base.SetStyle(ControlStyles.FixedHeight | ControlStyles.FixedWidth, true);
this.prevButton = new Button();
this.prevButton.FlatStyle = FlatStyle.System;
this.prevButton.Click += new EventHandler(this.OnPrevClick);
this.prevButton.TabIndex = 0x3e8;
this.nextButton = new Button();
this.nextButton.FlatStyle = FlatStyle.System;
this.nextButton.Click += new EventHandler(this.OnNextClick);
this.nextButton.TabIndex = 0x3e9;
this.cancelButton = new Button();
this.cancelButton.FlatStyle = FlatStyle.System;
this.cancelButton.Click += new EventHandler(this.OnCancelClick);
this.cancelButton.TabIndex = 0x3ea;
this.helpButton = new Button();
this.helpButton.FlatStyle = FlatStyle.System;
this.helpButton.Click += new EventHandler(this.OnHelpClick);
this.helpButton.TabIndex = 0x3eb;
this.helpButton.Visible = false;
base.Controls.AddRange(new Control[] { this.prevButton, this.nextButton, this.cancelButton, this.helpButton });
this.textFont = new Font("Verdana", 12f, FontStyle.Bold, GraphicsUnit.Point);
this.RecalculateSize();
this.SelectedPage = null;
this.setupVariables = new SetupVariables();
}
private void RecalculateSize()
{
this.bottomMargin = (int) (Control.DefaultFont.Height * 3.5f);
this.buttonSize = new Size((int) (Control.DefaultFont.Height * 5.8f), (int) (Control.DefaultFont.Height * 1.8f));
this.topMargin = (int) (Control.DefaultFont.Height * 4.5f);
this.Redraw();
}
private void DrawBannerPage(PaintEventArgs args)
{
Rectangle clientRect = base.ClientRectangle;
clientRect.Height = this.topMargin;
args.Graphics.FillRectangle(SystemBrushes.Window, clientRect);
args.Graphics.DrawLine(SystemPens.ControlDark, clientRect.Left, clientRect.Bottom, clientRect.Right, clientRect.Bottom);
args.Graphics.DrawLine(SystemPens.ControlLightLight, clientRect.Left, clientRect.Bottom + 1, clientRect.Right, clientRect.Bottom + 1);
int margin = (this.topMargin - 0x31) / 2;
Rectangle imageRect = clientRect;
imageRect.X = imageRect.Right - (0x31 + margin);
imageRect.Y += margin;
imageRect.Size = new Size(0x31, 0x31);
clientRect.Width -= 0x31 + margin;
if (this.BannerImage != null)
{
args.Graphics.DrawImage(this.BannerImage, imageRect);
}
else
{
args.Graphics.FillRectangle(Brushes.DarkBlue, imageRect);
}
using (StringFormat format = new StringFormat(StringFormat.GenericDefault))
{
clientRect.X += 0x17;
clientRect.Width -= 0x17 + (Control.DefaultFont.Height / 2);
clientRect.Y += (int) (Control.DefaultFont.Height * 0.8f);
SizeF stringSize = (SizeF) Size.Empty;
using (Font font = new Font("Tahoma", 9f, FontStyle.Bold, GraphicsUnit.Point))
{
using (SolidBrush brush = new SolidBrush(((BannerWizardPage) this.SelectedPage).TextColor))
{
args.Graphics.DrawString(this.SelectedPage.Text, font, brush, (RectangleF) clientRect, format);
}
stringSize = args.Graphics.MeasureString(this.SelectedPage.Text, font, (SizeF) clientRect.Size, format);
}
clientRect.Y += ((int) Math.Ceiling((double) stringSize.Height)) + 1;
clientRect.X += 0x17;
clientRect.Width -= 0x17;
using (SolidBrush brush = new SolidBrush(((BannerWizardPage) this.SelectedPage).DescriptionColor))
{
args.Graphics.DrawString(((BannerWizardPage) this.SelectedPage).Description, this.SelectedPage.Font, brush, (RectangleF) clientRect, format);
}
}
}
private WizardPageBase[] GetConnectedPages(WizardPageBase currentPage, bool forwardDirection)
{
ArrayList list = new ArrayList();
foreach (Control ctrl in base.Controls)
{
if (ctrl is WizardPageBase)
{
WizardPageBase page = (WizardPageBase) ctrl;
if (((page.NextPage == currentPage) && forwardDirection) || ((page.PreviousPage == currentPage) && !forwardDirection))
{
list.Add(page);
}
}
}
return (WizardPageBase[]) list.ToArray(typeof(WizardPageBase));
}
private void OnHelpClick(object sender, EventArgs args)
{
this.OnHelpRequested(new HelpEventArgs(Cursor.Position));
}
private WizardPageBase FindFirstWizardPage()
{
foreach (Control ctrl in base.Controls)
{
if (ctrl is IntroductionPage)
{
return (WizardPageBase) ctrl;
}
}
foreach (Control ctrl in base.Controls)
{
if (ctrl is WizardPageBase)
{
return (WizardPageBase) ctrl;
}
}
return null;
}
private void DrawMarginPage(PaintEventArgs args)
{
Rectangle clientRect = base.ClientRectangle;
clientRect.Width = 0xa4;
clientRect.Height -= this.bottomMargin + 2;
if (this.MarginImage != null)
{
args.Graphics.DrawImage(this.MarginImage, new Rectangle(0, 0, this.MarginImage.Width, this.MarginImage.Height));
}
else
{
args.Graphics.FillRectangle(Brushes.DarkBlue, clientRect);
}
clientRect = base.ClientRectangle;
clientRect.X += 0xa4;
clientRect.Width -= 0xa4;
clientRect.Height -= this.bottomMargin + 2;
using (SolidBrush brush = new SolidBrush(this.SelectedPage.BackColor))
{
args.Graphics.FillRectangle(brush, clientRect);
}
clientRect = base.ClientRectangle;
clientRect.X += 0xa4 + Control.DefaultFont.Height;
clientRect.Width -= 0xa4 + (Control.DefaultFont.Height * 2);
clientRect.Y += Control.DefaultFont.Height;
using (StringFormat format = new StringFormat(StringFormat.GenericDefault))
{
using (SolidBrush brush = new SolidBrush(this.SelectedPage.ForeColor))
{
args.Graphics.DrawString(this.SelectedPage.Text, this.textFont, brush, (RectangleF) clientRect, format);
}
}
}
private void OnCancelClick(object sender, EventArgs args)
{
this.OnCancel(EventArgs.Empty);
}
private void InitForm()
{
Form form = base.FindForm();
if ((form != null) && !base.DesignMode)
{
form.AcceptButton = this.nextButton;
form.CancelButton = this.cancelButton;
}
}
private void OnFormShown(object sender, EventArgs e)
{
WizardPageBase firstPage = this.SelectedPage;
if (firstPage != null)
{
firstPage.OnBeforeDisplay(EventArgs.Empty);
firstPage.OnAfterDisplay(EventArgs.Empty);
}
}
public void Close()
{
this.OnCancel(EventArgs.Empty);
}
private void OnNextClick(object source, EventArgs args)
{
this.GoNext();
}
internal void RedrawButtons()
{
this.prevButton.Text = this.prevText;
this.nextButton.Text = ((this.SelectedPage == null) || (this.SelectedPage.NextPage != null)) ? this.nextText : this.finishText;
this.cancelButton.Text = this.cancelText;
this.helpButton.Text = this.helpText;
if (this.disabled)
{
this.prevButton.Enabled = false;
this.nextButton.Enabled = false;
this.cancelButton.Enabled = false;
this.helpButton.Enabled = false;
}
else
{
this.prevButton.Enabled = ((this.SelectedPage != null) && (this.SelectedPage.PreviousPage != null)) && (this.SelectedPage.AllowMoveBack || base.DesignMode);
this.nextButton.Enabled = (this.SelectedPage != null) && (this.SelectedPage.AllowMoveNext || base.DesignMode);
this.cancelButton.Enabled = (this.SelectedPage != null) && this.SelectedPage.AllowCancel;
this.helpButton.Enabled = this.SelectedPage != null;
}
}
private void OnPrevClick(object source, EventArgs args)
{
this.GoBack();
}
protected override void Dispose(bool disposing)
{
if (disposing)
{
this.textFont.Dispose();
}
base.Dispose(disposing);
}
internal void Redraw()
{
if (this.SelectedPage != null)
{
this.SelectedPage.Visible = true;
}
foreach (Control ctrl in base.Controls)
{
if (ctrl is WizardPageBase)
{
if (ctrl is MarginWizardPage)
{
ctrl.Bounds = this.CoverPageBounds;
}
else
{
ctrl.Bounds = this.ContentPageBounds;
}
ctrl.Visible = ( ctrl == this.SelectedPage );
}
}
int y = (base.ClientRectangle.Bottom - (this.bottomMargin / 2)) - (this.buttonSize.Height / 2);
int x = y - (base.ClientRectangle.Bottom - this.bottomMargin);
Rectangle rect = new Rectangle((base.ClientRectangle.Right - x) - this.buttonSize.Width, y, this.buttonSize.Width, this.buttonSize.Height);
if (this.HelpVisible)
{
this.helpButton.Bounds = rect;
rect.Offset(-(this.buttonSize.Width + x), 0);
}
this.helpButton.Visible = this.HelpVisible;
this.cancelButton.Bounds = rect;
rect.Offset(-(this.buttonSize.Width + x), 0);
this.nextButton.Bounds = rect;
rect.Offset(-this.buttonSize.Width, 0);
this.prevButton.Bounds = rect;
base.Invalidate();
}
public WizardPageBase[] GetPagesWithNextPage(WizardPageBase nextPage)
{
return this.GetConnectedPages(nextPage, true);
}
public WizardPageBase[] GetPagesWithPreviousPage(WizardPageBase previousPage)
{
return this.GetConnectedPages(previousPage, false);
}
public virtual void GoBack()
{
//thread safe call
if (this.InvokeRequired)
{
VoidCallback callback = new VoidCallback(GoBack);
this.Invoke(callback);
}
else
{
this.disabled = true;
this.RedrawButtons();
this.Cursor = Cursors.WaitCursor;
try
{
WizardPageBase selectedPage = this.SelectedPage;
CancelEventArgs args = new CancelEventArgs();
selectedPage.OnBeforeMoveBack(args);
if (!args.Cancel)
{
WizardPageBase prevPage = selectedPage.PreviousPage;
this.SelectedPage = prevPage;
if (prevPage != null)
{
prevPage.OnAfterDisplay(EventArgs.Empty);
}
}
}
finally
{
this.disabled = false;
this.RedrawButtons();
this.Cursor = Cursors.Default;
}
}
}
public virtual void GoNext()
{
//thread safe call
if (this.InvokeRequired)
{
VoidCallback callback = new VoidCallback(GoNext);
this.Invoke(callback);
}
else
{
if (this.SelectedPage != null)
{
this.disabled = true;
this.RedrawButtons();
this.Cursor = Cursors.WaitCursor;
try
{
WizardPageBase selectedPage = this.SelectedPage;
CancelEventArgs args = new CancelEventArgs();
selectedPage.OnBeforeMoveNext(args);
if (!args.Cancel)
{
if (selectedPage.NextPage == null)
{
this.OnFinish(EventArgs.Empty);
}
else
{
WizardPageBase nextPage = selectedPage.NextPage;
if (nextPage != null)
{
nextPage.OnBeforeDisplay(EventArgs.Empty);
}
this.SelectedPage = nextPage;
if (nextPage != null)
{
nextPage.OnAfterDisplay(EventArgs.Empty);
}
}
}
}
finally
{
this.disabled = false;
this.RedrawButtons();
this.Cursor = Cursors.Default;
}
}
}
}
protected virtual void OnCancel(EventArgs e)
{
Log.WriteInfo("Setup wizard was canceled by user");
Form form = base.FindForm();
if ((form != null) && form.Modal)
{
form.DialogResult = DialogResult.Cancel;
}
if (SelectedPage != null && SelectedPage.CustomCancelHandler)
return;
if (this.Cancel != null)
{
this.Cancel(this, e);
}
}
protected override void OnControlAdded(ControlEventArgs e)
{
if ((e.Control is WizardPageBase) && (this.SelectedPage == null))
{
this.SelectedPage = (WizardPageBase) e.Control;
}
else
{
this.Redraw();
}
base.OnControlAdded(e);
}
protected override void OnControlRemoved(ControlEventArgs e)
{
if (this.SelectedPage == e.Control)
{
if (base.Controls.Contains(this.SelectedPage.PreviousPage))
{
this.SelectedPage = this.SelectedPage.PreviousPage;
}
else
{
this.SelectedPage = this.FindFirstWizardPage();
}
}
else
{
this.Redraw();
}
base.OnControlRemoved(e);
}
protected virtual void OnFinish(EventArgs e)
{
Form form = base.FindForm();
if ((form != null) && form.Modal)
{
form.DialogResult = DialogResult.OK;
}
if (this.Finish != null)
{
this.Finish(this, e);
}
}
protected override void OnPaint(PaintEventArgs args)
{
Rectangle clientRect = base.ClientRectangle;
args.Graphics.DrawLine(SystemPens.ControlLightLight, clientRect.Left, (clientRect.Bottom - this.bottomMargin) - 1, clientRect.Right, (clientRect.Bottom - this.bottomMargin) - 1);
args.Graphics.DrawLine(SystemPens.ControlDark, clientRect.Left, (clientRect.Bottom - this.bottomMargin) - 2, clientRect.Right, (clientRect.Bottom - this.bottomMargin) - 2);
if (this.SelectedPage is MarginWizardPage)
{
this.DrawMarginPage(args);
}
else if (this.SelectedPage is BannerWizardPage)
{
this.DrawBannerPage(args);
}
}
protected override void OnParentChanged(EventArgs e)
{
base.OnParentChanged(e);
this.InitForm();
Form form = base.FindForm();
if ((form != null) && !base.DesignMode)
{
form.Shown += new EventHandler(OnFormShown);
}
}
protected override void OnResize(EventArgs e)
{
this.RecalculateSize();
base.OnResize(e);
}
public void SetPagePair(WizardPageBase firstPage, WizardPageBase secondPage)
{
firstPage.NextPage = secondPage;
secondPage.PreviousPage = firstPage;
}
public void LinkPages()
{
WizardPageBase prevPage = null;
foreach(Control ctrl in this.Controls)
{
WizardPageBase page = ctrl as WizardPageBase;
if (page != null)
{
page.PreviousPage = prevPage;
if (prevPage != null)
{
prevPage.NextPage = page;
}
prevPage = page;
}
}
}
[Browsable(false)]
public override Color BackColor
{
get
{
return base.BackColor;
}
set
{
base.BackColor = value;
}
}
[Browsable(false)]
public override Image BackgroundImage
{
get
{
return base.BackgroundImage;
}
set
{
base.BackgroundImage = value;
}
}
[AmbientValue(typeof(Image), null), DefaultValue(typeof(Image), null), Category("Appearance"), Description("The image displayed at the top right on content pages. The image must be 49x49 pixels.")]
public Image BannerImage
{
get
{
return this.bannerImage;
}
set
{
if ((value != null) && ((value.Width != 0x31) || (value.Height != 0x31)))
{
throw new ArgumentException(string.Concat(new object[] { "The banner image must be ", 0x31, " pixels wide and ", 0x31, " pixels high." }));
}
this.bannerImage = value;
if (this.SelectedPage is BannerWizardPage)
{
base.Invalidate();
}
}
}
[DefaultValue("Cancel")]
public string CancelText
{
get
{
return this.cancelText;
}
set
{
if (value == null)
{
throw new ArgumentNullException();
}
this.cancelText = value;
this.RedrawButtons();
}
}
protected virtual Rectangle ContentPageBounds
{
get
{
Rectangle clientRect = base.ClientRectangle;
clientRect.Height -= this.bottomMargin + 2;
clientRect.Y += this.topMargin + 2;
clientRect.Height -= this.topMargin + 2;
clientRect.Inflate((int) (-Control.DefaultFont.Height * 1.5), -Control.DefaultFont.Height);
return clientRect;
}
}
protected virtual Rectangle CoverPageBounds
{
get
{
Rectangle clientRect = base.ClientRectangle;
clientRect.Height -= this.bottomMargin + 2;
clientRect.X += 0xa4;
clientRect.Width -= 0xa4;
int num1 = (this.textFont.Height * 2) + Control.DefaultFont.Height;
clientRect.Y += num1;
clientRect.Height -= num1;
clientRect.Inflate(-Control.DefaultFont.Height, -Control.DefaultFont.Height);
return clientRect;
}
}
protected override Size DefaultSize
{
get
{
return new Size(497, 360);
}
}
[DefaultValue("Finish")]
public string FinishText
{
get
{
return this.finishText;
}
set
{
if (value == null)
{
throw new ArgumentNullException();
}
this.finishText = value;
this.RedrawButtons();
}
}
[DefaultValue("&Help")]
public string HelpText
{
get
{
return this.helpText;
}
set
{
if (value == null)
{
throw new ArgumentNullException();
}
this.helpText = value;
this.RedrawButtons();
}
}
[DefaultValue(false)]
public bool HelpVisible
{
get
{
return this.helpVisible;
}
set
{
this.helpVisible = value;
this.Redraw();
}
}
[DefaultValue(typeof(Image), null), Description("The image displayed on the left of introduction and finish pages. The image must have a width of 164 pixels."), AmbientValue(typeof(Image), null), Category("Appearance")]
public Image MarginImage
{
get
{
return this.marginImage;
}
set
{
if ((value != null) && (value.Width != 164))
{
throw new ArgumentException("The margin image must be " + 164 + " pixels wide.");
}
this.marginImage = value;
if (this.SelectedPage is MarginWizardPage)
{
base.Invalidate();
}
}
}
internal Rectangle NextButtonBounds
{
get
{
return this.nextButton.Bounds;
}
}
[Category("Buttons"), Localizable(true), DefaultValue("&Next >"), Description("Indicates the text that is used on the Next button.")]
public string NextText
{
get
{
return this.nextText;
}
set
{
if (value == null)
{
throw new ArgumentNullException();
}
this.nextText = value;
this.RedrawButtons();
}
}
internal Rectangle PreviousButtonBounds
{
get
{
return this.prevButton.Bounds;
}
}
[Localizable(true), Description("Indicates the text that is used on the Previous button."), Category("Buttons"), DefaultValue("< &Back")]
public string PreviousText
{
get
{
return this.prevText;
}
set
{
if (value == null)
{
throw new ArgumentNullException();
}
this.prevText = value;
this.RedrawButtons();
}
}
//[Category("Paging"), Description("The active wizard page.")]
public WizardPageBase SelectedPage
{
get
{
return this.selectedPage;
}
set
{
if ((value != null) && !base.Controls.Contains(value))
{
throw new ArgumentException("The specified page does not belong to the wizard.");
}
if (value != null && this.selectedPage != value)
{
Log.WriteInfo(string.Format("{0} loaded.", value.GetType().Name));
}
this.selectedPage = value;
this.Redraw();
this.RedrawButtons();
if (this.selectedPage != null)
{
this.selectedPage.SelectNextControl(null, true, true, true, true);
this.selectedPage.InitializePage();
}
if (base.ActiveControl != null)
{
base.ActiveControl.Focus();
}
else if (this.nextButton.Enabled)
{
this.nextButton.Focus();
}
this.InitForm();
}
}
[Browsable(false)]
public override string Text
{
get
{
return base.Text;
}
set
{
base.Text = value;
}
}
#region Common
private SetupVariables setupVariables;
/// <summary>
/// Installer variables collection
/// </summary>
internal SetupVariables SetupVariables
{
get { return setupVariables; }
set { setupVariables = value; }
}
public IActionManager ActionManager { get; set; }
#endregion
internal void RollBack()
{
RollBackPage page = new RollBackPage();
page.NextPage = null;
page.PreviousPage = null;
// Disable Cancel button
page.AllowCancel = false;
//
this.Controls.Add(page);
this.SelectedPage = page;
}
}
}

View file

@ -0,0 +1,355 @@
// Copyright (c) 2011, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System;
using System.ComponentModel;
using System.Drawing;
using System.Runtime.CompilerServices;
using System.Windows.Forms;
namespace WebsitePanel.Setup
{
//[DefaultEvent("BeforeDisplay"), ToolboxItem(false), Designer(typeof(WizardPageBaseDesigner))]
public abstract class WizardPageBase : UserControl
{
// Events
public event EventHandler AfterDisplay;
public event EventHandler BeforeDisplay;
public event CancelEventHandler BeforeMoveBack;
public event CancelEventHandler BeforeMoveNext;
// Fields
private WizardPageBase previousPage;
private WizardPageBase nextPage;
private bool allowMoveBack;
private bool allowMoveNext;
private bool allowCancel;
private bool customCancelHandler;
private bool initialized = false;
protected WizardPageBase()
{
this.allowMoveBack = true;
this.allowMoveNext = true;
this.allowCancel = true;
base.SetStyle(ControlStyles.DoubleBuffer | ControlStyles.AllPaintingInWmPaint | ControlStyles.ResizeRedraw | ControlStyles.UserPaint, true);
base.SetStyle(ControlStyles.ContainerControl, true);
CheckForIllegalCrossThreadCalls = false;
}
protected internal virtual void OnAfterDisplay(EventArgs e)
{
if (this.AfterDisplay != null)
{
this.AfterDisplay(this, e);
}
}
protected internal virtual void OnBeforeDisplay(EventArgs e)
{
if (this.BeforeDisplay != null)
{
this.BeforeDisplay(this, e);
}
}
protected internal virtual void OnBeforeMoveBack(CancelEventArgs e)
{
if (this.BeforeMoveBack != null)
{
this.BeforeMoveBack(this, e);
}
}
protected internal virtual void OnBeforeMoveNext(CancelEventArgs e)
{
if (this.BeforeMoveNext != null)
{
this.BeforeMoveNext(this, e);
}
}
protected override void OnFontChanged(EventArgs e)
{
if (this.IsCurrentPage)
{
((Wizard) base.Parent).Redraw();
}
base.OnFontChanged(e);
}
protected override void OnTextChanged(EventArgs e)
{
if (this.IsCurrentPage)
{
((Wizard) base.Parent).Redraw();
}
base.OnTextChanged(e);
}
[Category("Behavior"), Description("Indicates whether the user will be allowed to cancel the wizard from this page."), DefaultValue(true)]
public bool AllowCancel
{
get
{
return this.allowCancel;
}
set
{
this.allowCancel = value;
if (this.IsCurrentPage)
{
((Wizard) base.Parent).RedrawButtons();
}
}
}
[Description("Indicates whether the user will be allowed to move forwards from this page."), Category("Paging"), DefaultValue(true)]
public bool AllowMoveNext
{
get
{
return this.allowMoveNext;
}
set
{
this.allowMoveNext = value;
if (this.IsCurrentPage)
{
((Wizard) base.Parent).RedrawButtons();
}
}
}
[DefaultValue(true), Category("Paging"), Description("Indicates whether the user will be allowed to move backwards from the page.")]
public bool AllowMoveBack
{
get
{
return this.allowMoveBack;
}
set
{
this.allowMoveBack = value;
if (this.IsCurrentPage)
{
((Wizard) base.Parent).RedrawButtons();
}
}
}
[DefaultValue(false)]
public bool CustomCancelHandler
{
get { return this.customCancelHandler; }
set { this.customCancelHandler = value; }
}
[Browsable(false)]
public override Image BackgroundImage
{
get
{
return base.BackgroundImage;
}
set
{
base.BackgroundImage = value;
}
}
[Browsable(false)]
public bool IsCurrentPage
{
get
{
if (base.Parent is Wizard)
{
return (((Wizard) base.Parent).SelectedPage == this);
}
return false;
}
}
[Description("The page to move to when the user presses the Next button."), DefaultValue(typeof(WizardPageBase), null), Category("Paging")]
public WizardPageBase NextPage
{
get
{
return this.nextPage;
}
set
{
if (value == this)
{
throw new ArgumentException("Cannot navigate from one page to the same page.");
}
this.nextPage = value;
if (this.IsCurrentPage)
{
((Wizard) base.Parent).RedrawButtons();
}
}
}
[Description("The page to move to when the user presses the Back button."), DefaultValue(typeof(WizardPageBase), null), Category("Paging")]
public WizardPageBase PreviousPage
{
get
{
return this.previousPage;
}
set
{
if (value == this)
{
throw new ArgumentException("Cannot navigate from one page to the same page.");
}
this.previousPage = value;
if (this.IsCurrentPage)
{
((Wizard) base.Parent).RedrawButtons();
}
}
}
[Browsable(true)]
public override string Text
{
get
{
return base.Text;
}
set
{
base.Text = value;
}
}
[Browsable(false)]
public Wizard Wizard
{
get
{
return (base.Parent as Wizard);
}
}
private SetupVariables setupVariables;
[Browsable(false)]
public SetupVariables SetupVariables
{
get
{
if (setupVariables == null)
{
if ( Wizard != null )
setupVariables = Wizard.SetupVariables;
}
return setupVariables;
}
set
{
setupVariables = value;
}
}
/// <summary>
/// Displays an error message box with the specified text.
/// </summary>
/// <param name="text">The text to display in the message box.</param>
protected void ShowError(string text)
{
MessageBox.Show(this, text, FindForm().Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
}
protected void ShowError()
{
ShowError("An unexpected error has occurred. We apologize for this inconvenience.\n" +
"Please contact Technical Support at support@websitepanel.net.\n\n" +
"Make sure you include a copy of the Installer.log file from the\n" +
"WebsitePanel Installer home directory.");
}
/// <summary>
/// Displays an warning message box with the specified text.
/// </summary>
/// <param name="text">The text to display in the message box.</param>
protected void ShowWarning(string text)
{
MessageBox.Show(this, text, FindForm().Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
internal void InitializePage()
{
if (!this.initialized)
{
this.initialized = true;
InitializePageInternal();
}
}
protected virtual void InitializePageInternal()
{
}
delegate void RollBackCallback();
/// <summary>
/// Thread safe application rollback
/// </summary>
protected void Rollback()
{
// InvokeRequired compares thread ID of the
// calling thread to thread ID of the creating thread.
// If these threads are different, it returns true.
if (this.InvokeRequired)
{
RollBackCallback callback = new RollBackCallback(Rollback);
Invoke(callback, null);
}
else
{
Wizard.RollBack();
}
}
private void InitializeComponent()
{
this.SuspendLayout();
//
// WizardPageBase
//
this.Name = "WizardPageBase";
this.ResumeLayout(false);
}
}
}