/// <summary> /// Make store current version verification /// </summary> /// <param name="appBandleId">Bandle Name for app package</param> /// <returns>VerifyVersionResult</returns> public static VerifyVersionResult VerifyIos(string appBandleId) { var verification = new VerifyVersionResult(); string url = $"http://itunes.apple.com/lookup?bundleId={appBandleId}"; using (var webClient = new WebClient()) { var donwloadedString = webClient.DownloadString(url); var data = JsonConvert.DeserializeObject <IosAppBundleData>(donwloadedString); if (data.ResultCount == 0) { } verification.AppName = data.Results[0].TrackName; verification.StoreCurrentVersion = data.Results[0].Version; verification.VersioningType = string.IsNullOrEmpty(OnlyNumbers(verification.StoreCurrentVersion)) ? VersioningType.ByCodeName : VersioningType.ByIncrementalNumber; } return(verification); }
/// <summary> /// Make store current version verification /// </summary> /// <param name="appBandleId">Bandle Name for app package</param> /// <returns>VerifyVersionResult</returns> public static VerifyVersionResult VerifyAndroid(string appBandleId) { var verification = new VerifyVersionResult(); string url = $"https://play.google.com/store/apps/details?id={appBandleId}&hl=en"; using (var webClient = new WebClient()) { var donwloadedString = webClient.DownloadString(url); var jsonString = donwloadedString; #region -- Get Name -- var searchString = "itemprop=\"name\">"; var endString = "</"; var pos = jsonString.IndexOf(searchString, StringComparison.InvariantCultureIgnoreCase) + searchString.Length; var endPos = jsonString.IndexOf(endString, pos, StringComparison.Ordinal); jsonString = jsonString.Substring(pos, endPos - pos).Trim(); verification.AppName = jsonString.Substring(jsonString.IndexOf(">") + 1, jsonString.Length - jsonString.LastIndexOf(">") - 1).Trim(); #endregion #region -- Get Version -- jsonString = donwloadedString; searchString = "Current Version"; endString = "</span"; pos = jsonString.IndexOf(searchString, StringComparison.InvariantCultureIgnoreCase) + searchString.Length; endPos = jsonString.IndexOf(endString, pos, StringComparison.Ordinal); jsonString = jsonString.Substring(pos, endPos - pos).Trim(); verification.StoreCurrentVersion = jsonString.Substring(jsonString.LastIndexOf(">") + 1, jsonString.Length - jsonString.LastIndexOf(">") - 1); #endregion verification.VersioningType = string.IsNullOrEmpty(OnlyNumbers(verification.StoreCurrentVersion)) ? VersioningType.ByCodeName : VersioningType.ByIncrementalNumber; return(verification); } }