Decompiled source of ShipColors v0.2.5

ShipColors.dll

Decompiled a month ago
using System;
using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using LethalConfig;
using Microsoft.CodeAnalysis;
using OpenLib;
using OpenLib.Common;
using OpenLib.Compat;
using OpenLib.ConfigManager;
using OpenLib.Events;
using ShipColors.Compat;
using ShipColors.ConfigManager;
using ShipColors.Customizer;
using ShipColors.Events;
using TerminalStuff;
using UnityEngine;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("ShipColors")]
[assembly: AssemblyDescription("https://github.com/darmuh/ShipColors")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ShipColors")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("16e2d4eb-0360-4fa3-9b4b-908c5717ef6c")]
[assembly: AssemblyFileVersion("0.2.5")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.2.5.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;
		}
	}
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}
namespace ShipColors
{
	[BepInPlugin("darmuh.ShipColors", "ShipColors", "0.2.5")]
	[BepInDependency("darmuh.OpenLib", "0.2.8")]
	public class Plugin : BaseUnityPlugin
	{
		public static class PluginInfo
		{
			public const string PLUGIN_GUID = "darmuh.ShipColors";

			public const string PLUGIN_NAME = "ShipColors";

			public const string PLUGIN_VERSION = "0.2.5";
		}

		public static Plugin instance;

		internal static ManualLogSource Log;

		public bool LobbyCompat = false;

		public bool darmuhsTerminalStuff = false;

		public bool ShipWindows = false;

		public Terminal Terminal;

		private void Awake()
		{
			instance = this;
			Log = ((BaseUnityPlugin)this).Logger;
			Log.LogInfo((object)"ShipColors is loading with version 0.2.5!");
			ConfigSettings.BindConfigSettings();
			((BaseUnityPlugin)this).Config.SettingChanged += OnSettingChanged;
			Subscribers.Subscribe();
			Log.LogInfo((object)"ShipColors load complete!");
		}

		internal void OnSettingChanged(object sender, SettingChangedEventArgs settingChangedArg)
		{
			Spam("CONFIG SETTING CHANGE EVENT");
			if (settingChangedArg.ChangedSetting != null)
			{
				if (settingChangedArg.ChangedSetting == ConfigSettings.ConfigCode)
				{
					Log.LogDebug((object)"Config Code detected!");
					GeneratedConfig.ReadConfigCode();
				}
				else if ((Object)(object)StartOfRound.Instance != (Object)null && ConfigSettings.ModeSetting.Value == "Use Shared Textures")
				{
					Subscribers.StartCustomizer();
				}
			}
		}

		internal static void MoreLogs(string message)
		{
			if (ConfigSettings.ExtensiveLogging.Value)
			{
				Log.LogInfo((object)message);
			}
		}

		internal static void Spam(string message)
		{
			if (ConfigSettings.DeveloperLogging.Value)
			{
				Log.LogDebug((object)message);
			}
		}

		internal static void ERROR(string message)
		{
			Log.LogError((object)message);
		}

		internal static void WARNING(string message)
		{
			Log.LogWarning((object)message);
		}
	}
}
namespace ShipColors.Properties
{
	[GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
	[DebuggerNonUserCode]
	[CompilerGenerated]
	internal class Resources
	{
		private static ResourceManager resourceMan;

		private static CultureInfo resourceCulture;

		[EditorBrowsable(EditorBrowsableState.Advanced)]
		internal static ResourceManager ResourceManager
		{
			get
			{
				if (resourceMan == null)
				{
					ResourceManager resourceManager = new ResourceManager("ShipColors.Properties.Resources", typeof(Resources).Assembly);
					resourceMan = resourceManager;
				}
				return resourceMan;
			}
		}

		[EditorBrowsable(EditorBrowsableState.Advanced)]
		internal static CultureInfo Culture
		{
			get
			{
				return resourceCulture;
			}
			set
			{
				resourceCulture = value;
			}
		}

		internal Resources()
		{
		}
	}
}
namespace ShipColors.Events
{
	public class Subscribers
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static ParameterEvent<Terminal> <0>__OnTerminalAwake;

			public static Event <1>__OnStart;

			public static Event <2>__OnTerminalDisable;

			public static Event <3>__OnGameLoad;

			public static Action <4>__GenerateWebpage;

			public static Action <5>__RegenerateConfig;

			public static EventHandler<SettingChangedEventArgs> <6>__OnSettingChanged;
		}

		public static void Subscribe()
		{
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Expected O, but got Unknown
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Expected O, but got Unknown
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Expected O, but got Unknown
			EventManager.TerminalAwake.AddListener((ParameterEvent<Terminal>)OnTerminalAwake);
			CustomEvent terminalStart = EventManager.TerminalStart;
			object obj = <>O.<1>__OnStart;
			if (obj == null)
			{
				Event val = OnStart;
				<>O.<1>__OnStart = val;
				obj = (object)val;
			}
			terminalStart.AddListener((Event)obj);
			CustomEvent terminalDisable = EventManager.TerminalDisable;
			object obj2 = <>O.<2>__OnTerminalDisable;
			if (obj2 == null)
			{
				Event val2 = OnTerminalDisable;
				<>O.<2>__OnTerminalDisable = val2;
				obj2 = (object)val2;
			}
			terminalDisable.AddListener((Event)obj2);
			CustomEvent gameNetworkManagerStart = EventManager.GameNetworkManagerStart;
			object obj3 = <>O.<3>__OnGameLoad;
			if (obj3 == null)
			{
				Event val3 = OnGameLoad;
				<>O.<3>__OnGameLoad = val3;
				obj3 = (object)val3;
			}
			gameNetworkManagerStart.AddListener((Event)obj3);
		}

