Пример #1
0
        public static Dictionary <K, List <V> > ToWrapList <K, V>(byte[] buffer,
                                                                  bool isLoadAll = false) where V : ConfigBase <K>, new()
        {
            if (buffer == null || buffer.Length <= 0)
            {
                return(null);
            }

            Dictionary <K, List <V> > ret = ConfigWrap.ToObjectList <K, V>(buffer, isLoadAll);

            return(ret);
        }
Пример #2
0
        public static Dictionary <K, List <V> > ToWrapList <K, V>(byte[] buffer,
                                                                  out bool isJson,
                                                                  bool isLoadAll = false) where V : ConfigBase <K>, new()
        {
            isJson = false;
            if (buffer == null || buffer.Length <= 0)
            {
                return(null);
            }

            Dictionary <K, List <V> > ret = ConfigWrap.ToObjectList <K, V>(buffer, isLoadAll);

            if (ret == null)
            {
                try {
                    string text = System.Text.Encoding.UTF8.GetString(buffer);
                    ret    = JsonMapper.ToObject <Dictionary <K, List <V> > >(text);
                    isJson = true;
                } catch {
                    ret = null;
                }
            }
            return(ret);
        }