ソースを参照

分离Web工具

yuzhengyang 8 年 前
コミット
23d4f9c1f9

+ 0 - 0
Fork.Net/.vs/Fork.Net/v15/Server/sqlite3/db.lock


BIN
Fork.Net/.vs/Fork.Net/v15/Server/sqlite3/storage.ide


+ 0 - 0
Fork.Net/.vs/Fork.Net/v15/sqlite3/db.lock


BIN
Fork.Net/.vs/Fork.Net/v15/sqlite3/storage.ide


+ 4 - 11
Fork.Net/Azylee.Utils/Yuzhyn.WebUtils/Yuzhyn.WebUtils.csproj

@@ -1,14 +1,14 @@
 <?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
   <PropertyGroup>
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
     <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
-    <ProjectGuid>{61FD5609-8D6D-434B-9A90-7719D45DF8D2}</ProjectGuid>
+    <ProjectGuid>{CCF7A654-B442-4DB1-BB3B-0F8014C3237F}</ProjectGuid>
     <OutputType>Library</OutputType>
     <AppDesignerFolder>Properties</AppDesignerFolder>
-    <RootNamespace>Yuzhyn.WebUtils</RootNamespace>
-    <AssemblyName>Yuzhyn.WebUtils</AssemblyName>
+    <RootNamespace>Azylee.YeahWeb</RootNamespace>
+    <AssemblyName>Azylee.YeahWeb</AssemblyName>
     <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
     <FileAlignment>512</FileAlignment>
   </PropertyGroup>
@@ -43,11 +43,4 @@
     <Compile Include="Properties\AssemblyInfo.cs" />
   </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
-  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
-       Other similar extension points exist, see Microsoft.Common.targets.
-  <Target Name="BeforeBuild">
-  </Target>
-  <Target Name="AfterBuild">
-  </Target>
-  -->
 </Project>

+ 5 - 53
Fork.Net/Azylee.Utils/Yuzhyn.WebUtils/HttpUtils/HttpTool.cs

@@ -5,17 +5,15 @@ using System.Linq;
 using System.Net;
 using System.Text;
 
