OSDN Git Service

.NET Framework 4.0 Client Profile での動作に対応
authorKimura Youichi <kim.upsilon@bucyou.net>
Thu, 7 Feb 2013 19:48:56 +0000 (04:48 +0900)
committerKimura Youichi <kim.upsilon@bucyou.net>
Thu, 7 Feb 2013 20:00:06 +0000 (05:00 +0900)
LRUCacheDictionary クラスによって System.Runtime.Caching.dll 依存は
無くなったため、残りの System.Web.HttpUtility クラスへの依存を無くした

OpenTween/MyCommon.cs
OpenTween/OpenTween.csproj
OpenTween/Resources/ChangeLog.txt
OpenTween/ShortUrl.cs
OpenTween/ShowUserInfo.cs
OpenTween/Tween.cs
OpenTween/Twitter.cs

index e79d482..063d2c1 100644 (file)
@@ -405,7 +405,7 @@ namespace OpenTween
             }
             if (Convert.ToInt32(c_) <= 127 && c_ != '%') return _input;
 
-            var input = HttpUtility.UrlDecode(_input);
+            var input = Uri.UnescapeDataString(_input);
         retry:
             foreach (char c in input)
             {
index d58cafd..6023d9b 100644 (file)
@@ -12,6 +12,7 @@
     <AssemblyName>OpenTween</AssemblyName>
     <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
     <FileAlignment>512</FileAlignment>
+    <TargetFrameworkProfile>Client</TargetFrameworkProfile>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
     <DebugSymbols>true</DebugSymbols>
@@ -43,9 +44,7 @@
     <Reference Include="System" />
     <Reference Include="System.Core" />
     <Reference Include="System.Drawing" />
-    <Reference Include="System.Runtime.Caching" />
     <Reference Include="System.Runtime.Serialization" />
-    <Reference Include="System.Web" />
     <Reference Include="System.Windows.Forms" />
     <Reference Include="System.Xml.Linq" />
     <Reference Include="System.Data.DataSetExtensions" />
       <Link>LICENSE.LGPL-3</Link>
       <CopyToOutputDirectory>Always</CopyToOutputDirectory>
     </None>
+    <None Include="app.config" />
   </ItemGroup>
   <ItemGroup>
     <Content Include="Resources\3b.ico" />
index 55cd0eb..d0dd342 100644 (file)
@@ -1,6 +1,7 @@
 更新履歴
 
 ==== Ver 1.0.9-beta1(2013/xx/xx)
+ * NEW: .NET Framework 4.0 Client Profile での動作に対応 (今後Full版のインストールは不要になります)
  * NEW: メニューに Twitter API の稼働状況ページへのリンクを追加
  * CHG: アイコンのキャッシュ機構を全面的に書き直し
  * CHG: アイコンの取得先をHTTPSを使用するURLに変更
index 4ce65eb..8248ea4 100644 (file)
@@ -261,7 +261,7 @@ namespace OpenTween
             //nico.msは短縮しない
             if (SrcUrl.StartsWith("http://nico.ms/")) return "Can't convert";
 
-            SrcUrl = HttpUtility.UrlEncode(SrcUrl);
+            SrcUrl = Uri.EscapeDataString(SrcUrl);
 
             switch (ConverterType)
             {
index 596604d..3d5134a 100644 (file)
@@ -398,7 +398,7 @@ namespace OpenTween
                     e.Url.AbsoluteUri.StartsWith("https://twitter.com/search?q=%23"))
                 {
                     //ハッシュタグの場合は、タブで開く
-                    string urlStr = HttpUtility.UrlDecode(e.Url.AbsoluteUri);
+                    string urlStr = Uri.UnescapeDataString(e.Url.AbsoluteUri);
                     string hash = urlStr.Substring(urlStr.IndexOf("#"));
                     MyOwner.HashSupl.AddItem(hash);
                     MyOwner.HashMgr.AddHashToHistory(hash.Trim(), false);
index c6895d6..d748293 100644 (file)
@@ -869,17 +869,6 @@ namespace OpenTween
             //アイコンリスト作成
             this.IconCache = new ImageCache();
 
-            try
-            {
-                new System.Runtime.Caching.MemoryCache("dummyCache");
-            }
-            catch (Exception)
-            {
-                MessageBox.Show("Please install [.NET Framework 4 (Full)].");
-                Application.Exit();
-                return;
-            }
-
             bool saveRequired = false;
             bool firstRun = false;
 
@@ -2346,7 +2335,7 @@ namespace OpenTween
             //Google検索(試験実装)
             if (StatusText.Text.StartsWith("Google:", StringComparison.OrdinalIgnoreCase) && StatusText.Text.Trim().Length > 7)
             {
-                string tmp = string.Format(Properties.Resources.SearchItem2Url, HttpUtility.UrlEncode(StatusText.Text.Substring(7)));
+                string tmp = string.Format(Properties.Resources.SearchItem2Url, Uri.EscapeDataString(StatusText.Text.Substring(7)));
                 OpenUriAsync(tmp);
             }
 
@@ -4204,7 +4193,7 @@ namespace OpenTween
                    e.Url.AbsoluteUri.StartsWith("https://twitter.com/search?q=%23"))
                 {
                     //ハッシュタグの場合は、タブで開く
-                    string urlStr = HttpUtility.UrlDecode(e.Url.AbsoluteUri);
+                    string urlStr = Uri.UnescapeDataString(e.Url.AbsoluteUri);
                     int i = urlStr.IndexOf('#');
                     if (i == -1) return;
 
@@ -9255,7 +9244,7 @@ namespace OpenTween
                     openUrlStr.StartsWith("https://twitter.com/search?q="))
                 {
                     //ハッシュタグの場合は、タブで開く
-                    string urlStr = HttpUtility.UrlDecode(openUrlStr);
+                    string urlStr = Uri.UnescapeDataString(openUrlStr);
                     string hash = urlStr.Substring(urlStr.IndexOf("#"));
                     HashSupl.AddItem(hash);
                     HashMgr.AddHashToHistory(hash.Trim(), false);
@@ -10249,7 +10238,7 @@ namespace OpenTween
                     return;
                 }
 
-                string tmp = string.Format(url, HttpUtility.UrlEncode(_selText));
+                string tmp = string.Format(url, Uri.EscapeDataString(_selText));
                 OpenUriAsync(tmp);
             }
         }
@@ -10802,7 +10791,7 @@ namespace OpenTween
                 string rtdata = _curPost.Text;
                 rtdata = CreateRetweetUnofficial(rtdata);
 
-                StatusText.Text = "RT @" + _curPost.ScreenName + ": " + HttpUtility.HtmlDecode(rtdata);
+                StatusText.Text = "RT @" + _curPost.ScreenName + ": " + Uri.UnescapeDataString(rtdata);
 
                 StatusText.SelectionStart = 0;
                 StatusText.Focus();
@@ -11398,7 +11387,7 @@ namespace OpenTween
                 string rtdata = _curPost.Text;
                 rtdata = CreateRetweetUnofficial(rtdata);
 
-                StatusText.Text = " QT @" + _curPost.ScreenName + ": " + HttpUtility.HtmlDecode(rtdata);
+                StatusText.Text = " QT @" + _curPost.ScreenName + ": " + Uri.UnescapeDataString(rtdata);
                 if (_curPost.RetweetedId == 0)
                 {
                     _reply_to_id = _curPost.StatusId;
index df1ca16..73f1d86 100644 (file)
@@ -396,7 +396,7 @@ namespace OpenTween
 
         private string GetPlainText(string orgData)
         {
-            return HttpUtility.HtmlDecode(Regex.Replace(orgData, "(?<tagStart><a [^>]+>)(?<text>[^<]+)(?<tagEnd></a>)", "${text}"));
+            return Uri.UnescapeDataString(Regex.Replace(orgData, "(?<tagStart><a [^>]+>)(?<text>[^<]+)(?<tagEnd></a>)", "${text}"));
         }
 
         // htmlの簡易サニタイズ(詳細表示に不要なタグの除去)
@@ -2158,7 +2158,7 @@ namespace OpenTween
             post.Text = CreateHtmlAnchor(ref textFromApi, post.ReplyToList, entities, post.Media);
             post.TextFromApi = textFromApi;
             post.TextFromApi = this.ReplaceTextFromApi(post.TextFromApi, entities);
-            post.TextFromApi = HttpUtility.HtmlDecode(post.TextFromApi);
+            post.TextFromApi = Uri.UnescapeDataString(post.TextFromApi);
             post.TextFromApi = post.TextFromApi.Replace("<3", "\u2661");
 
             //Source整形
@@ -2289,7 +2289,7 @@ namespace OpenTween
             //本文
             post.TextFromApi = status.Text;
             var entities = status.Entities;
-            post.Source = HttpUtility.HtmlDecode(status.Source);
+            post.Source = Uri.UnescapeDataString(status.Source);
             post.InReplyToStatusId = status.InReplyToStatusId;
             post.InReplyToUser = status.ToUser;
             post.InReplyToUserId = !status.ToUserId.HasValue ? 0 : (long)status.ToUserId;
@@ -2313,7 +2313,7 @@ namespace OpenTween
             string textFromApi = post.TextFromApi;
             post.Text = this.CreateHtmlAnchor(ref textFromApi, post.ReplyToList, entities, post.Media);
             post.TextFromApi = this.ReplaceTextFromApi(post.TextFromApi, entities);
-            post.TextFromApi = HttpUtility.HtmlDecode(post.TextFromApi);
+            post.TextFromApi = Uri.UnescapeDataString(post.TextFromApi);
             post.TextFromApi = post.TextFromApi.Replace("<3", "\u2661");
 
             //Source整形
@@ -2831,7 +2831,7 @@ namespace OpenTween
                     post.TextFromApi = message.Text;
                     //HTMLに整形
                     post.Text = CreateHtmlAnchor(post.TextFromApi, post.ReplyToList, post.Media);
-                    post.TextFromApi = HttpUtility.HtmlDecode(post.TextFromApi);
+                    post.TextFromApi = Uri.UnescapeDataString(post.TextFromApi);
                     post.TextFromApi = post.TextFromApi.Replace("<3", "\u2661");
                     post.IsFav = false;
 
@@ -3106,7 +3106,7 @@ namespace OpenTween
                     post.Text = CreateHtmlAnchor(ref textFromApi, post.ReplyToList, entities, post.Media);
                     post.TextFromApi = textFromApi;
                     post.TextFromApi = this.ReplaceTextFromApi(post.TextFromApi, entities);
-                    post.TextFromApi = HttpUtility.HtmlDecode(post.TextFromApi);
+                    post.TextFromApi = Uri.UnescapeDataString(post.TextFromApi);
                     post.TextFromApi = post.TextFromApi.Replace("<3", "\u2661");
                     //Source整形
                     CreateSource(post);
@@ -4032,7 +4032,7 @@ namespace OpenTween
                 if (mS.Success)
                 {
                     post.SourceHtml = string.Copy(ShortUrl.Resolve(PreProcessUrl(post.Source), false));
-                    post.Source = HttpUtility.HtmlDecode(mS.Result("${source}"));
+                    post.Source = Uri.UnescapeDataString(mS.Result("${source}"));
                 }
                 else
                 {
@@ -4447,7 +4447,7 @@ namespace OpenTween
                     break;
                 case "favorite":
                 case "unfavorite":
-                    evt.Target = "@" + eventData.TargetObject.User.ScreenName + ":" + HttpUtility.HtmlDecode(eventData.TargetObject.Text);
+                    evt.Target = "@" + eventData.TargetObject.User.ScreenName + ":" + Uri.UnescapeDataString(eventData.TargetObject.Text);
                     evt.Id = eventData.TargetObject.Id;
                     if (AppendSettingDialog.Instance.IsRemoveSameEvent)
                     {