Exemple #1
0
 public static D FileToObject <D>(string file, byte proj = 0x0f) where D : IData, new()
 {
     try
     {
         byte[] bytes = File.ReadAllBytes(file);
         JObj   jo    = (JObj) new JsonParser(bytes, bytes.Length).Parse();
         if (jo != null)
         {
             return(jo.ToObject <D>(proj));
         }
     }
     catch (Exception ex)
     {
         Debug.WriteLine(ex.Message);
     }
     return(default);
Exemple #2
0
        public static D StringToObject <D>(string v, byte proj = 0x0f) where D : IData, new()
        {
            JObj jo = (JObj) new JsonParser(v).Parse();

            return(jo.ToObject <D>(proj));
        }