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,107 @@
// 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 WebsitePanel.Installer.Common;
using System.Configuration;
using WebsitePanel.Installer.Configuration;
using System.IO;
using System.Reflection;
namespace WebsitePanel.Installer.Core
{
public sealed class AppConfigManager
{
private static System.Configuration.Configuration appConfig;
public const string AppConfigFileNameWithoutExtension = "WebsitePanel.Installer.exe";
static AppConfigManager()
{
LoadConfiguration();
}
#region Core.Configuration
/// <summary>
/// Loads application configuration
/// </summary>
public static void LoadConfiguration()
{
Log.WriteStart("Loading application configuration");
//
var exePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, AppConfigFileNameWithoutExtension);
//
appConfig = ConfigurationManager.OpenExeConfiguration(exePath);
//
Log.WriteEnd("Application configuration loaded");
}
/// <summary>
/// Returns application configuration section
/// </summary>
public static InstallerSection AppConfiguration
{
get
{
return appConfig.GetSection("installer") as InstallerSection;
}
}
/// <summary>
/// Saves application configuration
/// </summary>
public static void SaveConfiguration(bool showAlert)
{
if (appConfig != null)
{
try
{
Log.WriteStart("Saving application configuration");
appConfig.Save();
Log.WriteEnd("Application configuration saved");
if (showAlert)
{
//ShowInfo("Application settings updated successfully.");
}
}
catch (Exception ex)
{
Log.WriteError("Core.Configuration error", ex);
if (showAlert)
{
//ShowError(ex);
}
}
}
}
#endregion
}
}

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.Security.Policy;
using System.Diagnostics;
using System.Reflection;
using System.Collections.Generic;
using System.Text;
using System.Runtime.Remoting.Lifetime;
namespace WebsitePanel.Installer.Common
{
[Serializable]
public class AssemblyLoader : MarshalByRefObject
{
public object RemoteRun(string fileName, string typeName, string methodName, object[] parameters)
{
Assembly assembly = Assembly.LoadFrom(fileName);
Type type = assembly.GetType(typeName);
MethodInfo method = type.GetMethod(methodName);
return method.Invoke(Activator.CreateInstance(type), parameters);
}
public void AddTraceListener(TraceListener traceListener)
{
Trace.Listeners.Add(traceListener);
}
public static object Execute(string fileName, string typeName, string methodName, object[] parameters)
{
AppDomain domain = null;
try
{
Evidence securityInfo = AppDomain.CurrentDomain.Evidence;
AppDomainSetup info = new AppDomainSetup();
info.ApplicationBase = AppDomain.CurrentDomain.BaseDirectory;
domain = AppDomain.CreateDomain("Remote Domain", securityInfo, info);
domain.InitializeLifetimeService();
domain.UnhandledException += new UnhandledExceptionEventHandler(OnDomainUnhandledException);
AssemblyLoader loader = (AssemblyLoader)domain.CreateInstanceAndUnwrap(
typeof(AssemblyLoader).Assembly.FullName,
typeof(AssemblyLoader).FullName);
foreach (TraceListener listener in Trace.Listeners)
{
loader.AddTraceListener(listener);
}
object ret = loader.RemoteRun(fileName, typeName, methodName, parameters);
AppDomain.Unload(domain);
return ret;
}
catch (Exception)
{
if (domain != null)
{
AppDomain.Unload(domain);
}
throw;
}
}
static void OnDomainUnhandledException(object sender, UnhandledExceptionEventArgs e)
{
Log.WriteError("Remote domain error", (Exception)e.ExceptionObject);
}
public static string GetShellVersion()
{
return Assembly.GetEntryAssembly().GetName().Version.ToString();
}
}
}

View file

@ -0,0 +1,271 @@
// 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;
namespace WebsitePanel.Installer.Common
{
/// <summary>
/// File utils.
/// </summary>
public sealed class FileUtils
{
/// <summary>
/// Initializes a new instance of the class.
/// </summary>
private FileUtils()
{
}
/// <summary>
/// Creates drectory with the specified directory.
/// </summary>
/// <param name="path">The directory path to create.</param>
public 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>
public 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>
public 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>
/// Deletes the specified file.
/// </summary>
/// <param name="fileName">The name of the file to be deleted.</param>
public 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>
public 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>
public 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>
public static bool DirectoryExists(string path)
{
return Directory.Exists(path);
}
/// <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");
}
/// <summary>
/// Deletes application temp directory.
/// </summary>
public static void DeleteTempDirectory()
{
try
{
DeleteDirectory(GetTempDirectory());
}
catch (Exception ex)
{
Log.WriteError("IO Error", ex);
}
}
}
}

View file

@ -0,0 +1,250 @@
// 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;
using System.EnterpriseServices;
namespace WebsitePanel.Installer.Common
{
public class Global
{
public const string VisualInstallerShell = "VisualInstallerShell";
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 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,245 @@
// Copyright (c) 2011, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System;
using System.Configuration;
using System.Diagnostics;
using System.IO;
using WebsitePanel.Installer.Configuration;
using System.Security.Principal;
using WebsitePanel.Installer.Core;
using System.Reflection;
namespace WebsitePanel.Installer.Common
{
/// <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()
{
Initialize();
}
static void Initialize()
{
string fileName = LogFile;
//
Trace.Listeners.Clear();
//
FileStream fileLog = new FileStream(fileName, FileMode.Append);
//
TextWriterTraceListener fileListener = new TextWriterTraceListener(fileLog);
fileListener.TraceOutputOptions = TraceOptions.DateTime;
Trace.Listeners.Add(fileListener);
//
Trace.AutoFlush = true;
}
internal static string LogFile
{
get
{
string fileName = "WebsitePanel.Installer.log";
//
if (string.IsNullOrEmpty(fileName))
{
fileName = "Installer.log";
}
// Ensure the path is correct
if (!Path.IsPathRooted(fileName))
{
fileName = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, fileName);
}
//
return fileName;
}
}
/// <summary>
/// Write error to the log.
/// </summary>
/// <param name="message">Error message.</param>
/// <param name="ex">Exception.</param>
public static void WriteError(string message, Exception ex)
{
try
{
string line = string.Format("[{0:G}] ERROR: {1}", DateTime.Now, message);
Trace.WriteLine(line);
Trace.WriteLine(ex);
}
catch { }
}
/// <summary>
/// Write error to the log.
/// </summary>
/// <param name="message">Error message.</param>
public static void WriteError(string message)
{
try
{
string line = string.Format("[{0:G}] ERROR: {1}", DateTime.Now, message);
Trace.WriteLine(line);
}
catch { }
}
/// <summary>
/// Write to log
/// </summary>
/// <param name="message"></param>
public 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>
public static void WriteLine(string message)
{
try
{
string line = string.Format("[{0:G}] {1}", DateTime.Now, message);
Trace.WriteLine(line);
}
catch { }
}
/// <summary>
/// Writes formatted informational message into the log
/// </summary>
/// <param name="format"></param>
/// <param name="args"></param>
public static void WriteInfo(string format, params object[] args)
{
WriteInfo(String.Format(format, args));
}
/// <summary>
/// Write info message to log
/// </summary>
/// <param name="message"></param>
public 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>
public static void WriteStart(string message)
{
try
{
string line = string.Format("[{0:G}] START: {1}", DateTime.Now, message);
Trace.WriteLine(line);
}
catch { }
}
/// <summary>
/// Write end message to log
/// </summary>
/// <param name="message"></param>
public static void WriteEnd(string message)
{
try
{
string line = string.Format("[{0:G}] END: {1}", DateTime.Now, message);
Trace.WriteLine(line);
}
catch { }
}
public static void WriteApplicationStart()
{
try
{
string name = Assembly.GetEntryAssembly().GetName().Name;
string version = Assembly.GetEntryAssembly().GetName().Version.ToString();
string identity = WindowsIdentity.GetCurrent().Name;
string line = string.Format("[{0:G}] {1} {2} Started by {3}", DateTime.Now, name, version, identity);
Trace.WriteLine(line);
}
catch { }
}
public static void WriteApplicationEnd()
{
try
{
string name = Assembly.GetEntryAssembly().GetName().Name;
string line = string.Format("[{0:G}] {1} Ended", DateTime.Now, name);
Trace.WriteLine(line);
}
catch { }
}
/// <summary>
/// Opens notepad to view log file.
/// </summary>
public static void ShowLogFile()
{
try
{
string path = LogFile;
path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, path);
Process.Start("notepad.exe", path);
}
catch { }
}
}
}

