1
0
mirror of https://github.com/RaidMax/IW4M-Admin.git synced 2025-06-10 15:20:48 -05:00

fix alias command sending message to origin instead of target

(hopefully) fix an issue with banned players causing exception if they create events before they are kicked out
fix issues with sometimes wrong error message for timeout
show most recent IP address at top of alias list
optimization to some sql queries
This commit is contained in:
RaidMax
2019-11-15 14:50:20 -06:00
parent ba35177ded
commit edb00523a1
31 changed files with 1553 additions and 279 deletions

View File

@ -3,7 +3,6 @@ using SharedLibraryCore.Interfaces;
using System;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
namespace IW4MAdmin.Application
{
@ -20,16 +19,21 @@ namespace IW4MAdmin.Application
}
readonly string FileName;
readonly SemaphoreSlim OnLogWriting;
readonly ReaderWriterLockSlim WritingLock;
static readonly short MAX_LOG_FILES = 10;
public Logger(string fn)
{
FileName = Path.Join(Utilities.OperatingDirectory, "Log", $"{fn}.log");
OnLogWriting = new SemaphoreSlim(1, 1);
WritingLock = new ReaderWriterLockSlim();
RotateLogs();
}
~Logger()
{
WritingLock.Dispose();
}
/// <summary>
/// rotates logs when log is initialized
/// </summary>
@ -56,7 +60,7 @@ namespace IW4MAdmin.Application
void Write(string msg, LogType type)
{
OnLogWriting.Wait();
WritingLock.EnterWriteLock();
string stringType = type.ToString();
msg = msg.StripColors();
@ -74,7 +78,7 @@ namespace IW4MAdmin.Application
#if DEBUG
// lets keep it simple and dispose of everything quickly as logging wont be that much (relatively)
Console.WriteLine(LogLine);
File.AppendAllText(FileName, $"{LogLine}{Environment.NewLine}");
//File.AppendAllText(FileName, $"{LogLine}{Environment.NewLine}");
//Debug.WriteLine(msg);
#else
if (type == LogType.Error || type == LogType.Verbose)
@ -91,7 +95,7 @@ namespace IW4MAdmin.Application
Console.WriteLine(ex.GetExceptionInfo());
}
OnLogWriting.Release(1);
WritingLock.ExitWriteLock();
}
public void WriteVerbose(string msg)