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: AssemblyProduct("AutoRefresh")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyDescription("Automatically refreshes the lobby list so you don't have to!")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyCompany("AutoRefresh")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: CompilationRelaxations(8)]
[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;
[HarmonyPostfix]
[HarmonyPatch(typeof(SteamLobbyManager), "Update")]
private static void RefreshList(SteamLobbyManager __instance)
{
if ((Object)(object)__instance != (Object)null)
{
i++;
if (i == 3500)
{
__instance.LoadServerList();
i = 0;
}
}
}
}
}