public void BindApplicationDetails(GalleryApplication application) { lblVersion.Text = application.Version; lblDescription.Text = application.Description; lblTitle.Text = application.Title; lblSize.Text = application.Size; imgLogo.ImageUrl = "~/DesktopModules/WebsitePanel/resizeimage.ashx?url=" + Server.UrlEncode(application.IconUrl) + "&width=200&height=200"; hlAuthor.Text = application.AuthorName; hlAuthor.NavigateUrl = application.AuthorUrl; }
private void UpdateApplicationWellKnownDependencies(GalleryApplication app, Dependency dependency) { if (dependency.IdRef != null && wellKnownDependencies.ContainsKey(dependency.IdRef)) app.WellKnownDependencies |= wellKnownDependencies[dependency.IdRef]; // process "And" foreach (Dependency d in dependency.And) UpdateApplicationWellKnownDependencies(app, d); // process "Or" foreach (Dependency d in dependency.Or) UpdateApplicationWellKnownDependencies(app, d); // process "LogicalAnd" foreach (Dependency d in dependency.LogicalAnd) UpdateApplicationWellKnownDependencies(app, d); // process "LogicalOr" foreach (Dependency d in dependency.LogicalOr) UpdateApplicationWellKnownDependencies(app, d); }
public string GetApplicationPackagePath(GalleryApplication app) { // string appPackagePath = null; // if (app != null) { InstallerFile installerFile = null; // Acquire root installer item #region Atom Feed Version 0.2 if (app.InstallerItems.Count > 0) { InstallerItem installerItem_0 = app.InstallerItems[0]; if (installerItem_0 == null) { Log.WriteWarning(WEB_PI_APP_PACK_ROOT_INSTALLER_ITEM_MISSING, app.Title); return appPackagePath; } // Ensure web app package can be reached installerFile = installerItem_0.InstallerFile; } #endregion #region Atom Feed Version 2.0.1.0 else if (app.Installers.Count > 0) { Installer installerItem_0 = app.Installers[0]; if (installerItem_0 == null) { Log.WriteWarning(WEB_PI_APP_PACK_ROOT_INSTALLER_ITEM_MISSING, app.Title); return appPackagePath; } // Ensure web app package can be reached installerFile = installerItem_0.InstallerFile; } #endregion if (installerFile == null || String.IsNullOrEmpty(installerFile.InstallerUrl)) { Log.WriteWarning(WEB_PI_APP_PACK_DISPLAY_URL_MISSING, app.Title); return appPackagePath; } // Log.WriteInfo("Web App Download URL: {0}", installerFile.InstallerUrl); // Trying to match the original file name HttpWebRequest webReq = (HttpWebRequest)HttpWebRequest.Create(installerFile.InstallerUrl); { // Regex regex = new Regex("filename=\"(?<packageName>.{0,})\""); string packageName = null; // webReq.UserAgent = String.Format(WEB_PI_USER_AGENT_HEADER, Environment.OSVersion.VersionString); // using (HttpWebResponse webResp = (HttpWebResponse)webReq.GetResponse()) { string httpHeader = webResp.Headers["Content-Disposition"]; // if (!String.IsNullOrEmpty(httpHeader)) { string fileName = Array.Find<string>(httpHeader.Split(';'), x => x.Trim().StartsWith("filename=")); // Match match = regex.Match(fileName); // Match has been acquired if (match != null && match.Success) { packageName = match.Groups["packageName"].Value; } } } // Download URL points to the download package directly if (String.IsNullOrEmpty(packageName)) { packageName = Path.GetFileName(installerFile.InstallerUrl); } // if (HttpContext.Current != null) { appPackagePath = HttpContext.Current.Server.MapPath(String.Format("~/App_Cache/{0}", packageName)); } else { string assemblyPath = Path.GetDirectoryName(this.GetType().Assembly.Location); appPackagePath = Path.Combine(assemblyPath, String.Format(@"App_Cache\{0}", packageName)); } } } // return appPackagePath; }
private string GetAppLaunchUrl(GalleryApplication app, string siteUrl) { // fix app start page string startPage = app.StartPage != null ? app.StartPage.Replace('\\', '/').TrimStart('/') : ""; // build URL string url = "http://" + siteUrl; // append virtual dir if (directoryName.Text != "") url += "/" + directoryName.Text; // append start page and return return url + "/" + startPage; }