View file

@ -0,0 +1,386 @@
// 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.Installer.Common
{
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 + "Version: " + 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 + "Version: " + 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,
Vista,
WindowsServer2008
}
/// <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.Vista;
else
ret = WindowsVersion.WindowsServer2008;
break;
}
break;
}
return ret;
}
/// <summary>
/// Returns Windows directory
/// </summary>
/// <returns></returns>
public static string GetWindowsDirectory()
{
return Environment.GetEnvironmentVariable("windir");
}
}
}

View file

@ -0,0 +1,212 @@
// 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.Installer.Common
{
/// <summary>
/// Registry helper class.
/// </summary>
public sealed class RegistryUtils
{
/// <summary>
/// Initializes a new instance of the class.
/// </summary>
private RegistryUtils()
{
}
/// <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 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>
public 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 an array of strings that contains all the value names associated with this key.
/// </summary>
/// <param name="subkey">Subkey.</param>
/// <returns>An array of strings that contains the value names for the current key.</returns>
public static string[] GetRegistryKeyValues(string subkey)
{
string[] ret = null;
RegistryKey root = Registry.LocalMachine;
RegistryKey rk = root.OpenSubKey(subkey);
if (rk != null)
{
ret = rk.GetValueNames();
}
return ret;
}
public static RegistryValueKind GetRegistryKeyValueKind(string subkey, string name)
{
RegistryValueKind ret = RegistryValueKind.Unknown;
RegistryKey root = Registry.LocalMachine;
RegistryKey rk = root.OpenSubKey(subkey);
if (rk != null)
{
ret = rk.GetValueKind(name);
}
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>
public 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;
}
/// <summary>
/// Deletes a registry subkey and any child subkeys.
/// </summary>
/// <param name="subkey">Subkey to delete.</param>
public static void DeleteRegistryKey(string subkey)
{
RegistryKey root = Registry.LocalMachine;
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>
public 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>
public 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>
public 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>
public 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;
}
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,393 @@
// 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.Configuration;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;
using System.DirectoryServices;
using System.DirectoryServices.ActiveDirectory;
using System.Security.Principal;
using System.Security;
using System.Security.Permissions;
using System.Runtime.InteropServices;
using System.Threading;
using WebsitePanel.Installer.Core;
using WebsitePanel.Installer.Configuration;
using System.Xml;
namespace WebsitePanel.Installer.Common
{
public class UserDecisionEventArgs : EventArgs
{
public bool Accepted { get; set; }
public string UserMessage { get; set; }
}
public static class Utils
{
public static void FixConfigurationSectionDefinition()
{
var appConfigPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, String.Concat(AppConfigManager.AppConfigFileNameWithoutExtension, ".config"));
//
try
{
var configXmlDoc = new XmlDocument();
//
configXmlDoc.Load(appConfigPath);
//
var sectionDef = configXmlDoc.SelectSingleNode("//configSections/section[@name='installer']");
//
if (sectionDef == null)
{
return;
}
//
var typeDefString = sectionDef.Attributes["type"].Value;
//
if (typeDefString.EndsWith("WebsitePanel.Installer.Core") == false)
{
sectionDef.Attributes["type"].Value = "WebsitePanel.Installer.Configuration.InstallerSection, WebsitePanel.Installer.Core";
//
configXmlDoc.Save(appConfigPath);
}
}
catch (Exception ex)
{
Trace.TraceError("Failed to fix configuration section definition. Exception: {0}", ex);
}
}
#region DB
/// <summary>
/// Converts db value to string
/// </summary>
/// <param name="val">Value</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">Value</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">Value</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">Value</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">Value</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">Value</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
public static void ShowConsoleErrorMessage(string format, params object[] args)
{
Console.WriteLine(String.Format(format, args));
}
public static bool CheckForInstalledComponent(string componentCode)
{
bool ret = false;
List<string> installedComponents = new List<string>();
foreach (ComponentConfigElement componentConfig in AppConfigManager.AppConfiguration.Components)
{
string code = componentConfig.Settings[Global.Parameters.ComponentCode].Value;
installedComponents.Add(code);
if (code == componentCode)
{
ret = true;
break;
}
}
//
if (componentCode == "standalone")
{
if (installedComponents.Contains("server") ||
installedComponents.Contains("enterprise server") ||
installedComponents.Contains("portal"))
ret = true;
}
//
return ret;
}
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");
}
public static bool IsSecurityException(Exception ex)
{
if (ex is System.Security.SecurityException)
return true;
Exception innerException = ex;
while (innerException != null)
{
if (innerException is System.Security.SecurityException)
return true;
innerException = innerException.InnerException;
}
string str = ex.ToString();
return str.Contains("System.Security.SecurityException");
}
public static bool IsWin64()
{
return (IntPtr.Size == 8);
}
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 bool IIS32Enabled()
{
bool enabled = false;
DirectoryEntry obj = new DirectoryEntry("IIS://LocalHost/W3SVC/AppPools");
object objProperty = GetObjectProperty(obj, "Enable32bitAppOnWin64");
if (objProperty != null)
{
enabled = (bool)objProperty;
}
return enabled;
}
public static void CheckWin64(EventHandler<UserDecisionEventArgs> callback)
{
if (IsWin64())
{
Log.WriteInfo("x64 detected");
string check = AppConfigManager.AppConfiguration.GetStringSetting(ConfigKeys.Settings_IIS64);
if (check == "False")
return;
//ignore win64 check on IIS7
if (Global.IISVersion.Major == 7)
return;
if (!IIS32Enabled())
{
Log.WriteInfo("IIS 32-bit mode disabled");
var args = new UserDecisionEventArgs
{
UserMessage = "WebsitePanel Installer has detected that Microsoft Internet Information Services (IIS) " +
"are running in 64-bit mode. It is recommended to switch IIS to 32-bit mode to " +
"enable compatibility with 32-bit applications. " +
"Please note that 64-bit web applications will not work in 32-bit mode.\n" +
"Do you want WebsitePanel Installer to switch IIS to 32-bit mode?"
};
if (callback != null)
{
callback(null, args);
}
if (AppConfigManager.AppConfiguration.Settings[ConfigKeys.Settings_IIS64] != null)
AppConfigManager.AppConfiguration.Settings[ConfigKeys.Settings_IIS64].Value = "False";
else
AppConfigManager.AppConfiguration.Settings.Add(ConfigKeys.Settings_IIS64, "False");
//
AppConfigManager.SaveConfiguration(false);
if (args.Accepted)
{
EnableIIS32();
}
}
else
{
Log.WriteInfo("IIS 32-bit mode enabled");
}
}
else
{
Log.WriteInfo("x86 detected");
}
}
private static void EnableIIS32()
{
Log.WriteStart("Enabling IIS 32-bit mode");
DirectoryEntry obj = new DirectoryEntry("IIS://LocalHost/W3SVC/AppPools");
SetObjectProperty(obj, "Enable32bitAppOnWin64", true);
obj.CommitChanges();
Log.WriteEnd("Enabled IIS 32-bit mode");
Log.WriteStart("Starting aspnet_regiis -i");
string path = Path.Combine(OS.GetWindowsDirectory(), @"Microsoft.NET\Framework\v2.0.50727\aspnet_regiis.exe");
ProcessStartInfo info = new ProcessStartInfo(path, "-i");
//info.WindowStyle = ProcessWindowStyle.Minimized;
Process process = Process.Start(info);
process.WaitForExit();
Log.WriteEnd("Finished aspnet_regiis -i");
Log.WriteStart("Enabling Web Service Extension");
DirectoryEntry iis = new DirectoryEntry("IIS://LocalHost/W3SVC");
iis.Invoke("EnableWebServiceExtension", "ASP.NET v2.0.50727 (32-bit)");
iis.CommitChanges();
Log.WriteEnd("Enabled Web Service Extension");
}
/// <summary>
/// Check security permissions
/// </summary>
public static bool CheckSecurity()
{
try
{
PermissionSet set = new PermissionSet(PermissionState.Unrestricted);
set.Demand();
}
catch
{
return false;
}
return true;
}
public static bool IsAdministrator()
{
WindowsIdentity user = WindowsIdentity.GetCurrent();
WindowsPrincipal principal = new WindowsPrincipal(user);
return principal.IsInRole(WindowsBuiltInRole.Administrator);
}
private static Mutex mutex = null;
public static void SaveMutex()
{
GC.KeepAlive(mutex);
}
public static bool IsNewInstance()
{
//check only one instance
bool createdNew = true;
mutex = new Mutex(true, "WebsitePanel Installer", out createdNew);
return createdNew;
}
}
}

