AllrepliesToolStripMenuItem.Checked = tw.AllAtReply;
//画像投稿サービス
- ImageSelector.Initialize(tw, SettingDialog.TwitterConfiguration, _cfgCommon.UseImageServiceName, _cfgCommon.UseImageService);
+ ImageSelector.Initialize(tw, this.tw.Configuration, _cfgCommon.UseImageServiceName, _cfgCommon.UseImageService);
//ウィンドウ設定
this.ClientSize = _cfgLocal.FormSize;
case MyCommon.WORKERTYPE.Configuration:
try
{
- this.SettingDialog.TwitterConfiguration = tw.ConfigurationApi();
+ this.tw.RefreshConfiguration();
}
catch (WebApiException ex) { ret = ex.Message; }
break;
break;
case MyCommon.WORKERTYPE.Configuration:
//_waitFollower = false
- if (SettingDialog.TwitterConfiguration.PhotoSizeLimit != 0)
+ if (this.tw.Configuration.PhotoSizeLimit != 0)
{
foreach (var service in this.ImageSelector.GetServices())
{
- service.UpdateTwitterConfiguration(this.SettingDialog.TwitterConfiguration);
+ service.UpdateTwitterConfiguration(this.tw.Configuration);
}
}
this.PurgeListViewItemCache();
this._cfgLocal.ProxyAddress, this._cfgLocal.ProxyPort,
this._cfgLocal.ProxyUser, this._cfgLocal.ProxyPassword);
- ImageSelector.Reset(tw, SettingDialog.TwitterConfiguration);
+ ImageSelector.Reset(tw, this.tw.Configuration);
try
{
last_url_invalid_match = Regex.IsMatch(lasturl, Twitter.url_invalid_short_domain, RegexOptions.IgnoreCase);
if (!last_url_invalid_match)
{
- pLen += lasturl.Length - SettingDialog.TwitterConfiguration.ShortUrlLength;
+ pLen += lasturl.Length - this.tw.Configuration.ShortUrlLength;
}
}
{
if (last_url_invalid_match)
{
- pLen += lasturl.Length - SettingDialog.TwitterConfiguration.ShortUrlLength;
+ pLen += lasturl.Length - this.tw.Configuration.ShortUrlLength;
}
pLen += path.Length;
}
else
{
int shortUrlLength = protocol == "https://"
- ? SettingDialog.TwitterConfiguration.ShortUrlLengthHttps
- : SettingDialog.TwitterConfiguration.ShortUrlLength;
+ ? this.tw.Configuration.ShortUrlLengthHttps
+ : this.tw.Configuration.ShortUrlLength;
pLen += url.Length - shortUrlLength;
}
}
if (ImageSelector.Visible && !string.IsNullOrEmpty(ImageSelector.ServiceName))
{
- pLen -= SettingDialog.TwitterConfiguration.CharactersReservedPerMedia;
+ pLen -= this.tw.Configuration.CharactersReservedPerMedia;
}
return pLen;
}
GetTimeline(MyCommon.WORKERTYPE.NoRetweetIds, 0, "");
// 取得失敗の場合は再試行する
- if (SettingDialog.TwitterConfiguration.PhotoSizeLimit == 0)
+ if (this.tw.Configuration.PhotoSizeLimit == 0)
GetTimeline(MyCommon.WORKERTYPE.Configuration, 0, "");
// 権限チェック read/write権限(xAuthで取得したトークン)の場合は再認証を促す
public bool IsTwitterId(string name)
{
- if (SettingDialog.TwitterConfiguration.NonUsernamePaths == null || SettingDialog.TwitterConfiguration.NonUsernamePaths.Length == 0)
+ if (this.tw.Configuration.NonUsernamePaths == null || this.tw.Configuration.NonUsernamePaths.Length == 0)
return !Regex.Match(name, @"^(about|jobs|tos|privacy|who_to_follow|download|messages)$", RegexOptions.IgnoreCase).Success;
else
- return !SettingDialog.TwitterConfiguration.NonUsernamePaths.Contains(name.ToLower());
+ return !this.tw.Configuration.NonUsernamePaths.Contains(name.ToLower());
}
private string GetUserId()
| frtrt\.net/solo_status\.php\?status= # RtRT
)(?<StatusId>[0-9]+)", RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace);
+ public TwitterConfiguration Configuration { get; private set; }
+
delegate void GetIconImageDelegate(PostClass post);
private readonly object LockObj = new object();
private List<long> followerId = new List<long>();
//private List<PostClass> _deletemessages = new List<PostClass>();
+ public Twitter()
+ {
+ this.Configuration = TwitterConfiguration.DefaultConfiguration();
+ }
+
public TwitterApiAccessLevel AccessLevel
{
get
}
/// <summary>
- /// t.co の文字列長などの設定情報を取得します
+ /// t.co の文字列長などの設定情報を更新します
/// </summary>
/// <exception cref="WebApiException"/>
- public TwitterConfiguration ConfigurationApi()
+ public void RefreshConfiguration()
+ {
+ this.Configuration = this.ConfigurationApi();
+ }
+
+ private TwitterConfiguration ConfigurationApi()
{
HttpStatusCode res;
var content = "";