Commit Contribution from Helicon

Includes:

- complete re-write of Web Application Gallery
- Addition of Web PI Installer in Server module
This commit is contained in:
omara_vworks 2012-07-19 13:16:33 -04:00
parent 3b81883a25
commit a2beec7fe4
80 changed files with 9236 additions and 1762 deletions

View file

@ -43,6 +43,7 @@ using System.IO;
using Microsoft.Win32;
using Microsoft.Web.Deployment;
using WebsitePanel.Providers.HostedSolution;
using WebsitePanel.Providers.Web.WPIWebApplicationGallery;
using WebsitePanel.Server.Utils;
using WebsitePanel.Providers.OS;
using WebsitePanel.Providers.Utils;
@ -283,7 +284,7 @@ namespace WebsitePanel.Providers.Web
get
{
string ret = ProviderSettings["GalleryXmlFeedUrl"];
if (string.IsNullOrEmpty(ret))
if (String.IsNullOrEmpty(ret))
ret = WebApplicationGallery.WAG_DEFAULT_FEED_URL;
return ret;
}
@ -3386,246 +3387,209 @@ namespace WebsitePanel.Providers.Web
return IsIISInstalled();
}
#region Microsoft Web Application Gallery
#region Microsoft Web Application Gallery
public GalleryCategoriesResult GetGalleryCategories()
{
GalleryCategoriesResult result = new GalleryCategoriesResult();
private const string MS_DEPLOY_ASSEMBLY_NAME = "Microsoft.Web.Deployment";
private const string WPI_INSTANCE_VIEWER = "viewer";
private const string WPI_INSTANCE_INSTALLER = "installer";
try
{
WebApplicationGallery module = new WebApplicationGallery(GalleryXmlFeedUrl);
//
result.Value = module.GetCategories();
result.IsSuccess = true;
}
catch (Exception ex)
{
result.IsSuccess = false;
result.AddError(GalleryErrors.ProcessingFeedXMLError, ex);
}
//
return result;
}
public void InitFeeds(int UserId, string[] feeds)
{
//need to call InitFeeds() before any operation with WPIApplicationGallery()
WPIApplicationGallery module = new WPIApplicationGallery(WPI_INSTANCE_VIEWER);
module.InitFeeds(UserId, feeds);
}
public GalleryApplicationsResult GetGalleryApplications(string categoryId)
{
GalleryApplicationsResult result = new GalleryApplicationsResult();
public void SetResourceLanguage(int UserId, string resourceLanguage)
{
WPIApplicationGallery module = new WPIApplicationGallery(WPI_INSTANCE_VIEWER);
module.SetResourceLanguage(UserId, resourceLanguage);
}
try
{
WebApplicationGallery module = new WebApplicationGallery(GalleryXmlFeedUrl);
//
result.Value = module.GetApplications(categoryId);
result.IsSuccess = true;
}
catch (Exception ex)
{
result.IsSuccess = false;
result.AddError(GalleryErrors.ProcessingFeedXMLError, ex);
}
//
return result;
}
public bool IsMsDeployInstalled()
{
// project has reference to Microsoft.Web.Deployment, so
return true;
/*
try
{
Assembly.Load(MS_DEPLOY_ASSEMBLY_NAME);
return true;
}
catch
{
// type could not be instantiated
return false;
}
*/
}
public GalleryApplicationResult GetGalleryApplication(string id)
{
GalleryApplicationResult result = new GalleryApplicationResult();
//
try
{
WebApplicationGallery module = new WebApplicationGallery(GalleryXmlFeedUrl);
//
result.Value = module.GetApplicationByProductId(id);
result.IsSuccess = true;
}
catch (Exception ex)
{
result.IsSuccess = false;
result.AddError(GalleryErrors.ProcessingFeedXMLError, ex);
}
//
return result;
}
public GalleryLanguagesResult GetGalleryLanguages(int UserId)
{
GalleryLanguagesResult result = new GalleryLanguagesResult();
WPIApplicationGallery module = new WPIApplicationGallery(WPI_INSTANCE_VIEWER);
try
{
result.Value = module.GetLanguages(UserId);
result.IsSuccess = true;
}
catch (Exception ex)
{
result.IsSuccess = false;
result.AddError(GalleryErrors.GetLanguagesError, ex);
}
public GalleryWebAppStatus GetGalleryApplicationStatus(string id)
{
GalleryWebAppStatus status = GalleryWebAppStatus.NotDownloaded;
//
try
{
WebApplicationGallery module = new WebApplicationGallery(GalleryXmlFeedUrl);
//
GalleryApplication appObject = module.GetApplicationByProductId(id);
//
if (appObject == null)
return GalleryWebAppStatus.Failed;
//
string appPackageDistr = module.GetApplicationPackagePath(appObject);
// Check whether distributive exists locally
if (!File.Exists(appPackageDistr))
return GalleryWebAppStatus.NotDownloaded;
// Check whether distributive is in download queue
if (AppPackagesDownloader.IsApplicationInDownloadQueue(id))
return GalleryWebAppStatus.Downloading;
// From this point distibutive is considered as existed locally and it's not in download queue,
// so lets ensure the downloaded file either is not corrupted during the download process
#region Atom Feed Version 0.2
if (appObject.InstallerItems.Count > 0)
{
string md5CheckSum = appObject.InstallerItems[0].InstallerFile.MD5;
// Check MD5 check sum of the distributive
if (AppPackagesDownloader.CheckApplicationPackageHashSum_MD5(appPackageDistr, md5CheckSum))
status = GalleryWebAppStatus.Downloaded;
}
#endregion
return result;
}
#region Atom Feed Version 2.0.1.0
else if (appObject.Installers.Count > 0)
{
string sha1CheckSum = appObject.Installers[0].InstallerFile.SHA1;
// Check SHA1 check sum of the distributive
if (AppPackagesDownloader.CheckApplicationPackageHashSum_SHA1(appPackageDistr, sha1CheckSum))
status = GalleryWebAppStatus.Downloaded;
}
#endregion
// If MD5 check sum is failed then we have to resume distibutive download
else
status = GalleryWebAppStatus.NotDownloaded;
}
catch (Exception ex)
{
Log.WriteError(ex);
//
return GalleryWebAppStatus.Failed;
}
//
return status;
}
public GalleryCategoriesResult GetGalleryCategories(int UserId)
{
GalleryCategoriesResult result = new GalleryCategoriesResult();
public GalleryWebAppStatus DownloadGalleryApplication(string id)
{
WebApplicationGallery module = new WebApplicationGallery(GalleryXmlFeedUrl);
//
GalleryApplication appObject = module.GetApplicationByProductId(id);
if (appObject == null)
return GalleryWebAppStatus.Failed;
//
string localAppDistr = module.GetApplicationPackagePath(appObject);
//
InstallerFile installerFile = null;
//try
//{
WPIApplicationGallery module = new WPIApplicationGallery(WPI_INSTANCE_VIEWER);
//
result.Value = module.GetCategories(UserId);
result.IsSuccess = true;
//}
//catch (Exception ex)
//{
// result.IsSuccess = false;
// result.AddError(GalleryErrors.ProcessingFeedXMLError, ex);
//}
////
return result;
}
#region Atom Feed Version 0.2
//
if (appObject.InstallerItems.Count > 0)
{
InstallerItem installerItem_0 = appObject.InstallerItems[0];
//
if (installerItem_0 == null)
{
Log.WriteWarning(WEB_PI_APP_PACK_ROOT_INSTALLER_ITEM_MISSING, appObject.Title);
return GalleryWebAppStatus.Failed;
}
//
installerFile = installerItem_0.InstallerFile;
}
#endregion
public GalleryApplicationsResult GetGalleryApplications(int UserId, string categoryId)
{
GalleryApplicationsResult result = new GalleryApplicationsResult();
#region Atom Feed Version 2.0.1.0
//
if (appObject.Installers.Count > 0)
{
Installer installerItem_0 = appObject.Installers[0];
//
if (installerItem_0 == null)
{
Log.WriteWarning(WEB_PI_APP_PACK_ROOT_INSTALLER_ITEM_MISSING, appObject.Title);
return GalleryWebAppStatus.Failed;
}
//
installerFile = installerItem_0.InstallerFile;
}
#endregion
try
{
WPIApplicationGallery module = new WPIApplicationGallery(WPI_INSTANCE_VIEWER);
//
result.Value = module.GetApplications(UserId, categoryId);
result.IsSuccess = true;
}
catch (Exception ex)
{
result.IsSuccess = false;
result.AddError(GalleryErrors.ProcessingFeedXMLError, ex);
}
//
return result;
}
//
if (installerFile == null || String.IsNullOrEmpty(installerFile.InstallerUrl))
{
Log.WriteWarning(WEB_PI_APP_PACK_DISPLAY_URL_MISSING, appObject.Title);
return GalleryWebAppStatus.Failed;
}
public GalleryApplicationsResult GetGalleryApplicationsFiltered(int UserId, string pattern)
{
GalleryApplicationsResult result = new GalleryApplicationsResult();
//
try
{
string appCacheRoot = Path.GetDirectoryName(localAppDistr);
//
if (!Directory.Exists(appCacheRoot))
Directory.CreateDirectory(appCacheRoot);
//
Log.WriteInfo("Local distributive path: {0}", localAppDistr);
AppPackagesDownloader.StartApplicationDownload(id, installerFile.InstallerUrl, localAppDistr);
}
catch (Exception ex)
{
Log.WriteError(ex);
//
return GalleryWebAppStatus.Failed;
}
//
return GalleryWebAppStatus.Downloading;
}
try
{
WPIApplicationGallery module = new WPIApplicationGallery(WPI_INSTANCE_VIEWER);
public bool IsMsDeployInstalled()
{
WebApplicationGallery module = new WebApplicationGallery(GalleryXmlFeedUrl);
//
return module.IsMsDeployInstalled();
}
result.Value = module.GetGalleryApplicationsFiltered(UserId, pattern);
result.IsSuccess = true;
}
catch (Exception ex)
{
result.IsSuccess = false;
result.AddError(ex.Message, ex);
}
public DeploymentParametersResult GetGalleryApplicationParameters(string id)
{
DeploymentParametersResult result = new DeploymentParametersResult();
try
{
WebApplicationGallery module = new WebApplicationGallery(GalleryXmlFeedUrl);
//
result.Value = module.GetApplicationParameters(id);
result.IsSuccess = true;
}
catch (Exception ex)
{
result.IsSuccess = false;
result.AddError(GalleryErrors.ProcessingPackageError, ex);
}
//
return result;
}
return result;
}
public StringResultObject InstallGalleryApplication(string webAppId, List<DeploymentParameter> updatedValues)
{
StringResultObject result = new StringResultObject();
try
{
WebApplicationGallery module = new WebApplicationGallery(GalleryXmlFeedUrl);
//
string applicationPath = module.InstallApplication(webAppId, updatedValues);
//
if (!String.IsNullOrEmpty(applicationPath))
{
result.Value = applicationPath;
result.IsSuccess = true;
}
}
catch (Exception ex)
{
result.IsSuccess = false;
result.AddError(GalleryErrors.PackageInstallationError, ex);
}
//
return result;
}
public GalleryApplicationResult GetGalleryApplication(int UserId, string id)
{
GalleryApplicationResult result = new GalleryApplicationResult();
//
try
{
WPIApplicationGallery module = new WPIApplicationGallery(WPI_INSTANCE_VIEWER);
//
result.Value = module.GetApplicationByProductId(UserId, id);
result.IsSuccess = true;
result.ErrorCodes.AddRange(module.GetMissingDependenciesForApplicationById(UserId, id));
}
catch (Exception ex)
{
result.IsSuccess = false;
result.AddError(GalleryErrors.ProcessingFeedXMLError, ex);
}
//
return result;
}
public GalleryWebAppStatus DownloadGalleryApplication(int UserId, string id)
{
return GetGalleryApplicationStatus(UserId, id);
}
public GalleryWebAppStatus GetGalleryApplicationStatus(int UserId, string id)
{
try
{
WPIApplicationGallery module = new WPIApplicationGallery(WPI_INSTANCE_INSTALLER);
return module.DownloadAppAndGetStatus(UserId, id);
}
catch (Exception ex)
{
Log.WriteError(ex);
return GalleryWebAppStatus.Failed;
}
}
public DeploymentParametersResult GetGalleryApplicationParameters(int UserId, string id)
{
DeploymentParametersResult result = new DeploymentParametersResult();
try
{
WPIApplicationGallery module = new WPIApplicationGallery(WPI_INSTANCE_INSTALLER);
//
result.Value = module.GetApplicationParameters(UserId, id);
result.IsSuccess = true;
}
catch (Exception ex)
{
result.IsSuccess = false;
result.AddError(GalleryErrors.ProcessingPackageError, ex);
}
//
return result;
}
public StringResultObject InstallGalleryApplication(int UserId, string webAppId, List<DeploymentParameter> updatedValues, string languageId)
{
StringResultObject result = new StringResultObject();
try
{
WPIApplicationGallery module = new WPIApplicationGallery(WPI_INSTANCE_INSTALLER);
//
module.InstallApplication(UserId, webAppId, updatedValues, languageId, ref result);
if (result.IsSuccess)
{
module.DeleteWpiHelper(UserId);
}
}
catch (Exception ex)
{
result.IsSuccess = false;
result.AddError(GalleryErrors.PackageInstallationError, ex);
}
//
return result;
}
#endregion