View file

@ -0,0 +1,209 @@
// 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.Collections;
using System.Configuration;
using System.Text;
namespace WebsitePanel.Installer.Configuration
{
/// <summary>
/// Represents <connections> configuration element containing a collection of child elements.
/// </summary>
public class ComponentCollection : ConfigurationElementCollection
{
/// <summary>
/// Creates a new instance of the ConnectionCollection class.
/// </summary>
public ComponentCollection()
{
AddElementName = "component";
}
/// <summary>
/// Gets the type of the ConfigurationElementCollection.
/// </summary>
public override ConfigurationElementCollectionType CollectionType
{
get
{
return ConfigurationElementCollectionType.AddRemoveClearMap;
}
}
/// <summary>
/// Creates a new ConfigurationElement.
/// </summary>
/// <returns></returns>
protected override ConfigurationElement CreateNewElement()
{
return new ComponentConfigElement();
}
/// <summary>
/// Creates a new ConfigurationElement.
/// </summary>
/// <param name="elementName"></param>
/// <returns></returns>
protected override ConfigurationElement CreateNewElement(string id)
{
return new ComponentConfigElement(id);
}
/// <summary>
///
/// </summary>
/// <param name="element"></param>
/// <returns></returns>
protected override Object GetElementKey(ConfigurationElement element)
{
ComponentConfigElement componentConfigElement = element as ComponentConfigElement;
return componentConfigElement.ID;
}
/* public new string AddElementName
{
get
{
return base.AddElementName;
}
set
{
base.AddElementName = value;
}
}
public new string ClearElementName
{
get
{ return base.ClearElementName; }
set
{ base.AddElementName = value; }
}
public new string RemoveElementName
{
get
{ return base.RemoveElementName; }
}
public new int Count
{
get { return base.Count; }
}
*/
/// <summary>
/// Gets or sets a child element of this ConnectionCollection object.
/// </summary>
/// <param name="index"></param>
/// <returns></returns>
public ComponentConfigElement this[int index]
{
get
{
return (ComponentConfigElement)BaseGet(index);
}
set
{
if (BaseGet(index) != null)
{
BaseRemoveAt(index);
}
BaseAdd(index, value);
}
}
/// <summary>
/// Gets or sets a child element of this ConnectionCollection object.
/// </summary>
/// <param name="name"></param>
/// <returns></returns>
public new ComponentConfigElement this[string id]
{
get
{
return (ComponentConfigElement)BaseGet(id);
}
}
/// <summary>
/// The index of the specified PluginConfigElement.
/// </summary>
/// <param name="connection"></param>
/// <returns></returns>
public int IndexOf(ComponentConfigElement element)
{
return BaseIndexOf(element);
}
/// <summary>
/// Adds a PluginConfigElement to the ConnectionCollection instance.
/// </summary>
/// <param name="c"></param>
public void Add(ComponentConfigElement c)
{
BaseAdd(c);
// Add custom code here.
}
public void Remove(ComponentConfigElement c)
{
if (BaseIndexOf(c) >= 0)
BaseRemove(c.ID);
}
public void RemoveAt(int index)
{
BaseRemoveAt(index);
}
public void Remove(string id)
{
BaseRemove(id);
}
public void Clear()
{
BaseClear();
// Add custom code here.
}
}
}

View file

@ -0,0 +1,253 @@
// 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.Collections;
using System.Configuration;
using System.Text;
namespace WebsitePanel.Installer.Configuration
{
/// <summary>
/// Represents a configuration element containing component info.
/// </summary>
public class ComponentConfigElement : ConfigurationElement
{
/// <summary>
/// Creates a new instance of the ServerConfigElement class.
/// </summary>
public ComponentConfigElement() : this(string.Empty)
{
}
/// <summary>
/// Creates a new instance of the ServerConfigElement class.
/// </summary>
public ComponentConfigElement(string id)
{
ID = id;
}
[ConfigurationProperty("id", IsRequired = true, IsKey = true)]
public string ID
{
get
{
return (string)this["id"];
}
set
{
this["id"] = value;
}
}
[ConfigurationProperty("settings", IsDefaultCollection = false)]
public KeyValueConfigurationCollection Settings
{
get
{
return (KeyValueConfigurationCollection)base["settings"];
}
}
public string GetStringSetting(string key)
{
string ret = null;
if (Settings[key] != null)
{
ret = Settings[key].Value;
}
return ret;
}
public int GetInt32Setting(string key)
{
int ret = 0;
if (Settings[key] != null)
{
string val = Settings[key].Value;
Int32.TryParse(val, out ret);
}
return ret;
}
public bool GetBooleanSetting(string key)
{
bool ret = false;
if (Settings[key] != null)
{
string val = Settings[key].Value;
Boolean.TryParse(val, out ret);
}
return ret;
}
/*
/// <summary>
/// Gets the type of the ConfigurationElementCollection.
/// </summary>
public override ConfigurationElementCollectionType CollectionType
{
get
{
return ConfigurationElementCollectionType.AddRemoveClearMap;
}
}
/// <summary>
/// Creates a new ConfigurationElement.
/// </summary>
/// <returns></returns>
protected override ConfigurationElement CreateNewElement()
{
//return new ModuleConfigElement();
return null;
}*/
/// <summary>
/// Creates a new ConfigurationElement.
/// </summary>
/// <param name="elementName"></param>
/// <returns></returns>
/*protected override ConfigurationElement CreateNewElement(string elementName)
{
return new ModuleConfigElement(elementName);
}*/
/*
/// <summary>
///
/// </summary>
/// <param name="element"></param>
/// <returns></returns>
protected override Object GetElementKey(ConfigurationElement element)
{
//ModuleConfigElement moduleConfigElement = element as ModuleConfigElement;
//return userConfigElement.Module;
return null;
}*/
/* public new string AddElementName
{
get
{
return base.AddElementName;
}
set
{
base.AddElementName = value;
}
}
public new string ClearElementName
{
get
{ return base.ClearElementName; }
set
{ base.AddElementName = value; }
}
public new string RemoveElementName
{
get
{ return base.RemoveElementName; }
}
public new int Count
{
get { return base.Count; }
}
*/
/// <summary>
/// Gets or sets a child element of this ServerConfigElement object.
/// </summary>
/// <param name="index"></param>
/// <returns></returns>
/*public UserConfigElement this[int index]
{
get
{
return (UserConfigElement)BaseGet(index);
}
set
{
if (BaseGet(index) != null)
{
BaseRemoveAt(index);
}
BaseAdd(index, value);
}
}*/
/* /// <summary>
/// Gets or sets a child element of this ServerConfigElement object.
/// </summary>
/// <param name="name"></param>
/// <returns></returns>
new public UserConfigElement this[string name]
{
get
{
return (UserConfigElement)BaseGet(name);
}
}*/
/// <summary>
/// The index of the specified PluginConfigElement.
/// </summary>
/// <param name="connection"></param>
/// <returns></returns>
/*public int IndexOf(UserConfigElement connection)
{
return BaseIndexOf(connection);
}*/
/// <summary>
/// Adds a PluginConfigElement to the ServerConfigElement instance.
/// </summary>
/// <param name="c"></param>
/*public void Add(UserConfigElement c)
{
BaseAdd(c);
// Add custom code here.
}*/
}
}

