OSDN Git Service

TwitterApiConnection.RestApiBaseをstaticプロパティに変更
authorKimura Youichi <kim.upsilon@bucyou.net>
Thu, 5 May 2016 13:37:57 +0000 (22:37 +0900)
committerKimura Youichi <kim.upsilon@bucyou.net>
Thu, 5 May 2016 17:02:25 +0000 (02:02 +0900)
OpenTween/AppendSettingDialog.cs
OpenTween/Connection/TwitterApiConnection.cs
OpenTween/Tween.cs

index ecfb5ab..de1a827 100644 (file)
@@ -312,7 +312,7 @@ namespace OpenTween
 
             Networking.ForceIPv4 = this.ConnectionPanel.checkBoxForceIPv4.Checked;
 
-            HttpTwitter.TwitterUrl = this.ConnectionPanel.TwitterAPIText.Text.Trim();
+            TwitterApiConnection.RestApiBase = new Uri(this.ConnectionPanel.TwitterAPIText.Text.Trim());
         }
 
         private async Task<UserAccount> PinAuth()
index 4fc601b..a16c9be 100644 (file)
@@ -37,7 +37,7 @@ namespace OpenTween.Connection
 {
     public class TwitterApiConnection : IApiConnection, IDisposable
     {
-        public Uri RestApiBase { get; set; } = new Uri("https://api.twitter.com/1.1/");
+        public static Uri RestApiBase { get; set; } = new Uri("https://api.twitter.com/1.1/");
 
         public bool IsDisposed { get; private set; } = false;
 
@@ -60,7 +60,7 @@ namespace OpenTween.Connection
 
         public async Task<T> GetAsync<T>(Uri uri, IDictionary<string, string> param, string endpointName)
         {
-            var requestUri = new Uri(this.RestApiBase, uri);
+            var requestUri = new Uri(RestApiBase, uri);
 
             if (param != null)
                 requestUri = new Uri(requestUri, "?" + MyCommon.BuildQueryString(param));
@@ -102,7 +102,7 @@ namespace OpenTween.Connection
 
         public async Task<Stream> GetStreamAsync(Uri uri, IDictionary<string, string> param)
         {
-            var requestUri = new Uri(this.RestApiBase, uri);
+            var requestUri = new Uri(RestApiBase, uri);
 
             if (param != null)
                 requestUri = new Uri(requestUri, "?" + MyCommon.BuildQueryString(param));
@@ -120,7 +120,7 @@ namespace OpenTween.Connection
 
         public async Task<LazyJson<T>> PostLazyAsync<T>(Uri uri, IDictionary<string, string> param)
         {
-            var requestUri = new Uri(this.RestApiBase, uri);
+            var requestUri = new Uri(RestApiBase, uri);
             var request = new HttpRequestMessage(HttpMethod.Post, requestUri);
 
             using (var postContent = new FormUrlEncodedContent(param))
@@ -154,7 +154,7 @@ namespace OpenTween.Connection
 
         public async Task<LazyJson<T>> PostLazyAsync<T>(Uri uri, IDictionary<string, string> param, IDictionary<string, IMediaItem> media)
         {
-            var requestUri = new Uri(this.RestApiBase, uri);
+            var requestUri = new Uri(RestApiBase, uri);
             var request = new HttpRequestMessage(HttpMethod.Post, requestUri);
 
             using (var postContent = new MultipartFormDataContent())
@@ -239,7 +239,7 @@ namespace OpenTween.Connection
 
         public OAuthEchoHandler CreateOAuthEchoHandler(Uri authServiceProvider, Uri realm = null)
         {
-            var uri = new Uri(this.RestApiBase, authServiceProvider);
+            var uri = new Uri(RestApiBase, authServiceProvider);
 
             return OAuthEchoHandler.CreateHandler(Networking.CreateHttpClientHandler(), uri,
                 ApplicationSettings.TwitterConsumerKey, ApplicationSettings.TwitterConsumerSecret,
index 8f68012..bb95d6a 100644 (file)
@@ -776,7 +776,7 @@ namespace OpenTween
             if (this._cfgCommon.AutoShortUrlFirst < 0)
                 this._cfgCommon.AutoShortUrlFirst = MyCommon.UrlConverter.Uxnu;
 
-            HttpTwitter.TwitterUrl = this._cfgCommon.TwitterUrl;
+            TwitterApiConnection.RestApiBase = new Uri(this._cfgCommon.TwitterUrl);
             this.tw = new Twitter(this.twitterApi);
 
             //認証関連
@@ -812,7 +812,7 @@ namespace OpenTween
                 this._cfgLocal.ProxyUser, this._cfgLocal.ProxyPassword);
             Networking.ForceIPv4 = this._cfgCommon.ForceIPv4;
 
-            HttpTwitter.TwitterUrl = this._cfgCommon.TwitterUrl;
+            TwitterApiConnection.RestApiBase = new Uri(this._cfgCommon.TwitterUrl);
             tw.RestrictFavCheck = this._cfgCommon.RestrictFavCheck;
             tw.ReadOwnPost = this._cfgCommon.ReadOwnPost;
             tw.TrackWord = this._cfgCommon.TrackWord;
@@ -4174,7 +4174,7 @@ namespace OpenTween
                     ShortUrl.Instance.DisableExpanding = !this._cfgCommon.TinyUrlResolve;
                     ShortUrl.Instance.BitlyId = this._cfgCommon.BilyUser;
                     ShortUrl.Instance.BitlyKey = this._cfgCommon.BitlyPwd;
-                    HttpTwitter.TwitterUrl = _cfgCommon.TwitterUrl;
+                    TwitterApiConnection.RestApiBase = new Uri(this._cfgCommon.TwitterUrl);
 
                     Networking.DefaultTimeout = TimeSpan.FromSeconds(this._cfgCommon.DefaultTimeOut);
                     Networking.SetWebProxy(this._cfgLocal.ProxyType,