Decompiled source of WeightWrite v1.0.0

plugins/WeightWrite/WeightWrite.dll

Decompiled 4 days ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
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 System.Text;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using HG;
using Microsoft.CodeAnalysis;
using R2API.Utils;
using RiskOfOptions;
using RiskOfOptions.OptionConfigs;
using RiskOfOptions.Options;
using RoR2;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.ResourceManagement.AsyncOperations;
using WeightWrite.Config;
using WeightWrite.ModCompatibility;
using WeightWrite.Utilities.Extensions;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: NetworkCompatibility(/*Could not decode attribute arguments.*/)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("BepInEx")]
[assembly: AssemblyCompany("WeightWrite")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("WeightWrite")]
[assembly: AssemblyTitle("WeightWrite")]
[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 WeightWrite
{
	public class ConfigurableSceneCollection
	{
		private readonly SceneCollection _sceneCollection;

		private readonly ConfigFile _config;

		public readonly string Name;

		private readonly List<ConfigEntry<float>> _weightConfigs;

		public readonly ReadOnlyCollection<ConfigEntry<float>> WeightConfigs;

		public unsafe ConfigurableSceneCollection(SceneCollection sceneCollection, string name, ConfigFile config)
		{
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			_sceneCollection = sceneCollection;
			_config = config;
			Name = name.FilterConfigKey();
			_weightConfigs = new List<ConfigEntry<float>>();
			WeightConfigs = new ReadOnlyCollection<ConfigEntry<float>>(_weightConfigs);
			if (Object.op_Implicit((Object)(object)_sceneCollection))
			{
				for (int i = 0; i < _sceneCollection.sceneEntries.Length; i++)
				{
					createSceneConfig(Unsafe.Read<SceneEntry>((void*)_sceneCollection.sceneEntries[i]));
				}
			}
		}

		public ConfigurableSceneCollection(string sceneCollectionPath, string name, ConfigFile config)
			: this(Addressables.LoadAssetAsync<SceneCollection>((object)sceneCollectionPath).WaitForCompletion(), name, config)
		{
		}//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)


		private static string getDefaultSceneConfigName(SceneDef sceneDef)
		{
			if (!Object.op_Implicit((Object)(object)sceneDef))
			{
				return "Invalid Scene";
			}
			string key = sceneDef.cachedName;
			if (Language.english.TokenIsRegistered(sceneDef.nameToken))
			{
				key = Language.english.GetLocalizedStringByToken(sceneDef.nameToken);
			}
			key = key.FilterConfigKey();
			if (string.IsNullOrWhiteSpace(key))
			{
				key = "(Invalid Name)";
			}
			return key;
		}

		private void createSceneConfig(SceneEntry entry)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: 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_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Expected O, but got Unknown
			SceneDef sceneDef = entry.sceneDef;
			if (!Object.op_Implicit((Object)(object)sceneDef))
			{
				return;
			}
			string text = getDefaultSceneConfigName(sceneDef);
			List<SceneDef> list = new List<SceneDef>(_sceneCollection.sceneEntries.Length);
			for (int i = 0; i < _sceneCollection.sceneEntries.Length; i++)
			{
				SceneDef sceneDef2 = ((SceneEntry)_sceneCollection.sceneEntries[i]).sceneDef;
				if ((Object)(object)sceneDef2 != (Object)(object)sceneDef)
				{
					string defaultSceneConfigName = getDefaultSceneConfigName(sceneDef2);
					if (string.Equals(text, defaultSceneConfigName))
					{
						list.Add(sceneDef2);
					}
				}
			}
			if (list.Count > 0)
			{
				list.Add(sceneDef);
				list.Sort(delegate(SceneDef a, SceneDef b)
				{
					//IL_0001: Unknown result type (might be due to invalid IL or missing references)
					//IL_0006: Unknown result type (might be due to invalid IL or missing references)
					//IL_000a: Unknown result type (might be due to invalid IL or missing references)
					SceneIndex sceneDefIndex = a.sceneDefIndex;
					return ((Enum)(SceneIndex)(ref sceneDefIndex)).CompareTo((object?)b.sceneDefIndex);
				});
				int num = list.IndexOf(sceneDef);
				text += $" ({num + 1})";
			}
			float weight = ((SceneEntry)(ref entry)).weight;
			ConfigEntry<float> weightConfig = _config.Bind<float>(Name, text + " Weight", weight, new ConfigDescription("How likely this stage should be in this group, set to 0 to remove completely", (AcceptableValueBase)(object)new AcceptableValueMin<float>(0f), Array.Empty<object>()));
			weightConfig.SettingChanged += delegate
			{
				setSceneWeight(sceneDef, weightConfig.Value);
			};
			if (weightConfig.Value != weight)
			{
				setSceneWeight(sceneDef, weightConfig.Value);
			}
			_weightConfigs.Add(weightConfig);
		}

		private void setSceneWeight(SceneDef scene, float weight)
		{
			if (!Object.op_Implicit((Object)(object)scene))
			{
				return;
			}
			for (int i = 0; i < _sceneCollection._sceneEntries.Length; i++)
			{
				ref SceneEntry reference = ref _sceneCollection._sceneEntries[i];
				if ((Object)(object)reference.sceneDef == (Object)(object)scene)
				{
					((SceneEntry)(ref reference)).weight = weight;
					return;
				}
			}
			Log.Warning($"Failed to find '{scene}' in {_sceneCollection}", "D:\\Git\\RoR2\\WeightWrite\\WeightWrite\\ConfigurableSceneCollection.cs", "setSceneWeight", 126);
		}
	}
	internal static class Log
	{
		private static readonly StringBuilder _sharedStringBuilder;

		private static readonly int _cachedCallerPathPrefixLength;

		private static ManualLogSource _logSource;

		static Log()
		{
			_sharedStringBuilder = new StringBuilder(256);
			_cachedCallerPathPrefixLength = getCallerPathPrefixLength("D:\\Git\\RoR2\\WeightWrite\\WeightWrite\\Log.cs");
			static int getCallerPathPrefixLength([CallerFilePath] string callerPath = null)
			{
				int num = callerPath.LastIndexOf("WeightWrite\\");
				if (num >= 0)
				{
					return num + "WeightWrite\\".Length;
				}
				Debug.LogError((object)"[WeightWrite] Logger failed to determine caller path prefix length");
				return 0;
			}
		}

		internal static void Init(ManualLogSource logSource)
		{
			_logSource = logSource;
		}

		private static StringBuilder AppendCallerPrefix(this StringBuilder stringBuilder, string callerPath, string callerMemberName, int callerLineNumber)
		{
			return stringBuilder.Append(callerPath, _cachedCallerPathPrefixLength, callerPath.Length - _cachedCallerPathPrefixLength).Append(':').Append(callerLineNumber)
				.Append(" (")
				.Append(callerMemberName)
				.Append("):");
		}

		private static StringBuilder buildCallerLogString(string callerPath, string callerMemberName, int callerLineNumber, object data)
		{
			return _sharedStringBuilder.Clear().AppendCallerPrefix(callerPath, callerMemberName, callerLineNumber).Append(' ')
				.Append(data);
		}

		[Conditional("DEBUG")]
		internal static void Debug(object data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1)
		{
			_logSource.LogDebug((object)buildCallerLogString(callerPath, callerMemberName, callerLineNumber, data));
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		[Conditional("DEBUG")]
		internal static void Debug_NoCallerPrefix(object data)
		{
			_logSource.LogDebug(data);
		}

		internal static void Error(object data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1)
		{
			_logSource.LogError((object)buildCallerLogString(callerPath, callerMemberName, callerLineNumber, data));
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		internal static void Error_NoCallerPrefix(object data)
		{
			_logSource.LogError(data);
		}

		internal static void Fatal(object data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1)
		{
			_logSource.LogFatal((object)buildCallerLogString(callerPath, callerMemberName, callerLineNumber, data));
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		internal static void Fatal_NoCallerPrefix(object data)
		{
			_logSource.LogFatal(data);
		}

		internal static void Info(object data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1)
		{
			_logSource.LogInfo((object)buildCallerLogString(callerPath, callerMemberName, callerLineNumber, data));
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		internal static void Info_NoCallerPrefix(object data)
		{
			_logSource.LogInfo(data);
		}

		internal static void Message(object data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1)
		{
			_logSource.LogMessage((object)buildCallerLogString(callerPath, callerMemberName, callerLineNumber, data));
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		internal static void Message_NoCallerPrefix(object data)
		{
			_logSource.LogMessage(data);
		}

		internal static void Warning(object data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1)
		{
			_logSource.LogWarning((object)buildCallerLogString(callerPath, callerMemberName, callerLineNumber, data));
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		internal static void Warning_NoCallerPrefix(object data)
		{
			_logSource.LogWarning(data);
		}

		internal static void LogType(LogLevel level, object data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			if ((level & 0x20) == 0)
			{
				_logSource.Log(level, (object)buildCallerLogString(callerPath, callerMemberName, callerLineNumber, data));
			}
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		internal static void LogType_NoCallerPrefix(LogLevel level, object data)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			if ((level & 0x20) == 0)
			{
				_logSource.Log(level, data);
			}
		}
	}
	[BepInPlugin("com.Gorakh.WeightWrite", "WeightWrite", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class WeightWritePlugin : BaseUnityPlugin
	{
		public const string PluginGUID = "com.Gorakh.WeightWrite";

		public const string PluginAuthor = "Gorakh";

		public const string PluginName = "WeightWrite";

		public const string PluginVersion = "1.0.0";

		private static WeightWritePlugin _instance;

		private readonly List<ConfigurableSceneCollection> _configurableSceneCollections = new List<ConfigurableSceneCollection>();

		public ReadOnlyCollection<ConfigurableSceneCollection> ConfigurableSceneCollections;

		internal static WeightWritePlugin Instance => _instance;

		private void Awake()
		{
			Stopwatch stopwatch = Stopwatch.StartNew();
			SingletonHelper.Assign<WeightWritePlugin>(ref _instance, this);
			Log.Init(((BaseUnityPlugin)this).Logger);
			ConfigurableSceneCollections = new ReadOnlyCollection<ConfigurableSceneCollection>(_configurableSceneCollections);
			RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, new Action(onLoad));
			stopwatch.Stop();
			Log.Message_NoCallerPrefix($"Initialized in {stopwatch.Elapsed.TotalMilliseconds:F0}ms");
		}

		private void OnDestroy()
		{
			SingletonHelper.Unassign<WeightWritePlugin>(ref _instance, this);
		}

		private void onLoad()
		{
			((BaseUnityPlugin)this).Config.SaveOnConfigSet = false;
			_configurableSceneCollections.AddRange(new <>z__ReadOnlyArray<ConfigurableSceneCollection>(new ConfigurableSceneCollection[10]
			{
				new ConfigurableSceneCollection("RoR2/Base/SceneGroups/sgStage1.asset", "Stage 1", ((BaseUnityPlugin)this).Config),
				new ConfigurableSceneCollection("RoR2/Base/SceneGroups/sgStage2.asset", "Stage 2", ((BaseUnityPlugin)this).Config),
				new ConfigurableSceneCollection("RoR2/Base/SceneGroups/sgStage3.asset", "Stage 3", ((BaseUnityPlugin)this).Config),
				new ConfigurableSceneCollection("RoR2/Base/SceneGroups/sgStage4.asset", "Stage 4", ((BaseUnityPlugin)this).Config),
				new ConfigurableSceneCollection("RoR2/Base/SceneGroups/sgStage5.asset", "Stage 5", ((BaseUnityPlugin)this).Config),
				new ConfigurableSceneCollection("RoR2/Base/SceneGroups/loopSgStage1.asset", "Stage 1 (Loop)", ((BaseUnityPlugin)this).Config),
				new ConfigurableSceneCollection("RoR2/Base/SceneGroups/loopSgStage2.asset", "Stage 2 (Loop)", ((BaseUnityPlugin)this).Config),
				new ConfigurableSceneCollection("RoR2/Base/SceneGroups/loopSgStage3.asset", "Stage 3 (Loop)", ((BaseUnityPlugin)this).Config),
				new ConfigurableSceneCollection("RoR2/Base/SceneGroups/loopSgStage4.asset", "Stage 4 (Loop)", ((BaseUnityPlugin)this).Config),
				new ConfigurableSceneCollection("RoR2/Base/SceneGroups/loopSgStage5.asset", "Stage 5 (Loop)", ((BaseUnityPlugin)this).Config)
			}));
			((BaseUnityPlugin)this).Config.SaveOnConfigSet = true;
			((BaseUnityPlugin)this).Config.Save();
			if (RiskOfOptionsCompat.Enabled)
			{
				RiskOfOptionsCompat.AddOptions();
			}
		}
	}
}
namespace WeightWrite.Utilities.Extensions
{
	public static class AssetLoadExtensions
	{
		public static void CallOnSuccess<T>(this AsyncOperationHandle<T> handle, Action<T> onSuccess)
		{
			handle.Completed += delegate(AsyncOperationHandle<T> handle)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: Invalid comparison between Unknown and I4
				if ((int)handle.Status == 2)
				{
					Log.Error("Failed to load asset '" + handle.LocationName + "'", "D:\\Git\\RoR2\\WeightWrite\\WeightWrite\\Utilities\\Extensions\\AssetLoadExtensions.cs", "CallOnSuccess", 19);
				}
				else
				{
					onSuccess(handle.Result);
				}
			};
		}
	}
	public static class StringExtensions
	{
		public static string FilterChars(this string str, char[] invalidChars)
		{
			if (invalidChars == null || invalidChars.Length == 0)
			{
				return str;
			}
			if (str.IndexOfAny(invalidChars) == -1)
			{
				return str;
			}
			StringBuilder stringBuilder = StringBuilderPool.RentStringBuilder();
			foreach (char value in str)
			{
				if (Array.IndexOf(invalidChars, value) == -1)
				{
					stringBuilder.Append(value);
				}
			}
			string result = stringBuilder.ToString();
			StringBuilderPool.ReturnStringBuilder(stringBuilder);
			return result;
		}

		public static string FilterConfigKey(this string key)
		{
			return key.FilterChars(ConfigDefinition._invalidConfigChars);
		}
	}
}
namespace WeightWrite.ModCompatibility
{
	internal static class RiskOfOptionsCompat
	{
		private static Sprite _iconSprite;

		private const string MOD_GUID = "com.Gorakh.WeightWrite";

		private const string MOD_NAME = "WeightWrite";

		public static bool Enabled => Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions");

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		public static void AddOptions()
		{
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Expected O, but got Unknown
			//IL_0072: Expected O, but got Unknown
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Expected O, but got Unknown
			ModSettingsManager.SetModDescription("Options for WeightWrite", "com.Gorakh.WeightWrite", "WeightWrite");
			Sprite val = tryGetIcon();
			if (Object.op_Implicit((Object)(object)val))
			{
				ModSettingsManager.SetModIcon(val, "com.Gorakh.WeightWrite", "WeightWrite");
			}
			foreach (ConfigurableSceneCollection configurableSceneCollection in WeightWritePlugin.Instance.ConfigurableSceneCollections)
			{
				foreach (ConfigEntry<float> weightConfig in configurableSceneCollection.WeightConfigs)
				{
					FloatFieldConfig val2 = new FloatFieldConfig();
					((NumericFieldConfig<float>)val2).Min = 0f;
					ModSettingsManager.AddOption((BaseOption)new FloatFieldOption(weightConfig, val2), "com.Gorakh.WeightWrite", "WeightWrite");
				}
			}
		}

		private static Sprite tryGetIcon()
		{
			if (!Object.op_Implicit((Object)(object)_iconSprite))
			{
				_iconSprite = tryGenerateIcon();
				if (!Object.op_Implicit((Object)(object)_iconSprite))
				{
					Log.Warning("Failed to get config icon", "D:\\Git\\RoR2\\WeightWrite\\WeightWrite\\ModCompatibility\\RiskOfOptionsCompat.cs", "tryGetIcon", 54);
				}
			}
			return _iconSprite;
		}

		private static Sprite tryGenerateIcon()
		{
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Expected O, but got Unknown
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			FileInfo fileInfo = findIconFileRecursive(new DirectoryInfo(Path.GetDirectoryName(((BaseUnityPlugin)WeightWritePlugin.Instance).Info.Location)));
			if (fileInfo == null)
			{
				return null;
			}
			byte[] array;
			try
			{
				array = File.ReadAllBytes(fileInfo.FullName);
			}
			catch (Exception arg)
			{
				Log.Error_NoCallerPrefix($"Failed to read icon file '{fileInfo.FullName}': {arg}");
				return null;
			}
			Texture2D val = new Texture2D(256, 256);
			((Object)val).name = "texWeightWriteIcon";
			if (!ImageConversion.LoadImage(val, array))
			{
				Log.Error("Failed to load icon into texture", "D:\\Git\\RoR2\\WeightWrite\\WeightWrite\\ModCompatibility\\RiskOfOptionsCompat.cs", "tryGenerateIcon", 83);
				return null;
			}
			Sprite obj = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f));
			((Object)obj).name = "WeightWriteIcon";
			return obj;
		}

		private static FileInfo findIconFileRecursive(DirectoryInfo dir)
		{
			if (dir == null)
			{
				return null;
			}
			if (string.Equals(dir.FullName, Paths.PluginPath, StringComparison.OrdinalIgnoreCase))
			{
				return null;
			}
			FileInfo fileInfo = dir.EnumerateFiles("icon.png", SearchOption.TopDirectoryOnly).FirstOrDefault();
			if (fileInfo != null)
			{
				return fileInfo;
			}
			return findIconFileRecursive(dir.Parent);
		}
	}
}
namespace WeightWrite.Config
{
	public class AcceptableValueMin<T> : AcceptableValueBase where T : IComparable
	{
		public T MinValue { get; }

		public AcceptableValueMin(T minValue)
			: base(typeof(T))
		{
			if (minValue == null)
			{
				throw new ArgumentNullException("minValue");
			}
			MinValue = minValue;
		}

		public override object Clamp(object value)
		{
			if (MinValue.CompareTo(value) > 0)
			{
				return MinValue;
			}
			return value;
		}

		public override bool IsValid(object value)
		{
			return MinValue.CompareTo(value) <= 0;
		}

		public override string ToDescriptionString()
		{
			return $"# Acceptable value range: Greater than or equal to {MinValue}";
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		internal IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}
internal sealed class <>z__ReadOnlyArray<T> : IEnumerable, ICollection, IList, IEnumerable<T>, IReadOnlyCollection<T>, IReadOnlyList<T>, ICollection<T>, IList<T>
{
	int ICollection.Count => _items.Length;

	bool ICollection.IsSynchronized => false;

	object ICollection.SyncRoot => this;

	object IList.this[int index]
	{
		get
		{
			return _items[index];
		}
		set
		{
			throw new NotSupportedException();
		}
	}

	bool IList.IsFixedSize => true;

	bool IList.IsReadOnly => true;

	int IReadOnlyCollection<T>.Count => _items.Length;

	T IReadOnlyList<T>.this[int index] => _items[index];

	int ICollection<T>.Count => _items.Length;

	bool ICollection<T>.IsReadOnly => true;

	T IList<T>.this[int index]
	{
		get
		{
			return _items[index];
		}
		set
		{
			throw new NotSupportedException();
		}
	}

	public <>z__ReadOnlyArray(T[] items)
	{
		_items = items;
	}

	IEnumerator IEnumerable.GetEnumerator()
	{
		return ((IEnumerable)_items).GetEnumerator();
	}

	void ICollection.CopyTo(Array array, int index)
	{
		((ICollection)_items).CopyTo(array, index);
	}

	int IList.Add(object value)
	{
		throw new NotSupportedException();
	}

	void IList.Clear()
	{
		throw new NotSupportedException();
	}

	bool IList.Contains(object value)
	{
		return ((IList)_items).Contains(value);
	}

	int IList.IndexOf(object value)
	{
		return ((IList)_items).IndexOf(value);
	}

	void IList.Insert(int index, object value)
	{
		throw new NotSupportedException();
	}

	void IList.Remove(object value)
	{
		throw new NotSupportedException();
	}

	void IList.RemoveAt(int index)
	{
		throw new NotSupportedException();
	}

	IEnumerator<T> IEnumerable<T>.GetEnumerator()
	{
		return ((IEnumerable<T>)_items).GetEnumerator();
	}

	void ICollection<T>.Add(T item)
	{
		throw new NotSupportedException();
	}

	void ICollection<T>.Clear()
	{
		throw new NotSupportedException();
	}

	bool ICollection<T>.Contains(T item)
	{
		return ((ICollection<T>)_items).Contains(item);
	}

	void ICollection<T>.CopyTo(T[] array, int arrayIndex)
	{
		((ICollection<T>)_items).CopyTo(array, arrayIndex);
	}

	bool ICollection<T>.Remove(T item)
	{
		throw new NotSupportedException();
	}

	int IList<T>.IndexOf(T item)
	{
		return ((IList<T>)_items).IndexOf(item);
	}

	void IList<T>.Insert(int index, T item)
	{
		throw new NotSupportedException();
	}

	void IList<T>.RemoveAt(int index)
	{
		throw new NotSupportedException();
	}
}