コード例 #1
0
        public static StringBuilder JSONSerializeReport(CountlyCrashReport report)
        {
            StringBuilder builder = new StringBuilder();
            builder.Append("{");

            foreach (KeyValuePair<string, string> pair in report.parameters) {
            if (pair.Value != null && pair.Value != "") {
              builder.Append("\"" + pair.Key + "\":\"" + pair.Value + "\",");
            }
            }

            if (report.custom != null && report.custom.Count > 0) {
            builder.Append("\"custom\":{");
            foreach (KeyValuePair<string, string> pair in report.custom) {
            builder.Append("\"" + pair.Key + "\":\"" + pair.Value + "\",");
            }
            builder.Length = builder.Length-1;
            builder.Append("}");
            } else {
            builder.Length = builder.Length-1;
            }

            builder.Append("}");

            return builder;
        }
コード例 #2
0
        public static StringBuilder JSONSerializeReport(CountlyCrashReport report)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append("{");

            foreach (KeyValuePair <string, string> pair in report.parameters)
            {
                if (pair.Value != null && pair.Value != "")
                {
                    builder.Append("\"" + pair.Key + "\":\"" + pair.Value + "\",");
                }
            }

            if (report.custom != null && report.custom.Count > 0)
            {
                builder.Append("\"custom\":{");
                foreach (KeyValuePair <string, string> pair in report.custom)
                {
                    builder.Append("\"" + pair.Key + "\":\"" + pair.Value + "\",");
                }
                builder.Length = builder.Length - 1;
                builder.Append("}");
            }
            else
            {
                builder.Length = builder.Length - 1;
            }

            builder.Append("}");

            return(builder);
        }