From eb9b7621d4bec29c9e304751d6991194e9f99f11 Mon Sep 17 00:00:00 2001 From: Roger Zander Date: Tue, 3 Oct 2017 21:15:18 +0200 Subject: [PATCH] Fix: JSON File import --- RZ.OneGetProvider/RZUpdate.cs | 9 +++++++-- RZUpdate/RZUpdate.cs | 9 +++++++-- RuckZuck_Tool/RZUpdate.cs | 9 +++++++-- 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/RZ.OneGetProvider/RZUpdate.cs b/RZ.OneGetProvider/RZUpdate.cs index 75f1ae4..7c08d04 100644 --- a/RZ.OneGetProvider/RZUpdate.cs +++ b/RZ.OneGetProvider/RZUpdate.cs @@ -259,7 +259,12 @@ internal static AddSoftware ParseJSON(string sFile) { JavaScriptSerializer ser = new JavaScriptSerializer(); AddSoftware lRes = ser.Deserialize(File.ReadAllText(sFile)); - lRes.PreRequisites = lRes.PreRequisites.Where(x => !string.IsNullOrEmpty(x)).ToArray(); + if (lRes.PreRequisites != null) + { + lRes.PreRequisites = lRes.PreRequisites.Where(x => !string.IsNullOrEmpty(x)).ToArray(); + } + else + lRes.PreRequisites = new string[0]; return lRes; } catch { } @@ -1555,7 +1560,7 @@ private bool _checkFileSHA256(string FilePath, string SHA256) { try { - using (var sha256 = System.Security.Cryptography.SHA1.Create()) + using (var sha256 = System.Security.Cryptography.SHA256.Create()) { using (var stream = File.OpenRead(FilePath)) { diff --git a/RZUpdate/RZUpdate.cs b/RZUpdate/RZUpdate.cs index 75f1ae4..7c08d04 100644 --- a/RZUpdate/RZUpdate.cs +++ b/RZUpdate/RZUpdate.cs @@ -259,7 +259,12 @@ internal static AddSoftware ParseJSON(string sFile) { JavaScriptSerializer ser = new JavaScriptSerializer(); AddSoftware lRes = ser.Deserialize(File.ReadAllText(sFile)); - lRes.PreRequisites = lRes.PreRequisites.Where(x => !string.IsNullOrEmpty(x)).ToArray(); + if (lRes.PreRequisites != null) + { + lRes.PreRequisites = lRes.PreRequisites.Where(x => !string.IsNullOrEmpty(x)).ToArray(); + } + else + lRes.PreRequisites = new string[0]; return lRes; } catch { } @@ -1555,7 +1560,7 @@ private bool _checkFileSHA256(string FilePath, string SHA256) { try { - using (var sha256 = System.Security.Cryptography.SHA1.Create()) + using (var sha256 = System.Security.Cryptography.SHA256.Create()) { using (var stream = File.OpenRead(FilePath)) { diff --git a/RuckZuck_Tool/RZUpdate.cs b/RuckZuck_Tool/RZUpdate.cs index 75f1ae4..7c08d04 100644 --- a/RuckZuck_Tool/RZUpdate.cs +++ b/RuckZuck_Tool/RZUpdate.cs @@ -259,7 +259,12 @@ internal static AddSoftware ParseJSON(string sFile) { JavaScriptSerializer ser = new JavaScriptSerializer(); AddSoftware lRes = ser.Deserialize(File.ReadAllText(sFile)); - lRes.PreRequisites = lRes.PreRequisites.Where(x => !string.IsNullOrEmpty(x)).ToArray(); + if (lRes.PreRequisites != null) + { + lRes.PreRequisites = lRes.PreRequisites.Where(x => !string.IsNullOrEmpty(x)).ToArray(); + } + else + lRes.PreRequisites = new string[0]; return lRes; } catch { } @@ -1555,7 +1560,7 @@ private bool _checkFileSHA256(string FilePath, string SHA256) { try { - using (var sha256 = System.Security.Cryptography.SHA1.Create()) + using (var sha256 = System.Security.Cryptography.SHA256.Create()) { using (var stream = File.OpenRead(FilePath)) {