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,516 @@
// 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.Text;
using System.IO;
using System.Threading;
namespace WebsitePanel.Setup.Actions
{
public class ActionProgressEventArgs<T> : EventArgs
{
public string StatusMessage { get; set; }
public T EventData { get; set; }
public bool Indeterminate { get; set; }
}
public class ProgressEventArgs : EventArgs
{
public int Value { get; set; }
}
public class ActionErrorEventArgs : EventArgs
{
public string ErrorMessage { get; set; }
public Exception OriginalException { get; set; }
}
public abstract class Action
{
public event EventHandler<ActionProgressEventArgs<int>> ProgressChange;
public event EventHandler<ActionProgressEventArgs<bool>> PrerequisiteComplete;
protected object objectLock = new Object();
public virtual bool Indeterminate
{
get
{
return true;
}
}
protected void Begin(string message)
{
OnInstallProgressChanged(message, 0);
}
protected void Finish(string message)
{
OnInstallProgressChanged(message, 100);
}
protected void OnInstallProgressChanged(string message, int progress)
{
if (ProgressChange == null)
return;
//
ProgressChange(this, new ActionProgressEventArgs<int>
{
StatusMessage = message,
EventData = progress,
Indeterminate = this.Indeterminate
});
}
protected void OnUninstallProgressChanged(string message, int progress)
{
if (ProgressChange == null)
return;
//
ProgressChange(this, new ActionProgressEventArgs<int>
{
StatusMessage = message,
EventData = progress,
Indeterminate = this.Indeterminate
});
}
protected void OnPrerequisiteCompleted(string message, bool result)
{
if (PrerequisiteComplete == null)
return;
//
PrerequisiteComplete(this, new ActionProgressEventArgs<bool>
{
StatusMessage = message,
EventData = result
});
}
}
public interface IActionManager
{
/// <summary>
///
/// </summary>
event EventHandler<ProgressEventArgs> TotalProgressChanged;
/// <summary>
///
/// </summary>
event EventHandler<ActionProgressEventArgs<int>> ActionProgressChanged;
/// <summary>
///
/// </summary>
event EventHandler<ActionProgressEventArgs<bool>> PrerequisiteComplete;
/// <summary>
///
/// </summary>
event EventHandler<ActionErrorEventArgs> ActionError;
/// <summary>
/// Gets current variables available in this session
/// </summary>
SetupVariables SessionVariables { get; }
/// <summary>
///
/// </summary>
/// <param name="action"></param>
void AddAction(Action action);
/// <summary>
/// Triggers manager to run currentScenario specified
/// </summary>
void Start();
/// <summary>
/// Triggers manager to run prerequisites verification procedure
/// </summary>
void VerifyDistributivePrerequisites();
/// <summary>
/// Triggers manager to prepare default parameters for the distributive
/// </summary>
void PrepareDistributiveDefaults();
/// <summary>
/// Initiates rollback procedure from the action specified
/// </summary>
/// <param name="lastSuccessActionIndex"></param>
void Rollback();
}
public class BaseActionManager : IActionManager
{
private List<Action> currentScenario;
//
private int lastSuccessActionIndex = -1;
private SetupVariables sessionVariables;
public SetupVariables SessionVariables
{
get
{
return sessionVariables;
}
}
protected List<Action> CurrentScenario
{
get { return currentScenario; }
set { currentScenario = value; }
}
#region Events
/// <summary>
///
/// </summary>
public event EventHandler<ProgressEventArgs> TotalProgressChanged;
/// <summary>
///
/// </summary>
public event EventHandler<ActionProgressEventArgs<int>> ActionProgressChanged;
/// <summary>
///
/// </summary>
public event EventHandler<ActionProgressEventArgs<bool>> PrerequisiteComplete;
/// <summary>
///
/// </summary>
public event EventHandler<ActionErrorEventArgs> ActionError;
/// <summary>
///
/// </summary>
public event EventHandler Initialize;
#endregion
protected BaseActionManager(SetupVariables sessionVariables)
{
if (sessionVariables == null)
throw new ArgumentNullException("sessionVariables");
//
currentScenario = new List<Action>();
//
this.sessionVariables = sessionVariables;
}
private void OnInitialize()
{
if (Initialize == null)
return;
//
Initialize(this, EventArgs.Empty);
}
/// <summary>
/// Adds action into the list of currentScenario to be executed in the current action manager's session and attaches to its ProgressChange event
/// to track the action's execution progress.
/// </summary>
/// <param name="action">Action to be executed</param>
/// <exception cref="ArgumentNullException"/>
public virtual void AddAction(Action action)
{
if (action == null)
throw new ArgumentNullException("action");
currentScenario.Add(action);
}
private void UpdateActionProgress(string actionText, int actionValue, bool indeterminateAction)
{
OnActionProgressChanged(this, new ActionProgressEventArgs<int>
{
StatusMessage = actionText,
EventData = actionValue,
Indeterminate = indeterminateAction
});
}
private void UpdateTotalProgress(int value)
{
OnTotalProgressChanged(this, new ProgressEventArgs { Value = value });
}
// Fire the Event
private void OnTotalProgressChanged(object sender, ProgressEventArgs args)
{
// Check if there are any Subscribers
if (TotalProgressChanged != null)
{
// Call the Event
TotalProgressChanged(sender, args);
}
}
// Fire the Event
private void OnActionProgressChanged(object sender, ActionProgressEventArgs<int> args)
{
// Check if there are any Subscribers
if (ActionProgressChanged != null)
{
// Call the Event
ActionProgressChanged(sender, args);
}
}
// Fire the Event
private void OnPrerequisiteComplete(object sender, ActionProgressEventArgs<bool> args)
{
// Check if there are any Subscribers
if (PrerequisiteComplete != null)
{
// Call the Event
PrerequisiteComplete(sender, args);
}
}
private void OnActionError(Exception ex)
{
//
if (ActionError == null)
return;
//
var args = new ActionErrorEventArgs
{
ErrorMessage = "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.",
OriginalException = ex,
};
//
ActionError(this, args);
}
/// <summary>
/// Starts action execution.
/// </summary>
public virtual void Start()
{
var currentActionType = default(Type);
#region Executing the installation session
//
int totalValue = 0;
for (int i = 0, progress = 1; i < currentScenario.Count; i++, progress++)
{
var item = currentScenario[i];
// Get the next action from the queue
var action = item as IInstallAction;
// Take the action's type to log as much information about it as possible
currentActionType = item.GetType();
//
if (action != null)
{
item.ProgressChange += new EventHandler<ActionProgressEventArgs<int>>(action_ProgressChanged);
try
{
// Execute an install action
action.Run(SessionVariables);
}
catch (Exception ex)
{
//
if (currentActionType != default(Type))
{
Log.WriteError(String.Format("Failed to execute '{0}' type of action.", currentActionType));
}
//
Log.WriteError("Here is the original exception...", ex);
//
if (Utils.IsThreadAbortException(ex))
return;
// Notify external clients
OnActionError(ex);
//
Rollback();
//
return;
}
//
item.ProgressChange -= new EventHandler<ActionProgressEventArgs<int>>(action_ProgressChanged);
// Calculate overall current progress status
totalValue = Convert.ToInt32(progress * 100 / currentScenario.Count);
// Update overall progress status
UpdateTotalProgress(totalValue);
}
//
lastSuccessActionIndex = i;
}
//
totalValue = 100;
//
UpdateTotalProgress(totalValue);
//
#endregion
}
void action_ProgressChanged(object sender, ActionProgressEventArgs<int> e)
{
// Action progress has been changed
UpdateActionProgress(e.StatusMessage, e.EventData, e.Indeterminate);
}
public virtual void Rollback()
{
var currentActionType = default(Type);
//
Log.WriteStart("Rolling back");
//
UpdateActionProgress("Rolling back", 0, true);
//
var totalValue = 0;
//
UpdateTotalProgress(totalValue);
//
for (int i = lastSuccessActionIndex, progress = 1; i >= 0; i--, progress++)
{
var action = currentScenario[i] as IUninstallAction;
//
if (action != null)
{
action.ProgressChange += new EventHandler<ActionProgressEventArgs<int>>(action_ProgressChanged);
//
try
{
action.Run(sessionVariables);
}
catch (Exception ex)
{
if (currentActionType != default(Type))
Log.WriteError(String.Format("Failed to rollback '{0}' action.", currentActionType));
//
Log.WriteError("Here is the original exception...", ex);
//
}
//
action.ProgressChange -= new EventHandler<ActionProgressEventArgs<int>>(action_ProgressChanged);
}
//
totalValue = Convert.ToInt32(progress * 100 / (lastSuccessActionIndex + 1));
//
UpdateTotalProgress(totalValue);
}
//
Log.WriteEnd("Rolled back");
}
public void VerifyDistributivePrerequisites()
{
var currentActionType = default(Type);
try
{
//
for (int i = 0; i < currentScenario.Count; i++)
{
var item = currentScenario[i];
// Get the next action from the queue
var action = item as IPrerequisiteAction;
//
currentActionType = item.GetType();
//
if (action != null)
{
//
action.Complete += new EventHandler<ActionProgressEventArgs<bool>>(action_Complete);
// Execute an install action
action.Run(SessionVariables);
//
action.Complete -= new EventHandler<ActionProgressEventArgs<bool>>(action_Complete);
}
}
}
catch (Exception ex)
{
//
if (currentActionType != default(Type))
{
Log.WriteError(String.Format("Failed to execute '{0}' type of action.", currentActionType));
}
//
Log.WriteError("Here is the original exception...", ex);
//
if (Utils.IsThreadAbortException(ex))
return;
// Notify external clients
OnActionError(ex);
//
return;
}
}
void action_Complete(object sender, ActionProgressEventArgs<bool> e)
{
OnPrerequisiteComplete(sender, e);
}
public void PrepareDistributiveDefaults()
{
//
OnInitialize();
//
var currentActionType = default(Type);
try
{
//
for (int i = 0; i < currentScenario.Count; i++)
{
// Get the next action from the queue
var action = currentScenario[i] as IPrepareDefaultsAction;
//
if (action == null)
{
continue;
}
//
currentActionType = action.GetType();
// Execute an install action
action.Run(SessionVariables);
}
}
catch (Exception ex)
{
//
if (currentActionType != default(Type))
{
Log.WriteError(String.Format("Failed to execute '{0}' type of action.", currentActionType));
}
//
Log.WriteError("Here is the original exception...", ex);
//
if (Utils.IsThreadAbortException(ex))
return;
// Notify external clients
OnActionError(ex);
//
return;
}
}
}
}

View file

@ -0,0 +1,417 @@
// 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.Text;
using System.IO;
using System.Xml;
namespace WebsitePanel.Setup.Actions
{
public class SetEntServerWebSettingsAction : Action, IPrepareDefaultsAction
{
public const string LogStartMessage = "Retrieving default IP address of the component...";
void IPrepareDefaultsAction.Run(SetupVariables vars)
{
//
if (String.IsNullOrEmpty(vars.WebSiteIP))
vars.WebSiteIP = "127.0.0.1";
//
if (String.IsNullOrEmpty(vars.WebSitePort))
vars.WebSitePort = "9002";
//
if (String.IsNullOrEmpty(vars.UserAccount))
vars.UserAccount = "WPEnterpriseServer";
}
}
public class SetEntServerCryptoKeyAction : Action, IInstallAction
{
public const string LogStartInstallMessage = "Updating web.config file (crypto key)";
public const string LogEndInstallMessage = "Updated web.config file";
void IInstallAction.Run(SetupVariables vars)
{
try
{
OnInstallProgressChanged(LogStartInstallMessage, 0);
Log.WriteStart(LogStartInstallMessage);
var file = Path.Combine(vars.InstallationFolder, vars.ConfigurationFile);
vars.CryptoKey = Utils.GetRandomString(20);
// load file
string content = string.Empty;
using (StreamReader reader = new StreamReader(file))
{
content = reader.ReadToEnd();
}
// expand variables
content = Utils.ReplaceScriptVariable(content, "installer.cryptokey", vars.CryptoKey);
//
Log.WriteInfo(String.Format("The following cryptographic key has been generated: '{0}'", vars.CryptoKey));
// save file
using (StreamWriter writer = new StreamWriter(file))
{
writer.Write(content);
}
//update log
Log.WriteEnd(LogEndInstallMessage);
}
catch (Exception ex)
{
if (Utils.IsThreadAbortException(ex))
return;
//
Log.WriteError("Update web.config error", ex);
//
throw;
}
}
}
public class CreateDatabaseAction : Action, IInstallAction, IUninstallAction
{
public const string LogStartInstallMessage = "Creating SQL Server database...";
public const string LogStartUninstallMessage = "Deleting database";
void IInstallAction.Run(SetupVariables vars)
{
try
{
Begin(LogStartInstallMessage);
//
var connectionString = vars.DbInstallConnectionString;
var database = vars.Database;
Log.WriteStart(LogStartInstallMessage);
Log.WriteInfo(String.Format("SQL Server Database Name: \"{0}\"", database));
//
if (SqlUtils.DatabaseExists(connectionString, database))
{
throw new Exception(String.Format("SQL Server database \"{0}\" already exists", database));
}
SqlUtils.CreateDatabase(connectionString, database);
//
Log.WriteEnd("Created SQL Server database");
//
InstallLog.AppendLine(String.Format("- Created a new SQL Server database \"{0}\"", database));
}
catch (Exception ex)
{
if (Utils.IsThreadAbortException(ex))
return;
//
Log.WriteError("Create database error", ex);
//
throw;
}
}
void IUninstallAction.Run(SetupVariables vars)
{
try
{
Log.WriteStart(LogStartUninstallMessage);
//
Log.WriteInfo(String.Format("Deleting database \"{0}\"", vars.Database));
//
if (SqlUtils.DatabaseExists(vars.DbInstallConnectionString, vars.Database))
{
SqlUtils.DeleteDatabase(vars.DbInstallConnectionString, vars.Database);
//
Log.WriteEnd("Deleted database");
}
}
catch (Exception ex)
{
if (Utils.IsThreadAbortException(ex))
return;
Log.WriteError("Database delete error", ex);
throw;
}
}
}
public class CreateDatabaseUserAction : Action, IInstallAction, IUninstallAction
{
void IInstallAction.Run(SetupVariables vars)
{
try
{
//
Log.WriteStart(String.Format("Creating database user {0}", vars.Database));
//
vars.DatabaseUserPassword = Utils.GetRandomString(20);
//user name should be the same as database
vars.NewDatabaseUser = SqlUtils.CreateUser(vars.DbInstallConnectionString, vars.Database, vars.DatabaseUserPassword, vars.Database);
//
Log.WriteEnd("Created database user");
InstallLog.AppendLine("- Created database user \"{0}\"", vars.Database);
}
catch (Exception ex)
{
if (Utils.IsThreadAbortException(ex))
return;
Log.WriteError("Create db user error", ex);
throw;
}
}
void IUninstallAction.Run(SetupVariables vars)
{
try
{
Log.WriteStart("Deleting database user");
Log.WriteInfo(String.Format("Deleting database user \"{0}\"", vars.Database));
//
if (SqlUtils.UserExists(vars.DbInstallConnectionString, vars.Database))
{
SqlUtils.DeleteUser(vars.DbInstallConnectionString, vars.Database);
//
Log.WriteEnd("Deleted database user");
}
}
catch (Exception ex)
{
if (Utils.IsThreadAbortException(ex))
return;
Log.WriteError("Database user delete error", ex);
throw;
}
}
}
public class ExecuteInstallSqlAction : Action, IInstallAction
{
public const string SqlFilePath = @"Setup\install_db.sql";
public const string ExecuteProgressMessage = "Creating database objects...";
void IInstallAction.Run(SetupVariables vars)
{
try
{
var component = vars.ComponentFullName;
var componentId = vars.ComponentId;
var path = Path.Combine(vars.InstallationFolder, SqlFilePath);
if (!FileUtils.FileExists(path))
{
Log.WriteInfo(String.Format("File {0} not found", path));
return;
}
//
SqlProcess process = new SqlProcess(path, vars.DbInstallConnectionString, vars.Database);
//
process.ProgressChange += new EventHandler<ActionProgressEventArgs<int>>(process_ProgressChange);
//
process.Run();
//
InstallLog.AppendLine(string.Format("- Installed {0} database objects", component));
}
catch (Exception ex)
{
if (Utils.IsThreadAbortException(ex))
return;
//
Log.WriteError("Run sql error", ex);
//
throw;
}
}
void process_ProgressChange(object sender, ActionProgressEventArgs<int> e)
{
OnInstallProgressChanged(ExecuteProgressMessage, e.EventData);
}
}
public class UpdateServeradminPasswAction : Action, IInstallAction
{
public const string SqlStatement = @"USE [{0}]; UPDATE [dbo].[Users] SET [Password] = '{1}' WHERE [UserID] = 1;";
void IInstallAction.Run(SetupVariables vars)
{
try
{
Log.WriteStart("Updating serveradmin password");
//
var path = Path.Combine(vars.InstallationFolder, vars.ConfigurationFile);
var password = vars.ServerAdminPassword;
if (!File.Exists(path))
{
Log.WriteInfo(String.Format("File {0} not found", path));
return;
}
//
bool encryptionEnabled = IsEncryptionEnabled(path);
// Encrypt password
if (encryptionEnabled)
{
password = Utils.Encrypt(vars.CryptoKey, password);
}
//
SqlUtils.ExecuteQuery(vars.DbInstallConnectionString, String.Format(SqlStatement, vars.Database, password));
//
Log.WriteEnd("Updated serveradmin password");
//
InstallLog.AppendLine("- Updated password for the serveradmin account");
//
}
catch (Exception ex)
{
if (Utils.IsThreadAbortException(ex))
return;
//
Log.WriteError("Update error", ex);
throw;
}
}
private bool IsEncryptionEnabled(string path)
{
var doc = new XmlDocument();
doc.Load(path);
//encryption enabled
string xPath = "configuration/appSettings/add[@key=\"WebsitePanel.EncryptionEnabled\"]";
XmlElement encryptionNode = doc.SelectSingleNode(xPath) as XmlElement;
bool encryptionEnabled = false;
//
if (encryptionNode != null)
{
bool.TryParse(encryptionNode.GetAttribute("value"), out encryptionEnabled);
}
//
return encryptionEnabled;
}
}
public class SaveAspNetDbConnectionStringAction : Action, IInstallAction
{
void IInstallAction.Run(SetupVariables vars)
{
Log.WriteStart("Updating web.config file (connection string)");
//
var file = Path.Combine(vars.InstallationFolder, vars.ConfigurationFile);
//
var content = String.Empty;
// load file
using (StreamReader reader = new StreamReader(file))
{
content = reader.ReadToEnd();
}
// Build connection string
vars.ConnectionString = String.Format(vars.ConnectionString, vars.DatabaseServer, vars.Database, vars.Database, vars.DatabaseUserPassword);
// Expand variables
content = Utils.ReplaceScriptVariable(content, "installer.connectionstring", vars.ConnectionString);
// Save file
using (StreamWriter writer = new StreamWriter(file))
{
writer.Write(content);
}
//
Log.WriteEnd(String.Format("Updated {0} file", vars.ConfigurationFile));
}
}
public class SaveEntServerConfigSettingsAction : Action, IInstallAction
{
void IInstallAction.Run(SetupVariables vars)
{
AppConfig.EnsureComponentConfig(vars.ComponentId);
//
AppConfig.SetComponentSettingStringValue(vars.ComponentId, "Database", vars.Database);
AppConfig.SetComponentSettingBooleanValue(vars.ComponentId, "NewDatabase", true);
//
AppConfig.SetComponentSettingStringValue(vars.ComponentId, "DatabaseUser", vars.Database);
AppConfig.SetComponentSettingBooleanValue(vars.ComponentId, "NewDatabaseUser", vars.NewDatabaseUser);
//
AppConfig.SetComponentSettingStringValue(vars.ComponentId, Global.Parameters.ConnectionString, vars.ConnectionString);
AppConfig.SetComponentSettingStringValue(vars.ComponentId, Global.Parameters.DatabaseServer, vars.DatabaseServer);
AppConfig.SetComponentSettingStringValue(vars.ComponentId, Global.Parameters.InstallConnectionString, vars.DbInstallConnectionString);
AppConfig.SetComponentSettingStringValue(vars.ComponentId, Global.Parameters.CryptoKey, vars.CryptoKey);
//
AppConfig.SaveConfiguration();
}
}
public class EntServerActionManager : BaseActionManager
{
public static readonly List<Action> InstallScenario = new List<Action>
{
new SetCommonDistributiveParamsAction(),
new SetEntServerWebSettingsAction(),
new EnsureServiceAccntSecured(),
new CopyFilesAction(),
new SetEntServerCryptoKeyAction(),
new CreateWindowsAccountAction(),
new ConfigureAspNetTempFolderPermissionsAction(),
new SetNtfsPermissionsAction(),
new CreateWebApplicationPoolAction(),
new CreateWebSiteAction(),
new SwitchAppPoolAspNetVersion(),
new CreateDatabaseAction(),
new CreateDatabaseUserAction(),
new ExecuteInstallSqlAction(),
new UpdateServeradminPasswAction(),
new SaveAspNetDbConnectionStringAction(),
new SaveComponentConfigSettingsAction(),
new SaveEntServerConfigSettingsAction()
};
public EntServerActionManager(SetupVariables sessionVars) : base(sessionVars)
{
Initialize += new EventHandler(EntServerActionManager_PreInit);
}
void EntServerActionManager_PreInit(object sender, EventArgs e)
{
//
switch (SessionVariables.SetupAction)
{
case SetupActions.Install: // Install
LoadInstallationScenario();
break;
}
}
private void LoadInstallationScenario()
{
CurrentScenario.AddRange(InstallScenario);
}
}
}

View file

@ -0,0 +1,37 @@
// 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;
namespace WebsitePanel.Setup.Actions
{
public interface IInstallAction
{
void Run(WebsitePanel.Setup.SetupVariables vars);
}
}

View file

@ -0,0 +1,39 @@
// 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.Text;
namespace WebsitePanel.Setup.Actions
{
public interface IPrepareDefaultsAction
{
void Run(WebsitePanel.Setup.SetupVariables vars);
}
}

View file

@ -0,0 +1,39 @@
// 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;
namespace WebsitePanel.Setup.Actions
{
public interface IPrerequisiteAction
{
bool Run(WebsitePanel.Setup.SetupVariables vars);
// The event
event EventHandler<ActionProgressEventArgs<bool>> Complete;
}
}

View file