		public static void OnGameLoad()
		{
			if (StartGame.SoftCompatibility("darmuh.TerminalStuff", ref Plugin.instance.darmuhsTerminalStuff))
			{
				Plugin.MoreLogs("leaving terminal customization to darmuhsTerminalStuff (generated config will skip terminal object)");
			}
			if (StartGame.SoftCompatibility("BMX.LobbyCompatibility", ref Plugin.instance.LobbyCompat))
			{
				Version version = Assembly.GetExecutingAssembly().GetName().Version;
				BMX_LobbyCompat.SetBMXCompat(false, version);
			}
			if (StartGame.SoftCompatibility("TestAccount666.ShipWindows", ref Plugin.instance.ShipWindows))
			{
				Plugin.Spam("Will rely on ShipWindows to call customization");
			}
			if (Plugin.instance.LethalConfig)
			{
				LethalConfigSoft.AddButton("Setup", "Generate Webpage", "Press this to generate a webpage in the Bepinex/Config/Webconfig folder from this mod's generated config!\nYou can then use this webpage to modify your config and paste a config code to apply in-game", "Generate Webpage", (Action)GeneratedConfig.GenerateWebpage);
				LethalConfigSoft.AddButton("Setup", "Regen Config", "Press this to regenerate the generated config when [Mode Setting] is set to Generate Config.", "Regen Config", (Action)GeneratedConfig.RegenerateConfig);
			}
			else
			{
				Plugin.MoreLogs("LethalConfig is not detected by OpenLib");
			}
		}

		public static void OnTerminalAwake(Terminal instance)
		{
			Plugin.instance.Terminal = instance;
			Plugin.MoreLogs("Setting Plugin.instance.Terminal");
		}

		internal static void StartCustomizer()
		{
			if (ConfigSettings.SetShipLights.Value)
			{
				CustomShipLights.SetShipLights();
			}
			if (ConfigSettings.ModeSetting.Value == "Use Shared Textures")
			{
				GlobalSharedCustomization.UseSharedTextures();
				Plugin.Spam("Only setting shared texture values");
			}
			else if (ConfigSettings.ModeSetting.Value == "Generate Config")
			{
				if (!GeneratedCustomization.configGenerated)
				{
					GeneratedCustomization.CreateAllConfigs();
					GeneratedConfig.Generated.SettingChanged += GeneratedConfig.OnSettingChanged;
					GeneratedConfig.ReadConfigCode();
				}
				else
				{
					GeneratedCustomization.ReadCustomClassValues(ref GeneratedCustomization.materialToColor);
				}
			}
		}

		public static void OnTerminalDisable()
		{
			GeneratedCustomization.materialToColor.Clear();
			GeneratedCustomization.configGenerated = false;
		}

		public static void OnStart()
		{
			if (!Plugin.instance.ShipWindows)
			{
				Plugin.Log.LogInfo((object)"patching customizations now!");
				StartCustomizer();
			}
		}
	}
}
namespace ShipColors.Customizer
{
	internal class GeneratedCustomization
	{
		internal static List<CustomColorClass> materialToColor = new List<CustomColorClass>();

		internal static List<GameObject> ObjectsWithConfigItems = new List<GameObject>();

		internal static bool configGenerated = false;

		internal static void CreateAllConfigs()
		{
			if (configGenerated)
			{
				return;
			}
			materialToColor.Clear();
			ObjectsWithConfigItems.Clear();
			List<int> numberListFromStringList = CommonStringStuff.GetNumberListFromStringList(CommonStringStuff.GetKeywordsPerConfigItem(ConfigSettings.GenAcceptedLayers.Value, ','));
			List<string> keywordsPerConfigItem = CommonStringStuff.GetKeywordsPerConfigItem(ConfigSettings.GenBannedObjects.Value, ',');
			List<string> keywordsPerConfigItem2 = CommonStringStuff.GetKeywordsPerConfigItem(ConfigSettings.GenBannedMaterials.Value, ',');
			List<string> keywordsPerConfigItem3 = CommonStringStuff.GetKeywordsPerConfigItem(ConfigSettings.GenPermitListObjects.Value, ',');
			bool flag = true;
			if (Plugin.instance.darmuhsTerminalStuff)
			{
				flag = MyTerminalStuff.AddTerminalConfigs();
			}
			GameObject val = GameObject.Find("Environment/HangarShip");
			GameObject parent = GameObject.Find("Environment/HangarShip/ShipModels2b");
			if ((Object)(object)val == (Object)null)
			{
				Plugin.ERROR("Unable to find root ship object @ Environment/HangarShip");
				return;
			}
			if (TryGetChildObjects(val, out var allObjects, parent))
			{
				Plugin.Spam($"allObjects Count - {allObjects.Count}");
				allObjects = allObjects.OrderBy((GameObject x) => ((Object)x).name).ToList();
				foreach (GameObject gameObject in allObjects)
				{
					if (allObjects.Any((GameObject p) => (Object)(object)p.transform == (Object)(object)gameObject.transform.parent) || !IsValidObject(gameObject, keywordsPerConfigItem, numberListFromStringList, keywordsPerConfigItem3) || (!flag && ((Object)gameObject).name.ToLower() == "terminal"))
					{
						continue;
					}
					if (TryGetFamily(gameObject, out var familyTree))
					{
						if (familyTree.Count >= 2)
						{
							int num = 0;
							for (int num2 = familyTree.Count - 1; num2 > 0; num2--)
							{
								num++;
								int num3 = num2;
								int num4 = num3 - 1;
								if (!((Object)(object)familyTree[num3] == (Object)null))
								{
									if (num4 >= 0)
									{
										ProcessObject(familyTree[num3], keywordsPerConfigItem2, keywordsPerConfigItem, numberListFromStringList, keywordsPerConfigItem3, familyTree[num4], familyTree[0]);
									}
									else
									{
										ProcessObject(familyTree[num3], keywordsPerConfigItem2, keywordsPerConfigItem, numberListFromStringList, keywordsPerConfigItem3, familyTree[0]);
									}
								}
							}
						}
						else if (familyTree.Count == 1)
						{
							ProcessObject(familyTree[0], keywordsPerConfigItem2, keywordsPerConfigItem, numberListFromStringList, keywordsPerConfigItem3, familyTree[0]);
						}
						else
						{
							Plugin.WARNING("Unable to process familyTree??");
						}
					}
					else
					{
						Plugin.Spam(((Object)gameObject).name + " has no familyTree, processing on it's own");
						ProcessObject(gameObject, keywordsPerConfigItem2, keywordsPerConfigItem, numberListFromStringList, keywordsPerConfigItem3);
					}
				}
			}
			else
			{
				Plugin.WARNING("Unable to get any objects!");
			}
			if (Plugin.instance.LethalConfig)
			{
				LethalConfigStuff.AddConfig(GeneratedConfig.Generated);
			}
			Plugin.Spam("Config has been generated");
			configGenerated = true;
		}

