mirror of
https://github.com/NuclearPowered/Reactor.git
synced 2026-10-20 21:35:55 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
081e6e2ba9 | ||
|
|
70155fe8a6 |
No files matched your search
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using HarmonyLib;
|
||||
using Reactor.Extensions;
|
||||
using UnityEngine;
|
||||
using Object = UnityEngine.Object;
|
||||
@@ -10,6 +11,8 @@ namespace Reactor.Patches
|
||||
{
|
||||
private FileSystemWatcher Watcher { get; }
|
||||
|
||||
public bool IgnoreNext { get; set; }
|
||||
|
||||
internal RegionInfoWatcher()
|
||||
{
|
||||
Watcher = new FileSystemWatcher(
|
||||
@@ -21,6 +24,12 @@ namespace Reactor.Patches
|
||||
{
|
||||
if (new FileInfo(e.Name).Length > 0)
|
||||
{
|
||||
if (IgnoreNext)
|
||||
{
|
||||
IgnoreNext = false;
|
||||
return;
|
||||
}
|
||||
|
||||
Dispatcher.Instance.Enqueue(() =>
|
||||
{
|
||||
ServerManager.Instance.LoadServers();
|
||||
@@ -44,5 +53,17 @@ namespace Reactor.Patches
|
||||
{
|
||||
Watcher.Dispose();
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(FileIO), nameof(FileIO.WriteAllText))]
|
||||
private static class WritePatch
|
||||
{
|
||||
public static void Prefix(string path)
|
||||
{
|
||||
if (ServerManager.Instance && path == ServerManager.Instance.serverInfoFileJson)
|
||||
{
|
||||
PluginSingleton<ReactorPlugin>.Instance.RegionInfoWatcher.IgnoreNext = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,7 @@
|
||||
<Nullable>enable</Nullable>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
|
||||
<VersionPrefix>1.2.0</VersionPrefix>
|
||||
<VersionPrefix>1.2.1</VersionPrefix>
|
||||
<VersionSuffix>dev</VersionSuffix>
|
||||
<Description>Core mod and API for Among Us</Description>
|
||||
<Authors>NuclearPowered</Authors>
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace Reactor
|
||||
|
||||
public ConfigEntry<bool>? AllowVanillaServers { get; private set; }
|
||||
|
||||
private RegionInfoWatcher RegionInfoWatcher { get; } = new RegionInfoWatcher();
|
||||
internal RegionInfoWatcher RegionInfoWatcher { get; } = new RegionInfoWatcher();
|
||||
|
||||
public ReactorPlugin()
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user