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


C# JsonTextWriter.WriteBoolean方法代码示例

本文整理汇总了C#中Jayrock.Json.JsonTextWriter.WriteBoolean方法的典型用法代码示例。如果您正苦于以下问题:C# JsonTextWriter.WriteBoolean方法的具体用法?C# JsonTextWriter.WriteBoolean怎么用?C# JsonTextWriter.WriteBoolean使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Jayrock.Json.JsonTextWriter的用法示例。


在下文中一共展示了JsonTextWriter.WriteBoolean方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Page_Load

        protected void Page_Load(object sender, System.EventArgs e)
        {
            Response.ContentType = "application/json";

            string programID = Request.QueryString["programID"];
            Program program = uWiMP.TVServer.Programs.GetProgramByProgramId(Convert.ToInt32(programID));
            Channel channel = uWiMP.TVServer.Channels.GetChannelByChannelId(program.IdChannel);

            string timetext = string.Format("<b>{0}-{1}</b><br>", program.StartTime.ToShortTimeString(), program.EndTime.ToShortTimeString());
            string title = program.Title == "" ? GetGlobalResourceObject("uWiMPStrings", "unknown_title").ToString() : program.Title;
            string episodeName = program.EpisodeName == "" ? timetext : timetext + "<b>" + program.EpisodeName + "</b><br>";
            string description = program.Description == "" ? GetGlobalResourceObject("uWiMPStrings", "description_not_found").ToString() : episodeName + program.Description;

            using (JsonTextWriter jw = new JsonTextWriter())
            {
                jw.PrettyPrint = true;
                jw.WriteStartObject();
                jw.WriteMember("title");
                jw.WriteString(title);
                jw.WriteMember("description");
                jw.WriteString(description);
                jw.WriteMember("channel");
                jw.WriteString(channel.DisplayName);
                jw.WriteMember("running");
                jw.WriteBoolean(program.IsRunningAt(DateTime.Now));
                jw.WriteMember("scheduled");
                jw.WriteBoolean(uWiMP.TVServer.Schedules.IsProgramScheduled(program));
                jw.WriteEndObject();

                Response.Write(jw.ToString());
            }
        }
开发者ID:rndthoughts,项目名称:ipimpplus,代码行数:32,代码来源:ProgramDetails.aspx.cs

示例2: Page_Load

        protected void Page_Load(object sender, System.EventArgs e)
        {
            Response.ContentType = "application/json";

            string programID = Request.QueryString["programID"];
            string recordOption = Request.QueryString["option"];
            bool success;

            if (User.IsInRole("recorder"))
            {
                success = uWiMP.TVServer.Recordings.RecordProgramById(Convert.ToInt32(programID), (Recordings.RecordingType)Convert.ToInt32(recordOption));
            }
            else
            {
                success = false;
            }

            using (JsonTextWriter jw = new JsonTextWriter())
            {
                jw.PrettyPrint = true;
                jw.WriteStartObject();
                jw.WriteMember("result");
                jw.WriteBoolean(success);
                jw.WriteEndObject();

                Response.Write(jw.ToString());
            }
        }
开发者ID:rndthoughts,项目名称:ipimpplus,代码行数:28,代码来源:RecordProgram.aspx.cs

示例3: JayrockWriterObjects

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

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

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

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

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

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

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

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

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

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

                    case 'N':
                        writer.WriteNull ();
                        break;
                    }
                }
            }
        }
开发者ID:cupsster,项目名称:litjson,代码行数:57,代码来源:BmJayrockWriter.cs

示例4: WriteBoolean

 public void WriteBoolean()
 {
     JsonTextWriter writer = new JsonTextWriter(new StringWriter());
     writer.WriteBoolean(true);
     Assert.AreEqual("true", writer.ToString());
     
     writer = new JsonTextWriter(new StringWriter());
     writer.WriteBoolean(false);
     Assert.AreEqual("false", writer.ToString());
 }
开发者ID:BackupTheBerlios,项目名称:jayrock-svn,代码行数:10,代码来源:TestJsonTextWriter.cs

示例5: ReturnBoolean

        static internal string ReturnBoolean(bool value)
        {
            JsonTextWriter jw = new JsonTextWriter();
            jw.PrettyPrint = true;
            jw.WriteStartObject();
            jw.WriteMember("result");
            jw.WriteBoolean(value);
            jw.WriteEndObject();

            return jw.ToString();
        }
开发者ID:rndthoughts,项目名称:ipimpplus,代码行数:11,代码来源:MPClientRemoting.cs

示例6: ConvertRequestToJson

        static internal string ConvertRequestToJson(uWiMP.TVServer.MPClient.Request request)
        {
            JsonTextWriter jw = new JsonTextWriter();
            jw.PrettyPrint = true;
            jw.WriteStartObject();
            jw.WriteMember("action");
            jw.WriteString(request.Action);
            jw.WriteMember("filter");
            jw.WriteString(request.Filter);
            jw.WriteMember("value");
            jw.WriteString(request.Value);
            jw.WriteMember("start");
            jw.WriteString(request.Start.ToString());
            jw.WriteMember("pagesize");
            jw.WriteString(request.PageSize.ToString());
            jw.WriteMember("shuffle");
            jw.WriteBoolean(request.Shuffle);
            jw.WriteMember("enqueue");
            jw.WriteBoolean(request.Enqueue);
            jw.WriteMember("tracks");
            jw.WriteString(request.Tracks);
            jw.WriteEndObject();

            return jw.ToString();
        }
开发者ID:rndthoughts,项目名称:ipimpplus,代码行数:25,代码来源:MPClientRemoting.cs

示例7: JayrockOutputFile

        public static void JayrockOutputFile ()
        {
            using (FileStream fs = new FileStream ("jayrock_out.txt",
                                                   FileMode.Create)) {
                StreamWriter out_stream = new StreamWriter (fs);

                StringReader sr = new StringReader (Common.JsonText);

                JsonReader reader = new JsonTextReader (sr);


                out_stream.WriteLine (
                    "*** Reading with Jayrock.Json.JsonReader");

                while (reader.Read ()) {
                    out_stream.Write ("Token: {0}", reader.TokenClass);

                    if (reader.Text != null)
                        out_stream.WriteLine (" Value: {0}", reader.Text);
                    else
                        out_stream.WriteLine ("");

                }


                out_stream.WriteLine (
                    "\n*** Writing with Jayrock.Json.JsonWriter");

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

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

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

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

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

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

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

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

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

                    case 'N':
                        writer.WriteNull ();
                        break;
                    }
                }


                out_stream.WriteLine (
                    "\n\n*** Data imported with " +
                    "Jayrock.Json.Conversion.JsonConvert\n");

                Person art = (Person) JsonConvert.Import (typeof (Person),
                                                          Common.PersonJson);

                out_stream.Write (art.ToString ());


                out_stream.WriteLine (
                    "\n\n*** Object exported with " +
                    "Jayrock.Json.Conversion.JsonConvert\n");

                out_stream.Write (JsonConvert.ExportToString (
                        Common.SamplePerson));

                out_stream.WriteLine (
                    "\n\n*** Generic object exported with " +
                    "Jayrock.Json.Conversion.JsonConvert\n");
//.........这里部分代码省略.........
开发者ID:chenchen2015,项目名称:litjson,代码行数:101,代码来源:BmJayrockOutput.cs


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