本文整理汇总了C#中Inscribe.Authentication.AccountInfo.CreateFavorites方法的典型用法代码示例。如果您正苦于以下问题:C# AccountInfo.CreateFavorites方法的具体用法?C# AccountInfo.CreateFavorites怎么用?C# AccountInfo.CreateFavorites使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Inscribe.Authentication.AccountInfo
的用法示例。
在下文中一共展示了AccountInfo.CreateFavorites方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FavTweetCore
private static void FavTweetCore(AccountInfo d, TweetViewModel status)
{
/*
if (ApiHelper.ExecApi(() => d.CreateFavorites(status.Status.Id)) == null)
throw new ApplicationException();
*/
for (int i = 0; i < 3; i++)
{
try
{
if (d.CreateFavorites(status.Status.Id) != null)
break;
}
catch (WebException wex)
{
var hwr = wex.Response as HttpWebResponse;
if (wex.Status == WebExceptionStatus.ProtocolError &&
hwr != null && hwr.StatusCode == HttpStatusCode.Forbidden)
{
// あとIt's great that ... ならふぁぼ規制
using (var read = new StreamReader( hwr.GetResponseStream()))
{
var desc = read.ReadToEnd();
if (desc.Contains("It's great that you like so many updates, but we only allow so many updates to be marked as a favorite per day."))
{
throw new FavoriteSuspendedException();
}
}
}
else if (wex.Status == WebExceptionStatus.Timeout)
{
continue;
}
else
{
break;
}
}
}
}
示例2: FavTweetCore
private static void FavTweetCore(AccountInfo d, TweetViewModel status)
{
if (ApiHelper.ExecApi(() => d.CreateFavorites(status.Status.Id)) == null)
throw new ApplicationException();
}