diff --git a/RZ.Bot/Properties/AssemblyInfo.cs b/RZ.Bot/Properties/AssemblyInfo.cs index 2157b6e..127ffbc 100644 --- a/RZ.Bot/Properties/AssemblyInfo.cs +++ b/RZ.Bot/Properties/AssemblyInfo.cs @@ -10,7 +10,7 @@ [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Zander Tools")] [assembly: AssemblyProduct("RuckZuck LogConsole")] -[assembly: AssemblyCopyright("Copyright © 2018 by Roger Zander")] +[assembly: AssemblyCopyright("Copyright © 2019 by Roger Zander")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] @@ -33,4 +33,4 @@ // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.6.*")] -[assembly: AssemblyFileVersion("1.0.6.9")] +[assembly: AssemblyFileVersion("1.0.6.13")] diff --git a/RZ.Bot/Properties/Settings.Designer.cs b/RZ.Bot/Properties/Settings.Designer.cs index 5d7f8db..275d791 100644 --- a/RZ.Bot/Properties/Settings.Designer.cs +++ b/RZ.Bot/Properties/Settings.Designer.cs @@ -12,7 +12,7 @@ namespace RZ.Bot.Properties { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.5.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.9.0.0")] internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); diff --git a/RZ.Bot/RZRestAPI.cs b/RZ.Bot/RZRestAPI.cs index daff067..fe68001 100644 --- a/RZ.Bot/RZRestAPI.cs +++ b/RZ.Bot/RZRestAPI.cs @@ -32,7 +32,7 @@ public static string sURL { if (sWebSVC.StartsWith("http", StringComparison.CurrentCultureIgnoreCase)) { - RZRestAPI._sURL = sWebSVC; + RZRestAPI._sURL = sWebSVC.TrimEnd('/'); } } @@ -267,7 +267,7 @@ public static List CheckForUpdate(List lSoftware) if (contentType == "application/json") { var response = oClient.PostAsync(sURL + "/rest/CheckForUpdate", oCont); - response.Wait(15000); + response.Wait(60000); if (response.IsCompleted) { List lRes = ser.Deserialize>(response.Result.Content.ReadAsStringAsync().Result); @@ -309,15 +309,20 @@ public static bool UploadSWEntry(AddSoftware lSoftware) //vNext 5.9.2017 - public static async void TrackDownloads2(long SWId, string Architecture) + public static async void TrackDownloads2(long SWId, string Architecture, string Shortname = "") { try { - await oClient.GetStringAsync(sURL + "/rest/TrackDownloadsNew?SWId=" + SWId.ToString() + "&arch=" + WebUtility.UrlEncode(Architecture)); + string sID = SWId.ToString(); + if (SWId == 0) + sID = ""; + + await oClient.GetStringAsync(sURL + "/rest/TrackDownloadsNew?SWId=" + sID + "&arch=" + WebUtility.UrlEncode(Architecture) + "&shortname=" + WebUtility.UrlEncode(Shortname)); } catch { } } + public static List GetCategories(List oSWList) { List lResult = new List(); @@ -339,7 +344,8 @@ public static byte[] GetIcon(long SWId) using (MemoryStream ms = new MemoryStream()) { response.Result.CopyTo(ms); - return ms.ToArray(); + byte[] bRes = ms.ToArray(); + return bRes; } } @@ -394,6 +400,10 @@ public class GetSoftware public long IconId { get; set; } + public long SWId { get; set; } + + public string IconHash { get; set; } + public bool isInstalled { get; set; } //public string XMLFile { get; set; } @@ -404,14 +414,25 @@ public string IconURL { get { - if (IconId > 0) + //Support new V2 REST API + if(!string.IsNullOrEmpty(IconHash)) { - return RZRestAPI.sURL + "/rest/GetIcon?id=" + IconId.ToString(); + return RZRestAPI.sURL + "/rest/v2/GetIcon?iconhash=" + IconHash; } - else + + if (SWId > 0) { - return ""; // "File://" + IconFile; + return RZRestAPI.sURL + "/rest/GetIcon?id=" + SWId.ToString(); } + + if (IconId > 0) + { + SWId = IconId; + return RZRestAPI.sURL + "/rest/GetIcon?id=" + SWId.ToString(); + } + + return ""; + //return "https://ruckzuck.azurewebsites.net/wcf/RZService.svc/rest/GetIcon?id=" + IconId.ToString(); } } @@ -464,6 +485,9 @@ public class AddSoftware //public long SWId { get { return IconId; } set { IconId = value; } } public long SWId { get; set; } + public long IconId { get; set; } + + public string IconHash { get; set; } //remove if SWId is in place 5.9.2017 //public long IconId { get; set; } @@ -476,6 +500,19 @@ public string IconURL string sURL = RZRestAPI.sURL + "/rest/GetIcon?id=" + SWId.ToString(); return sURL; } + + //Support new V2 REST API + if (!string.IsNullOrEmpty(IconHash)) + { + return RZRestAPI.sURL + "/rest/v2/GetIcon?iconhash=" + IconHash; + } + + if (IconId > 0) + { + SWId = IconId; + string sURL = RZRestAPI.sURL + "/rest/GetIcon?id=" + SWId.ToString(); + return sURL; + } return ""; } } diff --git a/RZ.Bot/RZScan.cs b/RZ.Bot/RZScan.cs index fa4078a..7623a7b 100644 --- a/RZ.Bot/RZScan.cs +++ b/RZ.Bot/RZScan.cs @@ -163,20 +163,66 @@ public async Task GetSWRepository() var oDB = RZRestAPI.SWResults("").Distinct().OrderBy(t => t.Shortname).ThenByDescending(t => t.ProductVersion).ThenByDescending(t => t.ProductName).ToList(); lock (SoftwareRepository) { - SoftwareRepository = oDB.Select(item => new GetSoftware() + SoftwareRepository = oDB.Select(item => new GetSoftware() + { + Categories = item.Categories ?? new List(), + Description = item.Description, + Downloads = item.Downloads, + IconId = item.IconId, + SWId = item.SWId, + Image = item.Image, + Manufacturer = item.Manufacturer, + ProductName = item.ProductName, + ProductURL = item.ProductURL, + ProductVersion = item.ProductVersion, + Shortname = item.Shortname, + IconHash = item.IconHash + }).ToList(); + } + } + catch (Exception ex) + { + Debug.WriteLine(ex.Message.ToString()); + } + + OnSWRepoLoaded(this, new EventArgs()); + + return true; + }); + + return bResult; + } + + /* public async Task GetSWRepository(string RepositoryPath) + { + //var tGetSWRepo = + bool bResult = await Task.Run(() => + { + try + { + + //var oDB = RZRestAPI.SWResults("").Distinct().OrderBy(t => t.Shortname).ThenByDescending(t => t.ProductVersion).ThenByDescending(t => t.ProductName).ToList(); + DirectoryInfo dInfo = new DirectoryInfo(RepositoryPath); + + foreach (FileInfo dFile in dInfo.GetFiles("*.xml", SearchOption.AllDirectories)) + { + try { - Categories = item.Categories.ToList(), - Description = item.Description, - Downloads = item.Downloads, - IconId = item.IconId, - Image = item.Image, - Manufacturer = item.Manufacturer, - ProductName = item.ProductName, - ProductURL = item.ProductURL, - ProductVersion = item.ProductVersion, - Quality = item.Quality, - Shortname = item.Shortname - }).ToList(); + var oAddRemSW = RZUpdater.ParseXML(dFile.FullName); + string sFile = dFile.DirectoryName + "\\" + oAddRemSW.ContentID + ".png"; + + if (!File.Exists(sFile)) + { + byte[] image = oAddRemSW.Image; + MemoryStream ms = new MemoryStream(image); + Image img = Image.FromStream(ms); + + img.Save(dFile.DirectoryName + "\\" + oAddRemSW.ContentID + ".png", System.Drawing.Imaging.ImageFormat.Png); + } + + SoftwareRepository.Add(new GetSoftware() { ProductName = oAddRemSW.ProductName, Description = oAddRemSW.Description, Categories = (oAddRemSW.Category ?? "Local Repository").Split(';').ToList(), isInstalled = false, Manufacturer = oAddRemSW.Manufacturer, ProductURL = oAddRemSW.ProductURL, ProductVersion = oAddRemSW.ProductVersion, Shortname = oAddRemSW.ProductName + " (" + oAddRemSW.Architecture + ")", Downloads = 0, IconId = 0, IconFile = sFile, XMLFile = dFile.FullName, Quality = 100 }); + } + catch { } } } catch (Exception ex) @@ -191,7 +237,17 @@ public async Task GetSWRepository() return bResult; } +*/ + /*public bool CheckForUpdates + { + get { return bCheckUpdates; } + set + { + bCheckUpdates = value; + bInitialScan = value; + } + }*/ private void RZScan_OnUpdScanCompleted(object sender, EventArgs e) { @@ -236,9 +292,13 @@ internal void _CheckUpdates(List aSWCheck) var vSWCheck = aSWCheck.Select(t => new AddSoftware() { ProductName = t.ProductName, ProductVersion = t.ProductVersion, Manufacturer = t.Manufacturer }).ToList(); //we do not have to check for updates if it's in the Catalog - List tRes = vSWCheck.Where(t => SoftwareRepository.FirstOrDefault(r => r.ProductName == t.ProductName && r.ProductVersion == t.ProductVersion && r.Manufacturer == t.Manufacturer) == null).ToList(); + //List tRes = vSWCheck.Where(t => SoftwareRepository.Count(r => r.ProductName.ToLower().Trim() == t.ProductName.ToLower().Trim() && r.ProductVersion.ToLower().Trim() == t.ProductVersion.ToLower().Trim() && r.Manufacturer.ToLower().Trim() == t.Manufacturer.ToLower().Trim()) == 0).ToList(); + foreach(var oSW in SoftwareRepository) + { + vSWCheck.RemoveAll(t => t.ProductName.ToLower().Trim() == oSW.ProductName.ToLower().Trim() && t.Manufacturer.ToLower().Trim() == oSW.Manufacturer.ToLower().Trim() && t.ProductVersion.ToLower().Trim() == oSW.ProductVersion.ToLower().Trim()); + } - List lCheckResult = RZRestAPI.CheckForUpdate(tRes).ToList(); + List lCheckResult = RZRestAPI.CheckForUpdate(vSWCheck).ToList(); var lResult = lCheckResult.Select(item => new AddSoftware() { @@ -252,7 +312,9 @@ internal void _CheckUpdates(List aSWCheck) ProductVersion = item.ProductVersion, MSIProductID = item.MSIProductID, Shortname = item.Shortname, - SWId = item.SWId + SWId = item.SWId, + IconId = item.IconId, + IconHash = item.IconHash }).ToList(); //Only take updated Versions @@ -600,17 +662,17 @@ internal static Bitmap GetImageFromExe(string Filename) try { - /*TsudaKageyu.IconExtractor iE = new TsudaKageyu.IconExtractor(Filename); - if (iE.FileName != null) - { - List lIcons = TsudaKageyu.IconUtil.Split(iE.GetIcon(0)).ToList(); - //Max Size 128px... - var ico = lIcons.Where(t => t.Height <= 128 && t.ToBitmap().PixelFormat == System.Drawing.Imaging.PixelFormat.Format32bppArgb).OrderByDescending(t => t.Height).FirstOrDefault(); - if (ico != null) - return ico.ToBitmap(); - else - return bResult; - }*/ + //TsudaKageyu.IconExtractor iE = new TsudaKageyu.IconExtractor(Filename); + //if (iE.FileName != null) + //{ + // List lIcons = TsudaKageyu.IconUtil.Split(iE.GetIcon(0)).ToList(); + // //Max Size 128px... + // var ico = lIcons.Where(t => t.Height <= 128 && t.ToBitmap().PixelFormat == System.Drawing.Imaging.PixelFormat.Format32bppArgb).OrderByDescending(t => t.Height).FirstOrDefault(); + // if (ico != null) + // return ico.ToBitmap(); + // else + // return bResult; + //} } catch { } diff --git a/RZ.Bot/RZUpdate.cs b/RZ.Bot/RZUpdate.cs index a682c26..8b8b243 100644 --- a/RZ.Bot/RZUpdate.cs +++ b/RZ.Bot/RZUpdate.cs @@ -97,7 +97,7 @@ public SWUpdate CheckForUpdate(string ProductName, string Version, string Manufa } } - if ((bool)SWUpdate._RunPS(SW.PSPreReq)[0].BaseObject) + if ((bool)SWUpdate._RunPS(SW.PSPreReq).Last().BaseObject) { SoftwareUpdate = new SWUpdate(SW); return SoftwareUpdate; @@ -258,7 +258,20 @@ internal static AddSoftware ParseJSON(string sFile) try { JavaScriptSerializer ser = new JavaScriptSerializer(); - AddSoftware lRes = ser.Deserialize(File.ReadAllText(sFile)); + string sJson = File.ReadAllText(sFile); + AddSoftware lRes; + + //Check if it's an Arrya (new in V2) + if (sJson.TrimStart().StartsWith("[")) + { + List lItems = ser.Deserialize>(sJson); + lRes = lItems[0]; + } + else + { + lRes = ser.Deserialize(sJson); + } + if (lRes.PreRequisites != null) { lRes.PreRequisites = lRes.PreRequisites.Where(x => !string.IsNullOrEmpty(x)).ToArray(); @@ -325,6 +338,7 @@ public SWUpdate(AddSoftware Software) if (SW.Image == null) { SW.Image = RZRestAPI.GetIcon(SW.SWId); + downloadTask.Image = SW.Image; } } catch { } @@ -394,6 +408,9 @@ public SWUpdate(string ProductName, string ProductVersion, string Manufacturer, } } + if (SW.PreRequisites == null) + SW.PreRequisites = new string[0]; + } @@ -455,10 +472,6 @@ public SWUpdate(string Shortname) } - - - - downloadTask = new DLTask() { ProductName = SW.ProductName, ProductVersion = SW.ProductVersion, Manufacturer = SW.Manufacturer, Shortname = SW.Shortname, Image = SW.Image, Files = SW.Files }; foreach (contentFiles vFile in SW.Files) @@ -466,6 +479,9 @@ public SWUpdate(string Shortname) if (string.IsNullOrEmpty(vFile.HashType)) vFile.HashType = "MD5"; } + + if (SW.PreRequisites == null) + SW.PreRequisites = new string[0]; } catch { } } @@ -486,7 +502,7 @@ public bool GetInstallType(bool bGetFirst = false) { if (!bGetFirst) { - if (!(bool)_RunPS(DT.PSPreReq)[0].BaseObject) + if (!(bool)_RunPS(DT.PSPreReq).Last().BaseObject) continue; } } @@ -542,6 +558,7 @@ private bool _Download(bool Enforce, string DLPath) { foreach (var vFile in SW.Files) { + bool bDLSuccess = false; try { if (string.IsNullOrEmpty(vFile.URL)) @@ -629,20 +646,7 @@ private bool _Download(bool Enforce, string DLPath) } else { - - if (SendFeedback) - { - if (SW.SWId > 0) - { - RZRestAPI.TrackDownloads2(SW.SWId, SW.Architecture); - } - else - { - //Depreciated - //RZRestAPI.TrackDownloads(SW.ContentID); - } - } - + bDLSuccess = true; } //Sleep 1s to complete @@ -775,7 +779,14 @@ private bool _Download(bool Enforce, string DLPath) Console.WriteLine("ERROR: " + ex.Message); bError = true; } + + if (SendFeedback && bDLSuccess) + { + RZRestAPI.TrackDownloads2(SW.SWId, SW.Architecture, SW.Shortname); + } } + + } else { @@ -865,10 +876,17 @@ public async Task Download(bool Enforce, string DLPath) bool bAutoInstall = downloadTask.AutoInstall; downloadTask = new DLTask() { ProductName = SW.ProductName, ProductVersion = SW.ProductVersion, Manufacturer = SW.Manufacturer, Shortname = SW.Shortname, Image = SW.Image, Files = SW.Files }; - if (SW.PreRequisites.Length > 0) + if (SW.PreRequisites != null) { - downloadTask.WaitingForDependency = true; - downloadTask.AutoInstall = false; + if (SW.PreRequisites.Length > 0) + { + downloadTask.WaitingForDependency = true; + downloadTask.AutoInstall = false; + } + else + { + downloadTask.AutoInstall = bAutoInstall; + } } else { @@ -971,11 +989,11 @@ private bool _Install(bool Force = false) downloadTask.Installing = true; ProgressDetails(this.downloadTask, EventArgs.Empty); - var oResult = _RunPS(psPath + SW.PSPreInstall + ";" + SW.PSInstall + ";" + SW.PSPostInstall + ";$ExitCode"); + var oResult = _RunPS(psPath + SW.PSPreInstall + ";" + SW.PSInstall + ";" + SW.PSPostInstall + ";$ExitCode", "", new TimeSpan(0, 60, 0)); try { - iExitCode = ((int)oResult[0].BaseObject); + iExitCode = ((int)oResult.Last().BaseObject); } catch { } @@ -1173,11 +1191,11 @@ private bool _UnInstall(bool Force = false) downloadTask.Installing = true; ProgressDetails(this.downloadTask, EventArgs.Empty); - var oResult = _RunPS(SW.PSUninstall + ";$ExitCode"); + var oResult = _RunPS(SW.PSUninstall + ";$ExitCode", "", new TimeSpan(0, 30, 0)); try { - iExitCode = ((int)oResult[0].BaseObject); + iExitCode = ((int)oResult.Last().BaseObject); } catch { } @@ -1311,7 +1329,7 @@ public bool CheckIsInstalled(bool sendProgressEvent) try { //Already installed ? - if ((bool)_RunPS(SW.PSDetection)[0].BaseObject) + if ((bool)_RunPS(SW.PSDetection).Last().BaseObject) { UILock.EnterReadLock(); try @@ -1369,7 +1387,7 @@ public bool CheckDTPreReq() if (string.IsNullOrEmpty(SW.PSPreReq)) SW.PSPreReq = "$true; "; //Already installed ? - if ((bool)_RunPS(SW.PSPreReq)[0].BaseObject) + if ((bool)_RunPS(SW.PSPreReq).Last().BaseObject) { return true; } @@ -1391,7 +1409,7 @@ public bool _DownloadFile2(string URL, string FileName) //Check if URL is HTTP, otherwise it must be a PowerShell if (!URL.StartsWith("http", StringComparison.CurrentCultureIgnoreCase) && !URL.StartsWith("ftp", StringComparison.CurrentCultureIgnoreCase)) { - Collection oResults = _RunPS(URL, FileName); + var oResults = _RunPS(URL, FileName, new TimeSpan(2, 0, 0)); //2h timeout if (File.Exists(FileName)) { DLProgress((int)100, EventArgs.Empty); @@ -1629,25 +1647,51 @@ private bool _checkFileX509(string FilePath, string X509) /// /// PowerShell Script /// - public static Collection _RunPS(string PSScript, string WorkingDir = "") + public static PSDataCollection _RunPS(string PSScript, string WorkingDir = "", TimeSpan? Timeout = null) { - PowerShell PowerShellInstance = PowerShell.Create(); + TimeSpan timeout = new TimeSpan(0, 15, 0); //default timeout = 15min - if (!string.IsNullOrEmpty(WorkingDir)) - { - WorkingDir = Path.GetDirectoryName(WorkingDir); - PSScript = "Set-Location -Path '" + WorkingDir + "';" + PSScript; - } - PowerShellInstance.AddScript(PSScript); + if (Timeout != null) + timeout = (TimeSpan)Timeout; - Collection PSOutput = PowerShellInstance.Invoke(); - foreach (ErrorRecord err in PowerShellInstance.Streams.Error) + DateTime dStart = DateTime.Now; + TimeSpan dDuration = DateTime.Now - dStart; + using (PowerShell PowerShellInstance = PowerShell.Create()) { - Console.WriteLine(err.ToString()); + if (!string.IsNullOrEmpty(WorkingDir)) + { + WorkingDir = Path.GetDirectoryName(WorkingDir); + PSScript = "Set-Location -Path '" + WorkingDir + "';" + PSScript; + } + + PowerShellInstance.AddScript(PSScript); + PSDataCollection outputCollection = new PSDataCollection(); + + outputCollection.DataAdding += ConsoleOutput; + PowerShellInstance.Streams.Error.DataAdding += ConsoleError; + + IAsyncResult async = PowerShellInstance.BeginInvoke(null, outputCollection); + while (async.IsCompleted == false || dDuration > timeout) + { + Thread.Sleep(200); + dDuration = DateTime.Now - dStart; + } + + return outputCollection; } - return PSOutput; + } + + private static void ConsoleError(object sender, DataAddingEventArgs e) + { + if (e.ItemAdded != null) + Console.WriteLine("ERROR:" + e.ItemAdded.ToString()); + } + private static void ConsoleOutput(object sender, DataAddingEventArgs e) + { + //if (e.ItemAdded != null) + // Console.WriteLine(e.ItemAdded.ToString()); } public string GetDLPath() diff --git a/RZ.OneGetProvider/RZUpdate.cs b/RZ.OneGetProvider/RZUpdate.cs index 7f2f4f9..bb285d0 100644 --- a/RZ.OneGetProvider/RZUpdate.cs +++ b/RZ.OneGetProvider/RZUpdate.cs @@ -338,6 +338,7 @@ public SWUpdate(AddSoftware Software) if (SW.Image == null) { SW.Image = RZRestAPI.GetIcon(SW.SWId); + downloadTask.Image = SW.Image; } } catch { } @@ -407,6 +408,9 @@ public SWUpdate(string ProductName, string ProductVersion, string Manufacturer, } } + if (SW.PreRequisites == null) + SW.PreRequisites = new string[0]; + } @@ -468,10 +472,6 @@ public SWUpdate(string Shortname) } - - - - downloadTask = new DLTask() { ProductName = SW.ProductName, ProductVersion = SW.ProductVersion, Manufacturer = SW.Manufacturer, Shortname = SW.Shortname, Image = SW.Image, Files = SW.Files }; foreach (contentFiles vFile in SW.Files) @@ -479,6 +479,9 @@ public SWUpdate(string Shortname) if (string.IsNullOrEmpty(vFile.HashType)) vFile.HashType = "MD5"; } + + if (SW.PreRequisites == null) + SW.PreRequisites = new string[0]; } catch { } } diff --git a/RZUpdate/RZUpdate.cs b/RZUpdate/RZUpdate.cs index 7f2f4f9..bb285d0 100644 --- a/RZUpdate/RZUpdate.cs +++ b/RZUpdate/RZUpdate.cs @@ -338,6 +338,7 @@ public SWUpdate(AddSoftware Software) if (SW.Image == null) { SW.Image = RZRestAPI.GetIcon(SW.SWId); + downloadTask.Image = SW.Image; } } catch { } @@ -407,6 +408,9 @@ public SWUpdate(string ProductName, string ProductVersion, string Manufacturer, } } + if (SW.PreRequisites == null) + SW.PreRequisites = new string[0]; + } @@ -468,10 +472,6 @@ public SWUpdate(string Shortname) } - - - - downloadTask = new DLTask() { ProductName = SW.ProductName, ProductVersion = SW.ProductVersion, Manufacturer = SW.Manufacturer, Shortname = SW.Shortname, Image = SW.Image, Files = SW.Files }; foreach (contentFiles vFile in SW.Files) @@ -479,6 +479,9 @@ public SWUpdate(string Shortname) if (string.IsNullOrEmpty(vFile.HashType)) vFile.HashType = "MD5"; } + + if (SW.PreRequisites == null) + SW.PreRequisites = new string[0]; } catch { } } diff --git a/RuckZuck_Tool/InstallSwPanel.xaml.cs b/RuckZuck_Tool/InstallSwPanel.xaml.cs index e41c712..8ab3639 100644 --- a/RuckZuck_Tool/InstallSwPanel.xaml.cs +++ b/RuckZuck_Tool/InstallSwPanel.xaml.cs @@ -250,14 +250,6 @@ private void btInstall_Click(object sender, RoutedEventArgs e) if (oItem.GetType() == typeof(GetSoftware)) { GetSoftware dgr = oItem as GetSoftware; - /*if (!string.IsNullOrEmpty(dgr.XMLFile)) - { - if (System.IO.File.Exists(dgr.XMLFile)) - { - oSW = new SWUpdate(RZUpdater.ParseXML(dgr.XMLFile)); - oSW.SendFeedback = false; - } - }*/ if (oSW == null) oSW = new SWUpdate(dgr.ProductName, dgr.ProductVersion, dgr.Manufacturer); diff --git a/RuckZuck_Tool/Properties/Resources.resx b/RuckZuck_Tool/Properties/Resources.resx index b06479f..753e84e 100644 --- a/RuckZuck_Tool/Properties/Resources.resx +++ b/RuckZuck_Tool/Properties/Resources.resx @@ -1089,6 +1089,7 @@ namespace RZUpdate if (SW.Image == null) { SW.Image = RZRestAPI.GetIcon(SW.SWId); + downloadTask.Image = SW.Image; } } catch { } @@ -1158,6 +1159,9 @@ namespace RZUpdate } } + if (SW.PreRequisites == null) + SW.PreRequisites = new string[0]; + } @@ -1219,10 +1223,6 @@ namespace RZUpdate } - - - - downloadTask = new DLTask() { ProductName = SW.ProductName, ProductVersion = SW.ProductVersion, Manufacturer = SW.Manufacturer, Shortname = SW.Shortname, Image = SW.Image, Files = SW.Files }; foreach (contentFiles vFile in SW.Files) @@ -1230,6 +1230,9 @@ namespace RZUpdate if (string.IsNullOrEmpty(vFile.HashType)) vFile.HashType = "MD5"; } + + if (SW.PreRequisites == null) + SW.PreRequisites = new string[0]; } catch { } } @@ -1306,7 +1309,7 @@ namespace RZUpdate { foreach (var vFile in SW.Files) { - bool bDLSuccess = false; + bool bDLSuccess = false; try { if (string.IsNullOrEmpty(vFile.URL)) @@ -1530,10 +1533,7 @@ namespace RZUpdate if (SendFeedback && bDLSuccess) { - if (SW.SWId > 0) - { - RZRestAPI.TrackDownloads2(SW.SWId, SW.Architecture, SW.Shortname); - } + RZRestAPI.TrackDownloads2(SW.SWId, SW.Architecture, SW.Shortname); } } diff --git a/RuckZuck_Tool/RZUpdate.cs b/RuckZuck_Tool/RZUpdate.cs index 6db0d92..bb285d0 100644 --- a/RuckZuck_Tool/RZUpdate.cs +++ b/RuckZuck_Tool/RZUpdate.cs @@ -408,6 +408,9 @@ public SWUpdate(string ProductName, string ProductVersion, string Manufacturer, } } + if (SW.PreRequisites == null) + SW.PreRequisites = new string[0]; + } @@ -469,10 +472,6 @@ public SWUpdate(string Shortname) } - - - - downloadTask = new DLTask() { ProductName = SW.ProductName, ProductVersion = SW.ProductVersion, Manufacturer = SW.Manufacturer, Shortname = SW.Shortname, Image = SW.Image, Files = SW.Files }; foreach (contentFiles vFile in SW.Files) @@ -480,6 +479,9 @@ public SWUpdate(string Shortname) if (string.IsNullOrEmpty(vFile.HashType)) vFile.HashType = "MD5"; } + + if (SW.PreRequisites == null) + SW.PreRequisites = new string[0]; } catch { } } @@ -556,7 +558,7 @@ private bool _Download(bool Enforce, string DLPath) { foreach (var vFile in SW.Files) { - bool bDLSuccess = false; + bool bDLSuccess = false; try { if (string.IsNullOrEmpty(vFile.URL))