Updates to .NET Core 3.1 & Cleanup (#79)
This commit is contained in:
parent
57b14ad690
commit
de74218b89
14 changed files with 100 additions and 188 deletions
|
|
@ -171,7 +171,7 @@ namespace Server.Misc
|
|||
op.WriteLine("Server Crash Report");
|
||||
op.WriteLine("===================");
|
||||
op.WriteLine();
|
||||
op.WriteLine("RunUO Version {0}.{1}, Build {2}.{3}", ver.Major, ver.Minor, ver.Build, ver.Revision);
|
||||
op.WriteLine("ModernUO Version {0}.{1}, Build {2}.{3}", ver.Major, ver.Minor, ver.Build, ver.Revision);
|
||||
op.WriteLine("Operating System: {0}", Environment.OSVersion);
|
||||
op.WriteLine(".NET Framework: {0}", Environment.Version);
|
||||
op.WriteLine("Time: {0}", DateTime.UtcNow);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.NetworkInformation;
|
||||
using System.Net.Sockets;
|
||||
|
|
@ -39,9 +40,9 @@ namespace Server.Misc
|
|||
*/
|
||||
|
||||
public static readonly string Address = null;
|
||||
public static readonly string ServerName = "RunUO TC";
|
||||
public const string ServerName = "ModernUO TC";
|
||||
|
||||
public static readonly bool AutoDetect = true;
|
||||
public const bool AutoDetect = true;
|
||||
|
||||
private static IPAddress m_PublicAddress;
|
||||
|
||||
|
|
@ -120,65 +121,23 @@ namespace Server.Misc
|
|||
}
|
||||
}
|
||||
|
||||
private static bool HasPublicIPAddress()
|
||||
{
|
||||
NetworkInterface[] adapters = NetworkInterface.GetAllNetworkInterfaces();
|
||||
private static bool HasPublicIPAddress() =>
|
||||
NetworkInterface.GetAllNetworkInterfaces().Select(adapter => adapter.GetIPProperties())
|
||||
.Any(properties => properties.UnicastAddresses.Select(unicast => unicast.Address)
|
||||
.Any(ip => !IPAddress.IsLoopback(ip) && ip.AddressFamily != AddressFamily.InterNetworkV6 && !IsPrivateNetwork(ip)));
|
||||
|
||||
foreach (NetworkInterface adapter in adapters)
|
||||
{
|
||||
IPInterfaceProperties properties = adapter.GetIPProperties();
|
||||
|
||||
foreach (IPAddressInformation unicast in properties.UnicastAddresses)
|
||||
{
|
||||
IPAddress ip = unicast.Address;
|
||||
|
||||
if (!IPAddress.IsLoopback(ip) && ip.AddressFamily != AddressFamily.InterNetworkV6 &&
|
||||
!IsPrivateNetwork(ip))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
|
||||
/*
|
||||
IPHostEntry iphe = Dns.GetHostEntry( Dns.GetHostName() );
|
||||
|
||||
IPAddress[] ips = iphe.AddressList;
|
||||
|
||||
for ( int i = 0; i < ips.Length; ++i )
|
||||
{
|
||||
if ( ips[i].AddressFamily != AddressFamily.InterNetworkV6 && !IsPrivateNetwork( ips[i] ) )
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
*/
|
||||
}
|
||||
|
||||
private static bool IsPrivateNetwork(IPAddress ip)
|
||||
{
|
||||
// 10.0.0.0/8
|
||||
// 172.16.0.0/12
|
||||
// 192.168.0.0/16
|
||||
// 169.254.0.0/16
|
||||
// 100.64.0.0/10 RFC 6598
|
||||
|
||||
if (ip.AddressFamily == AddressFamily.InterNetworkV6)
|
||||
return false;
|
||||
|
||||
if (Utility.IPMatch("192.168.*", ip))
|
||||
return true;
|
||||
if (Utility.IPMatch("10.*", ip))
|
||||
return true;
|
||||
if (Utility.IPMatch("172.16-31.*", ip))
|
||||
return true;
|
||||
if (Utility.IPMatch("169.254.*", ip))
|
||||
return true;
|
||||
if (Utility.IPMatch("100.64-127.*", ip))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
// 10.0.0.0/8
|
||||
// 172.16.0.0/12
|
||||
// 192.168.0.0/16
|
||||
// 169.254.0.0/16
|
||||
// 100.64.0.0/10 RFC 6598
|
||||
private static bool IsPrivateNetwork(IPAddress ip) =>
|
||||
ip.AddressFamily != AddressFamily.InterNetworkV6 &&
|
||||
(Utility.IPMatch("192.168.*", ip) ||
|
||||
Utility.IPMatch("10.*", ip) ||
|
||||
Utility.IPMatch("172.16-31.*", ip) ||
|
||||
Utility.IPMatch("169.254.*", ip) ||
|
||||
Utility.IPMatch("100.64-127.*", ip));
|
||||
|
||||
private static IPAddress FindPublicAddress()
|
||||
{
|
||||
|
|
@ -194,7 +153,7 @@ namespace Server.Misc
|
|||
|
||||
StreamReader sr = new StreamReader(s);
|
||||
|
||||
IPAddress ip = IPAddress.Parse(sr.ReadLine());
|
||||
IPAddress ip = IPAddress.Parse(sr.ReadLine() ?? "");
|
||||
|
||||
sr.Close();
|
||||
s.Close();
|
||||
|
|
|
|||
|
|
@ -2,30 +2,28 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="Current">
|
||||
<PropertyGroup>
|
||||
<RootNamespace>Server</RootNamespace>
|
||||
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<AssemblyName>Scripts.CS</AssemblyName>
|
||||
<Authors>Kamron Batman</Authors>
|
||||
<Company>ModernUO</Company>
|
||||
<Product>ModernUO Scripts</Product>
|
||||
<Copyright>2019-2020</Copyright>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<UseNETCoreGenerator>true</UseNETCoreGenerator>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<Optimize>true</Optimize>
|
||||
<WarningsAsErrors />
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<OutDir>..\..\Distribution\Assemblies</OutDir>
|
||||
<OutputPath>..\..\Distribution\Assemblies</OutputPath>
|
||||
<PublishDir>..\..\Distribution\Assemblies</PublishDir>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
||||
<Optimize>true</Optimize>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
<DefineConstants>TRACE;DEBUG</DefineConstants>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<Optimize>false</Optimize>
|
||||
<OutDir>..\..\Distribution\Assemblies</OutDir>
|
||||
<OutputPath>..\..\Distribution\Assemblies</OutputPath>
|
||||
<PublishDir>..\..\Distribution\Assemblies</PublishDir>
|
||||
<WarningsAsErrors />
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="SpecialSystems\README.TXT" />
|
||||
|
|
@ -37,6 +35,6 @@
|
|||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="MailKit" Version="2.4.1" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Connections.Abstractions" Version="3.1.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Connections.Abstractions" Version="3.1.1" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
|
|
|||
|
|
@ -161,7 +161,7 @@ namespace Server.Misc
|
|||
AddBackground(0, 0, 160, 120, 5054);
|
||||
|
||||
AddButton(10, 10, 0xFB7, 0xFB9, 1);
|
||||
AddLabel(45, 10, 0x34, "RunUO");
|
||||
AddLabel(45, 10, 0x34, "ModernUO");
|
||||
|
||||
AddButton(10, 35, 0xFB7, 0xFB9, 2);
|
||||
AddLabel(45, 35, 0x34, "List of skills");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue