예제 #1
0
 protected virtual IEnumerable <IJsonStringFilter> EnumerateFilters(ObjectLoadOptions options)
 {
     if (options.HasFlag(ObjectLoadOptions.DecodeHex))
     {
         yield return(new JsonHexDecoder(JsonHexDecoderOptions.FilterNewLineCharacters));
     }
 }
예제 #2
0
 protected override IEnumerable <IJsonStringFilter> EnumerateFilters(ObjectLoadOptions options)
 {
     foreach (var f in EnumerateLogUpdateFilters())
     {
         yield return(f);
     }
     if (options.HasFlag(ObjectLoadOptions.DecodeHex))
     {
         yield return(new JsonHexDecoder());
     }
 }
예제 #3
0
        public override LogUpdate Load(string json, ObjectLoadOptions options = ObjectLoadOptions.Default)
        {
            if (json is null)
            {
                return(null);
            }

            return(new LogUpdate {
                Value = FilterJson(json, options)
            });
        }
예제 #4
0
        /// <summary>
        /// Creates a new object from a <see cref="StringBuilder"/> that contains JSON.
        /// </summary>
        public virtual T Load(StringBuilder json, ObjectLoadOptions options = ObjectLoadOptions.Default)
        {
            if (json is null)
            {
                return(null);
            }

            using (var textReader = new StringBuilderReader(FilterJson(json, options)))
            {
                return(Load(textReader));
            }
        }
예제 #5
0
        public override LogUpdate Load(StringBuilder json, ObjectLoadOptions options = ObjectLoadOptions.Default)
        {
            if (json is null)
            {
                return(null);
            }

            var copyTo = new StringBuilder();

            json.CopyTo(0, copyTo, 0, json.Length);
            return(new LogUpdate {
                Value = FilterJson(copyTo, options)
            });
        }
예제 #6
0
 /// <summary>
 /// Creates a new <see cref="SimulationInfo"/> object from a <see cref="StringBuilder"/> that contains JSON.
 /// </summary>
 public static SimulationInfo Load(StringBuilder json, ObjectLoadOptions options) => new Internal.SimulationInfoObjectLoader().Load(json, options);
예제 #7
0
 /// <summary>
 /// Creates a new <see cref="SlotOptions"/> object from a <see cref="StringBuilder"/> that contains JSON.
 /// </summary>
 public static SlotOptions Load(StringBuilder json, ObjectLoadOptions options) => new Internal.SlotOptionsObjectLoader().Load(json, options);
예제 #8
0
 /// <summary>
 /// Creates a new <see cref="SlotCollection"/> object from a <see cref="String"/> that contains JSON.
 /// </summary>
 public static SlotCollection Load(string json, ObjectLoadOptions options) => new Internal.SlotCollectionObjectLoader().Load(json, options);
예제 #9
0
 /// <summary>
 /// Creates a new <see cref="Info"/> object from a <see cref="String"/> that contains JSON.
 /// </summary>
 public static Info Load(string json, ObjectLoadOptions options) => new Internal.InfoObjectLoader().Load(json, options);
예제 #10
0
 /// <summary>
 /// Creates a new <see cref="LogUpdate"/> object from a <see cref="StringBuilder"/> that contains the log text.
 /// </summary>
 public static LogUpdate Load(StringBuilder text, ObjectLoadOptions options) => new Internal.LogUpdateObjectLoader().Load(text, options);
예제 #11
0
 /// <summary>
 /// Creates a new <see cref="UnitCollection"/> object from a <see cref="StringBuilder"/> that contains JSON.
 /// </summary>
 public static UnitCollection Load(StringBuilder json, ObjectLoadOptions options) => new Internal.UnitCollectionObjectLoader().Load(json, options);
예제 #12
0
 protected StringBuilder FilterJson(StringBuilder json, ObjectLoadOptions options)
 {
     return(FilterJson(json, EnumerateFilters(options)));
 }
예제 #13
0
 /// <summary>
 /// Creates a new <see cref="Options"/> object from a <see cref="String"/> that contains JSON.
 /// </summary>
 public static Options Load(string json, ObjectLoadOptions options) => new Internal.OptionsObjectLoader().Load(json, options);