private void AddAppToDB(HomeStoreApp app) { moduleDb.Add(app.AppName, app); }
/// <summary> /// Takes an xml node which describes a homestore app and returns /// a HomeStoreApp structure /// </summary> /// <param name="xmlModule">the xml subtree of the app</param> /// <returns>The relevant HomeStoreApp structure</returns> private HomeStoreApp ReadHomeStoreAppFromXml(Uri baseUri, XmlElement xmlModule) { if (!xmlModule.Name.Equals("Module")) throw new Exception("child is not a Module in " + xmlModule); HomeStoreApp homeStoreApp = new HomeStoreApp(); homeStoreApp.AppName = xmlModule.GetAttribute("AppName"); homeStoreApp.BinaryName = xmlModule.GetAttribute("BinaryName"); homeStoreApp.Description = xmlModule.GetAttribute("Description"); homeStoreApp.Rating = int.Parse(xmlModule.GetAttribute("Rating")); #region we don't have binary url anymore //try //{ // string binaryUrlString = xmlModule.GetAttribute("BinaryUrl"); // if (!String.IsNullOrWhiteSpace(binaryUrlString)) // { // //this function does the right thing if binaryUrlString is already absolute // homeStoreApp.BinaryUrl = new Uri(baseUri, binaryUrlString).ToString(); // } // else // { // homeStoreApp.BinaryUrl = null; // } //} //catch (Exception ex) //{ // logger.Log("exception in parsing BinaryUrl for {0}: {1}", homeStoreApp.AppName, ex.ToString()); // homeStoreApp.BinaryUrl = null; //} #endregion homeStoreApp.IconUrl = null; try { string iconUrlString = xmlModule.GetAttribute("IconUrl"); if (!String.IsNullOrWhiteSpace(iconUrlString)) { //this function does the right thing if iconUrlString is already absolute homeStoreApp.IconUrl = new Uri(baseUri, iconUrlString).ToString(); } } catch (Exception ex) { logger.Log("exception in parsing IconUrl for {0}: {1}", homeStoreApp.AppName, ex.ToString()); } homeStoreApp.Version = null; try { string versionString = xmlModule.GetAttribute("Version"); if (!String.IsNullOrWhiteSpace(versionString)) { homeStoreApp.Version = versionString; } } catch (Exception ex) { logger.Log("exception in parsing Version for {0}: {1}", homeStoreApp.AppName, ex.ToString()); } homeStoreApp.Manifest = ReadManifest(xmlModule, roleDb); //this field is filled in later homeStoreApp.CompatibleWithHome = false; return homeStoreApp; }
public bool IsCompatableWithHome(HomeStoreApp app) { return app.Manifest.IsCompatibleWithHome(System.Linq.Enumerable.ToList<VRole>(configuredRolesInHome.Keys)); }