-namespace Yuzhyn.WebUtils.HttpUtils
+namespace Azylee.YeahWeb.HttpUtils
 {
     public class HttpTool
     {
         const string DefaultContentType = "application/x-www-form-urlencoded";
         const string DefaultUserAgent = "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET4.0C; .NET4.0E)";
-
-        public static string Get(string url, out CookieCollection outcookie, CookieCollection cookie = null, string contentType = DefaultContentType, bool autoRedirect = false, bool keepAlive = true, string userAgent = DefaultUserAgent)
+        public static string Get(string url, ref CookieCollection cookie, string contentType = DefaultContentType, bool autoRedirect = false, bool keepAlive = true, string userAgent = DefaultUserAgent)
         {
             string html = "";
-            outcookie = null;
             Stream stream = null;
             StreamReader reader = null;
             try
@@ -30,7 +28,7 @@ namespace Yuzhyn.WebUtils.HttpUtils
                 if (cookie != null) request.CookieContainer.Add(cookie);
                 HttpWebResponse response = (HttpWebResponse)request.GetResponse();
                 response.Cookies = request.CookieContainer.GetCookies(request.RequestUri);
-                outcookie = response.Cookies;
+                cookie = response.Cookies;
                 stream = response.GetResponseStream();
                 reader = new StreamReader(stream, Encoding.Default);
                 html = reader.ReadToEnd();
@@ -45,11 +43,9 @@ namespace Yuzhyn.WebUtils.HttpUtils
             }
             return html;
         }
-
-        public static string Post(string url, out CookieCollection outcookie, Dictionary<string, string> data = null, CookieCollection cookie = null, string contentType = DefaultContentType, bool autoRedirect = true, bool keepAlive = true, string userAgent = DefaultUserAgent)
+        public static string Post(string url, ref CookieCollection cookie, Dictionary<string, string> data = null, string contentType = DefaultContentType, bool autoRedirect = true, bool keepAlive = true, string userAgent = DefaultUserAgent)
         {
             string html = "";
-            outcookie = null;
             Stream stream = null, dataStream = null;
             StreamReader reader = null;
             try
@@ -81,51 +77,7 @@ namespace Yuzhyn.WebUtils.HttpUtils
                 //请求数据
                 HttpWebResponse response = (HttpWebResponse)request.GetResponse();
                 response.Cookies = request.CookieContainer.GetCookies(request.RequestUri);
-                outcookie = response.Cookies;
-                stream = response.GetResponseStream();
-                reader = new StreamReader(stream, Encoding.Default);
-                html = reader.ReadToEnd();
-            }
-            catch
-            {
-            }
-            finally
-            {
-                if (reader != null) reader.Close();
-                if (stream != null) stream.Close();
-                if (dataStream != null) dataStream.Close();
-            }
-            return html;
-        }
-        public static string PostJson(string url, out CookieCollection outcookie, string data = null, CookieCollection cookie = null, string contentType = DefaultContentType, bool autoRedirect = true, bool keepAlive = true, string userAgent = DefaultUserAgent)
-        {
-            string html = "";
-            outcookie = null;
-            Stream stream = null, dataStream = null;
-            StreamReader reader = null;
-            try
-            {
-                //配置属性
-                HttpWebRequest request = WebRequest.Create(url) as HttpWebRequest;
-                request.Method = "POST";
-                request.ContentType = DefaultContentType;
-                request.AllowAutoRedirect = autoRedirect;
-                request.KeepAlive = keepAlive;
-                request.UserAgent = DefaultUserAgent;
-                request.CookieContainer = new CookieContainer();
-                if (cookie != null) request.CookieContainer.Add(cookie);
-                //配置参数
-                if (data != null)
-                {
-                    byte[] dataByte = Encoding.UTF8.GetBytes(data);
-                    request.ContentLength = dataByte.Length;
-                    dataStream = request.GetRequestStream();
-                    dataStream.Write(dataByte, 0, dataByte.Length);
-                }
-                //请求数据
-                HttpWebResponse response = (HttpWebResponse)request.GetResponse();
-                response.Cookies = request.CookieContainer.GetCookies(request.RequestUri);
-                outcookie = response.Cookies;
+                cookie = response.Cookies;
                 stream = response.GetResponseStream();
                 reader = new StreamReader(stream, Encoding.Default);
                 html = reader.ReadToEnd();

+ 7 - 7
Fork.Net/Azylee.Utils/Yuzhyn.WebUtils/Properties/AssemblyInfo.cs

@@ -5,22 +5,22 @@ using System.Runtime.InteropServices;
 // 有关程序集的一般信息由以下
 // 控制。更改这些特性值可修改
 // 与程序集关联的信息。
-[assembly: AssemblyTitle("Yuzhyn.WebUtils")]
+[assembly: AssemblyTitle("Azylee.YeahWeb")]
 [assembly: AssemblyDescription("")]
 [assembly: AssemblyConfiguration("")]
 [assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("Yuzhyn.WebUtils")]
+[assembly: AssemblyProduct("Azylee.YeahWeb")]
 [assembly: AssemblyCopyright("Copyright ©  2017")]
 [assembly: AssemblyTrademark("")]
 [assembly: AssemblyCulture("")]
 
-//将 ComVisible 设置为 false 将使此程序集中的类型
-//对 COM 组件不可见。  如果需要从 COM 访问此程序集中的类型
+// 将 ComVisible 设置为 false 会使此程序集中的类型
+//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
 //请将此类型的 ComVisible 特性设置为 true。
 [assembly: ComVisible(false)]
 
 // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
-[assembly: Guid("61fd5609-8d6d-434b-9a90-7719d45df8d2")]
+[assembly: Guid("ccf7a654-b442-4db1-bb3b-0f8014c3237f")]
 
 // 程序集的版本信息由下列四个值组成: 
 //
@@ -29,8 +29,8 @@ using System.Runtime.InteropServices;
 //      生成号
 //      修订号
 //
-//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
-// 方法是按如下所示使用“*”: :
+// 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号
+//通过使用 "*",如下所示:
 // [assembly: AssemblyVersion("1.0.*")]
 [assembly: AssemblyVersion("1.0.0.0")]
 [assembly: AssemblyFileVersion("1.0.0.0")]

+ 12 - 12
Fork.Net/Fork.Net.sln

@@ -1,7 +1,7 @@
 
 Microsoft Visual Studio Solution File, Format Version 12.00
 # Visual Studio 15
-VisualStudioVersion = 15.0.26730.12
+VisualStudioVersion = 15.0.27004.2005
 MinimumVisualStudioVersion = 10.0.40219.1
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Fork.Net", "Fork.Net\Fork.Net.csproj", "{A8EBC472-2AF6-41B1-B1A0-C4D28D165C02}"
 EndProject
@@ -49,8 +49,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Y.Utils", "Fork.Net.Tools\Y
 EndProject
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Azylee.Utils", "Azylee.Utils", "{C34A95B5-5F83-46E3-868A-56BDDA2D0B87}"
 EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Yuzhyn.WebUtils", "Azylee.Utils\Yuzhyn.WebUtils\Yuzhyn.WebUtils.csproj", "{61FD5609-8D6D-434B-9A90-7719D45DF8D2}"
-EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azylee.Core", "Azylee.Utils\Azylee.Core\Azylee.Core.csproj", "{88DC61FA-95F0-41B7-9D7D-AB0F3CBD169C}"
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azylee.ExeLaunch", "Azylee.Utils\Azylee.ExeLaunch\Azylee.ExeLaunch.csproj", "{1AB11F85-BA96-4F82-8122-BB89E63FCCB1}"
@@ -63,6 +61,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Version.Update", "Fork.Net.
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Oreo.FilePackage", "Oreo.Plugins\Oreo.FilePackage\Oreo.FilePackage.csproj", "{1500F997-4261-4999-A6F1-0EBB34E9854F}"
 EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azylee.YeahWeb", "Azylee.Utils\Azylee.YeahWeb\Azylee.YeahWeb.csproj", "{CCF7A654-B442-4DB1-BB3B-0F8014C3237F}"
+EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Any CPU = Debug|Any CPU
@@ -215,14 +215,6 @@ Global
 		{5B8EEEC7-AEB5-407D-9DC1-1C59E53F78D5}.Release|Any CPU.Build.0 = Release|Any CPU
 		{5B8EEEC7-AEB5-407D-9DC1-1C59E53F78D5}.Release|x86.ActiveCfg = Release|Any CPU
 		{5B8EEEC7-AEB5-407D-9DC1-1C59E53F78D5}.Release|x86.Build.0 = Release|Any CPU
-		{61FD5609-8D6D-434B-9A90-7719D45DF8D2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{61FD5609-8D6D-434B-9A90-7719D45DF8D2}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{61FD5609-8D6D-434B-9A90-7719D45DF8D2}.Debug|x86.ActiveCfg = Debug|Any CPU
-		{61FD5609-8D6D-434B-9A90-7719D45DF8D2}.Debug|x86.Build.0 = Debug|Any CPU
-		{61FD5609-8D6D-434B-9A90-7719D45DF8D2}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{61FD5609-8D6D-434B-9A90-7719D45DF8D2}.Release|Any CPU.Build.0 = Release|Any CPU
-		{61FD5609-8D6D-434B-9A90-7719D45DF8D2}.Release|x86.ActiveCfg = Release|Any CPU
-		{61FD5609-8D6D-434B-9A90-7719D45DF8D2}.Release|x86.Build.0 = Release|Any CPU
 		{88DC61FA-95F0-41B7-9D7D-AB0F3CBD169C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
 		{88DC61FA-95F0-41B7-9D7D-AB0F3CBD169C}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{88DC61FA-95F0-41B7-9D7D-AB0F3CBD169C}.Debug|x86.ActiveCfg = Debug|Any CPU
@@ -271,6 +263,14 @@ Global
 		{1500F997-4261-4999-A6F1-0EBB34E9854F}.Release|Any CPU.Build.0 = Release|Any CPU
 		{1500F997-4261-4999-A6F1-0EBB34E9854F}.Release|x86.ActiveCfg = Release|Any CPU
 		{1500F997-4261-4999-A6F1-0EBB34E9854F}.Release|x86.Build.0 = Release|Any CPU
+		{CCF7A654-B442-4DB1-BB3B-0F8014C3237F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{CCF7A654-B442-4DB1-BB3B-0F8014C3237F}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{CCF7A654-B442-4DB1-BB3B-0F8014C3237F}.Debug|x86.ActiveCfg = Debug|Any CPU
+		{CCF7A654-B442-4DB1-BB3B-0F8014C3237F}.Debug|x86.Build.0 = Debug|Any CPU
+		{CCF7A654-B442-4DB1-BB3B-0F8014C3237F}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{CCF7A654-B442-4DB1-BB3B-0F8014C3237F}.Release|Any CPU.Build.0 = Release|Any CPU
+		{CCF7A654-B442-4DB1-BB3B-0F8014C3237F}.Release|x86.ActiveCfg = Release|Any CPU
+		{CCF7A654-B442-4DB1-BB3B-0F8014C3237F}.Release|x86.Build.0 = Release|Any CPU
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE
@@ -293,13 +293,13 @@ Global
 		{3ECA2CC6-55C2-433F-A617-A7376E455F7C} = {F222E566-DA0C-443C-BB9F-80536F02DB36}
 		{E9A97673-3E27-4A49-90BC-8806411A2F57} = {F222E566-DA0C-443C-BB9F-80536F02DB36}
 		{5B8EEEC7-AEB5-407D-9DC1-1C59E53F78D5} = {F222E566-DA0C-443C-BB9F-80536F02DB36}
-		{61FD5609-8D6D-434B-9A90-7719D45DF8D2} = {C34A95B5-5F83-46E3-868A-56BDDA2D0B87}
 		{88DC61FA-95F0-41B7-9D7D-AB0F3CBD169C} = {C34A95B5-5F83-46E3-868A-56BDDA2D0B87}
 		{1AB11F85-BA96-4F82-8122-BB89E63FCCB1} = {C34A95B5-5F83-46E3-868A-56BDDA2D0B87}
 		{3C32DCA5-4E44-4701-A0C5-FA19272C128B} = {A89FC45A-A907-4487-8719-114530A62684}
 		{10F1E19E-AEBA-4835-9A58-F02BEC46FF4B} = {F222E566-DA0C-443C-BB9F-80536F02DB36}
 		{0DFAC9FC-9D48-4DCF-AE72-8FB1CA70A06E} = {F222E566-DA0C-443C-BB9F-80536F02DB36}
 		{1500F997-4261-4999-A6F1-0EBB34E9854F} = {E53B3662-A5FD-4D4C-AFF6-1DC9FF24EA16}
+		{CCF7A654-B442-4DB1-BB3B-0F8014C3237F} = {C34A95B5-5F83-46E3-868A-56BDDA2D0B87}
 	EndGlobalSection
 	GlobalSection(ExtensibilityGlobals) = postSolution
 		SolutionGuid = {5436696D-5F55-490A-AB40-050B54BE2AB4}