ModernUO/Projects/Server/World/WorldEvents.cs
Kamron Batman da01f5b8a5
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.
2021-02-20 19:32:08 -08:00

33 lines
1.1 KiB
C#

using System;
using System.Runtime.CompilerServices;
namespace Server
{
public class WorldSavePostSnapshotEventArgs
{
public string OldSavePath { get; }
public string NewSavePath { get; }
public WorldSavePostSnapshotEventArgs(string oldSavePath, string newSavePath)
{
OldSavePath = oldSavePath;
NewSavePath = newSavePath;
}
}
public static partial class EventSink
{
public static event Action WorldLoad;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void InvokeWorldLoad() => WorldLoad?.Invoke();
public static event Action WorldSave;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void InvokeWorldSave() => WorldSave?.Invoke();
public static event Action<WorldSavePostSnapshotEventArgs> WorldSavePostSnapshot;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void InvokeWorldSavePostSnapshot(string oldSavePath, string newSavePath) =>
WorldSavePostSnapshot?.Invoke(new WorldSavePostSnapshotEventArgs(oldSavePath, newSavePath));
}
}