actually fix the encoding issue
This commit is contained in:
parent
6d2e6aee4f
commit
5e04274da6
@ -6,7 +6,7 @@
|
|||||||
<RuntimeFrameworkVersion>2.1.5</RuntimeFrameworkVersion>
|
<RuntimeFrameworkVersion>2.1.5</RuntimeFrameworkVersion>
|
||||||
<MvcRazorExcludeRefAssembliesFromPublish>false</MvcRazorExcludeRefAssembliesFromPublish>
|
<MvcRazorExcludeRefAssembliesFromPublish>false</MvcRazorExcludeRefAssembliesFromPublish>
|
||||||
<PackageId>RaidMax.IW4MAdmin.Application</PackageId>
|
<PackageId>RaidMax.IW4MAdmin.Application</PackageId>
|
||||||
<Version>2.2.4.8</Version>
|
<Version>2.2.4.9</Version>
|
||||||
<Authors>RaidMax</Authors>
|
<Authors>RaidMax</Authors>
|
||||||
<Company>Forever None</Company>
|
<Company>Forever None</Company>
|
||||||
<Product>IW4MAdmin</Product>
|
<Product>IW4MAdmin</Product>
|
||||||
@ -31,8 +31,8 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<ServerGarbageCollection>true</ServerGarbageCollection>
|
<ServerGarbageCollection>true</ServerGarbageCollection>
|
||||||
<TieredCompilation>true</TieredCompilation>
|
<TieredCompilation>true</TieredCompilation>
|
||||||
<AssemblyVersion>2.2.4.8</AssemblyVersion>
|
<AssemblyVersion>2.2.4.9</AssemblyVersion>
|
||||||
<FileVersion>2.2.4.8</FileVersion>
|
<FileVersion>2.2.4.9</FileVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -32,10 +32,12 @@ namespace SharedLibraryCore.RCon
|
|||||||
|
|
||||||
private readonly ILogger Log;
|
private readonly ILogger Log;
|
||||||
private IRConParserConfiguration Config;
|
private IRConParserConfiguration Config;
|
||||||
|
private readonly Encoding defaultEncoding;
|
||||||
|
|
||||||
public Connection(string ipAddress, int port, string password, ILogger log, IRConParserConfiguration config)
|
public Connection(string ipAddress, int port, string password, ILogger log, IRConParserConfiguration config)
|
||||||
{
|
{
|
||||||
Endpoint = new IPEndPoint(IPAddress.Parse(ipAddress), port);
|
Endpoint = new IPEndPoint(IPAddress.Parse(ipAddress), port);
|
||||||
|
defaultEncoding = Encoding.GetEncoding("windows-1252");
|
||||||
RConPassword = password;
|
RConPassword = password;
|
||||||
Log = log;
|
Log = log;
|
||||||
Config = config;
|
Config = config;
|
||||||
@ -81,7 +83,7 @@ namespace SharedLibraryCore.RCon
|
|||||||
string convertEncoding(string text)
|
string convertEncoding(string text)
|
||||||
{
|
{
|
||||||
byte[] convertedBytes = Utilities.EncodingType.GetBytes(text);
|
byte[] convertedBytes = Utilities.EncodingType.GetBytes(text);
|
||||||
return Utilities.EncodingType.GetString(convertedBytes);
|
return defaultEncoding.GetString(convertedBytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
string convertedRConPassword = convertEncoding(RConPassword);
|
string convertedRConPassword = convertEncoding(RConPassword);
|
||||||
|
@ -266,14 +266,19 @@ namespace SharedLibraryCore
|
|||||||
public static long ConvertLong(this string str)
|
public static long ConvertLong(this string str)
|
||||||
{
|
{
|
||||||
str = str.Substring(0, Math.Min(str.Length, 16));
|
str = str.Substring(0, Math.Min(str.Length, 16));
|
||||||
if (long.TryParse(str, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out long id))
|
long id;
|
||||||
|
|
||||||
|
if (str.Length <= 10)
|
||||||
{
|
{
|
||||||
return id;
|
if (long.TryParse(str, NumberStyles.Integer, CultureInfo.InvariantCulture, out id))
|
||||||
|
{
|
||||||
|
return (uint)id;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (long.TryParse(str, NumberStyles.Integer, CultureInfo.InvariantCulture, out id))
|
if (long.TryParse(str, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out id))
|
||||||
{
|
{
|
||||||
return (uint)id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
var bot = Regex.Match(str, @"bot[0-9]+").Value;
|
var bot = Regex.Match(str, @"bot[0-9]+").Value;
|
||||||
@ -526,7 +531,7 @@ namespace SharedLibraryCore
|
|||||||
selectionIndex--;
|
selectionIndex--;
|
||||||
}
|
}
|
||||||
|
|
||||||
T selection = selections[selectionIndex ];
|
T selection = selections[selectionIndex];
|
||||||
|
|
||||||
return Tuple.Create(selectionIndex, selection);
|
return Tuple.Create(selectionIndex, selection);
|
||||||
}
|
}
|
||||||
@ -650,7 +655,10 @@ namespace SharedLibraryCore
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="log"></param>
|
/// <param name="log"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static bool IsRemoteLog(this string log) => (log ?? "").StartsWith("http");
|
public static bool IsRemoteLog(this string log)
|
||||||
|
{
|
||||||
|
return (log ?? "").StartsWith("http");
|
||||||
|
}
|
||||||
|
|
||||||
public static string ToBase64UrlSafeString(this string src)
|
public static string ToBase64UrlSafeString(this string src)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user