using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using AutoRefresh.Patches;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("AutoRefresh")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Automatically refreshes the lobby list so you don't have to!")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("AutoRefresh")]
[assembly: AssemblyTitle("AutoRefresh")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace AutoRefresh
{
[BepInPlugin("AutoRefresh", "AutoRefresh", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
private bool _patched;
public static ManualLogSource Log { get; set; }
private void Awake()
{
if (_patched)
{
Log.LogWarning((object)"Already patched");
return;
}
Log = ((BaseUnityPlugin)this).Logger;
Harmony.CreateAndPatchAll(typeof(RefreshPatch), "AutoRefresh");
((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin AutoRefresh is loaded!");
_patched = true;
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "AutoRefresh";
public const string PLUGIN_NAME = "AutoRefresh";
public const string PLUGIN_VERSION = "1.0.0";
}
}
namespace AutoRefresh.Patches
{
internal class RefreshPatch
{
private static int i;
[HarmonyPatch(typeof(SteamLobbyManager), "Update")]
[HarmonyPostfix]
private static void RefreshList(SteamLobbyManager __instance)
{
if ((Object)(object)__instance != (Object)null)
{
i++;
if (i == 600)
{
__instance.LoadServerList();
i = 0;
}
}
}
}
}