Cleanup network module.

This commit is contained in:
2023-07-04 11:12:27 +08:00
parent a4d0e3867a
commit f65e4f1900
12 changed files with 71 additions and 99 deletions

View File

@@ -1,4 +1,4 @@
using Cryville.Common.Network;
using Cryville.Common.Network.Http11;
using System;
using System.Collections.Generic;
using System.Threading;
@@ -123,13 +123,13 @@ namespace Cryville.Crtr {
try {
switch (p[0]) {
case "!http":
var httpcl = new HttpClient(new Uri(p[1]));
var httpcl = new Http11Client(new Uri(p[1]));
httpcl.Connect();
httpcl.Request("GET", new Uri(p[1])).MessageBody.ReadToEnd();
httpcl.Close();
break;
case "!https":
var httpscl = new HttpsClient(new Uri(p[1]));
var httpscl = new Https11Client(new Uri(p[1]));
httpscl.Connect();
httpscl.Request("GET", new Uri(p[1])).MessageBody.ReadToEnd();
httpscl.Close();

View File

@@ -1,4 +1,4 @@
using Cryville.Common.Network;
using Cryville.Common.Network.Http11;
using Cryville.Common.Unity;
using Newtonsoft.Json;
using System;
@@ -21,7 +21,7 @@ namespace Cryville.Crtr.Network {
List<VersionInfo> _versions;
public void CheckVersion() {
try {
var client = new HttpsClient(BaseUri);
var client = new Https11Client(BaseUri);
client.Connect();
var response = client.Request("GET", new Uri(BaseUri, "versions"));
var data = Encoding.UTF8.GetString(response.MessageBody.ReadToEnd());