View file

@ -0,0 +1,46 @@
// 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.Installer.Configuration
{
public class ConfigKeys
{
public const string Web_Service = "Web.Service";
public const string Web_AutoCheck = "Web.AutoCheck";
public const string Web_Proxy_UseProxy = "Web.Proxy.UseProxy";
public const string Web_Proxy_Address = "Web.Proxy.Address";
public const string Web_Proxy_UserName = "Web.Proxy.UserName";
public const string Web_Proxy_Password = "Web.Proxy.Password";
public const string Settings_ImportSettings = "Settings.ImportSettings";
public const string Settings_IIS64 = "Settings.CheckIIS64";
}
}

View file

@ -0,0 +1,103 @@
// 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.Configuration;
namespace WebsitePanel.Installer.Configuration
{
/// <summary>
/// Provides configuration system support for the <installerSettings> configuration section.
/// </summary>
public class InstallerSection : ConfigurationSection
{
/// <summary>
/// Creates a new instance of the StudioSection class.
/// </summary>
public InstallerSection()
{
}
/// <summary>
/// Declare <connections> collection element represented
/// in the configuration file by the sub-section.
/// </summary>
[ConfigurationProperty("components", IsDefaultCollection = false)]
public ComponentCollection Components
{
get
{
ComponentCollection componentCollection = (ComponentCollection)base["components"];
return componentCollection;
}
}
[ConfigurationProperty("settings", IsDefaultCollection = false)]
public KeyValueConfigurationCollection Settings
{
get
{
return (KeyValueConfigurationCollection)base["settings"];
}
}
public string GetStringSetting(string key)
{
string ret = null;
if (Settings[key] != null)
{
ret = Settings[key].Value;
}
return ret;
}
public int GetInt32Setting(string key)
{
int ret = 0;
if (Settings[key] != null)
{
string val = Settings[key].Value;
Int32.TryParse(val, out ret);
}
return ret;
}
public bool GetBooleanSetting(string key)
{
bool ret = false;
if (Settings[key] != null)
{
string val = Settings[key].Value;
Boolean.TryParse(val, out ret);
}
return ret;
}
}
}

View file

@ -0,0 +1,415 @@
// 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.Threading;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Text;
using Ionic.Zip;
using WebsitePanel.Installer.Common;
namespace WebsitePanel.Installer.Core
{
public class LoaderEventArgs<T> : EventArgs
{
public string StatusMessage { get; set; }
public T EventData { get; set; }
public bool Cancellable { get; set; }
}
/// <summary>
/// Loader form.
/// </summary>
public partial class Loader
{
public const string ConnectingRemotServiceMessage = "Connecting...";
public const string DownloadingSetupFilesMessage = "Downloading setup files...";
public const string CopyingSetupFilesMessage = "Copying setup files...";
public const string PreparingSetupFilesMessage = "Please wait while Setup prepares the necessary files...";
public const string DownloadProgressMessage = "{0} KB of {1} KB";
public const string PrepareSetupProgressMessage = "{0}%";
private const int ChunkSize = 262144;
private Thread thread;
private string localFile;
private string remoteFile;
private string componentCode;
private string version;
public event EventHandler<LoaderEventArgs<String>> StatusChanged;
public event EventHandler<LoaderEventArgs<Exception>> OperationFailed;
public event EventHandler<LoaderEventArgs<Int32>> ProgressChanged;
public event EventHandler<EventArgs> OperationCompleted;
public Loader(string remoteFile)
{
this.remoteFile = remoteFile;
}
public Loader(string localFile, string componentCode, string version)
{
this.localFile = localFile;
this.componentCode = componentCode;
this.version = version;
}
public void LoadAppDistributive()
{
thread = new Thread(new ThreadStart(LoadAppDistributiveInternal));
thread.Start();
}
private void RaiseOnStatusChangedEvent(string statusMessage)
{
RaiseOnStatusChangedEvent(statusMessage, String.Empty);
}
private void RaiseOnStatusChangedEvent(string statusMessage, string eventData)
{
RaiseOnStatusChangedEvent(statusMessage, eventData, true);
}
private void RaiseOnStatusChangedEvent(string statusMessage, string eventData, bool cancellable)
{
if (StatusChanged == null)
{
return;
}
// No event data for status updates
StatusChanged(this, new LoaderEventArgs<String> {
StatusMessage = statusMessage,
EventData = eventData,
Cancellable = cancellable
});
}
private void RaiseOnProgressChangedEvent(int eventData)
{
RaiseOnProgressChangedEvent(eventData, true);
}
private void RaiseOnProgressChangedEvent(int eventData, bool cancellable)
{
if (ProgressChanged == null)
{
return;
}
//
ProgressChanged(this, new LoaderEventArgs<int> {
EventData = eventData,
Cancellable = cancellable
});
}
private void RaiseOnOperationFailedEvent(Exception ex)
{
if (OperationFailed == null)
{
return;
}
//
OperationFailed(this, new LoaderEventArgs<Exception> { EventData = ex });
}
private void RaiseOnOperationCompletedEvent()
{
if (OperationCompleted == null)
{
return;
}
//
OperationCompleted(this, EventArgs.Empty);
}
/// <summary>
/// Displays process progress.
/// </summary>
private void LoadAppDistributiveInternal()
{
//
try
{
var service = ServiceProviderProxy.GetInstallerWebService();
//
string dataFolder = FileUtils.GetDataDirectory();
string tmpFolder = FileUtils.GetTempDirectory();
if (!Directory.Exists(dataFolder))
{
Directory.CreateDirectory(dataFolder);
Log.WriteInfo("Data directory created");
}
if (Directory.Exists(tmpFolder))
{
FileUtils.DeleteTempDirectory();
}
if (!Directory.Exists(tmpFolder))
{
Directory.CreateDirectory(tmpFolder);
Log.WriteInfo("Tmp directory created");
}
string fileToDownload = null;
if (!string.IsNullOrEmpty(localFile))
{
fileToDownload = localFile;
}
else
{
fileToDownload = Path.GetFileName(remoteFile);
}
string destinationFile = Path.Combine(dataFolder, fileToDownload);
string tmpFile = Path.Combine(tmpFolder, fileToDownload);
//check whether file already downloaded
if (!File.Exists(destinationFile))
{
if (string.IsNullOrEmpty(remoteFile))
{
//need to get remote file name
RaiseOnStatusChangedEvent(ConnectingRemotServiceMessage);
//
RaiseOnProgressChangedEvent(0);
//
DataSet ds = service.GetReleaseFileInfo(componentCode, version);
//
RaiseOnProgressChangedEvent(100);
//
if (ds != null &&
ds.Tables.Count > 0 &&
ds.Tables[0].Rows.Count > 0)
{
DataRow row = ds.Tables[0].Rows[0];
remoteFile = row["FullFilePath"].ToString();
fileToDownload = Path.GetFileName(remoteFile);
destinationFile = Path.Combine(dataFolder, fileToDownload);
tmpFile = Path.Combine(tmpFolder, fileToDownload);
}
else
{
throw new Exception("Installer not found");
}
}
// download file to tmp folder
RaiseOnStatusChangedEvent(DownloadingSetupFilesMessage);
//
RaiseOnProgressChangedEvent(0);
//
DownloadFile(remoteFile, tmpFile);
//
RaiseOnProgressChangedEvent(100);
// copy downloaded file to data folder
RaiseOnStatusChangedEvent(CopyingSetupFilesMessage);
//
RaiseOnProgressChangedEvent(0);
// Ensure that the target does not exist.
if (File.Exists(destinationFile))
FileUtils.DeleteFile(destinationFile);
File.Move(tmpFile, destinationFile);
//
RaiseOnProgressChangedEvent(100);
}
// unzip file
RaiseOnStatusChangedEvent(PreparingSetupFilesMessage);
//
RaiseOnProgressChangedEvent(0);
//
UnzipFile(destinationFile, tmpFolder);
//
RaiseOnProgressChangedEvent(100);
//
RaiseOnOperationCompletedEvent();
}
catch (Exception ex)
{
if (Utils.IsThreadAbortException(ex))
return;
Log.WriteError("Loader module error", ex);
//
RaiseOnOperationFailedEvent(ex);
}
}
private void DownloadFile(string sourceFile, string destinationFile)
{
try
{
var service = ServiceProviderProxy.GetInstallerWebService();
//
Log.WriteStart("Downloading file");
Log.WriteInfo(string.Format("Downloading file \"{0}\" to \"{1}\"", sourceFile, destinationFile));
long downloaded = 0;
long fileSize = service.GetFileSize(sourceFile);
if (fileSize == 0)
{
throw new FileNotFoundException("Service returned empty file.", sourceFile);
}
byte[] content;
while (downloaded < fileSize)
{
content = service.GetFileChunk(sourceFile, (int)downloaded, ChunkSize);
if (content == null)
{
throw new FileNotFoundException("Service returned NULL file content.", sourceFile);
}
FileUtils.AppendFileContent(destinationFile, content);
downloaded += content.Length;
//update progress bar
RaiseOnStatusChangedEvent(DownloadingSetupFilesMessage,
string.Format(DownloadProgressMessage, downloaded / 1024, fileSize / 1024));
//
RaiseOnProgressChangedEvent(Convert.ToInt32((downloaded * 100) / fileSize));
if (content.Length < ChunkSize)
break;
}
//
RaiseOnStatusChangedEvent(DownloadingSetupFilesMessage, "100%");
//
Log.WriteEnd(string.Format("Downloaded {0} bytes", downloaded));
}
catch (Exception ex)
{
if (Utils.IsThreadAbortException(ex))
return;
throw;
}
}
private void UnzipFile(string zipFile, string destFolder)
{
try
{
int val = 0;
// Negative value means no progress made yet
int progress = -1;
//
Log.WriteStart("Unzipping file");
Log.WriteInfo(string.Format("Unzipping file \"{0}\" to the folder \"{1}\"", zipFile, destFolder));
long zipSize = 0;
var zipInfo = ZipFile.Read(zipFile);
try
{
foreach (ZipEntry entry in zipInfo)
{
if (!entry.IsDirectory)
zipSize += entry.UncompressedSize;
}
}
finally
{
if (zipInfo != null)
{
zipInfo.Dispose();
}
}
long unzipped = 0;
//
var zip = ZipFile.Read(zipFile);
//
try
{
foreach (ZipEntry entry in zip)
{
//
entry.Extract(destFolder, ExtractExistingFileAction.OverwriteSilently);
//
if (!entry.IsDirectory)
unzipped += entry.UncompressedSize;
if (zipSize != 0)
{
val = Convert.ToInt32(unzipped * 100 / zipSize);
// Skip to raise the progress event change when calculated progress
// and the current progress value are even
if (val == progress)
{
continue;
}
//
RaiseOnStatusChangedEvent(
PreparingSetupFilesMessage,
String.Format(PrepareSetupProgressMessage, val),
false);
//
RaiseOnProgressChangedEvent(val, false);
}
}
// Notify client the operation can be cancelled at this time
RaiseOnProgressChangedEvent(100);
//
Log.WriteEnd("Unzipped file");
}
finally
{
if (zip != null)
{
zip.Dispose();
}
}
}
catch (Exception ex)
{
if (Utils.IsThreadAbortException(ex))
return;
//
RaiseOnOperationFailedEvent(ex);
}
}
public void AbortOperation()
{
if (thread != null)
{
if (thread.IsAlive)
{
thread.Abort();
}
thread.Join();
}
}
}
}

