1. It's all pretty simple. I cannot deserialize json file with unsigned integer in it.
    DynamicConfigFile converts any integer to int32 which leads to overflow exception.

    Stacktrace:
    Code:
    10:37 PM [Error] Failed to call hook 'LoadTest' on plugin 'JsonTest' (OverflowException: Value is greater than Int32.MaxValue or less than Int32.MinValue)
    10:37 PM [Debug]   at System.Convert.ToInt32 (Int64 value) [0x00000] in <filename unknown>:0
      at System.Int64.System.IConvertible.ToInt32 (IFormatProvider provider) [0x00000] in <filename unknown>:0
      at System.Convert.ToInt32 (System.Object value, IFormatProvider provider) [0x00000] in <filename unknown>:0
      at System.Convert.ToInt32 (System.Object value) [0x00000] in <filename unknown>:0
      at Oxide.Core.Configuration.KeyValuesConverter.ReadJson (Newtonsoft.Json.JsonReader reader, System.Type objectType, System.Object existingValue, Newtonsoft.Json.JsonSerializer serializer) [0x00000] in <filename unknown>:0
      at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.DeserializeConvertable (Newtonsoft.Json.JsonConverter converter, Newtonsoft.Json.JsonReader reader, System.Type objectType, System.Object existingValue) [0x00000] in <filename unknown>:0
      at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize (Newtonsoft.Json.JsonReader reader, System.Type objectType, Boolean checkAdditionalContent) [0x00000] in <filename unknown>:0 
    Test Case:
    JsonTest.cs
     
  2. From à file the First paramèter can only be à string.
     
  3. Ehm, i'm sorry? Didn't get it..
     
  4. Guess i didnt understand what you asked neither
     
  5. Alright, in few words. Any integer (long, uint etc) is treated as Int32.
    Because DynamicConfigFile.ReadJson() does so:
    Code:
                            case JsonToken.Integer:
                                dict[propname] = Convert.ToInt32(reader.Value);
    I don't think that it's supposed to be like this.
     
    Last edited by a moderator: Apr 25, 2015
  6. Oh i see so that's why you can't set à float as option in à config or it bugs
     
  7. Wulf

    Wulf Community Admin

    Via @bawNg: If you want to use specific types, you should be using the object API
    Code:
    Interface.Oxide.DataFileSystem.ReadObject
    Interface.Oxide.DataFileSystem.WriteObject