Skip to content
This repository has been archived by the owner on Apr 6, 2020. It is now read-only.

Commit

Permalink
Dropped custom JObject (#153)
Browse files Browse the repository at this point in the history
  • Loading branch information
osmirnov authored and gubanotorious committed Jun 30, 2018
1 parent 427521e commit 90c4baf
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 648 deletions.
12 changes: 6 additions & 6 deletions src/NeoSharp.Core/Network/Security/NetworkAclLoader.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.IO;
using System.Linq;
using NeoSharp.Core.Types.Json;
using Newtonsoft.Json.Linq;

namespace NeoSharp.Core.Network.Security
{
Expand All @@ -16,17 +16,17 @@ public NetworkAcl Load(NetworkAclConfig config)
if (!string.IsNullOrEmpty(config.Path) && File.Exists(config.Path))
{
var json = File.ReadAllText(config.Path);
var jObject = JObject.Parse(json);
var jToken = JToken.Parse(json);

if (jObject is JArray jArray)
if (jToken is JArray jArray)
{
entries = jArray
.Where(it => it.ContainsProperty("value"))
.Where(it => it["value"] != null)
.Select(it =>
{
var value = it.Properties["value"].AsString();
var value = (string)it["value"];
if (it.ContainsProperty("regex") && it.Properties["regex"].AsBooleanOrDefault())
if ((bool?)it["regex"] ?? false)
return new NetworkAcl.RegexEntry(value);
return new NetworkAcl.Entry(value);
Expand Down
140 changes: 0 additions & 140 deletions src/NeoSharp.Core/Types/Json/JArray.cs

This file was deleted.

67 changes: 0 additions & 67 deletions src/NeoSharp.Core/Types/Json/JBoolean.cs

This file was deleted.

109 changes: 0 additions & 109 deletions src/NeoSharp.Core/Types/Json/JNumber.cs

This file was deleted.

0 comments on commit 90c4baf

Please sign in to comment.