Decompiled source of HyperCam Watermark v1.1.0

Cam2.dll

Decompiled 2 hours 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 Configgy;
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("Cam2")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Cam2")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("1e8f23f4-d929-4aef-b5d1-21b5ca41effe")]
[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 Cam2;

public static class WatermarkConfig
{
	[Configgable("HyperCam Watermark", "Show Watermark", 0, null)]
	public static bool ShowWatermark = true;

	[Configgable("HyperCam Watermark", "Size Multiplier", 0, null)]
	public static float SizeMultiplier = 1f;
}
[BepInPlugin("com.user.hypercamwatermark", "Unregistered HyperCam 2 Watermark", "1.1.0")]
public class HyperCamWatermarkPlugin : BaseUnityPlugin
{
	public static Texture2D watermarkTexture;

	private void Awake()
	{
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		//IL_001a: Expected O, but got Unknown
		RegisterConfig();
		LoadImage();
		GameObject val = new GameObject("HyperCamWatermark");
		val.AddComponent<WatermarkComponent>();
		Object.DontDestroyOnLoad((Object)(object)val);
		((BaseUnityPlugin)this).Logger.LogInfo((object)"HyperCam 2 Image Watermark loaded!");
	}

	[MethodImpl(MethodImplOptions.NoInlining)]
	private void RegisterConfig()
	{
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: Expected O, but got Unknown
		try
		{
			ConfigBuilder val = new ConfigBuilder("com.user.hypercamwatermark", "HyperCam Watermark");
			val.BuildAll();
		}
		catch (Exception ex)
		{
			((BaseUnityPlugin)this).Logger.LogWarning((object)("Configgy not available, using default settings: " + ex.Message));
		}
	}

	private void LoadImage()
	{
		//IL_009f: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a5: Expected O, but got Unknown
		string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
		string text = Path.Combine(directoryName, "hypercam.png");
		((BaseUnityPlugin)this).Logger.LogInfo((object)("[HyperCam Watermark] Looking for image at: " + text));
		if (!File.Exists(text))
		{
			string text2 = Path.Combine(Paths.PluginPath, "hypercam.png");
			((BaseUnityPlugin)this).Logger.LogInfo((object)("[HyperCam Watermark] Not found in DLL folder. Checking fallback path: " + text2));
			text = text2;
		}
		if (!File.Exists(text))
		{
			((BaseUnityPlugin)this).Logger.LogError((object)"[HyperCam Watermark] Could not find hypercam.png anywhere! Make sure it is named lowercase 'hypercam.png'.");
			return;
		}
		byte[] array = File.ReadAllBytes(text);
		Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false);
		if (ImageConversion.LoadImage(val, array))
		{
			watermarkTexture = val;
			((BaseUnityPlugin)this).Logger.LogInfo((object)"[HyperCam Watermark] Image loaded successfully!");
		}
		else
		{
			((BaseUnityPlugin)this).Logger.LogError((object)"[HyperCam Watermark] Failed to parse image bytes. Make sure it's a valid PNG file.");
		}
	}
}
public class WatermarkComponent : MonoBehaviour
{
	private void OnGUI()
	{
		//IL_004e: Unknown result type (might be due to invalid IL or missing references)
		Texture2D watermarkTexture = HyperCamWatermarkPlugin.watermarkTexture;
		if (!((Object)(object)watermarkTexture == (Object)null) && WatermarkConfig.ShowWatermark)
		{
			float num = Mathf.Max(0.01f, WatermarkConfig.SizeMultiplier);
			GUI.DrawTexture(new Rect(10f, 10f, (float)((Texture)watermarkTexture).width * num, (float)((Texture)watermarkTexture).height * num), (Texture)(object)watermarkTexture);
		}
	}
}