Skip to content

Commit

Permalink
Multiple LoadJson calls fix #1831
Browse files Browse the repository at this point in the history
  • Loading branch information
LiorBanai committed Sep 5, 2023
1 parent cde9bb9 commit ed0597a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
10 changes: 5 additions & 5 deletions Analogy.CommonControls/Tools/JsonTreeView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,11 @@ private void LoadImageList()
}

[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
private List<TreeNode> LoadTree(object jsonData, CancellationToken cancellationToken)
private (bool valid, List<TreeNode> result) LoadTree(object jsonData, CancellationToken cancellationToken)
{
if (cancellationToken.IsCancellationRequested)
{
return new();
return (false, new());
}
List<TreeNode> nodes = new();
if (jsonData is JArray jsonArray)
Expand Down Expand Up @@ -155,7 +155,7 @@ private List<TreeNode> LoadTree(object jsonData, CancellationToken cancellationT
rootNode.ExpandAll();
}

return nodes;
return (!cancellationToken.IsCancellationRequested, nodes);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private static bool TryParse(string strInput, out JToken output)
Expand Down Expand Up @@ -368,9 +368,9 @@ public async Task ShowJson(string jsonString)
var token = cancellationTokenSource.Token;
object json = JsonConvert.DeserializeObject(jsonString);
var nodes = await Task.Run(() => LoadTree(json, token));
if (!token.IsCancellationRequested)
if (nodes.valid)
{
Nodes.AddRange(nodes.ToArray());
Nodes.AddRange(nodes.result.ToArray());
}
EndUpdate();
}
Expand Down
3 changes: 2 additions & 1 deletion Analogy/CommonChangeLog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ public static class CommonChangeLog
public static IEnumerable<AnalogyChangeLog> GetChangeLog()
{
return new List<AnalogyChangeLog>
{
{
new ("V5.0.0 - Multiple LoadJson calls #1831", AnalogChangeLogType.Bug,"Lior Banai",new DateTime(2023,09,05),"5.0.0.0"),
new ("V5.0.0 - Disable Updates If Running from Program Data Folder #1841", AnalogChangeLogType.Improvement,"Lior Banai",new DateTime(2023,09,05),"5.0.0.0"),
new ("V5.0.0 - Support running from MSI Installer #1838", AnalogChangeLogType.Improvement,"Lior Banai",new DateTime(2023,09,03),"5.0.0.0"),
new ("V5.0.0 - DevExpress 23.1 #1837", AnalogChangeLogType.Improvement,"Lior Banai",new DateTime(2023,09,03),"5.0.0.0"),
Expand Down

0 comments on commit ed0597a

Please sign in to comment.