Decompiled source of ExtendedBattery v1.0.1

ExtendedBattery/ExtraBatteryLife.dll

Decompiled 2 months ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using ExtraBatteryLife.Patches;
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: AssemblyTitle("ExtraBatteryLife")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ExtraBatteryLife")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("2a5fd20a-43fc-41e7-b6d4-552e48207555")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace ExtraBatteryLife
{
	[BepInPlugin("Dug.ExtraBatteryLife", "Extra Battery Life", "1.0.0")]
	public class ExtraBatteryLifeBase : BaseUnityPlugin
	{
		private const string modGUID = "Dug.ExtraBatteryLife";

		private const string modName = "Extra Battery Life";

		private const string modVersion = "1.0.0";

		internal ManualLogSource mls;

		private readonly Harmony harmony = new Harmony("Dug.ExtraBatteryLife");

		private static ExtraBatteryLifeBase Instance;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("Dug.ExtraBatteryLife");
			mls.LogInfo((object)"Loading Extra Battery Life - 1.0.0");
			harmony.PatchAll(typeof(ExtraBatteryLifeBase));
			harmony.PatchAll(typeof(VideoCameraTimeLeftPatch));
			mls.LogInfo((object)"Extra Battery Life - 1.0.0 is loaded!");
		}
	}
}
namespace ExtraBatteryLife.Patches
{
	[HarmonyPatch(typeof(VideoCamera))]
	internal class VideoCameraTimeLeftPatch
	{
		[HarmonyPatch(typeof(VideoCamera), "ConfigItem")]
		[HarmonyPostfix]
		private static void BatteryLevelPatch(ref VideoInfoEntry ___m_recorderInfoEntry)
		{
			float num = 90f;
			float num2 = num * 2f;
			if (___m_recorderInfoEntry.maxTime == num && ___m_recorderInfoEntry.timeLeft == num)
			{
				___m_recorderInfoEntry.maxTime = num2;
				___m_recorderInfoEntry.timeLeft = num2;
			}
		}
	}
}