Decompiled source of STSharedAudioLib v0.0.2

STSharedAudioLib.dll

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

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("STSharedAudioLib")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("A standalone Component storing Lists of AudioClips to access from different mods.")]
[assembly: AssemblyFileVersion("0.0.2.0")]
[assembly: AssemblyInformationalVersion("0.0.2")]
[assembly: AssemblyProduct("STSharedAudioLib")]
[assembly: AssemblyTitle("STSharedAudioLib")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.2.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.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace STSharedAudioLib
{
	public class AudioClipWithWeight : ScriptableObject
	{
		public AudioClip audioClip;

		public int weight;
	}
	public class AudioList : ScriptableObject
	{
		public List<AudioClipWithWeight> weightedClipsList = new List<AudioClipWithWeight>();

		public int listWeight;
	}
	[BepInPlugin("STSharedAudioLib", "STSharedAudioLib", "0.0.2")]
	public class Plugin : BaseUnityPlugin
	{
		internal static ManualLogSource Logger;

		private void Awake()
		{
			Logger = ((BaseUnityPlugin)this).Logger;
			Logger.LogInfo((object)"Plugin STSharedAudioLib is loaded!");
		}
	}
	public class SharedAudioComponent : MonoBehaviour
	{
		public List<AudioList> allAudioLists = new List<AudioList>();
	}
	public class SharedAudioMethods
	{
		public static SharedAudioComponent GetSharedAudioComponent(GameObject objectToCheck, bool printDebug = false, string newListName = null, int newListWeight = 100, bool makeNewListUponComponentAdd = true)
		{
			if ((Object)(object)objectToCheck == (Object)null)
			{
				Plugin.Logger.LogWarning((object)"GetSharedAudioComponent() was called with a null GameObject, please specify what GameObject a SharedAudioComponent must be gotten from or added to, returning null");
				return null;
			}
			SharedAudioComponent sharedAudioComponent = objectToCheck.GetComponent<SharedAudioComponent>();
			if ((Object)(object)sharedAudioComponent == (Object)null)
			{
				sharedAudioComponent = objectToCheck.AddComponent<SharedAudioComponent>();
				CheckComponentListForNull(sharedAudioComponent, printDebug, makeNewListUponComponentAdd, newListName, newListWeight);
				if (printDebug)
				{
					Plugin.Logger.LogDebug((object)("added SharedAudioComponent to object " + ((Object)objectToCheck).name));
				}
			}
			else if (printDebug)
			{
				Plugin.Logger.LogDebug((object)("got existing SharedAudioComponent on object " + ((Object)objectToCheck).name));
			}
			return sharedAudioComponent;
		}

		public static void CleanSharedAudioComponent(GameObject objectToClean, bool printDebug = false, bool removeNullAudioClips = true, bool removeNullAudioLists = true, bool removeDuplicates = true, bool removeDuplicateAudioClipsWithDifferentWeight = true)
		{
			CleanSharedAudioComponent(GetSharedAudioComponent(objectToClean, printDebug), printDebug, removeNullAudioClips, removeNullAudioLists, removeDuplicates, removeDuplicateAudioClipsWithDifferentWeight);
		}

		public static void CleanSharedAudioComponent(SharedAudioComponent audioComponent, bool printDebug = false, bool removeNullAudioClips = true, bool removeNullAudioLists = true, bool removeDuplicates = true, bool removeDuplicateAudioClipsWithDifferentWeight = true)
		{
			if ((Object)(object)audioComponent == (Object)null)
			{
				Plugin.Logger.LogWarning((object)"CleanSharedAudioComponent() was called with a null SharedAudioComponent, please specify what SharedAudioComponent to clean");
				return;
			}
			if (printDebug)
			{
				Plugin.Logger.LogDebug((object)("got call to clean up SharedAudioComponent on object " + ((Object)((Component)audioComponent).gameObject).name));
			}
			if (removeNullAudioClips || removeNullAudioLists)
			{
				RemoveNull(audioComponent, printDebug, -1, removeNullAudioClips, removeNullAudioLists);
			}
			if (removeDuplicates)
			{
				RemoveDuplicates(audioComponent, printDebug, removeDuplicateAudioClipsWithDifferentWeight);
			}
		}

		public static void CleanEverySharedAudioComponent(GameObject[] allObjectsToClean = null, bool printDebug = false, bool removeNullAudioClips = true, bool removeNullAudioLists = true, bool removeDuplicates = true, bool removeDuplicateAudioClipsWithDifferentWeight = true)
		{
			if (printDebug)
			{
				Plugin.Logger.LogDebug((object)"got call to clean up every single GameObject's SharedAudioComponent!");
			}
			if (allObjectsToClean == null)
			{
				allObjectsToClean = Object.FindObjectsOfType<GameObject>();
			}
			GameObject[] array = allObjectsToClean;
			foreach (GameObject val in array)
			{
				if ((Object)(object)val.GetComponent<SharedAudioComponent>() != (Object)null)
				{
					SharedAudioComponent[] components = val.GetComponents<SharedAudioComponent>();
					foreach (SharedAudioComponent audioComponent in components)
					{
						CleanSharedAudioComponent(audioComponent, printDebug, removeNullAudioClips, removeNullAudioLists, removeDuplicates, removeDuplicateAudioClipsWithDifferentWeight);
					}
				}
			}
		}

		public static void CleanEverySharedAudioComponent(SharedAudioComponent[] allAudioComponents = null, bool printDebug = false, bool removeNullAudioClips = true, bool removeNullAudioLists = true, bool removeDuplicates = true, bool removeDuplicateAudioClipsWithDifferentWeight = true)
		{
			if (printDebug)
			{
				Plugin.Logger.LogDebug((object)"got call to clean up every single SharedAudioComponent!");
			}
			if (allAudioComponents == null)
			{
				allAudioComponents = Object.FindObjectsOfType<SharedAudioComponent>();
			}
			SharedAudioComponent[] array = allAudioComponents;
			foreach (SharedAudioComponent audioComponent in array)
			{
				CleanSharedAudioComponent(audioComponent, printDebug, removeNullAudioClips, removeNullAudioLists, removeDuplicates, removeDuplicateAudioClipsWithDifferentWeight);
			}
		}

		public static AudioList AudioListCreateNew(GameObject objectToAdd, bool printDebug = false, string newListName = null, int newListWeight = 100)
		{
			return AudioListCreateNew(GetSharedAudioComponent(objectToAdd, printDebug), printDebug, newListName, newListWeight);
		}

		public static AudioList AudioListCreateNew(SharedAudioComponent audioComponent, bool printDebug = false, string newListName = null, int newListWeight = 100)
		{
			if ((Object)(object)audioComponent == (Object)null)
			{
				Plugin.Logger.LogWarning((object)"AudioListCreateNew() was called with a null SharedAudioComponent, please specify what SharedAudioComponent to add an AudioList to, returning null");
				return null;
			}
			AudioList audioList = ScriptableObject.CreateInstance<AudioList>();
			if (newListName == null)
			{
				((Object)audioList).name = $"{((Object)((Component)audioComponent).gameObject).name} // AudioList{audioComponent.allAudioLists.Count}";
				if (printDebug)
				{
					Plugin.Logger.LogDebug((object)("AudioListCreateNew() was not given a specified listName, creating new AudioList with name '" + ((Object)audioList).name + "'"));
				}
			}
			else if (!IsListNameUnique(audioComponent, newListName))
			{
				((Object)audioList).name = $"{((Object)((Component)audioComponent).gameObject).name} // AudioList{audioComponent.allAudioLists.Count}";
				if (printDebug)
				{
					Plugin.Logger.LogDebug((object)("allAudioLists on object " + ((Object)((Component)audioComponent).gameObject).name + " already had an AudioList with name '" + newListName + "', creating new AudioList with name '" + ((Object)audioList).name + "'"));
				}
			}
			else
			{
				((Object)audioList).name = newListName;
			}
			if (newListWeight <= 0)
			{
				audioList.listWeight = 100;
				Plugin.Logger.LogWarning((object)$"AudioListCreateNew() was called with an invalid newListWeight value of {newListWeight}, only positive values above zero allowed, creating new AudioList with weight {audioList.listWeight}");
			}
			else
			{
				audioList.listWeight = newListWeight;
			}
			audioComponent.allAudioLists.Add(audioList);
			if (printDebug)
			{
				Plugin.Logger.LogDebug((object)$"created new AudioList with name '{((Object)audioList).name}' and weight {audioList.listWeight} at index [{audioComponent.allAudioLists.Count - 1}] on object {((Object)((Component)audioComponent).gameObject).name}");
			}
			return audioList;
		}

		public static AudioList AudioListGetDefault(GameObject objectToCheck, bool printDebug = false, bool createListIfNull = true)
		{
			return AudioListGetDefault(GetSharedAudioComponent(objectToCheck, printDebug), printDebug, createListIfNull);
		}

		public static AudioList AudioListGetDefault(SharedAudioComponent audioComponent, bool printDebug = false, bool createListIfNull = true)
		{
			if ((Object)(object)audioComponent == (Object)null)
			{
				Plugin.Logger.LogWarning((object)"AudioListGetDefault() was called with a null SharedAudioComponent, please specify what SharedAudioComponent to get the first AudioList from, returning null");
				return null;
			}
			CheckComponentListForNull(audioComponent, printDebug, createListIfNull);
			if (audioComponent.allAudioLists.Count == 0)
			{
				Plugin.Logger.LogWarning((object)("SharedAudioComponent on object '" + ((Object)((Component)audioComponent).gameObject).name + "' did not contain any AudioLists, returning null"));
				return null;
			}
			AudioList audioList = audioComponent.allAudioLists[0];
			if (printDebug)
			{
				Plugin.Logger.LogDebug((object)$"found AudioList with name '{((Object)audioList).name}' at index [{audioComponent.allAudioLists[0]}] on object {((Object)((Component)audioComponent).gameObject).name}");
			}
			return audioList;
		}

		public static AudioList AudioListGetByName(string nameListToSearch, GameObject objectToCheck, bool printDebug = false, bool createListIfNull = true)
		{
			return AudioListGetByName(nameListToSearch, GetSharedAudioComponent(objectToCheck, printDebug), printDebug, createListIfNull);
		}

		public static AudioList AudioListGetByName(string nameListToSearch, SharedAudioComponent audioComponent, bool printDebug = false, bool createListIfNull = true)
		{
			if (nameListToSearch == null || (Object)(object)audioComponent == (Object)null)
			{
				Plugin.Logger.LogWarning((object)"AudioListGetByname() was called with a null nameListToSearch and/or SharedAudioComponent, please specify what name to search for on what SharedAudioComponent, returning null");
				return null;
			}
			CheckComponentListForNull(audioComponent, printDebug, createListIfNull, nameListToSearch);
			if (audioComponent.allAudioLists.Count == 0)
			{
				Plugin.Logger.LogWarning((object)("SharedAudioComponent on object '" + ((Object)((Component)audioComponent).gameObject).name + "' did not contain any AudioLists, returning null"));
				return null;
			}
			for (int i = 0; i < audioComponent.allAudioLists.Count; i++)
			{
				AudioList audioList = audioComponent.allAudioLists[i];
				if (((Object)audioList).name == nameListToSearch)
				{
					if (printDebug)
					{
						Plugin.Logger.LogDebug((object)$"found AudioList with name '{((Object)audioList).name}' at index [{i}] on object {((Object)((Component)audioComponent).gameObject).name}");
					}
					return audioList;
				}
			}
			if (createListIfNull)
			{
				if (printDebug)
				{
					Plugin.Logger.LogDebug((object)("AudioListGetByName() called with nameListToSearch that was not yet present on object " + ((Object)((Component)audioComponent).gameObject).name + ", creating new AudioList with name '" + nameListToSearch + "'"));
				}
				return AudioListCreateNew(audioComponent, printDebug, nameListToSearch);
			}
			Plugin.Logger.LogWarning((object)("no AudioList with name '" + nameListToSearch + "' was found on object " + ((Object)((Component)audioComponent).gameObject).name + ", returning first AudioList in allAudioLists"));
			return audioComponent.allAudioLists[0];
		}

		public static AudioList AudioListGetLongest(GameObject objectToCheck, bool printDebug = false, bool createListIfNull = true)
		{
			return AudioListGetLongest(GetSharedAudioComponent(objectToCheck, printDebug), printDebug, createListIfNull);
		}

		public static AudioList AudioListGetLongest(SharedAudioComponent audioComponent, bool printDebug = false, bool createListIfNull = true)
		{
			if ((Object)(object)audioComponent == (Object)null)
			{
				Plugin.Logger.LogWarning((object)"AudioListGetLongest() was called with a null SharedAudioComponent, please specify what SharedAudioComponent to get the longest AudioList from, returning null");
				return null;
			}
			CheckComponentListForNull(audioComponent, printDebug, createListIfNull);
			if (audioComponent.allAudioLists.Count == 0)
			{
				Plugin.Logger.LogWarning((object)("SharedAudioComponent on object '" + ((Object)((Component)audioComponent).gameObject).name + "' did not contain any AudioLists, returning null"));
				return null;
			}
			int num = 0;
			int num2 = 0;
			for (int i = 0; i < audioComponent.allAudioLists.Count; i++)
			{
				if (audioComponent.allAudioLists[i].weightedClipsList.Count > num)
				{
					num = audioComponent.allAudioLists[i].weightedClipsList.Count;
					num2 = i;
				}
			}
			if (num == 0)
			{
				Plugin.Logger.LogWarning((object)("error while searching for longest AudioList on object " + ((Object)((Component)audioComponent).gameObject).name + ", returning first AudioList in allAudioLists"));
			}
			if (printDebug && num != 0)
			{
				Plugin.Logger.LogDebug((object)$"found longest AudioList with name '{((Object)audioComponent.allAudioLists[num2]).name}' at index [{num2}] on object {((Object)((Component)audioComponent).gameObject).name}");
			}
			return audioComponent.allAudioLists[num2];
		}

		public static AudioList AudioListGetShortest(GameObject objectToCheck, bool printDebug = false, bool createListIfNull = true)
		{
			return AudioListGetShortest(GetSharedAudioComponent(objectToCheck, printDebug), printDebug, createListIfNull);
		}

		public static AudioList AudioListGetShortest(SharedAudioComponent audioComponent, bool printDebug = false, bool createListIfNull = true)
		{
			if ((Object)(object)audioComponent == (Object)null)
			{
				Plugin.Logger.LogWarning((object)"AudioListGetShortest() was called with a null SharedAudioComponent, please specify what SharedAudioComponent to get the shortest AudioList from, returning null");
				return null;
			}
			CheckComponentListForNull(audioComponent, printDebug, createListIfNull);
			if (audioComponent.allAudioLists.Count == 0)
			{
				Plugin.Logger.LogWarning((object)("SharedAudioComponent on object '" + ((Object)((Component)audioComponent).gameObject).name + "' did not contain any AudioLists, returning null"));
				return null;
			}
			int num = 999999999;
			int num2 = 0;
			for (int i = 0; i < audioComponent.allAudioLists.Count; i++)
			{
				if (audioComponent.allAudioLists[i].weightedClipsList.Count < num)
				{
					num = audioComponent.allAudioLists[i].weightedClipsList.Count;
					num2 = i;
				}
			}
			if (num == 999999999)
			{
				Plugin.Logger.LogWarning((object)("error while searching for shortest AudioList on object " + ((Object)((Component)audioComponent).gameObject).name + ", returning first AudioList in allAudioLists"));
			}
			if (printDebug && num != 999999999)
			{
				Plugin.Logger.LogDebug((object)$"found shortest AudioList with name '{((Object)audioComponent.allAudioLists[num2]).name}' at index [{num2}] on object {((Object)((Component)audioComponent).gameObject).name}");
			}
			return audioComponent.allAudioLists[num2];
		}

		public static AudioList AudioListGetRandom(GameObject objectToCheck, bool printDebug = false, bool createListIfNull = true)
		{
			SharedAudioComponent[] components = objectToCheck.GetComponents<SharedAudioComponent>();
			int num = Random.Range(0, components.Length);
			return AudioListGetRandom(components[num], printDebug, createListIfNull);
		}

		public static AudioList AudioListGetRandom(SharedAudioComponent audioComponent, bool printDebug = false, bool createListIfNull = true)
		{
			if ((Object)(object)audioComponent == (Object)null)
			{
				Plugin.Logger.LogWarning((object)"AudioListGetRandom() was called with a null SharedAudioComponent, please specify what SharedAudioComponent to get a random AudioList from, returning null");
				return null;
			}
			CheckComponentListForNull(audioComponent, printDebug, createListIfNull);
			if (audioComponent.allAudioLists.Count == 0)
			{
				Plugin.Logger.LogWarning((object)("SharedAudioComponent on object '" + ((Object)((Component)audioComponent).gameObject).name + "' did not contain any AudioLists, returning null"));
				return null;
			}
			int num = Random.Range(0, audioComponent.allAudioLists.Count);
			if (printDebug)
			{
				Plugin.Logger.LogDebug((object)$"returned AudioList with name '{((Object)audioComponent.allAudioLists[num]).name}' at random index [{num}] on object {((Object)((Component)audioComponent).gameObject).name}");
			}
			return audioComponent.allAudioLists[num];
		}

		public static AudioList AudioListGetRandomByWeight(GameObject objectToCheck, bool printDebug = false, bool createListIfNull = true)
		{
			SharedAudioComponent[] components = objectToCheck.GetComponents<SharedAudioComponent>();
			int num = Random.Range(0, components.Length);
			return AudioListGetRandomByWeight(components[num], printDebug, createListIfNull);
		}

		public static AudioList AudioListGetRandomByWeight(SharedAudioComponent audioComponent, bool printDebug = false, bool createListIfNull = true)
		{
			if ((Object)(object)audioComponent == (Object)null)
			{
				Plugin.Logger.LogWarning((object)"AudioListGetRandomByWeight() was called with a null SharedAudioComponent, please specify what SharedAudioComponent to get a random weighted AudioList from, returning null");
				return null;
			}
			CheckComponentListForNull(audioComponent, printDebug, createListIfNull);
			if (audioComponent.allAudioLists.Count == 0)
			{
				Plugin.Logger.LogWarning((object)("SharedAudioComponent on object '" + ((Object)((Component)audioComponent).gameObject).name + "' did not contain any AudioLists, returning null"));
				return null;
			}
			int num = AddUpAllWeights(audioComponent);
			if (printDebug)
			{
				Plugin.Logger.LogDebug((object)$"got totalWeight {num} from SharedAudioComponent on object {((Object)((Component)audioComponent).gameObject).name}");
			}
			int num2 = Random.Range(0, num + 1);
			int num3 = 0;
			int num4 = -1;
			for (int i = 0; i < audioComponent.allAudioLists.Count; i++)
			{
				num3 += audioComponent.allAudioLists[i].listWeight;
				if (num2 > num4 && num2 <= num3)
				{
					if (printDebug)
					{
						Plugin.Logger.LogDebug((object)$"returned AudioList with name '{((Object)audioComponent.allAudioLists[i]).name}' at index [{i}] on object {((Object)((Component)audioComponent).gameObject).name} after getting random weight {num2}");
					}
					return audioComponent.allAudioLists[i];
				}
			}
			Plugin.Logger.LogWarning((object)$"error occured while looking for random weight {num2} in SharedAudioComponent on object {((Object)((Component)audioComponent).gameObject).name}, returning first AudioList in allAudioLists");
			return AudioListGetDefault(audioComponent);
		}

		public static int AudioListGetIndex(AudioList audioList, GameObject objectToCheck, bool printDebug = false, bool createListIfNull = true, bool addListIfNotFound = true)
		{
			return AudioListGetIndex(audioList, GetSharedAudioComponent(objectToCheck, printDebug), printDebug, createListIfNull, addListIfNotFound);
		}

		public static int AudioListGetIndex(AudioList audioList, SharedAudioComponent audioComponent, bool printDebug = false, bool createListIfNull = true, bool addListIfNotFound = true)
		{
			if ((Object)(object)audioList == (Object)null || (Object)(object)audioComponent == (Object)null)
			{
				Plugin.Logger.LogWarning((object)"AudioListGetIndex() was called with a null AudioList and/or SharedAudioComponent, please specify what AudioList's index to get on what SharedAudioComponent, returning zero");
				return 0;
			}
			CheckComponentListForNull(audioComponent, printDebug, createListIfNull);
			if (audioComponent.allAudioLists.Count == 0)
			{
				Plugin.Logger.LogWarning((object)("SharedAudioComponent on object '" + ((Object)((Component)audioComponent).gameObject).name + "' did not contain any AudioLists, returning zero"));
				return 0;
			}
			for (int i = 0; i < audioComponent.allAudioLists.Count; i++)
			{
				AudioList audioList2 = audioComponent.allAudioLists[i];
				if ((Object)(object)audioList2 == (Object)(object)audioList)
				{
					if (printDebug)
					{
						Plugin.Logger.LogDebug((object)$"returned index [{i}] for AudioList with name '{((Object)audioList).name}' on object {((Object)((Component)audioComponent).gameObject).name}");
					}
					return i;
				}
			}
			if (addListIfNotFound)
			{
				audioComponent.allAudioLists.Add(audioList);
				if (printDebug)
				{
					Plugin.Logger.LogDebug((object)("AudioListGetIndex() called with an AudioList that was not yet present, adding AudioList with name '" + ((Object)audioList).name + "' to SharedAudioComponent on object " + ((Object)((Component)audioComponent).gameObject).name));
				}
				return audioComponent.allAudioLists.Count - 1;
			}
			Plugin.Logger.LogWarning((object)("no AudioList with name '" + ((Object)audioList).name + "' was found, returning first index in allAudioLists"));
			return 0;
		}

		public static AudioList AudioListGetNextInAllAudioLists(AudioList audioList, GameObject objectToCheck, bool printDebug = false, bool createListIfNull = true)
		{
			return AudioListGetNextInAllAudioLists(audioList, objectToCheck, printDebug, createListIfNull);
		}

		public static AudioList AudioListGetNextInAllAudioLists(AudioList audioList, SharedAudioComponent audioComponent, bool printDebug = false, bool createListIfNull = true)
		{
			if ((Object)(object)audioList == (Object)null || (Object)(object)audioComponent == (Object)null)
			{
				Plugin.Logger.LogWarning((object)"AudioListGetNextInAllAudioLists() was called with a null AudioList and/or SharedAudioComponent, please specify what next AudioList index to get on what SharedAudioComponent, returning null");
				return null;
			}
			CheckComponentListForNull(audioComponent, printDebug, createListIfNull);
			if (audioComponent.allAudioLists.Count == 0)
			{
				Plugin.Logger.LogWarning((object)("SharedAudioComponent on object '" + ((Object)((Component)audioComponent).gameObject).name + "' did not contain any AudioLists, returning null"));
				return null;
			}
			int num = AudioListGetIndex(audioList, audioComponent) + 1;
			if (num == audioComponent.allAudioLists.Count)
			{
				num = 0;
			}
			if (printDebug)
			{
				Plugin.Logger.LogDebug((object)$"returned next AudioList with name '{((Object)audioList).name}' on object {((Object)((Component)audioComponent).gameObject).name} at index [{num}]");
			}
			return audioComponent.allAudioLists[num];
		}

		public static bool AudioListContainsAudioClip(GameObject objectToCheck, AudioClip audioClip, bool printDebug = false, int weightToLookFor = -1)
		{
			if ((Object)(object)audioClip == (Object)null)
			{
				Plugin.Logger.LogWarning((object)"AudioListContainsAudioClip() called with a null AudioClip, please provide an AudioClip to search for, returning false");
				return false;
			}
			if ((Object)(object)objectToCheck == (Object)null)
			{
				Plugin.Logger.LogWarning((object)"AudioListContainsAudioClip called with a null GameObject, please specify what GameObject to search, returning false");
				return false;
			}
			SharedAudioComponent[] components = objectToCheck.GetComponents<SharedAudioComponent>();
			foreach (SharedAudioComponent audioComponent in components)
			{
				if (!AudioListContainsAudioClip(audioComponent, audioClip, printDebug, weightToLookFor))
				{
					continue;
				}
				if (printDebug)
				{
					if (weightToLookFor <= 0)
					{
						Plugin.Logger.LogDebug((object)("successfully found AudioClip with name '" + ((Object)audioClip).name + "' on object " + ((Object)objectToCheck).name));
					}
					else
					{
						Plugin.Logger.LogDebug((object)$"successfully found AudioClipWithWeight with AudioClip with name '{((Object)audioClip).name}' and weight {weightToLookFor} on object {((Object)objectToCheck).name}");
					}
				}
				return true;
			}
			if (printDebug)
			{
				if (weightToLookFor <= 0)
				{
					Plugin.Logger.LogDebug((object)("did not find AudioClip with name '" + ((Object)audioClip).name + "' on object " + ((Object)objectToCheck).name));
				}
				else
				{
					Plugin.Logger.LogDebug((object)$"did not find AudioClipWithWeight with AudioClip with name '{((Object)audioClip).name}' and weight {weightToLookFor} on object {((Object)objectToCheck).name}");
				}
			}
			return false;
		}

		public static bool AudioListContainsAudioClip(SharedAudioComponent audioComponent, AudioClip audioClip, bool printDebug = false, int weightToLookFor = -1)
		{
			if ((Object)(object)audioClip == (Object)null)
			{
				Plugin.Logger.LogWarning((object)"AudioListContainsAudioClip() called with a null AudioClip, please provide an AudioClip to search for, returning false");
				return false;
			}
			if ((Object)(object)audioComponent == (Object)null)
			{
				Plugin.Logger.LogWarning((object)"AudioListContainsAudioClip() called with a null SharedAudioComponent, please specify in what SharedAudioComponent to search, returning false");
				return false;
			}
			foreach (AudioList allAudioList in audioComponent.allAudioLists)
			{
				if (!AudioListContainsAudioClip(allAudioList, audioClip, printDebug, weightToLookFor))
				{
					continue;
				}
				if (printDebug)
				{
					if (weightToLookFor <= 0)
					{
						Plugin.Logger.LogDebug((object)("successfully found AudioClip with name '" + ((Object)audioClip).name + "' in SharedAudioComponent on object " + ((Object)((Component)audioComponent).gameObject).name));
					}
					else
					{
						Plugin.Logger.LogDebug((object)$"successfully found AudioClipWithWeight with AudioClip with name '{((Object)audioClip).name}' and weight {weightToLookFor} in SharedAudioComponent on object {((Object)((Component)audioComponent).gameObject).name}");
					}
				}
				return true;
			}
			if (printDebug)
			{
				if (weightToLookFor <= 0)
				{
					Plugin.Logger.LogDebug((object)("did not find AudioClip with name '" + ((Object)audioClip).name + "' in SharedAudioComponent on object " + ((Object)((Component)audioComponent).gameObject).name));
				}
				else
				{
					Plugin.Logger.LogDebug((object)$"did not find AudioClipWithWeight with AudioClip with name '{((Object)audioClip).name}' and weight {weightToLookFor} in SharedAudioComponent on object {((Object)((Component)audioComponent).gameObject).name}");
				}
			}
			return false;
		}

		public static bool AudioListContainsAudioClip(AudioList audioList, AudioClip audioClip, bool printDebug = false, int weightToLookFor = -1)
		{
			if ((Object)(object)audioClip == (Object)null)
			{
				Plugin.Logger.LogWarning((object)"AudioListContainsAudioClip() called with a null AudioClip, please provide an AudioClip to search for, returning false");
				return false;
			}
			if ((Object)(object)audioList == (Object)null)
			{
				Plugin.Logger.LogWarning((object)"AudioListContainsAudioClip() called with a null AudioList, please specify in what AudioList to search, returning false");
				return false;
			}
			foreach (AudioClipWithWeight weightedClips in audioList.weightedClipsList)
			{
				if (!((Object)(object)weightedClips.audioClip == (Object)(object)audioClip))
				{
					continue;
				}
				if (weightToLookFor <= 0)
				{
					if (printDebug)
					{
						Plugin.Logger.LogDebug((object)("successfully found AudioClip with name '" + ((Object)weightedClips.audioClip).name + "' in AudioList with name '" + ((Object)audioList).name + "'"));
					}
					return true;
				}
				if (weightedClips.weight == weightToLookFor)
				{
					if (printDebug)
					{
						Plugin.Logger.LogDebug((object)$"successfully found AudioClipWithWeight with AudioClip with name '{((Object)weightedClips.audioClip).name}' and weight {weightedClips.weight} in AudioList with name '{((Object)audioList).name}'");
					}
					return true;
				}
			}
			if (printDebug)
			{
				if (weightToLookFor <= 0)
				{
					Plugin.Logger.LogDebug((object)("did not find AudioClip with name '" + ((Object)audioClip).name + "' in AudioList with name '" + ((Object)audioList).name + "'"));
				}
				else
				{
					Plugin.Logger.LogDebug((object)$"did not find AudioClipWithWeight with AudioClip with name '{((Object)audioClip).name}' and weight {weightToLookFor} in AudioList with name '{((Object)audioList).name}'");
				}
			}
			return false;
		}

		public static void RemoveAudioList(AudioList audioList, GameObject objectToRemoveFrom, bool printDebug = false)
		{
			RemoveAudioList(audioList, GetSharedAudioComponent(objectToRemoveFrom, printDebug), printDebug);
		}

		public static void RemoveAudioList(AudioList audioList, SharedAudioComponent audioComponent, bool printDebug = false)
		{
			if ((Object)(object)audioList == (Object)null || (Object)(object)audioComponent == (Object)null)
			{
				Plugin.Logger.LogWarning((object)"RemoveAudioList() was called was a null AudioList and/or SharedAudioComponent, please specify what SharedAudioComponent to remove what AudioList from, returning");
				return;
			}
			if (printDebug)
			{
				Plugin.Logger.LogDebug((object)("received call to remove AudioList with name '" + ((Object)audioList).name + "' from allAudioLists on object " + ((Object)((Component)audioComponent).gameObject).name));
			}
			if (audioComponent.allAudioLists.Count == 0)
			{
				if (printDebug)
				{
					Plugin.Logger.LogDebug((object)("SharedAudioComponent on object " + ((Object)((Component)audioComponent).gameObject).name + " does not have any AudioLists to remove, returning"));
				}
				return;
			}
			int count = audioComponent.allAudioLists.Count;
			List<AudioList> list = new List<AudioList>();
			for (int i = 0; i < audioComponent.allAudioLists.Count; i++)
			{
				if ((Object)(object)audioComponent.allAudioLists[i] == (Object)(object)audioList)
				{
					list.Add(audioComponent.allAudioLists[i]);
				}
			}
			if (list.Count > 0)
			{
				foreach (AudioList item in list)
				{
					if (printDebug)
					{
						Plugin.Logger.LogDebug((object)$"removing AudioList at index '{item}' on object {((Object)((Component)audioComponent).gameObject).name}");
					}
					audioComponent.allAudioLists.Remove(item);
				}
			}
			int count2 = audioComponent.allAudioLists.Count;
			if (count > count2 && printDebug)
			{
				Plugin.Logger.LogDebug((object)$"removed {count - count2} AudioLists in SharedAudioComponent on object {((Object)((Component)audioComponent).gameObject).name}");
			}
		}

		public static void RemoveAudioClip(AudioClip audioClip, GameObject objectToRemoveFrom, bool printDebug = false)
		{
			RemoveAudioClip(audioClip, GetSharedAudioComponent(objectToRemoveFrom, printDebug), printDebug);
		}

		public static void RemoveAudioClip(AudioClip audioClip, SharedAudioComponent audioComponent, bool printDebug = false)
		{
			if ((Object)(object)audioComponent == (Object)null)
			{
				Plugin.Logger.LogWarning((object)"RemoveAudioClip() was called with a null SharedAudioComponent, please specify what AudioClip to remove from what SharedAudioComponent, returning");
				return;
			}
			if (printDebug)
			{
				Plugin.Logger.LogDebug((object)("received call to remove AudioClip with name '" + ((Object)audioClip).name + "' from SharedAudioComponent on object " + ((Object)((Component)audioComponent).gameObject).name));
			}
			if (audioComponent.allAudioLists.Count == 0)
			{
				if (printDebug)
				{
					Plugin.Logger.LogDebug((object)("SharedAudioComponent on object '" + ((Object)((Component)audioComponent).gameObject).name + "' does not have any AudioLists to remove AudioClips from, returning"));
				}
				return;
			}
			foreach (AudioList allAudioList in audioComponent.allAudioLists)
			{
				RemoveAudioClip(audioClip, allAudioList, printDebug);
			}
		}

		public static void RemoveAudioClip(AudioClip audioClip, AudioList audioList, bool printDebug = false)
		{
			if ((Object)(object)audioClip == (Object)null || (Object)(object)audioList == (Object)null)
			{
				Plugin.Logger.LogWarning((object)"RemoveAudioClip() was called with a null AudioClip and/or AudioList, please specify what AudioClip to remove from what AudioList, returning");
				return;
			}
			if (printDebug)
			{
				Plugin.Logger.LogDebug((object)("received call to remove AudioClip with name '" + ((Object)audioClip).name + "' from AudioList with name '" + ((Object)audioList).name + "'"));
			}
			if (audioList.weightedClipsList.Count == 0)
			{
				if (printDebug)
				{
					Plugin.Logger.LogDebug((object)("AudioList with name '" + ((Object)audioList).name + "' does not have any AudioClips to remove, returning"));
				}
				return;
			}
			int count = audioList.weightedClipsList.Count;
			List<AudioClipWithWeight> list = new List<AudioClipWithWeight>();
			for (int i = 0; i < audioList.weightedClipsList.Count; i++)
			{
				if ((Object)(object)audioList.weightedClipsList[i].audioClip == (Object)(object)audioClip)
				{
					list.Add(audioList.weightedClipsList[i]);
				}
			}
			if (list.Count > 0)
			{
				foreach (AudioClipWithWeight item in list)
				{
					if (printDebug)
					{
						Plugin.Logger.LogDebug((object)$"removing AudioClip with name '{item}' on AudioList with name '{((Object)audioList).name}'");
					}
					audioList.weightedClipsList.Remove(item);
				}
			}
			int count2 = audioList.weightedClipsList.Count;
			if (count > count2 && printDebug)
			{
				Plugin.Logger.LogDebug((object)$"removed {count - count2} AudioClips in AudioList with name '{((Object)audioList).name}'");
			}
		}

		public static void RemoveAudioClipRange(AudioClip[] audioClips, GameObject objectToRemoveFrom, bool printDebug = false)
		{
			RemoveAudioClipRange(audioClips, GetSharedAudioComponent(objectToRemoveFrom, printDebug), printDebug);
		}

		public static void RemoveAudioClipRange(AudioClip[] audioClips, SharedAudioComponent audioComponent, bool printDebug = false)
		{
			if (audioClips == null || audioClips.Length == 0 || (Object)(object)audioComponent == (Object)null)
			{
				Plugin.Logger.LogWarning((object)"RemoveAudioClipRange() was called with a null AudioClip array, an AudioClip array with no AudioClips, or a null SharedAudioComponent, please specify which AudioClips to remove from which SharedAudioComponent, returning");
				return;
			}
			foreach (AudioClip audioClip in audioClips)
			{
				RemoveAudioClip(audioClip, audioComponent, printDebug);
			}
		}

		public static void RemoveAudioClipRange(AudioClip[] audioClips, AudioList audioList, bool printDebug = false)
		{
			if (audioClips == null || audioClips.Length == 0 || (Object)(object)audioList == (Object)null)
			{
				Plugin.Logger.LogWarning((object)"RemoveAudioClipRange() was called with a null AudioClip array, an AudioClip array with no AudioClips, or a null AudioList, please specify which AudioClips to remove from which AudioList, returning");
				return;
			}
			foreach (AudioClip audioClip in audioClips)
			{
				RemoveAudioClip(audioClip, audioList, printDebug);
			}
		}

		public static void RemoveDuplicates(GameObject objectToRemoveFrom, bool printDebug = false, bool removeDuplicateAudioClipsWithDifferentWeight = true)
		{
			RemoveDuplicates(GetSharedAudioComponent(objectToRemoveFrom, printDebug), printDebug, removeDuplicateAudioClipsWithDifferentWeight);
		}

		public static void RemoveDuplicates(SharedAudioComponent audioComponent, bool printDebug = false, bool removeDuplicateAudioClipsWithDifferentWeight = true)
		{
			if ((Object)(object)audioComponent == (Object)null)
			{
				Plugin.Logger.LogWarning((object)"RemoveDuplicates() was called with a null SharedAudioComponent, please specify what SharedAudioComponent to remove duplicates from, returning");
				return;
			}
			if (printDebug)
			{
				Plugin.Logger.LogDebug((object)$"received call to remove duplicates with removeDuplicateClipsWithDifferentWeight {removeDuplicateAudioClipsWithDifferentWeight} in SharedAudioComponent on object {((Object)((Component)audioComponent).gameObject).name}");
			}
			if (audioComponent.allAudioLists.Count <= 1)
			{
				if (printDebug)
				{
					Plugin.Logger.LogDebug((object)("SharedAudioComponent on object " + ((Object)((Component)audioComponent).gameObject).name + " does not contain enough AudioLists to have any duplicates, returning"));
				}
				return;
			}
			int count = audioComponent.allAudioLists.Count;
			List<AudioList> list = new List<AudioList>();
			for (int i = 0; i < audioComponent.allAudioLists.Count; i++)
			{
				for (int j = 0; j < audioComponent.allAudioLists.Count; j++)
				{
					if (j > i && audioComponent.allAudioLists[i].weightedClipsList.Count == audioComponent.allAudioLists[j].weightedClipsList.Count && DoAudioListsMatch(audioComponent.allAudioLists[i].weightedClipsList, audioComponent.allAudioLists[j].weightedClipsList, removeDuplicateAudioClipsWithDifferentWeight))
					{
						list.Add(audioComponent.allAudioLists[j]);
					}
				}
			}
			if (list.Count > 0)
			{
				foreach (AudioList item in list)
				{
					if (printDebug)
					{
						Plugin.Logger.LogDebug((object)$"removing duplicate AudioList with name '{item}' on object {((Object)((Component)audioComponent).gameObject).name}");
					}
					audioComponent.allAudioLists.Remove(item);
				}
			}
			int count2 = audioComponent.allAudioLists.Count;
			if (count > count2 && printDebug)
			{
				Plugin.Logger.LogDebug((object)$"removed {count - count2} duplicates in SharedAudioComponent on object {((Object)((Component)audioComponent).gameObject).name}");
			}
		}

		public static void RemoveDuplicates(AudioList audioList, bool printDebug = false, bool removeDuplicateAudioClipsWithDifferentWeight = true)
		{
			if ((Object)(object)audioList == (Object)null)
			{
				Plugin.Logger.LogWarning((object)"RemoveDuplicates() was called with a null AudioList, please specify what AudioList to remove duplicates from, returning");
				return;
			}
			if (printDebug)
			{
				Plugin.Logger.LogDebug((object)$"received call to remove duplicates with removeDuplicateClipsWithDifferentWeight {removeDuplicateAudioClipsWithDifferentWeight} in AudioList with name '{((Object)audioList).name}'");
			}
			if (audioList.weightedClipsList.Count <= 1)
			{
				if (printDebug)
				{
					Plugin.Logger.LogDebug((object)("AudioList with name '" + ((Object)audioList).name + "' does not contain enough AudioClipsWithWeight to have any duplicates, returning"));
				}
				return;
			}
			int count = audioList.weightedClipsList.Count;
			List<AudioClipWithWeight> list = new List<AudioClipWithWeight>();
			for (int i = 0; i < audioList.weightedClipsList.Count; i++)
			{
				for (int j = 0; j < audioList.weightedClipsList.Count; j++)
				{
					if (j > i && ((removeDuplicateAudioClipsWithDifferentWeight && (Object)(object)audioList.weightedClipsList[i].audioClip == (Object)(object)audioList.weightedClipsList[j].audioClip) || (!removeDuplicateAudioClipsWithDifferentWeight && (Object)(object)audioList.weightedClipsList[i].audioClip == (Object)(object)audioList.weightedClipsList[j].audioClip && audioList.weightedClipsList[i].weight == audioList.weightedClipsList[j].weight)))
					{
						list.Add(audioList.weightedClipsList[j]);
					}
				}
			}
			if (list.Count > 0)
			{
				foreach (AudioClipWithWeight item in list)
				{
					if (printDebug)
					{
						Plugin.Logger.LogDebug((object)$"removing duplicate AudioClip with name '{item}' on AudioList with name '{((Object)audioList).name}'");
					}
					audioList.weightedClipsList.Remove(item);
				}
			}
			int count2 = audioList.weightedClipsList.Count;
			if (count > count2 && printDebug)
			{
				Plugin.Logger.LogDebug((object)$"removed {count - count2} duplicates in AudioList with name '{((Object)audioList).name}'");
			}
		}

		public static void RemoveNull(GameObject objectToRemoveFrom, AudioList audioList, bool printDebug = false, bool removeNullAudioClips = true, bool removeEmptyAudioLists = true)
		{
			RemoveNull(GetSharedAudioComponent(objectToRemoveFrom, printDebug), printDebug, AudioListGetIndex(audioList, GetSharedAudioComponent(objectToRemoveFrom, printDebug), printDebug), removeNullAudioClips, removeEmptyAudioLists);
		}

		public static void RemoveNull(SharedAudioComponent audioComponent, AudioList audioList, bool printDebug = false, bool removeNullAudioClips = true, bool removeEmptyAudioLists = true)
		{
			RemoveNull(audioComponent, printDebug, AudioListGetIndex(audioList, audioComponent, printDebug), removeNullAudioClips, removeEmptyAudioLists);
		}

		public static void RemoveNull(GameObject objectToRemoveFrom, bool printDebug = false, int indexListToClear = -1, bool removeNullAudioClips = true, bool removeEmptyAudioLists = true)
		{
			RemoveNull(GetSharedAudioComponent(objectToRemoveFrom, printDebug), printDebug, indexListToClear, removeNullAudioClips, removeEmptyAudioLists);
		}

		public static void RemoveNull(SharedAudioComponent audioComponent, bool printDebug = false, int indexListToClear = -1, bool removeNullAudioClips = true, bool removeEmptyAudioLists = true)
		{
			if ((Object)(object)audioComponent == (Object)null)
			{
				Plugin.Logger.LogWarning((object)"RemoveNull() was called with a null SharedAudioComponent, please specify what SharedAudioComponent to remove null from, returning");
				return;
			}
			if (printDebug)
			{
				Plugin.Logger.LogDebug((object)$"received call to removeNull {removeNullAudioClips} and removeEmpty {removeEmptyAudioLists} in SharedAudioComponent on object {((Object)((Component)audioComponent).gameObject).name} at index [{indexListToClear}]");
			}
			List<AudioList> list = new List<AudioList>();
			if (indexListToClear < 0)
			{
				foreach (AudioList allAudioList in audioComponent.allAudioLists)
				{
					int num = 0;
					if (removeNullAudioClips)
					{
						num = GoThroughListToRemoveNull(allAudioList);
					}
					if (num != 0 && printDebug)
					{
						Plugin.Logger.LogDebug((object)$"removed {num} null in AudioList with name '{((Object)allAudioList).name}' on object {((Object)((Component)audioComponent).gameObject).name}");
					}
					if (allAudioList.weightedClipsList.Count == 0 && removeEmptyAudioLists)
					{
						if (printDebug)
						{
							Plugin.Logger.LogDebug((object)("AudioList with name '" + ((Object)allAudioList).name + "' on object " + ((Object)audioComponent).name + " did not have any audioClips, removing AudioList from allAudioLists"));
						}
						list.Add(allAudioList);
					}
				}
			}
			else
			{
				int num2 = 0;
				if (removeNullAudioClips)
				{
					num2 = GoThroughListToRemoveNull(audioComponent.allAudioLists[indexListToClear]);
				}
				if (num2 != 0 && printDebug)
				{
					Plugin.Logger.LogDebug((object)$"removed {num2} null in AudioList with name '{((Object)audioComponent.allAudioLists[indexListToClear]).name}' on object {((Object)((Component)audioComponent).gameObject).name}");
				}
				if (audioComponent.allAudioLists[indexListToClear].weightedClipsList.Count == 0 && removeEmptyAudioLists)
				{
					if (printDebug)
					{
						Plugin.Logger.LogDebug((object)("AudioList with name '" + ((Object)audioComponent.allAudioLists[indexListToClear]).name + "' on object " + ((Object)audioComponent).name + " did not have any audioClips, removing AudioList from allAudioLists"));
					}
					list.Add(audioComponent.allAudioLists[indexListToClear]);
				}
			}
			if (list.Count <= 0)
			{
				return;
			}
			foreach (AudioList item in list)
			{
				audioComponent.allAudioLists.Remove(item);
			}
		}

		public static void RemoveLoadType(GameObject objectToRemoveFrom, AudioClipLoadType loadType, AudioList audioList, bool printDebug = false)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			RemoveLoadType(GetSharedAudioComponent(objectToRemoveFrom, printDebug), loadType, printDebug, AudioListGetIndex(audioList, GetSharedAudioComponent(objectToRemoveFrom, printDebug), printDebug));
		}

		public static void RemoveLoadType(SharedAudioComponent audioComponent, AudioClipLoadType loadType, AudioList audioList, bool printDebug = false)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			RemoveLoadType(audioComponent, loadType, printDebug, AudioListGetIndex(audioList, audioComponent, printDebug));
		}

		public static void RemoveLoadType(GameObject objectToRemoveFrom, AudioClipLoadType loadType, bool printDebug = false, int indexListToClear = -1)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			RemoveLoadType(GetSharedAudioComponent(objectToRemoveFrom, printDebug), loadType, printDebug, indexListToClear);
		}

		public static void RemoveLoadType(SharedAudioComponent audioComponent, AudioClipLoadType loadType, bool printDebug = false, int indexListToClear = -1)
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)audioComponent == (Object)null)
			{
				Plugin.Logger.LogWarning((object)"RemoveLoadType() was called with a null SharedAudioComponent, please specify what SharedAudioComponent to remove AudioClipLoadTypes from, returning");
				return;
			}
			if (printDebug)
			{
				Plugin.Logger.LogDebug((object)$"received call to remove AudioClipLoadType {loadType} in SharedAudioComponent on object {((Object)((Component)audioComponent).gameObject).name} at index [{indexListToClear}]");
			}
			if (indexListToClear < 0)
			{
				foreach (AudioList allAudioList in audioComponent.allAudioLists)
				{
					int num = GoThroughListToRemoveLoadTypes(allAudioList, loadType);
					if (num != 0 && printDebug)
					{
						Plugin.Logger.LogDebug((object)$"removed {num} AudioClips with AudioClipLoadType {loadType} in AudioList with name '{((Object)allAudioList).name}' on object {((Object)((Component)audioComponent).gameObject).name}");
					}
				}
				return;
			}
			int num2 = GoThroughListToRemoveLoadTypes(audioComponent.allAudioLists[indexListToClear], loadType);
			if (num2 != 0 && printDebug)
			{
				Plugin.Logger.LogDebug((object)$"removed {num2} AudioClips with AudioClipLoadType {loadType} in AudioList with name '{((Object)audioComponent.allAudioLists[indexListToClear]).name}' on object {((Object)((Component)audioComponent).gameObject).name}");
			}
		}

		public static AudioClip AudioClipAddNew(AudioClip newAudioClip, GameObject objectToAdd, bool printDebug = false, int audioClipWeight = 100, bool allowDuplicates = false)
		{
			return AudioClipAddNew(newAudioClip, AudioListGetDefault(GetSharedAudioComponent(objectToAdd, printDebug), printDebug), printDebug, audioClipWeight, allowDuplicates);
		}

		public static AudioClip AudioClipAddNew(AudioClip newAudioClip, SharedAudioComponent audioComponent, bool printDebug = false, int audioClipWeight = 100, bool allowDuplicates = false)
		{
			return AudioClipAddNew(newAudioClip, AudioListGetDefault(audioComponent), printDebug, audioClipWeight, allowDuplicates);
		}

		public static AudioClip AudioClipAddNew(AudioClip newAudioClip, AudioList audioList, bool printDebug = false, int audioClipWeight = 100, bool allowDuplicates = false)
		{
			if ((Object)(object)newAudioClip == (Object)null || (Object)(object)audioList == (Object)null)
			{
				Plugin.Logger.LogWarning((object)"AudioClipAddNew() was called with a null AudioClip and/or AudioList, please specify what AudioClip to add to what AudioList");
				return null;
			}
			if (!allowDuplicates)
			{
				foreach (AudioClipWithWeight weightedClips in audioList.weightedClipsList)
				{
					if ((Object)(object)weightedClips.audioClip == (Object)(object)newAudioClip && weightedClips.weight == audioClipWeight)
					{
						if (printDebug)
						{
							Plugin.Logger.LogDebug((object)$"AudioList with name '{((Object)audioList).name}' already contained an AudioClipWithWeight with name and weight '{((Object)newAudioClip).name} // {audioClipWeight}', skipping adding a duplicate instance");
						}
						return null;
					}
				}
			}
			AudioClipWithWeight audioClipWithWeight = ScriptableObject.CreateInstance<AudioClipWithWeight>();
			audioClipWithWeight.audioClip = newAudioClip;
			if (audioClipWeight <= 0)
			{
				audioClipWithWeight.weight = 100;
				Plugin.Logger.LogWarning((object)$"AudioClipAddNew() was called with an invalid audioClipWeight value of {audioClipWeight}, only positive values above zero allowed, adding new AudioClip with weight {audioClipWithWeight.weight}");
			}
			else
			{
				audioClipWithWeight.weight = audioClipWeight;
			}
			((Object)audioClipWithWeight).name = $"{((Object)newAudioClip).name} // {audioClipWithWeight.weight}";
			audioList.weightedClipsList.Add(audioClipWithWeight);
			if (printDebug)
			{
				Plugin.Logger.LogDebug((object)$"added AudioClipWithWeight with name and weight '{((Object)audioClipWithWeight).name}' to AudioList with name '{((Object)audioList).name}' at index [{audioList.weightedClipsList.Count - 1}]");
			}
			return newAudioClip;
		}

		public static AudioClip[] AudioClipAddNewRange(AudioClip[] audioClips, GameObject objectToAdd, bool printDebug = false, int audioClipWeight = 100, bool allowDuplicates = false)
		{
			return AudioClipAddNewRange(audioClips, AudioListGetDefault(GetSharedAudioComponent(objectToAdd, printDebug), printDebug), printDebug, audioClipWeight, allowDuplicates);
		}

		public static AudioClip[] AudioClipAddNewRange(AudioClip[] audioClips, SharedAudioComponent audioComponent, bool printDebug = false, int audioClipWeight = 100, bool allowDuplicates = false)
		{
			return AudioClipAddNewRange(audioClips, AudioListGetDefault(audioComponent, printDebug), printDebug, audioClipWeight, allowDuplicates);
		}

		public static AudioClip[] AudioClipAddNewRange(AudioClip[] audioClips, AudioList audioList, bool printDebug = false, int audioClipWeight = 100, bool allowDuplicates = false)
		{
			if (audioClips == null || (Object)(object)audioList == (Object)null || audioClips.Length == 0)
			{
				Plugin.Logger.LogWarning((object)"AudioClipAddNewRange() was called with either a null AudioClip array, an empty AudioClip array, or a null AudioList, please provide a valid AudioClip array and what AudioList to add it to");
				return audioClips;
			}
			foreach (AudioClip newAudioClip in audioClips)
			{
				AudioClipAddNew(newAudioClip, audioList, printDebug, audioClipWeight, allowDuplicates);
			}
			return audioClips;
		}

		public static AudioClip[] AudioClipAddNewRangeCapped(AudioClip[] audioClips, GameObject objectToAdd, bool printDebug = false, int amountToAdd = 0, int audioClipWeight = 100, bool randomize = false, bool allowDuplicates = false)
		{
			return AudioClipAddNewRangeCapped(audioClips, AudioListGetDefault(GetSharedAudioComponent(objectToAdd, printDebug), printDebug), printDebug, amountToAdd, audioClipWeight, randomize, allowDuplicates);
		}

		public static AudioClip[] AudioClipAddNewRangeCapped(AudioClip[] audioClips, SharedAudioComponent audioComponent, bool printDebug = false, int amountToAdd = 0, int audioClipWeight = 100, bool randomize = false, bool allowDuplicates = false)
		{
			return AudioClipAddNewRangeCapped(audioClips, AudioListGetDefault(audioComponent, printDebug), printDebug, amountToAdd, audioClipWeight, randomize, allowDuplicates);
		}

		public static AudioClip[] AudioClipAddNewRangeCapped(AudioClip[] audioClips, AudioList audioList, bool printDebug = false, int amountToAdd = 0, int audioClipWeight = 100, bool randomize = false, bool allowDuplicates = false)
		{
			if (audioClips == null || (Object)(object)audioList == (Object)null || audioClips.Length == 0)
			{
				Plugin.Logger.LogWarning((object)"AudioClipAddNewRangeCapped() was called with either a null AudioClip array, an empty AudioClip array, or a null AudioList, please provide a valid AudioClip array and what AudioList to add it to");
				return audioClips;
			}
			if (amountToAdd > audioClips.Length)
			{
				Plugin.Logger.LogWarning((object)"AudioClipAddNewRangeCapped() was called with an amountToAdd larger than the length of the AudioClips array, adding all AudioClips in the given array");
				amountToAdd = audioClips.Length;
			}
			else if (amountToAdd <= 0)
			{
				Plugin.Logger.LogWarning((object)"AudioClipAddNewRangeCapped() was called with an amountToAdd smaller than one, getting a new random amountToAdd");
				amountToAdd = Random.Range(0, audioClips.Length);
			}
			List<AudioClip> list = new List<AudioClip>();
			if (randomize)
			{
				List<int> list2 = new List<int>();
				for (int i = 0; i < audioClips.Length; i++)
				{
					list2.Add(i);
				}
				for (int j = 0; j < amountToAdd; j++)
				{
					int index = Random.Range(0, list2.Count);
					list.Add(AudioClipAddNew(audioClips[list2[index]], audioList, printDebug, audioClipWeight, allowDuplicates));
					list2.RemoveAt(index);
				}
			}
			else
			{
				for (int k = 0; k < amountToAdd; k++)
				{
					list.Add(AudioClipAddNew(audioClips[k], audioList, printDebug, audioClipWeight, allowDuplicates));
				}
			}
			if (printDebug)
			{
				Plugin.Logger.LogDebug((object)$"added random range of AudioClips with a length of {list.Count} to AudioList with name '{((Object)audioList).name}' with a randomize value of {randomize}");
			}
			return list.ToArray();
		}

		public static AudioClip AudioClipGetByName(string nameClipToSearch, GameObject objectToCheck, bool printDebug = false)
		{
			return AudioClipGetByName(nameClipToSearch, GetSharedAudioComponent(objectToCheck, printDebug), printDebug);
		}

		public static AudioClip AudioClipGetByName(string nameClipToSearch, SharedAudioComponent audioComponent, bool printDebug = false)
		{
			if (nameClipToSearch == null || (Object)(object)audioComponent == (Object)null)
			{
				Plugin.Logger.LogWarning((object)"AudioClipGetByNameFromAnyList() was called with a null nameClipToSearch and/or AudioComponent, please specify what name to search for on what SharedAudioComponent, returning null");
				return null;
			}
			if (audioComponent.allAudioLists.Count == 0)
			{
				Plugin.Logger.LogWarning((object)("SharedAudioComponent on object '" + ((Object)((Component)audioComponent).gameObject).name + "' did not contain any AudioLists, returning null"));
				return null;
			}
			for (int i = 0; i < audioComponent.allAudioLists.Count; i++)
			{
				for (int j = 0; j < audioComponent.allAudioLists[i].weightedClipsList.Count; j++)
				{
					if (((Object)audioComponent.allAudioLists[i].weightedClipsList[j].audioClip).name == nameClipToSearch)
					{
						if (printDebug)
						{
							Plugin.Logger.LogDebug((object)$"returned AudioClip with name '{((Object)audioComponent.allAudioLists[i].weightedClipsList[j].audioClip).name}' in AudioList with name '{((Object)audioComponent.allAudioLists[i]).name}' at index [{j}] on object '{((Object)((Component)audioComponent).gameObject).name}'");
						}
						return audioComponent.allAudioLists[i].weightedClipsList[j].audioClip;
					}
				}
			}
			Plugin.Logger.LogWarning((object)("no AudioClip with name '" + nameClipToSearch + "' was found on object " + ((Object)((Component)audioComponent).gameObject).name + ", returning null"));
			return null;
		}

		public static AudioClip AudioClipGetByName(string nameClipToSearch, AudioList audioList, bool printDebug = false)
		{
			if (nameClipToSearch == null || (Object)(object)audioList == (Object)null)
			{
				Plugin.Logger.LogWarning((object)"AudioClipGetByname() was called with a null nameClipToSearch and/or AudioList, please specify what name to search for in what AudioList, returning null");
				return null;
			}
			if (audioList.weightedClipsList.Count == 0)
			{
				Plugin.Logger.LogWarning((object)("AudioList with name '" + ((Object)audioList).name + "' did not contain any AudioClips, returning null"));
				return null;
			}
			for (int i = 0; i < audioList.weightedClipsList.Count; i++)
			{
				if (((Object)audioList.weightedClipsList[i].audioClip).name == nameClipToSearch)
				{
					if (printDebug)
					{
						Plugin.Logger.LogDebug((object)("returned AudioClip with name '" + ((Object)audioList.weightedClipsList[i].audioClip).name + "' in AudioList with name '" + ((Object)audioList).name + "'"));
					}
					return audioList.weightedClipsList[i].audioClip;
				}
			}
			Plugin.Logger.LogWarning((object)("no AudioClip with name '" + nameClipToSearch + "' was found in AudioList with name '" + ((Object)audioList).name + "', returning null"));
			return null;
		}

		public static AudioClip AudioClipGetNextInAudioList(AudioClip audioClip, GameObject objectToCheck, bool printDebug = false)
		{
			return AudioClipGetNextInAudioList(audioClip, GetSharedAudioComponent(objectToCheck, printDebug), printDebug);
		}

		public static AudioClip AudioClipGetNextInAudioList(AudioClip audioClip, SharedAudioComponent audioComponent, bool printDebug = false)
		{
			return AudioClipGetNextInAudioList(audioClip, AudioClipGetAudioList(audioClip, audioComponent, printDebug), printDebug);
		}

		public static AudioClip AudioClipGetNextInAudioList(AudioClip audioClip, AudioList audioList, bool printDebug = false)
		{
			if ((Object)(object)audioList == (Object)null)
			{
				Plugin.Logger.LogWarning((object)"AudioClipGetNextInAudioList() was called with a null AudioList, please specify what AudioList to get a next AudioClip from, returning null");
				return null;
			}
			if (audioList.weightedClipsList.Count == 0)
			{
				Plugin.Logger.LogWarning((object)("AudioList with name '" + ((Object)audioList).name + "' did not contain any AudioClips, returning null"));
				return null;
			}
			if ((Object)(object)audioClip == (Object)null)
			{
				if (printDebug)
				{
					Plugin.Logger.LogDebug((object)("AudioClip given to GetAudioClipNextInAudioList() was null, returning first song in AudioList with name '" + ((Object)audioList).name + "'"));
				}
				return audioList.weightedClipsList[0].audioClip;
			}
			int num = -1;
			for (int i = 0; i < audioList.weightedClipsList.Count; i++)
			{
				if ((Object)(object)audioList.weightedClipsList[i].audioClip == (Object)(object)audioClip)
				{
					num = i;
					break;
				}
			}
			int num2 = num + 1;
			if (num2 == audioList.weightedClipsList.Count)
			{
				num2 = 0;
			}
			if (printDebug)
			{
				Plugin.Logger.LogDebug((object)$"returned next AudioClip with name '{((Object)audioList.weightedClipsList[num2].audioClip).name}' in AudioList with name '{((Object)audioList).name}' at index [{num2}]");
			}
			return audioList.weightedClipsList[num2].audioClip;
		}

		public static AudioClip AudioClipGetRandom(GameObject objectToCheck, bool printDebug = false)
		{
			return AudioClipGetRandom(AudioListGetRandom(GetSharedAudioComponent(objectToCheck, printDebug), printDebug), printDebug);
		}

		public static AudioClip AudioClipGetRandom(SharedAudioComponent audioComponent, bool printDebug = false)
		{
			return AudioClipGetRandom(AudioListGetRandom(audioComponent, printDebug), printDebug);
		}

		public static AudioClip AudioClipGetRandom(AudioList audioList, bool printDebug = false)
		{
			if ((Object)(object)audioList == (Object)null)
			{
				Plugin.Logger.LogWarning((object)"AudioClipGetRandom() was called with a null AudioList, please specify what AudioList to get a random AudioClip from, returning null");
				return null;
			}
			if (audioList.weightedClipsList.Count == 0)
			{
				Plugin.Logger.LogWarning((object)("AudioList with name '" + ((Object)audioList).name + "' did not contain any AudioClips, returning null"));
				return null;
			}
			int num = Random.Range(0, audioList.weightedClipsList.Count);
			if (printDebug)
			{
				Plugin.Logger.LogDebug((object)$"returned random AudioClip with name '{((Object)audioList.weightedClipsList[num].audioClip).name}' in AudioList with name '{((Object)audioList).name}' at index [{num}]");
			}
			return audioList.weightedClipsList[num].audioClip;
		}

		public static AudioClip AudioClipGetRandomByWeight(GameObject objectToCheck, bool printDebug = false)
		{
			return AudioClipGetRandomByWeight(AudioListGetRandomByWeight(GetSharedAudioComponent(objectToCheck, printDebug), printDebug), printDebug);
		}

		public static AudioClip AudioClipGetRandomByWeight(SharedAudioComponent audioComponent, bool printDebug = false)
		{
			return AudioClipGetRandomByWeight(AudioListGetRandomByWeight(audioComponent, printDebug), printDebug);
		}

		public static AudioClip AudioClipGetRandomByWeight(AudioList audioList, bool printDebug = false)
		{
			if ((Object)(object)audioList == (Object)null)
			{
				Plugin.Logger.LogWarning((object)"AudioClipGetRandomByWeight() was called with a null AudioList, please specify what AudioList to get a random weighted AudioClip from, returning null");
				return null;
			}
			int num = AddUpAllWeights(null, audioList);
			if (printDebug)
			{
				Plugin.Logger.LogDebug((object)$"got totalWeight {num} from AudioList with name '{((Object)audioList).name}'");
			}
			int num2 = Random.Range(0, num + 1);
			int num3 = 0;
			int num4 = -1;
			for (int i = 0; i < audioList.weightedClipsList.Count; i++)
			{
				num3 += audioList.weightedClipsList[i].weight;
				if (num2 > num4 && num2 <= num3)
				{
					if (printDebug)
					{
						Plugin.Logger.LogDebug((object)$"returned random AudioClip with name '{((Object)audioList.weightedClipsList[i].audioClip).name}' at index [{i}] on AudioList with name '{((Object)audioList).name}' after getting random weight {num2}");
					}
					return audioList.weightedClipsList[i].audioClip;
				}
			}
			Plugin.Logger.LogWarning((object)$"error occured while looking for random weight {num2} in AudioList with name '{((Object)audioList).name}', returning null");
			return null;
		}

		public static AudioClip[] AudioClipGetAll(GameObject objectToCheck, bool printDebug = false, int indexListToSearch = -1)
		{
			return AudioClipGetAll(GetSharedAudioComponent(objectToCheck, printDebug), printDebug, indexListToSearch);
		}

		public static AudioClip[] AudioClipGetAll(SharedAudioComponent audioComponent, bool printDebug = false, int indexListToSearch = -1)
		{
			HashSet<AudioClip> hashSet = new HashSet<AudioClip>();
			if (indexListToSearch < 0)
			{
				for (int i = 0; i < audioComponent.allAudioLists.Count; i++)
				{
					AudioClip[] array = AudioClipGetAll(audioComponent.allAudioLists[i], printDebug);
					foreach (AudioClip item in array)
					{
						hashSet.Add(item);
					}
				}
			}
			else
			{
				AudioClip[] array2 = AudioClipGetAll(audioComponent.allAudioLists[indexListToSearch], printDebug);
				foreach (AudioClip item2 in array2)
				{
					hashSet.Add(item2);
				}
			}
			if (hashSet.Count > 0)
			{
				if (printDebug)
				{
					Plugin.Logger.LogDebug((object)$"returned array of AudioClips with length {hashSet.Count} from object '{((Object)((Component)audioComponent).gameObject).name}'");
				}
				return hashSet.ToArray();
			}
			Plugin.Logger.LogWarning((object)("no array of AudioClips to return found on object '" + ((Object)((Component)audioComponent).gameObject).name + "', returning null"));
			return null;
		}

		public static AudioClip[] AudioClipGetAll(AudioList audioList, bool printDebug = false)
		{
			HashSet<AudioClip> hashSet = new HashSet<AudioClip>();
			foreach (AudioClipWithWeight weightedClips in audioList.weightedClipsList)
			{
				if ((Object)(object)weightedClips.audioClip != (Object)null)
				{
					hashSet.Add(weightedClips.audioClip);
				}
			}
			if (hashSet.Count > 0)
			{
				if (printDebug)
				{
					Plugin.Logger.LogDebug((object)$"returned array of AudioClips with length {hashSet.Count} from AudioList with name '{((Object)audioList).name}'");
				}
				return hashSet.ToArray();
			}
			Plugin.Logger.LogWarning((object)("no array of AudioClips to return found on AudioList with name '" + ((Object)audioList).name + "', returning null"));
			return null;
		}

		public static int AudioClipGetIndex(AudioClip audioClip, GameObject objectToCheck, bool printDebug = false)
		{
			return AudioClipGetIndex(audioClip, AudioClipGetAudioList(audioClip, objectToCheck), printDebug);
		}

		public static int AudioClipGetIndex(AudioClip audioClip, SharedAudioComponent audioComponent, bool printDebug = false)
		{
			return AudioClipGetIndex(audioClip, AudioClipGetAudioList(audioClip, audioComponent, printDebug), printDebug);
		}

		public static int AudioClipGetIndex(AudioClip audioClip, AudioList audioList, bool printDebug = false)
		{
			if ((Object)(object)audioClip == (Object)null || (Object)(object)audioList == (Object)null)
			{
				Plugin.Logger.LogWarning((object)"AudioClipGetIndex() was called with a null AudioClip and/or AudioList, please specify what AudioClip to get an index from in what AudioList, returning null");
				return 0;
			}
			if (audioList.weightedClipsList.Count == 0)
			{
				Plugin.Logger.LogWarning((object)("AudioList with name '" + ((Object)audioList).name + "' did not contain any AudioClips, returning null"));
				return 0;
			}
			for (int i = 0; i < audioList.weightedClipsList.Count; i++)
			{
				if ((Object)(object)audioList.weightedClipsList[i].audioClip == (Object)(object)audioClip)
				{
					if (printDebug)
					{
						Plugin.Logger.LogDebug((object)$"returned index [{i}] for AudioClip with name '{((Object)audioClip).name}' in AudioList with name '{((Object)audioList).name}'");
					}
					return i;
				}
			}
			Plugin.Logger.LogWarning((object)("no AudioClip with name '" + ((Object)audioClip).name + "' was found in AudioList with name '" + ((Object)audioList).name + "', returning first index in AudioList with name '" + ((Object)audioList).name + "'"));
			return 0;
		}

		public static AudioClipWithWeight AudioClipGetAudioClipWithWeight(AudioClip audioClip, GameObject objectToCheck, bool printDebug = false)
		{
			return AudioClipGetAudioClipWithWeight(audioClip, GetSharedAudioComponent(objectToCheck, printDebug), printDebug);
		}

		public static AudioClipWithWeight AudioClipGetAudioClipWithWeight(AudioClip audioClip, SharedAudioComponent audioComponent, bool printDebug = false)
		{
			if ((Object)(object)audioClip == (Object)null || (Object)(object)audioComponent == (Object)null)
			{
				Plugin.Logger.LogWarning((object)"AudioClipGetAudioClipWithWeight() was called with a null AudioClip and/or SharedAudioComponent, please specify what AudioClipWithWeight to get its AudioClipWithWeight from what SharedAudioComponent, returning null");
				return null;
			}
			if (audioComponent.allAudioLists.Count == 0)
			{
				Plugin.Logger.LogWarning((object)("SharedAudioComponent on object " + ((Object)((Component)audioComponent).gameObject).name + " does not contain any AudioLists to get AudioClipWithWeights from, returning null"));
				return null;
			}
			AudioClipWithWeight audioClipWithWeight = null;
			foreach (AudioList allAudioList in audioComponent.allAudioLists)
			{
				audioClipWithWeight = AudioClipGetAudioClipWithWeight(audioClip, allAudioList, printDebug);
				if ((Object)(object)audioClipWithWeight != (Object)null)
				{
					break;
				}
			}
			if ((Object)(object)audioClipWithWeight == (Object)null)
			{
				Plugin.Logger.LogWarning((object)("no AudioClipWithWeight was found for AudioClip with name '" + ((Object)audioClip).name + "', returning null"));
			}
			if (printDebug)
			{
				Plugin.Logger.LogDebug((object)("returning AudioClipWithWeight with name '" + ((Object)audioClipWithWeight).name + "'"));
			}
			return audioClipWithWeight;
		}

		public static AudioClipWithWeight AudioClipGetAudioClipWithWeight(AudioClip audioClip, AudioList audioList, bool printDebug = false)
		{
			if ((Object)(object)audioClip == (Object)null || (Object)(object)audioList == (Object)null)
			{
				Plugin.Logger.LogWarning((object)"AudioClipGetAudioClipWithWeight() was called with a null AudioClip and/or AudioList, please specify what AudioClip to get its AudioClipWithWeight from what AudioList, returning null");
				return null;
			}
			if (audioList.weightedClipsList.Count == 0)
			{
				Plugin.Logger.LogWarning((object)("AudioList with name '" + ((Object)audioList).name + "' did not contain any AudioClipWithWeights, returning null"));
				return null;
			}
			for (int i = 0; i < audioList.weightedClipsList.Count; i++)
			{
				if ((Object)(object)audioList.weightedClipsList[i].audioClip == (Object)(object)audioClip)
				{
					if (printDebug)
					{
						Plugin.Logger.LogDebug((object)$"returned AudioClipWithWeight with name '{((Object)audioList.weightedClipsList[i]).name}' from AudioList with name '{((Object)audioList).name}' at index [{i}]");
					}
					return audioList.weightedClipsList[i];
				}
			}
			Plugin.Logger.LogWarning((object)("no AudioClipWithWeight containing AudioClip with name '" + ((Object)audioClip).name + "' was found in AudioList with name " + ((Object)audioList).name + ", returning null"));
			return null;
		}

		public static AudioList AudioClipGetAudioList(AudioClip audioClip, GameObject objectToCheck, bool printDebug = false)
		{
			return AudioClipGetAudioList(audioClip, GetSharedAudioComponent(objectToCheck, printDebug), printDebug);
		}

		public static AudioList AudioClipGetAudioList(AudioClip audioClip, SharedAudioComponent audioComponent, bool printDebug = false)
		{
			if ((Object)(object)audioClip == (Object)null || (Object)(object)audioComponent == (Object)null)
			{
				Plugin.Logger.LogWarning((object)"AudioClipGetAudioList() was called with a null AudioClip and/or SharedAudioComponent, please specify what AudioClip to get its AudioList from, returning null");
				return null;
			}
			CheckComponentListForNull(audioComponent, printDebug);
			if (audioComponent.allAudioLists.Count == 0)
			{
				Plugin.Logger.LogWarning((object)("SharedAudioComponent on object '" + ((Object)((Component)audioComponent).gameObject).name + "' did not contain any AudioLists, returning null"));
				return null;
			}
			for (int i = 0; i < audioComponent.allAudioLists.Count; i++)
			{
				for (int j = 0; j < audioComponent.allAudioLists[i].weightedClipsList.Count; j++)
				{
					if ((Object)(object)audioComponent.allAudioLists[i].weightedClipsList[j].audioClip == (Object)(object)audioClip)
					{
						if (printDebug)
						{
							Plugin.Logger.LogDebug((object)$"returned AudioList with name '{((Object)audioComponent.allAudioLists[i]).name}' on object '{((Object)((Component)audioComponent).gameObject).name}' at index [{i}]");
						}
						return audioComponent.allAudioLists[i];
					}
				}
			}
			Plugin.Logger.LogWarning((object)("no AudioList containing AudioClip with name '" + ((Object)audioClip).name + "' was found on object " + ((Object)((Component)audioComponent).gameObject).name + ", returning first AudioList on SharedAudioComponent"));
			return audioComponent.allAudioLists[0];
		}

		public static AudioList[] AudioClipGetEveryAudioList(AudioClip audioClip, GameObject objectToCheck, bool printDebug = false)
		{
			return AudioClipGetEveryAudioList(audioClip, GetSharedAudioComponent(objectToCheck, printDebug), printDebug);
		}

		public static AudioList[] AudioClipGetEveryAudioList(AudioClip audioClip, SharedAudioComponent audioComponent, bool printDebug = false)
		{
			if ((Object)(object)audioClip == (Object)null || (Object)(object)audioComponent == (Object)null)
			{
				Plugin.Logger.LogWarning((object)"AudioClipGetEveryAudioList() was called with a null AudioClip and/or SharedAudioComponent, please specify what AudioClip to get all AudioLists from, returning null");
				return null;
			}
			CheckComponentListForNull(audioComponent, printDebug);
			if (audioComponent.allAudioLists.Count == 0)
			{
				Plugin.Logger.LogWarning((object)("SharedAudioComponent on object '" + ((Object)((Component)audioComponent).gameObject).name + "' did not contain any AudioLists, returning null"));
				return null;
			}
			HashSet<AudioList> hashSet = new HashSet<AudioList>();
			for (int i = 0; i < audioComponent.allAudioLists.Count; i++)
			{
				for (int j = 0; j < audioComponent.allAudioLists[i].weightedClipsList.Count; j++)
				{
					if ((Object)(object)audioComponent.allAudioLists[i].weightedClipsList[j].audioClip == (Object)(object)audioClip)
					{
						if (printDebug)
						{
							Plugin.Logger.LogDebug((object)$"found AudioClip with name '{((Object)audioComponent.allAudioLists[i].weightedClipsList[j].audioClip).name}' in AudioList with name '{((Object)audioComponent.allAudioLists[i]).name}' at index [{i}] on object '{((Object)((Component)audioComponent).gameObject).name}'");
						}
						hashSet.Add(audioComponent.allAudioLists[i]);
					}
				}
			}
			if (hashSet.Count > 0)
			{
				if (printDebug)
				{
					Plugin.Logger.LogDebug((object)$"returning array of AudioLists containing AudioClip with name '{((Object)audioClip).name}' on object {((Object)((Component)audioComponent).gameObject).name} with length {hashSet.Count}");
				}
				return hashSet.ToArray();
			}
			Plugin.Logger.LogWarning((object)("no AudioLists containing AudioClip with name '" + ((Object)audioClip).name + "' were found on object " + ((Object)((Component)audioComponent).gameObject).name + ", returning allAudioLists on SharedAudioComponent"));
			return audioComponent.allAudioLists.ToArray();
		}

		private static bool DoAudioListsMatch(List<AudioClipWithWeight> iList, List<AudioClipWithWeight> jList, bool removeDuplicateClipsWithDifferentWeight)
		{
			int num = 0;
			foreach (AudioClipWithWeight i in iList)
			{
				foreach (AudioClipWithWeight j in jList)
				{
					if (removeDuplicateClipsWithDifferentWeight && (Object)(object)i.audioClip == (Object)(object)j.audioClip)
					{
						num++;
						break;
					}
					if (!removeDuplicateClipsWithDifferentWeight && (Object)(object)i.audioClip == (Object)(object)j.audioClip && i.weight == j.weight)
					{
						num++;
						break;
					}
				}
			}
			if (num >= iList.Count)
			{
				return true;
			}
			return false;
		}

		private static int GoThroughListToRemoveNull(AudioList list)
		{
			int num = 0;
			for (int num2 = list.weightedClipsList.Count - 1; num2 > -1; num2--)
			{
				if ((Object)(object)list.weightedClipsList[num2] == (Object)null || (Object)(object)list.weightedClipsList[num2].audioClip == (Object)null)
				{
					list.weightedClipsList.RemoveAt(num2);
					num++;
				}
			}
			return num;
		}

		private static int GoThroughListToRemoveLoadTypes(AudioList list, AudioClipLoadType clipLoadType)
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			int num = 0;
			for (int num2 = list.weightedClipsList.Count - 1; num2 > -1; num2--)
			{
				if (list.weightedClipsList[num2].audioClip.loadType == clipLoadType)
				{
					list.weightedClipsList.RemoveAt(num2);
					num++;
				}
			}
			return num;
		}

		private static void CheckComponentListForNull(SharedAudioComponent aComponent, bool printDebug = false, bool createListIfNull = true, string newListName = null, int newListWeight = 100)
		{
			if (aComponent.allAudioLists.Count == 0)
			{
				if (createListIfNull)
				{
					AudioListCreateNew(aComponent, printDebug, newListName, newListWeight);
				}
				else
				{
					Plugin.Logger.LogWarning((object)("SharedAudioComponent on " + ((Object)((Component)aComponent).gameObject).name + " does not have any AudioLists and createListIfNull is false"));
				}
			}
		}

		private static bool IsListNameUnique(SharedAudioComponent aComponent, string listName)
		{
			foreach (AudioList allAudioList in aComponent.allAudioLists)
			{
				if (((Object)allAudioList).name == listName)
				{
					return false;
				}
			}
			return true;
		}

		private static int AddUpAllWeights(SharedAudioComponent aComponent, AudioList aList = null)
		{
			if ((Object)(object)aComponent == (Object)null && (Object)(object)aList == (Object)null)
			{
				Plugin.Logger.LogWarning((object)"AddUpAllWeights called with no component or list, returning zero");
				return 0;
			}
			int num = 0;
			if ((Object)(object)aComponent != (Object)null)
			{
				foreach (AudioList allAudioList in aComponent.allAudioLists)
				{
					num += allAudioList.listWeight;
				}
				return num;
			}
			foreach (AudioClipWithWeight weightedClips in aList.weightedClipsList)
			{
				num += weightedClips.weight;
			}
			return num;
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "STSharedAudioLib";

		public const string PLUGIN_NAME = "STSharedAudioLib";

		public const string PLUGIN_VERSION = "0.0.2";
	}
}