public static Dictionary <K, V> ToWrap <K, V>(byte[] buffer, bool isLoadAll = false) where V : ConfigBase <K>, new() { if (buffer == null || buffer.Length <= 0) { return(null); } Dictionary <K, V> ret = ConfigWrap.ToObject <K, V>(buffer, isLoadAll); return(ret); }
public static Dictionary <K, V> ToWrap <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, V> ret = ConfigWrap.ToObject <K, V>(buffer, isLoadAll); if (ret == null) { try { string text = System.Text.Encoding.UTF8.GetString(buffer); ret = JsonMapper.ToObject <Dictionary <K, V> >(text); isJson = true; } catch { ret = null; } } return(ret); }