		private static bool IsValidObject(GameObject gameObject, List<string> bannedObjects, List<int> acceptableLayers, List<string> permitListObjects)
		{
			if (bannedObjects.Any((string x) => ((Object)gameObject).name.ToLower().Contains(x.ToLower())))
			{
				if (!permitListObjects.Any((string y) => ((Object)gameObject).name.ToLower() == y.ToLower()))
				{
					Plugin.Spam(((Object)gameObject).name + " is detected as a banned object!");
					return false;
				}
				Plugin.Spam(((Object)gameObject).name + " is explicitly permitted!");
			}
			if (!acceptableLayers.Contains(gameObject.layer))
			{
				return false;
			}
			if (ObjectsWithConfigItems.Contains(gameObject))
			{
				return false;
			}
			return true;
		}

		private static void ProcessObject(GameObject gameObject, List<string> bannedMaterials, List<string> bannedObjects, List<int> acceptableLayers, List<string> permitListObjects, GameObject parentObj = null, GameObject grandParent = null)
		{
			MeshRenderer[] mesh;
			if ((Object)(object)gameObject == (Object)null)
			{
				Plugin.ERROR("Provided NULL object at ProcessObject");
			}
			else if (IsValidObject(gameObject, bannedObjects, acceptableLayers, permitListObjects) && TryGetMeshRenderers(gameObject, out mesh))
			{
				MakeConfigItems(bannedMaterials, mesh, gameObject, parentObj, grandParent);
				ObjectsWithConfigItems.Add(gameObject);
			}
		}

		private static void MakeConfigItems(List<string> bannedMaterials, MeshRenderer[] meshes, GameObject gameObject, GameObject parent = null, GameObject grandparent = null)
		{
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_01df: Unknown result type (might be due to invalid IL or missing references)
			//IL_045e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0463: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0485: Unknown result type (might be due to invalid IL or missing references)
			//IL_041a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0328: Unknown result type (might be due to invalid IL or missing references)
			foreach (MeshRenderer val in meshes)
			{
				if (((Renderer)val).materials.Length < 1)
				{
					Plugin.WARNING("No materials in " + ((Object)val).name);
					continue;
				}
				Material[] materials = ((Renderer)val).materials;
				foreach (Material material in materials)
				{
					if (bannedMaterials.Any((string x) => ((Object)material).name.ToLower().Contains(x.ToLower())))
					{
						Plugin.Spam(((Object)material).name + " is banned!");
						continue;
					}
					ConfigEntry<float> val2 = null;
					string text = ColorUtility.ToHtmlStringRGB(material.color);
					ConfigEntry<string> val3;
					if ((Object)(object)parent != (Object)null && (Object)(object)grandparent != (Object)null)
					{
						val3 = ConfigSetup.MakeString(GeneratedConfig.Generated, ((Object)grandparent).name + " Colors", ((Object)parent).name + "/" + ((Object)gameObject).name + "/" + ((Object)material).name + " Color", "#" + text, "Change color of material, " + ((Object)material).name + " as part of object " + ((Object)gameObject).name);
						if (material.color.a < 1f)
						{
							val2 = ConfigSetup.MakeClampedFloat(GeneratedConfig.Generated, ((Object)grandparent).name + " Colors", ((Object)parent).name + "/" + ((Object)gameObject).name + "/" + ((Object)material).name + " Alpha", material.color.a, "Change alpha of material, " + ((Object)material).name + " as part of object " + ((Object)gameObject).name + " in " + ((Object)grandparent).name, 0f, 1f);
						}
					}
					else if ((Object)(object)parent != (Object)null && (Object)(object)grandparent == (Object)null)
					{
						val3 = ConfigSetup.MakeString(GeneratedConfig.Generated, ((Object)parent).name + " Colors", ((Object)gameObject).name + "/" + ((Object)material).name + " Color", "#" + text, "Change color of material, " + ((Object)material).name + " as part of object " + ((Object)gameObject).name);
						if (material.color.a < 1f)
						{
							val2 = ConfigSetup.MakeClampedFloat(GeneratedConfig.Generated, ((Object)parent).name + " Colors", ((Object)gameObject).name + "/" + ((Object)material).name + " Alpha", material.color.a, "Change alpha of material, " + ((Object)material).name + " as part of object " + ((Object)gameObject).name, 0f, 1f);
						}
					}
					else
					{
						val3 = ConfigSetup.MakeString(GeneratedConfig.Generated, ((Object)gameObject).name + " Colors", ((Object)material).name + " Color", "#" + text, "Change color of material, " + ((Object)material).name + " as part of object " + ((Object)gameObject).name);
						if (material.color.a < 1f)
						{
							val2 = ConfigSetup.MakeClampedFloat(GeneratedConfig.Generated, ((Object)gameObject).name + " Colors", ((Object)material).name + " Alpha", material.color.a, "Change alpha of material, " + ((Object)material).name + " as part of object " + ((Object)gameObject).name, 0f, 1f);
						}
					}
					Color color = Misc.HexToColor(val3.Value);
					if (val2 != null)
					{
						color.a = val2.Value;
					}
					material.color = color;
					CustomColorClass item = new CustomColorClass(val3, val2, material);
					materialToColor.Add(item);
				}
			}
		}

