Decompiled source of SoundOfSilenceRadio v1.0.1

BepInEx/plugins/SoundOfSilenceRadio.dll

Decompiled 2 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using SoundOfSilenceRadio.Patches;
using UnityEngine;
using UnityEngine.Networking;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("SoundOfSilenceRadio")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("SoundOfSilenceRadio")]
[assembly: AssemblyTitle("SoundOfSilenceRadio")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace SoundOfSilenceRadio
{
	[BepInPlugin("KamenVacuumCleaner.SoundOfSilenceRadio", "SoundOfSilenceRadio", "1.0.1")]
	public class Plugin : BaseUnityPlugin
	{
		private const string GUID = "KamenVacuumCleaner.SoundOfSilenceRadio";

		private const string NAME = "SoundOfSilenceRadio";

		private const string VERSION = "1.0.1";

		private readonly Harmony harmony = new Harmony("SoundOfSilenceRadio");

		public static Plugin instance;

		internal ManualLogSource mls;

		public static AudioClip soundOfSilence;

		private void Awake()
		{
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Invalid comparison between Unknown and I4
			if ((Object)(object)instance == (Object)null)
			{
				instance = this;
			}
			mls = Logger.CreateLogSource("KamenVacuumCleaner.SoundOfSilenceRadio");
			mls.LogInfo((object)"Loading SoundOfSilenceRadio...");
			string text = ((BaseUnityPlugin)this).Info.Location.TrimEnd("SoundOfSilenceRadio.dll".ToCharArray());
			UnityWebRequest audioClip = UnityWebRequestMultimedia.GetAudioClip("File://" + text + "SoundOfSilence.wav", (AudioType)20);
			audioClip.SendWebRequest();
			while (!audioClip.isDone)
			{
			}
			if ((int)audioClip.result == 1)
			{
				soundOfSilence = DownloadHandlerAudioClip.GetContent(audioClip);
				harmony.PatchAll(typeof(VehicleControllerPatch));
				mls.LogInfo((object)"SoundOfSilenceRadio v1.0.1 has been loaded up successfully!");
			}
			else
			{
				mls.LogError((object)"An error occured while trying to load!");
			}
		}
	}
}
namespace SoundOfSilenceRadio.Patches
{
	[HarmonyPatch(typeof(VehicleController))]
	internal class VehicleControllerPatch
	{
		[HarmonyPatch("Awake")]
		[HarmonyPrefix]
		private static void StartPatch(VehicleController __instance)
		{
			__instance.radioClips = (AudioClip[])(object)new AudioClip[1] { Plugin.soundOfSilence };
		}
	}
}