首次提交
This commit is contained in:
46
SCADA/WebApi/ApiTools.cs
Normal file
46
SCADA/WebApi/ApiTools.cs
Normal file
@@ -0,0 +1,46 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web.Http;
|
||||
using System.Net.Http;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace WebApi
|
||||
{
|
||||
public enum ResponseCode
|
||||
{
|
||||
Fail = 00000,
|
||||
Success = 00200,
|
||||
}
|
||||
|
||||
public class ApiTools
|
||||
{
|
||||
private string msgModel = "{{\"code\":{0},\"message\":\"{1}\",\"result\":{2}}}";
|
||||
public ApiTools()
|
||||
{
|
||||
}
|
||||
public HttpResponseMessage MsgFormat(ResponseCode code, string explanation, string result)
|
||||
{
|
||||
string r = @"^(\-|\+)?\d+(\.\d+)?$";
|
||||
string json = string.Empty;
|
||||
if (Regex.IsMatch(result, r) || result.ToLower() == "true" || result.ToLower() == "false" || result == "[]" || result.Contains('{'))
|
||||
{
|
||||
json = string.Format(msgModel, (int)code, explanation, result);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (result.Contains('"'))
|
||||
{
|
||||
json = string.Format(msgModel, (int)code, explanation, result);
|
||||
}
|
||||
else
|
||||
{
|
||||
json = string.Format(msgModel, (int)code, explanation, "\"" + result + "\"");
|
||||
}
|
||||
}
|
||||
return new HttpResponseMessage { Content = new StringContent(json, System.Text.Encoding.UTF8, "application/json") };
|
||||
}
|
||||
}
|
||||
}
|
||||
148
SCADA/WebApi/CallWebApi.cs
Normal file
148
SCADA/WebApi/CallWebApi.cs
Normal file
@@ -0,0 +1,148 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SlMesDbIterface
|
||||
{
|
||||
public partial class MyHttpRequest {
|
||||
|
||||
public static string MyPost(string url,string jsonStr)
|
||||
{
|
||||
string result = "";
|
||||
|
||||
try
|
||||
{
|
||||
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
|
||||
req.Method = "POST";
|
||||
req.ContentType = "text/html, application/xhtml+xml, application/json, */*";
|
||||
req.Proxy = null;
|
||||
req.KeepAlive = false;
|
||||
|
||||
byte[] data = Encoding.UTF8.GetBytes(jsonStr);
|
||||
req.ContentLength = data.Length;
|
||||
using (Stream reqStream = req.GetRequestStream())
|
||||
{
|
||||
reqStream.Write(data, 0, data.Length);
|
||||
reqStream.Close();
|
||||
}
|
||||
|
||||
HttpWebResponse resp = (HttpWebResponse)req.GetResponse();
|
||||
Stream stream = resp.GetResponseStream();
|
||||
|
||||
|
||||
//获取响应内容
|
||||
using (StreamReader reader = new StreamReader(stream, Encoding.UTF8))
|
||||
{
|
||||
result = reader.ReadToEnd();
|
||||
}
|
||||
Console.WriteLine(result);
|
||||
|
||||
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
Console.WriteLine("<Error> " + err.Message);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public static string MyPost(string url,Dictionary<string,string> paramDict, string jsonStr)
|
||||
{
|
||||
string result = "";
|
||||
|
||||
try
|
||||
{
|
||||
StringBuilder builder = new StringBuilder();
|
||||
|
||||
builder.Append(url);
|
||||
if (paramDict.Count > 0)
|
||||
{
|
||||
builder.Append("?");
|
||||
int i = 0;
|
||||
foreach (var item in paramDict)
|
||||
{
|
||||
if (i > 0)
|
||||
builder.Append("&");
|
||||
builder.AppendFormat("{0}={1}", item.Key, item.Value);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(builder.ToString());
|
||||
req.Method = "POST";
|
||||
req.ContentType = "text/html, application/xhtml+xml, application/json, */*";
|
||||
req.Proxy = null;
|
||||
req.KeepAlive = false;
|
||||
|
||||
byte[] data = Encoding.UTF8.GetBytes(jsonStr);
|
||||
req.ContentLength = data.Length;
|
||||
using (Stream reqStream = req.GetRequestStream())
|
||||
{
|
||||
reqStream.Write(data, 0, data.Length);
|
||||
reqStream.Close();
|
||||
}
|
||||
|
||||
HttpWebResponse resp = (HttpWebResponse)req.GetResponse();
|
||||
Stream stream = resp.GetResponseStream();
|
||||
|
||||
|
||||
//获取响应内容
|
||||
using (StreamReader reader = new StreamReader(stream, Encoding.UTF8))
|
||||
{
|
||||
result = reader.ReadToEnd();
|
||||
}
|
||||
Console.WriteLine(result);
|
||||
|
||||
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
Console.WriteLine("<Error> " + err.Message);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public static string MyGet(string url, Dictionary<string,string> paramDict)
|
||||
{
|
||||
string result = "";
|
||||
|
||||
StringBuilder builder = new StringBuilder();
|
||||
|
||||
builder.Append(url);
|
||||
if (paramDict.Count > 0)
|
||||
{
|
||||
builder.Append("?");
|
||||
int i = 0;
|
||||
foreach (var item in paramDict)
|
||||
{
|
||||
if (i > 0)
|
||||
builder.Append("&");
|
||||
builder.AppendFormat("{0}={1}", item.Key, item.Value);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(builder.ToString());
|
||||
req.Method = "GET";
|
||||
req.ContentType = "text/html, application/xhtml+xml, application/json, */*";
|
||||
req.Proxy = null;
|
||||
req.KeepAlive = false;
|
||||
|
||||
HttpWebResponse response = (HttpWebResponse)req.GetResponse();
|
||||
Stream rs = response.GetResponseStream();
|
||||
StreamReader sr = new StreamReader(rs, Encoding.UTF8);
|
||||
result = sr.ReadToEnd();
|
||||
sr.Close();
|
||||
rs.Close();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
362
SCADA/WebApi/HttpCli.cs
Normal file
362
SCADA/WebApi/HttpCli.cs
Normal file
@@ -0,0 +1,362 @@
|
||||
using MesWork;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace PLMTEST
|
||||
{
|
||||
public class HttpCli
|
||||
{
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 指定Url地址使用Get 方式获取全部字符串
|
||||
/// </summary>
|
||||
/// <param name="url">请求链接地址</param>
|
||||
/// <returns></returns>
|
||||
public static string Get(string url)
|
||||
{
|
||||
string result = "";
|
||||
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
|
||||
HttpWebResponse resp = (HttpWebResponse)req.GetResponse();
|
||||
Stream stream = resp.GetResponseStream();
|
||||
try
|
||||
{
|
||||
//获取内容
|
||||
using (StreamReader reader = new StreamReader(stream))
|
||||
{
|
||||
result = reader.ReadToEnd();
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
stream.Close();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static void GetFile(string url,string path)
|
||||
{
|
||||
WebRequest request = WebRequest.Create(url);
|
||||
WebResponse response = request.GetResponse();
|
||||
if (response.ContentType.ToLower().Length > 0)
|
||||
{
|
||||
using (Stream reader = response.GetResponseStream())
|
||||
{
|
||||
using (FileStream writer = new FileStream(path, FileMode.OpenOrCreate, FileAccess.Write))
|
||||
{
|
||||
byte[] buffer = new byte[1024];
|
||||
int c = 0;
|
||||
while ((c = reader.Read(buffer, 0, buffer.Length)) > 0)
|
||||
{
|
||||
writer.Write(buffer, 0, c);
|
||||
}
|
||||
}
|
||||
}
|
||||
//HttpContext
|
||||
}
|
||||
}
|
||||
|
||||
public static byte[] GetFile_Bytes(string url)
|
||||
{
|
||||
byte[] bytesAll = null;
|
||||
WebRequest request = WebRequest.Create(url);
|
||||
WebResponse response = request.GetResponse();
|
||||
if (response.ContentType.ToLower().Length > 0)
|
||||
{
|
||||
using (Stream reader = response.GetResponseStream())
|
||||
{
|
||||
MemoryStream ms = new MemoryStream();
|
||||
byte[] buffer = new byte[1024];
|
||||
while (true)
|
||||
{
|
||||
int sz = reader.Read(buffer, 0, 1024);
|
||||
if (sz == 0) break;
|
||||
ms.Write(buffer, 0, sz);
|
||||
}
|
||||
bytesAll = ms.ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
//如是图片
|
||||
//System.Drawing.Image img = System.Drawing.Image.FromStream(ms);
|
||||
|
||||
return bytesAll;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 发送Get请求
|
||||
/// </summary>
|
||||
/// <param name="url">地址</param>
|
||||
/// <param name="dic">请求参数定义</param>
|
||||
/// <returns></returns>
|
||||
public static string Get(string url, Dictionary<string, string> dic)
|
||||
{
|
||||
string result = "";
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.Append(url);
|
||||
if (dic.Count > 0)
|
||||
{
|
||||
builder.Append("?");
|
||||
int i = 0;
|
||||
foreach (var item in dic)
|
||||
{
|
||||
if (i > 0)
|
||||
builder.Append("&");
|
||||
builder.AppendFormat("{0}={1}", item.Key, item.Value);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(builder.ToString());
|
||||
//添加参数
|
||||
HttpWebResponse resp = (HttpWebResponse)req.GetResponse();
|
||||
Stream stream = resp.GetResponseStream();
|
||||
try
|
||||
{
|
||||
//获取内容
|
||||
using (StreamReader reader = new StreamReader(stream))
|
||||
{
|
||||
result = reader.ReadToEnd();
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
stream.Close();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 指定Post地址使用Get 方式获取全部字符串
|
||||
/// </summary>
|
||||
/// <param name="url">请求后台地址</param>
|
||||
/// <returns></returns>
|
||||
public static string Post(string url)
|
||||
{
|
||||
string result = "";
|
||||
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
|
||||
req.Method = "POST";
|
||||
HttpWebResponse resp = (HttpWebResponse)req.GetResponse();
|
||||
Stream stream = resp.GetResponseStream();
|
||||
//获取内容
|
||||
using (StreamReader reader = new StreamReader(stream, Encoding.UTF8))
|
||||
{
|
||||
result = reader.ReadToEnd();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 指定Post地址使用Get 方式获取全部字符串
|
||||
/// </summary>
|
||||
/// <param name="url">请求后台地址</param>
|
||||
/// <returns></returns>
|
||||
public static string Post(string url, Dictionary<string, string> dic)
|
||||
{
|
||||
string result = "";
|
||||
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
|
||||
req.Method = "POST";
|
||||
req.ContentType = "application/x-www-form-urlencoded";
|
||||
#region 添加Post 参数
|
||||
StringBuilder builder = new StringBuilder();
|
||||
int i = 0;
|
||||
foreach (var item in dic)
|
||||
{
|
||||
if (i > 0)
|
||||
builder.Append("&");
|
||||
builder.AppendFormat("{0}={1}", item.Key, item.Value);
|
||||
i++;
|
||||
}
|
||||
byte[] data = Encoding.UTF8.GetBytes(builder.ToString());
|
||||
req.ContentLength = data.Length;
|
||||
using (Stream reqStream = req.GetRequestStream())
|
||||
{
|
||||
reqStream.Write(data, 0, data.Length);
|
||||
reqStream.Close();
|
||||
}
|
||||
#endregion
|
||||
HttpWebResponse resp = (HttpWebResponse)req.GetResponse();
|
||||
Stream stream = resp.GetResponseStream();
|
||||
//获取响应内容
|
||||
using (StreamReader reader = new StreamReader(stream, Encoding.UTF8))
|
||||
{
|
||||
result = reader.ReadToEnd();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 指定Post地址使用Get 方式获取全部字符串
|
||||
/// </summary>
|
||||
/// <param name="url">请求后台地址</param>
|
||||
/// <param name="content">Post提交数据内容(utf-8编码的)</param>
|
||||
/// <returns></returns>
|
||||
public static string Post_Authorization(string url, string content,out string error )
|
||||
{
|
||||
string result = "";
|
||||
error = "";
|
||||
try
|
||||
{
|
||||
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
|
||||
req.Timeout = 30000;
|
||||
req.Method = "POST";
|
||||
req.ContentType = "application/json";
|
||||
|
||||
// 添加自定义 Header
|
||||
req.Headers.Add("Authorization", MesWorkForm.AuthorizationSet);
|
||||
req.Headers.Add("uuid", Guid.NewGuid().ToString().ToUpper());
|
||||
|
||||
#region 添加Post 参数
|
||||
byte[] data = Encoding.UTF8.GetBytes(content);
|
||||
req.ContentLength = data.Length;
|
||||
using (Stream reqStream = req.GetRequestStream())
|
||||
{
|
||||
reqStream.Write(data, 0, data.Length);
|
||||
reqStream.Close();
|
||||
}
|
||||
#endregion
|
||||
|
||||
HttpWebResponse resp = (HttpWebResponse)req.GetResponse();
|
||||
Stream stream = resp.GetResponseStream();
|
||||
//获取响应内容
|
||||
using (StreamReader reader = new StreamReader(stream, Encoding.UTF8))
|
||||
{
|
||||
result = reader.ReadToEnd();
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
error = $"WebApi Post请求调用错误:{err.Message}";
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
public static string Post(string url, string content, out string error)
|
||||
{
|
||||
string result = "";
|
||||
error = "";
|
||||
try
|
||||
{
|
||||
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
|
||||
req.Timeout = 30000;
|
||||
req.Method = "POST";
|
||||
req.ContentType = "application/json";
|
||||
|
||||
#region 添加Post 参数
|
||||
byte[] data = Encoding.UTF8.GetBytes(content);
|
||||
req.ContentLength = data.Length;
|
||||
using (Stream reqStream = req.GetRequestStream())
|
||||
{
|
||||
reqStream.Write(data, 0, data.Length);
|
||||
reqStream.Close();
|
||||
}
|
||||
#endregion
|
||||
|
||||
HttpWebResponse resp = (HttpWebResponse)req.GetResponse();
|
||||
Stream stream = resp.GetResponseStream();
|
||||
//获取响应内容
|
||||
using (StreamReader reader = new StreamReader(stream, Encoding.UTF8))
|
||||
{
|
||||
result = reader.ReadToEnd();
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
error = $"WebApi Post请求调用错误:{err.Message}";
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Http下载文件
|
||||
/// </summary>
|
||||
/// <param name="uri">下载地址</param>
|
||||
/// <param name="filefullpath">存放完整路径(含文件名)</param>
|
||||
/// <param name="size">每次多的大小</param>
|
||||
/// <returns>下载操作是否成功</returns>
|
||||
|
||||
public static bool DownLoadFiles(string uri, string filefullpath, int size = 1000000)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (File.Exists(filefullpath))
|
||||
{
|
||||
try
|
||||
{
|
||||
File.Delete(filefullpath);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
string fileDirectory = System.IO.Path.GetDirectoryName(filefullpath);
|
||||
|
||||
if (!Directory.Exists(fileDirectory))
|
||||
{
|
||||
Directory.CreateDirectory(fileDirectory);
|
||||
}
|
||||
|
||||
FileStream fs = new FileStream(filefullpath, FileMode.Create);
|
||||
|
||||
byte[] buffer = new byte[size];
|
||||
|
||||
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(uri);
|
||||
|
||||
request.Timeout = 100000;
|
||||
|
||||
request.AddRange((int)fs.Length);
|
||||
|
||||
Stream ns = request.GetResponse().GetResponseStream();
|
||||
|
||||
long contentLength = request.GetResponse().ContentLength;
|
||||
|
||||
int length = ns.Read(buffer, 0, buffer.Length);
|
||||
|
||||
while (length > 0)
|
||||
{
|
||||
fs.Write(buffer,0 , length);
|
||||
buffer = new byte[size];
|
||||
length = ns.Read(buffer, 0, buffer.Length);
|
||||
}
|
||||
|
||||
fs.Close();
|
||||
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
147
SCADA/WebApi/InitServer.cs
Normal file
147
SCADA/WebApi/InitServer.cs
Normal file
@@ -0,0 +1,147 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Formatting;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Text;
|
||||
using System.Web.Http;
|
||||
using System.Web.Http.Cors;
|
||||
using System.Web.Http.SelfHost;
|
||||
|
||||
namespace WebApi
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class InitServer
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
HttpSelfHostConfiguration config = null;
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
HttpSelfHostServer server = null;
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="port"></param>
|
||||
public InitServer(int port)
|
||||
{
|
||||
config = new HttpSelfHostConfiguration($"http://localhost:{port}");
|
||||
|
||||
config.EnableCors(new EnableCorsAttribute("*", "*", "*"));
|
||||
|
||||
config.MapHttpAttributeRoutes();
|
||||
|
||||
//config.Routes.MapHttpRoute(
|
||||
// name: "DefaultApi",
|
||||
// routeTemplate: "api/{controller}/{id}",
|
||||
// defaults: new { id = RouteParameter.Optional }
|
||||
//);
|
||||
|
||||
// 自定义路由匹配到action
|
||||
config.Routes.MapHttpRoute(
|
||||
name: "API Default",
|
||||
routeTemplate: "api/{controller}/{action}/{id}",
|
||||
defaults: new { id = RouteParameter.Optional }
|
||||
);
|
||||
|
||||
server = new HttpSelfHostServer(config);
|
||||
|
||||
server.OpenAsync().Wait();
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="port"></param>
|
||||
|
||||
public void Close()
|
||||
{
|
||||
server.CloseAsync();
|
||||
}
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class JsonContentNegotiator : IContentNegotiator
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
private readonly JsonMediaTypeFormatter _jsonFormatter;
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="formatter"></param>
|
||||
public JsonContentNegotiator(JsonMediaTypeFormatter formatter)
|
||||
{
|
||||
_jsonFormatter = formatter;
|
||||
}
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="type"></param>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="formatters"></param>
|
||||
/// <returns></returns>
|
||||
public ContentNegotiationResult Negotiate(Type type, HttpRequestMessage request, IEnumerable<MediaTypeFormatter> formatters)
|
||||
{
|
||||
var result = new ContentNegotiationResult(_jsonFormatter, new MediaTypeHeaderValue("application/json"));
|
||||
return result;
|
||||
}
|
||||
|
||||
public static string Postring1(string url, string token, Dictionary<string, string> dic)
|
||||
{
|
||||
string results = "";
|
||||
//url = "http://172.16.22.15:8000/" + url;
|
||||
|
||||
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
|
||||
req.Method = "POST";
|
||||
req.ContentType = "application/x-www-form-urlencoded";
|
||||
req.Headers.Add("Authorization", "Bearer " + token);
|
||||
|
||||
StringBuilder builder = new StringBuilder();
|
||||
int i = 0;
|
||||
foreach (var item in dic)
|
||||
{
|
||||
if (i > 0)
|
||||
builder.Append("&");
|
||||
builder.AppendFormat("{0}={1}", item.Key, item.Value);
|
||||
i++;
|
||||
}
|
||||
byte[] data = Encoding.UTF8.GetBytes(builder.ToString());
|
||||
req.ContentLength = data.Length;
|
||||
try
|
||||
{
|
||||
using (Stream reqStream = req.GetRequestStream())
|
||||
{
|
||||
reqStream.Write(data, 0, data.Length);
|
||||
reqStream.Close();
|
||||
}
|
||||
HttpWebResponse resp = (HttpWebResponse)req.GetResponse();
|
||||
Stream stream = resp.GetResponseStream();
|
||||
//获取响应内容
|
||||
using (StreamReader reader = new StreamReader(stream, Encoding.UTF8))
|
||||
{
|
||||
results = reader.ReadToEnd();
|
||||
}
|
||||
return results;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine(e.Message);
|
||||
return e.Message;
|
||||
throw;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user