		internal static void ReadCustomClassValues(ref List<CustomColorClass> config)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			foreach (CustomColorClass item in config)
			{
				Color color = Misc.HexToColor(item.colorConfig.Value);
				if (item.alphaConfig != null)
				{
					color.a = item.alphaConfig.Value;
				}
				item.material.color = color;
				Plugin.Spam($"set color for {item.material.color} to {item.colorConfig.Value}");
				if (item.alphaConfig != null)
				{
					Plugin.Spam($"with alpha {item.alphaConfig.Value}");
				}
			}
		}

		internal static void UpdateGeneratedValue(ConfigEntry<string> valueUpdated)
		{
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			Plugin.Spam("Attempting to update value: " + ((ConfigEntryBase)valueUpdated).Definition.Key);
			foreach (CustomColorClass item2 in materialToColor)
			{
				if (item2.TryGetItem(valueUpdated, out var item))
				{
					Color color = Misc.HexToColor(valueUpdated.Value);
					if (item.alphaConfig != null)
					{
						color.a = item.alphaConfig.Value;
					}
					item.material.color = color;
					Plugin.Spam(((Object)item.material).name + " updated to " + valueUpdated.Value);
					return;
				}
			}
			Plugin.WARNING($"Could not find {((ConfigEntryBase)valueUpdated).Definition.Key} in material listing ({materialToColor.Count})");
		}

		internal static void UpdateGeneratedValue(ConfigEntry<float> valueUpdated)
		{
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			Plugin.Spam("Attempting to update value: " + ((ConfigEntryBase)valueUpdated).Definition.Key);
			foreach (CustomColorClass item2 in materialToColor)
			{
				if (item2.TryGetItem(valueUpdated, out var item))
				{
					Color color = Misc.HexToColor(item.colorConfig.Value);
					color.a = valueUpdated.Value;
					item.material.color = color;
					Plugin.Spam($"{((Object)item.material).name} updated to {valueUpdated.Value}");
					return;
				}
			}
			Plugin.WARNING($"Could not find {((ConfigEntryBase)valueUpdated).Definition.Key} in material listing ({materialToColor.Count})");
		}

		private static bool TryGetMeshRenderers(GameObject gameObject, out MeshRenderer[] mesh)
		{
			if ((Object)(object)gameObject == (Object)null)
			{
				mesh = null;
				Plugin.WARNING("GameObject provided is null @TryGetMeshRenderer");
				return false;
			}
			mesh = gameObject.GetComponents<MeshRenderer>();
			if (mesh == null)
			{
				return false;
			}
			return true;
		}

		private static bool TryGetChildObjects(GameObject parent, out List<GameObject> allObjects, GameObject parent2 = null)
		{
			allObjects = null;
			if ((Object)(object)parent == (Object)null)
			{
				Plugin.WARNING("parent object is NULL at TryGetChildObjects");
				return false;
			}
			if (parent.transform.childCount == 0)
			{
				return false;
			}
			allObjects = new List<GameObject>();
			for (int i = 0; i < parent.transform.childCount; i++)
			{
				if (!((Object)(object)parent2 != (Object)null) || !((Object)(object)parent2 == (Object)(object)((Component)parent.transform.GetChild(i)).gameObject))
				{
					allObjects.Add(((Component)parent.transform.GetChild(i)).gameObject);
				}
			}
			if ((Object)(object)parent2 != (Object)null && parent2.transform.childCount > 0)
			{
				for (int j = 0; j < parent2.transform.childCount; j++)
				{
					allObjects.Add(((Component)parent2.transform.GetChild(j)).gameObject);
				}
			}
			return true;
		}

