private void AddScoutToDB(HomeStoreScout scout) { scoutDb.Add(scout.Name, scout); }
/// <summary> /// Takes an xml node which describes a homestore scout and returns /// a HomeStoreScout structure /// </summary> /// <param name="xmlScout">the xml subtree of the app</param> /// <returns>The relevant HomeStoreScout structure</returns> private HomeStoreScout ReadHomeStoreScoutFromXml(Uri baseUri, XmlElement xmlScout) { if (!xmlScout.Name.Equals("Scout")) throw new Exception("child is not a Scout in " + xmlScout); HomeStoreScout homeStoreScout = new HomeStoreScout(); homeStoreScout.Name = xmlScout.GetAttribute("Name"); homeStoreScout.DllName = xmlScout.GetAttribute("DllName").Replace(".dll", ""); homeStoreScout.Description = xmlScout.GetAttribute("Description"); homeStoreScout.Rating = int.Parse(xmlScout.GetAttribute("Rating")); homeStoreScout.IconUrl = null; try { string iconUrlString = xmlScout.GetAttribute("IconUrl"); if (!String.IsNullOrWhiteSpace(iconUrlString)) { //this function does the right thing if iconUrlString is already absolute homeStoreScout.IconUrl = new Uri(baseUri, iconUrlString).ToString(); } } catch (Exception ex) { logger.Log("exception in parsing IconUrl for {0}: {1}", homeStoreScout.Name, ex.ToString()); } homeStoreScout.Version = Constants.UnknownHomeOSUpdateVersionValue; try { string versionString = xmlScout.GetAttribute("Version"); if (!String.IsNullOrWhiteSpace(versionString)) { homeStoreScout.Version = versionString; } } catch (Exception ex) { logger.Log("exception in parsing Version for {0}: {1}", homeStoreScout.Name, ex.ToString()); } return homeStoreScout; }
public ScoutInfo(HomeStoreScout hsScout) : this(hsScout.Name, hsScout.DllName) { if (!string.IsNullOrEmpty(hsScout.Version)) SetDesiredVersion(hsScout.Version); }