/// <summary> /// Get special IVSU package such as Downgrade or Reformat from our API and passes it to ConvertIvsu /// </summary> /// <param name="url">URL of a valid 'SpecialPackage'</param> public static SyncModel.SyncIvsu GetSpecialIvsu(string url) { HttpResponseMessage response = ApplicationManager.Instance.Client.GetAsync(url).Result; Api.Ivsu ivsu = JsonConvert.DeserializeObject <Api.Ivsu>(response.Content.ReadAsStringAsync().Result); return(ConvertIvsu(ivsu)); }
public static void CanCallConvertIvsu() { var ivsu = new Api.Ivsu { Id = 1987917491, Name = "TestValue507747437", Type = "TestValue391370599", Regions = new[] { "TestValue941055651", "TestValue745553851", "TestValue1110261990" }, Md5 = "TestValue424093519", Url = "TestValue809188826", Notes = "TestValue323075795", Version = "TestValue29422309" }; var result = ApiHelper.ConvertIvsu(ivsu); Assert.Fail("Create or modify test"); }
/// <summary> /// Converts a API retrieved Api.Ivsu to SModel.Ivsu /// </summary> /// <param name="ivsu">SpecialPackage IVSU object from GetSpecialIvsu</param> /// <returns>ivsu as type SModel.Ivsu</returns> public static SModel.Ivsu ConvertIvsu(Api.Ivsu ivsu) { return(new() { Type = ivsu.Type, Name = ivsu.Name, Version = ivsu.Version, Notes = ivsu.Notes, Url = ivsu.Url, Md5 = ivsu.Md5, Selected = true, FileName = FileHelper.url_to_filename(ivsu.Url).Replace("?dl=1", ""), FileSize = ivsu.FileSize }); }
/// <summary> /// Converts a API retrieved Api.Ivsu to SyncModel.SyncIvsu /// </summary> /// <param name="ivsu">SpecialPackage IVSU object from GetSpecialIvsu</param> /// <returns>ivsu as type SyncModel.SyncIvsu</returns> public static SyncModel.SyncIvsu ConvertIvsu(Api.Ivsu ivsu) { string fileName = FileHelper.url_to_filename(ivsu.Url); SyncModel.SyncIvsu output = new SyncModel.SyncIvsu { Type = ivsu.Type, Name = ivsu.Name, Version = ivsu.Version, Notes = ivsu.Notes, Url = ivsu.Url, Md5 = ivsu.Md5, Selected = true, FileName = fileName.Replace("?dl=1", "") }; return(output); }