Пример #1
0
		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;
		}
Пример #2
0
		public bool IsMsDeployInstalled()
		{
			WebApplicationGallery module = new WebApplicationGallery(GalleryXmlFeedUrl);
			//
			return module.IsMsDeployInstalled();
		}
Пример #3
0
		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;
		}
Пример #4
0
		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;

			#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

			#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

			//
			if (installerFile == null || String.IsNullOrEmpty(installerFile.InstallerUrl))
			{
				Log.WriteWarning(WEB_PI_APP_PACK_DISPLAY_URL_MISSING, appObject.Title);
				return GalleryWebAppStatus.Failed;
			}

			//
			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;
 		}
Пример #5
0
		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
				
				#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;
		}
Пример #6
0
		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;
		}
Пример #7
0
		public GalleryCategoriesResult GetGalleryCategories()
		{
			GalleryCategoriesResult result = new GalleryCategoriesResult();
			
			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;
		}
Пример #8
0
		public GalleryApplicationsResult GetGalleryApplications(string categoryId)
		{
			GalleryApplicationsResult result = new GalleryApplicationsResult();

			try
			{
				WebApplicationGallery module = new WebApplicationGallery(GalleryXmlFeedUrl);
				//
				result.Value = module.GetApplications(categoryId);
				result.IsSuccess = true;
			}
			catch (Exception ex)
			{
				result.IsSuccess = false;
				result.AddError(GalleryErrorCodes.INVALID_FEED_XML, ex);
			}
			//
			return result;
		}