Ejemplo n.º 1
0
        public static D FileToObject <D>(string file, short proj = 0xff) 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);
Ejemplo n.º 2
0
        public static D StringToObject <D>(string v, short proj = 0xff) where D : IData, new()
        {
            JObj jo = (JObj) new JsonParser(v).Parse();

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