Fixed warnings
This commit is contained in:
@ -10,7 +10,7 @@
|
|||||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
<RootNamespace>RageCoop.Client</RootNamespace>
|
<RootNamespace>RageCoop.Client</RootNamespace>
|
||||||
<AssemblyName>RageCoop.Client</AssemblyName>
|
<AssemblyName>RageCoop.Client</AssemblyName>
|
||||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
<TargetFrameworkVersion>v4.8.1</TargetFrameworkVersion>
|
||||||
<FileAlignment>512</FileAlignment>
|
<FileAlignment>512</FileAlignment>
|
||||||
<Deterministic>true</Deterministic>
|
<Deterministic>true</Deterministic>
|
||||||
<TargetFrameworkProfile />
|
<TargetFrameworkProfile />
|
||||||
|
@ -11,11 +11,11 @@ namespace RageCoop.Client
|
|||||||
ID=EntityPool.RequestNewID();
|
ID=EntityPool.RequestNewID();
|
||||||
MainProjectile = p;
|
MainProjectile = p;
|
||||||
Origin=p.Position;
|
Origin=p.Position;
|
||||||
var shooter = EntityPool.GetPedByHandle((p.Owner?.Handle).GetValueOrDefault());
|
var shooter = EntityPool.GetPedByHandle((p.OwnerEntity?.Handle).GetValueOrDefault());
|
||||||
if (shooter==null)
|
if (shooter==null)
|
||||||
{
|
{
|
||||||
// Owner will be the vehicle if projectile is shot with a vehicle
|
// Owner will be the vehicle if projectile is shot with a vehicle
|
||||||
var shooterVeh = EntityPool.GetVehicleByHandle((p.Owner?.Handle).GetValueOrDefault());
|
var shooterVeh = EntityPool.GetVehicleByHandle((p.OwnerEntity?.Handle).GetValueOrDefault());
|
||||||
if (shooterVeh!=null && shooterVeh.MainVehicle.Driver!=null)
|
if (shooterVeh!=null && shooterVeh.MainVehicle.Driver!=null)
|
||||||
{
|
{
|
||||||
shooter=shooterVeh.MainVehicle.Driver?.GetSyncEntity();
|
shooter=shooterVeh.MainVehicle.Driver?.GetSyncEntity();
|
||||||
|
@ -4,10 +4,9 @@ using System.Xml;
|
|||||||
using System.Xml.Serialization;
|
using System.Xml.Serialization;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using RageCoop.Core;
|
|
||||||
using Lidgren.Network;
|
using Lidgren.Network;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Net.Sockets;
|
using System.Net.Http;
|
||||||
|
|
||||||
namespace RageCoop.Server
|
namespace RageCoop.Server
|
||||||
{
|
{
|
||||||
@ -22,9 +21,14 @@ namespace RageCoop.Server
|
|||||||
ServicePointManager.Expect100Continue = true;
|
ServicePointManager.Expect100Continue = true;
|
||||||
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls13 | SecurityProtocolType.Tls12;
|
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls13 | SecurityProtocolType.Tls12;
|
||||||
ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };
|
ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };
|
||||||
|
|
||||||
WebClient client = new();
|
HttpClient client = new();
|
||||||
return client.DownloadString(url);
|
HttpRequestMessage request = new(HttpMethod.Get, url);
|
||||||
|
HttpResponseMessage response = client.Send(request);
|
||||||
|
using var reader = new StreamReader(response.Content.ReadAsStream());
|
||||||
|
string responseBody = reader.ReadToEnd();
|
||||||
|
|
||||||
|
return responseBody;
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
@ -113,15 +117,17 @@ namespace RageCoop.Server
|
|||||||
string newUrl = url;
|
string newUrl = url;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
HttpWebRequest req = null;
|
|
||||||
HttpWebResponse resp = null;
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
req = (HttpWebRequest)HttpWebRequest.Create(url);
|
HttpClientHandler handler = new()
|
||||||
req.Method = "HEAD";
|
{
|
||||||
req.AllowAutoRedirect = false;
|
AllowAutoRedirect = false
|
||||||
resp = (HttpWebResponse)req.GetResponse();
|
};
|
||||||
switch (resp.StatusCode)
|
HttpClient client = new(handler);
|
||||||
|
HttpRequestMessage request = new(HttpMethod.Head, url);
|
||||||
|
HttpResponseMessage response = client.Send(request);
|
||||||
|
|
||||||
|
switch (response.StatusCode)
|
||||||
{
|
{
|
||||||
case HttpStatusCode.OK:
|
case HttpStatusCode.OK:
|
||||||
return newUrl;
|
return newUrl;
|
||||||
@ -129,11 +135,13 @@ namespace RageCoop.Server
|
|||||||
case HttpStatusCode.MovedPermanently:
|
case HttpStatusCode.MovedPermanently:
|
||||||
case HttpStatusCode.RedirectKeepVerb:
|
case HttpStatusCode.RedirectKeepVerb:
|
||||||
case HttpStatusCode.RedirectMethod:
|
case HttpStatusCode.RedirectMethod:
|
||||||
newUrl = resp.Headers["Location"];
|
newUrl = response.Headers.Location.ToString();
|
||||||
if (newUrl == null)
|
if (newUrl == null)
|
||||||
return url;
|
return url;
|
||||||
|
|
||||||
if (newUrl.IndexOf("://", System.StringComparison.Ordinal) == -1)
|
string newUrlString = newUrl;
|
||||||
|
|
||||||
|
if (!newUrlString.Contains("://"))
|
||||||
{
|
{
|
||||||
// Doesn't have a URL Schema, meaning it's a relative or absolute URL
|
// Doesn't have a URL Schema, meaning it's a relative or absolute URL
|
||||||
Uri u = new Uri(new Uri(url), newUrl);
|
Uri u = new Uri(new Uri(url), newUrl);
|
||||||
@ -143,6 +151,7 @@ namespace RageCoop.Server
|
|||||||
default:
|
default:
|
||||||
return newUrl;
|
return newUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
url = newUrl;
|
url = newUrl;
|
||||||
}
|
}
|
||||||
catch (WebException)
|
catch (WebException)
|
||||||
@ -154,11 +163,6 @@ namespace RageCoop.Server
|
|||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
finally
|
|
||||||
{
|
|
||||||
if (resp != null)
|
|
||||||
resp.Close();
|
|
||||||
}
|
|
||||||
} while (maxRedirCount-- > 0);
|
} while (maxRedirCount-- > 0);
|
||||||
|
|
||||||
return newUrl;
|
return newUrl;
|
||||||
|
Reference in New Issue
Block a user