View file

@ -0,0 +1,31 @@
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 Installer Core")]
[assembly: AssemblyDescription("WebsitePanel Installer Core")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyProduct("WebsitePanel Installer Core")]
[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("419351db-5137-4a0d-ab64-fd90f0d52d45")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:

View file

@ -0,0 +1,36 @@
//------------------------------------------------------------------------------
// <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.Installer.Core.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.SpecialSettingAttribute(global::System.Configuration.SpecialSetting.WebServiceUrl)]
[global::System.Configuration.DefaultSettingValueAttribute("http://www.websitepanel.net/Services/InstallerService.asmx")]
public string WebsitePanel_Installer_Core_InstallerService_InstallerService {
get {
return ((string)(this["WebsitePanel_Installer_Core_InstallerService_InstallerService"]));
}
}
}
}

View file

@ -0,0 +1,9 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="WebsitePanel.Installer.Core.Properties" GeneratedClassName="Settings">
<Profiles />
<Settings>
<Setting Name="WebsitePanel_Installer_Core_InstallerService_InstallerService" Type="(Web Service URL)" Scope="Application">
<Value Profile="(Default)">http://www.websitepanel.net/Services/InstallerService.asmx</Value>
</Setting>
</Settings>
</SettingsFile>

View file

@ -0,0 +1,73 @@
// 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 WebsitePanel.Installer.Configuration;
using System.Net;
using WebsitePanel.Installer.Services;
namespace WebsitePanel.Installer.Core
{
public class ServiceProviderProxy
{
public static InstallerService GetInstallerWebService()
{
var webService = new InstallerService();
string url = AppConfigManager.AppConfiguration.GetStringSetting(ConfigKeys.Web_Service);
if (!String.IsNullOrEmpty(url))
{
webService.Url = url;
}
else
{
webService.Url = "http://www.websitepanel.net/Services/InstallerService.asmx";
}
// check if we need to add a proxy to access Internet
bool useProxy = AppConfigManager.AppConfiguration.GetBooleanSetting(ConfigKeys.Web_Proxy_UseProxy);
if (useProxy)
{
string proxyServer = AppConfigManager.AppConfiguration.Settings[ConfigKeys.Web_Proxy_Address].Value;
if (!String.IsNullOrEmpty(proxyServer))
{
IWebProxy proxy = new WebProxy(proxyServer);
string proxyUsername = AppConfigManager.AppConfiguration.Settings[ConfigKeys.Web_Proxy_UserName].Value;
string proxyPassword = AppConfigManager.AppConfiguration.Settings[ConfigKeys.Web_Proxy_Password].Value;
if (!String.IsNullOrEmpty(proxyUsername))
proxy.Credentials = new NetworkCredential(proxyUsername, proxyPassword);
webService.Proxy = proxy;
}
}
return webService;
}
}
}

View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<discovery xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/disco/">
<contractRef ref="http://www.websitepanel.net/Services/InstallerService.asmx?wsdl" docRef="http://www.websitepanel.net/Services/InstallerService.asmx" xmlns="http://schemas.xmlsoap.org/disco/scl/" />
<soap address="http://www.websitepanel.net/Services/InstallerService.asmx" xmlns:q1="http://websitepanel.net/services" binding="q1:InstallerServiceSoap" xmlns="http://schemas.xmlsoap.org/disco/soap/" />
<soap address="http://www.websitepanel.net/Services/InstallerService.asmx" xmlns:q2="http://websitepanel.net/services" binding="q2:InstallerServiceSoap12" xmlns="http://schemas.xmlsoap.org/disco/soap/" />
</discovery>

View file

