OSDN Git Service

na-get-lib,NaGet.Util.UrlDecodeを削除。(System.Web.HttpUtilities.UrlDecodeの利用とする)
authorttp <ttp@users.sourceforge.jp>
Fri, 8 May 2009 17:02:37 +0000 (02:02 +0900)
committerttp <ttp@users.sourceforge.jp>
Fri, 8 May 2009 17:02:37 +0000 (02:02 +0900)
na-get-lib/NaGet/Utils.cs
na-get-lib/na-get-lib.csproj

index 87b2736..1d71ba5 100644 (file)
@@ -154,7 +154,7 @@ namespace NaGet
                /// <param name="url">対象のurl</param>\r
                public static string Url2filename(string url)\r
                {\r
                /// <param name="url">対象のurl</param>\r
                public static string Url2filename(string url)\r
                {\r
-                       string filename = Path.GetFileName(UrlDecode(url, Encoding.UTF8));\r
+                       string filename = Path.GetFileName(System.Web.HttpUtility.UrlDecode(url, Encoding.UTF8));\r
                        \r
                        int pos;\r
                        if ((pos = filename.IndexOfAny(Path.GetInvalidFileNameChars())) >= 0) {\r
                        \r
                        int pos;\r
                        if ((pos = filename.IndexOfAny(Path.GetInvalidFileNameChars())) >= 0) {\r
@@ -170,69 +170,6 @@ namespace NaGet
                }\r
                \r
                /// <summary>\r
                }\r
                \r
                /// <summary>\r
-               /// URLのデコードを行う\r
-               /// </summary>\r
-               /// <param name="s">対象のurl文字列</param>\r
-               /// <param name="e">デコードの処理に使う文字コード</param>\r
-               public static string UrlDecode(string s, Encoding e)\r
-               {\r
-                       // mono の System.Net.HttpUtility より作成\r
-                       \r
-                       if (null == s)\r
-                               return null;\r
-\r
-                       if (s.IndexOf ('%') == -1 && s.IndexOf ('+') == -1)\r
-                               return s;\r
-\r
-                       if (e == null)\r
-                               e = Encoding.GetEncoding (28591);\r
-\r
-                       StringBuilder output = new StringBuilder ();\r
-                       long len = s.Length;\r
-                       NumberStyles hexa = NumberStyles.HexNumber;\r
-                       MemoryStream bytes = new MemoryStream ();\r
-\r
-                       for (int i = 0; i < len; i++) {\r
-                               if (s [i] == '%' && i + 2 < len) {\r
-                                       if (s [i + 1] == 'u' && i + 5 < len) {\r
-                                               if (bytes.Length > 0) {\r
-                                                       //output.Append (GetChars (bytes, e));\r
-                                                       output.Append(e.GetChars(bytes.GetBuffer(), 0, (int) bytes.Length));\r
-                                                       bytes.SetLength (0);\r
-                                               }\r
-                                               \r
-                                               output.Append ((char) int.Parse(s.Substring (i + 2, 4), hexa));\r
-                                               i += 5;\r
-                                       } else {\r
-                                               bytes.WriteByte ((byte) int.Parse(s.Substring (i + 1, 2), hexa));\r
-                                               i += 2;\r
-                                       }\r
-                                       continue;\r
-                               }\r
-\r
-                               if (bytes.Length > 0) {\r
-                                       //output.Append (GetChars (bytes, e));\r
-                                       output.Append(e.GetChars(bytes.GetBuffer(), 0, (int) bytes.Length));\r
-                                       bytes.SetLength (0);\r
-                               }\r
-\r
-                               if (s [i] == '+') {\r
-                                       output.Append (' ');\r
-                               } else {\r
-                                       output.Append (s [i]);\r
-                               }\r
-                       }\r
-\r
-                       if (bytes.Length > 0) {\r
-                               //output.Append (GetChars (bytes, e));\r
-                               output.Append(e.GetChars(bytes.GetBuffer(), 0, (int) bytes.Length));\r
-                       }\r
-\r
-                       bytes = null;\r
-                       return output.ToString ();\r
-               }\r
-    \r
-               /// <summary>\r
                /// 再帰的にファイルの属性を指定します。強制的にフォルダの再帰削除の前に読み込み専用属性を消すのに使います。\r
                /// </summary>\r
                /// <param name="path">設定するフォルダ</param>\r
                /// 再帰的にファイルの属性を指定します。強制的にフォルダの再帰削除の前に読み込み専用属性を消すのに使います。\r
                /// </summary>\r
                /// <param name="path">設定するフォルダ</param>\r
index 09adf4b..6bf4078 100644 (file)
@@ -48,6 +48,7 @@
   <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />\r
   <ItemGroup>\r
     <Reference Include="System" />\r
   <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />\r
   <ItemGroup>\r
     <Reference Include="System" />\r
+    <Reference Include="System.Web" />\r
     <Reference Include="System.Xml" />\r
   </ItemGroup>\r
   <ItemGroup>\r
     <Reference Include="System.Xml" />\r
   </ItemGroup>\r
   <ItemGroup>\r