当前位置: 首页>>代码示例>>C#>>正文


C# LitJson.JsonWriter类代码示例

本文整理汇总了C#中LitJson.JsonWriter的典型用法代码示例。如果您正苦于以下问题:C# JsonWriter类的具体用法?C# JsonWriter怎么用?C# JsonWriter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


JsonWriter类属于LitJson命名空间,在下文中一共展示了JsonWriter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: createResource

        public static void createResource()
        {
            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            DirectoryInfo di = new DirectoryInfo(Global.PATH + "/res");
            var jd = new LitJson.JsonData();
            FileInfo[] fs = di.GetFiles("*", SearchOption.TopDirectoryOnly);

            foreach (FileInfo fi in fs)
            {
                if (fi.Name.Contains(".manifest"))
                {
                    continue;
                }

                string pPath = "res/" + fi.Name;
                jd[pPath.Replace("/", "@").Replace("\\", "@")] = pPath;
            }


            getJsonData(jd,"");
            JsonWriter writer = new JsonWriter(sb);
            writer.PrettyPrint = true;
            writer.IndentValue = 4;
            jd.ToJson(writer);
             
            

 
            string result = CoccosHelper.Properties.Resources.tpl.Replace("#1#", sb.ToString());
            File.WriteAllText(Global.PATH + "/src/resource.js", result);

        }
开发者ID:wshxbqq,项目名称:Cocos2dxJs-Helper,代码行数:32,代码来源:Resource.cs

示例2: Encode

        public string Encode(object obj)
        {
            JsonWriter writer = new JsonWriter();
            JsonMapper.ToJson(obj, writer);

            return writer.ToString();
        }
开发者ID:ideadreamDefy,项目名称:Defy,代码行数:7,代码来源:LitJsonEncoder.cs

示例3: Write

 static void Write(JsonWriter writer, string failedMessage)
 {
     WriteObject(writer, () =>
         {
             WriteProperty(writer, "message", failedMessage);
         });
 }
开发者ID:dwhelan,项目名称:Cuke4Nuke,代码行数:7,代码来源:Formatter.cs

示例4: ExportJson

 public override void ExportJson(JsonWriter writer)
 {
     using (var scope = new JsonScopeObjectWriter(writer)) {
         WriteCommonObjectNode(writer, scope);
         scope.WriteKeyValue("color", Color);
         scope.WriteKeyValue("intensity", Intensity);
     }
 }
开发者ID:GTAWWEKID,项目名称:unity-scene-web-exporter,代码行数:8,代码来源:AmbientLightElem.cs

示例5: ExportJson

 public override void ExportJson(JsonWriter writer)
 {
     using (var scope = new JsonScopeObjectWriter(writer)) {
         WriteCommonObjectNode(writer, scope);
         scope.WriteKeyValue("geometry", Geometry.Uuid);
         scope.WriteKeyValue("material", Material.Uuid);
     }
 }
开发者ID:GTAWWEKID,项目名称:unity-scene-web-exporter,代码行数:8,代码来源:MeshElem.cs

示例6: ErrorPropertyExpectedTest

        public void ErrorPropertyExpectedTest ()
        {
            JsonWriter writer = new JsonWriter ();

            writer.WriteObjectStart ();
            writer.Write (10);
            writer.WriteObjectEnd ();
        }
开发者ID:wanggan768q,项目名称:litjson-portable,代码行数:8,代码来源:JsonWriterTest.cs

示例7: ExportJson

 public override void ExportJson(JsonWriter writer)
 {
     using (var scope = new JsonScopeObjectWriter(writer)) {
         scope.WriteKeyValue("url", "./" + Name);
         scope.WriteKeyValue("uuid", Uuid);
         scope.WriteKeyValue("name", Name);
     }
 }
开发者ID:GTAWWEKID,项目名称:unity-scene-web-exporter,代码行数:8,代码来源:ImageElem.cs

示例8: ErrorArrayClosingTest

        public void ErrorArrayClosingTest()
        {
            JsonWriter writer = new JsonWriter ();

            writer.WriteArrayStart ();
            writer.Write (true);
            writer.WriteObjectEnd ();
        }
开发者ID:kvantetore,项目名称:litjson,代码行数:8,代码来源:JsonWriterTest.cs

示例9: LitJsonWriterObjects

        public static void LitJsonWriterObjects ()
        {
            for (int j = 0; j < Common.Iterations; j++) {
                StringBuilder output = new StringBuilder ();
                JsonWriter writer = new JsonWriter (new StringWriter (output));

                int n = Common.SampleObject.Length;
                for (int i = 0; i < n; i += 2) {
                    switch ((char) Common.SampleObject[i]) {
                    case '{':
                        writer.WriteObjectStart ();
                        break;

                    case '}':
                        writer.WriteObjectEnd ();
                        break;

                    case '[':
                        writer.WriteArrayStart ();
                        break;

                    case ']':
                        writer.WriteArrayEnd ();
                        break;

                    case 'P':
                        writer.WritePropertyName (
                            (string) Common.SampleObject[i + 1]);
                        break;

                    case 'I':
                        writer.Write (
                            (int) Common.SampleObject[i + 1]);
                        break;

                    case 'D':
                        writer.Write (
                            (double) Common.SampleObject[i + 1]);
                        break;

                    case 'S':
                        writer.Write (
                            (string) Common.SampleObject[i + 1]);
                        break;

                    case 'B':
                        writer.Write (
                            (bool) Common.SampleObject[i + 1]);
                        break;

                    case 'N':
                        writer.Write (null);
                        break;
                    }
                }

            }
        }