View file

@ -0,0 +1,438 @@
// Copyright (c) 2012, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System;
using System.Collections.Generic;
using System.IO;
using System.Security;
using System.Text;
using Microsoft.Practices.EnterpriseLibrary.Caching;
using Microsoft.Web.Deployment;
using Microsoft.Web.PlatformInstaller;
using WebsitePanel.Providers.ResultObjects;
using WebsitePanel.Providers.Utils;
using WebsitePanel.Providers.WebAppGallery;
using WebsitePanel.Server.Code;
using WebsitePanel.Server.Utils;
using System.Web;
using System.Diagnostics;
using Microsoft.Practices.EnterpriseLibrary.Caching.Expirations;
namespace WebsitePanel.Providers.Web.WPIWebApplicationGallery
{
internal class WPIApplicationGallery
{
private CacheManager _cache;
private const int LIVE_IN_CACHE_MINUTES = 20;
private string _sufix="";
public WPIApplicationGallery(string sufix)
{
_sufix = sufix;
//_feeds = new[]
// {
// "https://www.microsoft.com/web/webpi/3.0/webproductlist.xml",
// "http://www.helicontech.com/zoo/feed/wsp"
// };
_cache = CacheFactory.GetCacheManager();
//_wpi = GetWpiHelper();
}
private string GetKey_Feeds(int UserId)
{
return "WPIHELPER_CACHE_FEEDS" + UserId.ToString();
}
private string GetKey_object(int UserId)
{
return "WPIHELPER_CACHE_OBJECTS" + UserId.ToString() + _sufix;
}
public void InitFeeds(int UserId, string[] feeds)
{
//Log.WriteInfo("InitFeeds {0} ", UserId);
string CACHE_KEY = GetKey_Feeds(UserId);
if (_cache.Contains(CACHE_KEY))
{
string[] oldfeeds = (string[])_cache[CACHE_KEY];
if (!ArraysEqual<string>(feeds, oldfeeds))
{
//Feeeds have been changed
ICacheItemExpiration exp = new SlidingTime(TimeSpan.FromMinutes(LIVE_IN_CACHE_MINUTES*2));
_cache.Add(CACHE_KEY, feeds, CacheItemPriority.Normal, null, exp );
DeleteWpiHelper(UserId);
}
}
else
{
//add to cache
ICacheItemExpiration exp = new SlidingTime(TimeSpan.FromMinutes(LIVE_IN_CACHE_MINUTES*2));
_cache.Add(CACHE_KEY, feeds, CacheItemPriority.Normal, null, exp);
}
}
private WpiHelper GetWpiHelper(int UserId)
{
string CACHE_KEY = GetKey_object(UserId);
if (_cache.Contains(CACHE_KEY))
{
WpiHelper result = (WpiHelper)_cache[CACHE_KEY];
if (result != null)
{
return result;
}
}
string[] feeds = (string[])_cache[GetKey_Feeds(UserId)];
if (null == feeds)
{
throw new Exception("BUG:No feeds in cache.");
}
WpiHelper wpi = new WpiHelper(feeds);
ICacheItemExpiration exp = new SlidingTime(TimeSpan.FromMinutes(LIVE_IN_CACHE_MINUTES));
_cache.Add(CACHE_KEY, wpi, CacheItemPriority.Normal, null, exp);
//Debug.WriteLine(string.Format("GetWpiHelper: put in cache. User {0}", UserId));
return wpi;
}
public void DeleteWpiHelper(int UserId)
{
_cache.Remove(GetKey_object(UserId));
}
#region Public methods
public void SetResourceLanguage(int UserId, string resourceLanguage)
{
WpiHelper wpi = GetWpiHelper(UserId);
wpi.SetResourceLanguage(resourceLanguage);
}
public List<SettingPair> GetLanguages(int UserId)
{
List<SettingPair> langs = new List<SettingPair>();
WpiHelper wpi = GetWpiHelper(UserId);
foreach (Language lang in wpi.GetLanguages())
{
langs.Add(new SettingPair(lang.Id, lang.Name));
}
return langs;
}
public List<GalleryCategory> GetCategories(int UserId)
{
WpiHelper wpi = GetWpiHelper(UserId);
List<GalleryCategory> categories = new List<GalleryCategory>();
foreach (Keyword keyword in wpi.GetKeywords())
{
if (wpi.IsKeywordApplication(keyword))
{
categories.Add(new GalleryCategory
{
Id = keyword.Id,
Name = keyword.Text
});
}
}
return categories;
}
public List<GalleryApplication> GetApplications(int UserId, string categoryId)
{
WpiHelper wpi = GetWpiHelper(UserId);
List<Product> products = wpi.GetApplications(categoryId);
List<GalleryApplication> applications = new List<GalleryApplication>();
foreach (Product product in products)
{
applications.Add(MakeGalleryApplicationFromProduct(product));
}
return applications;
}
public List<GalleryApplication> GetGalleryApplicationsFiltered(int UserId, string pattern)
{
WpiHelper wpi = GetWpiHelper(UserId);
List<Product> products = wpi.GetApplications(null);
List<GalleryApplication> applications = new List<GalleryApplication>();
foreach (Product product in products)
{
if (product.Title.ToLower().Contains(pattern.ToLower()))
{
applications.Add(MakeGalleryApplicationFromProduct(product));
}
}
return applications;
}
public GalleryApplication GetApplicationByProductId(int UserId, string id)
{
WpiHelper wpi = GetWpiHelper(UserId);
return MakeGalleryApplicationFromProduct(wpi.GetProduct(id));
}
public List<string> GetMissingDependenciesForApplicationById(int UserId, string id)
{
WpiHelper wpi = GetWpiHelper(UserId);
List<string> missingDeps = new List<string>();
foreach (Product product in wpi.GetProductsWithDependencies(new string[] { id }))
{
if (product.ProductId != id)
{
missingDeps.Add(product.Title);
}
}
return missingDeps;
}
public GalleryWebAppStatus DownloadAppAndGetStatus(int UserId, string id)
{
WpiHelper wpi = GetWpiHelper(UserId);
wpi.InstallProducts(new[] { id }, null, null, null);
return GalleryWebAppStatus.Downloaded;
}
public List<DeploymentParameter> GetApplicationParameters(int UserId, string id)
{
WpiHelper wpi = GetWpiHelper(UserId);
Product product = wpi.GetProduct(id);
List<DeploymentParameter> deploymentParameters = new List<DeploymentParameter>();
IList<DeclaredParameter> appDecalredParameters = wpi.GetAppDecalredParameters(id);
foreach (DeclaredParameter declaredParameter in appDecalredParameters)
{
deploymentParameters.Add(MakeDeploymentParameterFromDecalredParameter(declaredParameter));
}
return deploymentParameters;
}
public void InstallApplication(
int UserId,
string webAppId,
List<DeploymentParameter> updatedParameters,
string languageId,
ref StringResultObject result)
{
WpiHelper wpi = GetWpiHelper(UserId);
// convert list of DeploymentParameter to list of WpiUpdatedDeploymentParameter
List<WpiUpdatedDeploymentParameter> updatedWpiParameters = new List<WpiUpdatedDeploymentParameter>();
foreach (DeploymentParameter updatedParameter in updatedParameters)
{
updatedWpiParameters.Add(
new WpiUpdatedDeploymentParameter
{
Name = updatedParameter.Name,
Value = updatedParameter.Value,
WellKnownTags = (DeploymentWellKnownTag)updatedParameter.WellKnownTags
}
);
}
Log.WriteStart("Application installation starting");
string log;
string failedMessage;
bool success = wpi.InstallApplication(
webAppId,
updatedWpiParameters,
languageId,
InstallStatusUpdatedHandler, InstallCompleteHandler,
out log,
out failedMessage);
result.Value = log;
result.IsSuccess = success;
// add log files to result value
try
{
StringBuilder sb = new StringBuilder();
string[] filePaths = Directory.GetFiles(wpi.GetLogFileDirectory());
foreach (string filePath in filePaths)
{
using (StreamReader streamReader = new StreamReader(filePath))
{
string fileContent =
SecurityElement.Escape(StringUtils.CleanupASCIIControlCharacters(streamReader.ReadToEnd()));
sb.AppendLine().AppendLine(filePath).AppendLine(fileContent);
}
}
result.Value += sb.ToString();
}
catch(Exception)
{
}
if (!success)
{
result.AddError(failedMessage, null);
}
// don`t reuse wpi helper after installation
DeleteWpiHelper(UserId);
}
#endregion
#region installaton events
private void InstallStatusUpdatedHandler(object sender, InstallStatusEventArgs installStatusEventArgs)
{
Log.WriteInfo("Application {0} installation status: {1}, return code: {0}",
installStatusEventArgs.InstallerContext.ProductName,
installStatusEventArgs.InstallerContext.InstallationState,
installStatusEventArgs.InstallerContext.ReturnCode);
}
private void InstallCompleteHandler(object sender, EventArgs eventArgs)
{
Log.WriteEnd("Application installation completed");
}
#endregion
#region static helpers
protected static GalleryApplication MakeGalleryApplicationFromProduct(Product product)
{
if (null == product)
{
return null;
}
int size = 0;
if (null != product.Installers && product.Installers.Count > 0 && null != product.Installers[0].InstallerFile)
{
size = product.Installers[0].InstallerFile.FileSize;
}
return new GalleryApplication
{
Id = product.ProductId,
Title = product.Title,
Author = new Author {Name = product.Author, Uri = product.AuthorUri.ToString()},
IconUrl = product.IconUrl.ToString(),
Version = product.Version,
Description = product.LongDescription,
Summary = product.Summary,
LastUpdated = product.Published,
Published = product.Published,
Link = product.Link.ToString(),
InstallerFileSize = size
};
}
protected static DeploymentParameter MakeDeploymentParameterFromDecalredParameter(DeclaredParameter d)
{
DeploymentParameter r = new DeploymentParameter();
r.Name = d.Name;
r.FriendlyName = d.FriendlyName;
r.DefaultValue = d.DefaultValue;
r.Description = d.Description;
r.WellKnownTags = (DeploymentParameterWellKnownTag) d.Tags;
if (null != d.Validation)
{
r.ValidationKind = (DeploymentParameterValidationKind) d.Validation.Kind;
r.ValidationString = d.Validation.ValidationString;
}
else
{
r.ValidationKind = DeploymentParameterValidationKind.None;
}
return r;
}
protected static bool ArraysEqual<T>(T[] a1, T[] a2)
{
if (ReferenceEquals(a1, a2))
return true;
if (a1 == null || a2 == null)
return false;
if (a1.Length != a2.Length)
return false;
EqualityComparer<T> comparer = EqualityComparer<T>.Default;
for (int i = 0; i < a1.Length; i++)
{
if (!comparer.Equals(a1[i], a2[i])) return false;
}
return true;
}
#endregion
}
}