@ -0,0 +1,39 @@
// 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;
namespace WebsitePanel.Setup.Actions
{
public interface IUninstallAction
{
void Run(WebsitePanel.Setup.SetupVariables vars);
//
event EventHandler<ActionProgressEventArgs<int>> ProgressChange;
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,282 @@
// 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.Text;
using System.IO;
using System.Xml;
namespace WebsitePanel.Setup.Actions
{
public class SetWebPortalWebSettingsAction : Action, IPrepareDefaultsAction
{
public const string LogStartMessage = "Retrieving default IP address of the component...";
void IPrepareDefaultsAction.Run(SetupVariables vars)
{
//
if (String.IsNullOrEmpty(vars.WebSitePort))
vars.WebSitePort = Global.WebPortal.DefaultPort;
//
if (String.IsNullOrEmpty(vars.UserAccount))
vars.UserAccount = Global.WebPortal.ServiceAccount;
// By default we use public ip for the component
if (String.IsNullOrEmpty(vars.WebSiteIP))
{
var serverIPs = WebUtils.GetIPv4Addresses();
//
if (serverIPs != null && serverIPs.Length > 0)
{
vars.WebSiteIP = serverIPs[0];
}
else
{
vars.WebSiteIP = Global.LoopbackIPv4;
}
}
}
}
public class UpdateEnterpriseServerUrlAction : Action, IInstallAction
{
public const string LogStartInstallMessage = "Updating site settings...";
void IInstallAction.Run(SetupVariables vars)
{
try
{
Begin(LogStartInstallMessage);
//
Log.WriteStart(LogStartInstallMessage);
//
var path = Path.Combine(vars.InstallationFolder, @"App_Data\SiteSettings.config");
//
if (!File.Exists(path))
{
Log.WriteInfo(String.Format("File {0} not found", path));
//
return;
}
//
var doc = new XmlDocument();
doc.Load(path);
//
var urlNode = doc.SelectSingleNode("SiteSettings/EnterpriseServer") as XmlElement;
if (urlNode == null)
{
Log.WriteInfo("EnterpriseServer setting not found");
return;
}
urlNode.InnerText = vars.EnterpriseServerURL;
doc.Save(path);
//
Log.WriteEnd("Updated site settings");
//
InstallLog.AppendLine("- Updated site settings");
}
catch (Exception ex)
{
if (Utils.IsThreadAbortException(ex))
return;
//
Log.WriteError("Site settigs error", ex);
//
throw;
}
}
}
public class CreateDesktopShortcutsAction : Action, IInstallAction
{
public const string LogStartInstallMessage = "Creating shortcut...";
public const string ApplicationUrlNotFoundMessage = "Application url not found";
public const string Path2 = "WebsitePanel Software";
void IInstallAction.Run(SetupVariables vars)
{
//
try
{
Begin(LogStartInstallMessage);
//
Log.WriteStart(LogStartInstallMessage);
//
var urls = Utils.GetApplicationUrls(vars.WebSiteIP, vars.WebSiteDomain, vars.WebSitePort, null);
string url = null;
if (urls.Length == 0)
{
Log.WriteInfo(ApplicationUrlNotFoundMessage);
//
return;
}
// Retrieve top-most url from the list
url = "http://" + urls[0];
//
Log.WriteStart("Creating menu shortcut");
//
string programs = Environment.GetFolderPath(Environment.SpecialFolder.Programs);
string fileName = "Login to WebsitePanel.url";
string path = Path.Combine(programs, Path2);
//
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
//
WriteShortcutData(Path.Combine(path, fileName), url);
//
Log.WriteEnd("Created menu shortcut");
//
Log.WriteStart("Creating desktop shortcut");
//
string desktop = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
WriteShortcutData(Path.Combine(desktop, fileName), url);
//
Log.WriteEnd("Created desktop shortcut");
//
InstallLog.AppendLine("- Created application shortcuts");
}
catch (Exception ex)
{
if (Utils.IsThreadAbortException(ex))
return;
//
Log.WriteError("Create shortcut error", ex);
}
}
private static void WriteShortcutData(string filePath, string url)
{
string iconFile = Path.Combine(Environment.SystemDirectory, "url.dll");
//
using (StreamWriter sw = File.CreateText(filePath))
{
sw.WriteLine("[InternetShortcut]");
sw.WriteLine("URL=" + url);
sw.WriteLine("IconFile=" + iconFile);
sw.WriteLine("IconIndex=0");
sw.WriteLine("HotKey=0");
//
Log.WriteInfo(String.Format("Shortcut url: {0}", url));
}
}
}
public class CopyWebConfigAction : Action, IInstallAction
{
void IInstallAction.Run(SetupVariables vars)
{
try
{
Log.WriteStart("Copying web.config");
string configPath = Path.Combine(vars.InstallationFolder, "web.config");
string config6Path = Path.Combine(vars.InstallationFolder, "web6.config");
bool iis6 = (vars.IISVersion.Major == 6);
if (!File.Exists(config6Path))
{
Log.WriteInfo(string.Format("File {0} not found", config6Path));
return;
}
if (iis6)
{
if (!File.Exists(configPath))
{
Log.WriteInfo(string.Format("File {0} not found", configPath));
return;
}
FileUtils.DeleteFile(configPath);
File.Move(config6Path, configPath);
}
else
{
FileUtils.DeleteFile(config6Path);
}
Log.WriteEnd("Copied web.config");
}
catch (Exception ex)
{
if (Utils.IsThreadAbortException(ex))
return;
//
Log.WriteError("Copy web.config error", ex);
//
throw;
}
}
}
public class WebPortalActionManager : BaseActionManager
{
public static readonly List<Action> InstallScenario = new List<Action>
{
new SetCommonDistributiveParamsAction(),
new SetWebPortalWebSettingsAction(),
new EnsureServiceAccntSecured(),
new CopyFilesAction(),
new CopyWebConfigAction(),
new CreateWindowsAccountAction(),
new ConfigureAspNetTempFolderPermissionsAction(),
new SetNtfsPermissionsAction(),
new CreateWebApplicationPoolAction(),
new CreateWebSiteAction(),
new SwitchAppPoolAspNetVersion(),
new UpdateEnterpriseServerUrlAction(),
new SaveComponentConfigSettingsAction(),
new CreateDesktopShortcutsAction()
};
public WebPortalActionManager(SetupVariables sessionVars)
: base(sessionVars)
{
Initialize += new EventHandler(WebPortalActionManager_Initialize);
}
void WebPortalActionManager_Initialize(object sender, EventArgs e)
{
//
switch (SessionVariables.SetupAction)
{
case SetupActions.Install: // Install
LoadInstallationScenario();
break;
}
}
private void LoadInstallationScenario()
{
CurrentScenario.AddRange(InstallScenario);
}
}
}

View file

@ -0,0 +1,350 @@
// 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.Windows.Forms;
using System.Collections;
using System.Xml;
using System.Collections.Generic;
using System.Linq;
namespace WebsitePanel.Setup
{
public class BaseSetup
{
public static void InitInstall(Hashtable args, SetupVariables vars)
{
AppConfig.LoadConfiguration();
LoadSetupVariablesFromParameters(vars, args);
vars.SetupAction = SetupActions.Install;
vars.InstallationFolder = Path.Combine(Global.DefaultInstallPathRoot, vars.ComponentName);
vars.ComponentId = Guid.NewGuid().ToString();
vars.Instance = String.Empty;
//create component settings node
//vars.ComponentConfig = AppConfig.CreateComponentConfig(vars.ComponentId);
//add default component settings
//CreateComponentSettingsFromSetupVariables(vars, vars.ComponentId);
}
public static DialogResult UninstallBase(object obj)
{
Hashtable args = Utils.GetSetupParameters(obj);
string shellVersion = Utils.GetStringSetupParameter(args, Global.Parameters.ShellVersion);
var setupVariables = new SetupVariables
{
ComponentId = Utils.GetStringSetupParameter(args, Global.Parameters.ComponentId),
ComponentCode = Utils.GetStringSetupParameter(args, Global.Parameters.ComponentCode),
SetupAction = SetupActions.Uninstall,
IISVersion = Global.IISVersion
};
//
AppConfig.LoadConfiguration();
InstallerForm form = new InstallerForm();
Wizard wizard = form.Wizard;
wizard.SetupVariables = setupVariables;
//
AppConfig.LoadComponentSettings(wizard.SetupVariables);
IntroductionPage page1 = new IntroductionPage();
ConfirmUninstallPage page2 = new ConfirmUninstallPage();
UninstallPage page3 = new UninstallPage();
page2.UninstallPage = page3;
FinishPage page4 = new FinishPage();
wizard.Controls.AddRange(new Control[] { page1, page2, page3, page4 });
wizard.LinkPages();
wizard.SelectedPage = page1;
//show wizard
IWin32Window owner = args[Global.Parameters.ParentForm] as IWin32Window;
return form.ShowModal(owner);
}
public static DialogResult SetupBase(object obj)
{
Hashtable args = Utils.GetSetupParameters(obj);
string shellVersion = Utils.GetStringSetupParameter(args, "ShellVersion");
string componentId = Utils.GetStringSetupParameter(args, "ComponentId");
AppConfig.LoadConfiguration();
InstallerForm form = new InstallerForm();
Wizard wizard = form.Wizard;
wizard.SetupVariables.SetupAction = SetupActions.Setup;
LoadSetupVariablesFromConfig(wizard.SetupVariables, componentId);
wizard.SetupVariables.WebSiteId = AppConfig.GetComponentSettingStringValue(componentId, "WebSiteId");
wizard.SetupVariables.WebSiteIP = AppConfig.GetComponentSettingStringValue(componentId, "WebSiteIP");
wizard.SetupVariables.WebSitePort = AppConfig.GetComponentSettingStringValue(componentId, "WebSitePort");
wizard.SetupVariables.WebSiteDomain = AppConfig.GetComponentSettingStringValue(componentId, "WebSiteDomain");
wizard.SetupVariables.NewWebSite = AppConfig.GetComponentSettingBooleanValue(componentId, "NewWebSite");
wizard.SetupVariables.NewVirtualDirectory = AppConfig.GetComponentSettingBooleanValue(componentId, "NewVirtualDirectory");
wizard.SetupVariables.VirtualDirectory = AppConfig.GetComponentSettingStringValue(componentId, "VirtualDirectory");
wizard.SetupVariables.IISVersion = Utils.GetVersionSetupParameter(args, "IISVersion");
//IntroductionPage page1 = new IntroductionPage();
WebPage page2 = new WebPage();
ExpressInstallPage page3 = new ExpressInstallPage();
//create install currentScenario
InstallAction action = new InstallAction(ActionTypes.UpdateWebSite);
action.Description = "Updating web site...";
page3.Actions.Add(action);
action = new InstallAction(ActionTypes.UpdateConfig);
action.Description = "Updating system configuration...";
page3.Actions.Add(action);
FinishPage page4 = new FinishPage();
wizard.Controls.AddRange(new Control[] { page2, page3, page4 });
wizard.LinkPages();
wizard.SelectedPage = page2;
//show wizard
IWin32Window owner = args["ParentForm"] as IWin32Window;
return form.ShowModal(owner);
}
public static DialogResult UpdateBase(object obj, string minimalInstallerVersion, string versionToUpgrade, bool updateSql)
{
return UpdateBase(obj, minimalInstallerVersion, versionToUpgrade, updateSql, null);
}
public static DialogResult UpdateBase(object obj, string minimalInstallerVersion,
string versionsToUpgrade, bool updateSql, InstallAction versionSpecificAction)
{
Hashtable args = Utils.GetSetupParameters(obj);
string shellVersion = Utils.GetStringSetupParameter(args, "ShellVersion");
Version version = new Version(shellVersion);
if (version < new Version(minimalInstallerVersion))
{
MessageBox.Show(
string.Format("WebsitePanel Installer {0} or higher required.", minimalInstallerVersion),
"Setup Wizard", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return DialogResult.Cancel;
}
// Load application configuration
AppConfig.LoadConfiguration();
//
var setupVariables = new SetupVariables
{
SetupAction = SetupActions.Update,
ComponentId = Utils.GetStringSetupParameter(args, "ComponentId"),
IISVersion = Global.IISVersion,
};
// Load setup variables from app.config
AppConfig.LoadComponentSettings(setupVariables);
//
InstallerForm form = new InstallerForm();
form.Wizard.SetupVariables = setupVariables;
Wizard wizard = form.Wizard;
// Initialize setup variables with the data received from update procedure
wizard.SetupVariables.BaseDirectory = Utils.GetStringSetupParameter(args, "BaseDirectory");
wizard.SetupVariables.UpdateVersion = Utils.GetStringSetupParameter(args, "UpdateVersion");
wizard.SetupVariables.InstallerFolder = Utils.GetStringSetupParameter(args, "InstallerFolder");
wizard.SetupVariables.Installer = Utils.GetStringSetupParameter(args, "Installer");
wizard.SetupVariables.InstallerType = Utils.GetStringSetupParameter(args, "InstallerType");
wizard.SetupVariables.InstallerPath = Utils.GetStringSetupParameter(args, "InstallerPath");
#region Support for multiple versions to upgrade from
// Find out whether the version(s) are supported in that upgrade
var upgradeSupported = versionsToUpgrade.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries)
.Any(x => { return VersionEquals(wizard.SetupVariables.Version, x.Trim()); });
//
if (upgradeSupported == false)
{
Log.WriteInfo(
String.Format("Could not find a suitable version to upgrade. Current version: {0}; Versions supported: {1};", wizard.SetupVariables.Version, versionsToUpgrade));
//
MessageBox.Show(
"Your current software version either is not supported or could not be upgraded at this time. Please send log file from the installer to the software vendor for further research on the issue.", "Setup Wizard", MessageBoxButtons.OK, MessageBoxIcon.Warning);
//
return DialogResult.Cancel;
}
#endregion
//
IntroductionPage introPage = new IntroductionPage();
LicenseAgreementPage licPage = new LicenseAgreementPage();
ExpressInstallPage page2 = new ExpressInstallPage();
//create install currentScenario
InstallAction action = new InstallAction(ActionTypes.StopApplicationPool);
action.Description = "Stopping IIS Application Pool...";
page2.Actions.Add(action);
action = new InstallAction(ActionTypes.Backup);
action.Description = "Backing up...";
page2.Actions.Add(action);
action = new InstallAction(ActionTypes.DeleteFiles);
action.Description = "Deleting files...";
action.Path = "setup\\delete.txt";
page2.Actions.Add(action);
action = new InstallAction(ActionTypes.CopyFiles);
action.Description = "Copying files...";
page2.Actions.Add(action);
if (versionSpecificAction != null)
page2.Actions.Add(versionSpecificAction);
if (updateSql)
{
action = new InstallAction(ActionTypes.ExecuteSql);
action.Description = "Updating database...";
action.Path = "setup\\update_db.sql";
page2.Actions.Add(action);
}
action = new InstallAction(ActionTypes.UpdateConfig);
action.Description = "Updating system configuration...";
page2.Actions.Add(action);
action = new InstallAction(ActionTypes.StartApplicationPool);
action.Description = "Starting IIS Application Pool...";
page2.Actions.Add(action);
FinishPage page3 = new FinishPage();
wizard.Controls.AddRange(new Control[] { introPage, licPage, page2, page3 });
wizard.LinkPages();
wizard.SelectedPage = introPage;
//show wizard
IWin32Window owner = args["ParentForm"] as IWin32Window;
return form.ShowModal(owner);
}
protected static void LoadSetupVariablesFromSetupXml(string xml, SetupVariables setupVariables)
{
if (string.IsNullOrEmpty(xml))
return;
XmlDocument doc = new XmlDocument();
doc.LoadXml(xml);
XmlNodeList settings = doc.SelectNodes("settings/add");
foreach (XmlElement node in settings)
{
string key = node.GetAttribute("key").ToLower();
string value = node.GetAttribute("value");
switch (key)
{
case "installationfolder":
setupVariables.InstallationFolder = value;
break;
case "websitedomain":
setupVariables.WebSiteDomain = value;
break;
case "websiteip":
setupVariables.WebSiteIP = value;
break;
case "websiteport":
setupVariables.WebSitePort = value;
break;
case "serveradminpassword":
setupVariables.ServerAdminPassword = value;
break;
case "serverpassword":
setupVariables.ServerPassword = value;
break;
case "useraccount":
setupVariables.UserAccount = value;
break;
case "userpassword":
setupVariables.UserPassword = value;
break;
case "userdomain":
setupVariables.UserDomain = value;
break;
case "enterpriseserverurl":
setupVariables.EnterpriseServerURL = value;
break;
case "licensekey":
setupVariables.LicenseKey = value;
break;
case "dbinstallconnectionstring":
setupVariables.DbInstallConnectionString = value;
break;
}
}
}
public static void LoadSetupVariablesFromConfig(SetupVariables vars, string componentId)
{
vars.InstallationFolder = AppConfig.GetComponentSettingStringValue(componentId, "InstallFolder");
vars.ComponentName = AppConfig.GetComponentSettingStringValue(componentId, "ComponentName");
vars.ComponentCode = AppConfig.GetComponentSettingStringValue(componentId, "ComponentCode");
vars.ComponentDescription = AppConfig.GetComponentSettingStringValue(componentId, "ComponentDescription");
vars.ComponentId = componentId;
vars.ApplicationName = AppConfig.GetComponentSettingStringValue(componentId, "ApplicationName");
vars.Version = AppConfig.GetComponentSettingStringValue(componentId, "Release");
vars.Instance = AppConfig.GetComponentSettingStringValue(componentId, "Instance");
}
public static void LoadSetupVariablesFromParameters(SetupVariables vars, Hashtable args)
{
vars.ApplicationName = Utils.GetStringSetupParameter(args, "ApplicationName");
vars.ComponentName = Utils.GetStringSetupParameter(args, "ComponentName");
vars.ComponentCode = Utils.GetStringSetupParameter(args, "ComponentCode");
vars.ComponentDescription = Utils.GetStringSetupParameter(args, "ComponentDescription");
vars.Version = Utils.GetStringSetupParameter(args, "Version");
vars.InstallerFolder = Utils.GetStringSetupParameter(args, "InstallerFolder");
vars.Installer = Utils.GetStringSetupParameter(args, "Installer");
vars.InstallerType = Utils.GetStringSetupParameter(args, "InstallerType");
vars.InstallerPath = Utils.GetStringSetupParameter(args, "InstallerPath");
vars.IISVersion = Utils.GetVersionSetupParameter(args, "IISVersion");
vars.SetupXml = Utils.GetStringSetupParameter(args, "SetupXml");
// Add some extra variables if any, coming from SilentInstaller
#region SilentInstaller CLI arguments
var shellMode = Utils.GetStringSetupParameter(args, Global.Parameters.ShellMode);
//
if (shellMode.Equals(Global.SilentInstallerShell, StringComparison.OrdinalIgnoreCase))
{
vars.WebSiteIP = Utils.GetStringSetupParameter(args, Global.Parameters.WebSiteIP);
vars.WebSitePort = Utils.GetStringSetupParameter(args, Global.Parameters.WebSitePort);
vars.WebSiteDomain = Utils.GetStringSetupParameter(args, Global.Parameters.WebSiteDomain);
vars.UserDomain = Utils.GetStringSetupParameter(args, Global.Parameters.UserDomain);
vars.UserAccount = Utils.GetStringSetupParameter(args, Global.Parameters.UserAccount);
vars.UserPassword = Utils.GetStringSetupParameter(args, Global.Parameters.UserPassword);
}
#endregion
}
public static string GetDefaultDBName(string componentName)
{
return componentName.Replace(" ", string.Empty);
}
protected static bool VersionEquals(string version1, string version2)
{
Version v1 = new Version(version1);
Version v2 = new Version(version2);
return (v1.Major == v2.Major && v1.Minor == v2.Minor && v1.Build == v2.Build);
}
}
}

View file

@ -0,0 +1,230 @@
// 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.Xml;
using System.Configuration;
using System.Collections.Generic;
using System.Text;
using System.IO;
namespace WebsitePanel.Setup
{
public sealed class AppConfig
{
public const string AppConfigFileNameWithoutExtension = "WebsitePanel.Installer.exe";
private AppConfig()
{
}
private static Configuration appConfig = null;
private static XmlDocument xmlConfig = null;
public static void LoadConfiguration()
{
//
var exePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, AppConfigFileNameWithoutExtension);
//
appConfig = ConfigurationManager.OpenExeConfiguration(exePath);
//
ConfigurationSection section = appConfig.Sections["installer"];
if (section == null)
throw new ConfigurationErrorsException("instalelr section not found");
string strXml = section.SectionInformation.GetRawXml();
xmlConfig = new XmlDocument();
xmlConfig.LoadXml(strXml);
}
public static XmlDocument Configuration
{
get
{
return xmlConfig;
}
}
public static void EnsureComponentConfig(string componentId)
{
var xmlConfigNode = GetComponentConfig(componentId);
//
if (xmlConfigNode != null)
return;
//
CreateComponentConfig(componentId);
}
public static XmlNode CreateComponentConfig(string componentId)
{
XmlNode components = Configuration.SelectSingleNode("//components");
if (components == null)
{
components = Configuration.CreateElement("components");
Configuration.FirstChild.AppendChild(components);
}
XmlElement componentNode = Configuration.CreateElement("component");
componentNode.SetAttribute("id", componentId);
components.AppendChild(componentNode);
XmlElement settingsNode = Configuration.CreateElement("settings");
componentNode.AppendChild(settingsNode);
return componentNode;
}
public static XmlNode GetComponentConfig(string componentId)
{
string xPath = string.Format("//component[@id=\"{0}\"]", componentId);
return Configuration.SelectSingleNode(xPath);
}
public static void SaveConfiguration()
{
if (appConfig != null && xmlConfig != null)
{
ConfigurationSection section = appConfig.Sections["installer"];
section.SectionInformation.SetRawXml(xmlConfig.OuterXml);
appConfig.Save();
}
}
public static void SetComponentSettingStringValue(string componentId, string settingName, string value)
{
XmlNode componentNode = GetComponentConfig(componentId);
XmlNode settings = componentNode.SelectSingleNode("settings");
string xpath = string.Format("add[@key=\"{0}\"]", settingName);
XmlNode settingNode = settings.SelectSingleNode(xpath);
if (settingNode == null)
{
settingNode = Configuration.CreateElement("add");
XmlUtils.SetXmlAttribute(settingNode, "key", settingName);
settings.AppendChild(settingNode);
}
XmlUtils.SetXmlAttribute(settingNode, "value", value);
}
public static void SetComponentSettingBooleanValue(string componentId, string settingName, bool value)
{
XmlNode componentNode = GetComponentConfig(componentId);
XmlNode settings = componentNode.SelectSingleNode("settings");
string xpath = string.Format("add[@key=\"{0}\"]", settingName);
XmlNode settingNode = settings.SelectSingleNode(xpath);
if (settingNode == null)
{
settingNode = Configuration.CreateElement("add");
XmlUtils.SetXmlAttribute(settingNode, "key", settingName);
settings.AppendChild(settingNode);
}
XmlUtils.SetXmlAttribute(settingNode, "value", value.ToString());
}
public static void LoadComponentSettings(SetupVariables vars)
{
XmlNode componentNode = GetComponentConfig(vars.ComponentId);
//
if (componentNode != null)
{
var typeRef = vars.GetType();
//
XmlNodeList settingNodes = componentNode.SelectNodes("settings/add");
//
foreach (XmlNode item in settingNodes)
{
var sName = XmlUtils.GetXmlAttribute(item, "key");
var sValue = XmlUtils.GetXmlAttribute(item, "value");
//
if (String.IsNullOrEmpty(sName))
continue;
//
var objProperty = typeRef.GetProperty(sName);
//
if (objProperty == null)
continue;
// Set property value
objProperty.SetValue(vars, Convert.ChangeType(sValue, objProperty.PropertyType), null);
}
}
}
public static string GetComponentSettingStringValue(string componentId, string settingName)
{
string ret = null;
XmlNode componentNode = GetComponentConfig(componentId);
if (componentNode != null)
{
string xpath = string.Format("settings/add[@key=\"{0}\"]", settingName);
XmlNode settingNode = componentNode.SelectSingleNode(xpath);
if (settingNode != null)
{
ret = XmlUtils.GetXmlAttribute(settingNode, "value");
}
}
return ret;
}
internal static int GetComponentSettingInt32Value(string componentId, string settingName)
{
int ret = 0;
XmlNode componentNode = GetComponentConfig(componentId);
if (componentNode != null)
{
string xpath = string.Format("settings/add[@key=\"{0}\"]", settingName);
XmlNode settingNode = componentNode.SelectSingleNode(xpath);
string val = XmlUtils.GetXmlAttribute(settingNode, "value");
Int32.TryParse(val, out ret);
}
return ret;
}
internal static bool GetComponentSettingBooleanValue(string componentId, string settingName)
{
bool ret = false;
XmlNode componentNode = GetComponentConfig(componentId);
if (componentNode != null)
{
string xpath = string.Format("settings/add[@key=\"{0}\"]", settingName);
XmlNode settingNode = componentNode.SelectSingleNode(xpath);
string val = XmlUtils.GetXmlAttribute(settingNode, "value");
Boolean.TryParse(val, out ret);
}
return ret;
}
internal static string GetSettingStringValue(string settingName)
{
string ret = null;
string xPath = string.Format("settings/add[@key=\"{0}\"]", settingName);
XmlNode settingNode = Configuration.SelectSingleNode(xPath);
if (settingNode != null)
{
ret = XmlUtils.GetXmlAttribute(settingNode, "value");
}
return ret;
}
}
}

View file

@ -0,0 +1,217 @@
// 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;
using System.IO;
using System.Security.Cryptography;
namespace WebsitePanel.Setup
{
internal class CRC32 : HashAlgorithm
{
protected static uint AllOnes = 0xffffffff;
protected static Hashtable cachedCRC32Tables;
protected static bool autoCache;
protected uint[] crc32Table;
private uint m_crc;
/// <summary>
/// Returns the default polynomial (used in WinZip, Ethernet, etc)
/// </summary>
public static uint DefaultPolynomial
{
get { return 0x04C11DB7; }
}
/// <summary>
/// Gets or sets the auto-cache setting of this class.
/// </summary>
public static bool AutoCache
{
get { return autoCache; }
set { autoCache = value; }
}
/// <summary>
/// Initialize the cache
/// </summary>
static CRC32()
{
cachedCRC32Tables = Hashtable.Synchronized(new Hashtable());
autoCache = true;
}
public static void ClearCache()
{
cachedCRC32Tables.Clear();
}
/// <summary>
/// Builds a crc32 table given a polynomial
/// </summary>
/// <param name="ulPolynomial"></param>
/// <returns></returns>
protected static uint[] BuildCRC32Table(uint ulPolynomial)
{
uint dwCrc;
uint[] table = new uint[256];
// 256 values representing ASCII character codes.
for (int i = 0; i < 256; i++)
{
dwCrc = (uint)i;
for (int j = 8; j > 0; j--)
{
if ((dwCrc & 1) == 1)
dwCrc = (dwCrc >> 1) ^ ulPolynomial;
else
dwCrc >>= 1;
}
table[i] = dwCrc;
}
return table;
}
/// <summary>
/// Creates a CRC32 object using the DefaultPolynomial
/// </summary>
public CRC32()
: this(DefaultPolynomial)
{
}
/// <summary>
/// Creates a CRC32 object using the specified Creates a CRC32 object
/// </summary>
public CRC32(uint aPolynomial)
: this(aPolynomial, CRC32.AutoCache)
{
}
/// <summary>
/// Construct the
/// </summary>
public CRC32(uint aPolynomial, bool cacheTable)
{
this.HashSizeValue = 32;
crc32Table = (uint[])cachedCRC32Tables[aPolynomial];
if (crc32Table == null)
{
crc32Table = CRC32.BuildCRC32Table(aPolynomial);
if (cacheTable)
cachedCRC32Tables.Add(aPolynomial, crc32Table);
}
Initialize();
}
/// <summary>
/// Initializes an implementation of HashAlgorithm.
/// </summary>
public override void Initialize()
{
m_crc = AllOnes;
}
/// <summary>
///
/// </summary>
/// <param name="buffer"></param>
/// <param name="offset"></param>
/// <param name="count"></param>
protected override void HashCore(byte[] buffer, int offset, int count)
{
// Save the text in the buffer.
for (int i = offset; i < count; i++)
{
ulong tabPtr = (m_crc & 0xFF) ^ buffer[i];
m_crc >>= 8;
m_crc ^= crc32Table[tabPtr];
}
}
/// <summary>
///
/// </summary>
/// <returns></returns>
protected override byte[] HashFinal()
{
byte[] finalHash = new byte[4];
ulong finalCRC = m_crc ^ AllOnes;
finalHash[0] = (byte)((finalCRC >> 24) & 0xFF);
finalHash[1] = (byte)((finalCRC >> 16) & 0xFF);
finalHash[2] = (byte)((finalCRC >> 8) & 0xFF);
finalHash[3] = (byte)((finalCRC >> 0) & 0xFF);
return finalHash;
}
/// <summary>
/// Computes the hash value for the specified Stream.
/// </summary>
new public byte[] ComputeHash(Stream inputStream)
{
byte[] buffer = new byte[4096];
int bytesRead;
while ((bytesRead = inputStream.Read(buffer, 0, 4096)) > 0)
{
HashCore(buffer, 0, bytesRead);
}
return HashFinal();
}
/// <summary>
/// Overloaded. Computes the hash value for the input data.
/// </summary>
new public byte[] ComputeHash(byte[] buffer)
{
return ComputeHash(buffer, 0, buffer.Length);
}
/// <summary>
/// Overloaded. Computes the hash value for the input data.
/// </summary>
/// <param name="buffer"></param>
/// <param name="offset"></param>
/// <param name="count"></param>
/// <returns></returns>
new public byte[] ComputeHash(byte[] buffer, int offset, int count)
{
HashCore(buffer, offset, count);
return HashFinal();
}
}
}

View file

@ -0,0 +1,68 @@
// 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.Text;
namespace WebsitePanel.Setup
{
public enum CheckTypes
{
None,
OperationSystem,
IISVersion,
ASPNET,
WPServer,
WPEnterpriseServer,
WPPortal,
ASPNET32
}
public enum CheckStatuses
{
Success,
Warning,
Error
}
public class ConfigurationCheck
{
public ConfigurationCheck(CheckTypes checkType, string action)
{
this.CheckType = checkType;
this.Action = action;
}
public CheckTypes CheckType {get;set;}
public string Action { get; set; }
public CheckStatuses Status {get;set;}
public string Details { get; set; }
public SetupVariables SetupVariables { get; set; }
}
}

View file

@ -0,0 +1,132 @@
// 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.IO;
using System.Windows.Forms;
namespace WebsitePanel.Setup
{
/// <summary>
/// Shows copy process.
/// </summary>
public sealed class CopyProcess
{
private ProgressBar progressBar;
private DirectoryInfo sourceFolder;
private DirectoryInfo destFolder;
/// <summary>
/// Initializes a new instance of the class.
/// </summary>
/// <param name="bar">Progress bar.</param>
/// <param name="source">Source folder.</param>
/// <param name="destination">Destination folder.</param>
public CopyProcess(ProgressBar bar, string source, string destination)
{
this.progressBar = bar;
this.sourceFolder = new DirectoryInfo(source);
this.destFolder = new DirectoryInfo(destination);
}
/// <summary>
/// Copy source to the destination folder.
/// </summary>
internal void Run()
{
// unzip
long totalSize = FileUtils.CalculateFolderSize(sourceFolder.FullName);
long copied = 0;
progressBar.Minimum = 0;
progressBar.Maximum = 100;
progressBar.Value = 0;
int i = 0;
List<DirectoryInfo> folders = new List<DirectoryInfo>();
List<FileInfo> files = new List<FileInfo>();
DirectoryInfo di = null;
//FileInfo fi = null;
string path = null;
// Part 1: Indexing
folders.Add(sourceFolder);
while (i < folders.Count)
{
foreach (DirectoryInfo info in folders[i].GetDirectories())
{
if (!folders.Contains(info))
folders.Add(info);
}
foreach (FileInfo info in folders[i].GetFiles())
{
files.Add(info);
}
i++;
}
// Part 2: Destination Folders Creation
///////////////////////////////////////////////////////
for (i = 0; i < folders.Count; i++)
{
if (folders[i].Exists)
{
path = destFolder.FullName +
Path.DirectorySeparatorChar +
folders[i].FullName.Remove(0, sourceFolder.FullName.Length);
di = new DirectoryInfo(path);
// Prevent IOException
if (!di.Exists)
di.Create();
}
}
// Part 3: Source to Destination File Copy
///////////////////////////////////////////////////////
for (i = 0; i < files.Count; i++)
{
if (files[i].Exists)
{
path = destFolder.FullName +
Path.DirectorySeparatorChar +
files[i].FullName.Remove(0, sourceFolder.FullName.Length + 1);
FileUtils.CopyFile(files[i], path);
copied += files[i].Length;
if (totalSize != 0)
{
progressBar.Value = Convert.ToInt32(copied * 100 / totalSize);
}
}
}
}
}
}

View file

@ -0,0 +1,266 @@
// 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.Text;
using Microsoft.Web.Services3;
using WebsitePanel.EnterpriseServer;
using WebsitePanel.EnterpriseServer.HostedSolution;
namespace WebsitePanel.Setup
{
public class ServerContext
{
public string Server { get; set; }
public string Username { get; set; }
public string Password { get; set; }
}
/// <summary>
/// ES Proxy class
/// </summary>
public class ES
{
public const int ERROR_USER_WRONG_PASSWORD = -110;
public const int ERROR_USER_WRONG_USERNAME = -109;
public const int ERROR_USER_ACCOUNT_CANCELLED = -105;
public const int ERROR_USER_ACCOUNT_DEMO = -106;
public const int ERROR_USER_ACCOUNT_PENDING = -103;
public const int ERROR_USER_ACCOUNT_SHOULD_BE_ADMINISTRATOR = -107;
public const int ERROR_USER_ACCOUNT_SHOULD_BE_RESELLER = -108;
public const int ERROR_USER_ACCOUNT_SUSPENDED = -104;
private static ServerContext serverContext = null;
private static void InitializeServices(ServerContext context)
{
serverContext = context;
}
public static bool Connect(string server, string username, string password)
{
bool ret = true;
ServerContext serverContext = new ServerContext();
serverContext.Server = server;
serverContext.Username = username;
serverContext.Password = password;
InitializeServices(serverContext);
int status = -1;
try
{
status = ES.Services.Authentication.AuthenticateUser(serverContext.Username, serverContext.Password, null);
}
catch (Exception ex)
{
Log.WriteError("Authentication error", ex);
return false;
}
string errorMessage = "Check your internet connection or server URL.";
if (status != 0)
{
switch (status)
{
case ERROR_USER_WRONG_USERNAME:
errorMessage = "Wrong username.";
break;
case ERROR_USER_WRONG_PASSWORD:
errorMessage = "Wrong password.";
break;
case ERROR_USER_ACCOUNT_CANCELLED:
errorMessage = "Account cancelled.";
break;
case ERROR_USER_ACCOUNT_PENDING:
errorMessage = "Account pending.";
break;
}
Log.WriteError(
string.Format("Cannot connect to the remote server. {0}", errorMessage));
ret = false;
}
return ret;
}
public static ES Services
{
get
{
return new ES();
}
}
public esSystem System
{
get { return GetCachedProxy<esSystem>(); }
}
public esApplicationsInstaller ApplicationsInstaller
{
get { return GetCachedProxy<esApplicationsInstaller>(); }
}
public esAuditLog AuditLog
{
get { return GetCachedProxy<esAuditLog>(); }
}
public esAuthentication Authentication
{
get { return GetCachedProxy<esAuthentication>(false); }
}
public esComments Comments
{
get { return GetCachedProxy<esComments>(); }
}
public esDatabaseServers DatabaseServers
{
get { return GetCachedProxy<esDatabaseServers>(); }
}
public esFiles Files
{
get { return GetCachedProxy<esFiles>(); }
}
public esFtpServers FtpServers
{
get { return GetCachedProxy<esFtpServers>(); }
}
public esMailServers MailServers
{
get { return GetCachedProxy<esMailServers>(); }
}
public esOperatingSystems OperatingSystems
{
get { return GetCachedProxy<esOperatingSystems>(); }
}
public esPackages Packages
{
get { return GetCachedProxy<esPackages>(); }
}
public esScheduler Scheduler
{
get { return GetCachedProxy<esScheduler>(); }
}
public esTasks Tasks
{
get { return GetCachedProxy<esTasks>(); }
}
public esServers Servers
{
get { return GetCachedProxy<esServers>(); }
}
public esStatisticsServers StatisticsServers
{
get { return GetCachedProxy<esStatisticsServers>(); }
}
public esUsers Users
{
get { return GetCachedProxy<esUsers>(); }
}
public esWebServers WebServers
{
get { return GetCachedProxy<esWebServers>(); }
}
public esSharePointServers SharePointServers
{
get { return GetCachedProxy<esSharePointServers>(); }
}
public esImport Import
{
get { return GetCachedProxy<esImport>(); }
}
public esBackup Backup
{
get { return GetCachedProxy<esBackup>(); }
}
public esExchangeServer ExchangeServer
{
get { return GetCachedProxy<esExchangeServer>(); }
}
public esOrganizations Organizations
{
get { return GetCachedProxy<esOrganizations>(); }
}
protected ES()
{
}
protected virtual T GetCachedProxy<T>()
{
return GetCachedProxy<T>(true);
}
protected virtual T GetCachedProxy<T>(bool secureCalls)
{
if (serverContext == null)
{
throw new Exception("Server context is not specified");
}
Type t = typeof(T);
string key = t.FullName + ".ServiceProxy";
T proxy = (T)Activator.CreateInstance(t);
object p = proxy;
// configure proxy
EnterpriseServerProxyConfigurator cnfg = new EnterpriseServerProxyConfigurator();
cnfg.EnterpriseServerUrl = serverContext.Server;
if (secureCalls)
{
cnfg.Username = serverContext.Username;
cnfg.Password = serverContext.Password;
}
cnfg.Configure((WebServicesClientProtocol)p);
return proxy;
}
}
}

View file

@ -0,0 +1,535 @@
// 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.Diagnostics;
using System.IO;
using System.Runtime.InteropServices;
using Ionic.Zip;
namespace WebsitePanel.Setup
{
/// <summary>
/// File utils.
/// </summary>
public sealed class FileUtils
{
/// <summary>
/// Initializes a new instance of the class.
/// </summary>
private FileUtils()
{
}
/// <summary>
/// Returns current application path.
/// </summary>
/// <returns>Curent application path.</returns>
public static string GetCurrentDirectory()
{
return AppDomain.CurrentDomain.BaseDirectory;
}
/// <summary>
/// Returns application temp directory.
/// </summary>
/// <returns>Application temp directory.</returns>
public static string GetTempDirectory()
{
return Path.Combine(GetCurrentDirectory(), "Tmp");
}
/// <summary>
/// Returns application data directory.
/// </summary>
/// <returns>Application data directory.</returns>
public static string GetDataDirectory()
{
return Path.Combine(GetCurrentDirectory(), "Data");
}
internal static void UnzipFile(string targetDir, string zipFile)
{
using (ZipFile zip = ZipFile.Read(zipFile))
{
foreach (ZipEntry e in zip)
{
e.Extract(targetDir, ExtractExistingFileAction.OverwriteSilently);
}
}
}
/// <summary>
/// Creates drectory with the specified directory.
/// </summary>
/// <param name="path">The directory path to create.</param>
internal static void CreateDirectory(string path)
{
string dir = Path.GetDirectoryName(path);
if (!Directory.Exists(dir))
{
// create directory structure
Directory.CreateDirectory(dir);
}
}
/// <summary>
/// Saves file content.
/// </summary>
/// <param name="fileName">File name.</param>
/// <param name="content">The array of bytes to write.</param>
internal static void SaveFileContent(string fileName, byte[] content)
{
FileStream stream = new FileStream(fileName, FileMode.Create);
stream.Write(content, 0, content.Length);
stream.Close();
}
/// <summary>
/// Saves file content.
/// </summary>
/// <param name="fileName">File name.</param>
/// <param name="content">The array of bytes to write.</param>
internal static void AppendFileContent(string fileName, byte[] content)
{
FileStream stream = new FileStream(fileName, FileMode.Append, FileAccess.Write);
stream.Write(content, 0, content.Length);
stream.Close();
}
/// <summary>
/// Copies the specified file.
/// </summary>
internal static void CopyFile(FileInfo sourceFile, string destinationFile)
{
int attempts = 0;
while (true)
{
try
{
CopyFileInternal(sourceFile, destinationFile);
break;
}
catch (Exception)
{
if (attempts > 2)
throw;
attempts++;
System.Threading.Thread.Sleep(1000);
}
}
}
/// <summary>
/// Copies the specified file.
/// </summary>
private static void CopyFileInternal(FileInfo sourceFile, string destinationFile)
{
try
{
sourceFile.CopyTo(destinationFile, true);
}
catch (UnauthorizedAccessException)
{
//try to overwrite read-only file
OverwriteReadOnlyFile(sourceFile, destinationFile);
}
}
/// <summary>
/// Copies the specified file.
/// </summary>
private static void OverwriteReadOnlyFile(FileInfo sourceFile, string destinationFile)
{
FileInfo fi = new FileInfo(destinationFile);
if (fi.Exists)
{
fi.Attributes = FileAttributes.Normal;
}
sourceFile.CopyTo(fi.FullName, true);
}
/// <summary>
/// Deletes the specified file.
/// </summary>
/// <param name="fileName">The name of the file to be deleted.</param>
internal static void DeleteFile(string fileName)
{
int attempts = 0;
while (true)
{
try
{
DeleteFileInternal(fileName);
break;
}
catch (Exception)
{
if (attempts > 2)
throw;
attempts++;
System.Threading.Thread.Sleep(1000);
}
}
}
/// <summary>
/// Deletes the specified file.
/// </summary>
/// <param name="fileName">The name of the file to be deleted.</param>
private static void DeleteReadOnlyFile(string fileName)
{
FileInfo info = new FileInfo(fileName);
info.Attributes = FileAttributes.Normal;
info.Delete();
}
/// <summary>
/// Deletes the specified file.
/// </summary>
/// <param name="fileName">The name of the file to be deleted.</param>
private static void DeleteFileInternal(string fileName)
{
try
{
File.Delete(fileName);
}
catch (UnauthorizedAccessException)
{
DeleteReadOnlyFile(fileName);
}
}
/// <summary>
/// Deletes the specified directory.
/// </summary>
/// <param name="directory">The name of the directory to be deleted.</param>
internal static void DeleteDirectory(string directory)
{
if (!Directory.Exists(directory))
return;
// iterate through child folders
string[] dirs = Directory.GetDirectories(directory);
foreach (string dir in dirs)
{
DeleteDirectory(dir);
}
// iterate through child files
string[] files = Directory.GetFiles(directory);
foreach (string file in files)
{
DeleteFile(file);
}
//try to delete dir for 3 times
int attempts = 0;
while (true)
{
try
{
DeleteDirectoryInternal(directory);
break;
}
catch (Exception)
{
if (attempts > 2)
throw;
attempts++;
System.Threading.Thread.Sleep(1000);
}
}
}
/// <summary>
/// Deletes the specified directory.
/// </summary>
/// <param name="directory">The name of the directory to be deleted.</param>
private static void DeleteDirectoryInternal(string directory)
{
try
{
Directory.Delete(directory);
}
catch (IOException)
{
DeleteReadOnlyDirectory(directory);
}
}
/// <summary>
/// Deletes the specified directory.
/// </summary>
/// <param name="directory">The name of the directory to be deleted.</param>
private static void DeleteReadOnlyDirectory(string directory)
{
DirectoryInfo info = new DirectoryInfo(directory);
info.Attributes = FileAttributes.Normal;
info.Delete();
}
/// <summary>
/// Determines whether the specified file exists.
/// </summary>
/// <param name="fileName">The path to check.</param>
/// <returns></returns>
internal static bool FileExists(string fileName)
{
return File.Exists(fileName);
}
/// <summary>
/// Determines whether the given path refers to an existing directory on disk.
/// </summary>
/// <param name="path">The path to test.</param>
/// <returns></returns>
internal static bool DirectoryExists(string path)
{
return Directory.Exists(path);
}
public static long CalculateFolderSize(string path)
{
int files = 0;
int folders = 0;
return CalculateFolderSize(path, out files, out folders);
}
public static int CalculateFiles(string path)
{
int files = 0;
int folders = 0;
CalculateFolderSize(path, out files, out folders);
return files;
}
public static void CopyFileToFolder(string sourceFile, string destinationFolder)
{
string fileName = Path.GetFileName(sourceFile);
string destinationFile = Path.Combine(destinationFolder, fileName);
CopyFile(new FileInfo(sourceFile), destinationFile);
}
/// <summary>
/// Copy source to the destination folder.
/// </summary>
public static void CopyDirectory(string source, string destination)
{
int i = 0;
List<DirectoryInfo> folders = new List<DirectoryInfo>();
List<FileInfo> files = new List<FileInfo>();
DirectoryInfo sourceFolder = new DirectoryInfo(source);
DirectoryInfo destFolder = new DirectoryInfo(destination);
DirectoryInfo di = null;
FileInfo fi = null;
string path = null;
// Part 1: Indexing
folders.Add(sourceFolder);
while (i < folders.Count)
{
foreach (DirectoryInfo info in folders[i].GetDirectories())
{
if (!folders.Contains(info))
folders.Add(info);
}
foreach (FileInfo info in folders[i].GetFiles())
{
files.Add(info);
}
i++;
}
// Part 2: Destination Folders Creation
///////////////////////////////////////////////////////
for (i = 0; i < folders.Count; i++)
{
if (folders[i].Exists)
{
path = destFolder.FullName +
Path.DirectorySeparatorChar +
folders[i].FullName.Remove(0, sourceFolder.FullName.Length);
di = new DirectoryInfo(path);
// Prevent IOException
if (!di.Exists)
di.Create();
}
}
// Part 3: Source to Destination File Copy
///////////////////////////////////////////////////////
for (i = 0; i < files.Count; i++)
{
if (files[i].Exists)
{
path = destFolder.FullName +
Path.DirectorySeparatorChar +
files[i].FullName.Remove(0, sourceFolder.FullName.Length + 1);
fi = new FileInfo(path);
files[i].CopyTo(fi.FullName, true);
}
}
}
public static long CalculateFolderSize(string path, out int files, out int folders)
{
files = 0;
folders = 0;
if (!Directory.Exists(path))
return 0;
IntPtr INVALID_HANDLE_VALUE = new IntPtr(-1);
long size = 0;
FindData findData = new FindData();
IntPtr findHandle;
findHandle = Kernel32.FindFirstFile(@"\\?\" + path + @"\*", findData);
if (findHandle != INVALID_HANDLE_VALUE)
{
do
{
if ((findData.fileAttributes & (int)FileAttributes.Directory) != 0)
{
if (findData.fileName != "." && findData.fileName != "..")
{
folders++;
int subfiles, subfolders;
string subdirectory = path + (path.EndsWith(@"\") ? "" : @"\") +
findData.fileName;
size += CalculateFolderSize(subdirectory, out subfiles, out subfolders);
folders += subfolders;
files += subfiles;
}
}
else
{
// File
files++;
size += (long)findData.nFileSizeLow + (long)findData.nFileSizeHigh * 4294967296;
}
}
while (Kernel32.FindNextFile(findHandle, findData));
Kernel32.FindClose(findHandle);
}
return size;
}
public static string SizeToString(long size)
{
if (size >= 0x400 && size < 0x100000)
// kilobytes
return SizeToKB(size);
else if (size >= 0x100000 && size < 0x40000000)
// megabytes
return SizeToMB(size);
else if (size >= 0x40000000 && size < 0x10000000000)
// gigabytes
return SizeToGB(size);
else
return string.Format("{0:0.0}", size);
}
public static string SizeToKB(long size)
{
return string.Format("{0:0.0} KB", (float)size / 1024 );
}
public static string SizeToMB(long size)
{
return string.Format("{0:0.0} MB", (float)size / 1024 / 1024);
}
public static string SizeToGB(long size)
{
return string.Format("{0:0.0} GB", (float)size / 1024 / 1024 / 1024);
}
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
public static extern bool GetDiskFreeSpaceEx(string lpDirectoryName,
out ulong lpFreeBytesAvailable,
out ulong lpTotalNumberOfBytes,
out ulong lpTotalNumberOfFreeBytes);
}
#region File Size Calculation helper classes
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
class FindData
{
public int fileAttributes;
public int creationTime_lowDateTime;
public int creationTime_highDateTime;
public int lastAccessTime_lowDateTime;
public int lastAccessTime_highDateTime;
public int lastWriteTime_lowDateTime;
public int lastWriteTime_highDateTime;
public int nFileSizeHigh;
public int nFileSizeLow;
public int dwReserved0;
public int dwReserved1;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)]
public String fileName;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 14)]
public String alternateFileName;
}
class Kernel32
{
[DllImport("Kernel32.dll", CharSet = CharSet.Auto)]
public static extern IntPtr FindFirstFile(String fileName, [In, Out] FindData findFileData);
[DllImport("kernel32", CharSet = CharSet.Auto)]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool FindNextFile(IntPtr hFindFile, [In, Out] FindData lpFindFileData);
[DllImport("kernel32", CharSet = CharSet.Auto)]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool FindClose(IntPtr hFindFile);
}
#endregion
}

