Decompiled source of HideVolumeMenuPlugin v1.2.0

HideVolumeMenuPlugin.dll

Decompiled 5 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.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using Bounce.Singletons;
using Bounce.Unmanaged;
using DataModel;
using HarmonyLib;
using ModdingTales;
using Newtonsoft.Json;
using TMPro;
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("HideVolumeMenuPlugin")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Nth Dimension")]
[assembly: AssemblyProduct("HideVolumeMenuPlugin")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("HideVolumeMenuPlugin")]
[assembly: ComVisible(false)]
[assembly: Guid("c303405d-e66c-4316-9cdb-4e3ca15c6360")]
[assembly: AssemblyFileVersion("1.2.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.2.0.0")]
namespace LordAshes;

[BepInPlugin("org.lordashes.plugins.hidevolumemenu", "Hide Volume Menu Plug-In", "1.2.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class HideVolumeMenuPlugin : BaseUnityPlugin
{
	public static class PatchAssistant
	{
		public static object GetProperty(object instance, string propertyName)
		{
			Type type = instance.GetType();
			foreach (PropertyInfo runtimeProperty in type.GetRuntimeProperties())
			{
				if (runtimeProperty.Name.Contains(propertyName))
				{
					return runtimeProperty.GetValue(instance);
				}
			}
			PropertyInfo[] properties = type.GetProperties();
			foreach (PropertyInfo propertyInfo in properties)
			{
				if (propertyInfo.Name.Contains(propertyName))
				{
					return propertyInfo.GetValue(instance);
				}
			}
			return null;
		}

		public static void SetProperty(object instance, string propertyName, object value)
		{
			Type type = instance.GetType();
			foreach (PropertyInfo runtimeProperty in type.GetRuntimeProperties())
			{
				if (runtimeProperty.Name.Contains(propertyName))
				{
					runtimeProperty.SetValue(instance, value);
					return;
				}
			}
			PropertyInfo[] properties = type.GetProperties();
			foreach (PropertyInfo propertyInfo in properties)
			{
				if (propertyInfo.Name.Contains(propertyName))
				{
					propertyInfo.SetValue(instance, value);
					break;
				}
			}
		}

		public static object GetField(object instance, string fieldName)
		{
			Type type = instance.GetType();
			foreach (FieldInfo runtimeField in type.GetRuntimeFields())
			{
				if (runtimeField.Name.Contains(fieldName))
				{
					return runtimeField.GetValue(instance);
				}
			}
			FieldInfo[] fields = type.GetFields();
			foreach (FieldInfo fieldInfo in fields)
			{
				if (fieldInfo.Name.Contains(fieldName))
				{
					return fieldInfo.GetValue(instance);
				}
			}
			return null;
		}

		public static void SetField(object instance, string fieldName, object value)
		{
			Type type = instance.GetType();
			foreach (FieldInfo runtimeField in type.GetRuntimeFields())
			{
				if (runtimeField.Name.Contains(fieldName))
				{
					runtimeField.SetValue(instance, value);
					return;
				}
			}
			FieldInfo[] fields = type.GetFields();
			foreach (FieldInfo fieldInfo in fields)
			{
				if (fieldInfo.Name.Contains(fieldName))
				{
					fieldInfo.SetValue(instance, value);
					break;
				}
			}
		}

		public static object UseMethod(object instance, string methodName, object[] parameters)
		{
			Type type = instance.GetType();
			foreach (MethodInfo runtimeMethod in type.GetRuntimeMethods())
			{
				if (runtimeMethod.Name.Contains(methodName))
				{
					return runtimeMethod.Invoke(instance, parameters);
				}
			}
			MethodInfo[] methods = type.GetMethods();
			foreach (MethodInfo methodInfo in methods)
			{
				if (methodInfo.Name.Contains(methodName))
				{
					return methodInfo.Invoke(instance, parameters);
				}
			}
			return null;
		}
	}

	[HarmonyPatch(typeof(HideVolumeItem), "VisibilityChange")]
	public static class Patches
	{
		public static bool Prefix(bool visibility, ref HideVolumeItem __instance)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			string text = visibility.ToString();
			NGuid id = __instance.HideVolume.Id;
			LoggingPlugin.LogInfo("Patch: Visibility Toggled To " + text + " For " + ((object)(NGuid)(ref id)).ToString());
			id = __instance.HideVolume.Id;
			GameObject val = GameObject.Find("HideVolume:Label:" + ((object)(NGuid)(ref id)).ToString());
			if ((Object)(object)val != (Object)null)
			{
				TextMeshPro component = val.GetComponent<TextMeshPro>();
				((TMP_Text)component).fontSize = (visibility ? LabelInfo.FontSize : 0f);
			}
			hideVolumesShowing = visibility;
			return true;
		}
	}

	public static class Utility
	{
		public static void PostOnMainPage(BaseUnityPlugin plugin)
		{
			string text = "Lord Ashes" + ("Lord Ashes".ToUpper().EndsWith("S") ? "'" : "'s");
			ModdingUtils.AddPluginToMenuList(plugin, text);
		}

		public static bool isBoardLoaded()
		{
			return SimpleSingletonBehaviour<CameraController>.HasInstance && SingletonStateMBehaviour<BoardSessionManager, State<BoardSessionManager>>.HasInstance && !BoardSessionManager.IsLoading;
		}
	}

	public class StateHideVolume
	{
		private Action _callback = null;

		public HideVolumeItem Volume { get; set; } = null;


		public string Name
		{
			get
			{
				string[] array = ((Object)Volume).name.Split(new char[1] { ':' });
				return array[0];
			}
			set
			{
				string[] array = ((Object)Volume).name.Split(new char[1] { ':' });
				if (((Object)Volume).name != value + ":" + array[1])
				{
					((Object)Volume).name = value + ":" + array[1];
					_callback();
				}
			}
		}

		public bool State
		{
			get
			{
				string[] array = ((Object)Volume).name.Split(new char[1] { ':' });
				return array[1] == "On";
			}
			set
			{
				string[] array = ((Object)Volume).name.Split(new char[1] { ':' });
				string text = (value ? "On" : "Off");
				if (((Object)Volume).name != array[0] + ":" + text)
				{
					((Object)Volume).name = array[0] + ":" + text;
					_callback();
				}
			}
		}

		public StateHideVolume(HideVolumeItem hvi, Action callback)
		{
			Volume = hvi;
			((Object)Volume).name = "Hide Volume:On";
			_callback = callback;
		}
	}

	private static class MenuLayout
	{
		public static int VerticalStart { get; set; } = 60;


		public static int VerticalOffset { get; set; } = 30;


		public static int VerticalCount { get; set; } = 34;


		public static int HorizontalStart { get; set; } = 10;


		public static int HorizontalOffset { get; set; } = 480;

	}

	private static class LabelInfo
	{
		public static float FontSize = 6f;

		public static float VerticalOffset { get; set; } = 0.25f;

	}

	public const string Name = "Hide Volume Menu Plug-In";

	public const string Guid = "org.lordashes.plugins.hidevolumemenu";

	public const string Version = "1.2.0.0";

	public const string Author = "Lord Ashes";

	private static string data = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "/CustomData/";

	private static HideVolumeMenuPlugin self = null;

	private static bool boardDataLoaded = false;

	private static bool menuOpen = false;

	private static bool hideVolumesShowing = false;

	public Dictionary<string, StateHideVolume> CurrentHideVolumeStates = new Dictionary<string, StateHideVolume>();

	private ConfigEntry<KeyboardShortcut> triggerKey { get; set; }

	public static HideVolumeMenuPlugin Instance()
	{
		return self;
	}

	private void Awake()
	{
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		//IL_0033: Unknown result type (might be due to invalid IL or missing references)
		//IL_0038: Unknown result type (might be due to invalid IL or missing references)
		//IL_0077: Unknown result type (might be due to invalid IL or missing references)
		//IL_0190: Unknown result type (might be due to invalid IL or missing references)
		//IL_0196: Expected O, but got Unknown
		LoggingPlugin.SetLogLevel(((BaseUnityPlugin)this).Config.Bind<DiagnosticLevel>("Settings", "Diagnostics", (DiagnosticLevel)3, (ConfigDescription)null).Value);
		string? assemblyQualifiedName = ((object)this).GetType().AssemblyQualifiedName;
		DiagnosticLevel logLevel = LoggingPlugin.GetLogLevel();
		LoggingPlugin.LogInfo(assemblyQualifiedName + " is actve. (Diagnostics = " + ((object)(DiagnosticLevel)(ref logLevel)).ToString() + ")");
		triggerKey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Hotkeys", "States Activation", new KeyboardShortcut((KeyCode)104, (KeyCode[])(object)new KeyCode[1] { (KeyCode)306 }), (ConfigDescription)null);
		MenuLayout.VerticalStart = ((BaseUnityPlugin)this).Config.Bind<int>("Menu Layout", "Vertical Start", 60, (ConfigDescription)null).Value;
		MenuLayout.VerticalOffset = ((BaseUnityPlugin)this).Config.Bind<int>("Menu Layout", "Vertical Offset", 30, (ConfigDescription)null).Value;
		MenuLayout.VerticalCount = ((BaseUnityPlugin)this).Config.Bind<int>("Menu Layout", "Vertical Item Count", 34, (ConfigDescription)null).Value;
		MenuLayout.HorizontalStart = ((BaseUnityPlugin)this).Config.Bind<int>("Menu Layout", "Horizontal Start", 10, (ConfigDescription)null).Value;
		MenuLayout.HorizontalOffset = ((BaseUnityPlugin)this).Config.Bind<int>("Menu Layout", "Horizontal Osset", 480, (ConfigDescription)null).Value;
		LabelInfo.VerticalOffset = ((BaseUnityPlugin)this).Config.Bind<float>("Labels", "Vertical Offset", 0.25f, (ConfigDescription)null).Value;
		LabelInfo.FontSize = ((BaseUnityPlugin)this).Config.Bind<float>("Labels", "Font Size", 6f, (ConfigDescription)null).Value;
		self = this;
		Harmony val = new Harmony("org.lordashes.plugins.hidevolumemenu");
		val.PatchAll();
		AssetDataPlugin.Subscribe("org.lordashes.plugins.hidevolumemenu", (Action<DatumChange>)delegate(DatumChange change)
		{
			LoggingPlugin.LogInfo("Remote Request " + change.value);
			if (!Enumerable.Contains(change.value.ToString(), ','))
			{
				LoggingPlugin.LogDebug("Mass Volume Set");
				string text = change.value.ToString();
				string[] array = CurrentHideVolumeStates.Keys.ToArray();
				Array.Sort(array);
				LoggingPlugin.LogTrace("Volume Guids " + Convert.ToString(array));
				for (int i = 0; i < array.Length; i++)
				{
					LoggingPlugin.LogTrace("H=" + i + ", Guid=" + array[i]);
					LoggingPlugin.LogInfo("Setting '" + CurrentHideVolumeStates[array[i]].Name + "' To '" + (text.Substring(i, 1) == "1") + "'");
					CurrentHideVolumeStates[array[i]].State = text.Substring(i, 1) == "1";
				}
				return;
			}
			LoggingPlugin.LogDebug("Single Volume Set");
			string text2 = change.value.ToString().Split(new char[1] { ',' })[0];
			string text3 = change.value.ToString().Split(new char[1] { ',' })[1];
			foreach (StateHideVolume value in CurrentHideVolumeStates.Values)
			{
				if (value.Name.ToUpper() == text2.ToUpper())
				{
					LoggingPlugin.LogInfo("Setting '" + value.Name + "' To '" + text3 + "'");
					value.State = ((!"[0][OFF][FALSE]".Contains(text3.ToUpper())) ? true : false);
				}
			}
		});
		Utility.PostOnMainPage((BaseUnityPlugin)(object)this);
	}

	private void Update()
	{
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		if (Utility.isBoardLoaded())
		{
			KeyboardShortcut value = triggerKey.Value;
			if (((KeyboardShortcut)(ref value)).IsUp())
			{
				menuOpen = !menuOpen;
				LoggingPlugin.LogInfo("Toggling Menu To " + menuOpen);
			}
		}
		else
		{
			boardDataLoaded = false;
		}
	}

	private void OnGUI()
	{
		//IL_0684: Unknown result type (might be due to invalid IL or missing references)
		//IL_0689: Unknown result type (might be due to invalid IL or missing references)
		//IL_068e: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
		//IL_06d7: Unknown result type (might be due to invalid IL or missing references)
		//IL_06e6: Unknown result type (might be due to invalid IL or missing references)
		//IL_013d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0142: Unknown result type (might be due to invalid IL or missing references)
		//IL_0177: Unknown result type (might be due to invalid IL or missing references)
		//IL_01af: 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_0105: Unknown result type (might be due to invalid IL or missing references)
		//IL_025c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0261: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ce: Unknown result type (might be due to invalid IL or missing references)
		//IL_032c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0331: Unknown result type (might be due to invalid IL or missing references)
		//IL_0435: Unknown result type (might be due to invalid IL or missing references)
		//IL_0461: Unknown result type (might be due to invalid IL or missing references)
		//IL_0466: Unknown result type (might be due to invalid IL or missing references)
		//IL_046b: Unknown result type (might be due to invalid IL or missing references)
		//IL_04cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_04d3: Expected O, but got Unknown
		//IL_04f6: Unknown result type (might be due to invalid IL or missing references)
		//IL_04fb: Unknown result type (might be due to invalid IL or missing references)
		//IL_0500: Unknown result type (might be due to invalid IL or missing references)
		//IL_0560: Unknown result type (might be due to invalid IL or missing references)
		//IL_0565: Unknown result type (might be due to invalid IL or missing references)
		//IL_056e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0594: Unknown result type (might be due to invalid IL or missing references)
		//IL_0599: Unknown result type (might be due to invalid IL or missing references)
		//IL_05a2: Unknown result type (might be due to invalid IL or missing references)
		//IL_05ce: Unknown result type (might be due to invalid IL or missing references)
		//IL_05d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_05dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_05e6: Unknown result type (might be due to invalid IL or missing references)
		NGuid id2;
		if (menuOpen)
		{
			HideVolumeManager instance = SimpleSingletonBehaviour<HideVolumeManager>.Instance;
			Transform[] array = ExtensionMethods.Children((from t in ExtensionMethods.Children(((Component)instance).transform)
				where ((Object)t).name.ToUpper() == "ROOT"
				select t).FirstOrDefault()).ToArray();
			if (array != null)
			{
				int num = 0;
				int horizontalStart = MenuLayout.HorizontalStart;
				int verticalStart = MenuLayout.VerticalStart;
				Transform[] array2 = array;
				HideVolume hideVolume;
				foreach (Transform val in array2)
				{
					horizontalStart = MenuLayout.HorizontalStart + MenuLayout.HorizontalOffset * (num / MenuLayout.VerticalCount);
					verticalStart = MenuLayout.VerticalStart + MenuLayout.VerticalOffset * (num % MenuLayout.VerticalCount);
					HideVolumeItem component = ((Component)val).GetComponent<HideVolumeItem>();
					Dictionary<string, StateHideVolume> currentHideVolumeStates = CurrentHideVolumeStates;
					hideVolume = component.HideVolume;
					if (!currentHideVolumeStates.ContainsKey(((object)(NGuid)(ref hideVolume.Id)).ToString()))
					{
						Dictionary<string, StateHideVolume> currentHideVolumeStates2 = CurrentHideVolumeStates;
						hideVolume = component.HideVolume;
						currentHideVolumeStates2.Add(((object)(NGuid)(ref hideVolume.Id)).ToString(), new StateHideVolume(component, delegate
						{
							Save();
						}));
					}
					Dictionary<string, StateHideVolume> currentHideVolumeStates3 = CurrentHideVolumeStates;
					hideVolume = component.HideVolume;
					StateHideVolume state = currentHideVolumeStates3[((object)(NGuid)(ref hideVolume.Id)).ToString()];
					state.State = GUI.Toggle(new Rect((float)horizontalStart, (float)verticalStart, 20f, 20f), state.State, "");
					if (GUI.Button(new Rect((float)(horizontalStart + 30), (float)verticalStart, (float)(MenuLayout.HorizontalOffset - 35), 20f), state.Name))
					{
						SystemMessage.AskForTextInput("Hide Voumes...", "Hide Volume Name:", "OK", (Action<string>)delegate(string s)
						{
							state.Name = s;
							Save();
						}, (Action)null, "Cancel", (Action)null, state.Name);
					}
					num++;
				}
				if (!boardDataLoaded)
				{
					boardDataLoaded = true;
					string[] obj = new string[5]
					{
						data,
						BoardSessionManager.CurrentBoardInfo.BoardName,
						"(",
						null,
						null
					};
					BoardGuid id = BoardSessionManager.CurrentBoardInfo.Id;
					obj[3] = ((object)(BoardGuid)(ref id)).ToString();
					obj[4] = ").json";
					if (File.Exists(string.Concat(obj)))
					{
						LoggingPlugin.LogDebug("Loading Hide Volume Names And States...");
						Dictionary<string, string> dictionary = new Dictionary<string, string>();
						string[] obj2 = new string[5]
						{
							data,
							BoardSessionManager.CurrentBoardInfo.BoardName,
							"(",
							null,
							null
						};
						id = BoardSessionManager.CurrentBoardInfo.Id;
						obj2[3] = ((object)(BoardGuid)(ref id)).ToString();
						obj2[4] = ").json";
						if (File.Exists(string.Concat(obj2)))
						{
							LoggingPlugin.LogTrace("Hide Volume Menu: Reading States File...");
							string[] obj3 = new string[5]
							{
								data,
								BoardSessionManager.CurrentBoardInfo.BoardName,
								"(",
								null,
								null
							};
							id = BoardSessionManager.CurrentBoardInfo.Id;
							obj3[3] = ((object)(BoardGuid)(ref id)).ToString();
							obj3[4] = ").json";
							string text = File.ReadAllText(string.Concat(obj3));
							LoggingPlugin.LogTrace("Hide Volume Menu: Deserializing States File...");
							dictionary = JsonConvert.DeserializeObject<Dictionary<string, string>>(text);
						}
						foreach (KeyValuePair<string, string> item in dictionary)
						{
							if (!(item.Key != ((object)(NGuid)(ref NGuid.Empty)).ToString()))
							{
								continue;
							}
							LoggingPlugin.LogDebug("Restoring Hide Volume '" + item.Key.ToString() + "' Name And State...");
							if (CurrentHideVolumeStates.ContainsKey(item.Key.ToString()))
							{
								((Object)CurrentHideVolumeStates[item.Key.ToString()].Volume).name = item.Value;
								SimpleSingletonBehaviour<HideVolumeManager>.Instance.SetHideVolumeState(CurrentHideVolumeStates[item.Key.ToString()].Volume.HideVolume);
								id2 = CurrentHideVolumeStates[item.Key.ToString()].Volume.HideVolume.Id;
								GameObject val2 = GameObject.Find("HideVolume:Label:" + ((object)(NGuid)(ref id2)).ToString());
								TextMeshPro val3 = null;
								if ((Object)(object)val2 == (Object)null)
								{
									LoggingPlugin.LogTrace("Creating Label For Hide Volume '" + CurrentHideVolumeStates[item.Key.ToString()].Name + "'...");
									val2 = new GameObject();
									GameObject obj4 = val2;
									id2 = CurrentHideVolumeStates[item.Key.ToString()].Volume.HideVolume.Id;
									((Object)obj4).name = "HideVolume:Label:" + ((object)(NGuid)(ref id2)).ToString();
									val3 = val2.AddComponent<TextMeshPro>();
									((TMP_Text)val3).alignment = (TextAlignmentOptions)514;
									((TMP_Text)val3).fontSize = 0f;
									Transform transform = val3.transform;
									hideVolume = CurrentHideVolumeStates[item.Key.ToString()].Volume.HideVolume;
									float x = ((Bounds)(ref hideVolume.Bounds)).center.x;
									hideVolume = CurrentHideVolumeStates[item.Key.ToString()].Volume.HideVolume;
									float num2 = ((Bounds)(ref hideVolume.Bounds)).max.y + LabelInfo.VerticalOffset;
									hideVolume = CurrentHideVolumeStates[item.Key.ToString()].Volume.HideVolume;
									transform.position = new Vector3(x, num2, ((Bounds)(ref hideVolume.Bounds)).center.z);
								}
								else
								{
									val3 = val2.GetComponent<TextMeshPro>();
								}
								((TMP_Text)val3).text = CurrentHideVolumeStates[item.Key.ToString()].Name;
							}
						}
					}
				}
			}
		}
		if (!hideVolumesShowing)
		{
			return;
		}
		foreach (StateHideVolume value in CurrentHideVolumeStates.Values)
		{
			id2 = value.Volume.HideVolume.Id;
			GameObject val4 = GameObject.Find("HideVolume:Label:" + ((object)(NGuid)(ref id2)).ToString());
			if ((Object)(object)val4 != (Object)null)
			{
				TextMeshPro component2 = val4.GetComponent<TextMeshPro>();
				component2.transform.eulerAngles = new Vector3(0f, ((Component)Camera.main).transform.eulerAngles.y, 0f);
			}
		}
	}

	private void Save()
	{
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		//IL_003e: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00da: Unknown result type (might be due to invalid IL or missing references)
		//IL_00df: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
		//IL_017b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0180: Unknown result type (might be due to invalid IL or missing references)
		LoggingPlugin.LogDebug("Saving Hide Volume Changes...");
		Dictionary<string, string> dictionary = new Dictionary<string, string>();
		foreach (StateHideVolume value in CurrentHideVolumeStates.Values)
		{
			HideVolume hideVolume = value.Volume.HideVolume;
			dictionary.Add(((object)(NGuid)(ref hideVolume.Id)).ToString(), ((Object)value.Volume).name);
			LoggingPlugin.LogInfo("Setting '" + value.Name + "' To '" + value.State + "'...");
			value.Volume.ChangeIsActive(value.State);
			SimpleSingletonBehaviour<HideVolumeManager>.Instance.SetHideVolumeState(value.Volume.HideVolume);
			NGuid id = value.Volume.HideVolume.Id;
			GameObject val = GameObject.Find("HideVolume:Label:" + ((object)(NGuid)(ref id)).ToString());
			if ((Object)(object)val != (Object)null)
			{
				TextMeshPro component = val.GetComponent<TextMeshPro>();
				if ((Object)(object)component != (Object)null)
				{
					((TMP_Text)component).text = value.Name;
				}
			}
		}
		string[] obj = new string[5]
		{
			data,
			BoardSessionManager.CurrentBoardInfo.BoardName,
			"(",
			null,
			null
		};
		BoardGuid id2 = BoardSessionManager.CurrentBoardInfo.Id;
		obj[3] = ((object)(BoardGuid)(ref id2)).ToString();
		obj[4] = ").json";
		File.WriteAllText(string.Concat(obj), JsonConvert.SerializeObject((object)dictionary, (Formatting)1));
	}
}