View file

@ -51,7 +51,8 @@ using System.Linq;
namespace WebsitePanel.Providers.Web
{
public sealed class WebApplicationGallery
[Obsolete]
public sealed class WebApplicationGallery
{
// MS Deploy library
private const string MS_DEPLOY_ASSEMBLY_NAME = "Microsoft.Web.Deployment";

View file

@ -67,10 +67,14 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\Lib\Microsoft.Practices.ObjectBuilder.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Web.Deployment, Version=7.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<Reference Include="Microsoft.Web.Deployment, Version=9.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\Lib\References\Microsoft\Microsoft.Web.Deployment.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Web.PlatformInstaller, Version=3.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\Lib\Microsoft.Web.PlatformInstaller.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.DirectoryServices" />
@ -82,9 +86,13 @@
<Compile Include="..\VersionInfo.cs">
<Link>VersionInfo.cs</Link>
</Compile>
<Compile Include="..\WebsitePanel.Server\Code\WPIHelper.cs">
<Link>WPIWebApplicationGallery\WPIHelper.cs</Link>
</Compile>
<Compile Include="IIs60.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="WebApplicationGallery.cs" />
<Compile Include="WPIWebApplicationGallery\WPIApplicationGallery.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\WebsitePanel.Providers.Base\WebsitePanel.Providers.Base.csproj">