View file

@ -0,0 +1,261 @@
// 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.Text;
using System.Xml;
namespace WebsitePanel.Setup
{
public class Global
{
public const string SilentInstallerShell = "SilentInstallerShell";
public const string DefaultInstallPathRoot = @"C:\WebsitePanel";
public const string LoopbackIPv4 = "127.0.0.1";
public const string InstallerProductCode = "cfg core";
public abstract class Parameters
{
public const string ComponentId = "ComponentId";
public const string EnterpriseServerUrl = "EnterpriseServerUrl";
public const string ShellMode = "ShellMode";
public const string ShellVersion = "ShellVersion";
public const string IISVersion = "IISVersion";
public const string BaseDirectory = "BaseDirectory";
public const string Installer = "Installer";
public const string InstallerType = "InstallerType";
public const string InstallerPath = "InstallerPath";
public const string InstallerFolder = "InstallerFolder";
public const string Version = "Version";
public const string ComponentDescription = "ComponentDescription";
public const string ComponentCode = "ComponentCode";
public const string ApplicationName = "ApplicationName";
public const string ComponentName = "ComponentName";
public const string WebSiteIP = "WebSiteIP";
public const string WebSitePort = "WebSitePort";
public const string WebSiteDomain = "WebSiteDomain";
public const string ServerPassword = "ServerPassword";
public const string UserDomain = "UserDomain";
public const string UserAccount = "UserAccount";
public const string UserPassword = "UserPassword";
public const string CryptoKey = "CryptoKey";
public const string ServerAdminPassword = "ServerAdminPassword";
public const string SetupXml = "SetupXml";
public const string ParentForm = "ParentForm";
public const string Component = "Component";
public const string FullFilePath = "FullFilePath";
public const string DatabaseServer = "DatabaseServer";
public const string DbServerAdmin = "DbServerAdmin";
public const string DbServerAdminPassword = "DbServerAdminPassword";
public const string DatabaseName = "DatabaseName";
public const string ConnectionString = "ConnectionString";
public const string InstallConnectionString = "InstallConnectionString";
public const string Release = "Release";
}
public abstract class Messages
{
public const string NotEnoughPermissionsError = "You do not have the appropriate permissions to perform this operation. Make sure you are running the application from the local disk and you have local system administrator privileges.";
public const string InstallerVersionIsObsolete = "WebsitePanel Installer {0} or higher required.";
public const string ComponentIsAlreadyInstalled = "Component or its part is already installed.";
public const string AnotherInstanceIsRunning = "Another instance of the installation process is already running.";
public const string NoInputParametersSpecified = "No input parameters specified";
public const int InstallationError = -1000;
public const int UnknownComponentCodeError = -999;
public const int SuccessInstallation = 0;
public const int AnotherInstanceIsRunningError = -998;
public const int NotEnoughPermissionsErrorCode = -997;
public const int NoInputParametersSpecifiedError = -996;
public const int ComponentIsAlreadyInstalledError = -995;
}
public abstract class Server
{
public abstract class CLI
{
public const string ServerPassword = "passw";
};
public const string ComponentName = "Server";
public const string ComponentCode = "server";
public const string ComponentDescription = "WebsitePanel Server is a set of services running on the remote server to be controlled. Server application should be reachable from Enterprise Server one.";
public const string ServiceAccount = "WPServer";
public const string DefaultPort = "9003";
public const string DefaultIP = "127.0.0.1";
public const string SetupController = "Server";
public static string[] ServiceUserMembership
{
get
{
if (IISVersion.Major == 7)
{
return new string[] { "AD:Domain Admins", "SID:" + SystemSID.ADMINISTRATORS, "IIS_IUSRS" };
}
//
return new string[] { "AD:Domain Admins", "SID:" + SystemSID.ADMINISTRATORS, "IIS_WPG" };
}
}
}
public abstract class StandaloneServer
{
public const string SetupController = "StandaloneServerSetup";
public const string ComponentCode = "standalone";
public const string ComponentName = "Standalone Server Setup";
}
public abstract class WebPortal
{
public const string ComponentName = "Portal";
public const string ComponentDescription = "WebsitePanel Portal is a control panel itself with user interface which allows managing user accounts, hosting spaces, web sites, FTP accounts, files, etc.";
public const string ServiceAccount = "WPPortal";
public const string DefaultPort = "9001";
public const string DefaultIP = "";
public const string DefaultEntServURL = "http://127.0.0.1:9002";
public const string ComponentCode = "portal";
public const string SetupController = "Portal";
public static string[] ServiceUserMembership
{
get
{
if (IISVersion.Major == 7)
{
return new string[] { "IIS_IUSRS" };
}
//
return new string[] { "IIS_WPG" };
}
}
public abstract class CLI
{
public const string EnterpriseServerUrl = "esurl";
}
}
public abstract class EntServer
{
public const string ComponentName = "Enterprise Server";
public const string ComponentDescription = "Enterprise Server is the heart of WebsitePanel system. It includes all business logic of the application. Enterprise Server should have access to Server and be accessible from Portal applications.";
public const string ServiceAccount = "WPEnterpriseServer";
public const string DefaultPort = "9002";
public const string DefaultIP = "127.0.0.1";
public const string DefaultDbServer = @"localhost\sqlexpress";
public const string DefaultDatabase = "WebsitePanel";
public const string AspNetConnectionStringFormat = "server={0};database={1};uid={2};pwd={3};";
public const string ComponentCode = "enterprise server";
public const string SetupController = "EnterpriseServer";
public static string[] ServiceUserMembership
{
get
{
if (IISVersion.Major == 7)
{
return new string[] { "IIS_IUSRS" };
}
//
return new string[] { "IIS_WPG" };
}
}
public abstract class CLI
{
public const string ServeradminPassword = "passw";
public const string DatabaseName = "dbname";
public const string DatabaseServer = "dbserver";
public const string DbServerAdmin = "dbadmin";
public const string DbServerAdminPassword = "dbapassw";
}
}
public abstract class CLI
{
public const string WebSiteIP = "webip";
public const string ServiceAccountPassword = "upassw";
public const string ServiceAccountDomain = "udomaim";
public const string ServiceAccountName = "uname";
public const string WebSitePort = "webport";
public const string WebSiteDomain = "webdom";
}
private Global()
{
}
private static Version iisVersion;
//
public static Version IISVersion
{
get
{
if (iisVersion == null)
{
iisVersion = RegistryUtils.GetIISVersion();
}
//
return iisVersion;
}
}
//
private static OS.WindowsVersion osVersion = OS.WindowsVersion.Unknown;
/// <summary>
/// Represents Setup Control Panel Accounts system settings set (SCPA)
/// </summary>
public class SCPA
{
public const string SettingsKeyName = "EnabledSCPA";
}
public static OS.WindowsVersion OSVersion
{
get
{
if (osVersion == OS.WindowsVersion.Unknown)
{
osVersion = OS.GetVersion();
}
//
return osVersion;
}
}
public static XmlDocument SetupXmlDocument { get; set; }
}
public class SetupEventArgs<T> : EventArgs
{
public T EventData { get; set; }
public string EventMessage { get; set; }
}
}

View file

@ -0,0 +1,154 @@
// 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.Text;
namespace WebsitePanel.Setup
{
public enum ActionTypes
{
None,
CopyFiles,
CreateWebSite,
CryptoKey,
ServerPassword,
UpdateServerPassword,
UpdateConfig,
UpdateEnterpriseServerUrl,
CreateDatabase,
CreateDatabaseUser,
ExecuteSql,
DeleteRegistryKey,
DeleteDirectory,
DeleteDatabase,
DeleteDatabaseUser,
DeleteDatabaseLogin,
DeleteWebSite,
DeleteVirtualDirectory,
DeleteUserAccount,
DeleteUserMembership,
DeleteApplicationPool,
DeleteFiles,
UpdateWebSite,
//UpdateFiles,
Backup,
BackupDatabase,
BackupDirectory,
BackupConfig,
UpdatePortal2811,
UpdateEnterpriseServer2810,
UpdateServer2810,
CreateShortcuts,
DeleteShortcuts,
UpdateServers,
CopyWebConfig,
UpdateWebConfigNamespaces,
StopApplicationPool,
StartApplicationPool,
RegisterWindowsService,
UnregisterWindowsService,
StartWindowsService,
StopWindowsService,
ServiceSettings,
CreateUserAccount,
InitSetupVariables,
UpdateServerAdminPassword,
UpdateLicenseInformation,
ConfigureStandaloneServerData,
CreateWPServerLogin,
FolderPermissions,
AddCustomErrorsPage,
SwitchServer2AspNet40,
SwitchEntServer2AspNet40,
SwitchWebPortal2AspNet40,
}
public class InstallAction
{
public InstallAction(ActionTypes type)
{
this.ActionType = type;
}
public ActionTypes ActionType{ get; set; }
public string Name{ get; set; }
public string Log{ get; set; }
public string Description{ get; set; }
public string ConnectionString{ get; set; }
public string Key{ get; set; }
public string Path{ get; set; }
public string UserName{ get; set; }
public string SiteId{ get; set; }
public string Source{ get; set; }
public string Destination{ get; set; }
public bool Empty{ get; set; }
public string IP{ get; set; }
public string Port{ get; set; }
public string Domain{ get; set; }
public string[] Membership { get; set; }
public SetupVariables SetupVariables { get; set; }
public string Url { get; set; }
}
}

View file

@ -0,0 +1,79 @@
// 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.Text;
namespace WebsitePanel.Setup
{
public sealed class InstallLog
{
private InstallLog()
{
}
private static StringBuilder sb;
static InstallLog()
{
sb = new StringBuilder("Setup has:");
sb.AppendLine();
}
public static void Append(string value)
{
sb.Append(value);
}
public static void AppendLine(string value)
{
sb.AppendLine(value);
}
public static void AppendLine(string format, params object[] args)
{
sb.AppendLine(String.Format(format, args));
}
public static void AppendLine()
{
sb.AppendLine();
}
public static void AppendFormat(string format, params object[] args)
{
sb.AppendFormat(format, args);
}
public static new string ToString()
{
return sb.ToString();
}
}
}

View file

@ -0,0 +1,174 @@
// 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.IO;
namespace WebsitePanel.Setup
{
/// <summary>
/// Installer Log.
/// </summary>
public sealed class Log
{
/// <summary>
/// Initializes a new instance of the class.
/// </summary>
private Log()
{
}
/// <summary>
/// Initializes trace listeners.
/// </summary>
static Log()
{
Trace.AutoFlush = true;
}
/// <summary>
/// Write error to the log.
/// </summary>
/// <param name="message">Error message.</param>
/// <param name="ex">Exception.</param>
internal static void WriteError(string message, Exception ex)
{
try
{
string line = string.Format("[{0:G}] ERROR: {1}", DateTime.Now, message);
Trace.WriteLine(line);
if ( ex != null )
Trace.WriteLine(ex);
}
catch { }
}
/// <summary>
/// Write error to the log.
/// </summary>
/// <param name="message">Error message.</param>
/// <param name="ex">Exception.</param>
internal static void WriteError(string message)
{
WriteError(message, null);
}
/// <summary>
/// Write to log
/// </summary>
/// <param name="message"></param>
internal static void Write(string message)
{
try
{
string line = string.Format("[{0:G}] {1}", DateTime.Now, message);
Trace.Write(line);
}
catch { }
}
/// <summary>
/// Write line to log
/// </summary>
/// <param name="message"></param>
internal static void WriteLine(string message)
{
try
{
string line = string.Format("[{0:G}] {1}", DateTime.Now, message);
Trace.WriteLine(line);
}
catch { }
}
/// <summary>
/// Write info message to log
/// </summary>
/// <param name="message"></param>
internal static void WriteInfo(string message)
{
try
{
string line = string.Format("[{0:G}] INFO: {1}", DateTime.Now, message);
Trace.WriteLine(line);
}
catch { }
}
/// <summary>
/// Write start message to log
/// </summary>
/// <param name="message"></param>
internal static void WriteStart(string message)
{
try
{
string line = string.Format("[{0:G}] START: {1}", DateTime.Now, message);
Trace.WriteLine(line);
Trace.Flush();
}
catch { }
}
/// <summary>
/// Write end message to log
/// </summary>
/// <param name="message"></param>
internal static void WriteEnd(string message)
{
try
{
string line = string.Format("[{0:G}] END: {1}", DateTime.Now, message);
Trace.WriteLine(line);
Trace.Flush();
}
catch { }
}
/// <summary>
/// Opens notepad to view log file.
/// </summary>
public static void ShowLogFile()
{
try
{
string path = AppConfig.GetSettingStringValue("Log.FileName");
if (string.IsNullOrEmpty(path))
{
path = "WebsitePanel.Installer.log";
}
path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, path);
Process.Start("notepad.exe", path);
}
catch { }
}
}
}

View file

@ -0,0 +1,437 @@
// 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.Text;
using System.Runtime.InteropServices;
namespace WebsitePanel.Setup
{
public sealed class OS
{
[StructLayout(LayoutKind.Sequential)]
public struct OSVERSIONINFO
{
public Int32 dwOSVersionInfoSize;
public Int32 dwMajorVersion;
public Int32 dwMinorVersion;
public Int32 dwBuildNumber;
public Int32 dwPlatformID;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)]
public string szCSDVersion;
}
[StructLayout(LayoutKind.Sequential)]
public struct OSVERSIONINFOEX
{
public Int32 dwOSVersionInfoSize;
public Int32 dwMajorVersion;
public Int32 dwMinorVersion;
public Int32 dwBuildNumber;
public Int32 dwPlatformID;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)]
public string szCSDVersion;
public short wServicePackMajor;
public short wServicePackMinor;
public short wSuiteMask;
public byte wProductType;
public byte wReserved;
}
[StructLayout(LayoutKind.Sequential)]
public struct SYSTEM_INFO
{
public Int32 dwOemID;
public Int32 dwPageSize;
public Int32 wProcessorArchitecture;
public Int32 lpMinimumApplicationAddress;
public Int32 lpMaximumApplicationAddress;
public Int32 dwActiveProcessorMask;
public Int32 dwNumberOrfProcessors;
public Int32 dwProcessorType;
public Int32 dwAllocationGranularity;
public Int32 dwReserved;
}
public enum WinSuiteMask : int
{
VER_SUITE_SMALLBUSINESS = 1,
VER_SUITE_ENTERPRISE = 2,
VER_SUITE_BACKOFFICE = 4,
VER_SUITE_COMMUNICATIONS = 8,
VER_SUITE_TERMINAL = 16,
VER_SUITE_SMALLBUSINESS_RESTRICTED = 32,
VER_SUITE_EMBEDDEDNT = 64,
VER_SUITE_DATACENTER = 128,
VER_SUITE_SINGLEUSERTS = 256,
VER_SUITE_PERSONAL = 512,
VER_SUITE_BLADE = 1024,
VER_SUITE_STORAGE_SERVER = 8192,
VER_SUITE_COMPUTE_SERVER = 16384
}
public enum WinPlatform : byte
{
VER_NT_WORKSTATION = 1,
VER_NT_DOMAIN_CONTROLLER = 2,
VER_NT_SERVER = 3
}
public enum OSMajorVersion : byte
{
VER_OS_NT4 = 4,
VER_OS_2K_XP_2K3 = 5,
VER_OS_VISTA_LONGHORN = 6
}
private const Int32 SM_SERVERR2 = 89;
private const Int32 SM_MEDIACENTER = 87;
private const Int32 SM_TABLETPC = 86;
[DllImport("kernel32")]
private static extern int GetSystemInfo(ref SYSTEM_INFO lpSystemInfo);
[DllImport("user32")]
private static extern int GetSystemMetrics(int nIndex);
[DllImport("kernel32", EntryPoint = "GetVersion")]
private static extern int GetVersionAdv(ref OSVERSIONINFO lpVersionInformation);
[DllImport("kernel32")]
private static extern int GetVersionEx(ref OSVERSIONINFOEX lpVersionInformation);
/*public static string GetVersionEx()
{
OSVERSIONINFO osvi = new OSVERSIONINFO();
OSVERSIONINFOEX xosvi = new OSVERSIONINFOEX();
Int32 iRet = 0;
string strDetails = string.Empty;
osvi.dwOSVersionInfoSize = Marshal.SizeOf(typeof(OSVERSIONINFO));
xosvi.dwOSVersionInfoSize = Marshal.SizeOf(typeof(OSVERSIONINFOEX));
try
{
iRet = (int)System.Environment.OSVersion.Platform;
if (iRet == 1)
{
iRet = GetVersionAdv(ref osvi);
strDetails = Environment.NewLine + "Release: " + osvi.dwMajorVersion + "." + osvi.dwMinorVersion + "." + osvi.dwBuildNumber + Environment.NewLine + osvi.szCSDVersion;
if (Len(osvi) == 0)
{
return "Windows 95" + strDetails;
}
else if (Len(osvi) == 10)
{
return "Windows 98" + strDetails;
}
else if (Len(osvi) == 9)
{
return "Windows ME" + strDetails;
}
}
else
{
iRet = GetVersionEx(xosvi);
strDetails = Environment.NewLine + "Release: " + xosvi.dwMajorVersion + "." + xosvi.dwMinorVersion + "." + xosvi.dwBuildNumber + Environment.NewLine + xosvi.szCSDVersion + " (" + xosvi.wServicePackMajor + "." + xosvi.wServicePackMinor + ")";
if (xosvi.dwMajorVersion == (byte)OSMajorVersion.VER_OS_NT4)
{
return "Windows NT 4" + strDetails;
}
else if (xosvi.dwMajorVersion == OSMajorVersion.VER_OS_2K_XP_2K3)
{
if (xosvi.dwMinorVersion == 0)
{
if (xosvi.wProductType == WinPlatform.VER_NT_WORKSTATION)
{
return "Windows 2000 Pro" + strDetails;
}
else if (xosvi.wProductType == WinPlatform.VER_NT_SERVER)
{
if ((xosvi.wSuiteMask & WinSuiteMask.VER_SUITE_DATACENTER) == WinSuiteMask.VER_SUITE_DATACENTER)
{
return "Windows 2000 Datacenter Server" + strDetails;
}
else if ((xosvi.wSuiteMask & WinSuiteMask.VER_SUITE_ENTERPRISE) == WinSuiteMask.VER_SUITE_ENTERPRISE)
{
return "Windows 2000 Advanced Server" + strDetails;
}
else if ((xosvi.wSuiteMask & WinSuiteMask.VER_SUITE_SMALLBUSINESS) == WinSuiteMask.VER_SUITE_SMALLBUSINESS)
{
return "Windows 2000 Small Business Server" + strDetails;
}
else
{
return "Windows 2000 Server" + strDetails;
}
}
else if (xosvi.wProductType == WinPlatform.VER_NT_DOMAIN_CONTROLLER)
{
if ((xosvi.wSuiteMask & WinSuiteMask.VER_SUITE_DATACENTER) == WinSuiteMask.VER_SUITE_DATACENTER)
{
return "Windows 2000 Datacenter Server Domain Controller" + strDetails;
}
else if ((xosvi.wSuiteMask & WinSuiteMask.VER_SUITE_ENTERPRISE) == WinSuiteMask.VER_SUITE_ENTERPRISE)
{
return "Windows 2000 Advanced Server Domain Controller" + strDetails;
}
else if ((xosvi.wSuiteMask & WinSuiteMask.VER_SUITE_SMALLBUSINESS) == WinSuiteMask.VER_SUITE_SMALLBUSINESS)
{
return "Windows 2000 Small Business Server Domain Controller" + strDetails;
}
else
{
return "Windows 2000 Server Domain Controller" + strDetails;
}
}
}
else if (xosvi.dwMinorVersion == 1)
{
if ((xosvi.wSuiteMask & WinSuiteMask.VER_SUITE_PERSONAL) == WinSuiteMask.VER_SUITE_PERSONAL)
{
return "Windows XP Home Edition" + strDetails;
}
else
{
return "Windows XP Professional Edition" + strDetails;
}
}
else if (xosvi.dwMinorVersion == 2)
{
if (xosvi.wProductType == WinPlatform.VER_NT_WORKSTATION)
{
return "Windows XP Professional x64 Edition" + strDetails;
}
else if (xosvi.wProductType == WinPlatform.VER_NT_SERVER)
{
if (GetSystemMetrics(SM_SERVERR2) == 1)
{
return "Windows Server 2003 R2" + strDetails;
}
else
{
return "Windows Server 2003" + strDetails;
}
}
else if (xosvi.wProductType == WinPlatform.VER_NT_DOMAIN_CONTROLLER)
{
if (GetSystemMetrics(SM_SERVERR2) == 1)
{
return "Windows Server 2003 R2 Domain Controller" + strDetails;
}
else
{
return "Windows Server 2003 Domain Controller" + strDetails;
}
}
}
}
else if (xosvi.dwMajorVersion == OSMajorVersion.VER_OS_VISTA_LONGHORN)
{
if (xosvi.wProductType == WinPlatform.VER_NT_WORKSTATION)
{
if ((xosvi.wSuiteMask & WinSuiteMask.VER_SUITE_PERSONAL) == WinSuiteMask.VER_SUITE_PERSONAL)
{
return "Windows Vista (Home Premium, Home Basic, or Home Ultimate) Edition";
}
else
{
return "Windows Vista (Enterprize or Business)" + strDetails;
}
}
else
{
return "Windows Server (Longhorn)" + strDetails;
}
}
}
}
catch
{
MessageBox.Show(GetLastError.ToString);
return string.Empty;
}
}*/
public enum WindowsVersion
{
Unknown = 0,
Windows95,
Windows98,
WindowsMe,
WindowsNT351,
WindowsNT4,
Windows2000,
WindowsXP,
WindowsServer2003,
WindowsVista,
WindowsServer2008
}
public static string GetName(WindowsVersion version)
{
string ret = string.Empty;
switch (version)
{
case WindowsVersion.Unknown:
ret = "Unknown";
break;
case WindowsVersion.Windows2000:
ret = "Windows 2000";
break;
case WindowsVersion.Windows95:
ret = "Windows 95";
break;
case WindowsVersion.Windows98:
ret = "Windows 98";
break;
case WindowsVersion.WindowsMe:
ret = "Windows Me";
break;
case WindowsVersion.WindowsNT351:
ret = "Windows NT 3.51";
break;
case WindowsVersion.WindowsNT4:
ret = "Windows NT 4.0";
break;
case WindowsVersion.WindowsServer2003:
ret = "Windows Server 2003";
break;
case WindowsVersion.WindowsServer2008:
ret = "Windows Server 2008";
break;
case WindowsVersion.WindowsVista:
ret = "Windows Vista";
break;
case WindowsVersion.WindowsXP:
ret = "Windows XP";
break;
}
return ret;
}
/// <summary>
/// Determine OS version
/// </summary>
/// <returns></returns>
public static WindowsVersion GetVersion()
{
WindowsVersion ret = WindowsVersion.Unknown;
OSVERSIONINFOEX info = new OSVERSIONINFOEX();
info.dwOSVersionInfoSize = Marshal.SizeOf(typeof(OSVERSIONINFOEX));
GetVersionEx(ref info);
// Get OperatingSystem information from the system namespace.
System.OperatingSystem osInfo = System.Environment.OSVersion;
// Determine the platform.
switch (osInfo.Platform)
{
// Platform is Windows 95, Windows 98, Windows 98 Second Edition, or Windows Me.
case System.PlatformID.Win32Windows:
switch (osInfo.Version.Minor)
{
case 0:
ret = WindowsVersion.Windows95;
break;
case 10:
ret = WindowsVersion.Windows98;
break;
case 90:
ret = WindowsVersion.WindowsMe;
break;
}
break;
// Platform is Windows NT 3.51, Windows NT 4.0, Windows 2000, or Windows XP.
case System.PlatformID.Win32NT:
switch (osInfo.Version.Major)
{
case 3:
ret = WindowsVersion.WindowsNT351;
break;
case 4:
ret = WindowsVersion.WindowsNT4;
break;
case 5:
switch (osInfo.Version.Minor)
{
case 0:
ret = WindowsVersion.Windows2000;
break;
case 1:
ret = WindowsVersion.WindowsXP;
break;
case 2:
int i = GetSystemMetrics(SM_SERVERR2);
if (i != 0)
{
//Server 2003 R2
ret = WindowsVersion.WindowsServer2003;
}
else
{
if (info.wProductType == (byte)WinPlatform.VER_NT_WORKSTATION)
{
//XP Pro x64
ret = WindowsVersion.WindowsXP;
}
else
{
ret = WindowsVersion.WindowsServer2003;
}
break;
}
break;
}
break;
case 6:
if (info.wProductType == (byte)WinPlatform.VER_NT_WORKSTATION)
ret = WindowsVersion.WindowsVista;
else
ret = WindowsVersion.WindowsServer2008;
break;
}
break;
}
return ret;
}
/// <summary>
/// Returns Windows directory
/// </summary>
/// <returns></returns>
public static string GetWindowsDirectory()
{
return Environment.GetEnvironmentVariable("windir");
}
/// <summary>
/// Returns Windows directory
/// </summary>
/// <returns></returns>
public static string GetSystemTmpDirectory()
{
return Environment.GetEnvironmentVariable("TMP", EnvironmentVariableTarget.Machine);
}
}
}

