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


C# JsonTextWriter.WriteBoolean方法代码示例

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


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

示例1: WriteAccount

 void WriteAccount(JsonTextWriter writer, TwitterAccount account)
 {
     writer.WriteStartObject ();
     if (account.Credential is NetworkCredential) {
         NetworkCredential nc = account.Credential as NetworkCredential;
         writer.WriteKey ("username");
         writer.WriteString (nc.UserName);
         writer.WriteKey ("password");
         writer.WriteString (nc.Password);
     } else if (account.Credential is OAuthPasswordCache) {
         OAuthPasswordCache pc = account.Credential as OAuthPasswordCache;
         writer.WriteKey ("username");
         writer.WriteString (pc.UserName);
         writer.WriteKey ("password");
         writer.WriteString (pc.Password);
         writer.WriteKey ("token");
         writer.WriteString (pc.AccessToken);
         writer.WriteKey ("secret");
         writer.WriteString (pc.AccessSecret);
     }
     if (account.SelfUserID > 0) {
         writer.WriteKey ("id");
         writer.WriteNumber (account.SelfUserID);
     }
     writer.WriteKey ("rest");
     writer.WriteStartObject ();
     string[] rest_keys = new string[] {"home", "mentions", "dm"};
     TwitterAccount.RestUsage[] rests = new TwitterAccount.RestUsage[] {account.RestHome, account.RestMentions, account.RestDirectMessages};
     for (int i = 0; i < rest_keys.Length; i ++) {
         writer.WriteKey (rest_keys[i]);
         writer.WriteStartObject ();
         writer.WriteKey ("enable");
         writer.WriteBoolean (rests[i].IsEnabled);
         writer.WriteKey ("count");
         writer.WriteNumber (rests[i].Count);
         writer.WriteKey ("interval");
         writer.WriteNumber ((int)rests[i].Interval.TotalSeconds);
         writer.WriteEndObject ();
     }
     writer.WriteEndObject ();
     writer.WriteKey ("streaming");
     if (account.StreamingClient == null) {
         writer.WriteNull ();
     } else {
         writer.WriteStartObject ();
         writer.WriteKey ("mode");
         if (account.StreamingClient.Target is TwitterAccount) {
             writer.WriteString ("follow");
             writer.WriteKey ("username");
             writer.WriteString ((account.StreamingClient.Target as TwitterAccount).ScreenName);
         } else if (account.StreamingClient.Target is SearchStatuses) {
             writer.WriteString ("track");
             writer.WriteKey ("keywords");
             writer.WriteString (account.StreamingClient.SearchKeywords);
         } else if (account.StreamingClient.Target is ListStatuses) {
             writer.WriteString ("list");
             writer.WriteKey ("id");
             writer.WriteNumber ((account.StreamingClient.Target as ListStatuses).List.ID);
         }
         writer.WriteEndObject ();
     }
     writer.WriteEndObject ();
 }
开发者ID:atrandom,项目名称:ktwt,代码行数:63,代码来源:TwitterAccountManager.cs

示例2: SaveConfigInternalMisc

        void SaveConfigInternalMisc(JsonTextWriter writer)
        {
            writer.WriteStartObject ();

            writer.WriteKey ("include_mentions");
            writer.WriteBoolean (_mgr.HomeIncludeMentions);

            writer.WriteEndObject ();
        }
开发者ID:kazuki,项目名称:ktwt,代码行数:9,代码来源:MainWindow.xaml.cs


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