fix(core): Fixes flow for saves, adds logging and configurations (#513)

- [X] Adds better diagnostics for world saves.
- [X] Adds world save stats.
- [X] World now saves to a temporary folder.
- [X] Backups are now stored by timestamp.
- [X] Backup is now made after the world save.
- [X] "Saves" folder is now configurable.
- [X] Temporary folder is now configurable.
- [X] Backups folder is now configurable.
This commit is contained in:
Kamron Batman 2021-02-20 19:32:08 -08:00 • committed by GitHub
parent 6f5312cb89
commit da01f5b8a5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 325 additions and 210 deletions

View file

@ -14,6 +14,7 @@
*************************************************************************/
using System;
using System.Runtime.CompilerServices;
using Server.Network;
namespace Server
@ -41,6 +42,8 @@ namespace Server
public static partial class EventSink
{
public static event Action<AccountLoginEventArgs> AccountLogin;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void InvokeAccountLogin(AccountLoginEventArgs e) => AccountLogin?.Invoke(e);
}
}

View file

@ -15,6 +15,7 @@
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
namespace Server
{
@ -64,6 +65,8 @@ namespace Server
public static partial class EventSink
{
public static event Action<AggressiveActionEventArgs> AggressiveAction;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void InvokeAggressiveAction(AggressiveActionEventArgs e) => AggressiveAction?.Invoke(e);
}
}

View file

@ -14,6 +14,7 @@
*************************************************************************/
using System;
using System.Runtime.CompilerServices;
using Server.Accounting;
using Server.Network;
@ -102,6 +103,8 @@ namespace Server
public static partial class EventSink
{
public static event Action<CharacterCreatedEventArgs> CharacterCreated;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void InvokeCharacterCreated(CharacterCreatedEventArgs e) => CharacterCreated?.Invoke(e);
}
}

View file

@ -106,12 +106,6 @@ namespace Server
public static event Action<NetState, int> DeleteRequest;
public static void InvokeDeleteRequest(NetState state, int index) => DeleteRequest?.Invoke(state, index);
public static event Action WorldLoad;
public static void InvokeWorldLoad() => WorldLoad?.Invoke();
public static event Action WorldSave;
public static void InvokeWorldSave() => WorldSave?.Invoke();
public static event Action<Mobile, int> SetAbility;
public static void InvokeSetAbility(Mobile mobile, int index) => SetAbility?.Invoke(mobile, index);

View file

@ -14,6 +14,7 @@
*************************************************************************/
using System;
using System.Runtime.CompilerServices;
using Server.Network;
namespace Server
@ -31,6 +32,7 @@ namespace Server
{
public static event Action<FastWalkEventArgs> FastWalk;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void InvokeFastWalk(FastWalkEventArgs e) => FastWalk?.Invoke(e);
}
}

View file

@ -14,6 +14,7 @@
*************************************************************************/
using System;
using System.Runtime.CompilerServices;
using Server.Network;
namespace Server
@ -41,6 +42,8 @@ namespace Server
public static partial class EventSink
{
public static event Action<GameLoginEventArgs> GameLogin;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void InvokeGameLogin(GameLoginEventArgs e) => GameLogin?.Invoke(e);
}
}

View file

@ -15,6 +15,7 @@
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
namespace Server
{
@ -63,6 +64,8 @@ namespace Server
public static partial class EventSink
{
public static event Action<MovementEventArgs> Movement;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void InvokeMovement(MovementEventArgs e) => Movement?.Invoke(e);
}
}

View file

@ -14,6 +14,7 @@
*************************************************************************/
using System;
using System.Runtime.CompilerServices;
namespace Server
{
@ -29,6 +30,8 @@ namespace Server
public static partial class EventSink
{
public static event Action<ServerCrashedEventArgs> ServerCrashed;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void InvokeServerCrashed(ServerCrashedEventArgs e) => ServerCrashed?.Invoke(e);
}
}

View file

@ -16,6 +16,7 @@
using System;
using System.Collections.Generic;
using System.Net;
using System.Runtime.CompilerServices;
using Server.Accounting;
using Server.Network;
@ -52,6 +53,8 @@ namespace Server
public static partial class EventSink
{
public static event Action<ServerListEventArgs> ServerList;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void InvokeServerList(ServerListEventArgs e) => ServerList?.Invoke(e);
}
}

View file

@ -15,6 +15,7 @@
using System;
using System.Net.Sockets;
using System.Runtime.CompilerServices;
namespace Server
{
@ -34,6 +35,8 @@ namespace Server
public static partial class EventSink
{
public static event Action<SocketConnectEventArgs> SocketConnect;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void InvokeSocketConnect(SocketConnectEventArgs e) => SocketConnect?.Invoke(e);
}
}

View file

@ -14,6 +14,7 @@
*************************************************************************/
using System;
using System.Runtime.CompilerServices;
using Server.Network;
namespace Server
@ -60,6 +61,8 @@ namespace Server
public static partial class EventSink
{
public static event Action<SpeechEventArgs> Speech;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void InvokeSpeech(SpeechEventArgs e) => Speech?.Invoke(e);
}
}