View file

@ -0,0 +1,248 @@
// 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 Microsoft.Win32;
namespace WebsitePanel.Setup
{
/// <summary>
/// Registry helper class.
/// </summary>
public sealed class RegistryUtils
{
/// <summary>
/// Initializes a new instance of the class.
/// </summary>
private RegistryUtils()
{
}
internal const string ProductKey = "SOFTWARE\\DotNetPark\\WebsitePanel\\";
internal const string CompanyKey = "SOFTWARE\\DotNetPark\\";
/// <summary>
/// Retrieves the specified value from the subkey.
/// </summary>
/// <param name="subkey">Subkey.</param>
/// <param name="name">Name of value to retrieve.</param>
/// <returns>The data associated with name.</returns>
public static object GetRegistryKeyValue(string subkey, string name)
{
object ret = null;
RegistryKey root = Registry.LocalMachine;
RegistryKey rk = root.OpenSubKey(subkey);
if (rk != null)
{
ret = rk.GetValue(name, null);
}
return ret;
}
/// <summary>
/// Retrieves the specified value from the subkey.
/// </summary>
/// <param name="subkey">Subkey.</param>
/// <param name="name">Name of value to retrieve.</param>
/// <returns>The data associated with name.</returns>
internal static string GetRegistryKeyStringValue(string subkey, string name)
{
string ret = null;
RegistryKey root = Registry.LocalMachine;
RegistryKey rk = root.OpenSubKey(subkey);
if ( rk != null )
{
ret = (string)rk.GetValue(name, string.Empty);
}
return ret;
}
/// <summary>
/// Retrieves the specified value from the subkey.
/// </summary>
/// <param name="subkey">Subkey.</param>
/// <param name="name">Name of value to retrieve.</param>
/// <returns>The data associated with name.</returns>
internal static int GetRegistryKeyInt32Value(string subkey, string name)
{
int ret = 0;
RegistryKey root = Registry.LocalMachine;
RegistryKey rk = root.OpenSubKey(subkey);
if ( rk != null )
{
ret = (int)rk.GetValue(name, 0);
}
return ret;
}
/// <summary>
/// Retrieves the specified value from the subkey.
/// </summary>
/// <param name="subkey">Subkey.</param>
/// <param name="name">Name of value to retrieve.</param>
/// <returns>The data associated with name.</returns>
internal static bool GetRegistryKeyBooleanValue(string subkey, string name)
{
bool ret = false;
RegistryKey root = Registry.LocalMachine;
RegistryKey rk = root.OpenSubKey(subkey);
if ( rk != null )
{
string strValue = (string)rk.GetValue(name, "False");
ret = Boolean.Parse(strValue);
}
return ret;
}
internal static bool RegistryKeyExist(string subkey)
{
RegistryKey root = Registry.LocalMachine;
RegistryKey rk = root.OpenSubKey(subkey);
return (rk != null);
}
/// <summary>
/// Deletes a registry subkey and any child subkeys.
/// </summary>
/// <param name="subkey">Subkey to delete.</param>
internal static void DeleteRegistryKey(string subkey)
{
RegistryKey root = Registry.LocalMachine;
RegistryKey rk = root.OpenSubKey(subkey);
if (rk != null)
root.DeleteSubKeyTree(subkey);
}
/// <summary>
/// Sets the specified value to the subkey.
/// </summary>
/// <param name="subkey">Subkey.</param>
/// <param name="name">Name of value to store data in.</param>
/// <param name="value">Data to store. </param>
internal static void SetRegistryKeyStringValue(string subkey, string name, string value)
{
RegistryKey root = Registry.LocalMachine;
RegistryKey rk = root.CreateSubKey(subkey);
if ( rk != null )
{
rk.SetValue(name, value);
}
}
/// <summary>
/// Sets the specified value to the subkey.
/// </summary>
/// <param name="subkey">Subkey.</param>
/// <param name="name">Name of value to store data in.</param>
/// <param name="value">Data to store. </param>
internal static void SetRegistryKeyInt32Value(string subkey, string name, int value)
{
RegistryKey root = Registry.LocalMachine;
RegistryKey rk = root.CreateSubKey(subkey);
if ( rk != null )
{
rk.SetValue(name, value);
}
}
/// <summary>
/// Sets the specified value to the subkey.
/// </summary>
/// <param name="subkey">Subkey.</param>
/// <param name="name">Name of value to store data in.</param>
/// <param name="value">Data to store. </param>
internal static void SetRegistryKeyBooleanValue(string subkey, string name, bool value)
{
RegistryKey root = Registry.LocalMachine;
RegistryKey rk = root.CreateSubKey(subkey);
if ( rk != null )
{
rk.SetValue(name, value);
}
}
/// <summary>
/// Return the list of sub keys for the specified registry key.
/// </summary>
/// <param name="subkey">The name of the registry key</param>
/// <returns>The array of subkey names.</returns>
internal static string[] GetRegistrySubKeys(string subkey)
{
string[] ret = new string[0];
RegistryKey root = Registry.LocalMachine;
RegistryKey rk = root.OpenSubKey(subkey);
if (rk != null)
ret = rk.GetSubKeyNames();
return ret;
}
/// <summary>
/// Returns appPoolName of the installed release
/// </summary>
/// <returns></returns>
internal static string GetInstalledReleaseName()
{
return GetRegistryKeyStringValue(ProductKey, "ReleaseName");
}
/// <summary>
/// Returns id of the installed release
/// </summary>
/// <returns></returns>
internal static int GetInstalledReleaseId()
{
return GetRegistryKeyInt32Value(ProductKey, "ReleaseId");
}
internal static int GetSubKeyCount(string subkey)
{
int ret = 0;
RegistryKey root = Registry.LocalMachine;
RegistryKey rk = root.OpenSubKey(subkey);
if (rk != null)
ret = rk.SubKeyCount;
return ret;
}
internal static bool IsAspNet20Registered()
{
object ret = GetRegistryKeyValue("SOFTWARE\\Microsoft\\ASP.NET\\2.0.50727.0", "DllFullPath");
return ( ret != null );
}
public static Version GetIISVersion()
{
int major = GetRegistryKeyInt32Value("SOFTWARE\\Microsoft\\InetStp", "MajorVersion");
int minor = GetRegistryKeyInt32Value("SOFTWARE\\Microsoft\\InetStp", "MinorVersion");
return new Version(major, minor);
}
}
}

View file

@ -0,0 +1,628 @@
// 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.Threading;
using System.Xml;
namespace WebsitePanel.Setup
{
/// <summary>
/// Provides methods for rolling back after an error.
/// </summary>
public sealed class RollBack
{
private static XmlDocument script;
static RollBack()
{
script = new XmlDocument();
XmlElement root = script.CreateElement("currentScenario");
script.AppendChild(root);
}
private static XmlNode RootElement
{
get
{
return script.ChildNodes[0];
}
}
internal static XmlNodeList Actions
{
get
{
return RootElement.ChildNodes;
}
}
internal static void RegisterRegistryAction(string key)
{
XmlElement action = script.CreateElement("registry");
RootElement.AppendChild(action);
action.SetAttribute("key", key);
}
internal static void RegisterDirectoryAction(string path)
{
XmlElement action = script.CreateElement("directory");
RootElement.AppendChild(action);
action.SetAttribute("path", path);
}
internal static void RegisterDirectoryBackupAction(string source, string destination)
{
XmlElement action = script.CreateElement("directoryBackup");
RootElement.AppendChild(action);
action.SetAttribute("source", source);
action.SetAttribute("destination", destination);
}
internal static void RegisterDatabaseAction(string connectionString, string name)
{
XmlElement action = script.CreateElement("database");
RootElement.AppendChild(action);
action.SetAttribute("connectionString", connectionString);
action.SetAttribute("name", name);
}
internal static void RegisterDatabaseBackupAction(string connectionString, string name, string bakFile, string position)
{
XmlElement action = script.CreateElement("databaseBackup");
RootElement.AppendChild(action);
action.SetAttribute("connectionString", connectionString);
action.SetAttribute("name", name);
action.SetAttribute("bakFile", bakFile);
action.SetAttribute("position", position);
}
internal static void RegisterDatabaseUserAction(string connectionString, string username)
{
XmlElement action = script.CreateElement("databaseUser");
RootElement.AppendChild(action);
action.SetAttribute("connectionString", connectionString);
action.SetAttribute("username", username);
}
internal static void RegisterWebSiteAction(string siteId)
{
XmlElement action = script.CreateElement("webSite");
RootElement.AppendChild(action);
action.SetAttribute("siteId", siteId);
}
internal static void RegisterIIS7WebSiteAction(string siteId)
{
XmlElement action = script.CreateElement("IIS7WebSite");
RootElement.AppendChild(action);
action.SetAttribute("siteId", siteId);
}
internal static void RegisterVirtualDirectoryAction(string siteId, string name)
{
XmlElement action = script.CreateElement("virtualDirectory");
RootElement.AppendChild(action);
action.SetAttribute("siteId", siteId);
action.SetAttribute("name", name);
}
internal static void RegisterUserAccountAction(string domain, string userName)
{
XmlElement action = script.CreateElement("userAccount");
RootElement.AppendChild(action);
action.SetAttribute("name", userName);
action.SetAttribute("domain", domain);
}
internal static void RegisterApplicationPool(string name)
{
XmlElement action = script.CreateElement("applicationPool");
RootElement.AppendChild(action);
action.SetAttribute("name", name);
}
internal static void RegisterIIS7ApplicationPool(string name)
{
XmlElement action = script.CreateElement("IIS7ApplicationPool");
RootElement.AppendChild(action);
action.SetAttribute("name", name);
}
internal static void RegisterStopApplicationPool(string name)
{
XmlElement action = script.CreateElement("stopApplicationPool");
RootElement.AppendChild(action);
action.SetAttribute("name", name);
}
internal static void RegisterStopIIS7ApplicationPool(string name)
{
XmlElement action = script.CreateElement("stopIIS7ApplicationPool");
RootElement.AppendChild(action);
action.SetAttribute("name", name);
}
internal static void RegisterConfigAction(string componentId, string name)
{
XmlElement action = script.CreateElement("config");
RootElement.AppendChild(action);
action.SetAttribute("key", componentId);
action.SetAttribute("name", name);
}
internal static void RegisterWindowsService(string path, string name)
{
XmlElement action = script.CreateElement("WindowsService");
RootElement.AppendChild(action);
action.SetAttribute("path", path);
action.SetAttribute("name", name);
}
internal static void ProcessAction(XmlNode action)
{
switch(action.Name)
{
case "registry":
DeleteRegistryKey(XmlUtils.GetXmlAttribute(action, "key"));
break;
case "directory":
DeleteDirectory(XmlUtils.GetXmlAttribute(action, "path"));
break;
case "directoryBackup":
RestoreDirectory(
XmlUtils.GetXmlAttribute(action, "source"),
XmlUtils.GetXmlAttribute(action, "destination"));
break;
case "database":
DeleteDatabase(
XmlUtils.GetXmlAttribute(action, "connectionString"),
XmlUtils.GetXmlAttribute(action, "name"));
break;
case "databaseBackup":
RestoreDatabase(
XmlUtils.GetXmlAttribute(action, "connectionString"),
XmlUtils.GetXmlAttribute(action, "name"),
XmlUtils.GetXmlAttribute(action, "bakFile"),
XmlUtils.GetXmlAttribute(action, "position"));
break;
case "databaseUser":
DeleteDatabaseUser(
XmlUtils.GetXmlAttribute(action, "connectionString"),
XmlUtils.GetXmlAttribute(action, "username"));
break;
case "webSite":
DeleteWebSite(
XmlUtils.GetXmlAttribute(action, "siteId"));
break;
case "IIS7WebSite":
DeleteIIS7WebSite(
XmlUtils.GetXmlAttribute(action, "siteId"));
break;
case "virtualDirectory":
DeleteVirtualDirectory(
XmlUtils.GetXmlAttribute(action, "siteId"),
XmlUtils.GetXmlAttribute(action, "name"));
break;
case "userAccount":
DeleteUserAccount(
XmlUtils.GetXmlAttribute(action, "domain"),
XmlUtils.GetXmlAttribute(action, "name"));
break;
case "applicationPool":
DeleteApplicationPool(
XmlUtils.GetXmlAttribute(action, "name"));
break;
case "IIS7ApplicationPool":
DeleteIIS7ApplicationPool(
XmlUtils.GetXmlAttribute(action, "name"));
break;
case "config":
DeleteComponentSettings(
XmlUtils.GetXmlAttribute(action, "key"),
XmlUtils.GetXmlAttribute(action, "name"));
break;
case "stopApplicationPool":
StartApplicationPool(
XmlUtils.GetXmlAttribute(action, "name"));
break;
case "stopIIS7ApplicationPool":
StartIIS7ApplicationPool(
XmlUtils.GetXmlAttribute(action, "name"));
break;
case "WindowsService":
UnregisterWindowsService(
XmlUtils.GetXmlAttribute(action, "path"),
XmlUtils.GetXmlAttribute(action, "name"));
break;
}
}
private static void DeleteComponentSettings(string id, string name)
{
try
{
Log.WriteStart("Deleting component settings");
Log.WriteInfo(string.Format("Deleting \"{0}\" settings", name));
XmlNode node = AppConfig.GetComponentConfig(id);
if (node != null)
{
XmlUtils.RemoveXmlNode(node);
AppConfig.SaveConfiguration();
}
Log.WriteEnd("Deleted component settings");
}
catch (Exception ex)
{
if (Utils.IsThreadAbortException(ex))
return;
Log.WriteError("Component settings delete error", ex);
throw;
}
}
private static void DeleteRegistryKey(string subkey)
{
try
{
Log.WriteStart("Deleting registry key");
Log.WriteInfo(string.Format("Deleting registry key \"{0}\"", subkey));
RegistryUtils.DeleteRegistryKey(subkey);
Log.WriteEnd("Deleted registry key");
}
catch(Exception ex)
{
if (Utils.IsThreadAbortException(ex))
return;
Log.WriteError("Registry key delete error", ex);
throw;
}
}
private static void DeleteDirectory(string path)
{
try
{
Log.WriteStart("Deleting directory");
Log.WriteInfo(string.Format("Deleting directory \"{0}\"", path));
if(FileUtils.DirectoryExists(path))
{
FileUtils.DeleteDirectory(path);
Log.WriteEnd("Deleted directory");
}
}
catch(Exception ex)
{
if (Utils.IsThreadAbortException(ex))
return;
Log.WriteError("Directory delete error", ex);
throw;
}
}
private static void RestoreDirectory(string targetDir, string zipFile)
{
try
{
Log.WriteStart("Restoring directory");
Log.WriteInfo(string.Format("Restoring directory \"{0}\"", targetDir));
FileUtils.UnzipFile(targetDir, zipFile);
Log.WriteStart("Restored directory");
}
catch (Exception ex)
{
if (Utils.IsThreadAbortException(ex))
return;
Log.WriteError("Directory restore error", ex);
throw;
}
}
private static void DeleteDatabase(string connectionString, string name)
{
try
{
Log.WriteStart("Deleting database");
Log.WriteInfo(string.Format("Deleting database \"{0}\"", name));
if ( SqlUtils.DatabaseExists(connectionString, name) )
{
SqlUtils.DeleteDatabase(connectionString, name);
Log.WriteEnd("Deleted database");
}
}
catch(Exception ex)
{
if (Utils.IsThreadAbortException(ex))
return;
Log.WriteError("Database delete error", ex);
throw;
}
}
private static void RestoreDatabase(string connectionString, string name, string bakFile, string position)
{
try
{
Log.WriteStart("Restoring database");
Log.WriteInfo(string.Format("Restoring database \"{0}\"", name));
if (SqlUtils.DatabaseExists(connectionString, name))
{
SqlUtils.RestoreDatabase(connectionString, name, bakFile, position);
Log.WriteEnd("Restored database");
}
}
catch (Exception ex)
{
if (Utils.IsThreadAbortException(ex))
return;
Log.WriteError("Database restore error", ex);
throw;
}
}
private static void DeleteDatabaseUser(string connectionString, string username)
{
try
{
Log.WriteStart("Deleting database user");
Log.WriteInfo(string.Format("Deleting database user \"{0}\"", username));
if (SqlUtils.UserExists(connectionString, username))
{
SqlUtils.DeleteUser(connectionString, username);
Log.WriteEnd("Deleted database user");
}
}
catch (Exception ex)
{
if (Utils.IsThreadAbortException(ex))
return;
Log.WriteError("Database user delete error", ex);
throw;
}
}
private static void DeleteWebSite(string siteId)
{
try
{
Log.WriteStart("Deleting web site");
Log.WriteInfo(string.Format("Deleting web site \"{0}\"", siteId));
if ( WebUtils.SiteIdExists(siteId) )
{
WebUtils.DeleteSite(siteId);
Log.WriteEnd("Deleted web site");
}
}
catch(Exception ex)
{
if (Utils.IsThreadAbortException(ex))
return;
Log.WriteError("Web site delete error", ex);
throw;
}
}
private static void DeleteIIS7WebSite(string siteId)
{
try
{
Log.WriteStart("Deleting web site");
Log.WriteInfo(string.Format("Deleting web site \"{0}\"", siteId));
if (WebUtils.IIS7SiteExists(siteId))
{
WebUtils.DeleteIIS7Site(siteId);
Log.WriteEnd("Deleted web site");
}
}
catch (Exception ex)
{
if (Utils.IsThreadAbortException(ex))
return;
Log.WriteError("Web site delete error", ex);
throw;
}
}
private static 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");
}
}
catch(Exception ex)
{
if (Utils.IsThreadAbortException(ex))
return;
Log.WriteError("Virtual directory delete error", ex);
throw;
}
}
private static void DeleteUserAccount(string domain, string user)
{
try
{
Log.WriteStart("Deleting user account");
Log.WriteInfo(string.Format("Deleting user account \"{0}\"", user));
if ( SecurityUtils.UserExists(domain, user) )
{
SecurityUtils.DeleteUser(domain, user);
Log.WriteEnd("Deleted user account");
}
}
catch(Exception ex)
{
if (Utils.IsThreadAbortException(ex))
return;
Log.WriteError("User account delete error", ex);
throw;
}
}
private static void DeleteApplicationPool(string name)
{
try
{
Log.WriteStart("Deleting application pool");
Log.WriteInfo(string.Format("Deleting application pool \"{0}\"", 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");
}
}
}
catch(Exception ex)
{
if (Utils.IsThreadAbortException(ex))
return;
Log.WriteError("Application pool delete error", ex);
throw;
}
}
private static void DeleteIIS7ApplicationPool(string name)
{
try
{
Log.WriteStart("Deleting application pool");
Log.WriteInfo(string.Format("Deleting application pool \"{0}\"", 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");
}
}
}
catch (Exception ex)
{
if (Utils.IsThreadAbortException(ex))
return;
Log.WriteError("Application pool delete error", ex);
throw;
}
}
private static void StartApplicationPool(string name)
{
try
{
Log.WriteStart("Starting IIS application pool");
Log.WriteInfo(string.Format("Starting \"{0}\"", name));
WebUtils.StartApplicationPool(name);
Log.WriteEnd("Started application pool");
}
catch (Exception ex)
{
if (Utils.IsThreadAbortException(ex))
return;
Log.WriteError("Application pool start error", ex);
throw;
}
}
private static void StartIIS7ApplicationPool(string name)
{
try
{
Log.WriteStart("Starting IIS application pool");
Log.WriteInfo(string.Format("Starting \"{0}\"", name));
WebUtils.StartIIS7ApplicationPool(name);
Log.WriteEnd("Started application pool");
}
catch (Exception ex)
{
if (Utils.IsThreadAbortException(ex))
return;
Log.WriteError("Application pool start error", ex);
throw;
}
}
private static void UnregisterWindowsService(string path, string serviceName)
{
try
{
Log.WriteStart(string.Format("Unregistering \"{0}\" Windows service", serviceName));
try
{
Utils.StopService(serviceName);
}
catch (Exception ex)
{
if (!Utils.IsThreadAbortException(ex))
Log.WriteError("Windows service stop error", ex);
}
Utils.RunProcess(path, "/u");
Log.WriteEnd("Unregistered Windows service");
}
catch (Exception ex)
{
if (Utils.IsThreadAbortException(ex))
return;
Log.WriteError("Windows service error", ex);
throw;
}
}
}
}

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.Windows.Forms;
using System.Xml;
namespace WebsitePanel.Setup
{
/// <summary>
/// Shows rollback process.
/// </summary>
public sealed class RollBackProcess
{
private ProgressBar progressBar;
/// <summary>
/// Initializes a new instance of the class.
/// </summary>
/// <param name="bar">Progress bar.</param>
public RollBackProcess(ProgressBar bar)
{
this.progressBar = bar;
}
/// <summary>
/// Runs rollback process.
/// </summary>
internal void Run()
{
progressBar.Minimum = 0;
progressBar.Maximum = 100;
progressBar.Value = 0;
int actions = RollBack.Actions.Count;
for ( int i=0; i<actions; i++ )
{
//reverse order
XmlNode action = RollBack.Actions[actions-i-1];
try
{
RollBack.ProcessAction(action);
}
catch
{}
progressBar.Value = Convert.ToInt32(i*100/actions);
}
}
}
}

View file

@ -0,0 +1,198 @@
// 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;
namespace WebsitePanel.Setup
{
#region Security enums
public enum ControlFlags
{
SE_OWNER_DEFAULTED = 0x1,
SE_GROUP_DEFAULTED = 0x2,
SE_DACL_PRESENT = 0x4,
SE_DACL_DEFAULTED = 0x8,
SE_SACL_PRESENT = 0x10,
SE_SACL_DEFAULTED = 0x20,
SE_DACL_AUTO_INHERIT_REQ = 0x100,
SE_SACL_AUTO_INHERIT_REQ = 0x200,
SE_DACL_AUTO_INHERITED = 0x400,
SE_SACL_AUTO_INHERITED = 0x800,
SE_DACL_PROTECTED = 0x1000,
SE_SACL_PROTECTED = 0x2000,
SE_SELF_RELATIVE = 0x8000
}
[Flags]
public enum SystemAccessMask : uint
{
// Grants the right to read data from the file. For a directory, this value grants
// the right to list the contents of the directory.
FILE_LIST_DIRECTORY = 0x1,
// Grants the right to write data to the file. For a directory, this value grants
// the right to create a file in the directory.
FILE_ADD_FILE = 0x2,
// Grants the right to append data to the file. For a directory, this value grants
// the right to create a subdirectory.
FILE_ADD_SUBDIRECTORY = 0x4,
// Grants the right to read extended attributes.
FILE_READ_EA = 0x8,
// Grants the right to write extended attributes.
FILE_WRITE_EA = 0x10,
// Grants the right to execute a file. For a directory, the directory can be traversed.
FILE_TRAVERSE = 0x20,
// Grants the right to delete a directory and all the files it contains (its children),
// even if the files are read-only.
FILE_DELETE_CHILD = 0x40,
// Grants the right to read file attributes.
FILE_READ_ATTRIBUTES = 0x80,
// Grants the right to change file attributes.
FILE_WRITE_ATTRIBUTES = 0x100,
// Grants delete access.
DELETE = 0x10000,
// Grants read access to the security descriptor and owner.
READ_CONTROL = 0x20000,
// Grants write access to the discretionary ACL.
WRITE_DAC = 0x40000,
// Assigns the write owner.
WRITE_OWNER = 0x80000,
// Synchronizes access and allows a process to wait for an object to enter the signaled state.
SYNCHRONIZE = 0x100000
}
[Flags]
public enum AceFlags : uint
{
// Non-container child objects inherit the ACE as an effective ACE. For child objects that are containers,
// the ACE is inherited as an inherit-only ACE unless the NO_PROPAGATE_INHERIT_ACE bit flag is also set.
OBJECT_INHERIT_ACE = 0x1,
// Child objects that are containers, such as directories, inherit the ACE as an effective ACE. The inherited
// ACE is inheritable unless the NO_PROPAGATE_INHERIT_ACE bit flag is also set.
CONTAINER_INHERIT_ACE = 0x2,
// If the ACE is inherited by a child object, the system clears the OBJECT_INHERIT_ACE and CONTAINER_INHERIT_ACE
// flags in the inherited ACE. This prevents the ACE from being inherited by subsequent generations of objects.
NO_PROPAGATE_INHERIT_ACE = 0x4,
// Indicates an inherit-only ACE which does not control access to the object to which it is attached. If this
// flag is not set, the ACE is an effective ACE which controls access to the object to which it is attached.
// Both effective and inherit-only ACEs can be inherited depending on the state of the other inheritance flags.
INHERIT_ONLY_ACE = 0x8,
// The system sets this bit when it propagates an inherited ACE to a child object.
INHERITED_ACE = 0x10,
// Used with system-audit ACEs in a SACL to generate audit messages for successful access attempts.
SUCCESSFUL_ACCESS_ACE_FLAG = 0x40,
// Used with system-audit ACEs in a SACL to generate audit messages for failed access attempts.
FAILED_ACCESS_ACE_FLAG = 0x80
}
/// <summary>
/// Change options
/// </summary>
public enum ChangeOption
{
/// <summary>Change the owner of the logical file.</summary>
CHANGE_OWNER_SECURITY_INFORMATION = 1,
/// <summary>Change the group of the logical file.</summary>
CHANGE_GROUP_SECURITY_INFORMATION = 2,
/// <summary>Change the ACL of the logical file.</summary>
CHANGE_DACL_SECURITY_INFORMATION = 4,
/// <summary>Change the system ACL of the logical file.</summary>
CHANGE_SACL_SECURITY_INFORMATION = 8
}
/// <summary>
/// Ace types
/// </summary>
public enum AceType
{
/// <summary>Allowed</summary>
Allowed = 0,
/// <summary>Denied</summary>
Denied = 1,
/// <summary>Audit</summary>
Audit = 2
}
/// <summary>
/// NTFS permissions
/// </summary>
[Flags]
[Serializable]
public enum NtfsPermission : int
{
/// <summary>FullControl</summary>
FullControl = 0x1,// = 0x1F01FF,
/// <summary>Modify</summary>
Modify = 0x2,// = 0x1301BF,
/// <summary>Execute</summary>
Execute = 0x4,// = 0x1200A9,
/// <summary>ListFolderContents</summary>
ListFolderContents = 0x8,// = 0x1200A9,
/// <summary>Read</summary>
Read = 0x10,// = 0x120089,
/// <summary>Write</summary>
Write = 0x20// = 0x100116
}
/// <summary>
/// Well-known SIDs
/// </summary>
public class SystemSID
{
/// <summary>"Administrators" SID</summary>
public const string ADMINISTRATORS = "S-1-5-32-544";
/// <summary>"Local System (SYSTEM)" SID</summary>
public const string SYSTEM = "S-1-5-18";
/// <summary>"NETWORK SERVICE" SID</summary>
public const string NETWORK_SERVICE = "S-1-5-20";
}
#endregion
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,70 @@
// 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.
namespace WebsitePanel.Setup.Common
{
/// <summary>
/// Server item.
/// </summary>
public sealed class ServerItem
{
private string name;
private string server;
/// <summary>
/// Initializes a new instance of the SystemUserItem class.
/// </summary>
public ServerItem()
{
}
public ServerItem(string server, string name)
{
this.Name = name;
this.Server = server;
}
/// <summary>
/// Name
/// </summary>
public string Name
{
get { return name; }
set { name = value; }
}
/// <summary>
/// Server
/// </summary>
public string Server
{
get { return server; }
set { server = value; }
}
}
}

View file

@ -0,0 +1,49 @@
// 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.Text;
namespace WebsitePanel.Setup
{
/// <summary>
/// Install currentScenario
/// </summary>
public enum SetupActions
{
/// <summary>Install</summary>
Install,
/// <summary>Uninstall</summary>
Uninstall,
/// <summary>Upgrade</summary>
Update,
/// <summary>Setup</summary>
Setup
};
}

View file

@ -0,0 +1,340 @@
// 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.Xml;
using System.Collections.Generic;
using System.Text;
using WebsitePanel.Setup.Common;
namespace WebsitePanel.Setup
{
/// <summary>
/// Variables container.
/// </summary>
public sealed class SetupVariables
{
//
public static readonly SetupVariables Empty = new SetupVariables();
public bool EnableScpaMode { get; set; }
public string PeerAdminPassword { get; set; }
public string DatabaseUserPassword { get; set; }
public bool NewDatabaseUser { get; set; }
/// <summary>
/// Installation folder
/// </summary>
public string InstallationFolder { get; set; }
public string InstallFolder
{
get { return InstallationFolder; }
set { InstallationFolder = value; }
}
/// <summary>
/// Component id
/// </summary>
public string ComponentId { get; set; }
public string ComponentDescription { get; set; }
/// <summary>
/// Component code
/// </summary>
public string ComponentCode { get; set; }
/// <summary>
/// Component name
/// </summary>
public string ComponentName { get; set; }
/// <summary>
/// Component name
/// </summary>
public string ApplicationName { get; set; }
public string ComponentFullName
{
get { return ApplicationName + " " + ComponentName; }
}
public string Instance { get; set; }
/// <summary>
/// Install currentScenario
/// </summary>
public SetupActions SetupAction { get; set; }
/// <summary>
/// Product key
/// </summary>
public string ProductKey { get; set; }
/// <summary>
/// Release Id
/// </summary>
public int ReleaseId { get; set; }
// Workaround
public string Release
{
get { return Version; }
set { Version = value; }
}
/// <summary>
/// Release name
/// </summary>
public string Version { get; set; }
/// <summary>
/// Connection string
/// </summary>
public string ConnectionString { get; set; }
/// <summary>
/// Database
/// </summary>
public string Database { get; set; }
/// <summary>
/// DatabaseServer
/// </summary>
public string DatabaseServer { get; set; }
/// <summary>
/// Database install connection string
/// </summary>
public string DbInstallConnectionString { get; set; }
public string InstallConnectionString
{
get { return DbInstallConnectionString; }
set { DbInstallConnectionString = value; }
}
/// <summary>
/// Create database
/// </summary>
public bool CreateDatabase { get; set; }
public bool NewVirtualDirectory { get; set; }
public bool NewWebApplicationPool { get; set; }
public string WebApplicationPoolName { get; set; }
public string ApplicationPool
{
get { return WebApplicationPoolName; }
set { WebApplicationPoolName = value; }
}
/// <summary>
/// Virtual directory
/// </summary>
public string VirtualDirectory { get; set; }
public bool NewWebSite { get; set; }
/// <summary>
/// Website Id
/// </summary>
public string WebSiteId { get; set; }
/// <summary>
/// Website IP
/// </summary>
public string WebSiteIP { get; set; }
/// <summary>
/// Website port
/// </summary>
public string WebSitePort { get; set; }
/// <summary>
/// Website domain
/// </summary>
public string WebSiteDomain { get; set; }
/// <summary>
/// User account
/// </summary>
public string UserAccount { get; set; }
/// <summary>
/// User password
/// </summary>
public string UserPassword { get; set; }
/// <summary>
/// User Membership
/// </summary>
public string[] UserMembership
{
get
{
if (ComponentCode.Equals(Global.Server.ComponentCode, StringComparison.OrdinalIgnoreCase))
{
return Global.Server.ServiceUserMembership;
}
else if(ComponentCode.Equals(Global.EntServer.ComponentCode, StringComparison.OrdinalIgnoreCase))
{
return Global.EntServer.ServiceUserMembership;
}
else if (ComponentCode.Equals(Global.WebPortal.ComponentCode, StringComparison.OrdinalIgnoreCase))
{
return Global.WebPortal.ServiceUserMembership;
}
else
{
return new string[] {};
}
}
}
/// <summary>
/// Welcome screen has been skipped
/// </summary>
public bool WelcomeScreenSkipped { get; set; }
public string InstallerFolder { get; set; }
public string Installer { get; set; }
public string InstallerType { get; set; }
public string InstallerPath { get; set; }
public XmlNode ComponentConfig { get; set; }
public string ServerPassword { get; set; }
public string CryptoKey { get; set; }
public bool UpdateWebSite { get; set; }
public bool UpdateServerPassword { get; set; }
public bool UpdateServerAdminPassword { get; set; }
public string ServerAdminPassword { get; set; }
public string BaseDirectory { get; set; }
public string UpdateVersion { get; set; }
public string EnterpriseServerURL { get; set; }
public string UserDomain { get; set; }
public string Domain
{
get { return UserDomain; }
set { UserDomain = value; }
}
public bool NewUserAccount { get; set; }
public bool NewApplicationPool { get; set; }
public ServerItem[] SQLServers { get; set; }
public string Product { get; set; }
public Version IISVersion { get; set; }
public string ServiceIP { get; set; }
public string ServicePort { get; set; }
public string ServiceName { get; set; }
public string ConfigurationFile { get; set; }
public string ServiceFile { get; set; }
public string LicenseKey { get; set; }
public string SetupXml { get; set; }
public string RemoteServerUrl
{
get
{
string address = "http://";
string server = String.Empty;
string ipPort = String.Empty;
//server
if (String.IsNullOrEmpty(WebSiteDomain) == false
&& WebSiteDomain.Trim().Length > 0)
{
//domain
server = WebSiteDomain.Trim();
}
else
{
//ip
if (String.IsNullOrEmpty(WebSiteIP) == false
&& WebSiteIP.Trim().Length > 0)
{
server = WebSiteIP.Trim();
}
}
//port
if (server.Length > 0 &&
WebSiteIP.Trim().Length > 0 &&
WebSitePort.Trim() != "80")
{
ipPort = ":" + WebSitePort.Trim();
}
//address string
address += server + ipPort;
//
return address;
}
}
public string RemoteServerPassword { get; set; }
public string ServerComponentId { get; set; }
public string PortalComponentId { get; set; }
public string EnterpriseServerComponentId { get; set; }
public SetupVariables Clone()
{
return (SetupVariables)this.MemberwiseClone();
}
}
}

View file

@ -0,0 +1,184 @@
// 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.Data.SqlClient;
using System.IO;
using System.Text;
using System.Windows.Forms;
using WebsitePanel.Setup.Actions;
namespace WebsitePanel.Setup
{
/// <summary>
/// Shows sql script process.
/// </summary>
public sealed class SqlProcess
{
private string scriptFile;
private string connectionString;
private string database;
public event EventHandler<ActionProgressEventArgs<int>> ProgressChange;
/// <summary>
/// Initializes a new instance of the class.
/// </summary>
/// <param name="file">Sql script file</param>
/// <param name="connection">Sql connection string</param>
/// <param name="db">Sql server database name</param>
public SqlProcess(string file, string connection, string db)
{
this.scriptFile = file;
this.connectionString = connection;
this.database = db;
}
private void OnProgressChange(int percentage)
{
if (ProgressChange == null)
return;
//
ProgressChange(this, new ActionProgressEventArgs<int>
{
EventData = percentage
});
}
/// <summary>
/// Executes sql script file.
/// </summary>
internal void Run()
{
int commandCount = 0;
int i = 0;
string sql = string.Empty;
try
{
using (StreamReader sr = new StreamReader(scriptFile))
{
while( null != (sql = ReadNextStatementFromStream(sr)))
{
commandCount++;
}
}
}
catch(Exception ex)
{
throw new Exception("Can't read SQL script " + scriptFile, ex);
}
Log.WriteInfo(string.Format("Executing {0} database commands", commandCount));
//
OnProgressChange(0);
//
SqlConnection connection = new SqlConnection(connectionString);
try
{
// iterate through "GO" delimited command text
using (StreamReader reader = new StreamReader(scriptFile))
{
SqlCommand command = new SqlCommand();
connection.Open();
command.Connection = connection;
command.CommandType = System.Data.CommandType.Text;
command.CommandTimeout = 600;
while (null != (sql = ReadNextStatementFromStream(reader)))
{
sql = ProcessInstallVariables(sql);
command.CommandText = sql;
try
{
command.ExecuteNonQuery();
}
catch (Exception ex)
{
throw new Exception("Error executing SQL command: " + sql, ex);
}
i++;
if (commandCount != 0)
{
OnProgressChange(Convert.ToInt32(i * 100 / commandCount));
}
}
}
}
catch (Exception ex)
{
throw new Exception("Can't run SQL script " + scriptFile, ex);
}
finally
{
connection.Close();
}
}
private string ReadNextStatementFromStream(StreamReader reader)
{
StringBuilder sb = new StringBuilder();
string lineOfText;
while(true)
{
lineOfText = reader.ReadLine();
if( lineOfText == null )
{
if( sb.Length > 0 )
{
return sb.ToString();
}
else
{
return null;
}
}
if(lineOfText.TrimEnd().ToUpper() == "GO")
{
break;
}
sb.Append(lineOfText + Environment.NewLine);
}
return sb.ToString();
}
private string ProcessInstallVariables(string input)
{
//replace install variables
string output = input;
output = output.Replace("${install.database}", database);
return output;
}
}
}

View file

@ -0,0 +1,39 @@
// 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.
namespace WebsitePanel.Setup
{
public sealed class SqlServerItem
{
public string Server { get; set; }
public bool WindowsAuthentication { get; set; }
public string User { get; set; }
public string Password { get; set; }
public string Database { get; set; }
}
}

View file

@ -0,0 +1,615 @@
// 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.Text.RegularExpressions;
using System.Data;
using System.Data.SqlClient;
namespace WebsitePanel.Setup
{
/// <summary>
/// Sql utils class.
/// </summary>
public sealed class SqlUtils
{
/// <summary>
/// Initializes a new instance of the class.
/// </summary>
private SqlUtils()
{
}
public static string BuildDbServerMasterConnectionString(string dbServer, string dbLogin, string dbPassw)
{
return BuildDbServerConnectionString(dbServer, "master", dbLogin, dbPassw);
}
public static string BuildDbServerConnectionString(string dbServer, string dbName, string dbLogin, string dbPassw)
{
if (String.IsNullOrEmpty(dbLogin) && String.IsNullOrEmpty(dbPassw))
{
return String.Format("Server={0};Database={1};Integrated Security=SSPI;", dbServer, dbName);
}
else
{
return String.Format("Server={0};Database={1};User id={2};Password={3};", dbServer, dbName, dbLogin, dbPassw);
}
}
/// <summary>
/// Check sql connection.
/// </summary>
/// <param name="connectionString">Connection string.</param>
/// <returns>True if connecion is valid, otherwise false.</returns>
internal static bool CheckSqlConnection(string connectionString)
{
SqlConnection conn = new SqlConnection(connectionString);
try
{
conn.Open();
}
catch
{
return false;
}
conn.Close();
return true;
}
/// <summary>
/// Gets the version of SQL Server instance.
/// </summary>
/// <param name="connectionString">Connection string.</param>
/// <returns>True if connecion is valid, otherwise false.</returns>
internal static string GetSqlServerVersion(string connectionString)
{
SqlConnection conn = new SqlConnection(connectionString);
try
{
SqlCommand cmd = new SqlCommand("SELECT SERVERPROPERTY('productversion')", conn);
conn.Open();
SqlDataReader reader = cmd.ExecuteReader(CommandBehavior.CloseConnection);
string version = "unknown";
if (reader.HasRows)
{
reader.Read();
version = reader[0].ToString();
reader.Close();
}
return version;
}
finally
{
if (conn != null && conn.State == ConnectionState.Open)
conn.Close();
}
}
/// <summary>
/// Gets the security mode of SQL Server.
/// </summary>
/// <param name="connectionString">Connection string.</param>
/// <returns>1 - Windows Authentication mode, 0 - Mixed mode.</returns>
internal static int GetSqlServerSecurityMode(string connectionString)
{
SqlConnection conn = new SqlConnection(connectionString);
int mode = 0;
try
{
SqlCommand cmd = new SqlCommand("SELECT SERVERPROPERTY('IsIntegratedSecurityOnly')", conn);
conn.Open();
SqlDataReader reader = cmd.ExecuteReader(CommandBehavior.CloseConnection);
if (reader.HasRows)
{
reader.Read();
mode = Convert.ToInt32(reader[0]);
reader.Close();
}
}
catch
{
}
finally
{
if (conn != null && conn.State == ConnectionState.Open)
conn.Close();
}
return mode;
}
/// <summary>
/// Get databases.
/// </summary>
/// <param name="connectionString">Connection string.</param>
/// <returns>Databases.</returns>
internal static string[] GetDatabases(string connectionString)
{
DataSet ds = ExecuteQuery(connectionString, "SELECT Name FROM master..sysdatabases ORDER BY Name");
string[] ret = new string[ds.Tables[0].Rows.Count];
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
ret[i] = (string)ds.Tables[0].Rows[i]["Name"];
}
return ret;
}
internal static int ExecuteStoredProcedure(string connectionString, string name, params SqlParameter[] commandParameters)
{
using (SqlConnection connection = new SqlConnection(connectionString))
{
connection.Open();
SqlCommand cmd = new SqlCommand();
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = name;
cmd.Connection = connection;
cmd.CommandTimeout = 300;
//attach parameters
if (commandParameters != null)
{
foreach (SqlParameter p in commandParameters)
{
if (p != null)
{
// Check for derived output value with no value assigned
if ((p.Direction == ParameterDirection.InputOutput ||
p.Direction == ParameterDirection.Input) &&
(p.Value == null))
{
p.Value = DBNull.Value;
}
cmd.Parameters.Add(p);
}
}
}
int ret = cmd.ExecuteNonQuery();
cmd.Parameters.Clear();
connection.Close();
return ret;
}
}
private static int ExecuteNonQuery(string connectionString, string commandText)
{
SqlConnection conn = null;
try
{
conn = new SqlConnection(connectionString);
SqlCommand cmd = new SqlCommand(commandText, conn);
cmd.CommandTimeout = 300;
conn.Open();
int ret = cmd.ExecuteNonQuery();
return ret;
}
finally
{
// close connection if required
if (conn != null && conn.State == ConnectionState.Open)
conn.Close();
}
}
internal static DataSet ExecuteQuery(string connectionString, string commandText)
{
SqlConnection conn = null;
try
{
conn = new SqlConnection(connectionString);
SqlDataAdapter adapter = new SqlDataAdapter(commandText, conn);
DataSet ds = new DataSet();
adapter.Fill(ds);
return ds;
}
finally
{
// close connection if required
if (conn != null && conn.State == ConnectionState.Open)
conn.Close();
}
}
/// <summary>
/// Checks if the database exists.
/// </summary>
/// <param name="databaseName">Database name.</param>
/// <param name="connectionString">Connection string.</param>
/// <returns>Returns True if the database exists.</returns>
internal static bool DatabaseExists(string connectionString, string databaseName)
{
return (ExecuteQuery(connectionString,
String.Format("select name from master..sysdatabases where name = '{0}'", databaseName)).Tables[0].Rows.Count > 0);
}
/// <summary>
/// Creates database.
/// </summary>
/// <param name="connectionString">Connection string.</param>
/// <param name="databaseName">Database name.</param>
internal static void CreateDatabase(string connectionString, string databaseName)
{
// create database in the default location
string commandText = string.Format("CREATE DATABASE [{0}] COLLATE Latin1_General_CI_AS;", databaseName);
// create database
ExecuteNonQuery(connectionString, commandText);
// grant users access
//UpdateDatabaseUsers(database.Name, database.Users);
}
/// <summary>
/// Creates database user.
/// </summary>
/// <param name="connectionString">Connection string.</param>
/// <param name="userName">User name</param>
/// <param name="password">Password.</param>
/// <param name="database">Default database.</param>
internal static bool CreateUser(string connectionString, string userName, string password, string database)
{
bool userCreated = false;
if (!UserExists(connectionString, userName))
{
ExecuteNonQuery(connectionString,
String.Format("CREATE LOGIN {0} WITH PASSWORD='{1}', DEFAULT_DATABASE={2}, CHECK_EXPIRATION=OFF, CHECK_POLICY=OFF",
userName, password, database));
userCreated = true;
}
AddUserToDatabase(connectionString, database, userName);
return userCreated;
}
private static void AddUserToDatabase(string connectionString, string databaseName, string user)
{
if (user == "sa")
return;
// grant database access
try
{
ExecuteNonQuery(connectionString,
string.Format("USE {0};EXEC sp_grantdbaccess '{1}';", databaseName, user));
}
catch (SqlException ex)
{
if (ex.Number == 15023)
{
// the user already exists in the database
// so, try to auto fix his login in the database
ExecuteNonQuery(connectionString,
string.Format("USE {0};EXEC sp_change_users_login 'Auto_Fix', '{1}';", databaseName, user));
}
else
{
throw new Exception("Can't add user to database", ex);
}
}
// add database owner
ExecuteNonQuery(connectionString,
string.Format("USE {0};EXEC sp_addrolemember 'db_owner', '{1}';", databaseName, user));
}
/// <summary>
/// Checks whether specified user exists.
/// </summary>
/// <param name="connectionString">Connection string</param>
/// <param name="username">User name.</param>
/// <returns>True if specified user exists, otherwise false.</returns>
internal static bool UserExists(string connectionString, string username)
{
return (ExecuteQuery(connectionString,
string.Format("select name from master..syslogins where name = '{0}'", username)).Tables[0].Rows.Count > 0);
}
/// <summary>
/// Checks whether specified login exists.
/// </summary>
/// <param name="connectionString">Connection string</param>
/// <param name="loginName">Login name.</param>
/// <returns>True if specified login exists, otherwise false.</returns>
internal static bool LoginExists(string connectionString, string loginName)
{
return (ExecuteQuery(connectionString,
string.Format("SELECT * FROM sys.server_principals WHERE name = N'{0}'", loginName)).Tables[0].Rows.Count > 0);
}
/// <summary>
/// Deletes login
/// </summary>
/// <param name="connectionString">Connection string</param>
/// <param name="loginName">Login name</param>
internal static void DeleteLogin(string connectionString, string loginName)
{
// drop login
if (LoginExists(connectionString, loginName))
ExecuteNonQuery(connectionString, String.Format("DROP LOGIN [{0}]", loginName));
}
/// <summary>
/// Deletes database user
/// </summary>
/// <param name="connectionString">Connection string</param>
/// <param name="username">Username</param>
internal static void DeleteUser(string connectionString, string username)
{
// remove user from databases
string[] userDatabases = GetUserDatabases(connectionString, username);
foreach (string database in userDatabases)
RemoveUserFromDatabase(connectionString, database, username);
// close all user connection
CloseUserConnections(connectionString, username);
// drop login
ExecuteNonQuery(connectionString, String.Format("EXEC sp_droplogin '{0}'", username));
}
/// <summary>
/// Deletes database
/// </summary>
/// <param name="connectionString">Connection string</param>
/// <param name="databaseName">Database name</param>
internal static void DeleteDatabase(string connectionString, string databaseName)
{
// remove all users from database
string[] users = GetDatabaseUsers(connectionString, databaseName);
foreach (string user in users)
{
RemoveUserFromDatabase(connectionString, databaseName, user);
}
// close all connection
CloseDatabaseConnections(connectionString, databaseName);
// drop database
ExecuteNonQuery(connectionString,
String.Format("DROP DATABASE {0}", databaseName));
}
private static string[] GetDatabaseUsers(string connectionString, string databaseName)
{
string cmdText = String.Format(@"
select su.name FROM {0}..sysusers as su
inner JOIN master..syslogins as sl on su.sid = sl.sid
where su.hasdbaccess = 1 AND su.islogin = 1 AND su.issqluser = 1 AND su.name <> 'dbo'",
databaseName);
DataView dvUsers = ExecuteQuery(connectionString, cmdText).Tables[0].DefaultView;
string[] users = new string[dvUsers.Count];
for (int i = 0; i < dvUsers.Count; i++)
{
users[i] = (string)dvUsers[i]["Name"];
}
return users;
}
private static string[] GetUserDatabaseObjects(string connectionString, string databaseName, string user)
{
DataView dvObjects = ExecuteQuery(connectionString,
String.Format("select so.name from {0}..sysobjects as so" +
" inner join {1}..sysusers as su on so.uid = su.uid" +
" where su.name = '{2}'", databaseName, databaseName, user)).Tables[0].DefaultView;
string[] objects = new string[dvObjects.Count];
for (int i = 0; i < dvObjects.Count; i++)
{
objects[i] = (string)dvObjects[i]["Name"];
}
return objects;
}
private static string[] GetUserDatabases(string connectionString, string username)
{
string cmdText = String.Format(@"
DECLARE @Username varchar(100)
SET @Username = '{0}'
CREATE TABLE #UserDatabases
(
Name nvarchar(100) collate database_default
)
DECLARE @DbName nvarchar(100)
DECLARE DatabasesCursor CURSOR FOR
SELECT name FROM master..sysdatabases
WHERE (status & 256) = 0 AND (status & 512) = 0
OPEN DatabasesCursor
WHILE (10 = 10)
BEGIN --LOOP 10: thru Databases
FETCH NEXT FROM DatabasesCursor
INTO @DbName
--print @DbName
IF (@@fetch_status <> 0)
BEGIN
DEALLOCATE DatabasesCursor
BREAK
END
DECLARE @sql nvarchar(1000)
SET @sql = 'if exists (select ''' + @DbName + ''' from [' + @DbName + ']..sysusers where name = ''' + @Username + ''') insert into #UserDatabases (Name) values (''' + @DbName + ''')'
EXECUTE(@sql)
END
SELECT Name FROM #UserDatabases
DROP TABLE #UserDatabases
", username);
DataView dvDatabases = ExecuteQuery(connectionString, cmdText).Tables[0].DefaultView;
string[] databases = new string[dvDatabases.Count];
for (int i = 0; i < dvDatabases.Count; i++)
databases[i] = (string)dvDatabases[i]["Name"];
return databases;
}
private static void CloseDatabaseConnections(string connectionString, string databaseName)
{
DataView dv = ExecuteQuery(connectionString,
String.Format(@"SELECT spid FROM master..sysprocesses WHERE dbid = DB_ID('{0}') AND spid > 50 AND spid <> @@spid", databaseName)).Tables[0].DefaultView;
// kill processes
for (int i = 0; i < dv.Count; i++)
{
KillProcess(connectionString, (short)(dv[i]["spid"]));
}
}
private static void CloseUserConnections(string connectionString, string userName)
{
DataView dv = ExecuteQuery(connectionString,
String.Format(@"SELECT spid FROM master..sysprocesses WHERE loginame = '{0}'", userName)).Tables[0].DefaultView;
// kill processes
for (int i = 0; i < dv.Count; i++)
{
KillProcess(connectionString, (short)(dv[i]["spid"]));
}
}
private static void KillProcess(string connectionString, short spid)
{
try
{
ExecuteNonQuery(connectionString,
String.Format("KILL {0}", spid));
}
catch (SqlException)
{
}
}
private static void RemoveUserFromDatabase(string connectionString, string databaseName, string user)
{
// change ownership of user's objects
string[] userObjects = GetUserDatabaseObjects(connectionString, databaseName, user);
foreach (string userObject in userObjects)
{
try
{
ExecuteNonQuery(connectionString,
String.Format("USE {0};EXEC sp_changeobjectowner '{1}.{2}', 'dbo'",
databaseName, user, userObject));
}
catch (SqlException ex)
{
if (ex.Number == 15505)
{
// Cannot change owner of object 'user.ObjectName' or one of its child objects because
// the new owner 'dbo' already has an object with the same name.
// try to rename object before changing owner
string renamedObject = user + DateTime.Now.Ticks + "_" + userObject;
ExecuteNonQuery(connectionString,
String.Format("USE {0};EXEC sp_rename '{1}.{2}', '{3}'",
databaseName, user, userObject, renamedObject));
// change owner
ExecuteNonQuery(connectionString,
String.Format("USE {0};EXEC sp_changeobjectowner '{1}.{2}', 'dbo'",
databaseName, user, renamedObject));
}
else
{
throw new Exception("Can't change database object owner", ex);
}
}
}
// revoke db access
ExecuteNonQuery(connectionString,
String.Format("USE {0};EXEC sp_revokedbaccess '{1}';",
databaseName, user));
}
internal static bool IsValidDatabaseName(string name)
{
if (name == null || name.Trim().Length == 0 || name.Length > 128)
return false;
return Regex.IsMatch(name, "^[0-9A-z_@#$]+$", RegexOptions.Singleline);
}
internal static string BackupDatabase(string connectionString, string databaseName)
{
string bakFile = databaseName + ".bak";
// backup database
ExecuteNonQuery(connectionString,
String.Format(@"BACKUP DATABASE [{0}] TO DISK = N'{1}'", // WITH INIT, NAME = '{2}'
databaseName, bakFile));
return bakFile;
}
internal static void BackupDatabase(string connectionString, string databaseName, out string bakFile, out string position)
{
bakFile = databaseName + ".bak";
position = "1";
string backupName = "Backup " + DateTime.Now.ToString("yyyyMMddHHmmss");
// backup database
ExecuteNonQuery(connectionString,
String.Format(@"BACKUP DATABASE [{0}] TO DISK = N'{1}' WITH NAME = '{2}'", // WITH INIT, NAME = '{2}'
databaseName, bakFile, backupName));
//define last position in backup set
string query = string.Format("RESTORE HEADERONLY FROM DISK = N'{0}'", bakFile);
DataSet ds = ExecuteQuery(connectionString, query);
query = string.Format("BackupName = '{0}'", backupName);
DataRow[] rows = ds.Tables[0].Select(query, "Position DESC");
if (rows != null && rows.Length > 0)
position = rows[0]["Position"].ToString();
}
internal static void RestoreDatabase(string connectionString, string databaseName, string bakFile)
{
// close current database connections
CloseDatabaseConnections(connectionString, databaseName);
// restore database
ExecuteNonQuery(connectionString,
String.Format(@"RESTORE DATABASE [{0}] FROM DISK = '{1}' WITH REPLACE",
databaseName, bakFile));
}
internal static void RestoreDatabase(string connectionString, string databaseName, string bakFile, string position)
{
// close current database connections
CloseDatabaseConnections(connectionString, databaseName);
// restore database
ExecuteNonQuery(connectionString,
String.Format(@"RESTORE DATABASE [{0}] FROM DISK = '{1}' WITH FILE = {2}, REPLACE",
databaseName, bakFile, position));
}
}
}

View file

@ -0,0 +1,810 @@
// 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;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Security.Cryptography;
using System.Text;
using System.Text.RegularExpressions;
using System.Xml;
using System.ServiceProcess;
using System.DirectoryServices;
using System.Linq;
using WebsitePanel.Setup.Web;
using Microsoft.Win32;
namespace WebsitePanel.Setup
{
/// <summary>
/// Utils class.
/// </summary>
public sealed class Utils
{
public const string AspNet40RegistrationToolx64 = @"Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis.exe";
public const string AspNet40RegistrationToolx86 = @"Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe";
/// <summary>
/// Initializes a new instance of the class.
/// </summary>
private Utils()
{
}
#region Resources
/// <summary>
/// Get resource stream from assembly by specified resource name.
/// </summary>
/// <param name="resourceName">Name of the resource.</param>
/// <returns>Resource stream.</returns>
public static Stream GetResourceStream(string resourceName)
{
Assembly asm = typeof(Utils).Assembly;
Stream ret = asm.GetManifestResourceStream(resourceName);
return ret;
}
#endregion
#region Crypting
/// <summary>
/// Computes the SHA1 hash value
/// </summary>
/// <param name="plainText"></param>
/// <returns></returns>
public static string ComputeSHA1(string plainText)
{
// Convert plain text into a byte array.
byte[] plainTextBytes = Encoding.UTF8.GetBytes(plainText);
HashAlgorithm hash = new SHA1Managed();
// Compute hash value of our plain text with appended salt.
byte[] hashBytes = hash.ComputeHash(plainTextBytes);
// Return the result.
return Convert.ToBase64String(hashBytes);
}
public static string CreateCryptoKey(int len)
{
byte[] bytes = new byte[len];
new RNGCryptoServiceProvider().GetBytes(bytes);
StringBuilder sb = new StringBuilder();
for (int i = 0; i < bytes.Length; i++)
{
sb.Append(string.Format("{0:X2}", bytes[i]));
}
return sb.ToString();
}
public static string Encrypt(string key, string str)
{
if (str == null)
return str;
// We are now going to create an instance of the
// Rihndael class.
RijndaelManaged RijndaelCipher = new RijndaelManaged();
byte[] plainText = System.Text.Encoding.Unicode.GetBytes(str);
byte[] salt = Encoding.ASCII.GetBytes(key.Length.ToString());
PasswordDeriveBytes secretKey = new PasswordDeriveBytes(key, salt);
ICryptoTransform encryptor = RijndaelCipher.CreateEncryptor(secretKey.GetBytes(32), secretKey.GetBytes(16));
// encode
MemoryStream memoryStream = new MemoryStream();
CryptoStream cryptoStream = new CryptoStream(memoryStream, encryptor, CryptoStreamMode.Write);
cryptoStream.Write(plainText, 0, plainText.Length);
cryptoStream.FlushFinalBlock();
byte[] cipherBytes = memoryStream.ToArray();
// Close both streams
memoryStream.Close();
cryptoStream.Close();
// Return encrypted string
return Convert.ToBase64String(cipherBytes);
}
public static string GetRandomString(int length)
{
string ptrn = "abcdefghjklmnpqrstwxyz0123456789";
StringBuilder sb = new StringBuilder();
byte[] randomBytes = new byte[4];
RNGCryptoServiceProvider rng = new RNGCryptoServiceProvider();
rng.GetBytes(randomBytes);
// Convert 4 bytes into a 32-bit integer value.
int seed = (randomBytes[0] & 0x7f) << 24 |
randomBytes[1] << 16 |
randomBytes[2] << 8 |
randomBytes[3];
Random rnd = new Random(seed);
for (int i = 0; i < length; i++)
sb.Append(ptrn[rnd.Next(ptrn.Length - 1)]);
return sb.ToString();
}
#endregion
#region Setup
public static Hashtable GetSetupParameters(object obj)
{
if (obj == null)
throw new ArgumentNullException("obj");
Hashtable args = obj as Hashtable;
if (args == null)
throw new ArgumentNullException("obj");
return args;
}
public static object GetSetupParameter(Hashtable args, string paramName)
{
if (args == null)
throw new ArgumentNullException("args");
//
if (args.ContainsKey(paramName) == false)
{
return String.Empty;
}
//
return args[paramName];
}
public static string GetStringSetupParameter(Hashtable args, string paramName)
{
object obj = GetSetupParameter(args, paramName);
if (obj == null)
return null;
if (!(obj is string))
throw new Exception(string.Format("Invalid type of '{0}' parameter", paramName));
return obj as string;
}
public static int GetInt32SetupParameter(Hashtable args, string paramName)
{
object obj = GetSetupParameter(args, paramName);
if (!(obj is int))
throw new Exception(string.Format("Invalid type of '{0}' parameter", paramName));
return (int)obj;
}
public static Version GetVersionSetupParameter(Hashtable args, string paramName)
{
object obj = GetSetupParameter(args, paramName);
if (!(obj is Version))
throw new Exception(string.Format("Invalid type of '{0}' parameter", paramName));
return obj as Version;
}
public static string ReplaceScriptVariable(string str, string variable, string value)
{
Regex re = new Regex("\\$\\{" + variable + "\\}+", RegexOptions.IgnoreCase);
return re.Replace(str, value);
}
#endregion
#region Type convertions
/// <summary>
/// Converts string to int
/// </summary>
/// <param name="value">String containing a number to convert</param>
/// <param name="defaultValue">Default value</param>
/// <returns>
///The Int32 number equivalent to the number contained in value.
/// </returns>
public static int ParseInt(string value, int defaultValue)
{
if (value != null && value.Length > 0)
{
try
{
return Int32.Parse(value);
}
catch (FormatException)
{
}
catch (OverflowException)
{
}
}
return defaultValue;
}
/// <summary>
/// ParseBool
/// </summary>
/// <param name="value">EventData</param>
/// <param name="defaultValue">Dafault value</param>
/// <returns>bool</returns>
public static bool ParseBool(string value, bool defaultValue)
{
if (value != null)
{
try
{
return bool.Parse(value);
}
catch (FormatException)
{
}
catch (OverflowException)
{
}
}
return defaultValue;
}
/// <summary>
/// Converts string to decimal
/// </summary>
/// <param name="value">String containing a number to convert</param>
/// <param name="defaultValue">Default value</param>
/// <returns>The Decimal number equivalent to the number contained in value.</returns>
public static decimal ParseDecimal(string value, decimal defaultValue)
{
if (value != null && !string.IsNullOrEmpty(value))
{
try
{
return Decimal.Parse(value);
}
catch (FormatException)
{
}
catch (OverflowException)
{
}
}
return defaultValue;
}
/// <summary>
/// Converts string to double
/// </summary>
/// <param name="value">String containing a number to convert</param>
/// <param name="defaultValue">Default value</param>
/// <returns>The double number equivalent to the number contained in value.</returns>
public static double ParseDouble(string value, double defaultValue)
{
if (value != null)
{
try
{
return double.Parse(value);
}
catch (FormatException)
{
}
catch (OverflowException)
{
}
}
return defaultValue;
}
#endregion
#region DB
/// <summary>
/// Converts db value to string
/// </summary>
/// <param name="val">EventData</param>
/// <returns>string</returns>
public static string GetDbString(object val)
{
string ret = string.Empty;
if ((val != null) && (val != DBNull.Value))
ret = (string)val;
return ret;
}
/// <summary>
/// Converts db value to short
/// </summary>
/// <param name="val">EventData</param>
/// <returns>short</returns>
public static short GetDbShort(object val)
{
short ret = 0;
if ((val != null) && (val != DBNull.Value))
ret = (short)val;
return ret;
}
/// <summary>
/// Converts db value to int
/// </summary>
/// <param name="val">EventData</param>
/// <returns>int</returns>
public static int GetDbInt32(object val)
{
int ret = 0;
if ((val != null) && (val != DBNull.Value))
ret = (int)val;
return ret;
}
/// <summary>
/// Converts db value to bool
/// </summary>
/// <param name="val">EventData</param>
/// <returns>bool</returns>
public static bool GetDbBool(object val)
{
bool ret = false;
if ((val != null) && (val != DBNull.Value))
ret = Convert.ToBoolean(val);
return ret;
}
/// <summary>
/// Converts db value to decimal
/// </summary>
/// <param name="val">EventData</param>
/// <returns>decimal</returns>
public static decimal GetDbDecimal(object val)
{
decimal ret = 0;
if ((val != null) && (val != DBNull.Value))
ret = (decimal)val;
return ret;
}
/// <summary>
/// Converts db value to datetime
/// </summary>
/// <param name="val">EventData</param>
/// <returns>DateTime</returns>
public static DateTime GetDbDateTime(object val)
{
DateTime ret = DateTime.MinValue;
if ((val != null) && (val != DBNull.Value))
ret = (DateTime)val;
return ret;
}
#endregion
#region Exceptions
public static bool IsThreadAbortException(Exception ex)
{
Exception innerException = ex;
while (innerException != null)
{
if (innerException is System.Threading.ThreadAbortException)
return true;
innerException = innerException.InnerException;
}
string str = ex.ToString();
return str.Contains("System.Threading.ThreadAbortException");
}
#endregion
#region Windows Firewall
public static bool IsWindowsFirewallEnabled()
{
int ret = RegistryUtils.GetRegistryKeyInt32Value(@"SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\StandardProfile", "EnableFirewall");
return (ret == 1);
}
public static bool IsWindowsFirewallExceptionsAllowed()
{
int ret = RegistryUtils.GetRegistryKeyInt32Value(@"SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\StandardProfile", "DoNotAllowExceptions");
return (ret != 1);
}
public static void OpenWindowsFirewallPort(string name, string port)
{
string path = Path.Combine(Environment.SystemDirectory, "netsh.exe");
string arguments = string.Format("firewall set portopening tcp {0} \"{1}\" enable", port, name);
RunProcess(path, arguments);
}
#endregion
#region Processes & Services
public static int RunProcess(string path, string arguments)
{
Process process = null;
try
{
ProcessStartInfo info = new ProcessStartInfo(path, arguments);
info.WindowStyle = ProcessWindowStyle.Hidden;
process = Process.Start(info);
process.WaitForExit();
return process.ExitCode;
}
finally
{
if (process != null)
{
process.Close();
}
}
}
public static void StartService(string serviceName)
{
ServiceController sc = new ServiceController(serviceName);
// Start the service if the current status is stopped.
if (sc.Status == ServiceControllerStatus.Stopped)
{
// Start the service, and wait until its status is "Running".
sc.Start();
sc.WaitForStatus(ServiceControllerStatus.Running);
}
}
public static void StopService(string serviceName)
{
ServiceController sc = new ServiceController(serviceName);
// Start the service if the current status is stopped.
if (sc.Status != ServiceControllerStatus.Stopped &&
sc.Status != ServiceControllerStatus.StopPending)
{
// Start the service, and wait until its status is "Running".
sc.Stop();
sc.WaitForStatus(ServiceControllerStatus.Stopped);
}
}
#endregion
#region I/O
public static string GetSystemDrive()
{
return Path.GetPathRoot(Environment.SystemDirectory);
}
#endregion
public static bool IsWebDeployInstalled()
{
// TO-DO: Implement Web Deploy detection (x64/x86)
var isInstalled = false;
//
try
{
var msdeployRegKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\IIS Extensions\MSDeploy\2");
//
var keyValue = msdeployRegKey.GetValue("Install");
// We have found the required key in the registry hive
if (keyValue != null && keyValue.Equals(1))
{
isInstalled = true;
}
}
catch (Exception ex)
{
Log.WriteError("Could not retrieve Web Deploy key from the registry", ex);
}
//
return isInstalled;
}
public static bool IsWin64()
{
return (IntPtr.Size == 8);
}
public static void ShowConsoleErrorMessage(string format, params object[] args)
{
Console.WriteLine(String.Format(format, args));
}
public static string ResolveAspNet40RegistrationToolPath_Iis6(SetupVariables setupVariables)
{
// By default we fallback to the corresponding tool version based on the platform bitness
var util = Environment.Is64BitOperatingSystem ? AspNet40RegistrationToolx64 : AspNet40RegistrationToolx86;
// Choose appropriate tool version for IIS 6
if (setupVariables.IISVersion.Major == 6)
{
// Change to x86 tool version on x64 w/ "Enable32bitAppOnWin64" flag enabled
if (Environment.Is64BitOperatingSystem == true && Utils.IIS32Enabled())
{
util = AspNet40RegistrationToolx86;
}
}
// Build path to the tool
return Path.Combine(Environment.GetEnvironmentVariable("WINDIR"), util);
}
/// <summary>
/// Beware: Web site component-dependent logic
/// </summary>
/// <param name="setupVariables"></param>
/// <returns></returns>
public static string ResolveAspNet40RegistrationToolPath_Iis7(SetupVariables setupVariables)
{
// By default we fallback to the corresponding tool version based on the platform bitness
var util = Environment.Is64BitOperatingSystem ? AspNet40RegistrationToolx64 : AspNet40RegistrationToolx86;
// Choose appropriate tool version for IIS 7
if (setupVariables.IISVersion.Major == 7 && setupVariables.SetupAction == SetupActions.Update)
{
// Evaluate app pool settings on x64 platform only when update is running
if (Environment.Is64BitOperatingSystem == true)
{
// Change to x86 tool version if the component's app pool is in WOW64 mode
using (var srvman = new Microsoft.Web.Administration.ServerManager())
{
// Retrieve the component's app pool
var appPoolObj = srvman.ApplicationPools[setupVariables.WebApplicationPoolName];
// We are
if (appPoolObj == null)
{
throw new ArgumentException(String.Format("Could not find '{0}' web application pool", setupVariables.WebApplicationPoolName), "appPoolObj");
}
// Check app pool mode
else if (appPoolObj.Enable32BitAppOnWin64 == true)
{
util = AspNet40RegistrationToolx86;
}
}
}
}
// Build path to the tool
return Path.Combine(Environment.GetEnvironmentVariable("WINDIR"), util);
}
public static bool CheckAspNet40Registered(SetupVariables setupVariables)
{
//
var aspNet40Registered = false;
// Run ASP.NET Registration Tool command
var psOutput = ExecAspNetRegistrationToolCommand(setupVariables, "-lv");
// Split process output per lines
var strLines = psOutput.Split(new char[] { '\n' }, StringSplitOptions.RemoveEmptyEntries);
// Lookup for an evidence of ASP.NET 4.0
aspNet40Registered = strLines.Any((string s) => { return s.Contains("4.0.30319.0"); });
//
return aspNet40Registered;
}
public static string ExecAspNetRegistrationToolCommand(SetupVariables setupVariables, string arguments)
{
//
var util = (setupVariables.IISVersion.Major == 6) ? Utils.ResolveAspNet40RegistrationToolPath_Iis6(setupVariables) : Utils.ResolveAspNet40RegistrationToolPath_Iis7(setupVariables);
//
// Create a specific process start info set to redirect its standard output for further processing
ProcessStartInfo info = new ProcessStartInfo(util)
{
WindowStyle = ProcessWindowStyle.Hidden,
UseShellExecute = false,
RedirectStandardOutput = true,
Arguments = arguments
};
//
Log.WriteInfo(String.Format("Starting aspnet_regiis.exe {0}", info.Arguments));
//
var process = default(Process);
//
var psOutput = String.Empty;
//
try
{
// Start the process
process = Process.Start(info);
// Read the output
psOutput = process.StandardOutput.ReadToEnd();
// Wait for the completion
process.WaitForExit();
}
catch (Exception ex)
{
Log.WriteError("Could not execute ASP.NET Registration Tool command", ex);
}
finally
{
if (process != null)
process.Close();
}
// Trace output data for troubleshooting purposes
Log.WriteInfo(psOutput);
//
Log.WriteInfo(String.Format("Finished aspnet_regiis.exe {0}", info.Arguments));
//
return psOutput;
}
public static void RegisterAspNet40(Setup.SetupVariables setupVariables)
{
// Run ASP.NET Registration Tool command
ExecAspNetRegistrationToolCommand(setupVariables, arguments: (setupVariables.IISVersion.Major == 6) ? "-ir -enable" : "-ir");
}
public static WebExtensionStatus GetAspNetWebExtensionStatus_Iis6(SetupVariables setupVariables)
{
WebExtensionStatus status = WebExtensionStatus.Allowed;
if (setupVariables.IISVersion.Major == 6)
{
status = WebExtensionStatus.NotInstalled;
string path;
if (Utils.IsWin64() && !Utils.IIS32Enabled())
{
//64-bit
path = Path.Combine(OS.GetWindowsDirectory(), @"Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll");
}
else
{
//32-bit
path = Path.Combine(OS.GetWindowsDirectory(), @"Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll");
}
path = path.ToLower();
using (DirectoryEntry iis = new DirectoryEntry("IIS://LocalHost/W3SVC"))
{
PropertyValueCollection values = iis.Properties["WebSvcExtRestrictionList"];
for (int i = 0; i < values.Count; i++)
{
string val = values[i] as string;
if (!string.IsNullOrEmpty(val))
{
string strVal = val.ToString().ToLower();
if (strVal.Contains(path))
{
if (strVal[0] == '1')
{
status = WebExtensionStatus.Allowed;
}
else
{
status = WebExtensionStatus.Prohibited;
}
break;
}
}
}
}
}
return status;
}
public static void EnableAspNetWebExtension_Iis6()
{
Log.WriteStart("Enabling ASP.NET Web Service Extension");
//
var webExtensionName = (Utils.IsWin64() && Utils.IIS32Enabled()) ? "ASP.NET v4.0.30319 (32-bit)" : "ASP.NET v4.0.30319";
//
using (DirectoryEntry iisService = new DirectoryEntry("IIS://LocalHost/W3SVC"))
{
iisService.Invoke("EnableWebServiceExtension", webExtensionName);
iisService.CommitChanges();
}
//
Log.WriteEnd("Enabled ASP.NET Web Service Extension");
}
public static bool IIS32Enabled()
{
bool enabled = false;
using (DirectoryEntry obj = new DirectoryEntry("IIS://LocalHost/W3SVC/AppPools"))
{
object objProperty = GetObjectProperty(obj, "Enable32bitAppOnWin64");
if (objProperty != null)
{
enabled = (bool)objProperty;
}
}
return enabled;
}
public static void SetObjectProperty(DirectoryEntry oDE, string name, object value)
{
if (value != null)
{
if (oDE.Properties.Contains(name))
{
oDE.Properties[name][0] = value;
}
else
{
oDE.Properties[name].Add(value);
}
}
}
public static object GetObjectProperty(DirectoryEntry entry, string name)
{
if (entry.Properties.Contains(name))
return entry.Properties[name][0];
else
return null;
}
public static void OpenFirewallPort(string name, string port, Version iisVersion)
{
bool iis7 = (iisVersion.Major == 7);
if (iis7)
{
//TODO: Add IIS7 support
}
else
{
if (Utils.IsWindowsFirewallEnabled() &&
Utils.IsWindowsFirewallExceptionsAllowed())
{
//SetProgressText("Opening port in windows firewall...");
Log.WriteStart(String.Format("Opening port {0} in windows firewall", port));
Utils.OpenWindowsFirewallPort(name, port);
//update log
Log.WriteEnd("Opened port in windows firewall");
InstallLog.AppendLine(String.Format("- Opened port {0} in Windows Firewall", port));
}
}
}
public static string[] GetApplicationUrls(string ip, string domain, string port, string virtualDir)
{
List<string> urls = new List<string>();
// IP address, [port] and [virtualDir]
string url = ip;
if (String.IsNullOrEmpty(domain))
{
if (!String.IsNullOrEmpty(port) && port != "80")
url += ":" + port;
if (!String.IsNullOrEmpty(virtualDir))
url += "/" + virtualDir;
urls.Add(url);
}
// domain, [port] and [virtualDir]
if (!String.IsNullOrEmpty(domain))
{
url = domain;
if (!String.IsNullOrEmpty(port) && port != "80")
url += ":" + port;
if (!String.IsNullOrEmpty(virtualDir))
url += "/" + virtualDir;
urls.Add(url);
}
return urls.ToArray();
}
}
}

View file

@ -0,0 +1,48 @@
// 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;
namespace WebsitePanel.Setup.Common
{
[Serializable]
internal class WebException : Exception
{
public WebException()
{
}
public WebException(string message) : base(message)
{
}
public WebException(string message, Exception inner) : base(message, inner)
{
}
}
}

File diff suppressed because it is too large Load diff

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.Management;
namespace WebsitePanel.Setup
{
/// <summary>
/// Wmi helper class.
/// </summary>
internal sealed class WmiHelper
{
// namespace
private string ns = null;
// scope
private ManagementScope scope = null;
/// <summary>
/// Initializes a new instance of the class.
/// </summary>
/// <param name="ns">Namespace.</param>
public WmiHelper(string ns)
{
this.ns = ns;
}
/// <summary>
/// Executes specified query.
/// </summary>
/// <param name="query">Query to execute.</param>
/// <returns>Resulting collection.</returns>
internal ManagementObjectCollection ExecuteQuery(string query)
{
ObjectQuery objectQuery = new ObjectQuery(query);
ManagementObjectSearcher searcher =
new ManagementObjectSearcher(WmiScope, objectQuery);
return searcher.Get();
}
/// <summary>
/// Retreives ManagementClass class initialized to the given WMI path.
/// </summary>
/// <param name="path">A ManagementPath specifying which WMI class to bind to.</param>
/// <returns>Instance of the ManagementClass class.</returns>
internal ManagementClass GetClass(string path)
{
return new ManagementClass(WmiScope, new ManagementPath(path), null);
}
/// <summary>
/// Retreives ManagementObject class bound to the specified WMI path.
/// </summary>
/// <param name="path">A ManagementPath that contains a path to a WMI object.</param>
/// <returns>Instance of the ManagementObject class.</returns>
internal ManagementObject GetObject(string path)
{
return new ManagementObject(WmiScope, new ManagementPath(path), null);
}
public ManagementScope WmiScope
{
get
{
if(scope == null)
{
ManagementPath path = new ManagementPath(ns);
scope = new ManagementScope(path, new ConnectionOptions());
scope.Connect();
}
return scope;
}
}
}
}

View file

@ -0,0 +1,84 @@
// 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.Xml;
namespace WebsitePanel.Setup
{
public sealed class XmlUtils
{
private XmlUtils()
{
}
/// <summary>
/// Retrieves the specified attribute from the XML node.
/// </summary>
/// <param name="node">XML node.</param>
/// <param name="attribute">Attribute to retreive.</param>
/// <returns>Attribute value.</returns>
internal static string GetXmlAttribute(XmlNode node, string attribute)
{
string ret = null;
if (node != null)
{
XmlAttribute xmlAttribute = node.Attributes[attribute];
if (xmlAttribute != null)
{
ret = xmlAttribute.Value;
}
}
return ret;
}
internal static void SetXmlAttribute(XmlNode node, string attribute, string value)
{
if (node != null)
{
XmlAttribute xmlAttribute = node.Attributes[attribute];
if (xmlAttribute == null)
{
xmlAttribute = node.OwnerDocument.CreateAttribute(attribute);
node.Attributes.Append(xmlAttribute);
}
xmlAttribute.Value = value;
}
}
internal static void RemoveXmlNode(XmlNode node)
{
if (node != null && node.ParentNode != null)
{
node.ParentNode.RemoveChild(node);
}
}
}
}

View file

@ -0,0 +1,79 @@
// 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.Windows.Forms;
using System.Collections.Generic;
using System.Text;
using Ionic.Zip;
namespace WebsitePanel.Setup.Common
{
/// <summary>
/// Shows progress of file zipping.
/// </summary>
public sealed class ZipIndicator
{
private ProgressBar progressBar;
string sourcePath;
string zipFile;
int totalFiles = 0;
int files = 0;
public ZipIndicator(ProgressBar progressBar, string sourcePath, string zipFile)
{
this.progressBar = progressBar;
this.sourcePath = sourcePath;
this.zipFile = zipFile;
}
public void Start()
{
totalFiles = FileUtils.CalculateFiles(sourcePath);
using (ZipFile zip = new ZipFile())
{
zip.AddProgress += ShowProgress;
zip.UseUnicodeAsNecessary = true;
zip.AddDirectory(sourcePath);
zip.Save(zipFile);
}
}
private void ShowProgress(object sender, AddProgressEventArgs e)
{
if (e.EventType == ZipProgressEventType.Adding_AfterAddEntry)
{
string fileName = e.CurrentEntry.FileName;
files++;
this.progressBar.Value = Convert.ToInt32(files * 100 / totalFiles);
this.progressBar.Update();
}
}
}
}

View file

@ -0,0 +1,274 @@
// 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.Xml;
using System.Configuration;
using System.Windows.Forms;
using System.Collections;
using System.Text;
using WebsitePanel.Setup.Actions;
namespace WebsitePanel.Setup
{
public class EnterpriseServer : BaseSetup
{
public static object Install(object obj)
{
return InstallBase(obj, "1.0.1");
}
internal static object InstallBase(object obj, string minimalInstallerVersion)
{
var args = Utils.GetSetupParameters(obj);
//check CS version
var shellVersion = Utils.GetStringSetupParameter(args, "ShellVersion");
var shellMode = Utils.GetStringSetupParameter(args, Global.Parameters.ShellMode);
var version = new Version(shellVersion);
var setupVariables = new SetupVariables
{
ConnectionString = Global.EntServer.AspNetConnectionStringFormat,
DatabaseServer = Global.EntServer.DefaultDbServer,
Database = Global.EntServer.DefaultDatabase,
CreateDatabase = true,
WebSiteIP = Global.EntServer.DefaultIP,
WebSitePort = Global.EntServer.DefaultPort,
WebSiteDomain = String.Empty,
NewWebSite = true,
NewVirtualDirectory = false,
ConfigurationFile = "web.config",
UpdateServerAdminPassword = true,
ServerAdminPassword = "",
};
//
InitInstall(args, setupVariables);
//
var eam = new EntServerActionManager(setupVariables);
//
eam.PrepareDistributiveDefaults();
//
if (shellMode.Equals(Global.SilentInstallerShell, StringComparison.OrdinalIgnoreCase))
{
if (version < new Version(minimalInstallerVersion))
{
Utils.ShowConsoleErrorMessage(Global.Messages.InstallerVersionIsObsolete, minimalInstallerVersion);
//
return false;
}
try
{
var success = true;
//
setupVariables.ServerAdminPassword = Utils.GetStringSetupParameter(args, Global.Parameters.ServerAdminPassword);
setupVariables.Database = Utils.GetStringSetupParameter(args, Global.Parameters.DatabaseName);
setupVariables.DatabaseServer = Utils.GetStringSetupParameter(args, Global.Parameters.DatabaseServer);
//
setupVariables.DbInstallConnectionString = SqlUtils.BuildDbServerMasterConnectionString(
setupVariables.DatabaseServer,
Utils.GetStringSetupParameter(args, Global.Parameters.DbServerAdmin),
Utils.GetStringSetupParameter(args, Global.Parameters.DbServerAdminPassword)
);
//
eam.ActionError += new EventHandler<ActionErrorEventArgs>((object sender, ActionErrorEventArgs e) =>
{
Utils.ShowConsoleErrorMessage(e.ErrorMessage);
//
Log.WriteError(e.ErrorMessage);
//
success = false;
});
//
eam.Start();
//
return success;
}
catch (Exception ex)
{
Log.WriteError("Failed to install the component", ex);
//
return false;
}
}
else
{
if (version < new Version(minimalInstallerVersion))
{
MessageBox.Show(string.Format(Global.Messages.InstallerVersionIsObsolete, minimalInstallerVersion), "Setup Wizard", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return DialogResult.Cancel;
}
InstallerForm form = new InstallerForm();
Wizard wizard = form.Wizard;
wizard.SetupVariables = setupVariables;
wizard.ActionManager = eam;
//Unattended setup
LoadSetupVariablesFromSetupXml(wizard.SetupVariables.SetupXml, wizard.SetupVariables);
//create wizard pages
var introPage = new IntroductionPage();
var licPage = new LicenseAgreementPage();
var page1 = new ConfigurationCheckPage();
//
ConfigurationCheck check1 = new ConfigurationCheck(CheckTypes.OperationSystem, "Operating System Requirement");
ConfigurationCheck check2 = new ConfigurationCheck(CheckTypes.IISVersion, "IIS Requirement");
ConfigurationCheck check3 = new ConfigurationCheck(CheckTypes.ASPNET, "ASP.NET Requirement");
//
page1.Checks.AddRange(new ConfigurationCheck[] { check1, check2, check3 });
//
var page2 = new InstallFolderPage();
var page3 = new WebPage();
var page4 = new UserAccountPage();
var page5 = new DatabasePage();
var passwordPage = new ServerAdminPasswordPage();
//
var page6 = new ExpressInstallPage2();
//
var page7 = new FinishPage();
wizard.Controls.AddRange(new Control[] { introPage, licPage, page1, page2, page3, page4, page5, passwordPage, page6, page7 });
wizard.LinkPages();
wizard.SelectedPage = introPage;
//show wizard
IWin32Window owner = args[Global.Parameters.ParentForm] as IWin32Window;
return form.ShowModal(owner);
}
}
public static DialogResult Uninstall(object obj)
{
return UninstallBase(obj);
}
public static DialogResult Setup(object obj)
{
Hashtable args = Utils.GetSetupParameters(obj);
string shellVersion = Utils.GetStringSetupParameter(args, "ShellVersion");
//
var setupVariables = new SetupVariables
{
ComponentId = Utils.GetStringSetupParameter(args, Global.Parameters.ComponentId),
ConfigurationFile = "web.config",
IISVersion = Global.IISVersion,
SetupAction = SetupActions.Setup
};
//
AppConfig.LoadConfiguration();
InstallerForm form = new InstallerForm();
Wizard wizard = form.Wizard;
wizard.SetupVariables = setupVariables;
//
AppConfig.LoadComponentSettings(wizard.SetupVariables);
//IntroductionPage page1 = new IntroductionPage();
WebPage page1 = new WebPage();
ServerAdminPasswordPage page2 = new ServerAdminPasswordPage();
ExpressInstallPage page3 = new ExpressInstallPage();
//create install currentScenario
InstallAction action = new InstallAction(ActionTypes.UpdateWebSite);
action.Description = "Updating web site...";
page3.Actions.Add(action);
action = new InstallAction(ActionTypes.UpdateServerAdminPassword);
action.Description = "Updating serveradmin password...";
page3.Actions.Add(action);
action = new InstallAction(ActionTypes.UpdateConfig);
action.Description = "Updating system configuration...";
page3.Actions.Add(action);
FinishPage page4 = new FinishPage();
wizard.Controls.AddRange(new Control[] { page1, page2, page3, page4 });
wizard.LinkPages();
wizard.SelectedPage = page1;
//show wizard
IWin32Window owner = args[Global.Parameters.ParentForm] as IWin32Window;
return form.ShowModal(owner);
}
public static DialogResult Update(object obj)
{
Hashtable args = Utils.GetSetupParameters(obj);
var setupVariables = new SetupVariables
{
ComponentId = Utils.GetStringSetupParameter(args, Global.Parameters.ComponentId),
SetupAction = SetupActions.Update,
IISVersion = Global.IISVersion
};
AppConfig.LoadConfiguration();
InstallerForm form = new InstallerForm();
Wizard wizard = form.Wizard;
wizard.SetupVariables = setupVariables;
//
AppConfig.LoadComponentSettings(wizard.SetupVariables);
IntroductionPage introPage = new IntroductionPage();
LicenseAgreementPage licPage = new LicenseAgreementPage();
ExpressInstallPage page2 = new ExpressInstallPage();
//create install currentScenario
InstallAction action = new InstallAction(ActionTypes.Backup);
action.Description = "Backing up...";
page2.Actions.Add(action);
action = new InstallAction(ActionTypes.DeleteFiles);
action.Description = "Deleting files...";
action.Path = "setup\\delete.txt";
page2.Actions.Add(action);
action = new InstallAction(ActionTypes.CopyFiles);
action.Description = "Copying files...";
page2.Actions.Add(action);
action = new InstallAction(ActionTypes.ExecuteSql);
action.Description = "Updating database...";
action.Path = "setup\\update_db.sql";
page2.Actions.Add(action);
action = new InstallAction(ActionTypes.UpdateConfig);
action.Description = "Updating system configuration...";
page2.Actions.Add(action);
FinishPage page3 = new FinishPage();
wizard.Controls.AddRange(new Control[] { introPage, licPage, page2, page3 });
wizard.LinkPages();
wizard.SelectedPage = introPage;
//show wizard
Form parentForm = args[Global.Parameters.ParentForm] as Form;
return form.ShowDialog(parentForm);
}
}
}

View file

@ -0,0 +1,133 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using WebsitePanel.Setup.Actions;
namespace WebsitePanel.Setup
{
/// <summary>
/// Release 1.2.0
/// </summary>
public class EnterpriseServer120 : EnterpriseServer
{
public static new object Install(object obj)
{
//
return EnterpriseServer.InstallBase(obj, "1.1.0");
}
public static new DialogResult Uninstall(object obj)
{
return EnterpriseServer.Uninstall(obj);
}
public static new DialogResult Setup(object obj)
{
return EnterpriseServer.Setup(obj);
}
public static new DialogResult Update(object obj)
{
return UpdateBase(obj, "1.2.0", "1.1.2", true, new InstallAction(ActionTypes.SwitchEntServer2AspNet40));
}
}
/// <summary>
/// Release 1.1.0
/// </summary>
public class EnterpriseServer110 : EnterpriseServer
{
public static new object Install(object obj)
{
return EnterpriseServer.InstallBase(obj, "1.1.0");
}
public static new DialogResult Uninstall(object obj)
{
return EnterpriseServer.Uninstall(obj);
}
public static new DialogResult Setup(object obj)
{
return EnterpriseServer.Setup(obj);
}
public static new DialogResult Update(object obj)
{
return UpdateBase(obj, "1.1.0", "1.0.2", true);
}
}
/// Release 1.0.2
/// </summary>
public class EnterpriseServer102 : EnterpriseServer101
{
public static new object Install(object obj)
{
return EnterpriseServer101.InstallBase(obj, "1.0.0");
}
public static new DialogResult Uninstall(object obj)
{
return EnterpriseServer101.Uninstall(obj);
}
public static new DialogResult Setup(object obj)
{
return EnterpriseServer101.Setup(obj);
}
public static new DialogResult Update(object obj)
{
return UpdateBase(obj, "1.0.0", "1.0.1", true);
}
}
/// <summary>
/// Release 1.0.1
/// </summary>
public class EnterpriseServer101 : EnterpriseServer10
{
public static new object Install(object obj)
{
return EnterpriseServer10.InstallBase(obj, "1.0.0");
}
public static new DialogResult Uninstall(object obj)
{
return EnterpriseServer10.Uninstall(obj);
}
public static new DialogResult Setup(object obj)
{
return EnterpriseServer10.Setup(obj);
}
public static new DialogResult Update(object obj)
{
return UpdateBase(obj, "1.0.0", "1.0", true);
}
}
/// <summary>
/// Release 1.0
/// </summary>
public class EnterpriseServer10 : EnterpriseServer
{
public static new object Install(object obj)
{
return EnterpriseServer.InstallBase(obj, "1.0.0");
}
public static new DialogResult Uninstall(object obj)
{
return EnterpriseServer.Uninstall(obj);
}
public static new DialogResult Setup(object obj)
{
return EnterpriseServer.Setup(obj);
}
}
}

View file

@ -0,0 +1,72 @@
namespace WebsitePanel.Setup
{
partial class InstallerForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
private Wizard wizard;
/// <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 Windows Form 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.wizard = new WebsitePanel.Setup.Wizard();
this.SuspendLayout();
//
// wizard
//
this.wizard.BannerImage = global::WebsitePanel.Setup.Properties.Resources.BannerImage;
this.wizard.Dock = System.Windows.Forms.DockStyle.Fill;
this.wizard.Location = new System.Drawing.Point(0, 0);
this.wizard.MarginImage = global::WebsitePanel.Setup.Properties.Resources.MarginImage;
this.wizard.Name = "wizard";
this.wizard.SelectedPage = null;
this.wizard.Size = new System.Drawing.Size(495, 358);
this.wizard.TabIndex = 0;
this.wizard.Finish += new System.EventHandler(this.OnWizardFinish);
this.wizard.Cancel += new System.EventHandler(this.OnWizardCancel);
//
// InstallerForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(495, 358);
this.Controls.Add(this.wizard);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "InstallerForm";
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Setup Wizard";
this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.OnFormClosed);
this.ResumeLayout(false);
}
#endregion
}
}

View file

@ -0,0 +1,90 @@
// 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.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime.Remoting.Lifetime;
namespace WebsitePanel.Setup
{
public partial class InstallerForm : Form
{
public InstallerForm()
{
InitializeComponent();
LifetimeServices.LeaseTime = TimeSpan.Zero;
Log.WriteInfo("Setup wizard loaded.");
}
private void OnWizardCancel(object sender, EventArgs e)
{
this.DialogResult = DialogResult.Cancel;
Close();
}
private void OnWizardFinish(object sender, EventArgs e)
{
this.DialogResult = DialogResult.OK;
Close();
}
public Wizard Wizard
{
get
{
return this.wizard;
}
}
private void OnFormClosed(object sender, FormClosedEventArgs e)
{
Log.WriteInfo("Setup wizard closed.");
}
delegate DialogResult ShowModalCallback(IWin32Window owner);
public DialogResult ShowModal(IWin32Window owner)
{
//thread safe call
if (this.InvokeRequired)
{
ShowModalCallback callback = new ShowModalCallback(ShowModal);
return (DialogResult)this.Invoke(callback, new object[] { owner });
}
else
{
return this.ShowDialog(owner);
}
}
}
}

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,285 @@
// 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.Xml;
using System.Configuration;
using System.Windows.Forms;
using System.Collections;
using System.Text;
using WebsitePanel.Setup.Actions;
namespace WebsitePanel.Setup
{
public class Portal : BaseSetup
{
public static object Install(object obj)
{
return InstallBase(obj, "1.0.1");
}
internal static object InstallBase(object obj, string minimalInstallerVersion)
{
Hashtable args = Utils.GetSetupParameters(obj);
//check CS version
var shellMode = Utils.GetStringSetupParameter(args, Global.Parameters.ShellMode);
var version = new Version(Utils.GetStringSetupParameter(args, Global.Parameters.ShellVersion));
var setupVariables = new SetupVariables
{
SetupAction = SetupActions.Install,
ConfigurationFile = "web.config",
WebSiteIP = Global.WebPortal.DefaultIP, //empty - to detect IP
WebSitePort = Global.WebPortal.DefaultPort,
WebSiteDomain = String.Empty,
NewWebSite = true,
NewVirtualDirectory = false,
EnterpriseServerURL = Global.WebPortal.DefaultEntServURL
};
//
InitInstall(args, setupVariables);
//
var wam = new WebPortalActionManager(setupVariables);
//
wam.PrepareDistributiveDefaults();
//
if (shellMode.Equals(Global.SilentInstallerShell, StringComparison.OrdinalIgnoreCase))
{
if (version < new Version(minimalInstallerVersion))
{
Utils.ShowConsoleErrorMessage(Global.Messages.InstallerVersionIsObsolete, minimalInstallerVersion);
//
return false;
}
try
{
var success = true;
//
setupVariables.EnterpriseServerURL = Utils.GetStringSetupParameter(args, Global.Parameters.EnterpriseServerUrl);
//
wam.ActionError += new EventHandler<ActionErrorEventArgs>((object sender, ActionErrorEventArgs e) =>
{
Utils.ShowConsoleErrorMessage(e.ErrorMessage);
//
Log.WriteError(e.ErrorMessage);
//
success = false;
});
//
wam.Start();
//
return success;
}
catch (Exception ex)
{
Log.WriteError("Failed to install the component", ex);
//
return false;
}
}
else
{
if (version < new Version(minimalInstallerVersion))
{
//
MessageBox.Show(String.Format(Global.Messages.InstallerVersionIsObsolete, minimalInstallerVersion), "Setup Wizard", MessageBoxButtons.OK, MessageBoxIcon.Warning);
//
return DialogResult.Cancel;
}
//
InstallerForm form = new InstallerForm();
Wizard wizard = form.Wizard;
wizard.SetupVariables = setupVariables;
wizard.ActionManager = wam;
//Unattended setup
LoadSetupVariablesFromSetupXml(wizard.SetupVariables.SetupXml, wizard.SetupVariables);
//create wizard pages
var introPage = new IntroductionPage();
var licPage = new LicenseAgreementPage();
var page1 = new ConfigurationCheckPage();
ConfigurationCheck check1 = new ConfigurationCheck(CheckTypes.OperationSystem, "Operating System Requirement");
ConfigurationCheck check2 = new ConfigurationCheck(CheckTypes.IISVersion, "IIS Requirement");
ConfigurationCheck check3 = new ConfigurationCheck(CheckTypes.ASPNET, "ASP.NET Requirement");
page1.Checks.AddRange(new ConfigurationCheck[] { check1, check2, check3 });
var page2 = new InstallFolderPage();
var page3 = new WebPage();
var page4 = new UserAccountPage();
var page5 = new UrlPage();
var page6 = new ExpressInstallPage2();
var page7 = new FinishPage();
wizard.Controls.AddRange(new Control[] { introPage, licPage, page1, page2, page3, page4, page5, page6, page7 });
wizard.LinkPages();
wizard.SelectedPage = introPage;
//show wizard
IWin32Window owner = args[Global.Parameters.ParentForm] as IWin32Window;
return form.ShowModal(owner);
}
}
public static DialogResult Uninstall(object obj)
{
Hashtable args = Utils.GetSetupParameters(obj);
string shellVersion = Utils.GetStringSetupParameter(args, Global.Parameters.ShellVersion);
//
var setupVariables = new SetupVariables
{
ComponentId = Utils.GetStringSetupParameter(args, Global.Parameters.ComponentId),
IISVersion = Global.IISVersion,
SetupAction = SetupActions.Uninstall
};
//
AppConfig.LoadConfiguration();
InstallerForm form = new InstallerForm();
Wizard wizard = form.Wizard;
wizard.SetupVariables = setupVariables;
//
AppConfig.LoadComponentSettings(wizard.SetupVariables);
//
IntroductionPage page1 = new IntroductionPage();
ConfirmUninstallPage page2 = new ConfirmUninstallPage();
UninstallPage page3 = new UninstallPage();
//create uninstall currentScenario
InstallAction action = new InstallAction(ActionTypes.DeleteShortcuts);
action.Description = "Deleting shortcuts...";
action.Log = "- Delete shortcuts";
action.Name = "Login to WebsitePanel.url";
page3.Actions.Add(action);
page2.UninstallPage = page3;
FinishPage page4 = new FinishPage();
wizard.Controls.AddRange(new Control[] { page1, page2, page3, page4 });
wizard.LinkPages();
wizard.SelectedPage = page1;
//show wizard
IWin32Window owner = args[Global.Parameters.ParentForm] as IWin32Window;
return form.ShowModal(owner);
}
public static DialogResult Setup(object obj)
{
Hashtable args = Utils.GetSetupParameters(obj);
string shellVersion = Utils.GetStringSetupParameter(args, Global.Parameters.ShellVersion);
//
var setupVariables = new SetupVariables
{
ComponentId = Utils.GetStringSetupParameter(args, Global.Parameters.ComponentId),
SetupAction = SetupActions.Setup,
IISVersion = Global.IISVersion
};
//
AppConfig.LoadConfiguration();
InstallerForm form = new InstallerForm();
Wizard wizard = form.Wizard;
wizard.SetupVariables = setupVariables;
//
AppConfig.LoadComponentSettings(wizard.SetupVariables);
WebPage page1 = new WebPage();
UrlPage page2 = new UrlPage();
ExpressInstallPage page3 = new ExpressInstallPage();
//create install currentScenario
InstallAction action = new InstallAction(ActionTypes.UpdateWebSite);
action.Description = "Updating web site...";
page3.Actions.Add(action);
action = new InstallAction(ActionTypes.UpdateEnterpriseServerUrl);
action.Description = "Updating site settings...";
page3.Actions.Add(action);
action = new InstallAction(ActionTypes.UpdateConfig);
action.Description = "Updating system configuration...";
page3.Actions.Add(action);
FinishPage page4 = new FinishPage();
wizard.Controls.AddRange(new Control[] { page1, page2, page3, page4 });
wizard.LinkPages();
wizard.SelectedPage = page1;
//show wizard
IWin32Window owner = args[Global.Parameters.ParentForm] as IWin32Window;
return form.ShowModal(owner);
}
public static DialogResult Update(object obj)
{
Hashtable args = Utils.GetSetupParameters(obj);
var setupVariables = new SetupVariables
{
ComponentId = Utils.GetStringSetupParameter(args, Global.Parameters.ComponentId),
SetupAction = SetupActions.Update,
IISVersion = Global.IISVersion
};
AppConfig.LoadConfiguration();
InstallerForm form = new InstallerForm();
Wizard wizard = form.Wizard;
wizard.SetupVariables = setupVariables;
//
AppConfig.LoadComponentSettings(wizard.SetupVariables);
//
IntroductionPage introPage = new IntroductionPage();
LicenseAgreementPage licPage = new LicenseAgreementPage();
ExpressInstallPage page2 = new ExpressInstallPage();
//create install currentScenario
InstallAction action = new InstallAction(ActionTypes.Backup);
action.Description = "Backing up...";
page2.Actions.Add(action);
action = new InstallAction(ActionTypes.DeleteFiles);
action.Description = "Deleting files...";
action.Path = "setup\\delete.txt";
page2.Actions.Add(action);
action = new InstallAction(ActionTypes.CopyFiles);
action.Description = "Copying files...";
page2.Actions.Add(action);
action = new InstallAction(ActionTypes.UpdateConfig);
action.Description = "Updating system configuration...";
page2.Actions.Add(action);
FinishPage page3 = new FinishPage();
wizard.Controls.AddRange(new Control[] { introPage, licPage, page2, page3 });
wizard.LinkPages();
wizard.SelectedPage = introPage;
//show wizard
IWin32Window owner = args[Global.Parameters.ParentForm] as IWin32Window;
return form.ShowModal(owner);
}
}
}

View file

@ -0,0 +1,132 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using WebsitePanel.Setup.Actions;
namespace WebsitePanel.Setup
{
/// <summary>
/// Release 1.2.0
/// </summary>
public class Portal120 : Portal
{
public static new object Install(object obj)
{
//
return Portal.InstallBase(obj, "1.1.0");
}
public static new DialogResult Uninstall(object obj)
{
return Portal.Uninstall(obj);
}
public static new DialogResult Setup(object obj)
{
return Portal.Setup(obj);
}
public static new DialogResult Update(object obj)
{
return UpdateBase(obj, "1.2.0", "1.1.2", false, new InstallAction(ActionTypes.SwitchWebPortal2AspNet40));
}
}
/// <summary>
/// Release 1.1.0
/// </summary>
public class Portal110 : Portal
{
public static new object Install(object obj)
{
return Portal.InstallBase(obj, "1.1.0");
}
public static new DialogResult Uninstall(object obj)
{
return Portal.Uninstall(obj);
}
public static new DialogResult Setup(object obj)
{
return Portal.Setup(obj);
}
public static new DialogResult Update(object obj)
{
return UpdateBase(obj, "1.1.0", "1.0.2", false, new InstallAction(ActionTypes.AddCustomErrorsPage));
}
}
/// Release 1.0.2
/// </summary>
public class Portal102 : Portal101
{
public static new object Install(object obj)
{
return Portal101.InstallBase(obj, "1.0.0");
}
public static new DialogResult Uninstall(object obj)
{
return Portal101.Uninstall(obj);
}
public static new DialogResult Setup(object obj)
{
return Portal101.Setup(obj);
}
public static new DialogResult Update(object obj)
{
return UpdateBase(obj, "1.0.0", "1.0.1", false);
}
}
/// <summary>
/// Release 1.0.1
/// </summary>
public class Portal101 : Portal10
{
public static new object Install(object obj)
{
return Portal10.InstallBase(obj, "1.0.0");
}
public static new DialogResult Uninstall(object obj)
{
return Portal10.Uninstall(obj);
}
public static new DialogResult Setup(object obj)
{
return Portal10.Setup(obj);
}
public static new DialogResult Update(object obj)
{
return UpdateBase(obj, "1.0.0", "1.0", false);
}
}
/// <summary>
/// Release 1.0
/// </summary>
public class Portal10 : Portal
{
public static new object Install(object obj)
{
return Portal.InstallBase(obj, "1.0.0");
}
public static new DialogResult Uninstall(object obj)
{
return Portal.Uninstall(obj);
}
public static new DialogResult Setup(object obj)
{
return Portal.Setup(obj);
}
}
}

View file

@ -0,0 +1,49 @@
// 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.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("WebsitePanel Setup Library")]
[assembly: AssemblyDescription("WebsitePanel Setup Library")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyProduct("WebsitePanel Setup Library")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("CBDE9448-42D2-4046-A6E7-F2662C7B5D4B")]

View file

@ -0,0 +1,77 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.1
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace WebsitePanel.Setup.Properties {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("WebsitePanel.Setup.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
internal static System.Drawing.Bitmap BannerImage {
get {
object obj = ResourceManager.GetObject("BannerImage", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
internal static System.Drawing.Bitmap MarginImage {
get {
object obj = ResourceManager.GetObject("MarginImage", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
}
}

View file

@ -0,0 +1,127 @@
<?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>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="BannerImage" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\BannerImage.GIF;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="MarginImage" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\MarginImage.GIF;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

Binary file not shown.

After

Width:  |  Height:  |  Size: 875 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View file

@ -0,0 +1,288 @@
// 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.Xml;
using System.Configuration;
using System.Windows.Forms;
using System.Collections;
using System.Text;
using WebsitePanel.Setup.Actions;
namespace WebsitePanel.Setup
{
public class Server : BaseSetup
{
public static object Install(object obj)
{
return InstallBase(obj, "1.0.1");
}
internal static object InstallBase(object obj, string minimalInstallerVersion)
{
Hashtable args = Utils.GetSetupParameters(obj);
//check CS version
string shellVersion = Utils.GetStringSetupParameter(args, Global.Parameters.ShellVersion);
var shellMode = Utils.GetStringSetupParameter(args, Global.Parameters.ShellMode);
Version version = new Version(shellVersion);
//
var setupVariables = new SetupVariables
{
SetupAction = SetupActions.Install,
IISVersion = Global.IISVersion
};
//
InitInstall(args, setupVariables);
//Unattended setup
LoadSetupVariablesFromSetupXml(setupVariables.SetupXml, setupVariables);
//
var sam = new ServerActionManager(setupVariables);
// Prepare installation defaults
sam.PrepareDistributiveDefaults();
// Silent Installer Mode
if (shellMode.Equals(Global.SilentInstallerShell, StringComparison.OrdinalIgnoreCase))
{
if (version < new Version(minimalInstallerVersion))
{
Utils.ShowConsoleErrorMessage(Global.Messages.InstallerVersionIsObsolete, minimalInstallerVersion);
//
return false;
}
try
{
var success = true;
//
setupVariables.ServerPassword = Utils.GetStringSetupParameter(args, Global.Parameters.ServerPassword);
//
sam.ActionError += new EventHandler<ActionErrorEventArgs>((object sender, ActionErrorEventArgs e) =>
{
Utils.ShowConsoleErrorMessage(e.ErrorMessage);
//
Log.WriteError(e.ErrorMessage);
//
success = false;
});
//
sam.Start();
//
return success;
}
catch (Exception ex)
{
Log.WriteError("Failed to install the component", ex);
//
return false;
}
}
else
{
if (version < new Version(minimalInstallerVersion))
{
MessageBox.Show(String.Format(Global.Messages.InstallerVersionIsObsolete, minimalInstallerVersion), "Setup Wizard", MessageBoxButtons.OK, MessageBoxIcon.Warning);
//
return DialogResult.Cancel;
}
var form = new InstallerForm();
var wizard = form.Wizard;
wizard.SetupVariables = setupVariables;
//
wizard.ActionManager = sam;
//create wizard pages
var introPage = new IntroductionPage();
var licPage = new LicenseAgreementPage();
//
var page1 = new ConfigurationCheckPage();
page1.Checks.AddRange(new ConfigurationCheck[]
{
new ConfigurationCheck(CheckTypes.OperationSystem, "Operating System Requirement"),
new ConfigurationCheck(CheckTypes.IISVersion, "IIS Requirement"),
new ConfigurationCheck(CheckTypes.ASPNET, "ASP.NET Requirement")
});
//
var page2 = new InstallFolderPage();
var page3 = new WebPage();
var page4 = new UserAccountPage();
var page5 = new ServerPasswordPage();
var page6 = new ExpressInstallPage2();
var page7 = new FinishPage();
//
wizard.Controls.AddRange(new Control[] { introPage, licPage, page1, page2, page3, page4, page5, page6, page7 });
wizard.LinkPages();
wizard.SelectedPage = introPage;
//show wizard
IWin32Window owner = args["ParentForm"] as IWin32Window;
return form.ShowModal(owner);
}
}
public static object Uninstall(object obj)
{
Hashtable args = Utils.GetSetupParameters(obj);
//
string shellVersion = Utils.GetStringSetupParameter(args, Global.Parameters.ShellVersion);
//
var setupVariables = new SetupVariables
{
ComponentId = Utils.GetStringSetupParameter(args, Global.Parameters.ComponentId),
SetupAction = SetupActions.Uninstall,
IISVersion = Global.IISVersion
};
//
AppConfig.LoadConfiguration();
InstallerForm form = new InstallerForm();
Wizard wizard = form.Wizard;
wizard.SetupVariables = setupVariables;
AppConfig.LoadComponentSettings(wizard.SetupVariables);
IntroductionPage page1 = new IntroductionPage();
ConfirmUninstallPage page2 = new ConfirmUninstallPage();
UninstallPage page3 = new UninstallPage();
page2.UninstallPage = page3;
FinishPage page4 = new FinishPage();
wizard.Controls.AddRange(new Control[] { page1, page2, page3, page4 });
wizard.LinkPages();
wizard.SelectedPage = page1;
//show wizard
IWin32Window owner = args[Global.Parameters.ParentForm] as IWin32Window;
return form.ShowModal(owner);
}
public static object Setup(object obj)
{
var args = Utils.GetSetupParameters(obj);
var shellVersion = Utils.GetStringSetupParameter(args, Global.Parameters.ShellVersion);
//
var setupVariables = new SetupVariables
{
ComponentId = Utils.GetStringSetupParameter(args, Global.Parameters.ComponentId),
SetupAction = SetupActions.Setup,
IISVersion = Global.IISVersion,
ConfigurationFile = "web.config"
};
//
AppConfig.LoadConfiguration();
InstallerForm form = new InstallerForm();
Wizard wizard = form.Wizard;
//
wizard.SetupVariables = setupVariables;
//
AppConfig.LoadComponentSettings(wizard.SetupVariables);
WebPage page1 = new WebPage();
ServerPasswordPage page2 = new ServerPasswordPage();
ExpressInstallPage page3 = new ExpressInstallPage();
//create install actions
InstallAction action = new InstallAction(ActionTypes.UpdateWebSite);
action.Description = "Updating web site...";
page3.Actions.Add(action);
action = new InstallAction(ActionTypes.UpdateServerPassword);
action.Description = "Updating server password...";
page3.Actions.Add(action);
action = new InstallAction(ActionTypes.UpdateConfig);
action.Description = "Updating system configuration...";
page3.Actions.Add(action);
FinishPage page4 = new FinishPage();
wizard.Controls.AddRange(new Control[] { page1, page2, page3, page4 });
wizard.LinkPages();
wizard.SelectedPage = page1;
//show wizard
IWin32Window owner = args[Global.Parameters.ParentForm] as IWin32Window;
return form.ShowModal(owner);
}
public static object Update(object obj)
{
Hashtable args = Utils.GetSetupParameters(obj);
var setupVariables = new SetupVariables
{
ComponentId = Utils.GetStringSetupParameter(args, Global.Parameters.ComponentId),
SetupAction = SetupActions.Update,
BaseDirectory = Utils.GetStringSetupParameter(args, Global.Parameters.BaseDirectory),
UpdateVersion = Utils.GetStringSetupParameter(args, "UpdateVersion"),
InstallerFolder = Utils.GetStringSetupParameter(args, Global.Parameters.InstallerFolder),
Installer = Utils.GetStringSetupParameter(args, Global.Parameters.Installer),
InstallerType = Utils.GetStringSetupParameter(args, Global.Parameters.InstallerType),
InstallerPath = Utils.GetStringSetupParameter(args, Global.Parameters.InstallerPath)
};
AppConfig.LoadConfiguration();
InstallerForm form = new InstallerForm();
Wizard wizard = form.Wizard;
//
wizard.SetupVariables = setupVariables;
//
AppConfig.LoadComponentSettings(wizard.SetupVariables);
IntroductionPage introPage = new IntroductionPage();
LicenseAgreementPage licPage = new LicenseAgreementPage();
ExpressInstallPage page2 = new ExpressInstallPage();
//create install currentScenario
InstallAction action = new InstallAction(ActionTypes.Backup);
action.Description = "Backing up...";
page2.Actions.Add(action);
action = new InstallAction(ActionTypes.DeleteFiles);
action.Description = "Deleting files...";
action.Path = "setup\\delete.txt";
page2.Actions.Add(action);
action = new InstallAction(ActionTypes.CopyFiles);
action.Description = "Copying files...";
page2.Actions.Add(action);
action = new InstallAction(ActionTypes.UpdateConfig);
action.Description = "Updating system configuration...";
page2.Actions.Add(action);
FinishPage page3 = new FinishPage();
wizard.Controls.AddRange(new Control[] { introPage, licPage, page2, page3 });
wizard.LinkPages();
wizard.SelectedPage = introPage;
//show wizard
IWin32Window owner = args[Global.Parameters.ParentForm] as IWin32Window;
return form.ShowModal(owner);
}
}
}

View file

@ -0,0 +1,132 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using WebsitePanel.Setup.Actions;
namespace WebsitePanel.Setup
{
/// <summary>
/// Release 1.2.0
/// </summary>
public class Server120 : Server
{
public static new object Install(object obj)
{
//
return Server.InstallBase(obj, "1.1.0");
}
public static new object Uninstall(object obj)
{
return Server.Uninstall(obj);
}
public static new object Setup(object obj)
{
return Server.Setup(obj);
}
public static new object Update(object obj)
{
return Server.UpdateBase(obj, "1.2.0", "1.1.2", false, new InstallAction(ActionTypes.SwitchServer2AspNet40));
}
}
/// <summary>
/// Release 1.1.0
/// </summary>
public class Server110 : Server
{
public static new object Install(object obj)
{
return Server.InstallBase(obj, "1.1.0");
}
public static new object Uninstall(object obj)
{
return Server.Uninstall(obj);
}
public static new object Setup(object obj)
{
return Server.Setup(obj);
}
public static new object Update(object obj)
{
return UpdateBase(obj, "1.1.0", "1.0.2", false);
}
}
/// Release 1.0.2
/// </summary>
public class Server102 : Server101
{
public static new object Install(object obj)
{
return Server101.InstallBase(obj, "1.0.0");
}
public static new object Uninstall(object obj)
{
return Server101.Uninstall(obj);
}
public static new object Setup(object obj)
{
return Server101.Setup(obj);
}
public static new object Update(object obj)
{
return UpdateBase(obj, "1.0.0", "1.0.1", false);
}
}
/// <summary>
/// Release 1.0.1
/// </summary>
public class Server101 : Server10
{
public static new object Install(object obj)
{
return Server10.InstallBase(obj, "1.0.0");
}
public static new object Uninstall(object obj)
{
return Server10.Uninstall(obj);
}
public static new object Setup(object obj)
{
return Server10.Setup(obj);
}
public static new object Update(object obj)
{
return UpdateBase(obj, "1.0.0", "1.0", false);
}
}
/// <summary>
/// Release 1.0
/// </summary>
public class Server10 : Server
{
public static new object Install(object obj)
{
return Server.InstallBase(obj, "1.0.0");
}
public static new object Uninstall(object obj)
{
return Server.Uninstall(obj);
}
public static new object Setup(object obj)
{
return Server.Setup(obj);
}
}
}

View file

@ -0,0 +1,369 @@
// 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.Xml;
using System.Configuration;
using System.Windows.Forms;
using System.Collections;
using System.Text;
using WebsitePanel.Setup.Web;
using WebsitePanel.Setup.Actions;
using System.Threading;
namespace WebsitePanel.Setup
{
public class StandaloneServerSetup : BaseSetup
{
public static object Install(object obj)
{
return InstallBase(obj, "1.0.6");
}
internal static object InstallBase(object obj, string minimalInstallerVersion)
{
Hashtable args = Utils.GetSetupParameters(obj);
//check CS version
string shellVersion = Utils.GetStringSetupParameter(args, Global.Parameters.ShellVersion);
var shellMode = Utils.GetStringSetupParameter(args, Global.Parameters.ShellMode);
Version version = new Version(shellVersion);
//******************** Server ****************
var serverSetup = new SetupVariables
{
ComponentId = Guid.NewGuid().ToString(),
Instance = String.Empty,
ComponentName = Global.Server.ComponentName,
ComponentCode = Global.Server.ComponentCode,
ComponentDescription = Global.Server.ComponentDescription,
//
ServerPassword = Guid.NewGuid().ToString("N").Substring(0, 10),
//
SetupAction = SetupActions.Install,
IISVersion = Global.IISVersion,
ApplicationName = Utils.GetStringSetupParameter(args, Global.Parameters.ApplicationName),
Version = Utils.GetStringSetupParameter(args, Global.Parameters.Version),
Installer = Utils.GetStringSetupParameter(args, Global.Parameters.Installer),
InstallerPath = Utils.GetStringSetupParameter(args, Global.Parameters.InstallerPath),
SetupXml = Utils.GetStringSetupParameter(args, Global.Parameters.SetupXml),
//
InstallerFolder = Path.Combine(Utils.GetStringSetupParameter(args, Global.Parameters.InstallerFolder), Global.Server.ComponentName),
InstallerType = Utils.GetStringSetupParameter(args, Global.Parameters.InstallerType).Replace(Global.StandaloneServer.SetupController, Global.Server.SetupController),
InstallationFolder = Path.Combine(Path.Combine(Utils.GetSystemDrive(), "WebsitePanel"), Global.Server.ComponentName),
ConfigurationFile = "web.config",
};
// Load config file
AppConfig.LoadConfiguration();
//
LoadComponentVariablesFromSetupXml(serverSetup.ComponentCode, serverSetup.SetupXml, serverSetup);
//
//serverSetup.ComponentConfig = AppConfig.CreateComponentConfig(serverSetup.ComponentId);
//serverSetup.RemoteServerUrl = GetUrl(serverSetup.WebSiteDomain, serverSetup.WebSiteIP, serverSetup.WebSitePort);
//
//CreateComponentSettingsFromSetupVariables(serverSetup, serverSetup.ComponentId);
//******************** Enterprise Server ****************
var esServerSetup = new SetupVariables
{
ComponentId = Guid.NewGuid().ToString(),
SetupAction = SetupActions.Install,
IISVersion = Global.IISVersion,
//
Instance = String.Empty,
ComponentName = Global.EntServer.ComponentName,
ComponentCode = Global.EntServer.ComponentCode,
ApplicationName = Utils.GetStringSetupParameter(args, Global.Parameters.ApplicationName),
Version = Utils.GetStringSetupParameter(args, Global.Parameters.Version),
ComponentDescription = Global.EntServer.ComponentDescription,
Installer = Utils.GetStringSetupParameter(args, Global.Parameters.Installer),
InstallerFolder = Path.Combine(Utils.GetStringSetupParameter(args, Global.Parameters.InstallerFolder), Global.EntServer.ComponentName),
InstallerType = Utils.GetStringSetupParameter(args, Global.Parameters.InstallerType).Replace(Global.StandaloneServer.SetupController, Global.EntServer.SetupController),
InstallationFolder = Path.Combine(Path.Combine(Utils.GetSystemDrive(), "WebsitePanel"), Global.EntServer.ComponentName),
InstallerPath = Utils.GetStringSetupParameter(args, Global.Parameters.InstallerPath),
SetupXml = Utils.GetStringSetupParameter(args, Global.Parameters.SetupXml),
//
ConfigurationFile = "web.config",
ConnectionString = Global.EntServer.AspNetConnectionStringFormat,
DatabaseServer = Global.EntServer.DefaultDbServer,
Database = Global.EntServer.DefaultDatabase,
CreateDatabase = true,
UpdateServerAdminPassword = true,
//
WebSiteIP = Global.EntServer.DefaultIP,
WebSitePort = Global.EntServer.DefaultPort,
WebSiteDomain = String.Empty,
};
//
LoadComponentVariablesFromSetupXml(esServerSetup.ComponentCode, esServerSetup.SetupXml, esServerSetup);
//
//esServerSetup.ComponentConfig = AppConfig.CreateComponentConfig(esServerSetup.ComponentId);
//
//CreateComponentSettingsFromSetupVariables(esServerSetup, esServerSetup.ComponentId);
//******************** Portal ****************
#region Portal Setup Variables
var portalSetup = new SetupVariables
{
ComponentId = Guid.NewGuid().ToString(),
SetupAction = SetupActions.Install,
IISVersion = Global.IISVersion,
//
Instance = String.Empty,
ComponentName = Global.WebPortal.ComponentName,
ComponentCode = Global.WebPortal.ComponentCode,
ApplicationName = Utils.GetStringSetupParameter(args, Global.Parameters.ApplicationName),
Version = Utils.GetStringSetupParameter(args, Global.Parameters.Version),
ComponentDescription = Global.WebPortal.ComponentDescription,
Installer = Utils.GetStringSetupParameter(args, Global.Parameters.Installer),
InstallerFolder = Path.Combine(Utils.GetStringSetupParameter(args, Global.Parameters.InstallerFolder), Global.WebPortal.ComponentName),
InstallerType = Utils.GetStringSetupParameter(args, Global.Parameters.InstallerType).Replace(Global.StandaloneServer.SetupController, Global.WebPortal.SetupController),
InstallationFolder = Path.Combine(Path.Combine(Utils.GetSystemDrive(), "WebsitePanel"), Global.WebPortal.ComponentName),
InstallerPath = Utils.GetStringSetupParameter(args, Global.Parameters.InstallerPath),
SetupXml = Utils.GetStringSetupParameter(args, Global.Parameters.SetupXml),
//
ConfigurationFile = "web.config",
EnterpriseServerURL = Global.WebPortal.DefaultEntServURL,
};
//
LoadComponentVariablesFromSetupXml(portalSetup.ComponentCode, portalSetup.SetupXml, portalSetup);
//
//portalSetup.ComponentConfig = AppConfig.CreateComponentConfig(portalSetup.ComponentId);
//
//CreateComponentSettingsFromSetupVariables(portalSetup, portalSetup.ComponentId);
#endregion
//
var stdssam = new StandaloneServerActionManager(serverSetup, esServerSetup, portalSetup);
//
stdssam.PrepareDistributiveDefaults();
//
if (shellMode.Equals(Global.SilentInstallerShell, StringComparison.OrdinalIgnoreCase))
{
// Validate the setup controller's bootstrapper version
if (version < new Version(minimalInstallerVersion))
{
Utils.ShowConsoleErrorMessage(Global.Messages.InstallerVersionIsObsolete, minimalInstallerVersion);
//
return false;
}
try
{
var success = true;
// Retrieve WebsitePanel Enterprise Server component's settings from the command-line
var adminPassword = Utils.GetStringSetupParameter(args, Global.Parameters.ServerAdminPassword);
// This has been designed to make an installation process via Web PI more secure
if (String.IsNullOrEmpty(adminPassword))
{
// Set serveradmin password
esServerSetup.ServerAdminPassword = Guid.NewGuid().ToString();
// Set peer admin password
esServerSetup.PeerAdminPassword = Guid.NewGuid().ToString();
// Instruct provisioning scenario to enter the application in SCPA mode (Setup Control Panel Acounts)
esServerSetup.EnableScpaMode = true;
}
else
{
esServerSetup.ServerAdminPassword = esServerSetup.PeerAdminPassword = adminPassword;
}
//
esServerSetup.Database = Utils.GetStringSetupParameter(args, Global.Parameters.DatabaseName);
esServerSetup.DatabaseServer = Utils.GetStringSetupParameter(args, Global.Parameters.DatabaseServer);
esServerSetup.DbInstallConnectionString = SqlUtils.BuildDbServerMasterConnectionString(
esServerSetup.DatabaseServer,
Utils.GetStringSetupParameter(args, Global.Parameters.DbServerAdmin),
Utils.GetStringSetupParameter(args, Global.Parameters.DbServerAdminPassword)
);
//
stdssam.ActionError += new EventHandler<ActionErrorEventArgs>((object sender, ActionErrorEventArgs e) =>
{
Utils.ShowConsoleErrorMessage(e.ErrorMessage);
//
Log.WriteError(e.ErrorMessage);
//
success = false;
});
//
stdssam.Start();
//
return success;
}
catch (Exception ex)
{
Log.WriteError("Failed to install the component", ex);
//
return false;
}
}
else
{
// Validate the setup controller's bootstrapper version
if (version < new Version(minimalInstallerVersion))
{
MessageBox.Show(String.Format(Global.Messages.InstallerVersionIsObsolete, minimalInstallerVersion),
"Setup Wizard", MessageBoxButtons.OK, MessageBoxIcon.Warning);
//
return DialogResult.Cancel;
}
// NOTE: there is no assignment to SetupVariables property of the wizard as usually because we have three components
// to setup here and thus we have created SwapSetupVariablesAction setup action to swap corresponding variables
// back and forth while executing the installation scenario.
InstallerForm form = new InstallerForm();
Wizard wizard = form.Wizard;
wizard.SetupVariables = serverSetup;
// Assign corresponding action manager to the wizard.
wizard.ActionManager = stdssam;
// Initialize wizard pages and their properties
var introPage = new IntroductionPage();
var licPage = new LicenseAgreementPage();
var page2 = new ConfigurationCheckPage();
// Setup prerequisites validation
page2.Checks.AddRange(new ConfigurationCheck[] {
new ConfigurationCheck(CheckTypes.OperationSystem, "Operating System Requirement"),
new ConfigurationCheck(CheckTypes.IISVersion, "IIS Requirement"),
new ConfigurationCheck(CheckTypes.ASPNET, "ASP.NET Requirement"),
// Validate Server installation prerequisites
new ConfigurationCheck(CheckTypes.WPServer, "WebsitePanel Server Requirement") { SetupVariables = serverSetup },
// Validate EnterpriseServer installation prerequisites
new ConfigurationCheck(CheckTypes.WPEnterpriseServer, "WebsitePanel Enterprise Server Requirement") { SetupVariables = esServerSetup },
// Validate WebPortal installation prerequisites
new ConfigurationCheck(CheckTypes.WPPortal, "WebsitePanel Portal Requirement") { SetupVariables = portalSetup }
});
// Assign WebPortal setup variables set to acquire corresponding settings
var page3 = new WebPage { SetupVariables = portalSetup };
// Assign EnterpriseServer setup variables set to acquire corresponding settings
var page4 = new DatabasePage { SetupVariables = esServerSetup };
// Assign EnterpriseServer setup variables set to acquire corresponding settings
var page5 = new ServerAdminPasswordPage
{
SetupVariables = esServerSetup,
NoteText = "Note: Both serveradmin and admin accounts will use this password. You can always change password for serveradmin or admin accounts through control panel."
};
//
var page6 = new ExpressInstallPage2();
// Assign WebPortal setup variables set to acquire corresponding settings
var page7 = new SetupCompletePage { SetupVariables = portalSetup };
//
wizard.Controls.AddRange(new Control[] { introPage, licPage, page2, page3, page4, page5, page6, page7 });
wizard.LinkPages();
wizard.SelectedPage = introPage;
// Run wizard
IWin32Window owner = args[Global.Parameters.ParentForm] as IWin32Window;
return form.ShowModal(owner);
}
}
public static DialogResult Uninstall(object obj)
{
MessageBox.Show("Functionality is not supported.", "Setup Wizard", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return DialogResult.Cancel;
}
public static DialogResult Setup(object obj)
{
MessageBox.Show("Functionality is not supported.", "Setup Wizard", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return DialogResult.Cancel;
}
public static DialogResult Update(object obj)
{
MessageBox.Show("Functionality is not supported.", "Setup Wizard", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return DialogResult.Cancel;
}
protected static void LoadComponentVariablesFromSetupXml(string componentCode, string xml, SetupVariables setupVariables)
{
if (string.IsNullOrEmpty(componentCode))
return;
if (string.IsNullOrEmpty(xml))
return;
try
{
XmlDocument doc = new XmlDocument();
doc.LoadXml(xml);
string xpath = string.Format("components/component[@code=\"{0}\"]", componentCode);
XmlNode componentNode = doc.SelectSingleNode(xpath);
if (componentNode != null)
{
LoadSetupVariablesFromSetupXml(componentNode.InnerXml, setupVariables);
}
}
catch (Exception ex)
{
Log.WriteError("Unattended setup error", ex);
throw;
}
}
private static string GetUrl(string domain, string ip, string port)
{
string address = "http://";
string server = string.Empty;
string ipPort = string.Empty;
//server
if (domain != null && domain.Trim().Length > 0)
{
//domain
server = domain.Trim();
}
else
{
//ip
if (ip != null && ip.Trim().Length > 0)
{
server = ip.Trim();
}
}
//port
if (server.Length > 0 &&
ip.Trim().Length > 0 &&
ip.Trim() != "80")
{
ipPort = ":" + port.Trim();
}
//address string
address += server + ipPort;
return address;
}
}
}

View file

@ -0,0 +1,62 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
namespace WebsitePanel.Setup
{
/// <summary>
/// Release 1.2.0
/// </summary>
public class StandaloneServerSetup120 : StandaloneServerSetup
{
public static new object Install(object obj)
{
return StandaloneServerSetup.InstallBase(obj, "1.2.0");
}
}
/// <summary>
/// Release 1.1.0
/// </summary>
public class StandaloneServerSetup110 : StandaloneServerSetup
{
public static new object Install(object obj)
{
return StandaloneServerSetup.InstallBase(obj, "1.1.0");
}
}
/// <summary>
/// Release 1.0.2
/// </summary>
public class StandaloneServerSetup102 : StandaloneServerSetup101
{
public static new object Install(object obj)
{
return StandaloneServerSetup.InstallBase(obj, "1.0.0");
}
}
/// <summary>
/// Release 1.0.1
/// </summary>
public class StandaloneServerSetup101 : StandaloneServerSetup
{
public static new object Install(object obj)
{
return StandaloneServerSetup.InstallBase(obj, "1.0.0");
}
}
/// <summary>
/// Release 1.0
/// </summary>
public class StandaloneServerSetup10 : StandaloneServerSetup
{
public static new object Install(object obj)
{
return StandaloneServerSetup.InstallBase(obj, "1.0.0");
}
}
}

View file

@ -0,0 +1,55 @@
// 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.Text;
namespace WebsitePanel.Setup.Web
{
/// <summary>
/// ASP.NET versions
/// </summary>
public enum AspNetVersion
{
/// <summary>
/// Uknown version
/// </summary>
Unknown = 0,
/// <summary>
/// ASP.NET 1.1
/// </summary>
AspNet11 = 1,
/// <summary>
/// ASP.NET 2.0
/// </summary>
AspNet20 = 2
}
}

View file

@ -0,0 +1,90 @@
// 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;
namespace WebsitePanel.Setup.Web
{
/// <summary>
/// Summary description for ServerBinding.
/// </summary>
[Serializable]
public sealed class ServerBinding
{
private string ip;
private string port;
private string host;
/// <summary>
/// Initializes a new instance of the class.
/// </summary>
public ServerBinding()
{
}
/// <summary>
/// Initializes a new instance of the class.
/// </summary>
/// <param name="ip">IP address.</param>
/// <param name="port">TCP port.</param>
/// <param name="host">Host header value.</param>
public ServerBinding(string ip, string port, string host)
{
this.ip = ip;
this.port = port;
this.host = host;
}
/// <summary>
/// IP address.
/// </summary>
public string IP
{
get { return ip; }
set { ip = value; }
}
/// <summary>
/// TCP port.
/// </summary>
public string Port
{
get { return port; }
set { port = value; }
}
/// <summary>
/// Host header value.
/// </summary>
public string Host
{
get { return host; }
set { host = value; }
}
}
}

View file

@ -0,0 +1,54 @@
// 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;
namespace WebsitePanel.Setup.Web
{
/// <summary>
/// Server states.
/// </summary>
[Serializable]
public enum ServerState
{
/// <summary>Starting</summary>
Starting = 1,
/// <summary>Started</summary>
Started = 2,
/// <summary>Stopping</summary>
Stopping = 3,
/// <summary>Stopped</summary>
Stopped = 4,
/// <summary>Pausing</summary>
Pausing = 5,
/// <summary>Paused</summary>
Paused = 6,
/// <summary>Continuing</summary>
Continuing = 7
}
}

View file

@ -0,0 +1,52 @@
// 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.
namespace WebsitePanel.Setup.Web
{
/// <summary>
/// Web Extension statuses
/// </summary>
public enum WebExtensionStatus
{
/// <summary>
/// Not installed
/// </summary>
NotInstalled = 0,
/// <summary>
/// Enabled
/// </summary>
Allowed = 1,
/// <summary>
/// Disabled
/// </summary>
Prohibited = 2,
}
}

View file

@ -0,0 +1,87 @@
// 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;
namespace WebsitePanel.Setup.Web
{
/// <summary>
/// Web site item.
/// </summary>
[Serializable]
public sealed class WebSiteItem : WebVirtualDirectoryItem
{
private string siteId;
private string siteIPAddress;
private string logFileDirectory;
private ServerBinding[] bindings;
/// <summary>
/// Initializes a new instance of the class.
/// </summary>
public WebSiteItem()
{
}
/// <summary>
/// Site id.
/// </summary>
public string SiteId
{
get { return siteId; }
set { siteId = value; }
}
/// <summary>
/// Site IP address.
/// </summary>
public string SiteIPAddress
{
get { return siteIPAddress; }
set { siteIPAddress = value; }
}
/// <summary>
/// Site log file directory.
/// </summary>
public string LogFileDirectory
{
get { return logFileDirectory; }
set { logFileDirectory = value; }
}
/// <summary>
/// Site bindings.
/// </summary>
public ServerBinding[] Bindings
{
get { return bindings; }
set { bindings = value; }
}
}
}

View file

@ -0,0 +1,219 @@
// 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;
namespace WebsitePanel.Setup.Web
{
/// <summary>
/// Virtual directory item.
/// </summary>
[Serializable]
public class WebVirtualDirectoryItem
{
private bool allowExecuteAccess;
private bool allowScriptAccess;
private bool allowSourceAccess;
private bool allowReadAccess;
private bool allowWriteAccess;
private string anonymousUsername;
private string anonymousUserPassword;
private string contentPath;
private bool allowDirectoryBrowsingAccess;
private bool authAnonymous;
private bool authWindows;
private bool authBasic;
private string defaultDocs;
private string httpRedirect;
private string name;
private AspNetVersion installedDotNetFramework;
private string applicationPool;
/// <summary>
/// Initializes a new instance of the class.
/// </summary>
public WebVirtualDirectoryItem()
{
}
/// <summary>
/// Name
/// </summary>
public string Name
{
get { return name; }
set { name = value; }
}
/// <summary>
/// Allow script access
/// </summary>
public bool AllowScriptAccess
{
get { return allowScriptAccess; }
set { allowScriptAccess = value; }
}
/// <summary>
/// Allow source access
/// </summary>
public bool AllowSourceAccess
{
get { return allowSourceAccess; }
set { allowSourceAccess = value; }
}
/// <summary>
/// Allow read access
/// </summary>
public bool AllowReadAccess
{
get { return allowReadAccess; }
set { allowReadAccess = value; }
}
/// <summary>
/// Allow write access
/// </summary>
public bool AllowWriteAccess
{
get { return allowWriteAccess; }
set { allowWriteAccess = value; }
}
/// <summary>
/// Anonymous user name
/// </summary>
public string AnonymousUsername
{
get { return anonymousUsername; }
set { anonymousUsername = value; }
}
/// <summary>
/// Anonymous user password
/// </summary>
public string AnonymousUserPassword
{
get { return anonymousUserPassword; }
set { anonymousUserPassword = value; }
}
/// <summary>
/// Allow execute access
/// </summary>
public bool AllowExecuteAccess
{
get { return allowExecuteAccess; }
set { allowExecuteAccess = value; }
}
/// <summary>
/// Content path
/// </summary>
public string ContentPath
{
get { return contentPath; }
set { contentPath = value; }
}
/// <summary>
/// Http redirect
/// </summary>
public string HttpRedirect
{
get { return httpRedirect; }
set { httpRedirect = value; }
}
/// <summary>
/// Default documents
/// </summary>
public string DefaultDocs
{
get { return defaultDocs; }
set { defaultDocs = value; }
}
/// <summary>
/// Allow directory browsing access
/// </summary>
public bool AllowDirectoryBrowsingAccess
{
get { return allowDirectoryBrowsingAccess; }
set { allowDirectoryBrowsingAccess = value; }
}
/// <summary>
/// Anonymous access.
/// </summary>
public bool AuthAnonymous
{
get { return this.authAnonymous; }
set { this.authAnonymous = value; }
}
/// <summary>
/// Basic authentication.
/// </summary>
public bool AuthBasic
{
get { return this.authBasic; }
set { this.authBasic = value; }
}
/// <summary>
/// Integrated Windows authentication.
/// </summary>
public bool AuthWindows
{
get { return this.authWindows; }
set { this.authWindows = value; }
}
/// <summary>
/// Installed ASP.NET version
/// </summary>
public AspNetVersion InstalledDotNetFramework
{
get { return this.installedDotNetFramework; }
set { this.installedDotNetFramework = value; }
}
/// <summary>
/// Application pool
/// </summary>
public string ApplicationPool
{
get { return applicationPool; }
set { applicationPool = value; }
}
}
}

View file

@ -0,0 +1,410 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.21022</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{3951C0EC-BD98-450E-B228-CDBE5BD4AD49}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>WebsitePanel.Setup</RootNamespace>
<AssemblyName>Setup</AssemblyName>
<FileUpgradeFlags>
</FileUpgradeFlags>
<OldToolsVersion>3.5</OldToolsVersion>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\Build\debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>none</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\..\Build\release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="Ionic.Zip.Reduced, Version=1.8.4.28, Culture=neutral, PublicKeyToken=edbe51ad942a3f5c, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\Lib\Ionic.Zip.Reduced.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Web.Administration, Version=7.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\Lib\Microsoft.Web.Administration.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.Web.Management, Version=7.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\Lib\Microsoft.Web.Management.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.Web.Services3, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\Lib\Microsoft.Web.Services3.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.configuration" />
<Reference Include="System.Data" />
<Reference Include="System.DirectoryServices" />
<Reference Include="System.Drawing" />
<Reference Include="System.Management" />
<Reference Include="System.ServiceProcess" />
<Reference Include="System.Web.Services" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="System.Xml.Linq" />
<Reference Include="WebsitePanel.EnterpriseServer.Base, Version=1.1.1.0, Culture=neutral, PublicKeyToken=da8782a6fc4d0081, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\WebsitePanel\Trunk\Bin\WebsitePanel.EnterpriseServer.Base.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="WebsitePanel.EnterpriseServer.Client, Version=1.1.1.0, Culture=neutral, PublicKeyToken=da8782a6fc4d0081, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\WebsitePanel\Trunk\Bin\WebsitePanel.EnterpriseServer.Client.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="WebsitePanel.Providers.Base">
<HintPath>..\..\..\..\WebsitePanel\Trunk\Bin\WebsitePanel.Providers.Base.dll</HintPath>
<Private>False</Private>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="..\VersionInfo.cs">
<Link>VersionInfo.cs</Link>
</Compile>
<Compile Include="Actions\BaseActionManager.cs" />
<Compile Include="Actions\EntServerActionManager.cs" />
<Compile Include="Actions\IInstallAction.cs" />
<Compile Include="Actions\IPrepareDefaultsAction.cs" />
<Compile Include="Actions\IPrerequisiteAction.cs" />
<Compile Include="Actions\IUninstallAction.cs" />
<Compile Include="Actions\ServerActionManager.cs" />
<Compile Include="Actions\StandaloneServerActionManager.cs" />
<Compile Include="Actions\WebPortalActionManager.cs" />
<Compile Include="Common\AppConfig.cs" />
<Compile Include="Common\ConfigurationCheck.cs" />
<Compile Include="Common\CopyProcess.cs" />
<Compile Include="Common\CRC32.cs" />
<Compile Include="Common\ES.cs" />
<Compile Include="Common\FileUtils.cs" />
<Compile Include="Common\Global.cs" />
<Compile Include="Common\InstallAction.cs" />
<Compile Include="Common\InstallLog.cs" />
<Compile Include="Common\Log.cs" />
<Compile Include="Common\OS.cs" />
<Compile Include="Common\RegistryUtils.cs" />
<Compile Include="Common\RollBack.cs" />
<Compile Include="Common\RollBackProcess.cs" />
<Compile Include="Common\SecurityEnums.cs" />
<Compile Include="Common\SecurityUtils.cs" />
<Compile Include="Common\SetupActions.cs" />
<Compile Include="Common\SetupVariables.cs" />
<Compile Include="Common\SqlServerItem.cs" />
<Compile Include="Common\SqlProcess.cs" />
<Compile Include="Common\SqlUtils.cs" />
<Compile Include="Common\ServerItem.cs" />
<Compile Include="Common\Utils.cs" />
<Compile Include="Common\WebException.cs" />
<Compile Include="Common\WebUtils.cs" />
<Compile Include="Common\WmiHelper.cs" />
<Compile Include="Common\XmlUtils.cs" />
<Compile Include="Common\ZipIndicator.cs" />
<Compile Include="EnterpriseServer10.cs" />
<Compile Include="Portal10.cs" />
<Compile Include="Server10.cs" />
<Compile Include="StandaloneServerSetup.cs" />
<Compile Include="EnterpriseServer.cs" />
<Compile Include="Portal.cs" />
<Compile Include="Server.cs" />
<Compile Include="BaseSetup.cs" />
<Compile Include="Forms\InstallerForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Forms\InstallerForm.Designer.cs">
<DependentUpon>InstallerForm.cs</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="StandaloneServerSetup10.cs" />
<Compile Include="Web\AspNetVersion.cs" />
<Compile Include="Web\ServerBinding.cs" />
<Compile Include="Web\ServerState.cs" />
<Compile Include="Web\WebExtensionStatus.cs" />
<Compile Include="Web\WebSiteItem.cs" />
<Compile Include="Web\WebVirtualDirectoryItem.cs" />
<Compile Include="Windows\SystemUserItem.cs" />
<Compile Include="Wizard\BannerWizardPage.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Wizard\ConfirmUninstallPage.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Wizard\ConfirmUninstallPage.Designer.cs">
<DependentUpon>ConfirmUninstallPage.cs</DependentUpon>
</Compile>
<Compile Include="Wizard\ConfigurationCheckPage.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Wizard\ConfigurationCheckPage.Designer.cs">
<DependentUpon>ConfigurationCheckPage.cs</DependentUpon>
</Compile>
<Compile Include="Wizard\ExpressInstallPage2.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Wizard\ExpressInstallPage2.Designer.cs">
<DependentUpon>ExpressInstallPage2.cs</DependentUpon>
</Compile>
<Compile Include="Wizard\SetupCompletePage.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Wizard\SetupCompletePage.Designer.cs">
<DependentUpon>SetupCompletePage.cs</DependentUpon>
</Compile>
<Compile Include="Wizard\ServerAdminPasswordPage.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Wizard\ServerAdminPasswordPage.Designer.cs">
<DependentUpon>ServerAdminPasswordPage.cs</DependentUpon>
</Compile>
<Compile Include="Wizard\ServiceAddressPage.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Wizard\ServiceAddressPage.Designer.cs">
<DependentUpon>ServiceAddressPage.cs</DependentUpon>
</Compile>
<Compile Include="Wizard\LicenseAgreementPage.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Wizard\LicenseAgreementPage.Designer.cs">
<DependentUpon>LicenseAgreementPage.cs</DependentUpon>
</Compile>
<Compile Include="Wizard\SQLServersPage.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Wizard\SQLServersPage.Designer.cs">
<DependentUpon>SQLServersPage.cs</DependentUpon>
</Compile>
<Compile Include="Wizard\UserAccountPage.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Wizard\UserAccountPage.Designer.cs">
<DependentUpon>UserAccountPage.cs</DependentUpon>
</Compile>
<Compile Include="Wizard\UrlPage.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Wizard\UrlPage.Designer.cs">
<DependentUpon>UrlPage.cs</DependentUpon>
</Compile>
<Compile Include="Wizard\WebPage.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Wizard\WebPage.Designer.cs">
<DependentUpon>WebPage.cs</DependentUpon>
</Compile>
<Compile Include="Wizard\InstallFolderPage.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Wizard\InstallFolderPage.Designer.cs">
<DependentUpon>InstallFolderPage.cs</DependentUpon>
</Compile>
<Compile Include="Wizard\DatabasePage.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Wizard\DatabasePage.Designer.cs">
<DependentUpon>DatabasePage.cs</DependentUpon>
</Compile>
<Compile Include="Wizard\ServerPasswordPage.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Wizard\ServerPasswordPage.Designer.cs">
<DependentUpon>ServerPasswordPage.cs</DependentUpon>
</Compile>
<Compile Include="Wizard\RollBackPage.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Wizard\RollBackPage.Designer.cs">
<DependentUpon>RollBackPage.cs</DependentUpon>
</Compile>
<Compile Include="Wizard\ExpressInstallPage.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Wizard\ExpressInstallPage.Designer.cs">
<DependentUpon>ExpressInstallPage.cs</DependentUpon>
</Compile>
<Compile Include="Wizard\FinishPage.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Wizard\FinishPage.Designer.cs">
<DependentUpon>FinishPage.cs</DependentUpon>
</Compile>
<Compile Include="Wizard\IntroductionPage.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Wizard\MarginWizardPage.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Wizard\UninstallPage.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Wizard\UninstallPage.Designer.cs">
<DependentUpon>UninstallPage.cs</DependentUpon>
</Compile>
<Compile Include="Wizard\Wizard.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Wizard\WizardPageBase.cs">
<SubType>UserControl</SubType>
</Compile>
<Service Include="{94E38DFF-614B-4cbd-B67C-F211BB35CE8B}" />
</ItemGroup>
<ItemGroup>
<Content Include="Resources\BannerImage.GIF" />
<Content Include="Resources\MarginImage.GIF" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Forms\InstallerForm.resx">
<DependentUpon>InstallerForm.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<SubType>Designer</SubType>
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<EmbeddedResource Include="Wizard\ExpressInstallPage2.resx">
<DependentUpon>ExpressInstallPage2.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Wizard\LicenseAgreementPage.resx">
<DependentUpon>LicenseAgreementPage.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Wizard\SQLServersPage.resx">
<DependentUpon>SQLServersPage.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Wizard\UserAccountPage.resx">
<DependentUpon>UserAccountPage.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Wizard\UrlPage.resx">
<DependentUpon>UrlPage.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Wizard\WebPage.resx">
<DependentUpon>WebPage.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Wizard\InstallFolderPage.resx">
<DependentUpon>InstallFolderPage.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Wizard\DatabasePage.resx">
<DependentUpon>DatabasePage.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Wizard\ServerPasswordPage.resx">
<DependentUpon>ServerPasswordPage.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Wizard\RollBackPage.resx">
<DependentUpon>RollBackPage.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Wizard\ExpressInstallPage.resx">
<DependentUpon>ExpressInstallPage.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Wizard\FinishPage.resx">
<DependentUpon>FinishPage.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Wizard\UninstallPage.resx">
<DependentUpon>UninstallPage.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="EULA.rtf" />
<EmbeddedResource Include="Wizard\ConfirmUninstallPage.resx">
<DependentUpon>ConfirmUninstallPage.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Wizard\ConfigurationCheckPage.resx">
<DependentUpon>ConfigurationCheckPage.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Wizard\SetupCompletePage.resx">
<DependentUpon>SetupCompletePage.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Wizard\ServerAdminPasswordPage.resx">
<DependentUpon>ServerAdminPasswordPage.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Wizard\ServiceAddressPage.resx">
<DependentUpon>ServiceAddressPage.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
<Visible>False</Visible>
<ProductName>Windows Installer 3.1</ProductName>
<Install>true</Install>
</BootstrapperPackage>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View file

@ -0,0 +1,144 @@
// 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.
namespace WebsitePanel.Setup.Windows
{
/// <summary>
/// System user item.
/// </summary>
public sealed class SystemUserItem
{
private string name;
private bool system;
private string fullName;
private string description;
private string password;
private bool passwordCantChange;
private bool passwordNeverExpires;
private bool accountDisabled;
private string domain;
private string[] memberOf = new string[0];
/// <summary>
/// Initializes a new instance of the SystemUserItem class.
/// </summary>
public SystemUserItem()
{
}
/// <summary>
/// Name
/// </summary>
public string Name
{
get { return name; }
set { name = value; }
}
/// <summary>
/// System
/// </summary>
public bool System
{
get { return system; }
set { system = value; }
}
/// <summary>
/// Full name
/// </summary>
public string FullName
{
get { return fullName; }
set { fullName = value; }
}
/// <summary>
/// Description
/// </summary>
public string Description
{
get { return description; }
set { description = value; }
}
/// <summary>
/// Password
/// </summary>
public string Password
{
get { return password; }
set { password = value; }
}
/// <summary>
/// User can't change password
/// </summary>
public bool PasswordCantChange
{
get { return passwordCantChange; }
set { passwordCantChange = value; }
}
/// <summary>
/// Password never expires
/// </summary>
public bool PasswordNeverExpires
{
get { return passwordNeverExpires; }
set { passwordNeverExpires = value; }
}
/// <summary>
/// Account is disabled
/// </summary>
public bool AccountDisabled
{
get { return accountDisabled; }
set { accountDisabled = value; }
}
/// <summary>
/// Member of
/// </summary>
public string[] MemberOf
{
get { return memberOf; }
set { memberOf = value; }
}
/// <summary>
/// Organizational Unit
/// </summary>
public string Domain
{
get { return domain; }
set { domain = value; }
}
}
}

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;
}
}

Some files were not shown because too many files have changed in this diff Show more