Skip to content

Commit

Permalink
Fix: JSON File import
Browse files Browse the repository at this point in the history
  • Loading branch information
rzander committed Oct 3, 2017
1 parent 79135b2 commit eb9b762
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
9 changes: 7 additions & 2 deletions RZ.OneGetProvider/RZUpdate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,12 @@ internal static AddSoftware ParseJSON(string sFile)
{
JavaScriptSerializer ser = new JavaScriptSerializer();
AddSoftware lRes = ser.Deserialize<AddSoftware>(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 { }
Expand Down Expand Up @@ -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))
{
Expand Down
9 changes: 7 additions & 2 deletions RZUpdate/RZUpdate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,12 @@ internal static AddSoftware ParseJSON(string sFile)
{
JavaScriptSerializer ser = new JavaScriptSerializer();
AddSoftware lRes = ser.Deserialize<AddSoftware>(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 { }
Expand Down Expand Up @@ -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))
{
Expand Down
9 changes: 7 additions & 2 deletions RuckZuck_Tool/RZUpdate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,12 @@ internal static AddSoftware ParseJSON(string sFile)
{
JavaScriptSerializer ser = new JavaScriptSerializer();
AddSoftware lRes = ser.Deserialize<AddSoftware>(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 { }
Expand Down Expand Up @@ -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))
{
Expand Down

0 comments on commit eb9b762

Please sign in to comment.