开发者ID:chenchen2015,项目名称:litjson,代码行数:58,代码来源:BmLitJsonWriter.cs

示例10: ErrorExcessDataTest

        public void ErrorExcessDataTest()
        {
            JsonWriter writer = new JsonWriter ();

            writer.WriteArrayStart ();
            writer.Write (true);
            writer.WriteArrayEnd ();
            writer.Write (false);
        }
开发者ID:kvantetore,项目名称:litjson,代码行数:9,代码来源:JsonWriterTest.cs

示例11: SaveSettings

		public void SaveSettings(Settings.SerializedForm serializedForm) {
			JsonWriter writer = new JsonWriter();
			writer.PrettyPrint = true;
			JsonMapper.ToJson(serializedForm, writer);
			string json = writer.ToString();
			StreamWriter sr = new StreamWriter(this.configFile);
			sr.Write(json);
			sr.Close();
		}
开发者ID:modulexcite,项目名称:timer,代码行数:9,代码来源:FileHandler.cs

示例12: SaveTasks

		public void SaveTasks(TaskList.SerializedForm serializedForm) {
			JsonWriter writer = new JsonWriter();
			writer.PrettyPrint = true;
			JsonMapper.ToJson(serializedForm, writer);
			string json = writer.ToString();
			StreamWriter sr = new StreamWriter(this.taskFile);
			sr.Write(json);
			sr.Close();
		}
开发者ID:modulexcite,项目名称:timer,代码行数:9,代码来源:FileHandler.cs

示例13: ErrorObjectClosingTest

        public void ErrorObjectClosingTest()
        {
            JsonWriter writer = new JsonWriter ();

            writer.WriteObjectStart ();
            writer.WritePropertyName ("foo");
            writer.Write ("bar");
            writer.WriteArrayEnd ();
        }
开发者ID:kvantetore,项目名称:litjson,代码行数:9,代码来源:JsonWriterTest.cs

示例14: ToNetMsg

        public static void ToNetMsg(Dictionary<long, F3_NetServerInfo> servers, ref NetOutgoingMessage netMsg)
        {
            netMsg.Write((byte)NetDataType.eDATA_REQUEST_SERVER_LIST);

            StringBuilder sb = new StringBuilder();
            JsonWriter writer = new JsonWriter(sb);

            writer.WriteObjectStart();
            writer.WritePropertyName("servers");
            writer.WriteArrayStart();

            for (int i = 0; i < servers.Count; i++)
            {
                F3_NetServerInfo info = servers.ElementAt(i).Value;
                writer.WriteObjectStart();

                writer.WritePropertyName("UUID");
                writer.Write(servers.ElementAt(i).Key);

                writer.WritePropertyName("serverName");
                writer.Write(info.m_serverName);

                writer.WritePropertyName("type");
                writer.Write((int)info.m_serverType);

                writer.WritePropertyName("internal_ip");
                writer.Write(info.m_serverInternalAdress.Address.ToString());

                writer.WritePropertyName("internal_port");
                writer.Write(info.m_serverInternalAdress.Port);

                writer.WritePropertyName("external_ip");
                writer.Write(info.m_serverExternalAdress.Address.ToString());

                writer.WritePropertyName("external_port");
                writer.Write(info.m_serverExternalAdress.Port);

                writer.WritePropertyName("maxPlayers");
                writer.Write(info.m_maxPlayers);

                writer.WritePropertyName("currentPlayers");
                writer.Write(info.m_currentNbPlayers);

                writer.WritePropertyName("token");
                writer.Write(info.m_NATtoken);

                writer.WriteObjectEnd();
            }

            writer.WriteArrayEnd();
            writer.WriteObjectEnd();

            netMsg.Write(sb.ToString());
        }
开发者ID:SharpEdgeEntertainment,项目名称:FrozenFlameFramework,代码行数:54,代码来源:F3.+NetMessageRequestServerList.cs

示例15: BooleansTest

        public void BooleansTest()
        {
            JsonWriter writer = new JsonWriter ();

            writer.WriteArrayStart ();
            writer.Write (true);
            writer.Write (false);
            writer.Write (false);
            writer.Write (true);
            writer.WriteArrayEnd ();
        }
开发者ID:kvantetore,项目名称:litjson,代码行数:11,代码来源:JsonWriterTest.cs


注:本文中的LitJson.JsonWriter类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。