		private static bool TryGetFamily(GameObject gameObject, out List<GameObject> familyTree)
		{
			familyTree = new List<GameObject>();
			if ((Object)(object)gameObject == (Object)null)
			{
				Plugin.WARNING("A provided gameobject is NULL at TryGetParents");
				return false;
			}
			if (gameObject.transform.childCount == 0)
			{
				return false;
			}
			List<Transform> list = gameObject.GetComponentsInChildren<Transform>().ToList();
			familyTree.Add(gameObject);
			foreach (Transform item in list)
			{
				if ((Object)(object)((Component)item).gameObject.GetComponent<MeshRenderer>() != (Object)null && (Object)(object)((Component)item).gameObject != (Object)null)
				{
					familyTree.Add(((Component)item).gameObject);
				}
			}
			Plugin.Spam($"TryGetFamily got familyTree tree for {((Object)gameObject).name} with [ {familyTree.Count} ] members");
			return true;
		}
	}
	internal class CustomColorClass
	{
		internal ConfigEntry<string> colorConfig;

		internal ConfigEntry<float> alphaConfig;

		internal Material material;

		internal CustomColorClass(ConfigEntry<string> stringEntry, ConfigEntry<float> floatEntry, Material mat)
		{
			colorConfig = stringEntry;
			alphaConfig = floatEntry;
			material = mat;
		}

		internal bool TryGetItem(ConfigEntry<string> configEntry, out CustomColorClass item)
		{
			if (configEntry == colorConfig)
			{
				item = this;
				return true;
			}
			item = null;
			return false;
		}

		internal bool TryGetItem(ConfigEntry<float> configEntry, out CustomColorClass item)
		{
			if (configEntry == alphaConfig)
			{
				item = this;
				return true;
			}
			item = null;
			return false;
		}
	}
	internal class GlobalSharedCustomization
	{
		internal static void UseSharedTextures()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			Misc.LogColorBeforeChange(StartOfRound.Instance.mapScreen.offScreenMat.color, ConfigSettings.Mat_ScreenOff);
			Misc.LogColorBeforeChange(((Renderer)StartOfRound.Instance.mapScreen.mesh).sharedMaterial.color, ConfigSettings.Mat_TerminalTex);
			StartOfRound.Instance.mapScreen.offScreenMat.color = Misc.HexToColor(ConfigSettings.Mat_ScreenOff.Value);
			Plugin.Spam("Mat_ScreenOff set");
			((Renderer)StartOfRound.Instance.mapScreen.mesh).sharedMaterial.color = Misc.HexToColor(ConfigSettings.Mat_TerminalTex.Value);
			Plugin.Spam("Mat_TerminalTex set");
			ChargingStation();
			ControlPanels();
			ShipInside();
			Bunkbeds();
			LockerCabinet();
			HangarDoorStuff();
		}

		private static void ShipInside()
		{
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			if (TryGetMeshRenderer("Environment/HangarShip/ShipInside", out var mesh))
			{
				Plugin.Spam($"This should be 5 - {((Renderer)mesh).sharedMaterials.Length}");
				Misc.LogColorBeforeChange(((Renderer)mesh).sharedMaterials[0].color, ConfigSettings.Mat_ShipHull);
				Misc.LogColorBeforeChange(((Renderer)mesh).sharedMaterials[1].color, ConfigSettings.Mat_ShipRoomMetal);
				Misc.LogColorBeforeChange(((Renderer)mesh).sharedMaterials[2].color, ConfigSettings.Mat_ShipFloor);
				((Renderer)mesh).sharedMaterials[0].color = Misc.HexToColor(ConfigSettings.Mat_ShipHull.Value);
				((Renderer)mesh).sharedMaterials[1].color = Misc.HexToColor(ConfigSettings.Mat_ShipRoomMetal.Value);
				((Renderer)mesh).sharedMaterials[2].color = Misc.HexToColor(ConfigSettings.Mat_ShipFloor.Value);
			}
		}

		private static void Bunkbeds()
		{
			SetSharedMaterial("Environment/HangarShip/Bunkbeds", ConfigSettings.Mat_BunkBeds);
		}

		private static void LockerCabinet()
		{
			SetSharedMaterial("Environment/HangarShip/StorageCloset", ConfigSettings.Mat_LockerCabinet);
			SetSharedMaterial("Environment/HangarShip/StorageCloset/Cube.000", ConfigSettings.Mat_LockerCabinet);
		}

		private static void HangarDoorStuff()
		{
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			SetSharedMaterial("Environment/HangarShip/DoorGenerator", ConfigSettings.Mat_DoorGenerator);
			SetSharedMaterial("Environment/HangarShip/AnimatedShipDoor/HangarDoorButtonPanel", ConfigSettings.Mat_DoorControlPanel);
			if (TryGetMeshRenderer("Environment/HangarShip/AnimatedShipDoor/HangarDoorLeft (1)", out var mesh))
			{
				Plugin.Spam($"This should be 2 - {((Renderer)mesh).sharedMaterials.Length}");
				Misc.LogColorBeforeChange(((Renderer)mesh).sharedMaterials[0].color, ConfigSettings.Mat_ShipDoors);
				Misc.LogColorBeforeChange(((Renderer)mesh).sharedMaterials[1].color, ConfigSettings.Mat_ShipDoors2);
				((Renderer)mesh).sharedMaterials[0].color = Misc.HexToColor(ConfigSettings.Mat_ShipDoors.Value);
				((Renderer)mesh).sharedMaterials[1].color = Misc.HexToColor(ConfigSettings.Mat_ShipDoors2.Value);
			}
		}

		private static void SetSharedMaterial(string FindObject, ConfigEntry<string> setting)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			if (TryGetMeshRenderer(FindObject, out var mesh))
			{
				Misc.LogColorBeforeChange(((Renderer)mesh).sharedMaterial.color, setting);
				((Renderer)mesh).sharedMaterial.color = Misc.HexToColor(setting.Value);
				Plugin.Spam(((ConfigEntryBase)setting).Definition.Key + " has been set");
			}
		}

		private static void ControlPanels()
		{
			SetSharedMaterial("Environment/HangarShip/ControlDesk", ConfigSettings.Mat_DeskBottom);
			SetSharedMaterial("Environment/HangarShip/ControlPanelWTexture", ConfigSettings.Mat_ControlPanel);
		}

		private static void ChargingStation()
		{
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			if (TryGetMeshRenderer("Environment/HangarShip/ShipModels2b/ChargeStation", out var mesh))
			{
				Plugin.Spam($"This should be 7 - {((Renderer)mesh).sharedMaterials.Length}");
				Misc.LogColorBeforeChange(((Renderer)mesh).sharedMaterials[0].color, ConfigSettings.Mat_Charger);
				Misc.LogColorBeforeChange(((Renderer)mesh).sharedMaterials[1].color, ConfigSettings.Mat_DarkSteel);
				Misc.LogColorBeforeChange(((Renderer)mesh).sharedMaterials[2].color, ConfigSettings.Mat_ElevatorSteel);
				Misc.LogColorBeforeChange(((Renderer)mesh).sharedMaterials[3].color, ConfigSettings.Mat_BlackRubber);
				((Renderer)mesh).sharedMaterials[0].color = Misc.HexToColor(ConfigSettings.Mat_Charger.Value);
				((Renderer)mesh).sharedMaterials[1].color = Misc.HexToColor(ConfigSettings.Mat_DarkSteel.Value);
				((Renderer)mesh).sharedMaterials[2].color = Misc.HexToColor(ConfigSettings.Mat_ElevatorSteel.Value);
				((Renderer)mesh).sharedMaterials[3].color = Misc.HexToColor(ConfigSettings.Mat_BlackRubber.Value);
				Plugin.Spam("Charger, Darksteel, ElevatorSteel, and BlackRubber materials set.");
			}
		}

		private static bool TryGetMeshRenderer(string GameObjectFind, out MeshRenderer mesh)
		{
			if ((Object)(object)GameObject.Find(GameObjectFind) == (Object)null)
			{
				mesh = null;
				Plugin.WARNING("Unable to find object at path " + GameObjectFind);
				return false;
			}
			mesh = GameObject.Find(GameObjectFind).GetComponent<MeshRenderer>();
			if ((Object)(object)mesh == (Object)null)
			{
				return false;
			}
			return true;
		}

		private static void GetAllMatchingMeshRenderers(Material query)
		{
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			List<MeshRenderer> list = Resources.FindObjectsOfTypeAll<MeshRenderer>().ToList();
			Plugin.Spam($"got all meshrenderers - {list.Count}");
			for (int i = 0; i < list.Count; i++)
			{
				if ((Object)(object)list[i] == (Object)null)
				{
					Plugin.Spam("meshRenderer is NULL");
				}
				else if (((Renderer)list[i]).materials == null)
				{
					Plugin.Spam("meshRenderer is NULL");
				}
				else if (((Renderer)list[i]).materials.Contains(query))
				{
					Plugin.Spam("material query found at " + ((Object)((Component)list[i]).gameObject).name);
					Scene scene = ((Component)list[i]).gameObject.scene;
					Plugin.Spam("path: " + ((Scene)(ref scene)).path);
				}
			}
		}
	}
	internal class CustomShipLights
	{
		internal static void SetShipLights()
		{
			SetLightColor("Environment/HangarShip/ShipElectricLights/Area Light (3)", ConfigSettings.ShipLight_1);
			SetLightColor("Environment/HangarShip/ShipElectricLights/Area Light (9)", ConfigSettings.ShipLight_4);
			SetLightColor("Environment/HangarShip/ShipElectricLights/Area Light (4)", ConfigSettings.ShipLight_2);
			SetLightColor("Environment/HangarShip/ShipElectricLights/Area Light (8)", ConfigSettings.ShipLight_5);
			SetLightColor("Environment/HangarShip/ShipElectricLights/Area Light (5)", ConfigSettings.ShipLight_3);
			SetLightColor("Environment/HangarShip/ShipElectricLights/Area Light (7)", ConfigSettings.ShipLight_6);
		}

		internal static void SetLightColor(string GameObjectFind, ConfigEntry<string> setting)
		{
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)GameObject.Find(GameObjectFind) != (Object)null && (Object)(object)GameObject.Find(GameObjectFind).GetComponent<Light>() != (Object)null)
			{
				GameObject.Find(GameObjectFind).GetComponent<Light>().color = Misc.HexToColor(setting.Value);
				Plugin.Spam(((ConfigEntryBase)setting).Definition.Key + " has been set for light at path " + GameObjectFind);
			}
		}
	}
}
namespace ShipColors.ConfigManager
{
	public static class GeneratedConfig
	{
		public static ConfigFile Generated = new ConfigFile(Path.Combine(Paths.ConfigPath, "ShipColors_Generated.cfg"), true);

