Exemplo n.º 1
0
        private static void DumpRecursively(object messageObj, int logLevel, int treeLevel)
        {
            Dictionary <object, object> dictionary = null;

            try
            {
                dictionary = (Dictionary <object, object>)messageObj;
            }
            catch (Exception ex)
            {
                global::Debug.LogFormat("Dumpメソッドのキャストが失敗. {0}", new object[]
                {
                    ex
                });
                return;
            }
            foreach (KeyValuePair <object, object> keyValuePair in dictionary)
            {
                switch (logLevel)
                {
                case 0:
                    global::Debug.LogFormat("{0}{1}:{2}", new object[]
                    {
                        new string('-', treeLevel),
                        keyValuePair.Key,
                        keyValuePair.Value
                    });
                    break;

                case 1:
                    global::Debug.LogWarningFormat("{0}{1}:{2}", new object[]
                    {
                        new string('-', treeLevel),
                        keyValuePair.Key,
                        keyValuePair.Value
                    });
                    break;

                case 2:
                    global::Debug.LogErrorFormat("{0}{1}:{2}", new object[]
                    {
                        new string('-', treeLevel),
                        keyValuePair.Key,
                        keyValuePair.Value
                    });
                    break;

                default:
                    global::Debug.LogFormat("{0}{1}:{2}", new object[]
                    {
                        new string('-', treeLevel),
                        keyValuePair.Key,
                        keyValuePair.Value
                    });
                    break;
                }
                MultiTools.DumpRecursively(keyValuePair.Value, logLevel, treeLevel + 1);
            }
        }
Exemplo n.º 2
0
        public static T GetValueByKey <T>(object messageObj, string key)
        {
            Dictionary <object, object> dictionary = (Dictionary <object, object>)messageObj;

            foreach (KeyValuePair <object, object> keyValuePair in dictionary)
            {
                if (keyValuePair.Key.ToString() == key && keyValuePair.Value != null)
                {
                    global::Debug.LogFormat("{0}キー発見.", new object[]
                    {
                        key
                    });
                    return(MultiTools.ConvertValue <T>(keyValuePair.Value));
                }
            }
            return(default(T));
        }
Exemplo n.º 3
0
 public static void DumpError(object messageObj)
 {
     MultiTools.DumpRecursively(messageObj, 2, 0);
 }
Exemplo n.º 4
0
 public static void DumpWarning(object messageObj)
 {
     MultiTools.DumpRecursively(messageObj, 1, 0);
 }