Decompiled source of CustomPosters v1.4.0

CustomPosters.dll

Decompiled 2 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
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(".NETFramework,Version=v4.7", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("CustomPosters")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("LC posters API")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("CustomPosters")]
[assembly: AssemblyTitle("CustomPosters")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.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 CustomPosters
{
	internal class Patches
	{
		[CompilerGenerated]
		private sealed class <>c__DisplayClass17_0
		{
			public Dictionary<string, List<(Texture2D texture, string filePath)>> allTextures;
		}

		[CompilerGenerated]
		private sealed class <>c__DisplayClass17_1
		{
			public string file;

			public <>c__DisplayClass17_0 CS$<>8__locals1;

			internal void <CreateCustomPostersAsync>b__2(Texture2D texture)
			{
				if ((Object)(object)texture != (Object)null)
				{
					string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(file);
					if (!CS$<>8__locals1.allTextures.ContainsKey(fileNameWithoutExtension))
					{
						CS$<>8__locals1.allTextures[fileNameWithoutExtension] = new List<(Texture2D, string)>();
					}
					CS$<>8__locals1.allTextures[fileNameWithoutExtension].Add((texture, file));
				}
			}
		}

		[CompilerGenerated]
		private sealed class <>c__DisplayClass17_2
		{
			public string file;

			public <>c__DisplayClass17_0 CS$<>8__locals2;

			internal void <CreateCustomPostersAsync>b__3(Texture2D texture)
			{
				if ((Object)(object)texture != (Object)null)
				{
					string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(file);
					if (!CS$<>8__locals2.allTextures.ContainsKey(fileNameWithoutExtension))
					{
						CS$<>8__locals2.allTextures[fileNameWithoutExtension] = new List<(Texture2D, string)>();
					}
					CS$<>8__locals2.allTextures[fileNameWithoutExtension].Add((texture, file));
				}
			}
		}

		[CompilerGenerated]
		private sealed class <CreateCustomPostersAsync>d__17 : IEnumerator<object>, IDisposable, IEnumerator
		{
			private int <>1__state;

			private object <>2__current;

			private <>c__DisplayClass17_0 <>8__1;

			private GameObject <environment>5__2;

			private GameObject <hangarShip>5__3;

			private GameObject <postersParent>5__4;

			private GameObject <posterPlane>5__5;

			private MeshRenderer <originalRenderer>5__6;

			private Material <originalMaterial>5__7;

			private (Vector3 position, Vector3 rotation, Vector3 scale, string name)[] <posterData>5__8;

			private List<string> <enabledPacks>5__9;

			private List<string> <enabledPackNames>5__10;

			private List<string> <packsToUse>5__11;

			private bool <anyTextureLoaded>5__12;

			private GameObject <vanillaPlane>5__13;

			private string <>s__14;

			private string <selectedPackName>5__15;

			private List<string>.Enumerator <>s__16;

			private string <pack>5__17;

			private string <postersPath>5__18;

			private string <tipsPath>5__19;

			private string[] <>s__20;

			private int <>s__21;

			private <>c__DisplayClass17_1 <>8__22;

			private string[] <>s__23;

			private int <>s__24;

			private <>c__DisplayClass17_2 <>8__25;

			private int <i>5__26;

			private GameObject <poster>5__27;

			private MeshRenderer <renderer>5__28;

			private List<(Texture2D texture, string filePath)> <textures>5__29;

			private (Texture2D texture, string filePath) <textureData>5__30;

			private Material <material>5__31;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <CreateCustomPostersAsync>d__17(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				int num = <>1__state;
				if (num == -3 || (uint)(num - 1) <= 1u)
				{
					try
					{
					}
					finally
					{
						<>m__Finally1();
					}
				}
				<>8__1 = null;
				<environment>5__2 = null;
				<hangarShip>5__3 = null;
				<postersParent>5__4 = null;
				<posterPlane>5__5 = null;
				<originalRenderer>5__6 = null;
				<originalMaterial>5__7 = null;
				<posterData>5__8 = null;
				<enabledPacks>5__9 = null;
				<enabledPackNames>5__10 = null;
				<packsToUse>5__11 = null;
				<vanillaPlane>5__13 = null;
				<>s__14 = null;
				<selectedPackName>5__15 = null;
				<>s__16 = default(List<string>.Enumerator);
				<pack>5__17 = null;
				<postersPath>5__18 = null;
				<tipsPath>5__19 = null;
				<>s__20 = null;
				<>8__22 = null;
				<>s__23 = null;
				<>8__25 = null;
				<poster>5__27 = null;
				<renderer>5__28 = null;
				<textures>5__29 = null;
				<textureData>5__30 = default((Texture2D, string));
				<material>5__31 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_1c02: Unknown result type (might be due to invalid IL or missing references)
				//IL_1c29: Unknown result type (might be due to invalid IL or missing references)
				//IL_1c2e: Unknown result type (might be due to invalid IL or missing references)
				//IL_1c55: Unknown result type (might be due to invalid IL or missing references)
				//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e7: Expected O, but got Unknown
				//IL_010e: Unknown result type (might be due to invalid IL or missing references)
				//IL_1cdb: Unknown result type (might be due to invalid IL or missing references)
				//IL_1ce5: Expected O, but got Unknown
				//IL_01cb: 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_01f3: Unknown result type (might be due to invalid IL or missing references)
				//IL_0218: Unknown result type (might be due to invalid IL or missing references)
				//IL_022c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0240: Unknown result type (might be due to invalid IL or missing references)
				//IL_0265: Unknown result type (might be due to invalid IL or missing references)
				//IL_0279: Unknown result type (might be due to invalid IL or missing references)
				//IL_028d: Unknown result type (might be due to invalid IL or missing references)
				//IL_02b2: Unknown result type (might be due to invalid IL or missing references)
				//IL_02c6: Unknown result type (might be due to invalid IL or missing references)
				//IL_02da: Unknown result type (might be due to invalid IL or missing references)
				//IL_02ff: Unknown result type (might be due to invalid IL or missing references)
				//IL_0313: Unknown result type (might be due to invalid IL or missing references)
				//IL_0327: Unknown result type (might be due to invalid IL or missing references)
				//IL_034c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0360: Unknown result type (might be due to invalid IL or missing references)
				//IL_0374: Unknown result type (might be due to invalid IL or missing references)
				//IL_03cc: Unknown result type (might be due to invalid IL or missing references)
				//IL_03e0: Unknown result type (might be due to invalid IL or missing references)
				//IL_03f4: Unknown result type (might be due to invalid IL or missing references)
				//IL_041e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0432: Unknown result type (might be due to invalid IL or missing references)
				//IL_0446: Unknown result type (might be due to invalid IL or missing references)
				//IL_04b2: Unknown result type (might be due to invalid IL or missing references)
				//IL_04c6: Unknown result type (might be due to invalid IL or missing references)
				//IL_04da: Unknown result type (might be due to invalid IL or missing references)
				//IL_0504: Unknown result type (might be due to invalid IL or missing references)
				//IL_0518: Unknown result type (might be due to invalid IL or missing references)
				//IL_052c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0556: Unknown result type (might be due to invalid IL or missing references)
				//IL_056a: Unknown result type (might be due to invalid IL or missing references)
				//IL_057e: Unknown result type (might be due to invalid IL or missing references)
				//IL_05a8: Unknown result type (might be due to invalid IL or missing references)
				//IL_05bc: Unknown result type (might be due to invalid IL or missing references)
				//IL_05d0: Unknown result type (might be due to invalid IL or missing references)
				//IL_05fa: Unknown result type (might be due to invalid IL or missing references)
				//IL_060e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0622: Unknown result type (might be due to invalid IL or missing references)
				//IL_064c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0660: Unknown result type (might be due to invalid IL or missing references)
				//IL_0674: Unknown result type (might be due to invalid IL or missing references)
				//IL_0714: Unknown result type (might be due to invalid IL or missing references)
				//IL_0728: Unknown result type (might be due to invalid IL or missing references)
				//IL_073c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0766: Unknown result type (might be due to invalid IL or missing references)
				//IL_077a: Unknown result type (might be due to invalid IL or missing references)
				//IL_078e: Unknown result type (might be due to invalid IL or missing references)
				//IL_07b8: Unknown result type (might be due to invalid IL or missing references)
				//IL_07cc: Unknown result type (might be due to invalid IL or missing references)
				//IL_07e0: Unknown result type (might be due to invalid IL or missing references)
				//IL_080a: Unknown result type (might be due to invalid IL or missing references)
				//IL_081e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0832: Unknown result type (might be due to invalid IL or missing references)
				//IL_0c93: Unknown result type (might be due to invalid IL or missing references)
				//IL_0ca7: Unknown result type (might be due to invalid IL or missing references)
				//IL_0cbb: Unknown result type (might be due to invalid IL or missing references)
				//IL_0ce5: Unknown result type (might be due to invalid IL or missing references)
				//IL_0cf9: Unknown result type (might be due to invalid IL or missing references)
				//IL_0d0d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0d37: Unknown result type (might be due to invalid IL or missing references)
				//IL_0d4b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0d5f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0d89: Unknown result type (might be due to invalid IL or missing references)
				//IL_0d9d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0db1: Unknown result type (might be due to invalid IL or missing references)
				//IL_0ddb: Unknown result type (might be due to invalid IL or missing references)
				//IL_0def: Unknown result type (might be due to invalid IL or missing references)
				//IL_0e03: Unknown result type (might be due to invalid IL or missing references)
				//IL_0861: Unknown result type (might be due to invalid IL or missing references)
				//IL_0875: Unknown result type (might be due to invalid IL or missing references)
				//IL_0889: Unknown result type (might be due to invalid IL or missing references)
				//IL_08b3: Unknown result type (might be due to invalid IL or missing references)
				//IL_08c7: Unknown result type (might be due to invalid IL or missing references)
				//IL_08db: Unknown result type (might be due to invalid IL or missing references)
				//IL_0905: Unknown result type (might be due to invalid IL or missing references)
				//IL_0919: Unknown result type (might be due to invalid IL or missing references)
				//IL_092d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0957: Unknown result type (might be due to invalid IL or missing references)
				//IL_096b: Unknown result type (might be due to invalid IL or missing references)
				//IL_097f: Unknown result type (might be due to invalid IL or missing references)
				//IL_09a9: Unknown result type (might be due to invalid IL or missing references)
				//IL_09bd: Unknown result type (might be due to invalid IL or missing references)
				//IL_09d1: Unknown result type (might be due to invalid IL or missing references)
				//IL_09fb: Unknown result type (might be due to invalid IL or missing references)
				//IL_0a0f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0a23: Unknown result type (might be due to invalid IL or missing references)
				//IL_0e57: Unknown result type (might be due to invalid IL or missing references)
				//IL_0e6b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0e7f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0ea9: Unknown result type (might be due to invalid IL or missing references)
				//IL_0ebd: Unknown result type (might be due to invalid IL or missing references)
				//IL_0ed1: Unknown result type (might be due to invalid IL or missing references)
				//IL_0efb: Unknown result type (might be due to invalid IL or missing references)
				//IL_0f0f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0f23: Unknown result type (might be due to invalid IL or missing references)
				//IL_0f4d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0f61: Unknown result type (might be due to invalid IL or missing references)
				//IL_0f75: Unknown result type (might be due to invalid IL or missing references)
				//IL_0f9f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0fb3: Unknown result type (might be due to invalid IL or missing references)
				//IL_0fc7: Unknown result type (might be due to invalid IL or missing references)
				//IL_0ff1: Unknown result type (might be due to invalid IL or missing references)
				//IL_1005: Unknown result type (might be due to invalid IL or missing references)
				//IL_1019: Unknown result type (might be due to invalid IL or missing references)
				//IL_1068: Unknown result type (might be due to invalid IL or missing references)
				//IL_107c: Unknown result type (might be due to invalid IL or missing references)
				//IL_1090: Unknown result type (might be due to invalid IL or missing references)
				//IL_10ba: Unknown result type (might be due to invalid IL or missing references)
				//IL_10ce: Unknown result type (might be due to invalid IL or missing references)
				//IL_10e2: Unknown result type (might be due to invalid IL or missing references)
				//IL_110c: Unknown result type (might be due to invalid IL or missing references)
				//IL_1120: Unknown result type (might be due to invalid IL or missing references)
				//IL_1134: Unknown result type (might be due to invalid IL or missing references)
				//IL_115e: Unknown result type (might be due to invalid IL or missing references)
				//IL_1172: Unknown result type (might be due to invalid IL or missing references)
				//IL_1186: Unknown result type (might be due to invalid IL or missing references)
				//IL_11b0: Unknown result type (might be due to invalid IL or missing references)
				//IL_11c4: Unknown result type (might be due to invalid IL or missing references)
				//IL_11d8: Unknown result type (might be due to invalid IL or missing references)
				//IL_1202: Unknown result type (might be due to invalid IL or missing references)
				//IL_1216: Unknown result type (might be due to invalid IL or missing references)
				//IL_122a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0a6e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0a82: Unknown result type (might be due to invalid IL or missing references)
				//IL_0a96: Unknown result type (might be due to invalid IL or missing references)
				//IL_0ac0: Unknown result type (might be due to invalid IL or missing references)
				//IL_0ad4: Unknown result type (might be due to invalid IL or missing references)
				//IL_0ae8: Unknown result type (might be due to invalid IL or missing references)
				//IL_0b12: Unknown result type (might be due to invalid IL or missing references)
				//IL_0b26: Unknown result type (might be due to invalid IL or missing references)
				//IL_0b3a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0b64: Unknown result type (might be due to invalid IL or missing references)
				//IL_0b78: Unknown result type (might be due to invalid IL or missing references)
				//IL_0b8c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0bb6: Unknown result type (might be due to invalid IL or missing references)
				//IL_0bca: Unknown result type (might be due to invalid IL or missing references)
				//IL_0bde: Unknown result type (might be due to invalid IL or missing references)
				//IL_0c08: Unknown result type (might be due to invalid IL or missing references)
				//IL_0c1c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0c30: Unknown result type (might be due to invalid IL or missing references)
				//IL_1294: Unknown result type (might be due to invalid IL or missing references)
				//IL_12a8: Unknown result type (might be due to invalid IL or missing references)
				//IL_12bc: Unknown result type (might be due to invalid IL or missing references)
				//IL_12e6: Unknown result type (might be due to invalid IL or missing references)
				//IL_12fa: Unknown result type (might be due to invalid IL or missing references)
				//IL_130e: Unknown result type (might be due to invalid IL or missing references)
				//IL_1338: Unknown result type (might be due to invalid IL or missing references)
				//IL_134c: Unknown result type (might be due to invalid IL or missing references)
				//IL_1360: Unknown result type (might be due to invalid IL or missing references)
				//IL_138a: Unknown result type (might be due to invalid IL or missing references)
				//IL_139e: Unknown result type (might be due to invalid IL or missing references)
				//IL_13b2: Unknown result type (might be due to invalid IL or missing references)
				//IL_13dc: Unknown result type (might be due to invalid IL or missing references)
				//IL_13f0: Unknown result type (might be due to invalid IL or missing references)
				//IL_1404: Unknown result type (might be due to invalid IL or missing references)
				//IL_1457: Unknown result type (might be due to invalid IL or missing references)
				//IL_146b: Unknown result type (might be due to invalid IL or missing references)
				//IL_147f: Unknown result type (might be due to invalid IL or missing references)
				//IL_14a9: Unknown result type (might be due to invalid IL or missing references)
				//IL_14bd: Unknown result type (might be due to invalid IL or missing references)
				//IL_14d1: Unknown result type (might be due to invalid IL or missing references)
				//IL_14fb: Unknown result type (might be due to invalid IL or missing references)
				//IL_150f: Unknown result type (might be due to invalid IL or missing references)
				//IL_1523: Unknown result type (might be due to invalid IL or missing references)
				//IL_154d: Unknown result type (might be due to invalid IL or missing references)
				//IL_1561: Unknown result type (might be due to invalid IL or missing references)
				//IL_1575: Unknown result type (might be due to invalid IL or missing references)
				//IL_159f: Unknown result type (might be due to invalid IL or missing references)
				//IL_15b3: Unknown result type (might be due to invalid IL or missing references)
				//IL_15c7: Unknown result type (might be due to invalid IL or missing references)
				//IL_1614: Unknown result type (might be due to invalid IL or missing references)
				//IL_1628: Unknown result type (might be due to invalid IL or missing references)
				//IL_163c: Unknown result type (might be due to invalid IL or missing references)
				//IL_1666: Unknown result type (might be due to invalid IL or missing references)
				//IL_167a: Unknown result type (might be due to invalid IL or missing references)
				//IL_168e: Unknown result type (might be due to invalid IL or missing references)
				//IL_16b8: Unknown result type (might be due to invalid IL or missing references)
				//IL_16cc: Unknown result type (might be due to invalid IL or missing references)
				//IL_16e0: Unknown result type (might be due to invalid IL or missing references)
				//IL_170a: Unknown result type (might be due to invalid IL or missing references)
				//IL_171e: Unknown result type (might be due to invalid IL or missing references)
				//IL_1732: Unknown result type (might be due to invalid IL or missing references)
				//IL_175c: Unknown result type (might be due to invalid IL or missing references)
				//IL_1770: Unknown result type (might be due to invalid IL or missing references)
				//IL_1784: Unknown result type (might be due to invalid IL or missing references)
				try
				{
					switch (<>1__state)
					{
					default:
						return false;
					case 0:
					{
						<>1__state = -1;
						<>8__1 = new <>c__DisplayClass17_0();
						CleanUpPosters();
						<environment>5__2 = GameObject.Find("Environment");
						if ((Object)(object)<environment>5__2 == (Object)null)
						{
							Logger.LogError((object)"Environment GameObject not found in the scene hierarchy!");
							return false;
						}
						Transform obj = <environment>5__2.transform.Find("HangarShip");
						<hangarShip>5__3 = ((obj != null) ? ((Component)obj).gameObject : null);
						if ((Object)(object)<hangarShip>5__3 == (Object)null)
						{
							Logger.LogError((object)"HangarShip GameObject not found under Environment!");
							return false;
						}
						<postersParent>5__4 = new GameObject("CustomPosters");
						<postersParent>5__4.transform.SetParent(<hangarShip>5__3.transform);
						<postersParent>5__4.transform.localPosition = Vector3.zero;
						<posterPlane>5__5 = GameObject.Find("Environment/HangarShip/Plane.001");
						if ((Object)(object)<posterPlane>5__5 == (Object)null)
						{
							Logger.LogError((object)"Poster (Plane.001) not found under HangarShip!");
							return false;
						}
						<originalRenderer>5__6 = <posterPlane>5__5.GetComponent<MeshRenderer>();
						if ((Object)(object)<originalRenderer>5__6 == (Object)null || ((Renderer)<originalRenderer>5__6).materials.Length == 0)
						{
							Logger.LogError((object)"Poster plane renderer or materials not found!");
							return false;
						}
						<originalMaterial>5__7 = ((Renderer)<originalRenderer>5__6).material;
						<posterData>5__8 = new(Vector3, Vector3, Vector3, string)[6]
						{
							(new Vector3(4.1886f, 2.9318f, -16.8409f), new Vector3(0f, 200.9872f, 0f), new Vector3(0.6391f, 0.4882f, 2f), "Poster1"),
							(new Vector3(6.4202f, 2.4776f, -10.8226f), new Vector3(0f, 0f, 0f), new Vector3(0.7296f, 0.4896f, 1f), "Poster2"),
							(new Vector3(9.9186f, 2.8591f, -17.4716f), new Vector3(0f, 180f, 356.3345f), new Vector3(0.7487f, 1.0539f, 1f), "Poster3"),
							(new Vector3(5.2187f, 2.5963f, -11.0945f), new Vector3(0f, 337.5868f, 2.68f), new Vector3(0.7289f, 0.9989f, 1f), "Poster4"),
							(new Vector3(5.5286f, 2.5882f, -17.3541f), new Vector3(0f, 201.1556f, 359.8f), new Vector3(0.5516f, 0.769f, 1f), "Poster5"),
							(new Vector3(3.0647f, 2.8174f, -11.7341f), new Vector3(0f, 0f, 358.6752f), new Vector3(0.8596f, 1.2194f, 1f), "CustomTips")
						};
						if (Plugin.IsShipWindowsInstalled && Plugin.IsWindow2Enabled)
						{
							Logger.LogInfo((object)"ShipWindows/Beta: Repositioning Poster2 and Poster4 due to Right Window enabled.");
							<posterData>5__8[1] = (new Vector3(6.4202f, 2.2577f, -10.8226f), new Vector3(0f, 0f, 0f), new Vector3(0.7296f, 0.4896f, 1f), "Poster2");
							<posterData>5__8[3] = (new Vector3(6.4449f, 3.0961f, -10.8221f), new Vector3(0f, 0.026f, 2.68f), new Vector3(0.7289f, 0.9989f, 1f), "Poster4");
						}
						if (Plugin.IsShipWindowsInstalled && Plugin.IsWindow2Enabled && Plugin.IsWiderShipModInstalled && Plugin.WiderShipExtendedSide == "Left")
						{
							Logger.LogInfo((object)"ShipWindows/Beta Left Window and WiderShipMod Extended Side Left detected, Repositioning Poster2 and Poster4.");
							<posterData>5__8[1] = (new Vector3(6.4202f, 2.2577f, -10.8226f), new Vector3(0f, 0f, 0f), new Vector3(0.7296f, 0.4896f, 1f), "Poster2");
							<posterData>5__8[3] = (new Vector3(6.4449f, 3.0961f, -10.8221f), new Vector3(0f, 0.026f, 2.68f), new Vector3(0.7289f, 0.9989f, 1f), "Poster4");
							<posterData>5__8[0] = (new Vector3(4.6777f, 2.9007f, -19.63f), new Vector3(0f, 118.2274f, 0f), new Vector3(0.6391f, 0.4882f, 2f), "Poster1");
							<posterData>5__8[2] = (new Vector3(9.7197f, 2.8151f, -17.4716f), new Vector3(0f, 180f, 356.3345f), new Vector3(0.7487f, 1.0539f, 1f), "Poster3");
							<posterData>5__8[4] = (new Vector3(5.3602f, 2.5482f, -18.3793f), new Vector3(0f, 118.0114f, 359.8f), new Vector3(0.5516f, 0.769f, 1f), "Poster5");
							<posterData>5__8[5] = (new Vector3(2.8647f, 2.7774f, -11.7341f), new Vector3(0f, 0f, 358.6752f), new Vector3(0.8596f, 1.2194f, 1f), "CustomTips");
						}
						if (Plugin.IsWiderShipModInstalled)
						{
							Logger.LogInfo((object)("Adjusting poster positions for WiderShipMod Extended Side: " + Plugin.WiderShipExtendedSide));
							string widerShipExtendedSide = Plugin.WiderShipExtendedSide;
							<>s__14 = widerShipExtendedSide;
							switch (<>s__14)
							{
							case "Both":
								<posterData>5__8[0] = (new Vector3(4.6877f, 2.9407f, -19.62f), new Vector3(0f, 118.2274f, 0f), new Vector3(0.6391f, 0.4882f, 2f), "Poster1");
								<posterData>5__8[3] = (new Vector3(5.5699f, 2.5963f, -10.3268f), new Vector3(0f, 62.0324f, 2.6799f), new Vector3(0.7289f, 0.9989f, 1f), "Poster4");
								<posterData>5__8[4] = (new Vector3(5.3602f, 2.5882f, -18.3793f), new Vector3(0f, 118.0114f, 359.8f), new Vector3(0.5516f, 0.769f, 1f), "Poster5");
								<posterData>5__8[5] = (new Vector3(3.0947f, 2.8174f, -6.7253f), new Vector3(0f, 0f, 358.6752f), new Vector3(0.8596f, 1.2194f, 1f), "CustomTips");
								break;
							case "Right":
								<posterData>5__8[0] = (new Vector3(4.2224f, 2.9318f, -16.8609f), new Vector3(0f, 200.9872f, 0f), new Vector3(0.6391f, 0.4882f, 2f), "Poster1");
								<posterData>5__8[1] = (new Vector3(6.4202f, 2.4776f, -10.8226f), new Vector3(0f, 0f, 0f), new Vector3(0.7296f, 0.4896f, 1f), "Poster2");
								<posterData>5__8[2] = (new Vector3(9.9426f, 2.8591f, -17.4716f), new Vector3(0f, 180f, 356.3345f), new Vector3(0.7487f, 1.0539f, 1f), "Poster3");
								<posterData>5__8[3] = (new Vector3(5.5699f, 2.5963f, -10.3268f), new Vector3(0f, 62.0324f, 2.6799f), new Vector3(0.7289f, 0.9989f, 1f), "Poster4");
								<posterData>5__8[4] = (new Vector3(5.5386f, 2.5882f, -17.3641f), new Vector3(0f, 200.9099f, 359.8f), new Vector3(0.5516f, 0.769f, 1f), "Poster5");
								<posterData>5__8[5] = (new Vector3(3.0947f, 2.8174f, -6.733f), new Vector3(0f, 0f, 358.6752f), new Vector3(0.8596f, 1.2194f, 1f), "CustomTips");
								break;
							case "Left":
								if (!Plugin.IsShipWindowsInstalled || !Plugin.IsWindow2Enabled)
								{
									<posterData>5__8[0] = (new Vector3(4.6777f, 2.9007f, -19.63f), new Vector3(0f, 118.2274f, 0f), new Vector3(0.6391f, 0.4882f, 2f), "Poster1");
									<posterData>5__8[1] = (new Vector3(6.4202f, 2.2577f, -10.8226f), new Vector3(0f, 0f, 0f), new Vector3(0.7296f, 0.4882f, 2f), "Poster2");
									<posterData>5__8[2] = (new Vector3(9.7197f, 2.8151f, -17.4716f), new Vector3(0f, 180f, 356.3345f), new Vector3(0.7487f, 1.0539f, 1f), "Poster3");
									<posterData>5__8[3] = (new Vector3(5.2187f, 2.5963f, -11.0945f), new Vector3(0f, 337.5868f, 2.68f), new Vector3(0.7289f, 0.9989f, 1f), "Poster4");
									<posterData>5__8[4] = (new Vector3(5.3602f, 2.5482f, -18.3793f), new Vector3(0f, 118.0114f, 359.8f), new Vector3(0.5516f, 0.769f, 1f), "Poster5");
									<posterData>5__8[5] = (new Vector3(2.8647f, 2.7774f, -11.7341f), new Vector3(0f, 0f, 358.6752f), new Vector3(0.8596f, 1.2194f, 1f), "CustomTips");
								}
								break;
							}
							<>s__14 = null;
						}
						if (Plugin.Is2StoryShipModInstalled)
						{
							if (Plugin.IsShipWindowsInstalled)
							{
								Logger.LogInfo((object)"ShipWindows and 2 Story Ship Mod detected. Ignoring both configs and repositioning posters.");
								<posterData>5__8[0] = (new Vector3(6.5923f, 2.9318f, -17.4766f), new Vector3(0f, 179.2201f, 0f), new Vector3(0.6391f, 0.4882f, 2f), "Poster1");
								<posterData>5__8[1] = (new Vector3(9.0884f, 2.4776f, -8.8229f), new Vector3(0f, 0f, 0f), new Vector3(0.7296f, 0.4896f, 1f), "Poster2");
								<posterData>5__8[3] = (new Vector3(5.3599f, 2.5963f, -9.455f), new Vector3(0f, 307.2657f, 2.68f), new Vector3(0.7289f, 0.9989f, 1f), "Poster4");
								<posterData>5__8[4] = (new Vector3(10.2813f, 2.7482f, -8.8271f), new Vector3(0f, 0.9014f, 359.8f), new Vector3(0.5516f, 0.769f, 1f), "Poster5");
								<posterData>5__8[5] = (new Vector3(2.5679f, 2.6763f, -11.7341f), new Vector3(0f, 0f, 358.6752f), new Vector3(0.8596f, 1.2194f, 1f), "CustomTips");
							}
							if (Plugin.IsShipWindowsInstalled && Plugin.IsWiderShipModInstalled)
							{
								Logger.LogInfo((object)"ShipWindows and WiderShipMod detected with 2 Story Ship Mod. Using default 2 Story Ship Mod positions.");
								<posterData>5__8[0] = (new Vector3(6.5923f, 2.9318f, -22.4766f), new Vector3(0f, 179.2201f, 0f), new Vector3(0.6391f, 0.4882f, 2f), "Poster1");
								<posterData>5__8[1] = (new Vector3(9.0884f, 2.4776f, -5.8265f), new Vector3(0f, 0f, 0f), new Vector3(0.7296f, 0.4896f, 1f), "Poster2");
								<posterData>5__8[2] = (new Vector3(10.1364f, 2.8591f, -22.4788f), new Vector3(0f, 180.3376f, 0f), new Vector3(0.7487f, 1.0539f, 1f), "Poster3");
								<posterData>5__8[3] = (new Vector3(5.3599f, 2.5963f, -9.455f), new Vector3(0f, 307.2657f, 2.68f), new Vector3(0.7289f, 0.9989f, 1f), "Poster4");
								<posterData>5__8[4] = (new Vector3(7.8577f, 2.7482f, -22.4803f), new Vector3(0f, 179.7961f, 359.8f), new Vector3(0.5516f, 0.769f, 1f), "Poster5");
								<posterData>5__8[5] = (new Vector3(-5.8111f, 2.541f, -17.577f), new Vector3(0f, 270.0942f, 358.6752f), new Vector3(0.8596f, 1.2194f, 1f), "CustomTips");
							}
							else if (Plugin.IsWiderShipModInstalled)
							{
								Logger.LogInfo((object)"WiderShipMod detected with 2 Story Ship Mod. Using WiderShipMod-compatible positions.");
								<posterData>5__8[0] = (new Vector3(6.3172f, 2.9407f, -22.4766f), new Vector3(0f, 180f, 0f), new Vector3(0.6391f, 0.4882f, 2f), "Poster1");
								<posterData>5__8[1] = (new Vector3(9.5975f, 2.5063f, -5.8245f), new Vector3(0f, 0f, 0f), new Vector3(0.7296f, 0.4896f, 1f), "Poster2");
								<posterData>5__8[2] = (new Vector3(10.1364f, 2.8591f, -22.4788f), new Vector3(0f, 180f, 356.3345f), new Vector3(0.7487f, 1.0539f, 1f), "Poster3");
								<posterData>5__8[3] = (new Vector3(5.3599f, 2.5963f, -9.455f), new Vector3(0f, 307.2657f, 2.68f), new Vector3(0.7289f, 0.9989f, 1f), "Poster4");
								<posterData>5__8[4] = (new Vector3(7.5475f, 2.5882f, -22.4803f), new Vector3(0f, 180f, 359.8f), new Vector3(0.5516f, 0.769f, 1f), "Poster5");
								<posterData>5__8[5] = (new Vector3(-5.8111f, 2.541f, -17.577f), new Vector3(0f, 270.0942f, 358.6752f), new Vector3(0.8596f, 1.2194f, 1f), "CustomTips");
							}
							else
							{
								Logger.LogInfo((object)"2 Story Ship Mod detected. Repositioning posters based on window settings.");
								if (Plugin.EnableRightWindows && Plugin.EnableLeftWindows)
								{
									Logger.LogInfo((object)"All windows are enabled. Repositioning posters to default 2 Story Ship Mod positions.");
									<posterData>5__8[0] = (new Vector3(10.1567f, 2.75f, -8.8293f), new Vector3(0f, 0f, 0f), new Vector3(0.6391f, 0.4882f, 2f), "Poster1");
									<posterData>5__8[1] = (new Vector3(9.0884f, 2.4776f, -8.8229f), new Vector3(0f, 0f, 0f), new Vector3(0.7296f, 0.4896f, 1f), "Poster2");
									<posterData>5__8[3] = (new Vector3(5.3599f, 2.5963f, -9.455f), new Vector3(0f, 307.2657f, 2.68f), new Vector3(0.7289f, 0.9989f, 1f), "Poster4");
									<posterData>5__8[4] = (new Vector3(6.1473f, 2.8195f, -17.4729f), new Vector3(0f, 179.7123f, 359.8f), new Vector3(0.5516f, 0.769f, 1f), "Poster5");
									<posterData>5__8[5] = (new Vector3(2.5679f, 2.6763f, -11.7341f), new Vector3(0f, 0f, 358.6752f), new Vector3(0.8596f, 1.2194f, 1f), "CustomTips");
								}
								else
								{
									if (!Plugin.EnableRightWindows)
									{
										Logger.LogInfo((object)"Right windows are disabled. Repositioning posters.");
										<posterData>5__8[0] = (new Vector3(4.0286f, 2.9318f, -16.7774f), new Vector3(0f, 200.9872f, 0f), new Vector3(0.6391f, 0.4882f, 2f), "Poster1");
										<posterData>5__8[1] = (new Vector3(9.0884f, 2.4776f, -8.8229f), new Vector3(0f, 0f, 0f), new Vector3(0.7296f, 0.4896f, 1f), "Poster2");
										<posterData>5__8[3] = (new Vector3(5.3599f, 2.5963f, -9.455f), new Vector3(0f, 307.2657f, 0f), new Vector3(0.7289f, 0.9989f, 1f), "Poster4");
										<posterData>5__8[4] = (new Vector3(5.3282f, 2.7482f, -17.2754f), new Vector3(0f, 202.3357f, 359.8f), new Vector3(0.5516f, 0.769f, 1f), "Poster5");
										<posterData>5__8[5] = (new Vector3(2.5679f, 2.6763f, -11.7341f), new Vector3(0f, 0f, 358.6752f), new Vector3(0.8596f, 1.2194f, 1f), "CustomTips");
									}
									if (!Plugin.EnableLeftWindows)
									{
										Logger.LogInfo((object)"Left windows are disabled. Repositioning posters.");
										<posterData>5__8[0] = (new Vector3(9.8324f, 2.9318f, -8.8257f), new Vector3(0f, 0f, 0f), new Vector3(0.6391f, 0.4882f, 2f), "Poster1");
										<posterData>5__8[1] = (new Vector3(7.3648f, 2.4776f, -8.8229f), new Vector3(0f, 0f, 0f), new Vector3(0.7296f, 0.4896f, 1f), "Poster2");
										<posterData>5__8[3] = (new Vector3(5.3599f, 2.5963f, -9.455f), new Vector3(0f, 307.2657f, 2.68f), new Vector3(0.7289f, 0.9989f, 1f), "Poster4");
										<posterData>5__8[4] = (new Vector3(6.1473f, 2.8195f, -17.4729f), new Vector3(0f, 179.7123f, 359.8f), new Vector3(0.5516f, 0.769f, 1f), "Poster5");
										<posterData>5__8[5] = (new Vector3(2.5679f, 2.6763f, -11.7341f), new Vector3(0f, 0f, 358.6752f), new Vector3(0.8596f, 1.2194f, 1f), "CustomTips");
									}
								}
							}
						}
						<enabledPacks>5__9 = Plugin.PosterFolders.Where((string folder) => PosterConfig.IsPackEnabled(folder)).ToList();
						if (<enabledPacks>5__9.Count == 0)
						{
							Logger.LogWarning((object)"No enabled packs found!");
							return false;
						}
						<enabledPackNames>5__10 = <enabledPacks>5__9.Select((string pack) => Path.GetFileName(Path.GetDirectoryName(pack))).ToList();
						Logger.LogInfo((object)("Enabled poster packs: " + string.Join(", ", <enabledPackNames>5__10)));
						if (PosterConfig.PosterRandomizer.Value)
						{
							_selectedPack = <enabledPacks>5__9[Plugin.Rand.Next(<enabledPacks>5__9.Count)];
							<packsToUse>5__11 = new List<string> { _selectedPack };
							<selectedPackName>5__15 = Path.GetFileName(Path.GetDirectoryName(_selectedPack));
							Logger.LogInfo((object)("PosterRandomizer enabled. Using pack: " + <selectedPackName>5__15));
							<selectedPackName>5__15 = null;
						}
						else
						{
							<packsToUse>5__11 = <enabledPacks>5__9;
							Logger.LogInfo((object)"PosterRandomizer disabled. Combining all enabled packs.");
						}
						<>8__1.allTextures = new Dictionary<string, List<(Texture2D, string)>>();
						<>s__16 = <packsToUse>5__11.GetEnumerator();
						<>1__state = -3;
						goto IL_1b34;
					}
					case 1:
						<>1__state = -3;
						<>8__22 = null;
						<>s__21++;
						goto IL_1a28;
					case 2:
						<>1__state = -3;
						<>8__25 = null;
						<>s__24++;
						goto IL_1b03;
					case 3:
						{
							<>1__state = -1;
							<poster>5__27 = null;
							<renderer>5__28 = null;
							<textures>5__29 = null;
							<i>5__26++;
							break;
						}
						IL_1b03:
						if (<>s__24 < <>s__23.Length)
						{
							<>8__25 = new <>c__DisplayClass17_2();
							<>8__25.CS$<>8__locals2 = <>8__1;
							<>8__25.file = <>s__23[<>s__24];
							<>2__current = LoadTextureAsync(<>8__25.file, delegate(Texture2D texture)
							{
								if ((Object)(object)texture != (Object)null)
								{
									string fileNameWithoutExtension2 = Path.GetFileNameWithoutExtension(<>8__25.file);
									if (!<>8__25.CS$<>8__locals2.allTextures.ContainsKey(fileNameWithoutExtension2))
									{
										<>8__25.CS$<>8__locals2.allTextures[fileNameWithoutExtension2] = new List<(Texture2D, string)>();
									}
									<>8__25.CS$<>8__locals2.allTextures[fileNameWithoutExtension2].Add((texture, <>8__25.file));
								}
							});
							<>1__state = 2;
							return true;
						}
						<>s__23 = null;
						goto IL_1b1e;
						IL_1a28:
						if (<>s__21 < <>s__20.Length)
						{
							<>8__22 = new <>c__DisplayClass17_1();
							<>8__22.CS$<>8__locals1 = <>8__1;
							<>8__22.file = <>s__20[<>s__21];
							<>2__current = LoadTextureAsync(<>8__22.file, delegate(Texture2D texture)
							{
								if ((Object)(object)texture != (Object)null)
								{
									string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(<>8__22.file);
									if (!<>8__22.CS$<>8__locals1.allTextures.ContainsKey(fileNameWithoutExtension))
									{
										<>8__22.CS$<>8__locals1.allTextures[fileNameWithoutExtension] = new List<(Texture2D, string)>();
									}
									<>8__22.CS$<>8__locals1.allTextures[fileNameWithoutExtension].Add((texture, <>8__22.file));
								}
							});
							<>1__state = 1;
							return true;
						}
						<>s__20 = null;
						goto IL_1a43;
						IL_1b1e:
						<postersPath>5__18 = null;
						<tipsPath>5__19 = null;
						<pack>5__17 = null;
						goto IL_1b34;
						IL_1b34:
						if (<>s__16.MoveNext())
						{
							<pack>5__17 = <>s__16.Current;
							<postersPath>5__18 = Path.Combine(<pack>5__17, "posters");
							<tipsPath>5__19 = Path.Combine(<pack>5__17, "tips");
							if (Directory.Exists(<postersPath>5__18))
							{
								<>s__20 = Directory.GetFiles(<postersPath>5__18, "*.png");
								<>s__21 = 0;
								goto IL_1a28;
							}
							goto IL_1a43;
						}
						<>m__Finally1();
						<>s__16 = default(List<string>.Enumerator);
						if (<>8__1.allTextures.Count == 0)
						{
							Logger.LogWarning((object)"No textures found in enabled packs!");
							return false;
						}
						<anyTextureLoaded>5__12 = false;
						<i>5__26 = 0;
						break;
						IL_1a43:
						if (Directory.Exists(<tipsPath>5__19))
						{
							<>s__23 = Directory.GetFiles(<tipsPath>5__19, "*.png");
							<>s__24 = 0;
							goto IL_1b03;
						}
						goto IL_1b1e;
					}
					if (<i>5__26 < <posterData>5__8.Length)
					{
						<poster>5__27 = GameObject.CreatePrimitive((PrimitiveType)5);
						((Object)<poster>5__27).name = <posterData>5__8[<i>5__26].name;
						<poster>5__27.transform.SetParent(<postersParent>5__4.transform);
						<poster>5__27.transform.position = <posterData>5__8[<i>5__26].position;
						<poster>5__27.transform.rotation = Quaternion.Euler(<posterData>5__8[<i>5__26].rotation);
						<poster>5__27.transform.localScale = <posterData>5__8[<i>5__26].scale;
						<renderer>5__28 = <poster>5__27.GetComponent<MeshRenderer>();
						if (<>8__1.allTextures.TryGetValue(((Object)<poster>5__27).name, out <textures>5__29) && <textures>5__29.Count > 0)
						{
							<textureData>5__30 = <textures>5__29[Plugin.Rand.Next(<textures>5__29.Count)];
							<material>5__31 = new Material(_copiedMaterial);
							<material>5__31.mainTexture = (Texture)(object)<textureData>5__30.texture;
							((Renderer)<renderer>5__28).material = <material>5__31;
							<anyTextureLoaded>5__12 = true;
							Logger.LogInfo((object)("Loaded texture for " + ((Object)<poster>5__27).name + " from " + <textureData>5__30.filePath));
							CreatedPosters.Add(<poster>5__27);
							<textureData>5__30 = default((Texture2D, string));
							<material>5__31 = null;
						}
						else
						{
							Logger.LogError((object)("No textures found for " + ((Object)<poster>5__27).name + ". Disabling the poster."));
							<poster>5__27.SetActive(false);
						}
						<>2__current = null;
						<>1__state = 3;
						return true;
					}
					if (!<anyTextureLoaded>5__12)
					{
						Object.Destroy((Object)(object)<postersParent>5__4);
						Logger.LogWarning((object)"No custom posters were created due to missing textures.");
						return false;
					}
					Transform obj2 = <hangarShip>5__3.transform.Find("Plane.001");
					<vanillaPlane>5__13 = ((obj2 != null) ? ((Component)obj2).gameObject : null);
					if ((Object)(object)<vanillaPlane>5__13 != (Object)null)
					{
						Logger.LogInfo((object)"Destroying vanilla Plane.001.");
						Object.Destroy((Object)(object)<vanillaPlane>5__13);
					}
					Logger.LogInfo((object)"Custom posters created successfully.");
					return false;
				}
				catch
				{
					//try-fault
					((IDisposable)this).Dispose();
					throw;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			private void <>m__Finally1()
			{
				<>1__state = -1;
				((IDisposable)<>s__16).Dispose();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[CompilerGenerated]
		private sealed class <DelayedUpdateMaterialsAsync>d__18 : IEnumerator<object>, IDisposable, IEnumerator
		{
			private int <>1__state;

			private object <>2__current;

			private GameObject <posterPlane>5__1;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <DelayedUpdateMaterialsAsync>d__18(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<posterPlane>5__1 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					if (_materialsUpdated)
					{
						return false;
					}
					Logger.LogInfo((object)"Updating materials for custom posters");
					<posterPlane>5__1 = GameObject.Find("Environment/HangarShip/Plane.001");
					if ((Object)(object)<posterPlane>5__1 != (Object)null)
					{
						<posterPlane>5__1.SetActive(false);
					}
					HideVanillaPosterPlane();
					<>2__current = CreateCustomPostersAsync();
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					_materialsUpdated = true;
					return false;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[CompilerGenerated]
		private sealed class <LoadTextureAsync>d__13 : IEnumerator<object>, IDisposable, IEnumerator
		{
			private int <>1__state;

			private object <>2__current;

			public string filePath;

			public Action<Texture2D> onComplete;

			private Texture2D <texture>5__1;

			private byte[] <fileData>5__2;

			private Exception <ex>5__3;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <LoadTextureAsync>d__13(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<texture>5__1 = null;
				<fileData>5__2 = null;
				<ex>5__3 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0064: Unknown result type (might be due to invalid IL or missing references)
				//IL_006e: Expected O, but got Unknown
				if (<>1__state != 0)
				{
					return false;
				}
				<>1__state = -1;
				try
				{
					if (!File.Exists(filePath))
					{
						Logger.LogError((object)("Texture file not found: " + filePath));
						onComplete?.Invoke(null);
						return false;
					}
					<texture>5__1 = new Texture2D(2, 2);
					<fileData>5__2 = File.ReadAllBytes(filePath);
					if (ImageConversion.LoadImage(<texture>5__1, <fileData>5__2))
					{
						((Texture)<texture>5__1).filterMode = (FilterMode)0;
						onComplete?.Invoke(<texture>5__1);
					}
					else
					{
						Logger.LogError((object)("Failed to load texture from " + filePath));
						onComplete?.Invoke(null);
					}
					<texture>5__1 = null;
					<fileData>5__2 = null;
				}
				catch (Exception ex)
				{
					<ex>5__3 = ex;
					Logger.LogError((object)("Error loading texture from " + filePath + ": " + <ex>5__3.Message));
					onComplete?.Invoke(null);
				}
				return false;
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		private static bool _materialsUpdated = false;

		private static string _selectedPack = null;

		private static Material _copiedMaterial = null;

		private static readonly List<GameObject> CreatedPosters = new List<GameObject>();

		private static ManualLogSource Logger { get; set; }

		public static void Init(ManualLogSource logger)
		{
			Logger = logger;
		}

		[HarmonyPatch(typeof(StartOfRound), "Start")]
		[HarmonyPostfix]
		private static void StartPatch(StartOfRound __instance)
		{
			_materialsUpdated = false;
			CopyPlane001Material();
			((MonoBehaviour)__instance).StartCoroutine(DelayedUpdateMaterialsAsync());
		}

		[HarmonyPatch(typeof(RoundManager), "GenerateNewLevelClientRpc")]
		[HarmonyPostfix]
		private static void GenerateNewLevelClientRpcPatch(int randomSeed, StartOfRound __instance)
		{
			if (!_materialsUpdated)
			{
				((MonoBehaviour)__instance).StartCoroutine(DelayedUpdateMaterialsAsync());
			}
		}

		[HarmonyPatch(typeof(StartOfRound), "OnShipLandedMiscEvents")]
		[HarmonyPostfix]
		private static void OnShipLandedMiscEventsPatch(StartOfRound __instance)
		{
			if (!_materialsUpdated)
			{
				((MonoBehaviour)__instance).StartCoroutine(DelayedUpdateMaterialsAsync());
			}
		}

		[HarmonyPatch(typeof(StartOfRound), "OnClientDisconnect")]
		[HarmonyPostfix]
		private static void OnClientDisconnectPatch(ulong clientId)
		{
			_materialsUpdated = false;
			Logger.LogInfo((object)"Resetting materials.");
			CleanUpPosters();
		}

		[IteratorStateMachine(typeof(<LoadTextureAsync>d__13))]
		private static IEnumerator LoadTextureAsync(string filePath, Action<Texture2D> onComplete)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <LoadTextureAsync>d__13(0)
			{
				filePath = filePath,
				onComplete = onComplete
			};
		}

		private static void CopyPlane001Material()
		{
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Expected O, but got Unknown
			GameObject val = GameObject.Find("Environment/HangarShip/Plane.001");
			if ((Object)(object)val == (Object)null)
			{
				Logger.LogError((object)"Poster plane (Plane.001) not found under HangarShip!");
				return;
			}
			MeshRenderer component = val.GetComponent<MeshRenderer>();
			if ((Object)(object)component == (Object)null || ((Renderer)component).materials.Length == 0)
			{
				Logger.LogError((object)"Poster plane renderer or materials not found!");
				return;
			}
			_copiedMaterial = new Material(((Renderer)component).material);
			Logger.LogInfo((object)"Copied material from Plane.001.");
		}

		private static void HideVanillaPosterPlane()
		{
			GameObject val = GameObject.Find("Environment/HangarShip/Plane.001 (Old)");
			if ((Object)(object)val != (Object)null)
			{
				val.SetActive(false);
				return;
			}
			val = GameObject.Find("Environment/HangarShip/Plane.001");
			if ((Object)(object)val != (Object)null)
			{
				val.SetActive(false);
			}
		}

		private static void CleanUpPosters()
		{
			if (CreatedPosters.Count == 0)
			{
				return;
			}
			Logger.LogInfo((object)"Cleaning up existing posters.");
			foreach (GameObject createdPoster in CreatedPosters)
			{
				if ((Object)(object)createdPoster != (Object)null)
				{
					Object.Destroy((Object)(object)createdPoster);
				}
			}
			CreatedPosters.Clear();
		}

		[IteratorStateMachine(typeof(<CreateCustomPostersAsync>d__17))]
		private static IEnumerator CreateCustomPostersAsync()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <CreateCustomPostersAsync>d__17(0);
		}

		[IteratorStateMachine(typeof(<DelayedUpdateMaterialsAsync>d__18))]
		private static IEnumerator DelayedUpdateMaterialsAsync()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <DelayedUpdateMaterialsAsync>d__18(0);
		}
	}
	[BepInPlugin("seeya.customposters", "CustomPosters", "1.4.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		public const string PLUGIN_GUID = "seeya.customposters";

		public const string PLUGIN_NAME = "CustomPosters";

		public const string PLUGIN_VERSION = "1.4.0";

		public static List<string> PosterFolders = new List<string>();

		public static readonly List<string> PosterFiles = new List<string>();

		public static readonly List<string> TipFiles = new List<string>();

		public static Random Rand = new Random();

		public static bool IsShipWindowsInstalled { get; private set; }

		public static bool IsWindow2Enabled { get; private set; }

		public static bool Is2StoryShipModInstalled { get; private set; }

		public static bool EnableRightWindows { get; private set; } = true;


		public static bool EnableLeftWindows { get; private set; } = true;


		public static bool IsWiderShipModInstalled { get; private set; }

		public static string WiderShipExtendedSide { get; private set; }

		public static ManualLogSource StaticLogger { get; private set; }

		private static void Check2StoryShipModConfig()
		{
			try
			{
				string path = Path.Combine(Paths.ConfigPath, "MelanieMelicious.2StoryShip.cfg");
				if (!File.Exists(path))
				{
					StaticLogger.LogWarning((object)"2 StoryShipMod config file not found. Using default window settings.");
					return;
				}
				string[] array = File.ReadAllLines(path);
				string[] array2 = array;
				foreach (string text in array2)
				{
					if (text.Contains("Enable Right Windows"))
					{
						EnableRightWindows = text.Contains("true");
					}
					else if (text.Contains("Enable Left Windows"))
					{
						EnableLeftWindows = text.Contains("true");
					}
				}
			}
			catch (Exception ex)
			{
				StaticLogger.LogError((object)("Failed to read 2 StoryShipMod config: " + ex.Message));
			}
		}

		private void Awake()
		{
			//IL_0276: Unknown result type (might be due to invalid IL or missing references)
			//IL_027c: Expected O, but got Unknown
			try
			{
				StaticLogger = ((BaseUnityPlugin)this).Logger;
				try
				{
					PosterFolders = (from dir in Directory.GetDirectories(Paths.PluginPath, "*", SearchOption.AllDirectories)
						where dir.EndsWith("CustomPosters", StringComparison.OrdinalIgnoreCase) && !dir.Equals(Paths.PluginPath, StringComparison.OrdinalIgnoreCase)
						select dir).ToList();
					if (PosterFolders.Count == 0)
					{
						((BaseUnityPlugin)this).Logger.LogDebug((object)"No CustomPosters directories found");
					}
					foreach (string posterFolder in PosterFolders)
					{
						string path = Path.Combine(posterFolder, "posters");
						string path2 = Path.Combine(posterFolder, "tips");
						if (Directory.Exists(path))
						{
							string[] files = Directory.GetFiles(path);
							foreach (string text in files)
							{
								if (Path.GetExtension(text) != ".old")
								{
									PosterFiles.Add(text);
								}
							}
						}
						if (!Directory.Exists(path2))
						{
							continue;
						}
						string[] files2 = Directory.GetFiles(path2);
						foreach (string text2 in files2)
						{
							if (Path.GetExtension(text2) != ".old")
							{
								TipFiles.Add(text2);
							}
						}
					}
					Is2StoryShipModInstalled = Chainloader.PluginInfos.ContainsKey("MelanieMelicious.2StoryShip");
					if (Is2StoryShipModInstalled)
					{
						StaticLogger.LogInfo((object)"2 Story Ship Mod detected.");
						Check2StoryShipModConfig();
					}
					IsShipWindowsInstalled = Chainloader.PluginInfos.ContainsKey("TestAccount666.ShipWindows") || Chainloader.PluginInfos.ContainsKey("TestAccount666.ShipWindowsBeta");
					if (IsShipWindowsInstalled)
					{
						StaticLogger.LogInfo((object)"ShipWindows or ShipWindowsBeta detected.");
						IsWindow2Enabled = CheckIfWindow2Enabled();
					}
					IsWiderShipModInstalled = Chainloader.PluginInfos.ContainsKey("mborsh.WiderShipMod");
					if (IsWiderShipModInstalled)
					{
						StaticLogger.LogInfo((object)"WiderShipMod detected.");
						WiderShipExtendedSide = GetWiderShipExtendedSide();
						StaticLogger.LogInfo((object)("WiderShipMod Extended Side: " + WiderShipExtendedSide));
					}
					PosterConfig.Init(((BaseUnityPlugin)this).Logger);
					Patches.Init(((BaseUnityPlugin)this).Logger);
					Harmony val = new Harmony("seeya.customposters");
					val.PatchAll(typeof(Patches));
					StaticLogger.LogInfo((object)"Plugin CustomPosters (1.4.0) is loaded!");
				}
				catch (Exception ex)
				{
					StaticLogger.LogError((object)("Failed to initialize plugin: " + ex.Message));
				}
			}
			catch (Exception ex2)
			{
				StaticLogger.LogError((object)("Failed to initialize plugin: " + ex2.Message));
			}
		}

		private static bool CheckIfWindow2Enabled()
		{
			try
			{
				bool flag = Chainloader.PluginInfos.ContainsKey("TestAccount666.ShipWindowsBeta");
				string path = Path.Combine(Paths.ConfigPath, "TestAccount666.ShipWindowsBeta.cfg");
				if (flag && File.Exists(path))
				{
					StaticLogger.LogInfo((object)"Found ShipWindowsBeta cfg");
					string[] array = File.ReadAllLines(path);
					bool flag2 = false;
					string[] array2 = array;
					foreach (string text in array2)
					{
						string text2 = text.Trim();
						if (text2.StartsWith("[Right Window (SideRight)]"))
						{
							flag2 = true;
						}
						else if (flag2 && text2.StartsWith("[") && !text2.StartsWith("[Right Window (SideRight)]"))
						{
							flag2 = false;
						}
						else if (flag2 && text2.Contains("1. Enabled") && text2.Contains("true"))
						{
							StaticLogger.LogInfo((object)"ShipWindowsBeta - Right Window is enabled");
							return true;
						}
					}
					StaticLogger.LogInfo((object)"ShipWindowsBeta - Right Window is disabled");
					return false;
				}
				bool flag3 = Chainloader.PluginInfos.ContainsKey("TestAccount666.ShipWindows");
				string path2 = Path.Combine(Paths.ConfigPath, "TestAccount666.ShipWindows.cfg");
				if (flag3 && File.Exists(path2))
				{
					StaticLogger.LogInfo((object)"Found ShipWindows config file");
					string[] array3 = File.ReadAllLines(path2);
					string[] array4 = array3;
					foreach (string text3 in array4)
					{
						if (text3.Contains("EnableWindow2") && text3.Contains("true"))
						{
							StaticLogger.LogInfo((object)"ShipWindows Window 2 is enabled");
							return true;
						}
					}
					StaticLogger.LogInfo((object)"ShipWindows Window 2 is disabled");
					return false;
				}
				StaticLogger.LogWarning((object)"ShipWindows is installed but no relevant config file found.");
				return false;
			}
			catch (Exception ex)
			{
				StaticLogger.LogError((object)("Error checking Window2 config: " + ex.Message));
				return false;
			}
		}

		private static string GetWiderShipExtendedSide()
		{
			try
			{
				string path = Path.Combine(Paths.ConfigPath, "mborsh.WiderShipMod.cfg");
				if (!File.Exists(path))
				{
					StaticLogger.LogWarning((object)"WiderShipMod config file not found. Assuming Extended Side is 'Both'.");
					return "Both";
				}
				string[] array = File.ReadAllLines(path);
				string[] array2 = array;
				foreach (string text in array2)
				{
					if (text.Contains("Extended Side"))
					{
						if (text.Contains("Both"))
						{
							return "Both";
						}
						if (text.Contains("Right"))
						{
							return "Right";
						}
						if (text.Contains("Left"))
						{
							return "Left";
						}
					}
				}
			}
			catch (Exception ex)
			{
				StaticLogger.LogError((object)("Failed to read WiderShipMod config: " + ex.Message));
			}
			return "Both";
		}
	}
	internal class PosterConfig
	{
		private static ConfigFile configFile;

		private static ManualLogSource Logger { get; set; }

		public static ConfigEntry<bool> PosterRandomizer { get; private set; }

		public static ConfigEntry<bool> LobbyRandom { get; private set; }

		public static void Init(ManualLogSource logger)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			Logger = logger;
			configFile = new ConfigFile(Path.Combine(Paths.ConfigPath, "CustomPosters.cfg"), true);
			PosterRandomizer = configFile.Bind<bool>("Settings", "PosterRandomizer", true, "If true, randomizes only poster packs. If false, combines all enabled packs and randomizes textures.");
			foreach (string posterFolder in Plugin.PosterFolders)
			{
				try
				{
					string fileName = Path.GetFileName(Path.GetDirectoryName(posterFolder));
					if (!string.IsNullOrEmpty(fileName) && !fileName.Equals("plugins", StringComparison.OrdinalIgnoreCase))
					{
						ConfigEntry<bool> val = configFile.Bind<bool>(fileName, "Enabled", true, "Enable or disable " + fileName);
					}
				}
				catch (Exception ex)
				{
					Logger.LogDebug((object)("Failed to parse mod path " + posterFolder + ": " + ex.Message));
				}
			}
		}

		public static bool IsPackEnabled(string folder)
		{
			int num = folder.IndexOf("plugins\\", StringComparison.Ordinal);
			if (num == -1)
			{
				return false;
			}
			num += "plugins\\".Length;
			int num2 = folder.IndexOf("\\CustomPosters", num, StringComparison.Ordinal);
			if (num2 == -1)
			{
				return false;
			}
			string text = folder.Substring(num, num2 - num);
			return configFile.Bind<bool>(text, "Enabled", true, (ConfigDescription)null).Value;
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "CustomPosters";

		public const string PLUGIN_NAME = "CustomPosters";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}