		public static void GenerateWebpage()
		{
			WebHelper.WebConfig(Generated);
		}

		public static void RegenerateConfig()
		{
			if (GeneratedCustomization.configGenerated)
			{
				GeneratedCustomization.configGenerated = false;
				GeneratedCustomization.CreateAllConfigs();
			}
		}

		public static void ReadConfigCode()
		{
			if (!(ConfigSettings.ConfigCode.Value == string.Empty) && GeneratedCustomization.configGenerated)
			{
				WebHelper.ReadCompressedConfig(ref ConfigSettings.ConfigCode, Generated);
				GeneratedCustomization.ReadCustomClassValues(ref GeneratedCustomization.materialToColor);
			}
		}

		internal static void OnSettingChanged(object sender, SettingChangedEventArgs settingChangedArg)
		{
			Plugin.Spam("Generated config setting changed!");
			if ((Object)(object)StartOfRound.Instance != (Object)null)
			{
				if (settingChangedArg.ChangedSetting.BoxedValue.GetType() == typeof(string))
				{
					Plugin.Spam($"String detected, checking listing ({GeneratedCustomization.materialToColor.Count})");
					ConfigEntry<string> val = settingChangedArg.ChangedSetting as ConfigEntry<string>;
					foreach (CustomColorClass item in GeneratedCustomization.materialToColor)
					{
						if (item.colorConfig == val)
						{
							GeneratedCustomization.UpdateGeneratedValue(val);
							return;
						}
					}
					Plugin.WARNING("Unable to find " + ((ConfigEntryBase)val).Definition.Key);
				}
				else if (settingChangedArg.ChangedSetting.BoxedValue.GetType() == typeof(float))
				{
					Plugin.Spam($"float detected, checking listing ({GeneratedCustomization.materialToColor.Count})");
					ConfigEntry<float> val2 = settingChangedArg.ChangedSetting as ConfigEntry<float>;
					foreach (CustomColorClass item2 in GeneratedCustomization.materialToColor)
					{
						if (item2.alphaConfig == val2)
						{
							GeneratedCustomization.UpdateGeneratedValue(val2);
							return;
						}
					}
					Plugin.WARNING("Unable to find " + settingChangedArg.ChangedSetting.Definition.Key);
				}
				else
				{
					Plugin.WARNING($"Setting change does not match float or string! Type is {settingChangedArg.ChangedSetting.BoxedValue.GetType()}");
				}
			}
			else
			{
				Plugin.Spam("Not in-game or mode is not using generated config");
			}
		}
	}
	public static class ConfigSettings
	{
		public static ConfigEntry<string> ConfigCode;

		public static ConfigEntry<bool> ExtensiveLogging { get; internal set; }

		public static ConfigEntry<bool> DeveloperLogging { get; internal set; }

		public static ConfigEntry<string> ModeSetting { get; internal set; }

		public static ConfigEntry<string> GenAcceptedLayers { get; internal set; }

