本文整理汇总了C#中JsonTextWriter.WriteKey方法的典型用法代码示例。如果您正苦于以下问题:C# JsonTextWriter.WriteKey方法的具体用法?C# JsonTextWriter.WriteKey怎么用?C# JsonTextWriter.WriteKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JsonTextWriter
的用法示例。
在下文中一共展示了JsonTextWriter.WriteKey方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WriteSearch
void WriteSearch(JsonTextWriter writer, SearchStatuses search)
{
writer.WriteStartObject ();
writer.WriteKey ("keywords");
writer.WriteString (search.Keyword);
writer.WriteKey ("username");
writer.WriteString (search.Account.ScreenName);
WriteRestUsage (writer, search.RestInfo);
writer.WriteEndObject ();
}
示例2: WriteList
void WriteList(JsonTextWriter writer, ListStatuses list)
{
writer.WriteStartObject ();
writer.WriteKey ("id");
writer.WriteNumber (list.List.ID);
writer.WriteKey ("username");
writer.WriteString (list.Account.ScreenName);
WriteRestUsage (writer, list.RestInfo);
writer.WriteEndObject ();
}
示例3: WriteRestUsage
void WriteRestUsage(JsonTextWriter writer, TwitterAccount.RestUsage usage)
{
writer.WriteKey ("interval");
writer.WriteNumber (usage.Interval.TotalSeconds);
writer.WriteKey ("count");
writer.WriteNumber (usage.Count);
}
示例4: Save
public void Save(ConfigSaveDelegate save)
{
using (StreamWriter streamWriter = new StreamWriter (ConfigFilePath, false, System.Text.Encoding.UTF8))
using (JsonTextWriter writer = new JsonTextWriter (streamWriter)) {
writer.WriteStartObject ();
writer.WriteKey ("accounts");
writer.WriteStartArray ();
for (int i = 0; i < _accounts.Length; i ++)
WriteAccount (writer, _accounts[i]);
writer.WriteEndArray ();
writer.WriteKey ("searches");
writer.WriteStartArray ();
for (int i = 0; i < _searches.Length; i ++)
WriteSearch (writer, _searches[i]);
writer.WriteEndArray ();
writer.WriteKey ("lists");
writer.WriteStartArray ();
for (int i = 0; i < _lists.Length; i++)
WriteList (writer, _lists[i]);
writer.WriteEndArray ();
save (writer);
writer.WriteEndObject ();
}
}
示例5: 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 ();
}
示例6: SaveConfigInternalStyles
void SaveConfigInternalStyles(JsonTextWriter writer)
{
writer.WriteStartObject ();
writer.WriteKey ("colors");
writer.WriteStartObject ();
SaveConfigInternalColors (writer);
writer.WriteEndObject ();
writer.WriteKey ("fonts");
writer.WriteStartObject ();
SaveConfigInternalFonts (writer);
writer.WriteEndObject ();
writer.WriteKey ("icon_size");
writer.WriteNumber (IconSize);
writer.WriteEndObject ();
}
示例7: SaveConfigInternalMisc
void SaveConfigInternalMisc(JsonTextWriter writer)
{
writer.WriteStartObject ();
writer.WriteKey ("include_mentions");
writer.WriteBoolean (_mgr.HomeIncludeMentions);
writer.WriteEndObject ();
}
示例8: SaveConfigInternalFonts
void SaveConfigInternalFonts(JsonTextWriter writer)
{
writer.WriteKey ("main-family");
writer.WriteString (FontFamily.ToString ());
writer.WriteKey ("main-size");
writer.WriteNumber (FontSize);
}
示例9: SaveConfigInternalColors
void SaveConfigInternalColors(JsonTextWriter writer)
{
ColorCodeNameConverter conv = new ColorCodeNameConverter ();
writer.WriteKey ("bg");
writer.WriteString ((string)conv.Convert (Background, null, null, null));
writer.WriteKey ("fg");
writer.WriteString ((string)conv.Convert (Foreground, null, null, null));
writer.WriteKey ("postTextBoxBg");
writer.WriteString ((string)conv.Convert (PostTextBox.Background, null, null, null));
writer.WriteKey ("postTextBoxFg");
writer.WriteString ((string)conv.Convert (PostTextBox.Foreground, null, null, null));
writer.WriteKey ("postBg");
writer.WriteString ((string)conv.Convert (PostBackground, null, null, null));
writer.WriteKey ("postFg");
writer.WriteString ((string)conv.Convert (PostForeground, null, null, null));
writer.WriteKey ("postNameFg");
writer.WriteString ((string)conv.Convert (NameForeground, null, null, null));
writer.WriteKey ("postLinkFg");
writer.WriteString ((string)conv.Convert (LinkForeground, null, null, null));
}
示例10: SaveConfigInternal
void SaveConfigInternal(JsonTextWriter writer, TimelineBase timelines)
{
foreach (object item in timelines.TimeLines) {
writer.WriteStartObject ();
writer.WriteKey ("type");
TimelineInfo tl = item as TimelineInfo;
TabInfo tb = item as TabInfo;
if (tl != null) {
if (tl.Search != null) {
writer.WriteString ("search");
writer.WriteKey ("keywords");
writer.WriteString (tl.Search.Keyword);
} else if (tl.List != null) {
writer.WriteString ("list");
writer.WriteKey ("id");
writer.WriteNumber (tl.List.List.ID);
} else {
writer.WriteString ("account");
writer.WriteKey ("subtype");
if (tl.Statuses == tl.RestAccount.HomeTimeline)
writer.WriteString ("home");
else if (tl.Statuses == tl.RestAccount.Mentions)
writer.WriteString ("mentions");
else if (tl.Statuses == tl.RestAccount.DirectMessages)
writer.WriteString ("directmessages");
writer.WriteKey ("name");
writer.WriteString (tl.RestAccount.ScreenName);
}
} else if (tb != null) {
writer.WriteString ("tab");
writer.WriteKey ("title");
writer.WriteString (tb.Title);
writer.WriteKey ("windows");
writer.WriteStartArray ();
SaveConfigInternal (writer, tb);
writer.WriteEndArray ();
} else {
writer.WriteNull ();
}
writer.WriteEndObject ();
}
}