curtail lost connection messages from RCon
verify still compatible with T6 fix potential null reference exception during configuration reading/setup
This commit is contained in:
parent
b5e9519f0c
commit
e91d076b41
@ -40,16 +40,6 @@
|
|||||||
"Name": "mp_crash"
|
"Name": "mp_crash"
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
|
||||||
"Alias": "Skidrow",
|
|
||||||
"Name": "mp_nightshift"
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
"Alias": "Quarry",
|
|
||||||
"Name": "mp_quarry"
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
{
|
||||||
"Alias": "Afghan",
|
"Alias": "Afghan",
|
||||||
"Name": "mp_afghan"
|
"Name": "mp_afghan"
|
||||||
|
@ -15,7 +15,7 @@ namespace IW4MAdmin.Application.Localization
|
|||||||
public static void Initialize(string customLocale)
|
public static void Initialize(string customLocale)
|
||||||
{
|
{
|
||||||
string currentLocale = string.IsNullOrEmpty(customLocale) ? CultureInfo.CurrentCulture.Name : customLocale;
|
string currentLocale = string.IsNullOrEmpty(customLocale) ? CultureInfo.CurrentCulture.Name : customLocale;
|
||||||
string[] localizationFiles = Directory.GetFiles("Localization", $"*.{currentLocale}.json");
|
string[] localizationFiles = Directory.GetFiles(Path.Join(Utilities.OperatingDirectory, "Localization"), $"*.{currentLocale}.json");
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -33,13 +33,13 @@ namespace IW4MAdmin.Application.Localization
|
|||||||
// culture doesn't exist so we just want language
|
// culture doesn't exist so we just want language
|
||||||
if (localizationFiles.Length == 0)
|
if (localizationFiles.Length == 0)
|
||||||
{
|
{
|
||||||
localizationFiles = Directory.GetFiles("Localization", $"*.{currentLocale.Substring(0, 2)}*.json");
|
localizationFiles = Directory.GetFiles(Path.Join(Utilities.OperatingDirectory, "Localization"), $"*.{currentLocale.Substring(0, 2)}*.json");
|
||||||
}
|
}
|
||||||
|
|
||||||
// language doesn't exist either so defaulting to english
|
// language doesn't exist either so defaulting to english
|
||||||
if (localizationFiles.Length == 0)
|
if (localizationFiles.Length == 0)
|
||||||
{
|
{
|
||||||
localizationFiles = Directory.GetFiles("Localization", "*.en-US.json");
|
localizationFiles = Directory.GetFiles(Path.Join(Utilities.OperatingDirectory, "Localization"), "*.en-US.json");
|
||||||
}
|
}
|
||||||
|
|
||||||
// this should never happen unless the localization folder is empty
|
// this should never happen unless the localization folder is empty
|
||||||
@ -64,7 +64,7 @@ namespace IW4MAdmin.Application.Localization
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
string localizationFile = $"Localization{Path.DirectorySeparatorChar}IW4MAdmin.{currentLocale}-{currentLocale.ToUpper()}.json";
|
string localizationFile = $"{Path.Join(Utilities.OperatingDirectory, "Localization")}{Path.DirectorySeparatorChar}IW4MAdmin.{currentLocale}-{currentLocale.ToUpper()}.json";
|
||||||
|
|
||||||
Utilities.CurrentLocalization = new SharedLibraryCore.Localization.Layout(localizationDict)
|
Utilities.CurrentLocalization = new SharedLibraryCore.Localization.Layout(localizationDict)
|
||||||
{
|
{
|
||||||
|
@ -24,7 +24,7 @@ namespace IW4MAdmin.Application
|
|||||||
|
|
||||||
public Logger(string fn)
|
public Logger(string fn)
|
||||||
{
|
{
|
||||||
FileName = Path.Join("Log", $"{fn}.log");
|
FileName = Path.Join(Utilities.OperatingDirectory, "Log", $"{fn}.log");
|
||||||
OnLogWriting = new SemaphoreSlim(1, 1);
|
OnLogWriting = new SemaphoreSlim(1, 1);
|
||||||
RotateLogs();
|
RotateLogs();
|
||||||
}
|
}
|
||||||
|
@ -38,10 +38,11 @@ namespace IW4MAdmin.Application
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
Console.CancelKeyPress += new ConsoleCancelEventHandler(OnCancelKey);
|
||||||
|
|
||||||
CheckDirectories();
|
CheckDirectories();
|
||||||
|
|
||||||
ServerManager = ApplicationManager.GetInstance();
|
ServerManager = ApplicationManager.GetInstance();
|
||||||
Console.CancelKeyPress += new ConsoleCancelEventHandler(OnCancelKey);
|
|
||||||
Localization.Configure.Initialize(ServerManager.GetApplicationSettings().Configuration()?.CustomLocale);
|
Localization.Configure.Initialize(ServerManager.GetApplicationSettings().Configuration()?.CustomLocale);
|
||||||
loc = Utilities.CurrentLocalization.LocalizationIndex;
|
loc = Utilities.CurrentLocalization.LocalizationIndex;
|
||||||
|
|
||||||
|
@ -874,7 +874,7 @@ namespace IW4MAdmin
|
|||||||
Logger.WriteError($"{logPath} {loc["SERVER_ERROR_DNE"]}");
|
Logger.WriteError($"{logPath} {loc["SERVER_ERROR_DNE"]}");
|
||||||
#if !DEBUG
|
#if !DEBUG
|
||||||
throw new ServerException($"{loc["SERVER_ERROR_LOG"]} {logPath}");
|
throw new ServerException($"{loc["SERVER_ERROR_LOG"]} {logPath}");
|
||||||
//#else
|
#else
|
||||||
LogEvent = new GameLogEventDetection(this, logPath, logfile.Value);
|
LogEvent = new GameLogEventDetection(this, logPath, logfile.Value);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -356,7 +356,8 @@ namespace IW4MAdmin.Plugins.Stats.Helpers
|
|||||||
|
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
Log.WriteWarning("Could not add client to stats");
|
||||||
|
Log.WriteDebug(ex.GetExceptionInfo());
|
||||||
}
|
}
|
||||||
|
|
||||||
finally
|
finally
|
||||||
|
@ -125,15 +125,15 @@ namespace SharedLibraryCore.Database
|
|||||||
// https://aleemkhan.wordpress.com/2013/02/28/dynamically-adding-dbset-properties-in-dbcontext-for-entity-framework-code-first/
|
// https://aleemkhan.wordpress.com/2013/02/28/dynamically-adding-dbset-properties-in-dbcontext-for-entity-framework-code-first/
|
||||||
IEnumerable<string> directoryFiles;
|
IEnumerable<string> directoryFiles;
|
||||||
|
|
||||||
string pluginDir = $@"{Environment.CurrentDirectory}{Path.DirectorySeparatorChar}bin{Path.DirectorySeparatorChar}Debug{Path.DirectorySeparatorChar}netcoreapp2.0{Path.DirectorySeparatorChar}Plugins";
|
string pluginDir = $@"{Environment.CurrentDirectory}{Path.DirectorySeparatorChar}bin{Path.DirectorySeparatorChar}Debug{Path.DirectorySeparatorChar}netcoreapp2.1{Path.DirectorySeparatorChar}Plugins";
|
||||||
|
|
||||||
if (!Directory.Exists(pluginDir))
|
if (!Directory.Exists(pluginDir))
|
||||||
{
|
{
|
||||||
pluginDir = $@"{Environment.CurrentDirectory}{Path.DirectorySeparatorChar}Plugins";
|
pluginDir = Path.Join(Environment.CurrentDirectory, "Plugins");
|
||||||
|
|
||||||
if (!Directory.Exists(pluginDir))
|
if (!Directory.Exists(pluginDir))
|
||||||
{
|
{
|
||||||
pluginDir = Utilities.OperatingDirectory;
|
pluginDir = Path.Join(Utilities.OperatingDirectory, "Plugins");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,17 +109,17 @@ namespace SharedLibraryCore.RCon
|
|||||||
connectionState.ConnectionAttempts = 0;
|
connectionState.ConnectionAttempts = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
catch (Exception ex)
|
catch/* (Exception ex)*/
|
||||||
{
|
{
|
||||||
if (connectionState.ConnectionAttempts < StaticHelpers.AllowedConnectionFails)
|
if (connectionState.ConnectionAttempts < StaticHelpers.AllowedConnectionFails)
|
||||||
{
|
{
|
||||||
Log.WriteWarning($"{Utilities.CurrentLocalization.LocalizationIndex["SERVER_ERROR_COMMUNICATION"]} [{this.Endpoint}] ({connectionState.ConnectionAttempts}/{StaticHelpers.AllowedConnectionFails})");
|
// Log.WriteWarning($"{Utilities.CurrentLocalization.LocalizationIndex["SERVER_ERROR_COMMUNICATION"]} [{this.Endpoint}] ({connectionState.ConnectionAttempts}/{StaticHelpers.AllowedConnectionFails})");
|
||||||
await Task.Delay(StaticHelpers.FloodProtectionInterval);
|
await Task.Delay(StaticHelpers.FloodProtectionInterval);
|
||||||
goto retrySend;
|
goto retrySend;
|
||||||
}
|
}
|
||||||
|
|
||||||
connectionState.OnComplete.Release(1);
|
connectionState.OnComplete.Release(1);
|
||||||
Log.WriteDebug(ex.GetExceptionInfo());
|
//Log.WriteDebug(ex.GetExceptionInfo());
|
||||||
throw new NetworkException($"{Utilities.CurrentLocalization.LocalizationIndex["SERVER_ERROR_COMMUNICATION"]} [{this.Endpoint}]");
|
throw new NetworkException($"{Utilities.CurrentLocalization.LocalizationIndex["SERVER_ERROR_COMMUNICATION"]} [{this.Endpoint}]");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,7 +20,6 @@ namespace WebfrontCore
|
|||||||
public Startup(IHostingEnvironment env)
|
public Startup(IHostingEnvironment env)
|
||||||
{
|
{
|
||||||
var builder = new ConfigurationBuilder()
|
var builder = new ConfigurationBuilder()
|
||||||
// .SetBasePath(SharedLibraryCore.Utilities.OperatingDirectory)
|
|
||||||
.AddEnvironmentVariables();
|
.AddEnvironmentVariables();
|
||||||
|
|
||||||
Configuration = builder.Build();
|
Configuration = builder.Build();
|
||||||
|
Loading…
Reference in New Issue
Block a user