@ -0,0 +1,303 @@
<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://websitepanel.net/services" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" targetNamespace="http://websitepanel.net/services" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<wsdl:types>
<s:schema elementFormDefault="qualified" targetNamespace="http://websitepanel.net/services">
<s:element name="GetReleaseFileInfo">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="componentCode" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="version" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="GetReleaseFileInfoResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="GetReleaseFileInfoResult">
<s:complexType>
<s:sequence>
<s:element ref="s:schema" />
<s:any />
</s:sequence>
</s:complexType>
</s:element>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="GetFileChunk">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="fileName" type="s:string" />
<s:element minOccurs="1" maxOccurs="1" name="offset" type="s:int" />
<s:element minOccurs="1" maxOccurs="1" name="size" type="s:int" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="GetFileChunkResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="GetFileChunkResult" type="s:base64Binary" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="GetFileSize">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="fileName" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="GetFileSizeResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="GetFileSizeResult" type="s:long" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="GetAvailableComponents">
<s:complexType />
</s:element>
<s:element name="GetAvailableComponentsResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="GetAvailableComponentsResult">
<s:complexType>
<s:sequence>
<s:element ref="s:schema" />
<s:any />
</s:sequence>
</s:complexType>
</s:element>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="GetLatestComponentUpdate">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="componentCode" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="GetLatestComponentUpdateResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="GetLatestComponentUpdateResult">
<s:complexType>
<s:sequence>
<s:element ref="s:schema" />
<s:any />
</s:sequence>
</s:complexType>
</s:element>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="GetComponentUpdate">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="componentCode" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="release" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="GetComponentUpdateResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="GetComponentUpdateResult">
<s:complexType>
<s:sequence>
<s:element ref="s:schema" />
<s:any />
</s:sequence>
</s:complexType>
</s:element>
</s:sequence>
</s:complexType>
</s:element>
</s:schema>
</wsdl:types>
<wsdl:message name="GetReleaseFileInfoSoapIn">
<wsdl:part name="parameters" element="tns:GetReleaseFileInfo" />
</wsdl:message>
<wsdl:message name="GetReleaseFileInfoSoapOut">
<wsdl:part name="parameters" element="tns:GetReleaseFileInfoResponse" />
</wsdl:message>
<wsdl:message name="GetFileChunkSoapIn">
<wsdl:part name="parameters" element="tns:GetFileChunk" />
</wsdl:message>
<wsdl:message name="GetFileChunkSoapOut">
<wsdl:part name="parameters" element="tns:GetFileChunkResponse" />
</wsdl:message>
<wsdl:message name="GetFileSizeSoapIn">
<wsdl:part name="parameters" element="tns:GetFileSize" />
</wsdl:message>
<wsdl:message name="GetFileSizeSoapOut">
<wsdl:part name="parameters" element="tns:GetFileSizeResponse" />
</wsdl:message>
<wsdl:message name="GetAvailableComponentsSoapIn">
<wsdl:part name="parameters" element="tns:GetAvailableComponents" />
</wsdl:message>
<wsdl:message name="GetAvailableComponentsSoapOut">
<wsdl:part name="parameters" element="tns:GetAvailableComponentsResponse" />
</wsdl:message>
<wsdl:message name="GetLatestComponentUpdateSoapIn">
<wsdl:part name="parameters" element="tns:GetLatestComponentUpdate" />
</wsdl:message>
<wsdl:message name="GetLatestComponentUpdateSoapOut">
<wsdl:part name="parameters" element="tns:GetLatestComponentUpdateResponse" />
</wsdl:message>
<wsdl:message name="GetComponentUpdateSoapIn">
<wsdl:part name="parameters" element="tns:GetComponentUpdate" />
</wsdl:message>
<wsdl:message name="GetComponentUpdateSoapOut">
<wsdl:part name="parameters" element="tns:GetComponentUpdateResponse" />
</wsdl:message>
<wsdl:portType name="InstallerServiceSoap">
<wsdl:operation name="GetReleaseFileInfo">
<wsdl:input message="tns:GetReleaseFileInfoSoapIn" />
<wsdl:output message="tns:GetReleaseFileInfoSoapOut" />
</wsdl:operation>
<wsdl:operation name="GetFileChunk">
<wsdl:input message="tns:GetFileChunkSoapIn" />
<wsdl:output message="tns:GetFileChunkSoapOut" />
</wsdl:operation>
<wsdl:operation name="GetFileSize">
<wsdl:input message="tns:GetFileSizeSoapIn" />
<wsdl:output message="tns:GetFileSizeSoapOut" />
</wsdl:operation>
<wsdl:operation name="GetAvailableComponents">
<wsdl:input message="tns:GetAvailableComponentsSoapIn" />
<wsdl:output message="tns:GetAvailableComponentsSoapOut" />
</wsdl:operation>
<wsdl:operation name="GetLatestComponentUpdate">
<wsdl:input message="tns:GetLatestComponentUpdateSoapIn" />
<wsdl:output message="tns:GetLatestComponentUpdateSoapOut" />
</wsdl:operation>
<wsdl:operation name="GetComponentUpdate">
<wsdl:input message="tns:GetComponentUpdateSoapIn" />
<wsdl:output message="tns:GetComponentUpdateSoapOut" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="InstallerServiceSoap" type="tns:InstallerServiceSoap">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="GetReleaseFileInfo">
<soap:operation soapAction="http://websitepanel.net/services/GetReleaseFileInfo" style="document" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="GetFileChunk">
<soap:operation soapAction="http://websitepanel.net/services/GetFileChunk" style="document" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="GetFileSize">
<soap:operation soapAction="http://websitepanel.net/services/GetFileSize" style="document" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="GetAvailableComponents">
<soap:operation soapAction="http://websitepanel.net/services/GetAvailableComponents" style="document" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="GetLatestComponentUpdate">
<soap:operation soapAction="http://websitepanel.net/services/GetLatestComponentUpdate" style="document" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="GetComponentUpdate">
<soap:operation soapAction="http://websitepanel.net/services/GetComponentUpdate" style="document" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="InstallerServiceSoap12" type="tns:InstallerServiceSoap">
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="GetReleaseFileInfo">
<soap12:operation soapAction="http://websitepanel.net/services/GetReleaseFileInfo" style="document" />
<wsdl:input>
<soap12:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap12:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="GetFileChunk">
<soap12:operation soapAction="http://websitepanel.net/services/GetFileChunk" style="document" />
<wsdl:input>
<soap12:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap12:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="GetFileSize">
<soap12:operation soapAction="http://websitepanel.net/services/GetFileSize" style="document" />
<wsdl:input>
<soap12:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap12:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="GetAvailableComponents">
<soap12:operation soapAction="http://websitepanel.net/services/GetAvailableComponents" style="document" />
<wsdl:input>
<soap12:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap12:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="GetLatestComponentUpdate">
<soap12:operation soapAction="http://websitepanel.net/services/GetLatestComponentUpdate" style="document" />
<wsdl:input>
<soap12:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap12:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="GetComponentUpdate">
<soap12:operation soapAction="http://websitepanel.net/services/GetComponentUpdate" style="document" />
<wsdl:input>
<soap12:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap12:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="InstallerService">
<wsdl:port name="InstallerServiceSoap" binding="tns:InstallerServiceSoap">
<soap:address location="http://www.websitepanel.net/Services/InstallerService.asmx" />
</wsdl:port>
<wsdl:port name="InstallerServiceSoap12" binding="tns:InstallerServiceSoap12">
<soap12:address location="http://www.websitepanel.net/Services/InstallerService.asmx" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

View file

