Decompiled source of FamilyFriendly v1.0.4

BepInEx/plugins/AnthonyStai.FamilyFriendly.dll

Decompiled 4 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using Microsoft.CodeAnalysis;
using VoiceRecognitionAPI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("")]
[assembly: AssemblyCompany("Anthony")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("A non serious mod which kills you if you swear.")]
[assembly: AssemblyFileVersion("1.0.4.0")]
[assembly: AssemblyInformationalVersion("1.0.4+f02355006226ba9b0f318e655512b6f8c19cdf1f")]
[assembly: AssemblyProduct("AnthonyStai.FamilyFriendly")]
[assembly: AssemblyTitle("AnthonyStai.FamilyFriendly")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/ItzRock/FamilyFriendly")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.4.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
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;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace FamilyFriendly
{
	[ContentWarningPlugin("AnthonyStai.FamilyFriendly", "1.0.4", true)]
	[BepInPlugin("AnthonyStai.FamilyFriendly", "AnthonyStai.FamilyFriendly", "1.0.4")]
	public class Plugin : BaseUnityPlugin
	{
		private readonly string filename = "naughtywords.txt";

		private readonly string overrideFN = "override.txt";

		private void Kill(string msg)
		{
			((BaseUnityPlugin)this).Logger.LogInfo((object)("Bro said: " + msg));
			Player.KillLocal();
		}

		private void Awake()
		{
			((BaseUnityPlugin)this).Logger.LogInfo((object)("Searching folder: " + Paths.PluginPath));
			List<string> list = Directory.GetFiles(Paths.PluginPath, filename, SearchOption.AllDirectories).ToList();
			if (list.Count < 1)
			{
				((BaseUnityPlugin)this).Logger.LogInfo((object)("Plugin AnthonyStai.FamilyFriendly failed to load! Missing " + filename));
				return;
			}
			List<string> list2 = Directory.GetFiles(Paths.PluginPath, overrideFN, SearchOption.AllDirectories).ToList();
			if (list2.Count > 0)
			{
				for (int i = 0; i < list2.Count; i++)
				{
					string text = list2[i];
					((BaseUnityPlugin)this).Logger.LogInfo((object)("LOADING OVERRIDE PATH: " + text));
					using StreamReader streamReader = new StreamReader(text);
					int num = 0;
					string text2;
					while ((text2 = streamReader.ReadLine()) != null)
					{
						Voice.ListenForPhrase(text2, (Action<string>)Kill);
						num++;
					}
					streamReader.Close();
				}
			}
			else
			{
				for (int j = 0; j < list.Count; j++)
				{
					string text3 = list[j];
					((BaseUnityPlugin)this).Logger.LogInfo((object)("LOADING PATH: " + text3));
					using StreamReader streamReader2 = new StreamReader(text3);
					int num2 = 0;
					string text4;
					while ((text4 = streamReader2.ReadLine()) != null)
					{
						Voice.ListenForPhrase(text4, (Action<string>)Kill);
						num2++;
					}
					streamReader2.Close();
				}
			}
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin AnthonyStai.FamilyFriendly is loaded!");
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "AnthonyStai.FamilyFriendly";

		public const string PLUGIN_NAME = "AnthonyStai.FamilyFriendly";

		public const string PLUGIN_VERSION = "1.0.4";
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}