VLog.dll

Decompiled a week ago
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("VLog")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("VLog")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("ea8c92d4-b8f5-4404-af47-4c005f339474")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace VLog;

internal class CustomLogger : ILogListener, IDisposable, ILogHandler
{
	private StreamWriter logWriter;

	private DateTime time = DateTime.Now;

	public CustomLogger()
	{
		string text = Application.persistentDataPath + "\\VLogs";
		string destFileName = text + "\\Player_" + time.ToString("yyyy-MM-dd_HH-mm-ss") + ".log";
		Directory.CreateDirectory(text);
		File.Copy(Application.persistentDataPath + "\\Player.log", destFileName);
		logWriter = new StreamWriter(text + "\\Player_" + time.ToString("yyyy-MM-dd_HH-mm-ss") + ".log", append: true)
		{
			AutoFlush = true
		};
	}

	public void LogEvent(object sender, LogEventArgs args)
	{
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		logWriter.WriteLine($"[{args.Level}] {args.Source.SourceName}: {args.Data}");
	}

	public void LogUnity(string log, string stackTrace, LogType type)
	{
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		logWriter.WriteLine($"{type}: {log}\n{stackTrace}");
	}

	public void LogFormat(LogType logType, Object context, string format, params object[] args)
	{
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		logWriter.WriteLine($"{logType}: {string.Format(format, args)}");
	}

	public void LogException(Exception exception, Object context)
	{
		logWriter.WriteLine($"Exception: {exception}");
	}

	public void Dispose()
	{
		logWriter?.Dispose();
	}
}
[BepInPlugin("_OreoM.VLog", "VLog", "1.3.3")]
public class VLogBase : BaseUnityPlugin
{
	private const string modGUID = "_OreoM.VLog";

	private const string modName = "VLog";

	private const string modVersion = "1.3.3";

	private CustomLogger vlogger = new CustomLogger();

	internal ManualLogSource vloglog;

	private void Awake()
	{
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0016: Expected O, but got Unknown
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		//IL_002c: Expected O, but got Unknown
		Application.logMessageReceived += new LogCallback(vlogger.LogUnity);
		Application.logMessageReceivedThreaded += new LogCallback(vlogger.LogUnity);
		Debug.unityLogger.logHandler = (ILogHandler)(object)vlogger;
		vloglog = Logger.CreateLogSource("_OreoM.VLog");
		Logger.Listeners.Clear();
		Logger.Listeners.Add((ILogListener)(object)vlogger);
		vloglog.LogInfo((object)"VLog 1.3.3 has loaded.");
	}

	private void OnDestroy()
	{
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0016: Expected O, but got Unknown
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		//IL_002c: Expected O, but got Unknown
		Application.logMessageReceived -= new LogCallback(vlogger.LogUnity);
		Application.logMessageReceivedThreaded -= new LogCallback(vlogger.LogUnity);
	}
}