@ -0,0 +1,458 @@
//------------------------------------------------------------------------------
// <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>
//------------------------------------------------------------------------------
//
// This source code was auto-generated by Microsoft.VSDesigner, Version 4.0.30319.1.
//
#pragma warning disable 1591
namespace WebsitePanel.Installer.Services {
using System;
using System.Web.Services;
using System.Diagnostics;
using System.Web.Services.Protocols;
using System.ComponentModel;
using System.Xml.Serialization;
using System.Data;
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.0.30319.1")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Web.Services.WebServiceBindingAttribute(Name="InstallerServiceSoap", Namespace="http://websitepanel.net/services")]
public partial class InstallerService : System.Web.Services.Protocols.SoapHttpClientProtocol {
private System.Threading.SendOrPostCallback GetReleaseFileInfoOperationCompleted;
private System.Threading.SendOrPostCallback GetFileChunkOperationCompleted;
private System.Threading.SendOrPostCallback GetFileSizeOperationCompleted;
private System.Threading.SendOrPostCallback GetAvailableComponentsOperationCompleted;
private System.Threading.SendOrPostCallback GetLatestComponentUpdateOperationCompleted;
private System.Threading.SendOrPostCallback GetComponentUpdateOperationCompleted;
private bool useDefaultCredentialsSetExplicitly;
/// <remarks/>
public InstallerService() {
this.Url = global::WebsitePanel.Installer.Core.Properties.Settings.Default.WebsitePanel_Installer_Core_InstallerService_InstallerService;
if ((this.IsLocalFileSystemWebService(this.Url) == true)) {
this.UseDefaultCredentials = true;
this.useDefaultCredentialsSetExplicitly = false;
}
else {
this.useDefaultCredentialsSetExplicitly = true;
}
}
public new string Url {
get {
return base.Url;
}
set {
if ((((this.IsLocalFileSystemWebService(base.Url) == true)
&& (this.useDefaultCredentialsSetExplicitly == false))
&& (this.IsLocalFileSystemWebService(value) == false))) {
base.UseDefaultCredentials = false;
}
base.Url = value;
}
}
public new bool UseDefaultCredentials {
get {
return base.UseDefaultCredentials;
}
set {
base.UseDefaultCredentials = value;
this.useDefaultCredentialsSetExplicitly = true;
}
}
/// <remarks/>
public event GetReleaseFileInfoCompletedEventHandler GetReleaseFileInfoCompleted;
/// <remarks/>
public event GetFileChunkCompletedEventHandler GetFileChunkCompleted;
/// <remarks/>
public event GetFileSizeCompletedEventHandler GetFileSizeCompleted;
/// <remarks/>
public event GetAvailableComponentsCompletedEventHandler GetAvailableComponentsCompleted;
/// <remarks/>
public event GetLatestComponentUpdateCompletedEventHandler GetLatestComponentUpdateCompleted;
/// <remarks/>
public event GetComponentUpdateCompletedEventHandler GetComponentUpdateCompleted;
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://websitepanel.net/services/GetReleaseFileInfo", RequestNamespace="http://websitepanel.net/services", ResponseNamespace="http://websitepanel.net/services", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public System.Data.DataSet GetReleaseFileInfo(string componentCode, string version) {
object[] results = this.Invoke("GetReleaseFileInfo", new object[] {
componentCode,
version});
return ((System.Data.DataSet)(results[0]));
}
/// <remarks/>
public void GetReleaseFileInfoAsync(string componentCode, string version) {
this.GetReleaseFileInfoAsync(componentCode, version, null);
}
/// <remarks/>
public void GetReleaseFileInfoAsync(string componentCode, string version, object userState) {
if ((this.GetReleaseFileInfoOperationCompleted == null)) {
this.GetReleaseFileInfoOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetReleaseFileInfoOperationCompleted);
}
this.InvokeAsync("GetReleaseFileInfo", new object[] {
componentCode,
version}, this.GetReleaseFileInfoOperationCompleted, userState);
}
private void OnGetReleaseFileInfoOperationCompleted(object arg) {
if ((this.GetReleaseFileInfoCompleted != null)) {
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.GetReleaseFileInfoCompleted(this, new GetReleaseFileInfoCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://websitepanel.net/services/GetFileChunk", RequestNamespace="http://websitepanel.net/services", ResponseNamespace="http://websitepanel.net/services", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
[return: System.Xml.Serialization.XmlElementAttribute(DataType="base64Binary")]
public byte[] GetFileChunk(string fileName, int offset, int size) {
object[] results = this.Invoke("GetFileChunk", new object[] {
fileName,
offset,
size});
return ((byte[])(results[0]));
}
/// <remarks/>
public void GetFileChunkAsync(string fileName, int offset, int size) {
this.GetFileChunkAsync(fileName, offset, size, null);
}
/// <remarks/>
public void GetFileChunkAsync(string fileName, int offset, int size, object userState) {
if ((this.GetFileChunkOperationCompleted == null)) {
this.GetFileChunkOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetFileChunkOperationCompleted);
}
this.InvokeAsync("GetFileChunk", new object[] {
fileName,
offset,
size}, this.GetFileChunkOperationCompleted, userState);
}
private void OnGetFileChunkOperationCompleted(object arg) {
if ((this.GetFileChunkCompleted != null)) {
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.GetFileChunkCompleted(this, new GetFileChunkCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://websitepanel.net/services/GetFileSize", RequestNamespace="http://websitepanel.net/services", ResponseNamespace="http://websitepanel.net/services", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public long GetFileSize(string fileName) {
object[] results = this.Invoke("GetFileSize", new object[] {
fileName});
return ((long)(results[0]));
}
/// <remarks/>
public void GetFileSizeAsync(string fileName) {
this.GetFileSizeAsync(fileName, null);
}
/// <remarks/>
public void GetFileSizeAsync(string fileName, object userState) {
if ((this.GetFileSizeOperationCompleted == null)) {
this.GetFileSizeOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetFileSizeOperationCompleted);
}
this.InvokeAsync("GetFileSize", new object[] {
fileName}, this.GetFileSizeOperationCompleted, userState);
}
private void OnGetFileSizeOperationCompleted(object arg) {
if ((this.GetFileSizeCompleted != null)) {
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.GetFileSizeCompleted(this, new GetFileSizeCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://websitepanel.net/services/GetAvailableComponents", RequestNamespace="http://websitepanel.net/services", ResponseNamespace="http://websitepanel.net/services", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public System.Data.DataSet GetAvailableComponents() {
object[] results = this.Invoke("GetAvailableComponents", new object[0]);
return ((System.Data.DataSet)(results[0]));
}
/// <remarks/>
public void GetAvailableComponentsAsync() {
this.GetAvailableComponentsAsync(null);
}
/// <remarks/>
public void GetAvailableComponentsAsync(object userState) {
if ((this.GetAvailableComponentsOperationCompleted == null)) {
this.GetAvailableComponentsOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetAvailableComponentsOperationCompleted);
}
this.InvokeAsync("GetAvailableComponents", new object[0], this.GetAvailableComponentsOperationCompleted, userState);
}
private void OnGetAvailableComponentsOperationCompleted(object arg) {
if ((this.GetAvailableComponentsCompleted != null)) {
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.GetAvailableComponentsCompleted(this, new GetAvailableComponentsCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://websitepanel.net/services/GetLatestComponentUpdate", RequestNamespace="http://websitepanel.net/services", ResponseNamespace="http://websitepanel.net/services", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public System.Data.DataSet GetLatestComponentUpdate(string componentCode) {
object[] results = this.Invoke("GetLatestComponentUpdate", new object[] {
componentCode});
return ((System.Data.DataSet)(results[0]));
}
/// <remarks/>
public void GetLatestComponentUpdateAsync(string componentCode) {
this.GetLatestComponentUpdateAsync(componentCode, null);
}
/// <remarks/>
public void GetLatestComponentUpdateAsync(string componentCode, object userState) {
if ((this.GetLatestComponentUpdateOperationCompleted == null)) {
this.GetLatestComponentUpdateOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetLatestComponentUpdateOperationCompleted);
}
this.InvokeAsync("GetLatestComponentUpdate", new object[] {
componentCode}, this.GetLatestComponentUpdateOperationCompleted, userState);
}
private void OnGetLatestComponentUpdateOperationCompleted(object arg) {
if ((this.GetLatestComponentUpdateCompleted != null)) {
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.GetLatestComponentUpdateCompleted(this, new GetLatestComponentUpdateCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://websitepanel.net/services/GetComponentUpdate", RequestNamespace="http://websitepanel.net/services", ResponseNamespace="http://websitepanel.net/services", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public System.Data.DataSet GetComponentUpdate(string componentCode, string release) {
object[] results = this.Invoke("GetComponentUpdate", new object[] {
componentCode,
release});
return ((System.Data.DataSet)(results[0]));
}
/// <remarks/>
public void GetComponentUpdateAsync(string componentCode, string release) {
this.GetComponentUpdateAsync(componentCode, release, null);
}
/// <remarks/>
public void GetComponentUpdateAsync(string componentCode, string release, object userState) {
if ((this.GetComponentUpdateOperationCompleted == null)) {
this.GetComponentUpdateOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetComponentUpdateOperationCompleted);
}
this.InvokeAsync("GetComponentUpdate", new object[] {
componentCode,
release}, this.GetComponentUpdateOperationCompleted, userState);
}
private void OnGetComponentUpdateOperationCompleted(object arg) {
if ((this.GetComponentUpdateCompleted != null)) {
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.GetComponentUpdateCompleted(this, new GetComponentUpdateCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/>
public new void CancelAsync(object userState) {
base.CancelAsync(userState);
}
private bool IsLocalFileSystemWebService(string url) {
if (((url == null)
|| (url == string.Empty))) {
return false;
}
System.Uri wsUri = new System.Uri(url);
if (((wsUri.Port >= 1024)
&& (string.Compare(wsUri.Host, "localHost", System.StringComparison.OrdinalIgnoreCase) == 0))) {
return true;
}
return false;
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.0.30319.1")]
public delegate void GetReleaseFileInfoCompletedEventHandler(object sender, GetReleaseFileInfoCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.0.30319.1")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class GetReleaseFileInfoCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
private object[] results;
internal GetReleaseFileInfoCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
base(exception, cancelled, userState) {
this.results = results;
}
/// <remarks/>
public System.Data.DataSet Result {
get {
this.RaiseExceptionIfNecessary();
return ((System.Data.DataSet)(this.results[0]));
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.0.30319.1")]
public delegate void GetFileChunkCompletedEventHandler(object sender, GetFileChunkCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.0.30319.1")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class GetFileChunkCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
private object[] results;
internal GetFileChunkCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
base(exception, cancelled, userState) {
this.results = results;
}
/// <remarks/>
public byte[] Result {
get {
this.RaiseExceptionIfNecessary();
return ((byte[])(this.results[0]));
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.0.30319.1")]
public delegate void GetFileSizeCompletedEventHandler(object sender, GetFileSizeCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.0.30319.1")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class GetFileSizeCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
private object[] results;
internal GetFileSizeCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
base(exception, cancelled, userState) {
this.results = results;
}
/// <remarks/>
public long Result {
get {
this.RaiseExceptionIfNecessary();
return ((long)(this.results[0]));
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.0.30319.1")]
public delegate void GetAvailableComponentsCompletedEventHandler(object sender, GetAvailableComponentsCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.0.30319.1")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class GetAvailableComponentsCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
private object[] results;
internal GetAvailableComponentsCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
base(exception, cancelled, userState) {
this.results = results;
}
/// <remarks/>
public System.Data.DataSet Result {
get {
this.RaiseExceptionIfNecessary();
return ((System.Data.DataSet)(this.results[0]));
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.0.30319.1")]
public delegate void GetLatestComponentUpdateCompletedEventHandler(object sender, GetLatestComponentUpdateCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.0.30319.1")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class GetLatestComponentUpdateCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
private object[] results;
internal GetLatestComponentUpdateCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
base(exception, cancelled, userState) {
this.results = results;
}
/// <remarks/>
public System.Data.DataSet Result {
get {
this.RaiseExceptionIfNecessary();
return ((System.Data.DataSet)(this.results[0]));
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.0.30319.1")]
public delegate void GetComponentUpdateCompletedEventHandler(object sender, GetComponentUpdateCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.0.30319.1")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class GetComponentUpdateCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
private object[] results;
internal GetComponentUpdateCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
base(exception, cancelled, userState) {
this.results = results;
}
/// <remarks/>
public System.Data.DataSet Result {
get {
this.RaiseExceptionIfNecessary();
return ((System.Data.DataSet)(this.results[0]));
}
}
}
}
#pragma warning restore 1591

View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<DiscoveryClientResultsFile xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Results>
<DiscoveryClientResult referenceType="System.Web.Services.Discovery.ContractReference" url="http://www.websitepanel.net/Services/InstallerService.asmx?wsdl" filename="InstallerService.wsdl" />
<DiscoveryClientResult referenceType="System.Web.Services.Discovery.DiscoveryDocumentReference" url="http://www.websitepanel.net/Services/InstallerService.asmx?disco" filename="InstallerService.disco" />
</Results>
</DiscoveryClientResultsFile>

View file

@ -0,0 +1,134 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{0E4A3F5B-0BB1-4F63-863D-7B0182B378CF}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>WebsitePanel.Installer.Core</RootNamespace>
<AssemblyName>WebsitePanel.Installer.Core</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>none</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Ionic.Zip.Reduced">
<HintPath>..\..\Lib\Ionic.Zip.Reduced.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.configuration" />
<Reference Include="System.Data" />
<Reference Include="System.DirectoryServices" />
<Reference Include="System.EnterpriseServices" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.ServiceModel" />
<Reference Include="System.Web.Services" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\VersionInfo.cs">
<Link>VersionInfo.cs</Link>
</Compile>
<Compile Include="AppConfigManager.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Common\AssemblyLoader.cs" />
<Compile Include="Common\FileUtils.cs" />
<Compile Include="Common\Global.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Common\Log.cs" />
<Compile Include="Common\OS.cs" />
<Compile Include="Common\RegistryUtils.cs" />
<Compile Include="Common\Utils.cs" />
<Compile Include="Configuration\ComponentCollection.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Configuration\ComponentConfigElement.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Configuration\ConfigKeys.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Configuration\InstallerSection.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Loader.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
<DependentUpon>Settings.settings</DependentUpon>
</Compile>
<Compile Include="ServiceProviderProxy.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Web References\InstallerService\Reference.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Reference.map</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<WebReferences Include="Web References\" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<None Include="Web References\InstallerService\InstallerService.wsdl" />
<None Include="Web References\InstallerService\Reference.map">
<Generator>MSDiscoCodeGenerator</Generator>
<LastGenOutput>Reference.cs</LastGenOutput>
</None>
</ItemGroup>
<ItemGroup>
<WCFMetadata Include="Service References\" />
</ItemGroup>
<ItemGroup>
<WebReferenceUrl Include="http://www.websitepanel.net/Services/InstallerService.asmx">
<UrlBehavior>Dynamic</UrlBehavior>
<RelPath>Web References\InstallerService\</RelPath>
<UpdateFromURL>http://www.websitepanel.net/Services/InstallerService.asmx</UpdateFromURL>
<ServiceLocationURL>
</ServiceLocationURL>
<CachedDynamicPropName>
</CachedDynamicPropName>
<CachedAppSettingsObjectName>Settings</CachedAppSettingsObjectName>
<CachedSettingsPropName>WebsitePanel_Installer_Core_InstallerService_InstallerService</CachedSettingsPropName>
</WebReferenceUrl>
</ItemGroup>
<ItemGroup>
<None Include="Web References\InstallerService\InstallerService.disco" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\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,20 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="WebsitePanel.Installer.Core.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</sectionGroup>
</configSections>
<system.serviceModel>
<bindings />
<client />
</system.serviceModel>
<applicationSettings>
<WebsitePanel.Installer.Core.Properties.Settings>
<setting name="WebsitePanel_Installer_Core_InstallerService_InstallerService"
serializeAs="String">
<value>http://www.websitepanel.net/Services/InstallerService.asmx</value>
</setting>
</WebsitePanel.Installer.Core.Properties.Settings>
</applicationSettings>
</configuration>