		public static ConfigEntry<string> GenBannedObjects { get; internal set; }

		public static ConfigEntry<string> GenBannedMaterials { get; internal set; }

		public static ConfigEntry<string> GenPermitListObjects { get; internal set; }

		public static ConfigEntry<bool> SetShipLights { get; internal set; }

		public static ConfigEntry<string> ShipLight_1 { get; internal set; }

		public static ConfigEntry<string> ShipLight_2 { get; internal set; }

		public static ConfigEntry<string> ShipLight_3 { get; internal set; }

		public static ConfigEntry<string> ShipLight_4 { get; internal set; }

		public static ConfigEntry<string> ShipLight_5 { get; internal set; }

		public static ConfigEntry<string> ShipLight_6 { get; internal set; }

		public static ConfigEntry<string> Mat_TerminalTex { get; internal set; }

		public static ConfigEntry<string> Mat_ScreenOff { get; internal set; }

		public static ConfigEntry<string> Mat_Charger { get; internal set; }

		public static ConfigEntry<string> Mat_DarkSteel { get; internal set; }

		public static ConfigEntry<string> Mat_ElevatorSteel { get; internal set; }

		public static ConfigEntry<string> Mat_BlackRubber { get; internal set; }

		public static ConfigEntry<string> Mat_DeskBottom { get; internal set; }

		public static ConfigEntry<string> Mat_ControlPanel { get; internal set; }

		public static ConfigEntry<string> Mat_ShipHull { get; internal set; }

		public static ConfigEntry<string> Mat_ShipRoomMetal { get; internal set; }

		public static ConfigEntry<string> Mat_ShipFloor { get; internal set; }

		public static ConfigEntry<string> Mat_BunkBeds { get; internal set; }

		public static ConfigEntry<string> Mat_LockerCabinet { get; internal set; }

		public static ConfigEntry<string> Mat_DoorGenerator { get; internal set; }

		public static ConfigEntry<string> Mat_DoorControlPanel { get; internal set; }

		public static ConfigEntry<string> Mat_ShipDoors { get; internal set; }

		public static ConfigEntry<string> Mat_ShipDoors2 { get; internal set; }

