private CurrentAppSimulator(AppListing listingInformation, LicenseInformation licenseInformation, IDictionary <string, bool> methodResults) { _listingInformation = listingInformation; _licenseInformation = licenseInformation; _methodResults = methodResults; }
private static LicenseInformation GetLicenseInformationFromXml(IEnumerable <XElement> licenseNodes) { var li = new LicenseInformation(); var licenseNode = licenseNodes.First(); var expirationString = licenseNode.Element("ExpirationDate").SafeRead(); li.ExpirationDate = CalculateExpirationDate(expirationString); li.IsActive = bool.Parse(licenseNode.Element("IsActive").SafeRead("true")); li.IsTrial = bool.Parse(licenseNode.Element("IsTrial").SafeRead("true")); //Parse in-app-purchase-specific licenses foreach (var productLicenseNode in licenseNode.Elements("Product")) { var productId = productLicenseNode.Attribute("ProductId").SafeRead(); var isActive = bool.Parse(productLicenseNode.Element("IsActive").SafeRead("false")); var isConsumable = bool.Parse(productLicenseNode.Element("IsConsumable").SafeRead("false")); var expirationDate = CalculateExpirationDate(productLicenseNode.Element("ExpirationDate").SafeRead()); li.ProductLicenses.Add(productId, new ProductLicense() { ProductId = productId, ExpirationDate = expirationDate, IsActive = isActive, IsConsumable = isConsumable }); } return(li); }
#pragma warning restore 67 /// <summary> /// Creates a LicenseInformation class based upon a Windows.ApplicationModel.Store.LicenseInformation object /// </summary> /// <param name="source">A valid Windows.ApplicationModel.Store.LicenseInformation object</param> /// <returns>A LicenseInformation class with all properties mapped from source</returns> public static LicenseInformation Create(Windows.ApplicationModel.Store.LicenseInformation source) { var licenseInformation = new LicenseInformation() { IsActive = source.IsActive, IsTrial = source.IsTrial, ExpirationDate = source.ExpirationDate, ProductLicenses = source.ProductLicenses.ToDictionary(key => key.Key, value => ProductLicense.Create(value.Value)) }; #if WINDOWS_PHONE && !DEBUG //The Windows Phone new Microsoft.Phone.Marketplace.LicenseInformation().IsTrial(); is what really determines the Trial vs. Full license status in production for WP8 licenseInformation.IsTrial = new Microsoft.Phone.Marketplace.LicenseInformation().IsTrial(); #endif return(licenseInformation); }
private static LicenseInformation GetLicenseInformationFromXml(IEnumerable <XElement> licenseNodes) { var li = new LicenseInformation(); var licenseNode = licenseNodes.First(); var expirationString = licenseNode.Element("ExpirationDate").SafeRead(); DateTime expirationDate; if (String.IsNullOrEmpty(expirationString) || !DateTime.TryParse(expirationString, out expirationDate)) { expirationDate = DEVELOPER_LICENSE_EXPIRES; //The date a developer license expires ({12/31/1600 12:00:00 AM UTC}) } li.ExpirationDate = expirationDate; li.IsActive = bool.Parse(licenseNode.Element("IsActive").SafeRead("true")); li.IsTrial = bool.Parse(licenseNode.Element("IsTrial").SafeRead("true")); return(li); }
/// <summary> /// Overload to be used by the CurrentAppSimulator for Windows Phone 8; decided /// that this was a nicer way to do it than a bunch more IFDEFs /// </summary> /// <param name="clone">A fully instantiated LicenseInformation implementation</param> /// <returns>The initial LicenseInformation implementation</returns> public static LicenseInformation Create(LicenseInformation clone) { return(clone); }