		public static void BindConfigSettings()
		{
			Plugin.Log.LogInfo((object)"Binding configuration settings");
			ExtensiveLogging = ConfigSetup.MakeBool(((BaseUnityPlugin)Plugin.instance).Config, "Debug", "ExtensiveLogging", false, "Enable or Disable extensive logging for this mod.");
			DeveloperLogging = ConfigSetup.MakeBool(((BaseUnityPlugin)Plugin.instance).Config, "Debug", "DeveloperLogging", false, "Enable or Disable developer logging for this mod. (this will fill your log file FAST)");
			ModeSetting = ConfigSetup.MakeClampedString(((BaseUnityPlugin)Plugin.instance).Config, "Setup", "ModeSetting", "Generate Config", "Determine whether to generate a config for each material or to use Global Shared Textures", new AcceptableValueList<string>(new string[2] { "Use Shared Textures", "Generate Config" }));
			ConfigCode = ConfigSetup.MakeString(((BaseUnityPlugin)Plugin.instance).Config, "Setup", "ConfigCode", "", "Paste your config code from the configuration website here to automatically apply your changes!");
			GenAcceptedLayers = ConfigSetup.MakeString(((BaseUnityPlugin)Plugin.instance).Config, "Setup", "GenAcceptedLayers", "0, 4, 6, 8, 9, 10, 26, 28", "[Comma-separated listing] - This sets the acceptable layers to search for materials in each GameObject in the ship. If a GameObject has a layer not specified here it will be skipped.");
			GenBannedObjects = ConfigSetup.MakeString(((BaseUnityPlugin)Plugin.instance).Config, "Setup", "GenBannedObjects", "Screen, (Clone), damageTrigger, ShipBoundsTrigger, ShipInnerRoomBoundsTrigger, ReverbTriggers, ScavengerModelSuitParts, Plane.001, LandingShipNavObstacle, SpawnRoom, VaultDoor, warningStickers", "[Comma-separated listing] - This listing of game objects will be skipped and no config section will be generated.\nExisting config section/items will be deleted on re-gen.");
			GenBannedMaterials = ConfigSetup.MakeString(((BaseUnityPlugin)Plugin.instance).Config, "Setup", "GenBannedMaterials", "testTrigger, testTriggerRed, MapScreen, DefaultHDMaterial, ShipScreen, BlackScreen", "[Comma-separated listing] - This listing of materials will be skipped and no config item will be generated.\nExisting config items will be deleted on re-gen.");
			GenPermitListObjects = ConfigSetup.MakeString(((BaseUnityPlugin)Plugin.instance).Config, "Setup", "GenPermitListObjects", "SingleScreen, VentChute(Clone)", "[Comma-separated listing] - This listing of game objects will be ALWAYS be added if an exact match is present.\nIgnores banned entries.");
			SetShipLights = ConfigSetup.MakeBool(((BaseUnityPlugin)Plugin.instance).Config, "Ship Lights", "SetShipLights", false, "Enable or Disable changing ship light colors section");
			ShipLight_1 = ConfigSetup.MakeString(((BaseUnityPlugin)Plugin.instance).Config, "Ship Lights", "ShipLight_1", "#FFFFFF", "This changes the color of the first ship light");
			ShipLight_2 = ConfigSetup.MakeString(((BaseUnityPlugin)Plugin.instance).Config, "Ship Lights", "ShipLight_2", "#FFFFFF", "This changes the color of the first ship light");
			ShipLight_3 = ConfigSetup.MakeString(((BaseUnityPlugin)Plugin.instance).Config, "Ship Lights", "ShipLight_3", "#FFFFFF", "This changes the color of the first ship light");
			ShipLight_4 = ConfigSetup.MakeString(((BaseUnityPlugin)Plugin.instance).Config, "Ship Lights", "ShipLight_4", "#FFFFFF", "This changes the color of the first ship light");
			ShipLight_5 = ConfigSetup.MakeString(((BaseUnityPlugin)Plugin.instance).Config, "Ship Lights", "ShipLight_5", "#FFFFFF", "This changes the color of the first ship light");
			ShipLight_6 = ConfigSetup.MakeString(((BaseUnityPlugin)Plugin.instance).Config, "Ship Lights", "ShipLight_6", "#FFFFFF", "This changes the color of the first ship light");
			Mat_TerminalTex = ConfigSetup.MakeString(((BaseUnityPlugin)Plugin.instance).Config, "Global Shared Textures", "Mat_TerminalTex", "#CFCFCF", "This changes the color of the physical terminal texture (re-used by other electronics)");
			Mat_Charger = ConfigSetup.MakeString(((BaseUnityPlugin)Plugin.instance).Config, "Global Shared Textures", "Mat_Charger", "#5C5840", "This changes the color of the main texture of the charging station");
			Mat_DarkSteel = ConfigSetup.MakeString(((BaseUnityPlugin)Plugin.instance).Config, "Global Shared Textures", "Mat_DarkSteel", "#494949", "This changes the color of the DarkSteel material that is used throughout the game");
			Mat_ElevatorSteel = ConfigSetup.MakeString(((BaseUnityPlugin)Plugin.instance).Config, "Global Shared Textures", "Mat_ElevatorSteel", "#FFFFFF", "This changes the color of the ElevatorSteel material that is used throughout the game");
			Mat_BlackRubber = ConfigSetup.MakeString(((BaseUnityPlugin)Plugin.instance).Config, "Global Shared Textures", "Mat_BlackRubber", "#2E2E2E", "This changes the color of the BlackRubber material that is used throughout the game");
			Mat_ScreenOff = ConfigSetup.MakeString(((BaseUnityPlugin)Plugin.instance).Config, "Global Shared Textures", "Mat_ScreenOff", "#000000", "This changes the color of the ScreenOff material that is used throughout the game");
			Mat_DeskBottom = ConfigSetup.MakeString(((BaseUnityPlugin)Plugin.instance).Config, "Global Shared Textures", "Mat_DeskBottom", "#545250", "This changes the color of the Desk Bottom texture by the ship monitors and everywhere else it is re-used");
			Mat_ControlPanel = ConfigSetup.MakeString(((BaseUnityPlugin)Plugin.instance).Config, "Global Shared Textures", "Mat_ControlPanel", "#6C6862", "This changes the color of the ControlPanel shared material that is used throughout the game");
			Mat_ShipFloor = ConfigSetup.MakeString(((BaseUnityPlugin)Plugin.instance).Config, "Global Shared Textures", "Mat_ShipFloor", "#C8BDB8", "This changes the color of the ShipFloor shared material that is used throughout the game");
			Mat_ShipHull = ConfigSetup.MakeString(((BaseUnityPlugin)Plugin.instance).Config, "Global Shared Textures", "Mat_ShipHull", "#FFFFFF", "This changes the color of the ShipHull shared material that is used throughout the game");
			Mat_ShipRoomMetal = ConfigSetup.MakeString(((BaseUnityPlugin)Plugin.instance).Config, "Global Shared Textures", "Mat_ShipRoomMetal", "#D6C9B5", "This changes the color of the ShipRoomMetal shared material that is used throughout the game");
			Mat_BunkBeds = ConfigSetup.MakeString(((BaseUnityPlugin)Plugin.instance).Config, "Global Shared Textures", "Mat_BunkBeds", "#CFCFCF", "This changes the color of the BunkBeds shared material that is used throughout the game");
			Mat_LockerCabinet = ConfigSetup.MakeString(((BaseUnityPlugin)Plugin.instance).Config, "Global Shared Textures", "Mat_LockerCabinet", "#7D2426", "This changes the color of the LockerCabinet shared material that is used throughout the game");
			Mat_ShipDoors = ConfigSetup.MakeString(((BaseUnityPlugin)Plugin.instance).Config, "Global Shared Textures", "Mat_ShipDoors", "#71665E", "This changes the color of the ShipDoors shared material that is used throughout the game");
			Mat_ShipDoors2 = ConfigSetup.MakeString(((BaseUnityPlugin)Plugin.instance).Config, "Global Shared Textures", "Mat_ShipDoors2", "#6F645D", "This changes the color of the ShipDoors2 shared material that is used throughout the game");
			Mat_DoorGenerator = ConfigSetup.MakeString(((BaseUnityPlugin)Plugin.instance).Config, "Global Shared Textures", "Mat_DoorGenerator", "#FFECD0", "This changes the color of the DoorGenerator shared material that is used throughout the game");
			Mat_DoorControlPanel = ConfigSetup.MakeString(((BaseUnityPlugin)Plugin.instance).Config, "Global Shared Textures", "Mat_DoorControlPanel", "#373732", "This changes the color of the DoorControlPanel shared material that is used throughout the game");
			ConfigSetup.RemoveOrphanedEntries(((BaseUnityPlugin)Plugin.instance).Config);
		}
	}
}
namespace ShipColors.Compat
{
	internal class LethalConfigStuff
	{
		public static void AddConfig(ConfigFile configName)
		{
			if (LethalConfigSoft.IsLethalConfigUpdated())
			{
				Plugin.Spam("Queuing file " + configName.ConfigFilePath);
				LethalConfigManager.QueueCustomConfigFileForLateAutoGeneration(configName);
				LethalConfigManager.RunLateAutoGeneration();
			}
		}
	}
	internal class MyTerminalStuff
	{
		internal static bool AddTerminalConfigs()
		{
			if (!Plugin.instance.darmuhsTerminalStuff)
			{
				return true;
			}
			if (ConfigSettings.TerminalCustomization.Value)
			{
				return false;
			}
			return true;
		}
	}
}