Decompiled source of MapStation v0.17.1
MapStation.API.dll
Decompiled 2 months agousing System; using System.Collections.ObjectModel; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using Microsoft.CodeAnalysis; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.7.1", FrameworkDisplayName = ".NET Framework 4.7.1")] [assembly: AssemblyCompany("MapStation.API")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+2a9f5e71dc280b5c7d4e74f2e1ad0f6a1ac841a2")] [assembly: AssemblyProduct("MapStation.API")] [assembly: AssemblyTitle("MapStation.API")] [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 MapStation.API { public static class APIManager { public static IMapStationAPI API; public static bool Initialized; public static event Action OnInitialized; public static void Initialize(IMapStationAPI api) { API = api; Initialized = true; APIManager.OnInitialized?.Invoke(); } } public interface ICustomStage { string DisplayName { get; } string InternalName { get; } string AuthorName { get; } int StageID { get; } } public interface IMapStationAPI { ReadOnlyCollection<ICustomStage> CustomStages { get; } ICustomStage GetCustomStageByID(int stageID); int GetStageID(string stageInternalName); } }
MapStation.Common.dll
Decompiled 2 months agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.IO.Compression; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx.Logging; using MapStation.Common.Runtime; using MapStation.Common.Serialization; using Microsoft.CodeAnalysis; using Microsoft.Win32; using Reptile; using UnityEngine; using UnityEngine.Audio; using UnityEngine.Playables; using UnityEngine.Rendering.PostProcessing; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.7.1", FrameworkDisplayName = ".NET Framework 4.7.1")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: AssemblyCompany("MapStation.Common")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+2a9f5e71dc280b5c7d4e74f2e1ad0f6a1ac841a2")] [assembly: AssemblyProduct("MapStation.Common")] [assembly: AssemblyTitle("MapStation.Common")] [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; } } } [AttributeUsage(AttributeTargets.Field, Inherited = true)] public class UidAttribute : PropertyAttribute { } namespace cspotcode.UnityGUI { public static class GUIUtil { private class EndScrollViewDisposable : IDisposable { public void Dispose() { GUILayout.EndScrollView(); } } private class EndVerticalDisposable : IDisposable { public void Dispose() { GUILayout.EndVertical(); } } private class EndHorizontalDisposable : IDisposable { public void Dispose() { GUILayout.EndHorizontal(); } } private class EndDisabledDisposable : IDisposable { private readonly bool stateBefore; internal EndDisabledDisposable(bool stateBefore) { this.stateBefore = stateBefore; } public void Dispose() { GUI.enabled = stateBefore; } } private class IndentDisposable : IDisposable { private readonly int increment; internal IndentDisposable(int increment) { this.increment = increment; } public void Dispose() { indentLevel -= increment; } } private class ApplyIndentDisposable : IDisposable { public void Dispose() { GUILayout.EndVertical(); GUILayout.EndHorizontal(); } } public const char UpTriangle = '▲'; public const char DownTriangle = '▼'; public const char RightTriangle = '▶'; public static readonly IDisposable EndScrollView = new EndScrollViewDisposable(); public static readonly IDisposable EndHorizontal = new EndHorizontalDisposable(); private const int PixelsPerIndentLevel = 15; public static readonly IDisposable EndApplyIndent = new ApplyIndentDisposable(); public static int indentLevel { get; set; } public static IDisposable ScrollView(ref Vector2 position) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) ScrollViewScope val = new ScrollViewScope(position, Array.Empty<GUILayoutOption>()); position = val.scrollPosition; return (IDisposable)val; } public static IDisposable Horizontal() { GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); return EndHorizontal; } public static IDisposable Disabled(bool disabled = true) { EndDisabledDisposable result = new EndDisabledDisposable(GUI.enabled); GUI.enabled = !disabled; return result; } public static IDisposable Indent(int increment = 1, bool apply = false) { indentLevel += increment; IndentDisposable indentDisposable = new IndentDisposable(increment); if (apply) { IDisposable disposable = ApplyIndent(); return new CompositeDisposable(disposable, indentDisposable); } return indentDisposable; } public static IDisposable ApplyIndent() { GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); GUILayout.Label("", (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width((float)(15 * indentLevel)), GUILayout.ExpandWidth(false) }); GUILayout.BeginVertical((GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(false) }); return EndApplyIndent; } } public static class Extensions { } public class CompositeDisposable : IDisposable { private readonly IDisposable[] disposables; public CompositeDisposable(params IDisposable[] disposables) { this.disposables = disposables; } public void Dispose() { IDisposable[] array = disposables; for (int i = 0; i < array.Length; i++) { array[i].Dispose(); } } } } namespace MapStation.Common { public abstract class AGameMapStationPlugin { public virtual void OnAddMapToDatabase(ZipArchive archive, string path, string mapName) { } public virtual void OnReload() { } } public class NoOpDynamicPickup : MonoBehaviour { private void Awake() { Object.Destroy((Object)(object)((Component)this).gameObject); } } public class PathConstants { public const string MapFileExtension = ".brcmap"; public const string ConfigDirectory = "MapStation"; public const string TestMapsDirectory = "TestMaps"; public static string AbsoluteTestMapsDirectoryFromBepInExProfile(string BepInExProfileDirectory) { return Path.Combine(BepInExProfileDirectory, "Config", "MapStation", "TestMaps"); } } public class AssetNames { public const string MapDirectory = "Maps"; public const string SceneBasenamePrefix = "Scene."; public const string PropertiesBasename = "Properties"; public const string BundlePrefix = "maps/"; public const string SceneBundleBasename = "scene"; public const string SceneBundleSuffix = "/scene"; public const string AssetsBundleBasename = "assets"; public const string AssetsBundleSuffix = "/assets"; public const string BundleVariant = ""; public static string GetMiniMapPathForMap(string name) { return "Assets/Maps/" + name + "/MiniMap.prefab"; } public static string GetAssetDirectoryForMap(string name) { return "Assets/Maps/" + name; } public static string GetScenePathForMap(string name) { return "Assets/Maps/" + name + "/Scene." + name + ".unity"; } public static string GetPropertiesPathForMap(string name) { return "Assets/Maps/" + name + "/Properties.asset"; } public static string GetReadmePathForMap(string name) { return "Assets/Maps/" + name + "/README.md"; } public static string GetIconPathForMap(string name) { return "Assets/Maps/" + name + "/icon.png"; } public static string GetChangelogPathForMap(string name) { return "Assets/Maps/" + name + "/CHANGELOG.md"; } public static string GetSceneBundleNameForMap(string name) { return "maps/" + name.ToLower() + "/scene"; } public static string GetAssetBundleNameForMap(string name) { return "maps/" + name.ToLower() + "/assets"; } } public static class EnumeratePairsExtensions { public static IEnumerable<KeyValuePair<int, T>> Pairs<T>(this T[] array) { for (int i = 0; i < array.Length; i++) { yield return new KeyValuePair<int, T>(i, array[i]); } } public static IEnumerable<KeyValuePair<int, T>> Pairs<T>(this List<T> list) { for (int i = 0; i < list.Count; i++) { yield return new KeyValuePair<int, T>(i, list[i]); } } } public static class DeconstructPairsExtensions { public static void Deconstruct<T, U>(this KeyValuePair<T, U> pair, out T key, out U value) { key = pair.Key; value = pair.Value; } } public static class EnumeratorExtensions { public static T TakeNext<T>(this IEnumerator<T> enumerator) { enumerator.MoveNext(); return enumerator.Current; } } public static class Log { public static ManualLogSource Logger; public static void Info(string message) { Logger.LogInfo((object)message); } public static void Error(string message) { Logger.LogError((object)message); } public static void Warning(string message) { Logger.LogWarning((object)message); } public static void Debug(string message) { Logger.LogDebug((object)message); } } public class BaseMapDatabaseEntry { public string Name; public string ScenePath; public string SceneBundleName => AssetNames.GetSceneBundleNameForMap(Name); public string AssetsBundleName => AssetNames.GetAssetBundleNameForMap(Name); } [Serializable] public class MapProperties { public int format = 1; public string internalName; public string version = "0.0.0"; public string displayName = ""; public string authorName = ""; public bool showInFastTravelMenus = true; public bool disableCops; [Tooltip("Override the shadow distance for your map. Can be used to avoid shadows fading out too close.")] public bool overrideShadowDistance = true; [Range(0f, 500f)] public float shadowDistance = 150f; } public class MapZip : IDisposable { public const string propertiesFilename = "properties.json"; public const string sceneBundleFilename = "scene"; public const string assetsBundleFilename = "assets"; private string path; private ZipArchive zip; public MapZip(string path) { this.path = path; } public ZipArchive WriteZip(string propertiesContents, string sceneBundlePath, string assetsBundlePath, bool compressed = true) { CompressionLevel compressionLevel = ((!compressed) ? CompressionLevel.NoCompression : CompressionLevel.Optimal); zip = ZipFile.Open(path, ZipArchiveMode.Create); zip.CreateEntryFromFile(sceneBundlePath, "scene", compressionLevel); zip.CreateEntryFromFile(assetsBundlePath, "assets", compressionLevel); using (Stream stream = zip.CreateEntry("properties.json", compressionLevel).Open()) { using StreamWriter streamWriter = new StreamWriter(stream); streamWriter.Write(propertiesContents); } return zip; } private void openForReading() { if (zip == null) { zip = ZipFile.Open(path, ZipArchiveMode.Read); } } public void DoPluginOnAddMapToDatabase(string mapName) { openForReading(); GamePluginManager.OnAddMapToDatabase(zip, path, mapName); } public string GetPropertiesText() { openForReading(); using Stream stream = zip.GetEntry("properties.json").Open(); using StreamReader streamReader = new StreamReader(stream); return streamReader.ReadToEnd(); } public Stream GetSceneBundleStream() { openForReading(); return zip.GetEntry("scene").Open(); } public Stream GetAssetsBundleStream() { openForReading(); return zip.GetEntry("assets").Open(); } public void Dispose() { zip?.Dispose(); } } public class MiniMapProperties : MonoBehaviour { [Header("Material that will change colors in phone and pause menu.")] public Material MapMaterial; } public class PathDetection { public const string RegistryKey = "HKEY_CURRENT_USER\\Software\\BRCMapStation\\MapStation"; public const string RegistryValueBepInExProfile = "BepInExProfile"; public const string RegistryValueBRCPath = "BRCPath"; public const string RegistryValueUnityEditorDataDir = "UnityEditorDataDir"; public static string GetBepInExProfileInRegistry() { return Registry.GetValue("HKEY_CURRENT_USER\\Software\\BRCMapStation\\MapStation", "BepInExProfile", "") as string; } public static void SetBepInExProfileInRegistry(string path) { Registry.SetValue("HKEY_CURRENT_USER\\Software\\BRCMapStation\\MapStation", "BepInExProfile", path); } public static string GetBRCPathInRegistry() { return Registry.GetValue("HKEY_CURRENT_USER\\Software\\BRCMapStation\\MapStation", "BRCPath", "") as string; } public static void SetBRCPathInRegistry(string path) { Registry.SetValue("HKEY_CURRENT_USER\\Software\\BRCMapStation\\MapStation", "BRCPath", path); } public static string GetUnityEditorDataDirInRegistry() { return Registry.GetValue("HKEY_CURRENT_USER\\Software\\BRCMapStation\\MapStation", "UnityEditorDataDir", "") as string; } public static void SetUnityEditorDataDirInRegistry(string path) { Registry.SetValue("HKEY_CURRENT_USER\\Software\\BRCMapStation\\MapStation", "UnityEditorDataDir", path); } } public class StageObject : MonoBehaviour { [Header("Name of the chunk GameObject. Leave this empty to automatically find a chunk.")] [SerializeField] private string chunkName = ""; public void PutInChunk() { //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)((Component)this).GetComponentInParent<StageChunk>(true) != (Object)null) { return; } StageObject componentInParent = ((Component)this).GetComponentInParent<StageObject>(true); if ((Object)(object)componentInParent != (Object)(object)this && (Object)(object)componentInParent != (Object)null) { componentInParent.PutInChunk(); return; } StageChunk[] array = Object.FindObjectsOfType<StageChunk>(true); StageChunk val = null; float num = 0f; StageChunk[] array2 = array; foreach (StageChunk val2 in array2) { if ((Object)(object)val2 == (Object)null || ((Object)((Component)val2).gameObject).name.StartsWith("!")) { continue; } if (!string.IsNullOrEmpty(chunkName)) { if (((Object)((Component)val2).gameObject).name == chunkName) { ((Component)this).transform.SetParent(((Component)val2).transform); return; } continue; } BoxCollider[] componentsInChildren = ((Component)val2).GetComponentsInChildren<BoxCollider>(true); bool flag = false; BoxCollider[] array3 = componentsInChildren; foreach (BoxCollider val3 in array3) { if (!((Object)(object)val3 == (Object)null) && StageChunk.PointInOBB(((Component)this).transform.position, val3)) { flag = true; break; } } if (flag) { float num2 = Vector3.Distance(((Component)this).transform.position, ((Component)val2).transform.position); if ((Object)(object)val == (Object)null) { val = val2; num = num2; } else if (num2 < num) { val = val2; num = num2; } } } if ((Object)(object)val != (Object)null) { ((Component)this).transform.SetParent(((Component)val).transform); } } } public static class StagePrefabHijacker { public class StagePrefabs { public GameObject Parent; public List<GameObject> Toilets = new List<GameObject>(); public GameObject GetToilet() { GameObject result = Toilets[0]; Toilets.RemoveAt(0); return result; } } public const Stage StageToHijackPrefabsFrom = 5; public static string[] ProtectedAssetBundles = new string[16] { "characters", "graffiti", "common_assets", "enemies", "enemy_animation", "character_animation", "in_game_assets", "mocap_animation_two", "mocap_animation", "finalboss_assets", "playeranimation", "finalboss_animation", "storyanimation", "minimap", "common_game_shaders", "city_assets" }; public static Stage ActualTargetStage = (Stage)(-1); public static bool Loaded = false; public static bool Active = false; public static StagePrefabs Prefabs; private const int PublicToiletPool = 100; public static void Log(string text) { MapStation.Common.Log.Info("[StagePrefabHijacker] " + text); } private static void CleanUp() { if (Prefabs != null && !((Object)(object)Prefabs.Parent == (Object)null)) { Object.Destroy((Object)(object)Prefabs.Parent); } } public static void RunOnHijackStage() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) CleanUp(); Prefabs = new StagePrefabs(); Prefabs.Parent = new GameObject("Custom Stage Prefabs"); Object.DontDestroyOnLoad((Object)(object)Prefabs.Parent); Prefabs.Parent.SetActive(false); PublicToilet val = Object.FindObjectOfType<PublicToilet>(); for (int i = 0; i < 100; i++) { GameObject val2 = Object.Instantiate<GameObject>(((Component)val).gameObject); val2.transform.SetParent(Prefabs.Parent.transform, false); val2.transform.SetPositionAndRotation(Vector3.zero, Quaternion.identity); Prefabs.Toilets.Add(val2); } } public static void RunOnCustomStage() { } } public class DebugShapeUtility { public static IEnumerable<Renderer> FindDebugShapes(GameObject root) { return root.GetComponentsInChildren<Renderer>(true).Where(delegate(Renderer r) { Material sharedMaterial = r.sharedMaterial; return ((sharedMaterial != null) ? ((Object)sharedMaterial).name : null) == "Debug"; }); } public static void SetDebugShapesVisibility(GameObject root, bool visible) { foreach (Renderer item in FindDebugShapes(root)) { item.enabled = visible; } } } public class DebugUI : MonoBehaviour { public abstract class DebugMenu { public abstract string Name { get; } public virtual int? Width { get; } public abstract void OnGUI(); } public const int DefaultWidth = 400; private const int Height = 1200; private List<DebugMenu> debugMenus = new List<DebugMenu>(); private bool show = true; private DebugMenu currentDebugMenu; public static DebugUI Instance { get; private set; } public bool UiEnabled { get { return ((Component)this).gameObject.activeSelf; } set { ((Component)this).gameObject.SetActive(value); } } public static void Create(bool enabled) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown if (!((Object)(object)Instance != (Object)null)) { GameObject val = new GameObject("MapStation Debug UI"); val.SetActive(enabled); Instance = val.AddComponent<DebugUI>(); Object.DontDestroyOnLoad((Object)val); } } public void RegisterMenu(DebugMenu menu) { debugMenus.Add(menu); } private void OnGUI() { //IL_0051: Unknown result type (might be due to invalid IL or missing references) int num = ((show && currentDebugMenu != null && currentDebugMenu.Width.HasValue) ? currentDebugMenu.Width.Value : 400); GUILayout.BeginArea(new Rect(0f, 0f, (float)num, 1200f)); GUILayout.BeginVertical(GUI.skin.box, Array.Empty<GUILayoutOption>()); GUILayout.BeginVertical(GUI.skin.box, Array.Empty<GUILayoutOption>()); GUILayout.BeginVertical("Debug UI", GUI.skin.box, Array.Empty<GUILayoutOption>()); GUILayout.Space(20f); try { if (GUILayout.Button("Show/Hide", Array.Empty<GUILayoutOption>())) { show = !show; } if (!show) { return; } if (currentDebugMenu != null) { if (GUILayout.Button("Back", Array.Empty<GUILayoutOption>())) { currentDebugMenu = null; } else { currentDebugMenu.OnGUI(); } return; } foreach (DebugMenu debugMenu in debugMenus) { if (GUILayout.Button(debugMenu.Name, Array.Empty<GUILayoutOption>())) { currentDebugMenu = debugMenu; } } } finally { GUILayout.EndVertical(); GUILayout.EndVertical(); GUILayout.EndVertical(); GUILayout.EndArea(); } } } public static class PluginInfo { public const string PLUGIN_GUID = "MapStation.Common"; public const string PLUGIN_NAME = "MapStation.Common"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace MapStation.Common.Serialization { internal class SerializationExample : MonoBehaviour { [Serializable] private class Conversation { public string showIfUnlockableIsUnlocked; } [Serializable] private class Dialog { public string say; public string animation; public bool askYesNo; } private class SList_NpcDialog : SList<Dialog> { } [SerializeReference] private Conversation conversation = new Conversation(); [SerializeReference] private SList_NpcDialog npcDialog_ = new SList_NpcDialog(); private List<Dialog> npcDialogs => npcDialog_.items; private void Awake() { string text = ""; text += string.Format("{0} serialized data:\n", "SerializationExample"); text += string.Format("{0}.{1}={2}\n", "Conversation", "showIfUnlockableIsUnlocked", conversation.showIfUnlockableIsUnlocked); text += string.Format("{0}.Count={1}\n", "npcDialogs", npcDialogs.Count); for (int i = 0; i < npcDialogs.Count; i++) { text += string.Format("{0}[{1}].{2}={3}\n", "npcDialogs", i, "say", npcDialogs[i].say); text += string.Format("{0}[{1}].{2}={3}\n", "npcDialogs", i, "animation", npcDialogs[i].animation); text += string.Format("{0}[{1}].{2}={3}\n", "npcDialogs", i, "askYesNo", npcDialogs[i].askYesNo); } Log.Info(text); } } public class SList { } [Serializable] public class SList<T> : SList, ISerializationCallbackReceiver where T : new() { [HideInInspector] [SerializeReference] private Node linkedList; [SerializeReference] public List<T> items; public void copyToLinkedList() { if (items == null || items.Count == 0) { linkedList = null; return; } if (linkedList == null) { linkedList = new Node(); } Node next = linkedList; int i = 0; for (int count = items.Count; i < count; i++) { next.value = items[i]; if (i < count - 1) { Node node = next; if (node.next == null) { node.next = new Node(); } next = next.next; } else { next.next = null; } } } public void copyToList() { if (items == null) { items = new List<T>(); } else { items.Clear(); } for (Node next = linkedList; next != null; next = next.next) { items.Add((T)next.value); } } private void instantiateNullList() { if (items == null) { items = new List<T>(); } } private void instantiateNullItemsInList() { int i = 0; for (int count = items.Count; i < count; i++) { if (items[i] == null) { items[i] = new T(); } } } public void OnBeforeSerialize() { instantiateNullList(); instantiateNullItemsInList(); copyToLinkedList(); } public void OnAfterDeserialize() { if (!Application.isEditor) { copyToList(); } } } [Serializable] public class Node { [SerializeReference] public object value; [SerializeReference] public Node next; } } namespace MapStation.Common.Gameplay { [AddComponentMenu("")] public class GrindPath_FixComboBreakingProperty : MonoBehaviour { } public class MapStationVert : MonoBehaviour { } } namespace MapStation.Common.Runtime { [RequireComponent(typeof(AudioSource))] public class GameAudio : MonoBehaviour { public enum AudioTypes { Master = 0, Music = 4, SFX = 1, UI = 2, Gameplay = 3, Voices = 5, Ambience = 6 } public AudioTypes AudioType = AudioTypes.Gameplay; private void Awake() { ((Component)this).GetComponent<AudioSource>().outputAudioMixerGroup = Core.Instance.AudioManager.mixerGroups[(int)AudioType]; } } public static class GamePluginManager { private static ManualLogSource LogSource = Logger.CreateLogSource("MapStation Plugin Manager"); private static List<AGameMapStationPlugin> GetPlugins() { List<AGameMapStationPlugin> list = new List<AGameMapStationPlugin>(); Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); foreach (Assembly assembly in assemblies) { try { Type[] types = assembly.GetTypes(); foreach (Type type in types) { try { if (typeof(AGameMapStationPlugin).IsAssignableFrom(type) && !type.IsAbstract) { AGameMapStationPlugin item = Activator.CreateInstance(type) as AGameMapStationPlugin; list.Add(item); } } catch (Exception arg) { LogSource.LogWarning((object)$"Problem loading Type, silently handled.{Environment.NewLine}{arg}"); } } } catch (Exception arg2) { LogSource.LogWarning((object)$"Problem loading Assembly, silently handled.{Environment.NewLine}{arg2}"); } } return list; } public static void OnAddMapToDatabase(ZipArchive archive, string path, string mapName) { foreach (AGameMapStationPlugin plugin in GetPlugins()) { plugin.OnAddMapToDatabase(archive, path, mapName); } } public static void OnReload() { foreach (AGameMapStationPlugin plugin in GetPlugins()) { plugin.OnReload(); } } } [RequireComponent(typeof(Camera))] public class MapStationCameraOverride : MonoBehaviour { public bool AlsoAffectPhoneCamera = true; private PostProcessLayer _layer; public static MapStationCameraOverride Instance { get; private set; } private void Awake() { Instance = this; Camera component = ((Component)this).GetComponent<Camera>(); if ((Object)(object)component != (Object)null) { ((Behaviour)component).enabled = false; } _layer = ((Component)this).GetComponent<PostProcessLayer>(); if ((Object)(object)_layer != (Object)null) { ((Behaviour)_layer).enabled = false; } AudioListener component2 = ((Component)this).GetComponent<AudioListener>(); if ((Object)(object)component2 != (Object)null) { ((Behaviour)component2).enabled = false; } } private void OnDestroy() { Instance = null; } public void ApplyToCamera(Camera camera) { //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_layer != (Object)null) { PostProcessLayer val = ((Component)camera).gameObject.GetComponent<PostProcessLayer>(); if ((Object)(object)val == (Object)null) { val = ((Component)camera).gameObject.AddComponent<PostProcessLayer>(); } val.finalBlitToCameraTarget = _layer.finalBlitToCameraTarget; val.stopNaNPropagation = _layer.stopNaNPropagation; val.volumeTrigger = ((Component)camera).transform; val.volumeLayer = _layer.volumeLayer; val.antialiasingMode = _layer.antialiasingMode; val.fastApproximateAntialiasing = _layer.fastApproximateAntialiasing; val.subpixelMorphologicalAntialiasing = _layer.subpixelMorphologicalAntialiasing; val.temporalAntialiasing = _layer.temporalAntialiasing; FieldInfo field = typeof(PostProcessLayer).GetField("m_Resources", BindingFlags.Instance | BindingFlags.NonPublic); field.SetValue(val, field.GetValue(_layer)); } } } } namespace MapStation.Common.Runtime.Gameplay { public class MapStationPublicToilet : MonoBehaviour { public Transform Exit; public Animator DoorAnimator; public GameObject GreenLight; public GameObject RedLight; private void Awake() { //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) Transform val = ((Component)this).transform.Find("Trigger"); GameObject toilet = StagePrefabHijacker.Prefabs.GetToilet(); PublicToilet component = toilet.GetComponent<PublicToilet>(); Object.Destroy((Object)(object)((Component)((Component)component).transform.Find("OutHouse").Find("Cube.007")).gameObject); Object.Destroy((Object)(object)((Component)((Component)component).transform.Find("OutHouse").Find("Cube.001")).gameObject); Object.Destroy((Object)(object)((Component)((Component)component).transform.Find("Trigger")).gameObject); Object.Destroy((Object)(object)((Component)component.doorAnimator).gameObject); component.exit = Exit; component.doorAnimator = DoorAnimator; component.greenLight = GreenLight; component.redLight = RedLight; foreach (PlayableBinding output in component.sequence.playableAsset.outputs) { PlayableBinding current = output; if (((PlayableBinding)(ref current)).streamName == "Animation Track (3)") { component.sequence.SetGenericBinding(((PlayableBinding)(ref current)).sourceObject, (Object)(object)DoorAnimator); break; } } toilet.transform.SetParent(((Component)this).transform, false); toilet.transform.SetLocalPositionAndRotation(Vector3.zero, Quaternion.identity); ((Component)val).transform.SetParent(toilet.transform, true); } } } namespace MapStation.Common.VanillaAssets { public class DeleteVanillaGameObjectsV1 : MonoBehaviour { public class SList_Deletion : SList<Deletion> { } [Serializable] public class Deletion { public string Path; } private HashSet<GameObject> disabledGameObjects = new HashSet<GameObject>(); [SerializeReference] private SList_Deletion deletions = new SList_Deletion(); public static DeleteVanillaGameObjectsV1 Instance { get; private set; } private List<Deletion> Deletions => deletions.items; private void Awake() { if (!Application.isEditor) { Instance = this; DeleteGameObjects(); } } public void DeleteGameObjects() { foreach (Deletion deletion in Deletions) { GameObject val = GameObject.Find(deletion.Path); if ((Object)(object)val == (Object)null) { Log.Info("DeleteVanillaGameObjectsV1 could not find GameObject to delete at path: " + deletion.Path); } else { HandleDeleteGameObject(val); } } } private void HandleDeleteGameObject(GameObject gameObject) { if ((Object)(object)gameObject.GetComponent<StreetLifeCluster>() != (Object)null) { DisableGameObject(gameObject); } else { Object.Destroy((Object)(object)gameObject); } } private void DisableGameObject(GameObject gameObject) { gameObject.SetActive(false); disabledGameObjects.Add(gameObject); } public bool IsDisabled(GameObject gameObject) { if (disabledGameObjects.Contains(gameObject)) { return true; } return false; } } public class MoveVanillaGameObjectV1 : MonoBehaviour { public string moveThis; public Transform targetLocation; private void Awake() { if (!Application.isEditor) { MoveGameObject(); } } public void MoveGameObject() { //IL_0017: 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) GameObject obj = GameObject.Find(moveThis); obj.transform.position = targetLocation.position; obj.transform.rotation = targetLocation.rotation; } } public class VanillaAssetReference : MonoBehaviour { public Component component; [TextArea(3, 10)] public List<string> fields = new List<string>(); public const BindingFlags UseTheseBindingFlags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy; private void Awake() { AssignReferences(); } public void AssignReferences() { if ((Object)(object)component == (Object)null) { return; } foreach (string field in fields) { int num = field.IndexOf("="); int num2 = field.IndexOf(":"); string text = field.Substring(0, num); int num3 = -1; int num4 = text.IndexOf("["); if (num4 >= 0) { num3 = int.Parse(text.Substring(num4 + 1, -1)); ((Object)this).name = text.Substring(0, num4); } else { ((Object)this).name = text; } string text2 = field.Substring(num + 1, num2 - num - 1); string text3 = field.Substring(num2 + 1); Object val = Core.Instance.Assets.LoadAssetFromBundle<Object>(text2, text3); if (val == (Object)null) { Log.Info(string.Format("{0}: Restoring reference to vanilla asset failed, asset not found: {1}.{2} = LoadAssetFromBundle(\"{3}\", \"{4}\")", "VanillaAssetReference", ((object)component).GetType().Name, ((Object)this).name, text2, text3)); continue; } Type type = ((object)component).GetType(); MemberInfo memberInfo = type.GetMember(((Object)this).name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy)[0]; string text4 = string.Format("VanillaAssetReference: Assigning {0}.{1} = asset {2}:{3} (asset found={4}, field found={5}, asset type={6})", type.Name, text, text2, text3, val != (Object)null, memberInfo != null, (val != (Object)null) ? ((object)val).GetType().Name : "<not found>"); try { if (num3 >= 0) { object obj = ((memberInfo is PropertyInfo propertyInfo) ? propertyInfo.GetValue(component) : ((FieldInfo)memberInfo).GetValue(component)); obj.GetType().GetProperty("Item").SetValue(obj, val, new object[1] { num3 }); } else if (memberInfo is PropertyInfo propertyInfo2) { propertyInfo2.SetValue(component, val); } else { ((FieldInfo)memberInfo).SetValue(component, val); } } catch (Exception ex) { Log.Info(text4 + "\nFailed with error:\n" + ex.Message + "\n" + ex.StackTrace); } } } } public class VanillaAssetReferenceV2 : MonoBehaviour { public class SList_Components : SList<ComponentEntry> { } [SerializeReference] private SList_Components components = new SList_Components(); public const BindingFlags UseTheseBindingFlags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy; private List<ComponentEntry> Components => components.items; private void Awake() { AssignReferences(); } public void AssignReferences() { //IL_014a: Unknown result type (might be due to invalid IL or missing references) foreach (ComponentEntry component2 in Components) { Component component = component2.Component; foreach (FieldEntry field in component2.Fields) { Object val = null; Object[] array = null; if (field.SubAssetType == SubAssetType.FbxChild) { array = Core.Instance.Assets.availableBundles[field.BundleName].AssetBundle.LoadAssetWithSubAssets(field.Path); } else { val = Core.Instance.Assets.LoadAssetFromBundle<Object>(field.BundleName, field.Path); } if (val == (Object)null && array == null) { Log.Info(string.Format("{0}: Restoring reference to vanilla asset failed, asset not found: {1}.{2} = LoadAssetFromBundle(\"{3}\", \"{4}\")", "VanillaAssetReferenceV2", ((object)component).GetType().Name, field.Name, field.BundleName, field.Path)); continue; } switch (field.SubAssetType) { case SubAssetType.FbxChild: { Object[] array2 = array; foreach (Object val2 in array2) { if (val2.name == field.SubPath && !(val2 is GameObject) && !(val2 is Component)) { val = val2; break; } } break; } case SubAssetType.MixerGroup: val = (Object)(object)((AudioMixer)val).FindMatchingGroups(field.SubPath)[0]; break; } if (val == (Object)null) { Log.Info(string.Format("{0}: Restoring reference to vanilla asset failed, sub-asset not found: {1}.{2} = LoadAssetFromBundle(\"{3}\", \"{4}\"); SubAssetType={5}; SubPath={6}", "VanillaAssetReferenceV2", ((object)component).GetType().Name, field.Name, field.BundleName, field.Path, field.SubAssetType.ToString(), field.SubPath)); continue; } string message = ""; try { if (component is Animation && field.Name == "AddClip") { AddAnimationClip(val, component, field, out message); continue; } AssignMember(val, component, field, out message); Animation val3 = (Animation)(object)((component is Animation) ? component : null); if ((Object)(object)val3 != (Object)null && field.Name == "clip" && val3.playAutomatically) { ((MonoBehaviour)this).StartCoroutine(PlayAnimationAutomaticallyCoroutine(val3)); } } catch (Exception ex) { Log.Info(message + "\nFailed with error:\n" + ex.Message + "\n" + ex.StackTrace); } } } } private IEnumerator PlayAnimationAutomaticallyCoroutine(Animation animationComponent) { yield return (object)new WaitForEndOfFrame(); animationComponent.Play(); } public static void AssignMember(Object asset, Component component, FieldEntry f, out string message) { Type type = ((object)component).GetType(); MemberInfo memberInfo = type.GetMember(f.Name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy)[0]; message = string.Format("{0}: Assigning {1}.{2} = asset {3}:{4} (asset found={5}, field found={6}, asset type={7})", "VanillaAssetReferenceV2", type.Name, f.PropertyPath, f.BundleName, f.Path, asset != (Object)null, memberInfo != null, (asset != (Object)null) ? ((object)asset).GetType().Name : "<not found>"); if (f.Index >= 0) { IList list = (IList)((memberInfo is PropertyInfo propertyInfo) ? propertyInfo.GetValue(component) : ((FieldInfo)memberInfo).GetValue(component)); list[f.Index] = asset; if (memberInfo is PropertyInfo) { ((PropertyInfo)memberInfo).SetValue(component, list); } else { ((FieldInfo)memberInfo).SetValue(component, list); } } else if (memberInfo is PropertyInfo propertyInfo2) { Object value = GetComponentFromPrefab(propertyInfo2.PropertyType, asset); propertyInfo2.SetValue(component, value); } else if (memberInfo is FieldInfo fieldInfo) { Object value2 = GetComponentFromPrefab(fieldInfo.FieldType, asset); fieldInfo.SetValue(component, value2); } else { Log.Info($"Unexpected member type: {memberInfo.MemberType}"); } static Object GetComponentFromPrefab(Type FieldOrPropertyType, Object asset) { GameObject val = (GameObject)(object)((asset is GameObject) ? asset : null); if (val != null && FieldOrPropertyType.IsSubclassOf(typeof(Component))) { return (Object)(object)val.GetComponent(FieldOrPropertyType); } return asset; } } public static void AddAnimationClip(Object asset, Component component, FieldEntry f, out string message) { message = "VanillaAssetReferenceV2: Animation.AddClip(asset, " + asset.name + ") where asset is " + f.BundleName + ":" + f.Path + ((f.SubPath != null) ? (":" + f.SubPath) : "") + " (asset type=" + ((asset != (Object)null) ? ((object)asset).GetType().Name : "<not found>") + ")"; ((Animation)((component is Animation) ? component : null)).AddClip((AnimationClip)(object)((asset is AnimationClip) ? asset : null), asset.name); } } [Serializable] public class ComponentEntry { private class SList_FieldEntry : SList<FieldEntry> { } [SerializeField] public Component Component; [SerializeReference] private SList_FieldEntry fields = new SList_FieldEntry(); public List<FieldEntry> Fields => fields.items; } [Serializable] public class FieldEntry { [HideInInspector] [SerializeField] public bool Enabled = true; [HideInInspector] [SerializeField] public bool AutoSync = true; [SerializeField] public string Name; [SerializeField] public int Index = -1; [SerializeField] public string BundleName; [SerializeField] public string Path; [SerializeField] public SubAssetType SubAssetType; [SerializeField] public string SubPath = ""; public string PropertyPath { get { if (Index < 0) { return Name; } return $"{Name}[{Index}]"; } } } public enum SubAssetType { None, MixerGroup, FbxChild } } namespace MapStation.Common.Dependencies { public class AssemblyDependencies { } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }
MapStation.Plugin.dll
Decompiled 2 months ago
The result has been truncated due to the large size, download it to view full contents!
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.Cryptography; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using System.Threading; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using CommonAPI; using CommonAPI.Phone; using HarmonyLib; using MapStation.API; using MapStation.Common; using MapStation.Common.Dependencies; using MapStation.Common.Doctor; using MapStation.Common.Gameplay; using MapStation.Common.Runtime; using MapStation.Plugin; using MapStation.Plugin.API; using MapStation.Plugin.Dependencies; using MapStation.Plugin.Gameplay; using MapStation.Plugin.Phone; using MapStation.Plugin.Tools; using MapStation.TypeForwarder.Dependencies; using Microsoft.CodeAnalysis; using ProtoBuf; using Reptile; using Reptile.Phone; using Rewired; using TMPro; using Unity.AI.Navigation; using UnityEngine; using UnityEngine.Rendering.PostProcessing; using UnityEngine.SceneManagement; using cspotcode.SlopCrewClient; using cspotcode.SlopCrewClient.SlopCrewAPI; using cspotcode.UnityGUI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.7.1", FrameworkDisplayName = ".NET Framework 4.7.1")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: AssemblyCompany("MapStation.Plugin")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("BepInEx Plugin Assembly for MapStation.")] [assembly: AssemblyFileVersion("0.17.1.0")] [assembly: AssemblyInformationalVersion("0.17.1+2a9f5e71dc280b5c7d4e74f2e1ad0f6a1ac841a2")] [assembly: AssemblyProduct("MapStation.Plugin")] [assembly: AssemblyTitle("MapStation.Plugin")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.17.1.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; } } } [HarmonyPatch(typeof(SceneManager))] internal static class SceneManagerPatch { [HarmonyPrefix] [HarmonyPatch("LoadSceneAsync")] [HarmonyPatch(new Type[] { typeof(string), typeof(LoadSceneMode) })] private static void LoadSceneAsync_Prefix(ref string sceneName, LoadSceneMode __1) { if (SceneNameMapper.Instance.Paths.TryGetValue(sceneName, out var value)) { Log.Info("SceneManager.LoadSceneAsync redirected from " + sceneName + " to " + value); sceneName = value; } } [HarmonyPrefix] [HarmonyPatch("UnloadSceneAsync")] [HarmonyPatch(new Type[] { typeof(string) })] private static void UnloadSceneAsync_Prefix(ref string sceneName) { if (SceneNameMapper.Instance.Names.TryGetValue(sceneName, out var value)) { Log.Info("SceneManager.UnloadSceneAsync redirected from " + sceneName + " to " + value); sceneName = value; } } } [HarmonyPatch(typeof(UnityLogSource))] internal class Patch { [HarmonyPrefix] [HarmonyPatch("OnUnityLogMessageReceived")] private static bool OnUnityLogMessageReceived_Prefix(string message, string stackTrace, LogType type) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Invalid comparison between Unknown and I4 if ((int)type == 2 && message.Contains("does not support negative scale or size")) { return false; } return true; } } namespace MapStation.Common.Doctor { public static class Doctor { public const string AboutMe = "The Doctor will analyze your map and list any problems, offering suggestions to fix them."; private static readonly string[] VendingMachineAnimations = new string[5] { "none", "shake", "emptyShake", "close", "drop" }; public static Analysis Analyze(MapProperties mapProperties) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) Scene activeScene = SceneManager.GetActiveScene(); return Analyze(((Scene)(ref activeScene)).GetRootGameObjects(), mapProperties); } public static Analysis Analyze(GameObject root, MapProperties mapProperties) { return Analyze((GameObject[])(object)new GameObject[1] { root }, mapProperties); } private static List<T> GetComponentsInChildren<T>(this GameObject[] roots) { List<T> list = new List<T>(); foreach (GameObject val in roots) { list.AddRange(val.GetComponentsInChildren<T>()); } return list; } private static void CheckChunkStuff(Analysis a, GameObject[] roots) { List<MonoBehaviour> list = new List<MonoBehaviour>(); list.AddRange((IEnumerable<MonoBehaviour>)roots.GetComponentsInChildren<Junk>()); list.AddRange((IEnumerable<MonoBehaviour>)roots.GetComponentsInChildren<StreetLifeCluster>()); foreach (MonoBehaviour item in list) { if ((Object)(object)((Component)item).GetComponentInParent<StageChunk>() == (Object)null) { a.Add(Severity.Error, (Object)(object)item, "Component not in Chunk", "This component is not inside of a Stage Chunk. This may crash the game."); } } } private static void CheckStreetLife(Analysis a, GameObject[] roots) { foreach (Pedestrian componentsInChild in roots.GetComponentsInChildren<Pedestrian>()) { if ((Object)(object)((Component)componentsInChild).GetComponentInParent<StreetLifeCluster>(true) == (Object)null) { a.Add(Severity.Warning, (Object)(object)componentsInChild, "Pedestrian not in StreetLifeCluster", "Pedestrian is not in a StreetLifeCluster, may not function properly."); } } } public static Analysis Analyze(GameObject[] roots, MapProperties mapProperties) { Analysis analysis = new Analysis(); if (roots.GetComponentsInChildren<MapStationCameraOverride>().Count > 1) { analysis.Add(Severity.Warning, null, "Multiple Camera Overrides", "There are multiple Camera Overrides. Only one is supported."); } List<PlayerSpawner> componentsInChildren = roots.GetComponentsInChildren<PlayerSpawner>(); bool flag = false; foreach (PlayerSpawner item in componentsInChildren) { if (item.isDefaultSpawnPoint) { flag = true; break; } } if (!flag) { analysis.Add(Severity.Warning, null, "Missing Default Player Spawn Point", "Map is missing a default player spawn point. Player will spawn at 0,0,0."); } CheckChunkStuff(analysis, roots); CheckStreetLife(analysis, roots); List<BasicEnemySpawner> componentsInChildren2 = roots.GetComponentsInChildren<BasicEnemySpawner>(); bool flag2 = false; bool flag3 = false; bool flag4 = false; foreach (BasicEnemySpawner item2 in componentsInChildren2) { if (item2.spawnableEnemies == null) { continue; } GameObject[] spawnableEnemies = item2.spawnableEnemies; for (int i = 0; i < spawnableEnemies.Length; i++) { switch (((Object)spawnableEnemies[i]).name) { case "ShieldCop": case "SniperCop": case "BasicCop": flag2 = true; break; case "CopterCop": flag3 = true; break; case "tankWalker": flag4 = true; break; } } } List<NavMeshSurface> componentsInChildren3 = roots.GetComponentsInChildren<NavMeshSurface>(); bool flag5 = false; bool flag6 = false; bool flag7 = false; foreach (NavMeshSurface item3 in componentsInChildren3) { if (!((Object)(object)item3.navMeshData == (Object)null)) { switch (item3.agentTypeID) { case 0: flag5 = true; break; case -1372625422: flag7 = true; break; case -334000983: flag6 = true; break; } } } if (componentsInChildren2.Count == 0 && !mapProperties.disableCops) { analysis.Add(Severity.Warning, null, "Missing Cop Spawners", "Map has cops enabled, but there are no spawners for them."); } if (flag2 && !flag5) { analysis.Add(Severity.Warning, null, "Missing NavMeshSurface for Cops", "Map has cops but no NavMeshSurface for them. They will not be able to navigate."); } if (flag3 && !flag6) { analysis.Add(Severity.Warning, null, "Missing NavMeshSurface for Cop Helicopters", "Map has helicopters but no NavMeshSurface for them. They will not be able to navigate."); } if (flag4 && !flag7) { analysis.Add(Severity.Warning, null, "Missing NavMeshSurface for Tankwalkers", "Map has tankwalkers but no NavMeshSurface for them. They will not be able to navigate."); } foreach (GraffitiSpot componentsInChild in roots.GetComponentsInChildren<GraffitiSpot>()) { if ((Object)(object)componentsInChild.dynamicRepPickup == (Object)null) { analysis.Add(Severity.Error, (Object)(object)componentsInChild, "Graffiti missing dynamicRepPickup", "Found GraffitiSpot.dynamicRepPickup == null. This will soft-lock when tagged."); } if (((Component)componentsInChild).tag != "GraffitiSpot") { analysis.Add(Severity.Warning, (Object)(object)componentsInChild, "GraffitiSpot has wrong tag", "Found GraffitiSpot not tagged as 'GraffitiSpot'"); } if (((Component)componentsInChild).gameObject.layer != 19) { analysis.Add(Severity.Warning, (Object)(object)componentsInChild, "GraffitiSpot has wrong layer", "Found GraffitiSpot not on the 'TriggerDetectPlayer' layer."); } } List<AProgressable> componentsInChildren4 = roots.GetComponentsInChildren<AProgressable>(); foreach (AProgressable item4 in componentsInChildren4) { if ((!(((Object)((Component)item4).gameObject).name == "DummyNPC") || !(item4 is NPC)) && !Regex.Match(item4.uid, "^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$", RegexOptions.None).Success) { analysis.Add(Severity.Warning, (Object)(object)item4, "Bad Uid", "Found " + ((object)item4).GetType().Name + ".uid which is not in expected UID format (all lowercase, numbers and letters a-f, correct length, correct hyphens) UID=" + item4.uid); } } foreach (IGrouping<string, AProgressable> item5 in from p in componentsInChildren4 group p by p.uid) { if (item5.Count() <= 1) { continue; } foreach (AProgressable item6 in item5) { analysis.Add(Severity.Error, (Object)(object)item6, "Duplicate Uid", "Found " + ((object)item6).GetType().Name + ".uid which is identical to one or more other progressables in this map. This may crash the game when the map loads. Ensure all UIDs are unique. UID=" + item6.uid); } } foreach (VendingMachine componentsInChild2 in roots.GetComponentsInChildren<VendingMachine>()) { if (((Component)componentsInChild2).gameObject.layer != 17) { analysis.Add(Severity.Warning, (Object)(object)componentsInChild2, "VendingMachine has wrong layer", "Found VendingMachine that is not on the Enemies layer, this means it cannot be kicked."); } Animation component = ((Component)componentsInChild2).GetComponent<Animation>(); if ((Object)(object)component == (Object)null) { analysis.Add(Severity.Warning, (Object)(object)componentsInChild2, "VendingMachine missing Animation component", "Found VendingMachine without an Animation component."); } string[] vendingMachineAnimations = VendingMachineAnimations; foreach (string text in vendingMachineAnimations) { if ((TrackedReference)(object)component.GetState(text) == (TrackedReference)null) { analysis.Add(Severity.Warning, (Object)(object)componentsInChild2, "VendingMachine missing animations", "Found VendingMachine with Animation component missing animation: " + text + ". This will fail with errors when kicked."); } } } foreach (Teleport componentsInChild3 in roots.GetComponentsInChildren<Teleport>()) { if ((Object)(object)componentsInChild3.teleportTo == (Object)null && !componentsInChild3.automaticallyReturnPlayerToLastSafeLocation) { analysis.Add(Severity.Warning, (Object)(object)componentsInChild3, "Found Teleport missing a `teleportTo` destination."); } BoxCollider componentInChildren = ((Component)componentsInChild3).GetComponentInChildren<BoxCollider>(); if ((Object)(object)componentInChildren == (Object)null) { analysis.Add(Severity.Warning, (Object)(object)componentsInChild3, "Found Teleport without a Box Collider on a child GameObject."); continue; } if (((Component)componentInChildren).tag != "Teleport") { analysis.Add(Severity.Warning, (Object)(object)componentsInChild3, "Found Teleporter's child collider not tagged as 'Teleport'"); } if (((Component)componentInChildren).gameObject.layer != 19) { analysis.Add(Severity.Warning, (Object)(object)componentsInChild3, "Found Teleport's child collider not on the 'TriggerDetectPlayer' layer."); } } List<SunFlareGPU> componentsInChildren5 = roots.GetComponentsInChildren<SunFlareGPU>(); if (componentsInChildren5.Count == 0) { analysis.Add(Severity.Error, null, "Missing Sun", "Map is missing a sun, will crash on startup. Try adding Sun prefab from the right-click menu."); } if (componentsInChildren5.Count > 1) { foreach (SunFlareGPU item7 in componentsInChildren5) { analysis.Add(Severity.Warning, (Object)(object)item7, "Multiple Suns", "Map has multiple suns, lighting will be too bright. Try deleting all but one."); } } foreach (GrindNode componentsInChild4 in roots.GetComponentsInChildren<GrindNode>()) { if ((Object)(object)componentsInChild4.grindLines.Find((GrindLine l) => (Object)(object)l != (Object)null) == (Object)null) { analysis.Add(Severity.Warning, (Object)(object)componentsInChild4, "Unattached Grind Node", "Grind Node is not attached to any grind lines, should probably be deleted."); } } foreach (GrindLine componentsInChild5 in roots.GetComponentsInChildren<GrindLine>()) { if ((Object)(object)componentsInChild5.n0 == (Object)null || (Object)(object)componentsInChild5.n1 == (Object)null) { analysis.Add(Severity.Warning, (Object)(object)componentsInChild5, "Unattached Grind Line", "Grind Line is not attached to two Grind Nodes, should probably be deleted."); } } return analysis; } public static string GetGameObjectPath(GameObject obj) { string text = "/" + ((Object)obj).name; while ((Object)(object)obj.transform.parent != (Object)null) { obj = ((Component)obj.transform.parent).gameObject; text = "/" + ((Object)obj).name + text; } return text; } } public class Analysis { public readonly Dictionary<GameObject, List<Diagnostic>> gameObjects = new Dictionary<GameObject, List<Diagnostic>>(); public readonly List<Diagnostic> diagnostics = new List<Diagnostic>(); public readonly List<Diagnostic> diagnosticsWithoutTarget = new List<Diagnostic>(); public readonly Dictionary<Severity, int> countBySeverity = new Dictionary<Severity, int>(); public Analysis() { foreach (object value in Enum.GetValues(typeof(Severity))) { countBySeverity.Add((Severity)value, 0); } } public void Add(Severity severity, Object target, string message, string details = null) { Diagnostic diagnostic = new Diagnostic(severity, target, message, details); diagnostics.Add(diagnostic); countBySeverity[diagnostic.Severity]++; if ((Object)(object)diagnostic.GameObject != (Object)null) { gameObjects.TryGetValue(diagnostic.GameObject, out var value); if (value == null) { value = new List<Diagnostic>(); gameObjects.Add(diagnostic.GameObject, value); } value.Add(diagnostic); } else { diagnosticsWithoutTarget.Add(diagnostic); } } public void Log() { Debug.Log((object)$"MapStation: Analysis found {diagnostics.Count} problems."); foreach (Diagnostic diagnostic in diagnostics) { string targetPath = diagnostic.TargetPath; string text = ""; if (targetPath != null) { text = " (at " + targetPath + ")"; } Debug.Log((object)(diagnostic.Message + text)); } } } public class Diagnostic { public readonly string Message; public readonly string Details; public readonly Object Target; public readonly Component Component; public readonly GameObject GameObject; public readonly Severity Severity; public string TargetPath; public Diagnostic(Severity severity, Object target, string message, string details = null) { GameObject gameObject = (GameObject)(object)((target is GameObject) ? target : null); Component val = (Component)(object)((target is Component) ? target : null); if ((Object)(object)val != (Object)null) { gameObject = val.gameObject; } Message = message; Details = details; Target = target; GameObject = gameObject; Severity = severity; Component = val; TargetPath = (((Object)(object)GameObject == (Object)null) ? null : Doctor.GetGameObjectPath(GameObject)); } } public enum Severity { Error, Warning } } namespace MapStation.Plugin { public class CrashDetector { [CompilerGenerated] private static class <>O { public static OnStageInitializedDelegate <0>__AfterLoadStage; } private const string PlayerPrefName = "MapStation.CrashDetector.IsLoadingStage"; public static bool ShouldAvoidReCrashing { get; private set; } public static void InitOnGameStart() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown ShouldAvoidReCrashing = PlayerPrefs.GetInt("MapStation.CrashDetector.IsLoadingStage") > 0; object obj = <>O.<0>__AfterLoadStage; if (obj == null) { OnStageInitializedDelegate val = AfterLoadStage; <>O.<0>__AfterLoadStage = val; obj = (object)val; } StageManager.OnStagePostInitialization += (OnStageInitializedDelegate)obj; } public static void BeforeLoadStage() { PlayerPrefs.SetInt("MapStation.CrashDetector.IsLoadingStage", 1); } public static void AfterLoadStage() { PlayerPrefs.SetInt("MapStation.CrashDetector.IsLoadingStage", 0); ShouldAvoidReCrashing = false; } } internal class KBMInputDisabler { private static bool KbmDisabled; private static KeyCode ToggleKey; public static void Init(bool kbmDisabled, KeyCode toggleKey, ref Plugin.UpdateDelegate updateEvent, ref Plugin.UpdateDelegate lateUpdateEvent) { //IL_0006: 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) KbmDisabled = kbmDisabled; ToggleKey = toggleKey; updateEvent = (Plugin.UpdateDelegate)Delegate.Combine(updateEvent, new Plugin.UpdateDelegate(Update)); lateUpdateEvent = (Plugin.UpdateDelegate)Delegate.Combine(lateUpdateEvent, new Plugin.UpdateDelegate(LateUpdate)); } private static void Update() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) if (Input.GetKeyDown(ToggleKey)) { KbmDisabled = !KbmDisabled; Apply(); } } private static void LateUpdate() { if (KbmDisabled) { Cursor.visible = true; Cursor.lockState = (CursorLockMode)0; } } private static Player TryGetRewiredPlayer() { Core instance = Core.Instance; if ((Object)(object)instance == (Object)null) { return null; } GameInput gameInput = instance.GameInput; if (gameInput == null) { return null; } RewiredMappingHandler rewiredMappingHandler = gameInput.rewiredMappingHandler; if (rewiredMappingHandler == null) { return null; } return rewiredMappingHandler.GetRewiredPlayer(0); } public static void Apply() { Player val = TryGetRewiredPlayer(); if (val != null) { if (KbmDisabled) { DisableKbm(val); } else { EnableKbm(val); } } } private static void DisableKbm(Player player) { ((Controller)player.controllers.Mouse).enabled = false; ((Controller)player.controllers.Keyboard).enabled = false; Cursor.visible = true; Cursor.lockState = (CursorLockMode)0; } private static void EnableKbm(Player player) { ((Controller)player.controllers.Mouse).enabled = true; ((Controller)player.controllers.Keyboard).enabled = true; Cursor.visible = false; Cursor.lockState = (CursorLockMode)1; } } public enum MapSource { Normal, TestMaps } public class MapDatabase { public static MapDatabase Instance; public Assets Assets; public Dictionary<Stage, PluginMapDatabaseEntry> maps = new Dictionary<Stage, PluginMapDatabaseEntry>(); private ManualLogSource logger; public MapDatabase(Assets assets) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown Assets = assets; logger = new ManualLogSource("MapStation Map Database"); } public void AddFromDirectory(string path, MapSource source = MapSource.Normal) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Expected O, but got Unknown //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Expected O, but got Unknown //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Expected I4, but got Unknown //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) string[] files = Directory.GetFiles(path, "*.brcmap", SearchOption.AllDirectories); foreach (string text in files) { string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(text); Stage val = StageEnum.HashMapName(fileNameWithoutExtension); if (maps.ContainsKey(val)) { logger.LogWarning((object)$"Won't add custom stage {fileNameWithoutExtension} to the database as there's already a stage with the same ID ({(int)val})"); continue; } logger.LogInfo((object)("Found map " + fileNameWithoutExtension + " at " + text)); MapProperties val2 = new MapProperties(); MapZip val3 = new MapZip(text); try { JsonUtility.FromJsonOverwrite(val3.GetPropertiesText(), (object)val2); val3.DoPluginOnAddMapToDatabase(fileNameWithoutExtension); } finally { ((IDisposable)val3)?.Dispose(); } PluginMapDatabaseEntry map = new PluginMapDatabaseEntry { Name = fileNameWithoutExtension, internalName = fileNameWithoutExtension, Properties = val2, ScenePath = AssetNames.GetScenePathForMap(fileNameWithoutExtension), zipPath = text, stageId = val, source = source }; Add(map); } } public void Add(PluginMapDatabaseEntry map) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Expected O, but got Unknown maps.Add(map.stageId, map); StageEnum.AddMapName(map.stageId, map.internalName); List<AssetBundleCollection> list = Assets.assetBundleLibrary.collections.ToList(); AssetBundleCollection val = ScriptableObject.CreateInstance<AssetBundleCollection>(); val.assetBundleCollectionName = ((object)(Stage)(ref map.stageId)).ToString(); val.assetBundleNames = new string[18] { "characters", "graffiti", "common_assets", "enemies", "enemy_animation", "character_animation", "in_game_assets", "mocap_animation_two", "mocap_animation", "finalboss_assets", "playeranimation", "finalboss_animation", "storyanimation", "minimap", "common_game_shaders", "city_assets", ((BaseMapDatabaseEntry)map).AssetsBundleName, ((BaseMapDatabaseEntry)map).SceneBundleName }; list.Add(val); Assets.assetBundleLibrary.collections = list.ToArray(); string[] array = new string[2] { ((BaseMapDatabaseEntry)map).AssetsBundleName, ((BaseMapDatabaseEntry)map).SceneBundleName }; foreach (string text in array) { Assets.availableBundles.Add(text, new Bundle(text) { name = text }); } ZipAssetBundles.Instance.Bundles.Add(((BaseMapDatabaseEntry)map).AssetsBundleName, new ZipAssetBundle { zipPath = map.zipPath, bundleType = ZipBundleType.ASSETS }); ZipAssetBundles.Instance.Bundles.Add(((BaseMapDatabaseEntry)map).SceneBundleName, new ZipAssetBundle { zipPath = map.zipPath, bundleType = ZipBundleType.SCENE }); SceneNameMapper.Instance.Names.Add(((object)(Stage)(ref map.stageId)).ToString(), "Scene." + map.internalName); SceneNameMapper.Instance.Paths.Add(((object)(Stage)(ref map.stageId)).ToString(), "Assets/Maps/" + map.internalName + "/Scene." + map.internalName + ".unity"); } } public class PluginMapDatabaseEntry : BaseMapDatabaseEntry { public Stage stageId; public string internalName; public string zipPath; public MapProperties Properties; public MapSource source; } internal class SceneNameMapper { public static SceneNameMapper Instance; public Dictionary<string, string> Names = new Dictionary<string, string>(); public Dictionary<string, string> Paths = new Dictionary<string, string>(); } public static class StageEnum { public const Stage FirstMapId = 15; public const string MapNamePrefix = "mapstation/"; public const int MapNamePrefixLength = 11; public const string MapNameUnknownInfix = "unknown/"; public const Stage FirstVanillaStage = -1; public static readonly Dictionary<string, Stage> MapIds; public static readonly Dictionary<Stage, string> MapNames; static StageEnum() { MapIds = new Dictionary<string, Stage>(); MapNames = new Dictionary<Stage, string>(); if ("mapstation/".Length != 11) { throw new Exception("StageEnumMapNamePrefixLength is wrong."); } } public static string GetMapName(Stage id) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) return MapNames[id]; } public static Stage GetMapId(string internalName) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) return MapIds[internalName]; } public static string RemovePrefixFromInternalName(string prefixedInternalName) { int num = prefixedInternalName.IndexOf("/"); if (num < 0) { return prefixedInternalName; } return prefixedInternalName.Substring(num + 1); } public static Stage HashMapName(string internalName) { uint num = BitConverter.ToUInt32(new SHA512Managed().ComputeHash(Encoding.UTF8.GetBytes(internalName)), 0); num &= 0xFFFFFFF0u; num >>= 4; return (Stage)(15 + num); } public static Stage AddMapName(string internalName) { //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) Stage val = HashMapName(internalName); AddMapName(val, internalName); return val; } public static void AddMapName(Stage id, string internalName) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) MapNames.Add(id, internalName); MapIds.Add(internalName, id); } public static void RemoveMapName(string internalName) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) MapNames.Remove(MapIds[internalName]); MapIds.Remove(internalName); } public static bool IsValidMapId(Stage id) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Invalid comparison between Unknown and I4 //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Invalid comparison between Unknown and I4 if ((int)id < 15) { return (int)id < -1; } return true; } public static bool IsKnownMapId(Stage id) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) return MapNames.ContainsKey(id); } } public class StageProgresses : CustomSaveData { public static StageProgresses Instance; public Dictionary<string, StageProgress> stageProgresses = new Dictionary<string, StageProgress>(); private const byte Version = 1; public StageProgresses() : base("MapStation.Plugin", "{0}.msp") { } public override void Write(BinaryWriter writer) { writer.Write((byte)1); writer.Write(stageProgresses.Count); foreach (KeyValuePair<string, StageProgress> stageProgress in stageProgresses) { StageProgress value = stageProgress.Value; string key = stageProgress.Key; writer.Write(key); value.Write(writer); value.WriteVersionTwo(writer); value.WriteVersionThree(writer); } } public override void Read(BinaryReader reader) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) reader.ReadByte(); int num = reader.ReadInt32(); for (int i = 0; i < num; i++) { string text = reader.ReadString(); string internalName = StageEnum.RemovePrefixFromInternalName(text); StageProgress val = new StageProgress(); val.Read(reader); val.ReadVersionTwo(reader); val.ReadVersionThree(reader); val.stageID = StageEnum.HashMapName(internalName); stageProgresses[text] = val; } } public override void Initialize() { stageProgresses.Clear(); } public StageProgress GetOrCreateForStage(Stage stageId) { //IL_0000: 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_002d: 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_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown if (StageEnum.IsValidMapId(stageId)) { string key = ((object)(Stage)(ref stageId)).ToString(); if (stageProgresses.TryGetValue(key, out var value)) { return value; } value = new StageProgress { version = 3, stageID = stageId, policeAllowed = true, mapFound = true, taxiFound = true }; stageProgresses.Add(key, value); return value; } return null; } } public class ZipAssetBundles { public static ZipAssetBundles Instance; public Dictionary<string, ZipAssetBundle> Bundles = new Dictionary<string, ZipAssetBundle>(); } public class ZipAssetBundle { public string zipPath; public ZipBundleType bundleType; } public enum ZipBundleType { ASSETS, SCENE } public static class MapOverrides { public static void OnStagePreInitialization(Stage newStage, Stage previousStage) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) OverrideQualitySettings(newStage, Core.Instance.BaseModule.user.VideoSettingsManager.cachedVideoSettings); } public static void OverrideQualitySettings(Stage stage, VideoSettings videoSettings) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) if (MapDatabase.Instance.maps.TryGetValue(stage, out var value) && value.Properties.overrideShadowDistance) { QualitySettings.shadowDistance = value.Properties.shadowDistance; } else { QualitySettings.shadowDistance = videoSettings.shadowDistance; } } } public class MapRepair { public static void OnStagePreInitialization(Stage newStage, Stage previousStage) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) if (StageEnum.IsKnownMapId(newStage)) { Repair(); } } public static void Repair() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Object.FindObjectOfType<PlayerSpawner>() == (Object)null) { new GameObject().AddComponent<PlayerSpawner>().isDefaultSpawnPoint = true; } CharacterSelectSpot[] array = Object.FindObjectsOfType<CharacterSelectSpot>(); foreach (CharacterSelectSpot val in array) { if ((Object)(object)((Component)val).GetComponentInChildren<NPC>(true) == (Object)null) { GameObject val2 = new GameObject("DummyNPC"); val2.transform.parent = ((Component)val).transform; val2.SetActive(false); val2.AddComponent<NPC>(); } } GameObject val3 = new GameObject("DummyNPC"); val3.SetActive(false); val3.AddComponent<NPC>(); } } public class MapStationConfig { public ConfigEntry<string> QuickLaunch; public ConfigEntry<bool> QuickReload; public ConfigEntry<bool> DisableKBMInput; public ConfigEntry<bool> DebugUI; public ConfigEntry<bool> ShowDebugShapes; public ConfigEntry<KeyCode> QuickReloadKey; public ConfigEntry<KeyCode> DisableKBMInputKey; public static MapStationConfig Instance { get; private set; } public string QuickLaunchValue => QuickLaunch.Value; public bool QuickReloadValue => QuickReload.Value; public bool DisableKBMInputValue => DisableKBMInput.Value; public bool DebugUIValue => DebugUI.Value; public bool ShowDebugShapesValue => ShowDebugShapes.Value; public KeyCode QuickReloadKeyValue => QuickReloadKey.Value; public KeyCode DisableKBMInputKeyValue => DisableKBMInputKey.Value; public MapStationConfig() { Instance = this; } public MapStationConfig(ConfigFile file) : this() { string text = "Mapping"; QuickLaunch = file.Bind<string>(text, "QuickLaunch", "", "Skip game intros and menu and launch directly into this map."); string text2 = "Enable to reload *any* map with a hotkey (F5 by default), including vanilla and downloaded maps. By default, only locally-built maps can be reloaded."; string text3 = "Reloads the map."; QuickReload = file.Bind<bool>(text, "QuickReload", false, text2); string text4 = "Disable keyboard and mouse input, making it easier to use MapStation's DebugUI, Unity Explorer, or tab between windows. When this is enabled, you MUST use a game controller. Note: there is also a hotkey for this."; string text5 = "Enables/disables keyboard and mouse input."; DisableKBMInput = file.Bind<bool>(text, "DisableKBMInput", false, text4); DebugUI = file.Bind<bool>(text, "DebugUI", false, "Show Debug UI in the corner for *all* maps. By default this is enabled only for locally-built maps."); ShowDebugShapes = file.Bind<bool>(text, "ShowDebugShapes", false, "Show debug meshes along grind lines, spawners, teleporters, etc."); string text6 = "Input"; QuickReloadKey = file.Bind<KeyCode>(text6, "QuickReloadKey", (KeyCode)286, text3); DisableKBMInputKey = file.Bind<KeyCode>(text6, "DisableKBMInputKey", (KeyCode)287, text5); } } public static class MiniMapManager { public static bool TryCreateMapForCustomStage(BaseMapDatabaseEntry mapEntry, out Map map) { //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) GameObject val = Core.Instance.Assets.LoadAssetFromBundle<GameObject>(mapEntry.AssetsBundleName, "MiniMap.prefab"); if ((Object)(object)val == (Object)null) { map = null; return false; } MiniMapProperties val2 = val.GetComponent<MiniMapProperties>(); if ((Object)(object)val2 == (Object)null) { val2 = val.AddComponent<MiniMapProperties>(); } Map val3 = ScriptableObject.CreateInstance<Map>(); val3.m_MapObject = val; val3.m_ScaleFactor = 1f; val3.m_PositionOffset = Vector3.zero; val3.m_EulerOffset = Vector3.zero; val3.mapMaterial = Mapcontroller.Instance.pyramidMap.mapMaterial; map = val3; ProcessCustomMiniMapPrefab(map, val2); if ((Object)(object)val2.MapMaterial != (Object)null) { val3.mapMaterial = val2.MapMaterial; } val3.mapMaterial.SetFloat("_AnchorOffset", -5000f); val3.mapMaterial.SetFloat("_AnchorScale", 0.035f); return true; } private static void ProcessCustomMiniMapPrefab(Map map, MiniMapProperties properties) { Renderer[] componentsInChildren = map.m_MapObject.GetComponentsInChildren<Renderer>(); for (int i = 0; i < componentsInChildren.Length; i++) { ((Component)componentsInChildren[i]).gameObject.layer = 27; } } } [BepInPlugin("MapStation.Plugin", "MapStation.Plugin", "0.17.1")] public class Plugin : BaseUnityPlugin { public delegate void UpdateDelegate(); [CompilerGenerated] private static class <>O { public static StageInitializationDelegate <0>__OnStagePreInitialization; public static StageInitializationDelegate <1>__OnStagePreInitialization; public static UpdateDelegate <2>__QuickReloadUpdate; } public static Plugin Instance; internal string MapStationMapsAbsoluteDirectory; internal string TestMapsAbsoluteDirectory; internal string UserMapsAbsoluteDirectory; private static Type ForceLoadMapStationCommonAssembly = typeof(AssemblyDependencies); private static Type ForceLoadMapStationPluginAssembly = typeof(AssemblyDependencies); private static Type ForceLoadMapStationTypeForwarderAssembly = typeof(AssemblyDependencies); public static UpdateDelegate UpdateEvent; public static UpdateDelegate LateUpdateEvent; public Plugin() { Log.Logger = ((BaseUnityPlugin)this).Logger; } private void Awake() { Instance = this; try { Initialize(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin MapStation.Plugin 0.17.1 is loaded!"); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogError((object)string.Format("Plugin {0} {1} failed to load!{2}{3}", "MapStation.Plugin", "0.17.1", Environment.NewLine, ex)); } } private void Initialize() { //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Expected O, but got Unknown //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Expected O, but got Unknown //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Expected O, but got Unknown //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Expected O, but got Unknown //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Expected O, but got Unknown //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Expected O, but got Unknown new MapStationConfig(((BaseUnityPlugin)this).Config); SceneNameMapper.Instance = new SceneNameMapper(); ZipAssetBundles.Instance = new ZipAssetBundles(); StageProgresses.Instance = new StageProgresses(); DebugUI.Create(MapStationConfig.Instance.DebugUI.Value); DebugUI.Instance.RegisterMenu((DebugMenu)(object)new BackToHideoutDebugUI()); DebugUI.Instance.RegisterMenu((DebugMenu)(object)new DoctorDebugUI()); DebugUI.Instance.RegisterMenu((DebugMenu)(object)new HiddenShapesDebugUI()); MapStationMapsAbsoluteDirectory = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location); TestMapsAbsoluteDirectory = Path.Combine(Paths.ConfigPath, "MapStation", "TestMaps"); UserMapsAbsoluteDirectory = Paths.PluginPath; ThreadedLogFix.Install(); Sprite val = TextureUtility.LoadSprite(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "MapStation-AppIcon.png")); PhoneAPI.RegisterApp<AppMapStation>("mapstation", val); new Harmony("MapStation.Plugin").PatchAll(); PathDetection.SetBepInExProfileInRegistry(Paths.BepInExRootPath); PathDetection.SetBRCPathInRegistry(Path.GetDirectoryName(Application.dataPath)); StageInitializationDelegate onStagePreInitialization = StageAPI.OnStagePreInitialization; object obj = <>O.<0>__OnStagePreInitialization; if (obj == null) { StageInitializationDelegate val2 = MapRepair.OnStagePreInitialization; <>O.<0>__OnStagePreInitialization = val2; obj = (object)val2; } StageAPI.OnStagePreInitialization = (StageInitializationDelegate)Delegate.Combine((Delegate?)(object)onStagePreInitialization, (Delegate?)obj); StageInitializationDelegate onStagePreInitialization2 = StageAPI.OnStagePreInitialization; object obj2 = <>O.<1>__OnStagePreInitialization; if (obj2 == null) { StageInitializationDelegate val3 = MapOverrides.OnStagePreInitialization; <>O.<1>__OnStagePreInitialization = val3; obj2 = (object)val3; } StageAPI.OnStagePreInitialization = (StageInitializationDelegate)Delegate.Combine((Delegate?)(object)onStagePreInitialization2, (Delegate?)obj2); StageAPI.OnStagePreInitialization = (StageInitializationDelegate)Delegate.Combine((Delegate?)(object)StageAPI.OnStagePreInitialization, (Delegate?)new StageInitializationDelegate(EnableDebugFeaturesOnStageInit)); KBMInputDisabler.Init(MapStationConfig.Instance.DisableKBMInputValue, MapStationConfig.Instance.DisableKBMInputKeyValue, ref UpdateEvent, ref LateUpdateEvent); CrashDetector.InitOnGameStart(); HiddenShapes.Visible = MapStationConfig.Instance.ShowDebugShapesValue; } public void InitializeMapDatabase(Assets assets) { MapDatabase.Instance = new MapDatabase(assets); if (!Directory.Exists(TestMapsAbsoluteDirectory)) { Directory.CreateDirectory(TestMapsAbsoluteDirectory); } MapDatabase.Instance.AddFromDirectory(MapStationMapsAbsoluteDirectory); MapDatabase.Instance.AddFromDirectory(TestMapsAbsoluteDirectory, MapSource.TestMaps); MapDatabase.Instance.AddFromDirectory(UserMapsAbsoluteDirectory); APIManager.Initialize((IMapStationAPI)(object)new MapStationAPI(MapDatabase.Instance)); } private void Update() { UpdateEvent?.Invoke(); } private void LateUpdate() { LateUpdateEvent?.Invoke(); } private static IEnumerator BackToHideout() { yield return null; Core.Instance.BaseModule.SwitchStage((Stage)5); } public static bool CanSwitchStagesWithoutCrashing() { if ((Object)(object)Core.Instance != (Object)null && Core.Instance.BaseModule.IsPlayingInStage && !Core.Instance.BaseModule.IsLoading) { return !Core.Instance.BaseModule.IsInGamePaused; } return false; } private static void QuickReloadUpdate() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) if (CanSwitchStagesWithoutCrashing() && Input.GetKeyDown(MapStationConfig.Instance.QuickReloadKeyValue)) { GamePluginManager.OnReload(); Core.Instance.BaseModule.StageManager.ExitCurrentStage(Core.Instance.SaveManager.CurrentSaveSlot.currentStageProgress.stageID, (Stage)(-1)); } } private void EnableDebugFeaturesOnStageInit(Stage newStage, Stage previousStage) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) PluginMapDatabaseEntry value; bool flag = MapDatabase.Instance.maps.TryGetValue(newStage, out value) && value.source == MapSource.TestMaps; DebugUI.Instance.UiEnabled = MapStationConfig.Instance.DebugUIValue || flag; UpdateEvent = (UpdateDelegate)Delegate.Remove(UpdateEvent, new UpdateDelegate(QuickReloadUpdate)); if (MapStationConfig.Instance.QuickReloadValue || flag) { UpdateEvent = (UpdateDelegate)Delegate.Combine(UpdateEvent, new UpdateDelegate(QuickReloadUpdate)); } } } internal class ThreadedLogFix { private delegate void UnityLogSource_OnUnityLogMessageReceived(string message, string stackTrace, LogType type); [CompilerGenerated] private static class <>O { public static LogCallback <0>__onLogMessageReceivedThreaded; } private static int MainThreadId; private static UnityLogSource_OnUnityLogMessageReceived UnityLogSource_OnUnityLogMessageReceived_Handler; public static void Install() { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Expected O, but got Unknown MainThreadId = Thread.CurrentThread.ManagedThreadId; UnityLogSource_OnUnityLogMessageReceived_Handler = (UnityLogSource_OnUnityLogMessageReceived)typeof(UnityLogSource).GetMethod("OnUnityLogMessageReceived", BindingFlags.Static | BindingFlags.NonPublic).CreateDelegate(typeof(UnityLogSource_OnUnityLogMessageReceived)); object obj = <>O.<0>__onLogMessageReceivedThreaded; if (obj == null) { LogCallback val = onLogMessageReceivedThreaded; <>O.<0>__onLogMessageReceivedThreaded = val; obj = (object)val; } Application.logMessageReceivedThreaded += (LogCallback)obj; } private static void onLogMessageReceivedThreaded(string condition, string stackTrace, LogType type) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) if (Thread.CurrentThread.ManagedThreadId != MainThreadId) { UnityLogSource_OnUnityLogMessageReceived_Handler(condition, stackTrace, type); } } } public static class PluginInfo { public const string PLUGIN_GUID = "MapStation.Plugin"; public const string PLUGIN_NAME = "MapStation.Plugin"; public const string PLUGIN_VERSION = "0.17.1"; } } namespace MapStation.Plugin.Tools { internal class BackToHideoutDebugUI : DebugMenu { public override string Name => "Hideout Escape"; public override void OnGUI() { if (Plugin.CanSwitchStagesWithoutCrashing()) { GUILayout.Label("This button takes you back to the hideout, if you get trapped in a custom map.", Array.Empty<GUILayoutOption>()); if (GUILayout.Button("Go to Hideout", Array.Empty<GUILayoutOption>())) { Core.Instance.BaseModule.SwitchStage((Stage)5); } } } } public class DoctorDebugUI : DebugMenu { private int widthIndex; private int[] widths = new int[3] { 400, 700, 1000 }; private Analysis analysis; private bool[] showDiag; private bool[] showGo; private Vector2 scrollPosition = Vector2.zero; private bool HasUnityExplorer; private Assembly unityExplorerAssembly; private Type unityExplorerInspectorManagerType; private Type unityExplorerUIManagerType; private Type unityExplorerCacheObjectBase; public override string Name => "Map Doctor"; public override int? Width => widths[widthIndex]; public DoctorDebugUI() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: 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_003e: Expected O, but got Unknown //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown StageAPI.OnStagePreInitialization = (StageInitializationDelegate)Delegate.Combine((Delegate?)(object)StageAPI.OnStagePreInitialization, (Delegate?)new StageInitializationDelegate(OnStagePreInitialization)); HasUnityExplorer = false; unityExplorerAssembly = AppDomain.CurrentDomain.GetAssemblies().SingleOrDefault((Assembly assembly) => assembly.GetName().Name == "UnityExplorer.BIE5.Mono"); if (unityExplorerAssembly != null) { unityExplorerInspectorManagerType = unityExplorerAssembly.GetExportedTypes().SingleOrDefault((Type type) => type.FullName == "UnityExplorer.InspectorManager"); unityExplorerUIManagerType = unityExplorerAssembly.GetExportedTypes().SingleOrDefault((Type type) => type.FullName == "UnityExplorer.UI.UIManager"); unityExplorerCacheObjectBase = unityExplorerAssembly.GetExportedTypes().SingleOrDefault((Type t) => t.Name == "CacheObjectBase"); HasUnityExplorer = unityExplorerInspectorManagerType != null; } } public override void OnGUI() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown //IL_002f: 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_003c: Expected O, but got Unknown //IL_0098: Unknown result type (might be due to invalid IL or missing references) GUIStyle wrappedLabel = new GUIStyle(GUI.skin.label) { wordWrap = true }; GUIStyle val = new GUIStyle(GUI.skin.label) { fontStyle = (FontStyle)1 }; GUILayout.Label("The Doctor will analyze your map and list any problems, offering suggestions to fix them.", Array.Empty<GUILayoutOption>()); if (GUILayout.Button("Expand", Array.Empty<GUILayoutOption>())) { widthIndex = (widthIndex + 1) % widths.Length; } if (GUILayout.Button("Analyze", Array.Empty<GUILayoutOption>()) && MapDatabase.Instance.maps.TryGetValue(Core.Instance.BaseModule.CurrentStage, out var value)) { analysis = Doctor.Analyze(value.Properties); showDiag = new bool[analysis.diagnostics.Count]; showGo = new bool[analysis.gameObjects.Count + 1]; } if (analysis == null) { return; } GUILayout.Label($"Analysis found {analysis.diagnostics.Count} problems.", val, Array.Empty<GUILayoutOption>()); using (GUIUtil.ScrollView(ref scrollPosition)) { int di = -1; int num = 0; if (analysis.diagnosticsWithoutTarget.Count > 0) { GUILayout.Label("Misc", Array.Empty<GUILayoutOption>()); using (GUIUtil.Indent(2, true)) { foreach (Diagnostic item in analysis.diagnosticsWithoutTarget) { DrawDiagnostic(item); } } } foreach (KeyValuePair<GameObject, List<Diagnostic>> gameObject in analysis.gameObjects) { num++; GameObject key = gameObject.Key; List<Diagnostic> value2 = gameObject.Value; showGo[num] = GUILayout.Toggle(showGo[num], $"{expandCollapseIcon(showGo[num])} GameObject: {value2[0].TargetPath}", GUI.skin.label, Array.Empty<GUILayoutOption>()); if (!showGo[num]) { continue; } using (GUIUtil.Indent(1, true)) { if (HasUnityExplorer && GUILayout.Button("UnityExplorer", Array.Empty<GUILayoutOption>())) { OpenInUnityExplorer((Object)(object)key); } foreach (Diagnostic item2 in value2) { DrawDiagnostic(item2); } } } void DrawDiagnostic(Diagnostic diagnostic) { di++; showDiag[di] = GUILayout.Toggle(showDiag[di], $"{expandCollapseIcon(showDiag[di])} {diagnostic.Message}", wrappedLabel, Array.Empty<GUILayoutOption>()); if (showDiag[di]) { using (GUIUtil.Indent(1, true)) { GUILayout.Label((diagnostic.Details == null) ? "<no details>" : diagnostic.Details, Array.Empty<GUILayoutOption>()); } } } } } private char expandCollapseIcon(bool expanded) { if (!expanded) { return '▶'; } return '▼'; } private void OpenInUnityExplorer(Object obj) { MethodInfo? method = unityExplorerInspectorManagerType.GetMethod("Inspect", new Type[2] { typeof(object), unityExplorerCacheObjectBase }); object[] parameters = (object[])(object)new Object[2] { obj, default(Object) }; method.Invoke(null, parameters); unityExplorerUIManagerType.GetMethod("set_ShowMenu").Invoke(null, new object[1] { true }); } private void OnStagePreInitialization(Stage newStage, Stage previousStage) { analysis = null; } } public static class HiddenShapes { private static readonly int[] DebugLayers = new int[2] { 12, 19 }; private static bool visible; private static GameplayCamera camera; public static bool Visible { get { return visible; } set { visible = value; Apply(); } } public static GameplayCamera Camera { get { return camera; } set { camera = value; Apply(); } } private static void Apply() { if ((Object)(object)camera == (Object)null) { return; } int[] debugLayers = DebugLayers; foreach (int num in debugLayers) { if (visible) { Camera cam = camera.cam; cam.cullingMask |= 1 << num; } else { Camera cam2 = camera.cam; cam2.cullingMask &= ~(1 << num); } } } } internal class HiddenShapesDebugUI : DebugMenu { public override string Name => "Show/Hide Hidden Shapes"; public override void OnGUI() { GUILayout.Label("Toggle visibility of hidden shapes: spawn points, grind lines, etc.", Array.Empty<GUILayoutOption>()); if (GUILayout.Button(HiddenShapes.Visible ? "Hide" : "Show", Array.Empty<GUILayoutOption>())) { HiddenShapes.Visible = !HiddenShapes.Visible; } } } [ProtoContract] [ProtoInclude(1, typeof(PlayAnimation))] internal class BasePacket { } [ProtoContract] internal class PlayAnimation : BasePacket { [ProtoMember(1)] public string directorId; [ProtoMember(2)] public Vector3 position; } internal class SlopCrewClientUI : DebugMenu { private Client<BasePacket> client; public override string Name => "SlopCrewClient"; public SlopCrewClientUI() { client = new Client<BasePacket>("MapStation.Common"); client.Enable(); client.OnPacketReceived += delegate(uint player, BasePacket packet, bool isLocal) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) Debug.Log((object)$"{player} sent us: {packet}"); if (packet is PlayAnimation playAnimation) { Debug.Log((object)playAnimation.directorId); Debug.Log((object)playAnimation.position); } }; } public override void OnGUI() { //IL_02a8: Unknown result type (might be due to invalid IL or missing references) //IL_02ad: Unknown result type (might be due to invalid IL or missing references) GUILayout.Label($"IsSlopCrewInstalled {APIManager.IsSlopCrewInstalled}", Array.Empty<GUILayoutOption>()); GUILayout.Label($"API available? {client.ApiAvailable}", Array.Empty<GUILayoutOption>()); if (client.ApiAvailable) { GUILayout.Label($"Connected {client.SlopCrewAPI.Connected}", Array.Empty<GUILayoutOption>()); GUILayout.Label($"TickRate {client.SlopCrewAPI.TickRate}", Array.Empty<GUILayoutOption>()); GUILayout.Label("ServerAddress " + client.SlopCrewAPI.ServerAddress, Array.Empty<GUILayoutOption>()); GUILayout.Label($"Latency {client.SlopCrewAPI.Latency}", Array.Empty<GUILayoutOption>()); GUILayout.Label($"PlayerCount {client.SlopCrewAPI.PlayerCount}", Array.Empty<GUILayoutOption>()); foreach (uint player in client.SlopCrewAPI.Players) { GUILayout.Label($"Player#{player}: {client.SlopCrewAPI.GetPlayerName(player)}", Array.Empty<GUILayoutOption>()); } } GUILayout.Label($"CurrentTick {client.CurrentTick}", Array.Empty<GUILayoutOption>()); GUILayout.Label($"CurrentTickSmoothed {client.CurrentTickSmoothed}", Array.Empty<GUILayoutOption>()); GUILayout.Label($"TickDuration {client.TickDuration}", Array.Empty<GUILayoutOption>()); bool flag = client.CurrentTickSmoothed > client.CurrentTick; bool flag2 = client.CurrentTickSmoothed < client.CurrentTick; ulong num = (flag ? (client.CurrentTickSmoothed - client.CurrentTick) : (client.CurrentTick - client.CurrentTickSmoothed)); GUILayout.Label(string.Format("Tick difference {0} {1}", num, flag ? "Local is ahead" : (flag2 ? "Server is ahead" : "")), Array.Empty<GUILayoutOption>()); if (GUILayout.Button("Send Packet", Array.Empty<GUILayoutOption>())) { client.Send((BasePacket)new PlayAnimation { directorId = "foobar", position = Vector3.down }, true); } } } } namespace MapStation.Plugin.Phone { public class AppMapStation : CustomApp { public override void OnAppInit() { ((CustomApp)this).OnAppInit(); ((CustomApp)this).CreateIconlessTitleBar("MapStation", 70f); base.ScrollView = PhoneScrollView.Create((CustomApp)(object)this, 275f, 1600f); } public override void OnAppEnable() { //IL_00c0: Unknown result type (might be due to invalid IL or missing references) ((App)this).OnAppEnable(); base.ScrollView.RemoveAllButtons(); base.ScrollView.ResetScroll(); base.ScrollView.CancelAnimation(); IEnumerable<PluginMapDatabaseEntry> enumerable = from map in MapDatabase.Instance.maps.Values orderby map.source descending, map.Properties.displayName where map.Properties.showInFastTravelMenus select map; addButton((Stage)5, "Hideout"); foreach (PluginMapDatabaseEntry item in enumerable) { addButton(item.stageId, item.Properties.displayName, item.source == MapSource.TestMaps); } void addButton(Stage stageId, string displayName, bool localBuild = false) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: 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) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) SimplePhoneButton val = PhoneUIUtility.CreateSimpleButton(displayName); if (localBuild) { GameObject obj = Object.Instantiate<GameObject>(((Component)((TMP_Text)val.Label).transform).gameObject, val.AnimationParent); ((TMP_Text)obj.GetComponent<TextMeshProUGUI>()).text = "L"; RectTransform obj2 = GameObjectExtensions.RectTransform(obj); ((Transform)obj2).localPosition = ((Transform)obj2).localPosition + (Vector3.up * 65f + Vector3.left * 65f); } ((PhoneButton)val).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val).OnConfirm, (Action)delegate { //IL_0010: Unknown result type (might be due to invalid IL or missing references) Core.Instance.BaseModule.StageManager.ExitCurrentStage(stageId, (Stage)(-1)); }); base.ScrollView.AddButton((PhoneButton)(object)val); } } } } namespace MapStation.Plugin.Patches { [HarmonyPatch(typeof(AirDashAbility))] internal static class AirDashAbilityPatch { [HarmonyPrefix] [HarmonyPatch("OnStartAbility")] private static void OnStartAbility_Prefix(AirDashAbility __instance) { MapStationPlayer mapStationPlayer = MapStationPlayer.Get(((Ability)__instance).p); if (mapStationPlayer.OnVertAir) { mapStationPlayer.AirVertEnd(); } } } [HarmonyPatch(typeof(AirTrickAbility))] internal static class AirTrickAbilityPatch { [HarmonyPrefix] [HarmonyPatch("SetupBoostTrick")] private static bool SetupBoostTrick_Prefix(AirTrickAbility __instance) { //IL_0049: Unknown result type (might be due to invalid IL or missing references) Player p = ((Ability)__instance).p; if (MapStationPlayer.Get(p).OnVertAir) { p.PlayAnim(__instance.airBoostTrickHashes[__instance.curTrick], true, false, 0f); p.PlayVoice((AudioClipID)498, (VoicePriority)2, true); p.ringParticles.Emit(1); __instance.trickType = (TrickType)2; __instance.duration *= 1.5f; p.AddBoostCharge(0f - p.boostTrickCost); return false; } return true; } } [HarmonyPatch(typeof(AProgressable))] internal static class AProgressablePatch { [HarmonyPrefix] [HarmonyPatch("InitProgressable")] private static bool InitProgressable_Prefix(AProgressable __instance, StageProgress stageProgress) { //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) __instance.hasSaveData = stageProgress.HasProgressableData(__instance.uid); if (__instance.hasSaveData) { __instance.progressableData = stageProgress.GetProgressableData(__instance.uid); try { __instance.ReadFromData(); } catch (InvalidCastException) { string uid = __instance.uid; Type type = ((object)__instance).GetType(); Stage stageID = stageProgress.stageID; Debug.LogWarning((object)$"Invalid data for progressable with UID {uid}, type {type} in Stage {((object)(Stage)(ref stageID)).ToString()}. Setting default data."); __instance.SetDefaultData(stageProgress); return false; } return false; } __instance.SetDefaultData(stageProgress); return false; } } [HarmonyPatch(typeof(ASceneSetupInstruction))] public class ASceneSetupInstructionPatch { [HarmonyPrefix] [HarmonyPatch("SetSceneActive")] protected static void SetSceneActive_Prefix(ref string sceneToSetActive) { if (SceneNameMapper.Instance.Names.TryGetValue(sceneToSetActive, out var value)) { Log.Info("ASceneSetupInstruction.SetSceneActive redirected from " + sceneToSetActive + " to " + value); sceneToSetActive = value; } } } [HarmonyPatch(typeof(Assets))] internal static class AssetsPatch { [HarmonyPostfix] [HarmonyPatch("Init")] private static void Init_Postfix(Assets __instance) { Plugin.Instance.InitializeMapDatabase(__instance); } [HarmonyPostfix] [HarmonyPatch("GetAssetsToLoadDataForScene")] private static void GetAssetsToLoadDataForScene_Postfix(Assets __instance, string sceneName, ref AssetsToLoadData __result) { if ((Object)(object)__result == (Object)null) { Log.Info("Assets.GetAssetsToLoadDataForScene does not know about scene " + sceneName + "; assuming it's a custom map, creating default struct instead."); __result = ScriptableObject.CreateInstance<AssetsToLoadData>(); __result.loadCharacters = true; __result.loadGameplayPrefabs = true; __result.loadGraffiti = true; __result.sfxCollectionsToLoad = (SfxCollection[])(object)new SfxCollection[0]; } } [HarmonyPrefix] [HarmonyPatch("UnloadAssetBundleByName")] private static bool UnloadAssetBundleByName_Prefix(string assetBundleName) { if (StagePrefabHijacker.Loaded && StagePrefabHijacker.ProtectedAssetBundles.Contains(assetBundleName)) { return false; } return true; } [HarmonyPrefix] [HarmonyPatch("LoadBundleASync")] private static bool LoadBundleASync_Prefix(ref IEnumerator __result, Assets __instance, Bundle bundleToLoad) { if (ZipAssetBundles.Instance.Bundles.TryGetValue(bundleToLoad.name, out var value)) { __result = LoadMapBundleASync(__instance, bundleToLoad, value); return false; } if (bundleToLoad.IsLoaded) { return false; } return true; } private static IEnumerator LoadMapBundleASync(Assets __instance, Bundle bundleToLoad, ZipAssetBundle zipAssetBundle) { bundleToLoad.InitializeLoad(); Log.Info("Assets.LoadBundleASync loading " + bundleToLoad.Name + " from zip " + zipAssetBundle.zipPath); MapZip val = new MapZip(zipAssetBundle.zipPath); byte[] array; try { Stream stream = zipAssetBundle.bundleType switch { ZipBundleType.SCENE => val.GetSceneBundleStream(), ZipBundleType.ASSETS => val.GetAssetsBundleStream(), _ => throw new Exception("Unexpected ZipBundleType " + zipAssetBundle.bundleType), }; using (stream) { using MemoryStream memoryStream = new MemoryStream(); stream.CopyTo(memoryStream); array = memoryStream.ToArray(); } } finally { ((IDisposable)val)?.Dispose(); } __instance.currentAssetBundleCreateRequest = AssetBundle.LoadFromMemoryAsync(array); yield return __instance.currentAssetBundleCreateRequest; if ((Object)(object)__instance.currentAssetBundleCreateRequest.assetBundle == (Object)null) { bundleToLoad.ResetLoadState(); } else { bundleToLoad.SetAssetBundle(__instance.currentAssetBundleCreateRequest.assetBundle); } } } [HarmonyPatch(typeof(BaseModule))] internal static class BaseModulePatch { [HarmonyPrefix] [HarmonyPatch("SetupNewStage")] private static bool SetupNewStage_Prefix(Stage newStage) { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) if (!StagePrefabHijacker.Loaded && StagePrefabHijacker.Active) { StagePrefabHijacker.RunOnHijackStage(); StagePrefabHijacker.Log("Hideout resources loaded - switching to intended stage now."); StagePrefabHijacker.Loaded = true; StagePrefabHijacker.Active = false; Core.Instance.BaseModule.SwitchStage(StagePrefabHijacker.ActualTargetStage); return false; } if (StagePrefabHijacker.Loaded && MapDatabase.Instance.maps.ContainsKey(newStage)) { StagePrefabHijacker.RunOnCustomStage(); } StagePrefabHijacker.Loaded = false; return true; } } [HarmonyPatch(typeof(BoostAbility))] internal static class BoostAbilityPatch { [HarmonyPrefix] [HarmonyPatch("CheckActivation")] private static bool CheckActivation_Prefix(BoostAbility __instance, ref bool __result) { MapStationPlayer mapStationPlayer = MapStationPlayer.Get(((Ability)__instance).p); if (mapStationPlayer.VertBoostCooldown > 0f && mapStationPlayer.OnVertAir) { __result = false; return false; } return true; } [HarmonyPrefix] [HarmonyPatch("SetState")] private static void SetState_Prefix(BoostAbility __instance, State setState) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Invalid comparison between Unknown and I4 MapStationPlayer mapStationPlayer = MapStationPlayer.Get(((Ability)__instance).p); if (mapStationPlayer.OnVertAir && (int)setState == 1) { mapStationPlayer.AirVertEnd(); } } } [HarmonyPatch(typeof(Bootstrap))] internal static class BootstrapPatch { [HarmonyPrefix] [HarmonyPatch("LaunchGame")] private static bool LaunchGame_Prefix(Bootstrap __instance) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) if (MapStationConfig.Instance.QuickLaunchValue != "") { ((MonoBehaviour)__instance).StartCoroutine(__instance.SetupGameToStage(StageEnum.GetMapId(MapStationConfig.Instance.QuickLaunchValue))); return false; } return true; } } [HarmonyPatch(typeof(CharacterVisual))] internal static class CharacterVisualPatch { [HarmonyPostfix] [HarmonyPatch("InitVFX")] private static void InitVFX_Postfix(CharacterVisual __instance) { if (__instance.VFX != null) { Assets assets = Core.Instance.Assets; Texture2D mainTexture = assets.LoadAssetFromBundle<Texture2D>("common_assets", "spraycanTex"); if ((Object)(object)__instance.VFX.spraycan != (Object)null) { __instance.VFX.spraycan.GetComponent<Renderer>().sharedMaterial.mainTexture = (Texture)(object)mainTexture; } Texture2D mainTexture2 = assets.LoadAssetFromBundle<Texture2D>("common_assets", "flipPhoneTex"); if ((Object)(object)__instance.VFX.phone != (Object)null) { __instance.VFX.phone.GetComponent<Renderer>().sharedMaterial.mainTexture = (Texture)(object)mainTexture2; } } } } [HarmonyPatch(typeof(GameplayCamera))] internal static class GameplayCameraPatch { [HarmonyPostfix] [HarmonyPatch("Awake")] private static void Awake_Postfix(GameplayCamera __instance) { HiddenShapes.Camera = __instance; } [HarmonyPostfix] [HarmonyPatch("UpdateCamera")] private static void UpdateCamera_Postfix(GameplayCamera __instance) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)__instance.player) && ((Behaviour)__instance).isActiveAndEnabled && (!(__instance.hitpause > 0f) || !(__instance.player.GetVelocity() == Vector3.zero))) { MapStationPlayer mapStationPlayer = MapStationPlayer.Get(__instance.player); if (__instance.cameraMode == __instance.cameraModeDrag && mapStationPlayer.OnVertAir) { __instance.SetCameraMode(mapStationPlayer.VertCameraMode, false); } } } [HarmonyPrefix] [HarmonyPatch("SetCameraMode")] [HarmonyPatch(new Type[] { typeof(CameraMode), typeof(bool) })] private static bool SetCameraMode_Prefix(GameplayCamera __instance, ref CameraMode mode) { MapStationPlayer mapStationPlayer = MapStationPlayer.Get(__instance.player); if (!(mode is CameraModeDrag)) { return true; } if (mapStationPlayer.OnVertAir) { mode = mapStationPlayer.VertCameraMode; if (__instance.cameraMode == mapStationPlayer.VertCameraMode) { return false; } } return true; } } [HarmonyPatch(typeof(GrindAbility))] internal static class GrindAbilityPatch { [HarmonyPrefix] [HarmonyPatch("SetToLine")] private static void SetToLine_Prefix(GrindAbility __instance) { Player p = ((Ability)__instance).p; MapStationPlayer mapStationPlayer = MapStationPlayer.Get(p); if (mapStationPlayer.OnVertGround || mapStationPlayer.OnVertAir || mapStationPlayer.HasVertBelow) { p.OrientVisualInstantReset(); } } [HarmonyPrefix] [HarmonyPatch("JumpOut")] private static void JumpOut_Prefix(GrindAbility __instance) { if ((Object)(object)((Component)__instance.lastPath).GetComponent<GrindPath_FixComboBreakingProperty>() != (Object)null) { MapStationPlayer.Get(((Ability)__instance).p).GroundCooldown = 0.1f; } } } [HarmonyPatch(typeof(GroundDetection))] internal static class GroundDetectionPatch { private static void ComputeVert(GroundDetection __instance) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: 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_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0061: 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) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0106: 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_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Unknown result type (might be due to invalid IL or missing references) //IL_0232: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_0245: Unknown result type (might be due to invalid IL or missing references) Player player = ((BaseGroundDetection)__instance).player; MapStationPlayer mapStationPlayer = MapStationPlayer.Get(player); mapStationPlayer.HasVertBelow = false; float num = 500f; RaycastInfo raycastInfo = __instance.GetRaycastInfo(((Component)player).transform.position + Vector3.up * 1f, Vector3.down, num, 1f); if (!raycastInfo.hit) { return; } float num2 = Vector3.Angle(Vector3.up, ((RaycastHit)(ref raycastInfo.hitInfo)).normal); if ((Object)(object)((Component)((RaycastHit)(ref raycastInfo.hitInfo)).collider).GetComponent<MapStationVert>() == (Object)null) { return; } if (num2 >= 45f) { mapStationPlayer.HasVertBelow = true; if (!mapStationPlayer.OnVertGround) { mapStationPlayer.GroundVertVector = -((RaycastHit)(ref raycastInfo.hitInfo)).normal; } } if (!mapStationPlayer.OnVertAir) { return; } RaycastInfo raycastInfo2 = __instance.GetRaycastInfo(((Component)player).transform.position - mapStationPlayer.AirVertVector * 0.35f + Vector3.up * 1f, Vector3.down, num, 1f); if (raycastInfo2.hit && ((Object)(object)((Component)((RaycastHit)(ref raycastInfo2.hitInfo)).collider).GetComponent<MapStationVert>() == (Object)null || Vector3.Angle(((RaycastHit)(ref raycastInfo2.hitInfo)).normal, Vector3.up) < 45f)) { Transform transform = ((Component)player).transform; transform.position += mapStationPlayer.AirVertVector * 0.35f; } raycastInfo2 = __instance.GetRaycastInfo(((Component)player).transform.position + mapStationPlayer.AirVertVector * 0.35f + Vector3.up * 1f, Vector3.down, num, 1f); if (raycastInfo2.hit && ((Object)(object)((Component)((RaycastHit)(ref raycastInfo2.hitInfo)).collider).GetComponent<MapStationVert>() == (Object)null || Vector3.Angle(((RaycastHit)(ref raycastInfo2.hitInfo)).normal, Vector3.up) < 45f)) { Transform transform2 = ((Component)player).transform; transform2.position -= mapStationPlayer.AirVertVector * 0.35f; } if (!(num2 < 45f)) { Vector3 vertVectorFromGroundNormal = MapStationPlayer.GetVertVectorFromGroundNormal(((RaycastHit)(ref raycastInfo.hitInfo)).normal); if (!(vertVectorFromGroundNormal == mapStationPlayer.AirVertVector)) { mapStationPlayer.TransferVert(vertVectorFromGroundNormal); } } } [HarmonyPrefix] [HarmonyPatch("ComputeGroundHit")] private static bool ComputeGroundHit_Prefix(GroundDetection __instance, ref bool __result, Vector3 position, Quaternion rotation, ref GroundHit groundHitInfo, float distance) { //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_015f: 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_0168: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) MapStationPlayer mapStationPlayer = MapStationPlayer.Get(((BaseGroundDetection)__instance).player); if (mapStationPlayer.GroundCooldown > 0f || mapStationPlayer.OnPreventComboBreakingGrindPath()) { mapStationPlayer.OnVertGround = false; mapStationPlayer.WasOnVertGround = false; mapStationPlayer.HasVertBelow = false; __result = false; return false; } if (!mapStationPlayer.MoveStyleEquipped) { mapStationPlayer.OnVertGround = false; mapStationPlayer.WasOnVertGround = false; mapStationPlayer.HasVertBelow = false; return true; } ComputeVert(__instance); mapStationPlayer.OnVertGround = false; if (mapStationPlayer.OnVertAir && ((BaseGroundDetection)__instance).player.motor.velocity.y > 0f) { __result = false; return false; } Vector3 val = mapStationPlayer.GroundVertVector; float num = distance; if (mapStationPlayer.WasOnVertGround || ((BaseGroundDetection)__instance).player.motor.wasGrounded) { num = distance * 2f; } if (mapStationPlayer.OnVertAir) { num = distance * 1.25f; val = -mapStationPlayer.AirVertVector; } RaycastInfo raycastInfo = __instance.GetRaycastInfo(position, val, num, 1f); if (!raycastInfo.hit) { RaycastHit hitInfo = default(RaycastHit); if (!((BaseGroundDetection)__instance).BottomSphereCast(position, rotation, ref hitInfo, distance, 0.05f)) { return true; } raycastInfo.hit = true; raycastInfo.hitInfo = hitInfo; } if ((Object)(object)((Component)((RaycastHit)(ref raycastInfo.hitInfo)).collider).GetComponent<MapStationVert>() == (Object)null) { return true; } ((GroundHit)(ref groundHitInfo)).SetFrom(raycastInfo.hitInfo); ((GroundHit)(ref groundHitInfo)).groundDistance = 0.001f; ((GroundHit)(ref groundHitInfo)).isOnGround = true; ((GroundHit)(ref groundHitInfo)).isValidGround = true; Vector3 groundNormal = ((GroundHit)(ref groundHitInfo)).groundNormal; ((GroundHit)(ref groundHitInfo)).groundNormal = ((Vector3)(ref groundNormal)).normalized; ((GroundHit)(ref groundHitInfo)).groundNormalVisual = ((GroundHit)(ref groundHitInfo)).groundNormal; ((GroundHit)(ref groundHitInfo)).isOnStep = false; mapStationPlayer.VertCollider = ((GroundHit)(ref groundHitInfo)).groundCollider; mapStationPlayer.OnVertGround = true; __result = true; return false; } [HarmonyPostfix] [HarmonyPatch("ComputeGroundHit")] private static void ComputeGroundHit_Postfix(GroundDetection __instance, ref bool __result, Vector3 position, Quaternion rotation, ref GroundHit groundHitInfo, float distance) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: 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_0043: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) MapStationPlayer mapStationPlayer = MapStationPlayer.Get(((BaseGroundDetection)__instance).player); if (!__result && (mapStationPlayer.WasOnVertGround || mapStationPlayer.OnVertGround || mapStationPlayer.HasVertBelow)) { GroundHit prevGroundHit = ((BaseGroundDetection)__instance).prevGroundHit; if (((GroundHit)(ref prevGroundHit)).isValidGround && Vector3.Angle(-mapStationPlayer.GroundVertVector, Vector3.up) >= 45f && ((BaseGroundDetection)__instance).player.motor.velocity.y > 0f) { mapStationPlayer.AirVertBegin(); } } if (__result && mapStationPlayer.OnVertAir && ((GroundHit)(ref groundHitInfo)).isValidGround) { mapStationPlayer.AirVertEnd(); } if (mapStationPlayer.OnVertGround) { mapStationPlayer.GroundVertVector = -((GroundHit)(ref groundHitInfo)).groundNormal; } if (!mapStationPlayer.OnVertGround && ((GroundHit)(ref groundHitInfo)).isValidGround && ((GroundHit)(ref groundHitInfo)).isOnGround && mapStationPlayer.MoveStyleEquipped && mapStationPlayer.GroundVertVector != Vector3.down && (Object)(object)((Component)((GroundHit)(ref groundHitInfo)).groundCollider).GetComponent<MapStationVert>() != (Object)null) { mapStationPlayer.OnVertGround = true; } if (!mapStationPlayer.OnVertGround) { mapStationPlayer.GroundVertVector = Vector3.down; } mapStationPlayer.WasOnVertGround = mapStationPlayer.OnVertGround; } } [HarmonyPatch(typeof(LedgeClimbAbility))] internal static class LedgeClimbAbilityPatch { [HarmonyPrefix] [HarmonyPatch("CheckActivation")] private static bool CheckActivation_Prefix(LedgeClimbAbility __instance, ref bool __result) { if (MapStationPlayer.Get(((Ability)__instance).p).OnVertAir) { __result = false; return false; } return true; } } [HarmonyPatch(typeof(LoadStageASyncInstruction))] internal class LoadStageASyncInstructionPatch { [HarmonyPrefix] [HarmonyPatch(/*Could not decode attribute arguments.*/)] [HarmonyPatch(new Type[] { typeof(Stage), typeof(bool), typeof(float) })] private static void LoadStageASyncInstruction_ctor_Prefix(ref Stage stage) { //IL_0095: Unknown result type (might be due to invalid IL or missing references) CrashDetector.BeforeLoadStage(); if ((StageEnum.IsValidMapId(stage) && !StageEnum.IsKnownMapId(stage)) || (int)stage == -1) { Log.Info($"Invariant violated! Attempting to load invalid/unrecognized stage int={(int)stage} ToString()=\"{((object)(Stage)(ref stage)).ToString()}\" This should never happen, because other patches should redirect to hideout before we get here."); stage = (Stage)5; } else if (CrashDetector.ShouldAvoidReCrashing) { Log.Info($"Crash detector believes we previously crashed while loading a stage. To avoid re-crashing, redirecting from stage int={(int)stage} ToString()=\"{((object)(Stage)(ref stage)).ToString()}\" to hideout."); stage = (Stage)5; } if (!StagePrefabHijacker.Loaded && MapDatabase.Instance.maps.ContainsKey(stage)) { StagePrefabHijacker.Log("Loading Hideout resources."); StagePrefabHijacker.ActualTargetStage = stage; stage = (Stage)5; StagePrefabHijacker.Active = true; } } } [HarmonyPatch(typeof(Logger))] internal class LoggerPatch { private static readonly object Lock = new object(); [HarmonyPrefix] [HarmonyPatch("InternalLogEvent")] private static bool InternalLogEvent_Prefix(object sender, LogEventArgs eventArgs) { lock (Lock) { foreach (ILogListener listener in Logger.Listeners) { if (listener != null) { listener.LogEvent(sender, eventArgs); } } } return false; } } [HarmonyPatch(typeof(Mapcontroller))] internal static class MapcontrollerPatch { [HarmonyPrefix] [HarmonyPatch("SetMapGradient")] private static bool SetMapGradient_Prefix(Mapcontroller __instance) { if ((Object)(object)__instance.mapMaterial == (Object)null) { return false; } return true; } [HarmonyPrefix] [HarmonyPatch("GetMap")] private static bool GetMap_Prefix(Stage stage, ref Map __result) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) if (MapDatabase.Instance.maps.TryGetValue(stage, out var value)) { if (!MiniMapManager.TryCreateMapForCustomStage((BaseMapDatabaseEntry)(object)value, out var map)) { return true; } __result = map; return false; } return true; } } [HarmonyPatch(typeof(MovementMotor))] internal static class MovementMotorPatch { [HarmonyPrefix] [HarmonyPatch("ApplyGroundMovement")] private static void ApplyGroundMovement_Prefix(MovementMotor __instance, out GroundHit __state) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) GroundHit prevGroundHit = (__state = __instance.groundDetection.prevGroundHit); Player component = ((Component)__instance).gameObject.GetComponent<Player>(); if (!((Object)(object)component == (Object)null) && MapStationPlayer.Get(component).OnVertGround && !((GroundHit)(ref prevGroundHit)).isOnGround && !((GroundHit)(ref prevGroundHit)).isValidGround) { ((GroundHit)(ref prevGroundHit)).isOnGround = true; ((GroundHit)(ref prevGroundHit)).isValidGround = true; __instance.groundDetection.prevGroundHit = prevGroundHit; } } [HarmonyPostfix] [HarmonyPatch("ApplyGroundMovement")] private static void ApplyGroundMovement_Postfix(MovementMotor __instance, GroundHit __state) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) __instance.groundDetection.prevGroundHit = __state; } } [HarmonyPatch(typeof(Player))] internal static class PlayerPatch { private struct MoveState { public float airDecc; public float aboveMaxAirDecc; } private struct OrientState { public MovementType targetMovement; public MoveStyle moveStyle; } [HarmonyPrefix] [HarmonyPatch("Awake")] private static void Awake_Prefix(Player __instance) { ((Component)__instance).gameObject.AddComponent<MapStationPlayer>(); } [HarmonyPostfix] [HarmonyPatch("Init")] private static void Init_Postfix(Player __instance) { KBMInputDisabler.Apply(); MapStationPlayer.Get(__instance).Init(); } [HarmonyPrefix] [HarmonyPatch("OnLanded")] private static bool OnLanded_Prefix(Player __instance) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) if (MapStationPlayer.Get(__instance).OnVertGround && Vector3.Angle(__instance.motor.groundNormal, Vector3.up) >= 10f) { __instance.OrientVisualInstant(); __instance.audioManager.PlaySfxGameplay(__instance.moveStyle, (AudioClipID)255, __instance.playerOneShotAudioSource, 0f); return false; } return true; } [HarmonyPrefix] [HarmonyPatch("UpdateRotation")] private static bool UpdateRotation_Prefix(Player __instance) { if (MapStationPlayer.Get(__instance).OnVertAir) { return false; } return true; } [HarmonyPrefix] [HarmonyPatch("Move")] private static void Move_Prefix(Player __instance, out MoveState __state) { __state = default(MoveState); __state.airDecc = __instance.stats.airDecc; __state.aboveMaxAirDecc = __instance.aboveMaxAirDecc; if (MapStationPlayer.Get(__instance).OnVertAir) { __instance.stats.airDecc = 0f; __instance.aboveMaxAirDecc = 0f; } } [HarmonyPostfix] [HarmonyPatch("Move")] private static void Move_Postfix(Player __instance, MoveState __state) { __instance.stats.airDecc = __state.airDecc; __instance.aboveMaxAirDecc = __state.aboveMaxAirDecc; } [HarmonyPrefix] [HarmonyPatch("SetVisualRotXZ")] private static bool SetVisualRotXZ_Prefix(Player __instance) { if (MapStationPlayer.Get(__instance).OnVertAir) { return false; } return true; } [HarmonyPrefix] [HarmonyPatch("OrientVisualToSurface")] private static bool OrientVisualToSurface_Prefix(Player __instance, out OrientState __state) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) MapStationPlayer mapStationPlayer = MapStationPlayer.Get(__instance); OrientState orientState = default(OrientState); orientState.targetMovement = __instance.targetMovement; orientState.moveStyle = __instance.moveStyle; OrientState orientState2 = orientState; __state = orientState2; if (mapStationPlayer.OnVertGround) { __instance.targetMovement = (MovementType)0; __instance.moveStyle = (MoveStyle)2; } if (mapStationPlayer.OnVertAir) { mapStationPlayer.UpdateVertRotation(); return false; } return true; } [HarmonyPostfix] [HarmonyPatch("OrientVisualToSurface")] private static void OrientVisualToSurface_Postfix(Player __instance, OrientState __state) { //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) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) __instance.targetMovement = __state.targetMovement; __instance.moveStyle = __state.moveStyle; } [HarmonyPrefix] [HarmonyPatch("SetMoveStyle")] private static void SetMoveStyle_Prefix(Player __instance, MoveStyle setMoveStyle) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) if ((int)setMoveStyle != 0) { return; } Ability ability = __instance.ability; BoostAbility val = (BoostAbility)(object)((ability is BoostAbility) ? ability : null); if (val == null || !val.equippedMovestyleWasUsed) { MapStationPlayer mapStationPlayer = MapStationPlayer.Get(__instance); if (mapStationPlayer.OnVertAir) { mapStationPlayer.AirVertEnd(); } } } [HarmonyPostfix] [HarmonyPatch("CompletelyStop")] private static void CompletelyStop_Postfix(Player __instance) { MapStationPlayer mapStationPlayer = MapStationPlayer.Get(__instance); mapStationPlayer.SpeedFromVertAir = 0f; if (mapStationPlayer.OnVertAir) { mapStationPlayer.AirVertEnd(); } } [HarmonyPrefix] [HarmonyPatch("JumpIsAllowed")] private static bool JumpIsAllowed_Prefix(Player __instance, ref bool __result) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) MapStationPlayer mapStationPlayer = MapStationPlayer.Get(__instance); if (mapStationPlayer.OnVertGround && Vector3.Angle(__instance.motor.groundNormal, Vector3.up) >= 45f) { __result = false; return false; } if (mapStationPlayer.OnVertAir) { __result = false; return false; } return true; } [HarmonyPrefix] [HarmonyPatch("CanStartGrind")] private static bool CanStartGrind_Prefix(Player __instance, ref bool __result) { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) if (__instance.jumpButtonHeld || __instance.jumpButtonNew || __instance.jumpRequested) { return true; } MapStationPlayer mapStationPlayer = MapStationPlayer.Get(__instance); if (mapStationPlayer.OnVertAir) { __result = false; return false; } if (mapStationPlayer.HasVertBelow) { __result = false; return false; } if (mapStationPlayer.OnVertGround && Vector3.Angle(__instance.motor.groundNormal, Vector3.up) >= 45f) { __result = false; return false; } return true; } [HarmonyPostfix] [HarmonyPatch("UpdateAbilities")] private static void UpdateAbilities_Postfix(Player __instance) { if (__instance.ability == __instance.handplantAbility) { MapStationPlayer.Get(__instance).MapStationHandplantAbility.UpdateAbility(); } } [HarmonyPostfix] [HarmonyPatch("LateUpdateAnimation")] private static void LateUpdateAnimation_Postfix(Player __instance) { if (((Component)__instance).gameObject.activeSelf) { MapStationPlayer.Get(__instance).MapStationHandplantAbility.LateUpdateAnimation(); } } } [HarmonyPatch(typeof(PlayerPhoneCameras))] internal class PlayerPhoneCamerasPatch { [HarmonyPostfix] [HarmonyPatch("Awake")] private static void Awake_Postfix(PlayerPhoneCameras __instance) { //IL_0044: 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) MapStationCameraOverride instance = MapStationCameraOverride.Instance; if ((Object)(object)instance == (Object)null || !instance.AlsoAffectPhoneCamera) { return; } Camera[] componentsInChildren = ((Component)__instance).GetComponentsInChildren<Camera>(); foreach (Camera val in componentsInChildren) { instance.ApplyToCamera(val); if ((Object)(object)((Component)val).GetComponent<PostProcessLayer>() != (Object)null) { PostProcessLayer component = ((Component)val).GetComponent<PostProcessLayer>(); component.volumeLayer = LayerMask.op_Implicit(LayerMask.op_Implicit(component.volumeLayer) | 0x1000000); } } } } [HarmonyPatch(typeof(SaveSlotData))] internal static class SaveSlotDataPatch { [HarmonyPostfix] [HarmonyPatch("GetStageProgress")] private static void GetStageProgress_Postfix(Stage stage, ref StageProgress __result) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) if (__result == null && StageEnum.IsKnownMapId(stage)) { __result = StageProgresses.Instance.GetOrCreateForStage(stage); } } } [HarmonyPatch(typeof(Enum))] internal static class StagePatch { [HarmonyPostfix] [HarmonyPatch("ToString")] [HarmonyPatch(new Type[] { })] private static void ToString_Postfix(ref string __result, Enum __instance) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) if (!(__instance is Stage)) { return; } Stage val = (Stage)(object)__instance; if (StageEnum.IsValidMapId(val)) { if (StageEnum.MapNames.TryGetValue(val, out var value)) { __result = "mapstation/" + value; } else { __result = "mapstation/unknown/" + __result; } } } } [HarmonyPatch(typeof(TextMeshProGameTextLocalizer))] internal class TextMeshProGameTextLocalizerPatch { [HarmonyPrefix] [HarmonyPatch("GetStageNameKey")] private static bool GetStageNameKey_Prefix(TextMeshProGameTextLocalizer __instance, Stage stageID, ref string __result) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) if (MapDatabase.Instance.maps.TryGetValue(stageID, out var value)) { __result = value.Properties.displayName; return false; } return true; } } [HarmonyPatch(typeof(Utility))] internal static class UtilityPatch { [HarmonyPostfix] [HarmonyPatch("SceneNameToStage")] private static void SceneNameToStage_Postfix(ref Stage __result, string sceneName) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected I4, but got Unknown //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Expected I4, but got Unknown if ((int)__result != -1) { return; } bool flag = false; if (sceneName.StartsWith("mapstation/")) { string key = sceneName.Substring(11); if (StageEnum.MapIds.TryGetValue(ke
MapStation.Tools.dll
Decompiled 2 months agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using Microsoft.CodeAnalysis; using Reptile; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.7.1", FrameworkDisplayName = ".NET Framework 4.7.1")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: AssemblyCompany("MapStation.Tools")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+2a9f5e71dc280b5c7d4e74f2e1ad0f6a1ac841a2")] [assembly: AssemblyProduct("MapStation.Tools")] [assembly: AssemblyTitle("MapStation.Tools")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [assembly: TypeForwardedTo(typeof(ABaseError))] [assembly: TypeForwardedTo(typeof(Ability))] [assembly: TypeForwardedTo(typeof(Achievement))] [assembly: TypeForwardedTo(typeof(AchievementLibrary))] [assembly: TypeForwardedTo(typeof(AchievementPhotoObjective))] [assembly: TypeForwardedTo(typeof(Achievements))] [assembly: TypeForwardedTo(typeof(AchievementsCache))] [assembly: TypeForwardedTo(typeof(AchievementsLocal))] [assembly: TypeForwardedTo(typeof(AchievementsSteam))] [assembly: TypeForwardedTo(typeof(AchievementsTracker))] [assembly: TypeForwardedTo(typeof(AchievementsTracking))] [assembly: TypeForwardedTo(typeof(AchievementType))] [assembly: TypeForwardedTo(typeof(ActiveOnChapter))] [assembly: TypeForwardedTo(typeof(ADataSerializer))] [assembly: TypeForwardedTo(typeof(ADownloadableContent))] [assembly: TypeForwardedTo(typeof(AErrorHandler))] [assembly: TypeForwardedTo(typeof(AFileTransaction))] [assembly: TypeForwardedTo(typeof(AFodsLocalizationFileParser))] [assembly: TypeForwardedTo(typeof(AGameDebug))] [assembly: TypeForwardedTo(typeof(AGameTextFormatter))] [assembly: TypeForwardedTo(typeof(AIndexQueue))] [assembly: TypeForwardedTo(typeof(AirDashAbility))] [assembly: TypeForwardedTo(typeof(AirTrickAbility))] [assembly: TypeForwardedTo(typeof(AlignWithRayAttribute))] [assembly: TypeForwardedTo(typeof(AmbientManager))] [assembly: TypeForwardedTo(typeof(AmbientTrigger))] [assembly: TypeForwardedTo(typeof(AMenuController))] [assembly: TypeForwardedTo(typeof(AnimatedStripe))] [assembly: TypeForwardedTo(typeof(AnimationAssetManager))] [assembly: TypeForwardedTo(typeof(AnimationEventRelay))] [assembly: TypeForwardedTo(typeof(AnimationInstanceEvent))] [assembly: TypeForwardedTo(typeof(AnimationInstanceInfo))] [assembly: TypeForwardedTo(typeof(AnimationInstanceType))] [assembly: TypeForwardedTo(typeof(AnimationInstancing))] [assembly: TypeForwardedTo(typeof(AnimationInstancingManager))] [assembly: TypeForwardedTo(typeof(AnimationTexture))] [assembly: TypeForwardedTo(typeof(AnimInfo))] [assembly: TypeForwardedTo(typeof(AOptionsMenuTab))] [assembly: TypeForwardedTo(typeof(APlatform))] [assembly: TypeForwardedTo(typeof(ApplicationUtility))] [assembly: TypeForwardedTo(typeof(ApplyToChildAttribute))] [assembly: TypeForwardedTo(typeof(AProgressable))] [assembly: TypeForwardedTo(typeof(Arm))] [assembly: TypeForwardedTo(typeof(ASceneAssetLoader))] [assembly: TypeForwardedTo(typeof(ASceneSetupInstruction))] [assembly: TypeForwardedTo(typeof(AssetBundleCollection))] [assembly: TypeForwardedTo(typeof(AssetBundleLibrary))] [assembly: TypeForwardedTo(typeof(Assets))] [assembly: TypeForwardedTo(typeof(AssetsToLoadData))] [assembly: TypeForwardedTo(typeof(AssetsToLoadDataLibrary))] [assembly: TypeForwardedTo(typeof(AStorage))] [assembly: TypeForwardedTo(typeof(AsyncState))] [assembly: TypeForwardedTo(typeof(ATextMeshProFormatter))] [assembly: TypeForwardedTo(typeof(ATransaction))] [assembly: TypeForwardedTo(typeof(AudioAmbienceTrigger))] [assembly: TypeForwardedTo(typeof(AudioAmbienceZone))] [assembly: TypeForwardedTo(typeof(AudioAnalyzer))] [assembly: TypeForwardedTo(typeof(AudioChannelID))] [assembly: TypeForwardedTo(typeof(AudioClipFilterAttribute))] [assembly: TypeForwardedTo(typeof(AudioClipID))] [assembly: TypeForwardedTo(typeof(AudioManager))] [assembly: TypeForwardedTo(typeof(AudioRectangularReverb))] [assembly: TypeForwardedTo(typeof(AudioSettings))] [assembly: TypeForwardedTo(typeof(AudioSourceID))] [assembly: TypeForwardedTo(typeof(AudioSubSystem))] [assembly: TypeForwardedTo(typeof(AUnlockable))] [assembly: TypeForwardedTo(typeof(AUser))] [assembly: TypeForwardedTo(typeof(AUserSaveDataLoader))] [assembly: TypeForwardedTo(typeof(AutoPlayLoop))] [assembly: TypeForwardedTo(typeof(BannerSpin))] [assembly: TypeForwardedTo(typeof(BaseGroundDetection))] [assembly: TypeForwardedTo(typeof(BaseMenuTimelineBehaviour))] [assembly: TypeForwardedTo(typeof(BaseModule))] [assembly: TypeForwardedTo(typeof(BaseMoveHandler))] [assembly: TypeForwardedTo(typeof(BasePhotoObjective))] [assembly: TypeForwardedTo(typeof(BasicCop))] [assembly: TypeForwardedTo(typeof(BasicCopAnimInfo))] [assembly: TypeForwardedTo(typeof(BasicEnemy))] [assembly: TypeForwardedTo(typeof(BasicEnemySpawner))] [assembly: TypeForwardedTo(typeof(BasketballAchievement))] [assembly: TypeForwardedTo(typeof(Battle))] [assembly: TypeForwardedTo(typeof(Bird))] [assembly: TypeForwardedTo(typeof(BirdAchievement))] [assembly: TypeForwardedTo(typeof(BirdBehaviour))] [assembly: TypeForwardedTo(typeof(BlackBarBehaviour))] [assembly: TypeForwardedTo(typeof(BlackBarClip))] [assembly: TypeForwardedTo(typeof(BlackBarTrack))] [assembly: TypeForwardedTo(typeof(BMXOnlyGateway))] [assembly: TypeForwardedTo(typeof(BoostAbility))] [assembly: TypeForwardedTo(typeof(BoosterAchievementsTracker))] [assembly: TypeForwardedTo(typeof(BoosterEvent))] [assembly: TypeForwardedTo(typeof(BoosterStats))] [assembly: TypeForwardedTo(typeof(BoostpackEffectMode))] [assembly: TypeForwardedTo(typeof(Bootstrap))] [assembly: TypeForwardedTo(typeof(BouncingBoxWidget))] [assembly: TypeForwardedTo(typeof(BoxGroundDetection))] [assembly: TypeForwardedTo(typeof(BoxSide))] [assembly: TypeForwardedTo(typeof(BreakableObject))] [assembly: TypeForwardedTo(typeof(Buffer<>))] [assembly: TypeForwardedTo(typeof(Bullet))] [assembly: TypeForwardedTo(typeof(Bundle))] [assembly: TypeForwardedTo(typeof(ButtonSpriteData))] [assembly: TypeForwardedTo(typeof(ButtonSpriteDictionary))] [assembly: TypeForwardedTo(typeof(CameraExtensions))] [assembly: TypeForwardedTo(typeof(CameraMode))] [assembly: TypeForwardedTo(typeof(CameraModeDrag))] [assembly: TypeForwardedTo(typeof(CameraModeGrind))] [assembly: TypeForwardedTo(typeof(CameraModeHandplant))] [assembly: TypeForwardedTo(typeof(CameraModeLock))] [assembly: TypeForwardedTo(typeof(CameraModeVert))] [assembly: TypeForwardedTo(typeof(CameraModeWallrun))] [assembly: TypeForwardedTo(typeof(CameraModeZone))] [assembly: TypeForwardedTo(typeof(CameraRegisterer))] [assembly: TypeForwardedTo(typeof(CameraShakeBehaviour))] [assembly: TypeForwardedTo(typeof(CameraShakeClip))] [assembly: TypeForwardedTo(typeof(CameraShakeComponent))] [assembly: TypeForwardedTo(typeof(CameraShakeTrack))] [assembly: TypeForwardedTo(typeof(CameraUtility))] [assembly: TypeForwardedTo(typeof(CameraZone))] [assembly: TypeForwardedTo(typeof(CameraZoneMode))] [assembly: TypeForwardedTo(typeof(Car))] [assembly: TypeForwardedTo(typeof(CarsMoveHandler))] [assembly: TypeForwardedTo(typeof(CarVisualAudio))] [assembly: TypeForwardedTo(typeof(Category))] [assembly: TypeForwardedTo(typeof(CaughtAbility))] [assembly: TypeForwardedTo(typeof(ChapterMusic))] [assembly: TypeForwardedTo(typeof(CharacterConstructor))] [assembly: TypeForwardedTo(typeof(CharacterLoader))] [assembly: TypeForwardedTo(typeof(CharacterNamePickerAttribute))] [assembly: TypeForwardedTo(typeof(CharacterProgress))] [assembly: TypeForwardedTo(typeof(Characters))] [assembly: TypeForwardedTo(typeof(CharacterSelect))] [assembly: TypeForwardedTo(typeof(CharacterSelectAbility))] [assembly: TypeForwardedTo(typeof(CharacterSelectCharacter))] [assembly: TypeForwardedTo(typeof(CharacterSelectSpot))] [assembly: TypeForwardedTo(typeof(CharacterSelectUI))] [assembly: TypeForwardedTo(typeof(CharacterVisual))] [assembly: TypeForwardedTo(typeof(Collectable))] [assembly: TypeForwardedTo(typeof(CollectableProgress))] [assembly: TypeForwardedTo(typeof(CombatEncounter))] [assembly: TypeForwardedTo(typeof(ComboEncounter))] [assembly: TypeForwardedTo(typeof(ComboMascot))] [assembly: TypeForwardedTo(typeof(ComboMascotSystem))] [assembly: TypeForwardedTo(typeof(ComparerHash))] [assembly: TypeForwardedTo(typeof(ComponentExtensions))] [assembly: TypeForwardedTo(typeof(CompressedGameSaveDataSerializer))] [assembly: TypeForwardedTo(typeof(ContainerExtensions))] [assembly: TypeForwardedTo(typeof(ControllerGuidHandlerFactory))] [assembly: TypeForwardedTo(typeof(CopAnimInfo))] [assembly: TypeForwardedTo(typeof(CopterCop))] [assembly: TypeForwardedTo(typeof(CopterCopAnimInfo))] [assembly: TypeForwardedTo(typeof(CopterCopSpawner))] [assembly: TypeForwardedTo(typeof(Core))] [assembly: TypeForwardedTo(typeof(CorruptedDataLoadError))] [assembly: TypeForwardedTo(typeof(CorruptedDataSaveError))] [assembly: TypeForwardedTo(typeof(CorruptedSaveSlotLoadError))] [assembly: TypeForwardedTo(typeof(CreditsManager))] [assembly: TypeForwardedTo(typeof(Crew))] [assembly: TypeForwardedTo(typeof(CuffMissileEnemy))] [assembly: TypeForwardedTo(typeof(CuffMissileLauncher))] [assembly: TypeForwardedTo(typeof(CutsceneAudioTrack))] [assembly: TypeForwardedTo(typeof(CutsceneCameraFollowTempRacer))] [assembly: TypeForwardedTo(typeof(DanceAbility))] [assembly: TypeForwardedTo(typeof(DanceAbilityUI))] [assembly: TypeForwardedTo(typeof(DanceAbilityUIButton))] [assembly: TypeForwardedTo(typeof(Dances))] [assembly: TypeForwardedTo(typeof(DataSerializerFactory))] [assembly: TypeForwardedTo(typeof(DeactivateOnAwake))] [assembly: TypeForwardedTo(typeof(DebugConsoleTextAreaHandler))] [assembly: TypeForwardedTo(typeof(DebugMenuController))] [assembly: TypeForwardedTo(typeof(DebugUtility))] [assembly: TypeForwardedTo(typeof(DefaultIndexQueue))] [assembly: TypeForwardedTo(typeof(DeleteTransaction))] [assembly: TypeForwardedTo(typeof(DelimiterMatcher))] [assembly: TypeForwardedTo(typeof(DelimiterRegexFormatterData))] [assembly: TypeForwardedTo(typeof(DestroyWhenOutOfView))] [assembly: TypeForwardedTo(typeof(DialogueBehaviour))] [assembly: TypeForwardedTo(typeof(DialogueClip))] [assembly: TypeForwardedTo(typeof(DialogueTrack))] [assembly: TypeForwardedTo(typeof(DialogueUI))] [assembly: TypeForwardedTo(typeof(DieAbility))] [assembly: TypeForwardedTo(typeof(DieMenu))] [assembly: TypeForwardedTo(typeof(DirectoryCreateTransaction))] [assembly: TypeForwardedTo(typeof(DirectoryInfoTransaction))] [assembly: TypeForwardedTo(typeof(DJBoss))] [assembly: TypeForwardedTo(typeof(DJBossAnimInfo))] [assembly: TypeForwardedTo(typeof(DJBossJumper))] [assembly: TypeForwardedTo(typeof(DJCollider))] [assembly: TypeForwardedTo(typeof(DownloadableContentEditor))] [assembly: TypeForwardedTo(typeof(DownloadableContentItem))] [assembly: TypeForwardedTo(typeof(DownloadableContentLibrary))] [assembly: TypeForwardedTo(typeof(DownloadableContentSteam))] [assembly: TypeForwardedTo(typeof(DownloadableContentWindows))] [assembly: TypeForwardedTo(typeof(DreamEncounter))] [assembly: TypeForwardedTo(typeof(DummyAnimationEventRelay))] [assembly: TypeForwardedTo(typeof(DumpFileGenerator))] [assembly: TypeForwardedTo(typeof(DynamicJunk))] [assembly: TypeForwardedTo(typeof(DynamicJunkUpdater))] [assembly: TypeForwardedTo(typeof(DynamicPickup))] [assembly: TypeForwardedTo(typeof(DynamicRepPickup))] [assembly: TypeForwardedTo(typeof(EffectsUI))] [assembly: TypeForwardedTo(typeof(EmptyError))] [assembly: TypeForwardedTo(typeof(Encounter))] [assembly: TypeForwardedTo(typeof(EncounterProgress))] [assembly: TypeForwardedTo(typeof(EnemyAnimationEventRelay))] [assembly: TypeForwardedTo(typeof(EnemyAnimations))] [assembly: TypeForwardedTo(typeof(EnemyAnimInfos))] [assembly: TypeForwardedTo(typeof(EnemyExtension))] [assembly: TypeForwardedTo(typeof(EnemyFirearm))] [assembly: TypeForwardedTo(typeof(EnemyGraffitiSpotDamager))] [assembly: TypeForwardedTo(typeof(EnemyGrindLines))] [assembly: TypeForwardedTo(typeof(EnemyHitResponse))] [assembly: TypeForwardedTo(typeof(EnemyLockOnAiming))] [assembly: TypeForwardedTo(typeof(EnemyMeleeWeapon))] [assembly: TypeForwardedTo(typeof(EnemyNavmeshMovement))] [assembly: TypeForwardedTo(typeof(EnemyPositioningInfo))] [assembly: TypeForwardedTo(typeof(EnemyShield))] [assembly: TypeForwardedTo(typeof(EnemySpawnAdds))] [assembly: TypeForwardedTo(typeof(EnemySpawnReplacement))] [assembly: TypeForwardedTo(typeof(EnemyStopMoveAlongPoints))] [assembly: TypeForwardedTo(typeof(EnemyTargetabilityAiming))] [assembly: TypeForwardedTo(typeof(EnemyTargets))] [assembly: TypeForwardedTo(typeof(EnemyType))] [assembly: TypeForwardedTo(typeof(EnemyVelocityAiming))] [assembly: TypeForwardedTo(typeof(EnemyVoices))] [assembly: TypeForwardedTo(typeof(ErrorHandlerFinishedDelegate))] [assembly: TypeForwardedTo(typeof(ErrorHandlingResult))] [assembly: TypeForwardedTo(typeof(ErrorQueue))] [assembly: TypeForwardedTo(typeof(ErrorYieldInstruction))] [assembly: TypeForwardedTo(typeof(ExplosionMaterialData))] [assembly: TypeForwardedTo(typeof(Explosive))] [assembly: TypeForwardedTo(typeof(ExtraBoneInfo))] [assembly: TypeForwardedTo(typeof(Extrusion))] [assembly: TypeForwardedTo(typeof(FadeBehaviour))] [assembly: TypeForwardedTo(typeof(FadeClip))] [assembly: TypeForwardedTo(typeof(FadeTrack))] [assembly: TypeForwardedTo(typeof(FinalBossAchievement))] [assembly: TypeForwardedTo(typeof(FixedFramerateSequence))] [assembly: TypeForwardedTo(typeof(FlipOutJumpAbility))] [assembly: TypeForwardedTo(typeof(FloorIsLavaEncounter))] [assembly: TypeForwardedTo(typeof(FodsCharacterNamesParser))] [assembly: TypeForwardedTo(typeof(FodsCreditsParser))] [assembly: TypeForwardedTo(typeof(FodsDialogueParser))] [assembly: TypeForwardedTo(typeof(FodsDocumentLoader))] [assembly: TypeForwardedTo(typeof(FodsLocalizationFileReader))] [assembly: TypeForwardedTo(typeof(FodsObjectiveTextParser))] [assembly: TypeForwardedTo(typeof(FodsStageNamesParser))] [assembly: TypeForwardedTo(typeof(FodsTable))] [assembly: TypeForwardedTo(typeof(FodsTextLocalizationParser))] [assembly: TypeForwardedTo(typeof(FodsTextSizeLocalizationParser))] [assembly: TypeForwardedTo(typeof(FormatterData))] [assembly: TypeForwardedTo(typeof(FormattingUtility))] [assembly: TypeForwardedTo(typeof(FortuneCookie))] [assembly: TypeForwardedTo(typeof(FortuneRare))] [assembly: TypeForwardedTo(typeof(FrictionEffectMode))] [assembly: TypeForwardedTo(typeof(GameDebugDummy))] [assembly: TypeForwardedTo(typeof(GameFontType))] [assembly: TypeForwardedTo(typeof(GameInput))] [assembly: TypeForwardedTo(typeof(GameNotificationUI))] [assembly: TypeForwardedTo(typeof(GameParameters))] [assembly: TypeForwardedTo(typeof(GameplayCamera))] [assembly: TypeForwardedTo(typeof(GameplayEvent))] [assembly: TypeForwardedTo(typeof(GameplaySettings))] [assembly: TypeForwardedTo(typeof(GameplayUI))] [assembly: TypeForwardedTo(typeof(GamePrefabLoader))] [assembly: TypeForwardedTo(typeof(GameVersion))] [assembly: TypeForwardedTo(typeof(GassBarrier))] [assembly: TypeForwardedTo(typeof(GenericStats<, >))] [assembly: TypeForwardedTo(typeof(GraffitiAchievementsTracker))] [assembly: TypeForwardedTo(typeof(GraffitiArt))] [assembly: TypeForwardedTo(typeof(GraffitiArtInfo))] [assembly: TypeForwardedTo(typeof(GraffitiCollectableVisual))] [assembly: TypeForwardedTo(typeof(GraffitiEffect))] [assembly: TypeForwardedTo(typeof(GraffitiEvent))] [assembly: TypeForwardedTo(typeof(GraffitiGame))] [assembly: TypeForwardedTo(typeof(GraffitiInfoPanel))] [assembly: TypeForwardedTo(typeof(GraffitiLoader))] [assembly: TypeForwardedTo(typeof(GraffitiSize))] [assembly: TypeForwardedTo(typeof(GraffitiSpot))] [assembly: TypeForwardedTo(typeof(GraffitiSpotFinisher))] [assembly: TypeForwardedTo(typeof(GraffitiSpotProgress))] [assembly: TypeForwardedTo(typeof(GraffitiState))] [assembly: TypeForwardedTo(typeof(GraffitiStats))] [assembly: TypeForwardedTo(typeof(GraphicsStatusHandler))] [assembly: TypeForwardedTo(typeof(GrindAbility))] [assembly: TypeForwardedTo(typeof(GrindLine))] [assembly: TypeForwardedTo(typeof(GrindLineAnimate))] [assembly: TypeForwardedTo(typeof(GrindNode))] [assembly: TypeForwardedTo(typeof(GrindNodeAnimate))] [assembly: TypeForwardedTo(typeof(GrindPath))] [assembly: TypeForwardedTo(typeof(GroundDetection))] [assembly: TypeForwardedTo(typeof(GroundHit))] [assembly: TypeForwardedTo(typeof(GroundTrickAbility))] [assembly: TypeForwardedTo(typeof(GroupOptions))] [assembly: TypeForwardedTo(typeof(HackerText))] [assembly: TypeForwardedTo(typeof(HandplantAbility))] [assembly: TypeForwardedTo(typeof(HeadspinAbility))] [assembly: TypeForwardedTo(typeof(HitBounceAbility))] [assembly: TypeForwardedTo(typeof(HitDir))] [assembly: TypeForwardedTo(typeof(HomeScreenApp))] [assembly: TypeForwardedTo(typeof(IAudioSubSystem))] [assembly: TypeForwardedTo(typeof(ICollectionGenerator))] [assembly: TypeForwardedTo(typeof(IDataSerializer))] [assembly: TypeForwardedTo(typeof(IEditorGameTextLocalizer))] [assembly: TypeForwardedTo(typeof(IError))] [assembly: TypeForwardedTo(typeof(IGameTextFormatter))] [assembly: TypeForwardedTo(typeof(IGameTextLocalizer))] [assembly: TypeForwardedTo(typeof(IInitializableSceneObject))] [assembly: TypeForwardedTo(typeof(IInterruptable))] [assembly: TypeForwardedTo(typeof(ILocalizationFileLoader))] [assembly: TypeForwardedTo(typeof(ILocalizationFileParser))] [assembly: TypeForwardedTo(typeof(ILocalizationFileReader))] [assembly: TypeForwardedTo(typeof(IMenuAnimationTransitionController))] [assembly: TypeForwardedTo(typeof(IMultiTransactionHandler))] [assembly: TypeForwardedTo(typeof(IMusicLibraryPlayer))] [assembly: TypeForwardedTo(typeof(IMusicPlayer))] [assembly: TypeForwardedTo(typeof(IncorrectFormatException))] [assembly: TypeForwardedTo(typeof(InputControllerGuidData))] [assembly: TypeForwardedTo(typeof(InputSelectionRowController))] [assembly: TypeForwardedTo(typeof(InputSettings))] [assembly: TypeForwardedTo(typeof(InstanceAnimationInstanceInfo))] [assembly: TypeForwardedTo(typeof(InstanceData))] [assembly: TypeForwardedTo(typeof(InstancingPackage))] [assembly: TypeForwardedTo(typeof(InverseKinematicsRelay))] [assembly: TypeForwardedTo(typeof(IOUtility))] [assembly: TypeForwardedTo(typeof(IPoolable))] [assembly: TypeForwardedTo(typeof(IRegexPatternCreator))] [assembly: TypeForwardedTo(typeof(IRewiredControllerGuidHandler))] [assembly: TypeForwardedTo(typeof(ISaveable))] [assembly: TypeForwardedTo(typeof(ISceneAssetLoader))] [assembly: TypeForwardedTo(typeof(ISubsystem))] [assembly: TypeForwardedTo(typeof(ITextFormatter))] [assembly: TypeForwardedTo(typeof(ITextMatcher))] [assembly: TypeForwardedTo(typeof(ITextSelectable))] [assembly: TypeForwardedTo(typeof(ITransactionError))] [assembly: TypeForwardedTo(typeof(IUIElement))] [assembly: TypeForwardedTo(typeof(IUIMenuController))] [assembly: TypeForwardedTo(typeof(IUserId))] [assembly: TypeForwardedTo(typeof(IUserSaveDataLoader))] [assembly: TypeForwardedTo(typeof(Junk))] [assembly: TypeForwardedTo(typeof(JunkBehaviour))] [assembly: TypeForwardedTo(typeof(JunkHolder))] [assembly: TypeForwardedTo(typeof(JunkStageHandler))] [assembly: TypeForwardedTo(typeof(KnockbackAbility))] [assembly: TypeForwardedTo(typeof(Layers))] [assembly: TypeForwardedTo(typeof(Layout))] [assembly: TypeForwardedTo(typeof(LayoutManagerRuleSet))] [assembly: TypeForwardedTo(typeof(LedgeClimbAbility))] [assembly: TypeForwardedTo(typeof(LoadingScreenUI))] [assembly: TypeForwardedTo(typeof(LoadSceneASyncInstruction))] [assembly: TypeForwardedTo(typeof(LoadSceneInstruction))] [assembly: TypeForwardedTo(typeof(LoadStageASyncInstruction))] [assembly: TypeForwardedTo(typeof(LoadTransaction<>))] [assembly: TypeForwardedTo(typeof(LocalizationData))] [assembly: TypeForwardedTo(typeof(LocalizationGroup))] [assembly: TypeForwardedTo(typeof(LocalizationKeyValuePair))] [assembly: TypeForwardedTo(typeof(LocalizationLookupTable))] [assembly: TypeForwardedTo(typeof(LocalizationNameFont))] [assembly: TypeForwardedTo(typeof(LocalizationTableGenerator))] [assembly: TypeForwardedTo(typeof(LocalizedTMProText))] [assembly: TypeForwardedTo(typeof(LodInfo))] [assembly: TypeForwardedTo(typeof(LogEntry))] [assembly: TypeForwardedTo(typeof(Logger))] [assembly: TypeForwardedTo(typeof(LookAtIKBehaviour))] [assembly: TypeForwardedTo(typeof(LookAtIKClip))] [assembly: TypeForwardedTo(typeof(LookAtIKComponent))] [assembly: TypeForwardedTo(typeof(LookAtIKMixerBehaviour))] [assembly: TypeForwardedTo(typeof(LookAtIKTrack))] [assembly: TypeForwardedTo(typeof(MainMenuManager))] [assembly: TypeForwardedTo(typeof(Map))] [assembly: TypeForwardedTo(typeof(Mapcontroller))] [assembly: TypeForwardedTo(typeof(MapPin))] [assembly: TypeForwardedTo(typeof(MaterialBlock))] [assembly: TypeForwardedTo(typeof(Menu))] [assembly: TypeForwardedTo(typeof(MenuNavigationController))] [assembly: TypeForwardedTo(typeof(MenuTimelineButton))] [assembly: TypeForwardedTo(typeof(MissileEnemy))] [assembly: TypeForwardedTo(typeof(MissionPhotoObjective))] [assembly: TypeForwardedTo(typeof(MouseLook))] [assembly: TypeForwardedTo(typeof(MoveAlongHandler))] [assembly: TypeForwardedTo(typeof(MoveAlongPoints))] [assembly: TypeForwardedTo(typeof(MoveAlongPoints_Hot))] [assembly: TypeForwardedTo(typeof(MovementMotor))] [assembly: TypeForwardedTo(typeof(MovementStats))] [assembly: TypeForwardedTo(typeof(MoveObject))] [assembly: TypeForwardedTo(typeof(MoverLOD))] [assembly: TypeForwardedTo(typeof(MoveStyle))] [assembly: TypeForwardedTo(typeof(MoveStyleCollectableVisuals))] [assembly: TypeForwardedTo(typeof(MoveStyleLoader))] [assembly: TypeForwardedTo(typeof(MoveStyleSkin))] [assembly: TypeForwardedTo(typeof(MovingPlatform))] [assembly: TypeForwardedTo(typeof(MultiOptionButton))] [assembly: TypeForwardedTo(typeof(MusicAssetsLoader))] [assembly: TypeForwardedTo(typeof(MusicBundle))] [assembly: TypeForwardedTo(typeof(MusicLibrary))] [assembly: TypeForwardedTo(typeof(MusicLibraryPlayer))] [assembly: TypeForwardedTo(typeof(MusicPlayer))] [assembly: TypeForwardedTo(typeof(MusicPlayerBuffer))] [assembly: TypeForwardedTo(typeof(MusicPlayerData))] [assembly: TypeForwardedTo(typeof(MusicTimelineBehaviour))] [assembly: TypeForwardedTo(typeof(MusicTimelineClip))] [assembly: TypeForwardedTo(typeof(MusicTimelineMixer))] [assembly: TypeForwardedTo(typeof(MusicTimelineTrack))] [assembly: TypeForwardedTo(typeof(MusicTrack))] [assembly: TypeForwardedTo(typeof(MusicTrackDictionary))] [assembly: TypeForwardedTo(typeof(MusicTrackID))] [assembly: TypeForwardedTo(typeof(MusicTrackIDComparer))] [assembly: TypeForwardedTo(typeof(MusicTrackQueue))] [assembly: TypeForwardedTo(typeof(NoAccessToDataError))] [assembly: TypeForwardedTo(typeof(NoBundleFoundException))] [assembly: TypeForwardedTo(typeof(NoDiskSpaceSaveError))] [assembly: TypeForwardedTo(typeof(NoModelException))] [assembly: TypeForwardedTo(typeof(NonPlayerAnimationEventRelay))] [assembly: TypeForwardedTo(typeof(NoOutfitException))] [assembly: TypeForwardedTo(typeof(NotificationTextAsset))] [assembly: TypeForwardedTo(typeof(NPC))] [assembly: TypeForwardedTo(typeof(NPCProgress))] [assembly: TypeForwardedTo(typeof(ObjectProgress))] [assembly: TypeForwardedTo(typeof(OneOffVisualEffect))] [assembly: TypeForwardedTo(typeof(OnGSpotStateChanged))] [assembly: TypeForwardedTo(typeof(OnLanguageChangedHandler))] [assembly: TypeForwardedTo(typeof(OnMultiOptionsUIChangedEvent))] [assembly: TypeForwardedTo(typeof(OnSliderValueChangedEvent))] [assembly: TypeForwardedTo(typeof(OptionsMenu))] [assembly: TypeForwardedTo(typeof(OptionsMenuAudioTab))] [assembly: TypeForwardedTo(typeof(OptionsMenuGameTab))] [assembly: TypeForwardedTo(typeof(OptionsMenuInputTab))] [assembly: TypeForwardedTo(typeof(OptionsMenuVideoTab))] [assembly: TypeForwardedTo(typeof(OptionsSliderButton))] [assembly: TypeForwardedTo(typeof(OutfitSwappableCharacter))] [assembly: TypeForwardedTo(typeof(OutfitSwitchBehaviour))] [assembly: TypeForwardedTo(typeof(OutfitSwitchClip))] [assembly: TypeForwardedTo(typeof(OutfitSwitchMenu))] [assembly: TypeForwardedTo(typeof(OutfitSwitchTrack))] [assembly: TypeForwardedTo(typeof(OutfitUnlockable))] [assembly: TypeForwardedTo(typeof(Overlay))] [assembly: TypeForwardedTo(typeof(PauseMenu))] [assembly: TypeForwardedTo(typeof(PauseType))] [assembly: TypeForwardedTo(typeof(Pedestrian))] [assembly: TypeForwardedTo(typeof(PhonePictureData))] [assembly: TypeForwardedTo(typeof(PhotoAchievementTracker))] [assembly: TypeForwardedTo(typeof(PhotoButton))] [assembly: TypeForwardedTo(typeof(PhotoEvent))] [assembly: TypeForwardedTo(typeof(PhotoObjectiveProgressable))] [assembly: TypeForwardedTo(typeof(PhotoObjectProgress))] [assembly: TypeForwardedTo(typeof(PhotosAlbumMenu))] [assembly: TypeForwardedTo(typeof(PhotosManager))] [assembly: TypeForwardedTo(typeof(PhotoStats))] [assembly: TypeForwardedTo(typeof(PhotoViewScrollArea))] [assembly: TypeForwardedTo(typeof(Pickup))] [assembly: TypeForwardedTo(typeof(PlatformData))] [assembly: TypeForwardedTo(typeof(PlatformLanguages))] [assembly: TypeForwardedTo(typeof(PlatformSteam))] [assembly: TypeForwardedTo(typeof(PlayAudioOnEnable))] [assembly: TypeForwardedTo(typeof(Player))] [assembly: TypeForwardedTo(typeof(PlayerAchievements))] [assembly: TypeForwardedTo(typeof(PlayerAI))] [assembly: TypeForwardedTo(typeof(PlayerAIPath))] [assembly: TypeForwardedTo(typeof(PlayerAIWaypoint))] [assembly: TypeForwardedTo(typeof(PlayerCuff))] [assembly: TypeForwardedTo(typeof(PlayerIK))] [assembly: TypeForwardedTo(typeof(PlayerLogInputThing))] [assembly: TypeForwardedTo(typeof(PlayerMoveStyleProps))] [assembly: TypeForwardedTo(typeof(PlayerPhoneCameras))] [assembly: TypeForwardedTo(typeof(PlayerSpawner))] [assembly: TypeForwardedTo(typeof(PlayerStats))] [assembly: TypeForwardedTo(typeof(PlayerType))] [assembly: TypeForwardedTo(typeof(PlayerVisualEffects))] [assembly: TypeForwardedTo(typeof(Playlist))] [assembly: TypeForwardedTo(typeof(PlayListDictionary))] [assembly: TypeForwardedTo(typeof(PlaylistID))] [assembly: TypeForwardedTo(typeof(PlaylistIDComparer))] [assembly: TypeForwardedTo(typeof(PlaystationFiveBootstrap))] [assembly: TypeForwardedTo(typeof(PoliceCaptainIrene))] [assembly: TypeForwardedTo(typeof(PoliceCaptainIreneAnimInfo))] [assembly: TypeForwardedTo(typeof(PoliceCaptainSniper))] [assembly: TypeForwardedTo(typeof(PoliceCutscenes))] [assembly: TypeForwardedTo(typeof(PoliceTubeSpawner))] [assembly: TypeForwardedTo(typeof(PoliceWall))] [assembly: TypeForwardedTo(typeof(PoolableInstantiator))] [assembly: TypeForwardedTo(typeof(PoolableObjectToName))] [assembly: TypeForwardedTo(typeof(PoolableParticleEffects))] [assembly: TypeForwardedTo(typeof(PoolableState))] [assembly: TypeForwardedTo(typeof(PostProssesing))] [assembly: TypeForwardedTo(typeof(PreludeMusicStopper))] [assembly: TypeForwardedTo(typeof(ProgressableData))] [assembly: TypeForwardedTo(typeof(ProgressableDataFactory))] [assembly: TypeForwardedTo(typeof(ProgressableType))] [assembly: TypeForwardedTo(typeof(ProgressObject))] [assembly: TypeForwardedTo(typeof(Projectile))] [assembly: TypeForwardedTo(typeof(PromptButton))] [assembly: TypeForwardedTo(typeof(ProximityMine))] [assembly: TypeForwardedTo(typeof(PseudoGraffitiAbility))] [assembly: TypeForwardedTo(typeof(PublicToilet))] [assembly: TypeForwardedTo(typeof(QuickTurnAbility))] [assembly: TypeForwardedTo(typeof(RaceEncounter))] [assembly: TypeForwardedTo(typeof(RailRider))] [assembly: TypeForwardedTo(typeof(RailRiderLauncher))] [assembly: TypeForwardedTo(typeof(RateLimitWatcher))] [assembly: TypeForwardedTo(typeof(RawDataSerializer))] [assembly: TypeForwardedTo(typeof(RaycastGroundDetection))] [assembly: TypeForwardedTo(typeof(RecoverAbility))] [assembly: TypeForwardedTo(typeof(RegexGameTextFormatter))] [assembly: TypeForwardedTo(typeof(RegularErrorHandler))] [assembly: TypeForwardedTo(typeof(RenameFileTransaction))] [assembly: TypeForwardedTo(typeof(RestrictedArea))] [assembly: TypeForwardedTo(typeof(RewiredControllerGuidHandler))] [assembly: TypeForwardedTo(typeof(RewiredControllerHandler))] [assembly: TypeForwardedTo(typeof(RewiredInputUIActionBinder))] [assembly: TypeForwardedTo(typeof(RewiredMappingHandler))] [assembly: TypeForwardedTo(typeof(RewiredPlayerId))] [assembly: TypeForwardedTo(typeof(RewiredRemappingHandler))] [assembly: TypeForwardedTo(typeof(RewiredStructUtility))] [assembly: TypeForwardedTo(typeof(RewiredUtility))] [assembly: TypeForwardedTo(typeof(RigidbodyMoveAlongHandler))] [assembly: TypeForwardedTo(typeof(RotateObject))] [assembly: TypeForwardedTo(typeof(RuntimeHelper))] [assembly: TypeForwardedTo(typeof(SafeLocation))] [assembly: TypeForwardedTo(typeof(SaveDataUtility))] [assembly: TypeForwardedTo(typeof(SaveManager))] [assembly: TypeForwardedTo(typeof(SaveSettingsData))] [assembly: TypeForwardedTo(typeof(SaveSlotData))] [assembly: TypeForwardedTo(typeof(SaveSlotHandler))] [assembly: TypeForwardedTo(typeof(SaveSlotMenu))] [assembly: TypeForwardedTo(typeof(SaveTransaction<>))] [assembly: TypeForwardedTo(typeof(SceneExtensions))] [assembly: TypeForwardedTo(typeof(SceneInspector))] [assembly: TypeForwardedTo(typeof(SceneLibrary))] [assembly: TypeForwardedTo(typeof(SceneLoader))] [assembly: TypeForwardedTo(typeof(SceneObjectsRegister))] [assembly: TypeForwardedTo(typeof(ScoreEncounter))] [assembly: TypeForwardedTo(typeof(ScreenShakeType))] [assembly: TypeForwardedTo(typeof(SelectEnlargeButton))] [assembly: TypeForwardedTo(typeof(SequenceHandler))] [assembly: TypeForwardedTo(typeof(SequenceState))] [assembly: TypeForwardedTo(typeof(SerializableDictionary<, >))] [assembly: TypeForwardedTo(typeof(SerializedLibraryUtility))] [assembly: TypeForwardedTo(typeof(setclearflag))] [assembly: TypeForwardedTo(typeof(SettingsData))] [assembly: TypeForwardedTo(typeof(SettingsMultiOptionsUI))] [assembly: TypeForwardedTo(typeof(SettingsSliderUI))] [assembly: TypeForwardedTo(typeof(SfxApplyAttribute))] [assembly: TypeForwardedTo(typeof(SfxClip))] [assembly: TypeForwardedTo(typeof(SfxCollection))] [assembly: TypeForwardedTo(typeof(SfxCollectionDictionary))] [assembly: TypeForwardedTo(typeof(SfxCollectionID))] [assembly: TypeForwardedTo(typeof(SfxCollectionLoader))] [assembly: TypeForwardedTo(typeof(SfxCollectionPickerAttribute))] [assembly: TypeForwardedTo(typeof(SfxLibrary))] [assembly: TypeForwardedTo(typeof(SfxTimelineClip))] [assembly: TypeForwardedTo(typeof(ShieldCop))] [assembly: TypeForwardedTo(typeof(ShieldCopAnimInfo))] [assembly: TypeForwardedTo(typeof(ShuffleIndexQueue))] [assembly: TypeForwardedTo(typeof(Side))] [assembly: TypeForwardedTo(typeof(SinglePathMoveAlongHandler))] [assembly: TypeForwardedTo(typeof(SitAbility))] [assembly: TypeForwardedTo(typeof(SkateboardScrewPole))] [assembly: TypeForwardedTo(typeof(SkyboxRotate))] [assembly: TypeForwardedTo(typeof(SlideAbility))] [assembly: TypeForwardedTo(typeof(SlideButton))] [assembly: TypeForwardedTo(typeof(SnakeBossAnimationEventRelay))] [assembly: TypeForwardedTo(typeof(SnakeBossAnimInfo))] [assembly: TypeForwardedTo(typeof(SnakeBossChestImpactReceiver))] [assembly: TypeForwardedTo(typeof(SnakeBossNEW))] [assembly: TypeForwardedTo(typeof(SniperCop))] [assembly: TypeForwardedTo(typeof(SniperCopAnimInfo))] [assembly: TypeForwardedTo(typeof(SoloMoveAlongUpdater))] [assembly: TypeForwardedTo(typeof(SpecialAirAbility))] [assembly: TypeForwardedTo(typeof(SphereGroundDetection))] [assembly: TypeForwardedTo(typeof(SplashScreen))] [assembly: TypeForwardedTo(typeof(SplineBasedGrindLineGenerator))] [assembly: TypeForwardedTo(typeof(Stage))] [assembly: TypeForwardedTo(typeof(StageAchievements))] [assembly: TypeForwardedTo(typeof(StageAmbience))] [assembly: TypeForwardedTo(typeof(StageChunk))] [assembly: TypeForwardedTo(typeof(StageManager))] [assembly: TypeForwardedTo(typeof(StageProgress))] [assembly: TypeForwardedTo(typeof(StageTransition))] [assembly: TypeForwardedTo(typeof(StageTransitionProgress))] [assembly: TypeForwardedTo(typeof(StandbyAbility))] [assembly: TypeForwardedTo(typeof(StatTracker))] [assembly: TypeForwardedTo(typeof(StatTrackerInfo))] [assembly: TypeForwardedTo(typeof(StatTrackerMAX))] [assembly: TypeForwardedTo(typeof(StatTrackerMIN))] [assembly: TypeForwardedTo(typeof(StatTrackerREPLACE))] [assembly: TypeForwardedTo(typeof(StatTrackerSUM))] [assembly: TypeForwardedTo(typeof(Statusbar))] [assembly: TypeForwardedTo(typeof(SteamControllerGuidHandler))] [assembly: TypeForwardedTo(typeof(StorageSteam))] [assembly: TypeForwardedTo(typeof(Story))] [assembly: TypeForwardedTo(typeof(StoryBlinkAnimation))] [assembly: TypeForwardedTo(typeof(StoryManager))] [assembly: TypeForwardedTo(typeof(StoryObjectivePin))] [assembly: TypeForwardedTo(typeof(StreetLife))] [assembly: TypeForwardedTo(typeof(StreetLifeBehaviour))] [assembly: TypeForwardedTo(typeof(StreetLifeCluster))] [assembly: TypeForwardedTo(typeof(StreetLifeHot))] [assembly: TypeForwardedTo(typeof(StringExtensions))] [assembly: TypeForwardedTo(typeof(StyleSwitchBehaviour))] [assembly: TypeForwardedTo(typeof(StyleSwitchClip))] [assembly: TypeForwardedTo(typeof(StyleSwitchMenu))] [assembly: TypeForwardedTo(typeof(StyleSwitchResetTexture))] [assembly: TypeForwardedTo(typeof(StyleSwitchTrack))] [assembly: TypeForwardedTo(typeof(SunFlareGPU))] [assembly: TypeForwardedTo(typeof(SunGlare))] [assembly: TypeForwardedTo(typeof(SwirlSkyUpdater))] [assembly: TypeForwardedTo(typeof(SwitchCorruptedDataLoadError))] [assembly: TypeForwardedTo(typeof(SwitchCorruptedDataSaveError))] [assembly: TypeForwardedTo(typeof(SwitchCorruptedSaveSlotLoadError))] [assembly: TypeForwardedTo(typeof(SwitchErrorHandler))] [assembly: TypeForwardedTo(typeof(SwitchMoveStyleAbility))] [assembly: TypeForwardedTo(typeof(SwitchStageInstruction))] [assembly: TypeForwardedTo(typeof(SystemLanguageUtility))] [assembly: TypeForwardedTo(typeof(Tags))] [assembly: TypeForwardedTo(typeof(TalkAbility))] [assembly: TypeForwardedTo(typeof(TalkIcon))] [assembly: TypeForwardedTo(typeof(Tankwalker))] [assembly: TypeForwardedTo(typeof(TankwalkerAnimInfo))] [assembly: TypeForwardedTo(typeof(TargetVisual))] [assembly: TypeForwardedTo(typeof(Taxi))] [assembly: TypeForwardedTo(typeof(TaxiBehaviour))] [assembly: TypeForwardedTo(typeof(TaxiClip))] [assembly: TypeForwardedTo(typeof(TaxiTrack))] [assembly: TypeForwardedTo(typeof(TaxiUI))] [assembly: TypeForwardedTo(typeof(Teleport))] [assembly: TypeForwardedTo(typeof(TextMeshProBoldFormatter))] [assembly: TypeForwardedTo(typeof(TextMeshProButtonGlyphFormatter))] [assembly: TypeForwardedTo(typeof(TextMeshProButtonSpriteHandler))] [assembly: TypeForwardedTo(typeof(TextMeshProFont))] [assembly: TypeForwardedTo(typeof(TextMeshProGameTextLocalizer))] [assembly: TypeForwardedTo(typeof(TextMeshProHighlightFormatter))] [assembly: TypeForwardedTo(typeof(TextMeshProMenuButton))] [assembly: TypeForwardedTo(typeof(TextMeshProMenuButtonFont))] [assembly: TypeForwardedTo(typeof(TextMeshProNormalFormatter))] [assembly: TypeForwardedTo(typeof(TextMeshProSlider))] [assembly: TypeForwardedTo(typeof(TMProFontLocalizer))] [assembly: TypeForwardedTo(typeof(TMProLocalizationAddOn))] [assembly: TypeForwardedTo(typeof(TrackerType))] [assembly: TypeForwardedTo(typeof(TransactionsYieldInstruction))] [assembly: TypeForwardedTo(typeof(TransactionYieldInstruction))] [assembly: TypeForwardedTo(typeof(TransformExtentions))] [assembly: TypeForwardedTo(typeof(TransformMoveAlongHandler))] [assembly: TypeForwardedTo(typeof(TRInputId))] [assembly: TypeForwardedTo(typeof(TurretEnemy))] [assembly: TypeForwardedTo(typeof(TurretSpawner))] [assembly: TypeForwardedTo(typeof(UIAnimationController))] [assembly: TypeForwardedTo(typeof(UIButtonGlyphComponent))] [assembly: TypeForwardedTo(typeof(UILocalizationUtility))] [assembly: TypeForwardedTo(typeof(UIManager))] [assembly: TypeForwardedTo(typeof(UIPopup))] [assembly: TypeForwardedTo(typeof(UIPrompt))] [assembly: TypeForwardedTo(typeof(UnloadSceneInstruction))] [assembly: TypeForwardedTo(typeof(UnloadStageASyncInstruction))] [assembly: TypeForwardedTo(typeof(UnlockableSaveData))] [assembly: TypeForwardedTo(typeof(UpdateGraffitiOnOtherJuggledEnemies))] [assembly: TypeForwardedTo(typeof(UserAchievementsCacheLoader))] [assembly: TypeForwardedTo(typeof(UserIdSteam))] [assembly: TypeForwardedTo(typeof(UserInputHandler))] [assembly: TypeForwardedTo(typeof(UserPhotosDataLoader))] [assembly: TypeForwardedTo(typeof(UserPlayerStatsLoader))] [assembly: TypeForwardedTo(typeof(UserSaveSlotSaveDataLoader))] [assembly: TypeForwardedTo(typeof(UserSaveSlotSettingsDataLoader))] [assembly: TypeForwardedTo(typeof(UserSettingsSaveDataLoader))] [assembly: TypeForwardedTo(typeof(UserStatusHandler))] [assembly: TypeForwardedTo(typeof(UserSteam))] [assembly: TypeForwardedTo(typeof(Utility))] [assembly: TypeForwardedTo(typeof(VendingMachine))] [assembly: TypeForwardedTo(typeof(VersionUIHandler))] [assembly: TypeForwardedTo(typeof(VertAbility))] [assembly: TypeForwardedTo(typeof(VertexCache))] [assembly: TypeForwardedTo(typeof(VertShape))] [assembly: TypeForwardedTo(typeof(VideoSettings))] [assembly: TypeForwardedTo(typeof(VideoSettingsManager))] [assembly: TypeForwardedTo(typeof(VoicePriority))] [assembly: TypeForwardedTo(typeof(VoiceSfxTimelineClip))] [assembly: TypeForwardedTo(typeof(WallrunLine))] [assembly: TypeForwardedTo(typeof(WallrunLineAbility))] [assembly: TypeForwardedTo(typeof(WantedManager))] [assembly: TypeForwardedTo(typeof(WatermarkInitializer))] [assembly: TypeForwardedTo(typeof(WorldHandler))] [assembly: TypeForwardedTo(typeof(XmlHelper))] [assembly: TypeForwardedTo(typeof(YesNoButton))] [assembly: TypeForwardedTo(typeof(YesNoPanel))] [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 MapStation.Tools { public static class PluginInfo { public const string PLUGIN_GUID = "MapStation.Tools"; public const string PLUGIN_NAME = "MapStation.Tools"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace MapStation.TypeForwarder.Dependencies { public class AssemblyDependencies { } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }
System.IO.Compression.dll
Decompiled 2 months ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Buffers; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Diagnostics; using System.Globalization; using System.IO.Compression; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Security; using System.Security.Permissions; using System.Text; using System.Threading; using System.Threading.Tasks; using Microsoft.Win32.SafeHandles; using Unity; [assembly: CLSCompliant(true)] [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("System.IO.Compression.dll")] [assembly: AssemblyDefaultAlias("System.IO.Compression.dll")] [assembly: AssemblyDescription("System.IO.Compression.dll")] [assembly: AssemblyCompany("Mono development team")] [assembly: AssemblyProduct("Mono Common Language Infrastructure")] [assembly: AssemblyCopyright("(c) Various Mono authors")] [assembly: AssemblyInformationalVersion("4.6.57.0")] [assembly: AssemblyFileVersion("4.6.57.0")] [assembly: AssemblyDelaySign(true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("4.0.0.0")] [assembly: TypeForwardedTo(typeof(CompressionLevel))] [assembly: TypeForwardedTo(typeof(CompressionMode))] [assembly: TypeForwardedTo(typeof(DeflateStream))] [assembly: TypeForwardedTo(typeof(GZipStream))] [module: UnverifiableCode] internal static class Interop { internal static class Brotli { [DllImport("__Internal")] internal static extern SafeBrotliDecoderHandle BrotliDecoderCreateInstance(IntPtr allocFunc, IntPtr freeFunc, IntPtr opaque); [DllImport("__Internal")] internal unsafe static extern int BrotliDecoderDecompressStream(SafeBrotliDecoderHandle state, ref IntPtr availableIn, byte** nextIn, ref IntPtr availableOut, byte** nextOut, out IntPtr totalOut); [DllImport("__Internal")] internal unsafe static extern bool BrotliDecoderDecompress(IntPtr availableInput, byte* inBytes, ref IntPtr availableOutput, byte* outBytes); [DllImport("__Internal")] internal static extern void BrotliDecoderDestroyInstance(IntPtr state); [DllImport("__Internal")] internal static extern bool BrotliDecoderIsFinished(SafeBrotliDecoderHandle state); [DllImport("__Internal")] internal static extern SafeBrotliEncoderHandle BrotliEncoderCreateInstance(IntPtr allocFunc, IntPtr freeFunc, IntPtr opaque); [DllImport("__Internal")] internal static extern bool BrotliEncoderSetParameter(SafeBrotliEncoderHandle state, BrotliEncoderParameter parameter, uint value); [DllImport("__Internal")] internal unsafe static extern bool BrotliEncoderCompressStream(SafeBrotliEncoderHandle state, BrotliEncoderOperation op, ref IntPtr availableIn, byte** nextIn, ref IntPtr availableOut, byte** nextOut, out IntPtr totalOut); [DllImport("__Internal")] internal static extern bool BrotliEncoderHasMoreOutput(SafeBrotliEncoderHandle state); [DllImport("__Internal")] internal static extern void BrotliEncoderDestroyInstance(IntPtr state); [DllImport("__Internal")] internal unsafe static extern bool BrotliEncoderCompress(int quality, int window, int v, IntPtr availableInput, byte* inBytes, ref IntPtr availableOutput, byte* outBytes); } internal static class Libraries { internal const string CompressionNative = "__Internal"; } } internal static class Consts { public const string MonoCorlibVersion = "1A5E0066-58DC-428A-B21C-0AD6CDAE2789"; public const string MonoVersion = "6.13.0.0"; public const string MonoCompany = "Mono development team"; public const string MonoProduct = "Mono Common Language Infrastructure"; public const string MonoCopyright = "(c) Various Mono authors"; public const string FxVersion = "4.0.0.0"; public const string FxFileVersion = "4.6.57.0"; public const string EnvironmentVersion = "4.0.30319.42000"; public const string VsVersion = "0.0.0.0"; public const string VsFileVersion = "11.0.0.0"; private const string PublicKeyToken = "b77a5c561934e089"; public const string AssemblyI18N = "I18N, Version=4.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756"; public const string AssemblyMicrosoft_JScript = "Microsoft.JScript, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; public const string AssemblyMicrosoft_VisualStudio = "Microsoft.VisualStudio, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; public const string AssemblyMicrosoft_VisualStudio_Web = "Microsoft.VisualStudio.Web, Version=0.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; public const string AssemblyMicrosoft_VSDesigner = "Microsoft.VSDesigner, Version=0.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; public const string AssemblyMono_Http = "Mono.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756"; public const string AssemblyMono_Posix = "Mono.Posix, Version=4.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756"; public const string AssemblyMono_Security = "Mono.Security, Version=4.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756"; public const string AssemblyMono_Messaging_RabbitMQ = "Mono.Messaging.RabbitMQ, Version=4.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756"; public const string AssemblyCorlib = "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"; public const string AssemblySystem = "System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"; public const string AssemblySystem_Data = "System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"; public const string AssemblySystem_Design = "System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; public const string AssemblySystem_DirectoryServices = "System.DirectoryServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; public const string AssemblySystem_Drawing = "System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; public const string AssemblySystem_Drawing_Design = "System.Drawing.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; public const string AssemblySystem_Messaging = "System.Messaging, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; public const string AssemblySystem_Security = "System.Security, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; public const string AssemblySystem_ServiceProcess = "System.ServiceProcess, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; public const string AssemblySystem_Web = "System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; public const string AssemblySystem_Windows_Forms = "System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"; public const string AssemblySystem_2_0 = "System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"; public const string AssemblySystemCore_3_5 = "System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"; public const string AssemblySystem_Core = "System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"; public const string WindowsBase_3_0 = "WindowsBase, Version=3.0.0.0, PublicKeyToken=31bf3856ad364e35"; public const string AssemblyWindowsBase = "WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"; public const string AssemblyPresentationCore_3_5 = "PresentationCore, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"; public const string AssemblyPresentationCore_4_0 = "PresentationCore, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"; public const string AssemblyPresentationFramework_3_5 = "PresentationFramework, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"; public const string AssemblySystemServiceModel_3_0 = "System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"; } internal static class SR { public const string ArgumentOutOfRange_Enum = "Enum value was out of legal range."; public const string ArgumentOutOfRange_NeedPosNum = "Positive number required."; public const string CannotReadFromDeflateStream = "Reading from the compression stream is not supported."; public const string CannotWriteToDeflateStream = "Writing to the compression stream is not supported."; public const string GenericInvalidData = "Found invalid data while decoding."; public const string InvalidArgumentOffsetCount = "Offset plus count is larger than the length of target array."; public const string InvalidBeginCall = "Only one asynchronous reader or writer is allowed time at one time."; public const string InvalidBlockLength = "Block length does not match with its complement."; public const string InvalidHuffmanData = "Failed to construct a huffman tree using the length array. The stream might be corrupted."; public const string NotSupported = "This operation is not supported."; public const string NotSupported_UnreadableStream = "Stream does not support reading."; public const string NotSupported_UnwritableStream = "Stream does not support writing."; public const string ObjectDisposed_StreamClosed = "Can not access a closed Stream."; public const string UnknownBlockType = "Unknown block type. Stream might be corrupted."; public const string UnknownState = "Decoder is in some unknown state. This might be caused by corrupted data."; public const string ZLibErrorDLLLoadError = "The underlying compression routine could not be loaded correctly."; public const string ZLibErrorInconsistentStream = "The stream state of the underlying compression routine is inconsistent."; public const string ZLibErrorIncorrectInitParameters = "The underlying compression routine received incorrect initialization parameters."; public const string ZLibErrorNotEnoughMemory = "The underlying compression routine could not reserve sufficient memory."; public const string ZLibErrorVersionMismatch = "The version of the underlying compression routine does not match expected version."; public const string ZLibErrorUnexpected = "The underlying compression routine returned an unexpected error code."; public const string ArgumentNeedNonNegative = "The argument must be non-negative."; public const string CannotBeEmpty = "String cannot be empty."; public const string CDCorrupt = "Central Directory corrupt."; public const string CentralDirectoryInvalid = "Central Directory is invalid."; public const string CreateInReadMode = "Cannot create entries on an archive opened in read mode."; public const string CreateModeCapabilities = "Cannot use create mode on a non-writable stream."; public const string CreateModeCreateEntryWhileOpen = "Entries cannot be created while previously created entries are still open."; public const string CreateModeWriteOnceAndOneEntryAtATime = "Entries in create mode may only be written to once, and only one entry may be held open at a time."; public const string DateTimeOutOfRange = "The DateTimeOffset specified cannot be converted into a Zip file timestamp."; public const string DeletedEntry = "Cannot modify deleted entry."; public const string DeleteOnlyInUpdate = "Delete can only be used when the archive is in Update mode."; public const string DeleteOpenEntry = "Cannot delete an entry currently open for writing."; public const string EntriesInCreateMode = "Cannot access entries in Create mode."; public const string EntryNameEncodingNotSupported = "The specified entry name encoding is not supported."; public const string EntryNamesTooLong = "Entry names cannot require more than 2^16 bits."; public const string EntryTooLarge = "Entries larger than 4GB are not supported in Update mode."; public const string EOCDNotFound = "End of Central Directory record could not be found."; public const string FieldTooBigCompressedSize = "Compressed Size cannot be held in an Int64."; public const string FieldTooBigLocalHeaderOffset = "Local Header Offset cannot be held in an Int64."; public const string FieldTooBigNumEntries = "Number of Entries cannot be held in an Int64."; public const string FieldTooBigOffsetToCD = "Offset to Central Directory cannot be held in an Int64."; public const string FieldTooBigOffsetToZip64EOCD = "Offset to Zip64 End Of Central Directory record cannot be held in an Int64."; public const string FieldTooBigStartDiskNumber = "Start Disk Number cannot be held in an Int64."; public const string FieldTooBigUncompressedSize = "Uncompressed Size cannot be held in an Int64."; public const string FrozenAfterWrite = "Cannot modify entry in Create mode after entry has been opened for writing."; public const string HiddenStreamName = "A stream from ZipArchiveEntry has been disposed."; public const string LengthAfterWrite = "Length properties are unavailable once an entry has been opened for writing."; public const string LocalFileHeaderCorrupt = "A local file header is corrupt."; public const string NumEntriesWrong = "Number of entries expected in End Of Central Directory does not correspond to number of entries in Central Directory."; public const string OffsetLengthInvalid = "The offset and length parameters are not valid for the array that was given."; public const string ReadingNotSupported = "This stream from ZipArchiveEntry does not support reading."; public const string ReadModeCapabilities = "Cannot use read mode on a non-readable stream."; public const string ReadOnlyArchive = "Cannot modify read-only archive."; public const string SeekingNotSupported = "This stream from ZipArchiveEntry does not support seeking."; public const string SetLengthRequiresSeekingAndWriting = "SetLength requires a stream that supports seeking and writing."; public const string SplitSpanned = "Split or spanned archives are not supported."; public const string UnexpectedEndOfStream = "Zip file corrupt: unexpected end of stream reached."; public const string UnsupportedCompression = "The archive entry was compressed using an unsupported compression method."; public const string UnsupportedCompressionMethod = "The archive entry was compressed using {0} and is not supported."; public const string UpdateModeCapabilities = "Update mode requires a stream with read, write, and seek capabilities."; public const string UpdateModeOneStream = "Entries cannot be opened multiple times in Update mode."; public const string WritingNotSupported = "This stream from ZipArchiveEntry does not support writing."; public const string Zip64EOCDNotWhereExpected = "Zip 64 End of Central Directory Record not where indicated."; public const string Argument_InvalidPathChars = "Illegal characters in path '{0}'."; public const string Stream_FalseCanRead = "Stream does not support reading."; public const string Stream_FalseCanWrite = "Stream does not support writing."; public const string BrotliEncoder_Create = "Failed to create BrotliEncoder instance"; public const string BrotliEncoder_Disposed = "Can not access a closed Encoder."; public const string BrotliEncoder_Quality = "Provided BrotliEncoder Quality of {0} is not between the minimum value of {1} and the maximum value of {2}"; public const string BrotliEncoder_Window = "Provided BrotliEncoder Window of {0} is not between the minimum value of {1} and the maximum value of {2}"; public const string BrotliEncoder_InvalidSetParameter = "The BrotliEncoder {0} can not be changed at current encoder state."; public const string BrotliDecoder_Create = "Failed to create BrotliDecoder instance"; public const string BrotliDecoder_Error = "Decoder threw unexpected error: {0}"; public const string BrotliDecoder_Disposed = "Can not access a closed Decoder."; public const string BrotliStream_Compress_UnsupportedOperation = "Can not perform Read operations on a BrotliStream constructed with CompressionMode.Compress."; public const string BrotliStream_Compress_InvalidData = "Encoder ran into invalid data."; public const string BrotliStream_Decompress_UnsupportedOperation = "Can not perform Write operations on a BrotliStream constructed with CompressionMode.Decompress."; public const string BrotliStream_Decompress_InvalidData = "Decoder ran into invalid data."; public const string BrotliStream_Decompress_InvalidStream = "BrotliStream.BaseStream returned more bytes than requested in Read."; internal static string GetString(string name, params object[] args) { return GetString(CultureInfo.InvariantCulture, name, args); } internal static string GetString(CultureInfo culture, string name, params object[] args) { return string.Format(culture, name, args); } internal static string GetString(string name) { return name; } internal static string GetString(CultureInfo culture, string name) { return name; } internal static string Format(string resourceFormat, params object[] args) { if (args != null) { return string.Format(CultureInfo.InvariantCulture, resourceFormat, args); } return resourceFormat; } internal static string Format(string resourceFormat, object p1) { return string.Format(CultureInfo.InvariantCulture, resourceFormat, p1); } internal static string Format(string resourceFormat, object p1, object p2) { return string.Format(CultureInfo.InvariantCulture, resourceFormat, p1, p2); } internal static string Format(CultureInfo ci, string resourceFormat, object p1, object p2) { return string.Format(ci, resourceFormat, p1, p2); } internal static string Format(string resourceFormat, object p1, object p2, object p3) { return string.Format(CultureInfo.InvariantCulture, resourceFormat, p1, p2, p3); } internal static string GetResourceString(string str) { return str; } } namespace System.Runtime.CompilerServices { internal class FriendAccessAllowedAttribute : Attribute { } } namespace System.IO.Compression { public sealed class BrotliStream : Stream { [StructLayout(LayoutKind.Auto)] [CompilerGenerated] private struct <FinishReadAsyncMemory>d__41 : IAsyncStateMachine { public int <>1__state; public AsyncValueTaskMethodBuilder<int> <>t__builder; public BrotliStream <>4__this; public CancellationToken cancellationToken; public Memory<byte> buffer; private int <totalWritten>5__2; private ConfiguredValueTaskAwaiter<int> <>u__1; private void MoveNext() { //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_0025: 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) //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Invalid comparison between Unknown and I4 //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Invalid comparison between Unknown and I4 //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; BrotliStream brotliStream = <>4__this; int result; try { if (num != 0) { brotliStream.AsyncOperationStarting(); } try { OperationStatus val; if (num != 0) { <totalWritten>5__2 = 0; _ = Memory<byte>.Empty; val = (OperationStatus)1; goto IL_0215; } ConfiguredValueTaskAwaiter<int> awaiter = <>u__1; <>u__1 = default(ConfiguredValueTaskAwaiter<int>); num = (<>1__state = -1); goto IL_0158; IL_0215: int num2; if (buffer.Length > 0 && (int)val != 0) { if ((int)val == 2) { if (brotliStream._bufferCount > 0 && brotliStream._bufferOffset != 0) { MemoryExtensions.AsSpan<byte>(brotliStream._buffer, brotliStream._bufferOffset, brotliStream._bufferCount).CopyTo(Span<byte>.op_Implicit(brotliStream._buffer)); } brotliStream._bufferOffset = 0; num2 = 0; goto IL_00ab; } goto IL_017a; } goto IL_0229; IL_00ab: bool flag = brotliStream._bufferCount < brotliStream._buffer.Length; if (flag) { awaiter = brotliStream._stream.ReadAsync(new Memory<byte>(brotliStream._buffer, brotliStream._bufferCount, brotliStream._buffer.Length - brotliStream._bufferCount), default(CancellationToken)).ConfigureAwait(false).GetAwaiter(); if (!awaiter.IsCompleted) { num = (<>1__state = 0); <>u__1 = awaiter; <>t__builder.AwaitUnsafeOnCompleted<ConfiguredValueTaskAwaiter<int>, <FinishReadAsyncMemory>d__41>(ref awaiter, ref this); return; } goto IL_0158; } goto IL_0167; IL_0158: flag = (num2 = awaiter.GetResult()) > 0; goto IL_0167; IL_0167: if (flag) { brotliStream._bufferCount += num2; if (brotliStream._bufferCount > brotliStream._buffer.Length) { throw new InvalidDataException("BrotliStream.BaseStream returned more bytes than requested in Read."); } goto IL_00ab; } if (brotliStream._bufferCount > 0) { goto IL_017a; } goto IL_0229; IL_0229: result = <totalWritten>5__2; goto end_IL_0018; IL_017a: cancellationToken.ThrowIfCancellationRequested(); val = brotliStream._decoder.Decompress(Span<byte>.op_Implicit(MemoryExtensions.AsSpan<byte>(brotliStream._buffer, brotliStream._bufferOffset, brotliStream._bufferCount)), buffer.Span, out var bytesConsumed, out var bytesWritten); if ((int)val == 3) { throw new InvalidOperationException("Decoder ran into invalid data."); } if (bytesConsumed > 0) { brotliStream._bufferOffset += bytesConsumed; brotliStream._bufferCount -= bytesConsumed; } if (bytesWritten > 0) { <totalWritten>5__2 += bytesWritten; buffer = buffer.Slice(bytesWritten); } goto IL_0215; end_IL_0018:; } finally { if (num < 0) { brotliStream.AsyncOperationCompleting(); } } } catch (Exception exception) { <>1__state = -2; <>t__builder.SetException(exception); return; } <>1__state = -2; <>t__builder.SetResult(result); } void IAsyncStateMachine.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext this.MoveNext(); } [DebuggerHidden] private void SetStateMachine(IAsyncStateMachine stateMachine) { <>t__builder.SetStateMachine(stateMachine); } void IAsyncStateMachine.SetStateMachine(IAsyncStateMachine stateMachine) { //ILSpy generated this explicit interface implementation from .override directive in SetStateMachine this.SetStateMachine(stateMachine); } } private const int DefaultInternalBufferSize = 65520; private Stream _stream; private readonly byte[] _buffer; private readonly bool _leaveOpen; private readonly CompressionMode _mode; private int _activeAsyncOperation; private BrotliDecoder _decoder; private int _bufferOffset; private int _bufferCount; private BrotliEncoder _encoder; public Stream BaseStream => _stream; public override bool CanRead { get { //IL_0001: Unknown result type (might be due to invalid IL or missing references) if ((int)_mode == 0 && _stream != null) { return _stream.CanRead; } return false; } } public override bool CanWrite { get { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Invalid comparison between Unknown and I4 if ((int)_mode == 1 && _stream != null) { return _stream.CanWrite; } return false; } } public override bool CanSeek => false; public override long Length { get { throw new NotSupportedException(); } } public override long Position { get { throw new NotSupportedException(); } set { throw new NotSupportedException(); } } private bool AsyncOperationIsActive => _activeAsyncOperation != 0; public BrotliStream(Stream stream, CompressionMode mode) : this(stream, mode, leaveOpen: false) { }//IL_0002: Unknown result type (might be due to invalid IL or missing references) public BrotliStream(Stream stream, CompressionMode mode, bool leaveOpen) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Invalid comparison between Unknown and I4 //IL_005c: 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) if (stream == null) { throw new ArgumentNullException("stream"); } if ((int)mode != 0) { if ((int)mode != 1) { throw new ArgumentException("Enum value was out of legal range.", "mode"); } if (!stream.CanWrite) { throw new ArgumentException("Stream does not support writing.", "stream"); } } else if (!stream.CanRead) { throw new ArgumentException("Stream does not support reading.", "stream"); } _mode = mode; _stream = stream; _leaveOpen = leaveOpen; _buffer = new byte[65520]; } private void EnsureNotDisposed() { if (_stream == null) { throw new ObjectDisposedException("stream", "Can not access a closed Stream."); } } protected override void Dispose(bool disposing) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Invalid comparison between Unknown and I4 //IL_0015: Unknown result type (might be due to invalid IL or missing references) try { if (disposing && _stream != null) { if ((int)_mode == 1) { WriteCore(ReadOnlySpan<byte>.Empty, isFinalBlock: true); } if (!_leaveOpen) { _stream.Dispose(); } } } finally { _stream = null; _encoder.Dispose(); _decoder.Dispose(); base.Dispose(disposing); } } private static void ValidateParameters(byte[] array, int offset, int count) { if (array == null) { throw new ArgumentNullException("array"); } if (offset < 0) { throw new ArgumentOutOfRangeException("offset", "Positive number required."); } if (count < 0) { throw new ArgumentOutOfRangeException("count", "Positive number required."); } if (array.Length - offset < count) { throw new ArgumentException("Offset plus count is larger than the length of target array."); } } public override long Seek(long offset, SeekOrigin origin) { throw new NotSupportedException(); } public override void SetLength(long value) { throw new NotSupportedException(); } private void EnsureNoActiveAsyncOperation() { if (AsyncOperationIsActive) { ThrowInvalidBeginCall(); } } private void AsyncOperationStarting() { if (Interlocked.CompareExchange(ref _activeAsyncOperation, 1, 0) != 0) { ThrowInvalidBeginCall(); } } private void AsyncOperationCompleting() { Interlocked.CompareExchange(ref _activeAsyncOperation, 0, 1); } private static void ThrowInvalidBeginCall() { throw new InvalidOperationException("Only one asynchronous reader or writer is allowed time at one time."); } public override int Read(byte[] buffer, int offset, int count) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) ValidateParameters(buffer, offset, count); return ((Stream)this).Read(new Span<byte>(buffer, offset, count)); } public int Read(Span<byte> buffer) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Invalid comparison between Unknown and I4 //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Invalid comparison between Unknown and I4 //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_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) if ((int)_mode != 0) { throw new InvalidOperationException("Can not perform Read operations on a BrotliStream constructed with CompressionMode.Compress."); } EnsureNotDisposed(); int num = 0; OperationStatus val = (OperationStatus)1; while (buffer.Length > 0 && (int)val != 0) { if ((int)val == 2) { if (_bufferCount > 0 && _bufferOffset != 0) { MemoryExtensions.AsSpan<byte>(_buffer, _bufferOffset, _bufferCount).CopyTo(Span<byte>.op_Implicit(_buffer)); } _bufferOffset = 0; int num2 = 0; while (_bufferCount < _buffer.Length && (num2 = _stream.Read(_buffer, _bufferCount, _buffer.Length - _bufferCount)) > 0) { _bufferCount += num2; if (_bufferCount > _buffer.Length) { throw new InvalidDataException("BrotliStream.BaseStream returned more bytes than requested in Read."); } } if (_bufferCount <= 0) { break; } } val = _decoder.Decompress(Span<byte>.op_Implicit(MemoryExtensions.AsSpan<byte>(_buffer, _bufferOffset, _bufferCount)), buffer, out var bytesConsumed, out var bytesWritten); if ((int)val == 3) { throw new InvalidOperationException("Decoder ran into invalid data."); } if (bytesConsumed > 0) { _bufferOffset += bytesConsumed; _bufferCount -= bytesConsumed; } if (bytesWritten > 0) { num += bytesWritten; buffer = buffer.Slice(bytesWritten); } } return num; } public override IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback asyncCallback, object asyncState) { return System.Threading.Tasks.TaskToApm.Begin(ReadAsync(buffer, offset, count, CancellationToken.None), asyncCallback, asyncState); } public override int EndRead(IAsyncResult asyncResult) { return System.Threading.Tasks.TaskToApm.End<int>(asyncResult); } public override Task<int> ReadAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) ValidateParameters(buffer, offset, count); return ((Stream)this).ReadAsync(new Memory<byte>(buffer, offset, count), cancellationToken).AsTask(); } public ValueTask<int> ReadAsync(Memory<byte> buffer, CancellationToken cancellationToken = default(CancellationToken)) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) if ((int)_mode != 0) { throw new InvalidOperationException("Can not perform Read operations on a BrotliStream constructed with CompressionMode.Compress."); } EnsureNoActiveAsyncOperation(); EnsureNotDisposed(); if (cancellationToken.IsCancellationRequested) { return new ValueTask<int>(Task.FromCanceled<int>(cancellationToken)); } return FinishReadAsyncMemory(buffer, cancellationToken); } [AsyncStateMachine(typeof(<FinishReadAsyncMemory>d__41))] private ValueTask<int> FinishReadAsyncMemory(Memory<byte> buffer, CancellationToken cancellationToken) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: 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) <FinishReadAsyncMemory>d__41 <FinishReadAsyncMemory>d__ = default(<FinishReadAsyncMemory>d__41); <FinishReadAsyncMemory>d__.<>4__this = this; <FinishReadAsyncMemory>d__.buffer = buffer; <FinishReadAsyncMemory>d__.cancellationToken = cancellationToken; <FinishReadAsyncMemory>d__.<>t__builder = AsyncValueTaskMethodBuilder<int>.Create(); <FinishReadAsyncMemory>d__.<>1__state = -1; <FinishReadAsyncMemory>d__.<>t__builder.Start<<FinishReadAsyncMemory>d__41>(ref <FinishReadAsyncMemory>d__); return <FinishReadAsyncMemory>d__.<>t__builder.Task; } public BrotliStream(Stream stream, CompressionLevel compressionLevel) : this(stream, compressionLevel, leaveOpen: false) { }//IL_0002: Unknown result type (might be due to invalid IL or missing references) public BrotliStream(Stream stream, CompressionLevel compressionLevel, bool leaveOpen) : this(stream, (CompressionMode)1, leaveOpen) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) _encoder.SetQuality(BrotliUtils.GetQualityFromCompressionLevel(compressionLevel)); } public override void Write(byte[] buffer, int offset, int count) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) ValidateParameters(buffer, offset, count); WriteCore(new ReadOnlySpan<byte>(buffer, offset, count)); } public void Write(ReadOnlySpan<byte> buffer) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) WriteCore(buffer); } internal void WriteCore(ReadOnlySpan<byte> buffer, bool isFinalBlock = false) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Invalid comparison between Unknown and I4 //IL_001b: 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_007e: Invalid comparison between Unknown and I4 //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //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_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: 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) //IL_007a: Unknown result type (might be due to invalid IL or missing references) if ((int)_mode != 1) { throw new InvalidOperationException("Can not perform Write operations on a BrotliStream constructed with CompressionMode.Decompress."); } EnsureNotDisposed(); OperationStatus val = (OperationStatus)1; Span<byte> destination = default(Span<byte>); destination..ctor(_buffer); while ((int)val == 1) { int bytesConsumed = 0; int bytesWritten = 0; val = _encoder.Compress(buffer, destination, out bytesConsumed, out bytesWritten, isFinalBlock); if ((int)val == 3) { throw new InvalidOperationException("Encoder ran into invalid data."); } if (bytesWritten > 0) { _stream.Write(Span<byte>.op_Implicit(destination.Slice(0, bytesWritten))); } if (bytesConsumed > 0) { buffer = buffer.Slice(bytesConsumed); } } } public override IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback asyncCallback, object asyncState) { return System.Threading.Tasks.TaskToApm.Begin(WriteAsync(buffer, offset, count, CancellationToken.None), asyncCallback, asyncState); } public override void EndWrite(IAsyncResult asyncResult) { System.Threading.Tasks.TaskToApm.End(asyncResult); } public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) ValidateParameters(buffer, offset, count); ValueTask val = ((Stream)this).WriteAsync(new ReadOnlyMemory<byte>(buffer, offset, count), cancellationToken); return ((ValueTask)(ref val)).AsTask(); } public ValueTask WriteAsync(ReadOnlyMemory<byte> buffer, CancellationToken cancellationToken = default(CancellationToken)) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Invalid comparison between Unknown and I4 //IL_002a: 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) if ((int)_mode != 1) { throw new InvalidOperationException("Can not perform Write operations on a BrotliStream constructed with CompressionMode.Decompress."); } EnsureNoActiveAsyncOperation(); EnsureNotDisposed(); return new ValueTask(cancellationToken.IsCancellationRequested ? Task.FromCanceled<int>(cancellationToken) : WriteAsyncMemoryCore(buffer, cancellationToken)); } private async Task WriteAsyncMemoryCore(ReadOnlyMemory<byte> buffer, CancellationToken cancellationToken) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) AsyncOperationStarting(); try { OperationStatus lastResult = (OperationStatus)1; Memory<byte> destination = default(Memory<byte>); while ((int)lastResult == 1) { destination..ctor(_buffer); int bytesConsumed = 0; int bytesWritten = 0; lastResult = _encoder.Compress(buffer, destination, out bytesConsumed, out bytesWritten, isFinalBlock: false); if ((int)lastResult == 3) { throw new InvalidOperationException("Encoder ran into invalid data."); } if (bytesConsumed > 0) { buffer = buffer.Slice(bytesConsumed); } if (bytesWritten > 0) { ValueTask val = _stream.WriteAsync(new ReadOnlyMemory<byte>(_buffer, 0, bytesWritten), cancellationToken); await ((ValueTask)(ref val)).ConfigureAwait(false); } } } finally { AsyncOperationCompleting(); } } public override void Flush() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Invalid comparison between Unknown and I4 //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Invalid comparison between Unknown and I4 //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: 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_0053: Invalid comparison between Unknown and I4 //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) EnsureNotDisposed(); if ((int)_mode != 1 || _encoder._state == null || _encoder._state.IsClosed) { return; } OperationStatus val = (OperationStatus)1; Span<byte> destination = default(Span<byte>); destination..ctor(_buffer); while ((int)val == 1) { int bytesWritten = 0; val = _encoder.Flush(destination, out bytesWritten); if ((int)val == 3) { throw new InvalidDataException("Encoder ran into invalid data."); } if (bytesWritten > 0) { _stream.Write(Span<byte>.op_Implicit(destination.Slice(0, bytesWritten))); } } } public override Task FlushAsync(CancellationToken cancellationToken) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Invalid comparison between Unknown and I4 EnsureNoActiveAsyncOperation(); EnsureNotDisposed(); if (cancellationToken.IsCancellationRequested) { return Task.FromCanceled(cancellationToken); } if ((int)_mode == 1) { return FlushAsyncCore(cancellationToken); } return Task.CompletedTask; } private async Task FlushAsyncCore(CancellationToken cancellationToken) { AsyncOperationStarting(); try { if (_encoder._state == null || _encoder._state.IsClosed) { return; } OperationStatus lastResult = (OperationStatus)1; Memory<byte> destination = default(Memory<byte>); while ((int)lastResult == 1) { destination..ctor(_buffer); int bytesWritten = 0; lastResult = _encoder.Flush(destination, out bytesWritten); if ((int)lastResult == 3) { throw new InvalidDataException("Encoder ran into invalid data."); } if (bytesWritten > 0) { ValueTask val = _stream.WriteAsync(Memory<byte>.op_Implicit(destination.Slice(0, bytesWritten)), cancellationToken); await ((ValueTask)(ref val)).ConfigureAwait(false); } } } finally { AsyncOperationCompleting(); } } } internal static class BrotliUtils { public const int WindowBits_Min = 10; public const int WindowBits_Default = 22; public const int WindowBits_Max = 24; public const int Quality_Min = 0; public const int Quality_Default = 11; public const int Quality_Max = 11; public const int MaxInputSize = 2147483132; internal static int GetQualityFromCompressionLevel(CompressionLevel level) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected I4, but got Unknown //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected I4, but got Unknown return (int)level switch { 0 => 11, 2 => 0, 1 => 1, _ => (int)level, }; } } public struct BrotliDecoder : IDisposable { private SafeBrotliDecoderHandle _state; private bool _disposed; internal void InitializeDecoder() { _state = global::Interop.Brotli.BrotliDecoderCreateInstance(IntPtr.Zero, IntPtr.Zero, IntPtr.Zero); if (_state.IsInvalid) { throw new IOException("Failed to create BrotliDecoder instance"); } } internal void EnsureInitialized() { EnsureNotDisposed(); if (_state == null) { InitializeDecoder(); } } public void Dispose() { _disposed = true; _state?.Dispose(); } private void EnsureNotDisposed() { if (_disposed) { throw new ObjectDisposedException("BrotliDecoder", "Can not access a closed Decoder."); } } public unsafe OperationStatus Decompress(ReadOnlySpan<byte> source, Span<byte> destination, out int bytesConsumed, out int bytesWritten) { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: 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_00e3: Unknown result type (might be due to invalid IL or missing references) EnsureInitialized(); bytesConsumed = 0; bytesWritten = 0; if (!global::Interop.Brotli.BrotliDecoderIsFinished(_state)) { IntPtr availableOut = (IntPtr)destination.Length; IntPtr availableIn = (IntPtr)source.Length; while ((int)availableOut > 0) { fixed (byte* ptr = &MemoryMarshal.GetReference<byte>(source)) { fixed (byte* ptr3 = &MemoryMarshal.GetReference<byte>(destination)) { byte* ptr2 = ptr; byte* ptr4 = ptr3; IntPtr totalOut; int num = global::Interop.Brotli.BrotliDecoderDecompressStream(_state, ref availableIn, &ptr2, ref availableOut, &ptr4, out totalOut); if (num == 0) { return (OperationStatus)3; } bytesConsumed += source.Length - (int)availableIn; bytesWritten += destination.Length - (int)availableOut; switch (num) { case 1: return (OperationStatus)0; case 3: return (OperationStatus)1; } source = source.Slice(source.Length - (int)availableIn); destination = destination.Slice(destination.Length - (int)availableOut); if (num == 2 && source.Length == 0) { return (OperationStatus)2; } } } } return (OperationStatus)1; } return (OperationStatus)0; } public unsafe static bool TryDecompress(ReadOnlySpan<byte> source, Span<byte> destination, out int bytesWritten) { //IL_0000: 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) fixed (byte* inBytes = &MemoryMarshal.GetReference<byte>(source)) { fixed (byte* outBytes = &MemoryMarshal.GetReference<byte>(destination)) { IntPtr availableOutput = (IntPtr)destination.Length; bool result = global::Interop.Brotli.BrotliDecoderDecompress((IntPtr)source.Length, inBytes, ref availableOutput, outBytes); bytesWritten = (int)availableOutput; return result; } } } } public struct BrotliEncoder : IDisposable { internal SafeBrotliEncoderHandle _state; private bool _disposed; public BrotliEncoder(int quality, int window) { _disposed = false; _state = global::Interop.Brotli.BrotliEncoderCreateInstance(IntPtr.Zero, IntPtr.Zero, IntPtr.Zero); if (_state.IsInvalid) { throw new IOException("Failed to create BrotliEncoder instance"); } SetQuality(quality); SetWindow(window); } internal void InitializeEncoder() { EnsureNotDisposed(); _state = global::Interop.Brotli.BrotliEncoderCreateInstance(IntPtr.Zero, IntPtr.Zero, IntPtr.Zero); if (_state.IsInvalid) { throw new IOException("Failed to create BrotliEncoder instance"); } } internal void EnsureInitialized() { EnsureNotDisposed(); if (_state == null) { InitializeEncoder(); } } public void Dispose() { _disposed = true; _state?.Dispose(); } private void EnsureNotDisposed() { if (_disposed) { throw new ObjectDisposedException("BrotliEncoder", "Can not access a closed Encoder."); } } internal void SetQuality(int quality) { EnsureNotDisposed(); if (_state == null || _state.IsInvalid || _state.IsClosed) { InitializeEncoder(); } if (quality < 0 || quality > 11) { throw new ArgumentOutOfRangeException("quality", SR.Format("Provided BrotliEncoder Quality of {0} is not between the minimum value of {1} and the maximum value of {2}", quality, 0, 11)); } if (!global::Interop.Brotli.BrotliEncoderSetParameter(_state, BrotliEncoderParameter.Quality, (uint)quality)) { throw new InvalidOperationException(SR.Format("The BrotliEncoder {0} can not be changed at current encoder state.", "Quality")); } } internal void SetWindow(int window) { EnsureNotDisposed(); if (_state == null || _state.IsInvalid || _state.IsClosed) { InitializeEncoder(); } if (window < 10 || window > 24) { throw new ArgumentOutOfRangeException("window", SR.Format("Provided BrotliEncoder Window of {0} is not between the minimum value of {1} and the maximum value of {2}", window, 10, 24)); } if (!global::Interop.Brotli.BrotliEncoderSetParameter(_state, BrotliEncoderParameter.LGWin, (uint)window)) { throw new InvalidOperationException(SR.Format("The BrotliEncoder {0} can not be changed at current encoder state.", "Window")); } } public static int GetMaxCompressedLength(int length) { if (length < 0 || length > 2147483132) { throw new ArgumentOutOfRangeException("length"); } if (length == 0) { return 1; } int num = length >> 24; int num2 = (((length & 0xFFFFFF) > 1048576) ? 4 : 3); int num3 = 2 + 4 * num + num2 + 1; return length + num3; } internal OperationStatus Flush(Memory<byte> destination, out int bytesWritten) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) return Flush(destination.Span, out bytesWritten); } public OperationStatus Flush(Span<byte> destination, out int bytesWritten) { //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_000b: Unknown result type (might be due to invalid IL or missing references) int bytesConsumed; return Compress(ReadOnlySpan<byte>.Empty, destination, out bytesConsumed, out bytesWritten, BrotliEncoderOperation.Flush); } internal OperationStatus Compress(ReadOnlyMemory<byte> source, Memory<byte> destination, out int bytesConsumed, out int bytesWritten, bool isFinalBlock) { //IL_0003: 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) //IL_0014: Unknown result type (might be due to invalid IL or missing references) return Compress(source.Span, destination.Span, out bytesConsumed, out bytesWritten, isFinalBlock); } public OperationStatus Compress(ReadOnlySpan<byte> source, Span<byte> destination, out int bytesConsumed, out int bytesWritten, bool isFinalBlock) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) return Compress(source, destination, out bytesConsumed, out bytesWritten, isFinalBlock ? BrotliEncoderOperation.Finish : BrotliEncoderOperation.Process); } internal unsafe OperationStatus Compress(ReadOnlySpan<byte> source, Span<byte> destination, out int bytesConsumed, out int bytesWritten, BrotliEncoderOperation operation) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: 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_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: 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) EnsureInitialized(); bytesWritten = 0; bytesConsumed = 0; IntPtr availableOut = (IntPtr)destination.Length; IntPtr availableIn = (IntPtr)source.Length; while ((int)availableOut > 0) { fixed (byte* ptr = &MemoryMarshal.GetReference<byte>(source)) { fixed (byte* ptr3 = &MemoryMarshal.GetReference<byte>(destination)) { byte* ptr2 = ptr; byte* ptr4 = ptr3; if (!global::Interop.Brotli.BrotliEncoderCompressStream(_state, operation, ref availableIn, &ptr2, ref availableOut, &ptr4, out var _)) { return (OperationStatus)3; } bytesConsumed += source.Length - (int)availableIn; bytesWritten += destination.Length - (int)availableOut; if ((int)availableOut == destination.Length && !global::Interop.Brotli.BrotliEncoderHasMoreOutput(_state) && (int)availableIn == 0) { return (OperationStatus)0; } source = source.Slice(source.Length - (int)availableIn); destination = destination.Slice(destination.Length - (int)availableOut); } } } return (OperationStatus)1; } public static bool TryCompress(ReadOnlySpan<byte> source, Span<byte> destination, out int bytesWritten) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) return TryCompress(source, destination, out bytesWritten, 11, 22); } public unsafe static bool TryCompress(ReadOnlySpan<byte> source, Span<byte> destination, out int bytesWritten, int quality, int window) { //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) if (quality < 0 || quality > 11) { throw new ArgumentOutOfRangeException("quality", SR.Format("Provided BrotliEncoder Quality of {0} is not between the minimum value of {1} and the maximum value of {2}", quality, 0, 11)); } if (window < 10 || window > 24) { throw new ArgumentOutOfRangeException("window", SR.Format("Provided BrotliEncoder Window of {0} is not between the minimum value of {1} and the maximum value of {2}", window, 10, 24)); } fixed (byte* inBytes = &MemoryMarshal.GetReference<byte>(source)) { fixed (byte* outBytes = &MemoryMarshal.GetReference<byte>(destination)) { IntPtr availableOutput = (IntPtr)destination.Length; bool result = global::Interop.Brotli.BrotliEncoderCompress(quality, window, 0, (IntPtr)source.Length, inBytes, ref availableOutput, outBytes); bytesWritten = (int)availableOutput; return result; } } } } internal enum BrotliEncoderOperation { Process, Flush, Finish, EmitMetadata } internal enum BrotliEncoderParameter { Mode, Quality, LGWin, LGBlock, LCModeling, SizeHint } internal enum BlockType { Uncompressed, Static, Dynamic } internal sealed class CopyEncoder { private const int PaddingSize = 5; private const int MaxUncompressedBlockSize = 65536; public void GetBlock(DeflateInput input, OutputBuffer output, bool isFinal) { int num = 0; if (input != null) { num = Math.Min(input.Count, output.FreeBytes - 5 - output.BitsInBuffer); if (num > 65531) { num = 65531; } } if (isFinal) { output.WriteBits(3, 1u); } else { output.WriteBits(3, 0u); } output.FlushBits(); WriteLenNLen((ushort)num, output); if (input != null && num > 0) { output.WriteBytes(input.Buffer, input.StartIndex, num); input.ConsumeBytes(num); } } private void WriteLenNLen(ushort len, OutputBuffer output) { output.WriteUInt16(len); ushort value = (ushort)(~len); output.WriteUInt16(value); } } internal sealed class DeflateInput { internal readonly struct InputState { internal readonly int _count; internal readonly int _startIndex; internal InputState(int count, int startIndex) { _count = count; _startIndex = startIndex; } } internal byte[] Buffer { get; set; } internal int Count { get; set; } internal int StartIndex { get; set; } internal void ConsumeBytes(int n) { StartIndex += n; Count -= n; } internal InputState DumpState() { return new InputState(Count, StartIndex); } internal void RestoreState(InputState state) { Count = state._count; StartIndex = state._startIndex; } } internal sealed class DeflateManagedStream : Stream { internal const int DefaultBufferSize = 8192; private Stream _stream; private CompressionMode _mode; private bool _leaveOpen; private System.IO.Compression.InflaterManaged _inflater; private DeflaterManaged _deflater; private byte[] _buffer; private int _asyncOperations; private IFileFormatWriter _formatWriter; private bool _wroteHeader; private bool _wroteBytes; public override bool CanRead { get { //IL_000b: Unknown result type (might be due to invalid IL or missing references) if (_stream == null) { return false; } if ((int)_mode == 0) { return _stream.CanRead; } return false; } } public override bool CanWrite { get { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Invalid comparison between Unknown and I4 if (_stream == null) { return false; } if ((int)_mode == 1) { return _stream.CanWrite; } return false; } } public override bool CanSeek => false; public override long Length { get { throw new NotSupportedException("This operation is not supported."); } } public override long Position { get { throw new NotSupportedException("This operation is not supported."); } set { throw new NotSupportedException("This operation is not supported."); } } internal DeflateManagedStream(Stream stream, ZipArchiveEntry.CompressionMethodValues method) { if (stream == null) { throw new ArgumentNullException("stream"); } if (!stream.CanRead) { throw new ArgumentException("Stream does not support reading.", "stream"); } InitializeInflater(stream, leaveOpen: false, null, method); } internal void InitializeInflater(Stream stream, bool leaveOpen, IFileFormatReader reader = null, ZipArchiveEntry.CompressionMethodValues method = ZipArchiveEntry.CompressionMethodValues.Deflate) { //IL_0037: Unknown result type (might be due to invalid IL or missing references) if (!stream.CanRead) { throw new ArgumentException("Stream does not support reading.", "stream"); } _inflater = new System.IO.Compression.InflaterManaged(reader, method == ZipArchiveEntry.CompressionMethodValues.Deflate64); _stream = stream; _mode = (CompressionMode)0; _leaveOpen = leaveOpen; _buffer = new byte[8192]; } internal void SetFileFormatWriter(IFileFormatWriter writer) { if (writer != null) { _formatWriter = writer; } } public override void Flush() { EnsureNotDisposed(); } public override Task FlushAsync(CancellationToken cancellationToken) { EnsureNotDisposed(); if (!cancellationToken.IsCancellationRequested) { return Task.CompletedTask; } return Task.FromCanceled(cancellationToken); } public override long Seek(long offset, SeekOrigin origin) { throw new NotSupportedException("This operation is not supported."); } public override void SetLength(long value) { throw new NotSupportedException("This operation is not supported."); } public override int Read(byte[] array, int offset, int count) { EnsureDecompressionMode(); ValidateParameters(array, offset, count); EnsureNotDisposed(); int num = offset; int num2 = count; while (true) { int num3 = _inflater.Inflate(array, num, num2); num += num3; num2 -= num3; if (num2 == 0 || _inflater.Finished()) { break; } int num4 = _stream.Read(_buffer, 0, _buffer.Length); if (num4 <= 0) { break; } if (num4 > _buffer.Length) { throw new InvalidDataException("Found invalid data while decoding."); } _inflater.SetInput(_buffer, 0, num4); } return count - num2; } private void ValidateParameters(byte[] array, int offset, int count) { if (array == null) { throw new ArgumentNullException("array"); } if (offset < 0) { throw new ArgumentOutOfRangeException("offset"); } if (count < 0) { throw new ArgumentOutOfRangeException("count"); } if (array.Length - offset < count) { throw new ArgumentException("Offset plus count is larger than the length of target array."); } } private void EnsureNotDisposed() { if (_stream == null) { ThrowStreamClosedException(); } } [MethodImpl(MethodImplOptions.NoInlining)] private static void ThrowStreamClosedException() { throw new ObjectDisposedException(null, "Can not access a closed Stream."); } private void EnsureDecompressionMode() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) if ((int)_mode != 0) { ThrowCannotReadFromDeflateManagedStreamException(); } } [MethodImpl(MethodImplOptions.NoInlining)] private static void ThrowCannotReadFromDeflateManagedStreamException() { throw new InvalidOperationException("Reading from the compression stream is not supported."); } private void EnsureCompressionMode() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Invalid comparison between Unknown and I4 if ((int)_mode != 1) { ThrowCannotWriteToDeflateManagedStreamException(); } } [MethodImpl(MethodImplOptions.NoInlining)] private static void ThrowCannotWriteToDeflateManagedStreamException() { throw new InvalidOperationException("Writing to the compression stream is not supported."); } public override IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback asyncCallback, object asyncState) { return System.Threading.Tasks.TaskToApm.Begin(ReadAsync(buffer, offset, count, CancellationToken.None), asyncCallback, asyncState); } public override int EndRead(IAsyncResult asyncResult) { return System.Threading.Tasks.TaskToApm.End<int>(asyncResult); } public override Task<int> ReadAsync(byte[] array, int offset, int count, CancellationToken cancellationToken) { EnsureDecompressionMode(); if (_asyncOperations != 0) { throw new InvalidOperationException("Only one asynchronous reader or writer is allowed time at one time."); } ValidateParameters(array, offset, count); EnsureNotDisposed(); if (cancellationToken.IsCancellationRequested) { return Task.FromCanceled<int>(cancellationToken); } Interlocked.Increment(ref _asyncOperations); Task<int> task = null; try { int num = _inflater.Inflate(array, offset, count); if (num != 0) { return Task.FromResult(num); } if (_inflater.Finished()) { return Task.FromResult(0); } task = _stream.ReadAsync(_buffer, 0, _buffer.Length, cancellationToken); if (task == null) { throw new InvalidOperationException("Stream does not support reading."); } return ReadAsyncCore(task, array, offset, count, cancellationToken); } finally { if (task == null) { Interlocked.Decrement(ref _asyncOperations); } } } private async Task<int> ReadAsyncCore(Task<int> readTask, byte[] array, int offset, int count, CancellationToken cancellationToken) { try { int num; while (true) { num = await readTask.ConfigureAwait(continueOnCapturedContext: false); EnsureNotDisposed(); if (num <= 0) { return 0; } if (num > _buffer.Length) { throw new InvalidDataException("Found invalid data while decoding."); } cancellationToken.ThrowIfCancellationRequested(); _inflater.SetInput(_buffer, 0, num); num = _inflater.Inflate(array, offset, count); if (num != 0 || _inflater.Finished()) { break; } readTask = _stream.ReadAsync(_buffer, 0, _buffer.Length, cancellationToken); if (readTask == null) { throw new InvalidOperationException("Stream does not support reading."); } } return num; } finally { Interlocked.Decrement(ref _asyncOperations); } } public override void Write(byte[] array, int offset, int count) { EnsureCompressionMode(); ValidateParameters(array, offset, count); EnsureNotDisposed(); DoMaintenance(array, offset, count); WriteDeflaterOutput(); _deflater.SetInput(array, offset, count); WriteDeflaterOutput(); } private void WriteDeflaterOutput() { while (!_deflater.NeedsInput()) { int deflateOutput = _deflater.GetDeflateOutput(_buffer); if (deflateOutput > 0) { _stream.Write(_buffer, 0, deflateOutput); } } } private void DoMaintenance(byte[] array, int offset, int count) { if (count <= 0) { return; } _wroteBytes = true; if (_formatWriter != null) { if (!_wroteHeader) { byte[] header = _formatWriter.GetHeader(); _stream.Write(header, 0, header.Length); _wroteHeader = true; } _formatWriter.UpdateWithBytesRead(array, offset, count); } } private void PurgeBuffers(bool disposing) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Invalid comparison between Unknown and I4 if (!disposing || _stream == null) { return; } Flush(); if ((int)_mode != 1) { return; } if (_wroteBytes) { WriteDeflaterOutput(); bool flag; do { flag = _deflater.Finish(_buffer, out var bytesRead); if (bytesRead > 0) { _stream.Write(_buffer, 0, bytesRead); } } while (!flag); } else { int bytesRead2; while (!_deflater.Finish(_buffer, out bytesRead2)) { } } if (_formatWriter != null && _wroteHeader) { byte[] footer = _formatWriter.GetFooter(); _stream.Write(footer, 0, footer.Length); } } protected override void Dispose(bool disposing) { try { PurgeBuffers(disposing); } finally { try { if (disposing && !_leaveOpen && _stream != null) { _stream.Dispose(); } } finally { _stream = null; try { _deflater?.Dispose(); _inflater?.Dispose(); } finally { _deflater = null; _inflater = null; base.Dispose(disposing); } } } } public override Task WriteAsync(byte[] array, int offset, int count, CancellationToken cancellationToken) { EnsureCompressionMode(); if (_asyncOperations != 0) { throw new InvalidOperationException("Only one asynchronous reader or writer is allowed time at one time."); } ValidateParameters(array, offset, count); EnsureNotDisposed(); if (cancellationToken.IsCancellationRequested) { return Task.FromCanceled<int>(cancellationToken); } return WriteAsyncCore(array, offset, count, cancellationToken); } private async Task WriteAsyncCore(byte[] array, int offset, int count, CancellationToken cancellationToken) { Interlocked.Increment(ref _asyncOperations); try { await base.WriteAsync(array, offset, count, cancellationToken).ConfigureAwait(continueOnCapturedContext: false); } finally { Interlocked.Decrement(ref _asyncOperations); } } public override IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback asyncCallback, object asyncState) { return System.Threading.Tasks.TaskToApm.Begin(WriteAsync(buffer, offset, count, CancellationToken.None), asyncCallback, asyncState); } public override void EndWrite(IAsyncResult asyncResult) { System.Threading.Tasks.TaskToApm.End(asyncResult); } } internal sealed class DeflaterManaged : IDisposable { private enum DeflaterState { NotStarted, SlowDownForIncompressible1, SlowDownForIncompressible2, StartingSmallData, CompressThenCheck, CheckingForIncompressible, HandlingSmallData } private const int MinBlockSize = 256; private const int MaxHeaderFooterGoo = 120; private const int CleanCopySize = 8072; private const double BadCompressionThreshold = 1.0; private readonly FastEncoder _deflateEncoder; private readonly CopyEncoder _copyEncoder; private readonly DeflateInput _input; private readonly OutputBuffer _output; private DeflaterState _processingState; private DeflateInput _inputFromHistory; internal DeflaterManaged() { _deflateEncoder = new FastEncoder(); _copyEncoder = new CopyEncoder(); _input = new DeflateInput(); _output = new OutputBuffer(); _processingState = DeflaterState.NotStarted; } internal bool NeedsInput() { if (_input.Count == 0) { return _deflateEncoder.BytesInHistory == 0; } return false; } internal void SetInput(byte[] inputBuffer, int startIndex, int count) { _input.Buffer = inputBuffer; _input.Count = count; _input.StartIndex = startIndex; if (count > 0 && count < 256) { switch (_processingState) { case DeflaterState.NotStarted: case DeflaterState.CheckingForIncompressible: _processingState = DeflaterState.StartingSmallData; break; case DeflaterState.CompressThenCheck: _processingState = DeflaterState.HandlingSmallData; break; } } } internal int GetDeflateOutput(byte[] outputBuffer) { _output.UpdateBuffer(outputBuffer); switch (_processingState) { case DeflaterState.NotStarted: { DeflateInput.InputState state3 = _input.DumpState(); OutputBuffer.BufferState state4 = _output.DumpState(); _deflateEncoder.GetBlockHeader(_output); _deflateEncoder.GetCompressedData(_input, _output); if (!UseCompressed(_deflateEncoder.LastCompressionRatio)) { _input.RestoreState(state3); _output.RestoreState(state4); _copyEncoder.GetBlock(_input, _output, isFinal: false); FlushInputWindows(); _processingState = DeflaterState.CheckingForIncompressible; } else { _processingState = DeflaterState.CompressThenCheck; } break; } case DeflaterState.CompressThenCheck: _deflateEncoder.GetCompressedData(_input, _output); if (!UseCompressed(_deflateEncoder.LastCompressionRatio)) { _processingState = DeflaterState.SlowDownForIncompressible1; _inputFromHistory = _deflateEncoder.UnprocessedInput; } break; case DeflaterState.SlowDownForIncompressible1: _deflateEncoder.GetBlockFooter(_output); _processingState = DeflaterState.SlowDownForIncompressible2; goto case DeflaterState.SlowDownForIncompressible2; case DeflaterState.SlowDownForIncompressible2: if (_inputFromHistory.Count > 0) { _copyEncoder.GetBlock(_inputFromHistory, _output, isFinal: false); } if (_inputFromHistory.Count == 0) { _deflateEncoder.FlushInput(); _processingState = DeflaterState.CheckingForIncompressible; } break; case DeflaterState.CheckingForIncompressible: { DeflateInput.InputState state = _input.DumpState(); OutputBuffer.BufferState state2 = _output.DumpState(); _deflateEncoder.GetBlock(_input, _output, 8072); if (!UseCompressed(_deflateEncoder.LastCompressionRatio)) { _input.RestoreState(state); _output.RestoreState(state2); _copyEncoder.GetBlock(_input, _output, isFinal: false); FlushInputWindows(); } break; } case DeflaterState.StartingSmallData: _deflateEncoder.GetBlockHeader(_output); _processingState = DeflaterState.HandlingSmallData; goto case DeflaterState.HandlingSmallData; case DeflaterState.HandlingSmallData: _deflateEncoder.GetCompressedData(_input, _output); break; } return _output.BytesWritten; } internal bool Finish(byte[] outputBuffer, out int bytesRead) { if (_processingState == DeflaterState.NotStarted) { bytesRead = 0; return true; } _output.UpdateBuffer(outputBuffer); if (_processingState == DeflaterState.CompressThenCheck || _processingState == DeflaterState.HandlingSmallData || _processingState == DeflaterState.SlowDownForIncompressible1) { _deflateEncoder.GetBlockFooter(_output); } WriteFinal(); bytesRead = _output.BytesWritten; return true; } private bool UseCompressed(double ratio) { return ratio <= 1.0; } private void FlushInputWindows() { _deflateEncoder.FlushInput(); } private void WriteFinal() { _copyEncoder.GetBlock(null, _output, isFinal: true); } public void Dispose() { } } internal sealed class FastEncoder { private readonly FastEncoderWindow _inputWindow; private readonly Match _currentMatch; private double _lastCompressionRatio; internal int BytesInHistory => _inputWindow.BytesAvailable; internal DeflateInput UnprocessedInput => _inputWindow.UnprocessedInput; internal double LastCompressionRatio => _lastCompressionRatio; public FastEncoder() { _inputWindow = new FastEncoderWindow(); _currentMatch = new Match(); } internal void FlushInput() { _inputWindow.FlushWindow(); } internal void GetBlock(DeflateInput input, OutputBuffer output, int maxBytesToCopy) { WriteDeflatePreamble(output); GetCompressedOutput(input, output, maxBytesToCopy); WriteEndOfBlock(output); } internal void GetCompressedData(DeflateInput input, OutputBuffer output) { GetCompressedOutput(input, output, -1); } internal void GetBlockHeader(OutputBuffer output) { WriteDeflatePreamble(output); } internal void GetBlockFooter(OutputBuffer output) { WriteEndOfBlock(output); } private void GetCompressedOutput(DeflateInput input, OutputBuffer output, int maxBytesToCopy) { int bytesWritten = output.BytesWritten; int num = 0; int num2 = BytesInHistory + input.Count; do { int num3 = ((input.Count < _inputWindow.FreeWindowSpace) ? input.Count : _inputWindow.FreeWindowSpace); if (maxBytesToCopy >= 1) { num3 = Math.Min(num3, maxBytesToCopy - num); } if (num3 > 0) { _inputWindow.CopyBytes(input.Buffer, input.StartIndex, num3); input.ConsumeBytes(num3); num += num3; } GetCompressedOutput(output); } while (SafeToWriteTo(output) && InputAvailable(input) && (maxBytesToCopy < 1 || num < maxBytesToCopy)); int num4 = output.BytesWritten - bytesWritten; int num5 = BytesInHistory + input.Count; int num6 = num2 - num5; if (num4 != 0) { _lastCompressionRatio = (double)num4 / (double)num6; } } private void GetCompressedOutput(OutputBuffer output) { while (_inputWindow.BytesAvailable > 0 && SafeToWriteTo(output)) { _inputWindow.GetNextSymbolOrMatch(_currentMatch); if (_currentMatch.State == MatchState.HasSymbol) { WriteChar(_currentMatch.Symbol, output); continue; } if (_currentMatch.State == MatchState.HasMatch) { WriteMatch(_currentMatch.Length, _currentMatch.Position, output); continue; } WriteChar(_currentMatch.Symbol, output); WriteMatch(_currentMatch.Length, _currentMatch.Position, output); } } private bool InputAvailable(DeflateInput input) { if (input.Count <= 0) { return BytesInHistory > 0; } return true; } private bool SafeToWriteTo(OutputBuffer output) { return output.FreeBytes > 16; } private void WriteEndOfBlock(OutputBuffer output) { uint num = FastEncoderStatics.FastEncoderLiteralCodeInfo[256]; int n = (int)(num & 0x1F); output.WriteBits(n, num >> 5); } internal static void WriteMatch(int matchLen, int matchPos, OutputBuffer output) { uint num = FastEncoderStatics.FastEncoderLiteralCodeInfo[254 + matchLen]; int num2 = (int)(num & 0x1F); if (num2 <= 16) { output.WriteBits(num2, num >> 5); } else { output.WriteBits(16, (num >> 5) & 0xFFFFu); output.WriteBits(num2 - 16, num >> 21); } num = FastEncoderStatics.FastEncoderDistanceCodeInfo[FastEncoderStatics.GetSlot(matchPos)]; output.WriteBits((int)(num & 0xF), num >> 8); int num3 = (int)((num >> 4) & 0xF); if (num3 != 0) { output.WriteBits(num3, (uint)matchPos & FastEncoderStatics.BitMask[num3]); } } internal static void WriteChar(byte b, OutputBuffer output) { uint num = FastEncoderStatics.FastEncoderLiteralCodeInfo[b]; output.WriteBits((int)(num & 0x1F), num >> 5); } internal static void WriteDeflatePreamble(OutputBuffer output) { output.WriteBytes(FastEncoderStatics.FastEncoderTreeStructureData, 0, FastEncoderStatics.FastEncoderTreeStructureData.Length); output.WriteBits(9, 34u); } } internal static class FastEncoderStatics { internal static readonly byte[] FastEncoderTreeStructureData = new byte[98] { 236, 189, 7, 96, 28, 73, 150, 37, 38, 47, 109, 202, 123, 127, 74, 245, 74, 215, 224, 116, 161, 8, 128, 96, 19, 36, 216, 144, 64, 16, 236, 193, 136, 205, 230, 146, 236, 29, 105, 71, 35, 41, 171, 42, 129, 202, 101, 86, 101, 93, 102, 22, 64, 204, 237, 157, 188, 247, 222, 123, 239, 189, 247, 222, 123, 239, 189, 247, 186, 59, 157, 78, 39, 247, 223, 255, 63, 92, 102, 100, 1, 108, 246, 206, 74, 218, 201, 158, 33, 128, 170, 200, 31, 63, 126, 124, 31, 63 }; internal static readonly byte[] BFinalFastEncoderTreeStructureData = new byte[98] { 237, 189, 7, 96, 28, 73, 150, 37, 38, 47, 109, 202, 123, 127, 74, 245, 74, 215, 224, 116, 161, 8, 128, 96, 19, 36, 216, 144, 64, 16, 236, 193, 136, 205, 230, 146, 236, 29, 105, 71, 35, 41, 171, 42, 129, 202, 101, 86, 101, 93, 102, 22, 64, 204, 237, 157, 188, 247, 222, 123, 239, 189, 247, 222, 123, 239, 189, 247, 186, 59, 157, 78, 39, 247, 223, 255, 63, 92, 102, 100, 1, 108, 246, 206, 74, 218, 201, 158, 33, 128, 170, 200, 31, 63, 126, 124, 31, 63 }; internal static readonly uint[] FastEncoderLiteralCodeInfo = new uint[513] { 55278u, 317422u, 186350u, 448494u, 120814u, 382958u, 251886u, 514030u, 14318u, 51180u, 294u, 276462u, 145390u, 407534u, 79854u, 341998u, 210926u, 473070u, 47086u, 309230u, 178158u, 440302u, 112622u, 374766u, 243694u, 505838u, 30702u, 292846u, 161774u, 423918u, 6125u, 96238u, 1318u, 358382u, 9194u, 116716u, 227310u, 489454u, 137197u, 25578u, 2920u, 3817u, 23531u, 5098u, 1127u, 7016u, 3175u, 12009u, 1896u, 5992u, 3944u, 7913u, 8040u, 16105u, 21482u, 489u, 232u, 8681u, 4585u, 4328u, 12777u, 13290u, 2280u, 63470u, 325614u, 6376u, 2537u, 1256u, 10729u, 5352u, 6633u, 29674u, 56299u, 3304u, 15339u, 194542u, 14825u, 3050u, 1513u, 19434u, 9705u, 10220u, 5609u, 13801u, 3561u, 11242u, 75756u, 48107u, 456686u, 129006u, 42988u, 31723u, 391150u, 64491u, 260078u, 522222u, 4078u, 806u, 615u, 2663u, 1639u, 1830u, 7400u, 744u, 3687u, 166u, 108524u, 11753u, 1190u, 359u, 2407u, 678u, 1383u, 71661u, 1702u, 422u, 1446u, 3431u, 4840u, 2792u, 7657u, 6888u, 2027u, 202733u, 26604u, 38893u, 169965u, 266222u, 135150u, 397294u, 69614u, 331758u, 200686u, 462830u, 36846u, 298990u, 167918u, 430062u, 102382u, 364526u, 233454u, 495598u, 20462u, 282606u, 151534u, 413678u, 85998u, 348142u, 217070u, 479214u, 53230u, 315374u, 184302u, 446446u, 118766u, 380910u, 249838u, 511982u, 12270u, 274414u, 143342u, 405486u, 77806u, 339950u, 208878u, 471022u, 45038u, 307182u, 176110u, 438254u, 110574u, 372718u, 241646u, 503790u, 28654u, 290798u, 159726u, 421870u, 94190u, 356334u, 225262u, 487406u, 61422u, 323566u, 192494u, 454638u, 126958u, 389102u, 258030u, 520174u, 8174u, 270318u, 139246u, 401390u, 73710u, 335854u, 204782u, 466926u, 40942u, 303086u, 172014u, 434158u, 106478u, 368622u, 237550u, 499694u, 24558u, 286702u, 155630u, 417774u, 90094u, 352238u, 221166u, 483310u, 57326u, 319470u, 188398u, 450542u, 122862u, 385006u, 253934u, 516078u, 16366u, 278510u, 147438u, 409582u, 81902u, 344046u, 212974u, 475118u, 49134u, 311278u, 180206u, 442350u, 114670u, 376814u, 245742u, 507886u, 32750u, 294894u, 163822u, 425966u, 98286u, 104429u, 235501u, 22509u, 360430u, 153581u, 229358u, 88045u, 491502u, 219117u, 65518u, 327662u, 196590u, 458734u, 131054u, 132u, 3u, 388u, 68u, 324u, 197u, 709u, 453u, 966u, 1990u, 38u, 1062u, 935u, 2983u, 1959u, 4007u, 551u, 1575u, 2599u, 3623u, 104u, 2152u, 4200u, 6248u, 873u, 4969u, 9065u, 13161u, 1770u, 9962u, 18154u, 26346u, 5867u, 14059u, 22251u, 30443u, 38635u, 46827u, 55019u, 63211u, 15852u, 32236u, 48620u, 65004u, 81388u, 97772u, 114156u, 130540u, 27629u, 60397u, 93165u, 125933u, 158701u, 191469u, 224237u, 257005u, 1004u, 17388u, 33772u, 50156u, 66540u, 82924u, 99308u, 115692u, 7150u, 39918u, 72686u, 105454u, 138222u, 170990u, 203758u, 236526u, 269294u, 302062u, 334830u, 367598u, 400366u, 433134u, 465902u, 498670u, 92144u, 223216u, 354288u, 485360u, 616432u, 747504u, 878576u, 1009648u, 1140720u, 1271792u, 1402864u, 1533936u, 1665008u, 1796080u, 1927152u, 2058224u, 34799u, 100335u, 165871u, 231407u, 296943u, 362479u, 428015u, 493551u, 559087u, 624623u, 690159u, 755695u, 821231u, 886767u, 952303u, 1017839u, 59376u, 190448u, 321520u, 452592u, 583664u, 714736u, 845808u, 976880u, 1107952u, 1239024u, 1370096u, 1501168u, 1632240u, 1763312u, 1894384u, 2025456u, 393203u, 917491u, 1441779u, 1966067u, 2490355u, 3014643u, 3538931u, 4063219u, 4587507u, 5111795u, 5636083u, 6160371u, 6684659u, 7208947u, 7733235u, 8257523u, 8781811u, 9306099u, 9830387u, 10354675u, 10878963u, 11403251u, 11927539u, 12451827u, 12976115u, 13500403u, 14024691u, 14548979u, 15073267u, 15597555u, 16121843u, 16646131u, 262131u, 786419u, 1310707u, 1834995u, 2359283u, 2883571u, 3407859u, 3932147u, 4456435u, 4980723u, 5505011u, 6029299u, 6553587u, 7077875u, 7602163u, 8126451u, 8650739u, 9175027u, 9699315u, 10223603u, 10747891u, 11272179u, 11796467u, 12320755u, 12845043u, 13369331u, 13893619u, 14417907u, 14942195u, 15466483u, 15990771u, 16515059u, 524275u, 1048563u, 1572851u, 2097139u, 2621427u, 3145715u, 3670003u, 4194291u, 4718579u, 5242867u, 5767155u, 6291443u, 6815731u, 7340019u, 7864307u, 8388595u, 8912883u, 9437171u, 9961459u, 10485747u, 11010035u, 11534323u, 12058611u, 12582899u, 13107187u, 13631475u, 14155763u, 14680051u, 15204339u, 15728627u, 16252915u, 16777203u, 124913u, 255985u, 387057u, 518129u, 649201u, 780273u, 911345u, 1042417u, 1173489u, 1304561u, 1435633u, 1566705u, 1697777u, 1828849u, 1959921u, 2090993u, 2222065u, 2353137u, 2484209u, 2615281u, 2746353u, 2877425u, 3008497u, 3139569u, 3270641u, 3401713u, 3532785u, 3663857u, 3794929u, 3926001u, 4057073u, 18411u }; internal static readonly uint[] FastEncoderDistanceCodeInfo = new uint[32] { 3846u, 130826u, 261899u, 524043u, 65305u, 16152u, 48936u, 32552u, 7991u, 24375u, 3397u, 12102u, 84u, 7509u, 2148u, 869u, 1140u, 4981u, 3204u, 644u, 2708u, 1684u, 3748u, 420u, 2484u, 2997u, 1476u, 7109u, 2005u, 6101u, 0u, 256u }; internal static readonly uint[] BitMask = new uint[16] { 0u, 1u, 3u, 7u, 15u, 31u, 63u, 127u, 255u, 511u, 1023u, 2047u, 4095u, 8191u, 16383u, 32767u }; internal static readonly byte[] ExtraLengthBits = new byte[29] { 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0 }; internal static readonly byte[] ExtraDistanceBits = new byte[32] { 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 0, 0 }; internal const int NumChars = 256; internal const int NumLengthBaseCodes = 29; internal const int NumDistBaseCodes = 30; internal const uint FastEncoderPostTreeBitBuf = 34u; internal const int FastEncoderPostTreeBitCount = 9; internal const uint NoCompressionHeader = 0u; internal const int NoCompressionHeaderBitCount = 3; internal const uint BFinalNoCompressionHeader = 1u; internal const int BFinalNoCompressionHeaderBitCount = 3; internal const int MaxCodeLen = 16; private static readonly byte[] s_distLookup = CreateDistanceLookup(); private static byte[] CreateDistanceLookup() { byte[] array = new byte[512]; int num = 0; int i; for (i = 0; i < 16; i++) { for (int j = 0; j < 1 << (int)ExtraDistanceBits[i]; j++) { array[num++] = (byte)i; } } num >>= 7; for (; i < 30; i++) { for (int k = 0; k < 1 << ExtraDistanceBits[i] - 7; k++) { array[256 + num++] = (byte)i; } } return array; } internal static int GetSlot(int pos) { return s_distLookup[(pos < 256) ? pos : (256 + (pos >> 7))]; } public static uint BitReverse(uint code, int length) { uint num = 0u; do { num |= code & 1u; num <<= 1; code >>= 1; } while (--length > 0); return num >> 1; } } internal sealed class FastEncoderWindow { private byte[] _window; private int _bufPos; private int _bufEnd; private const int FastEncoderHashShift = 4; private const int FastEncoderHashtableSize = 2048; private const int FastEncoderHashMask = 2047; private const int FastEncoderWindowSize = 8192; private const int FastEncoderWindowMask = 8191; private const int FastEncoderMatch3DistThreshold = 16384; internal const int MaxMatch = 258; internal const int MinMatch = 3; private const int SearchDepth = 32; private const int GoodLength = 4; private const int NiceLength = 32; private const int LazyMatchThreshold = 6; private ushort[] _prev; private ushort[] _lookup; public int BytesAvailable => _bufEnd - _bufPos; public DeflateInput UnprocessedInput => new DeflateInput { Buffer = _window, StartIndex = _bufPos, Count = _bufEnd - _bufPos }; public int FreeWindowSpace => 16384 - _bufEnd; public FastEncoderWindow() { ResetWindow(); } public void FlushWindow() { ResetWindow(); } private void ResetWindow() { _window = new byte[16646]; _prev = new ushort[8450]; _lookup = new ushort[2048]; _bufPos = 8192; _bufEnd = _bufPos; } public void CopyBytes(byte[] inputBuffer, int startIndex, int count) { Array.Copy(inputBuffer, startIndex, _window, _bufEnd, count); _bufEnd += count; } public void MoveWindows() { Array.Copy(_window, _bufPos - 8192, _window, 0, 8192); for (int i = 0; i < 2048; i++) { int num = _lookup[i] - 8192; if (num <= 0) { _lookup[i] = 0; } else { _lookup[i] = (ushort)num; } } for (int i = 0; i < 8192; i++) { long num2 = (long)_prev[i] - 8192L; if (num2 <= 0) { _prev[i] = 0; } else { _prev[i] = (ushort)num2; } } _bufPos = 8192; _bufEnd = _bufPos; } private uint HashValue(uint hash, byte b) { return (hash << 4) ^ b; } private uint InsertString(ref uint hash) { hash = HashValue(hash, _window[_bufPos + 2]); uint num = _lookup[hash & 0x7FF]; _lookup[hash & 0x7FF] = (ushort)_bufPos; _prev[_bufPos & 0x1FFF] = (ushort)num; return num; } private void InsertStrings(ref uint hash, int matchLen) { if (_bufEnd - _bufPos <= matchLen) { _bufPos += matchLen - 1; return; } while (--matchLen > 0) { InsertString(ref hash); _bufPos++; } } internal bool GetNextSymbolOrMatch(Match match) { uint hash = HashValue(0u, _window[_bufPos]); hash = HashValue(hash, _window[_bufPos + 1]); int matchPos = 0; int num; if (_bufEnd - _bufPos <= 3) { num = 0; } else { int num2 = (int)InsertString(ref hash); if (num2 != 0) { num = FindMatch(num2, out matchPos, 32, 32); if (_bufPos + num > _bufEnd) { num = _bufEnd - _bufPos; } } else { num = 0; } } if (num < 3) { match.State = MatchState.HasSymbol; match.Symbol = _window[_bufPos]; _bufPos++; } else { _bufPos++; if (num <= 6) { int matchPos2 = 0; int num3 = (int)InsertString(ref hash); int num4; if (num3 != 0) { num4 = FindMatch(num3, out matchPos2, (num < 4) ? 32 : 8, 32); if (_bufPos + num4 > _bufEnd) { num4 = _bufEnd - _bufPos; } } else { num4 = 0; } if (num4 > num) { match.State = MatchState.HasSymbolAndMatch; match.Symbol = _window[_bufPos - 1]; match.Position = matchPos2; match.Length = num4; _bufPos++; num = num4; InsertStrings(ref hash, num); } else { match.State = MatchState.HasMatch; match.Position = matchPos; match.Length = num; num--; _bufPos++; InsertStrings(ref hash, num); } } else { match.State = MatchState.HasMatch; match.Position = matchPos; match.Length = num; InsertStrings(ref hash, num); } } if (_bufPos == 16384) { MoveWindows(); } return true; } private int FindMatch(int search, out int matchPos, int searchDepth, int niceLength) { int num = 0; int num2 = 0; int num3 = _bufPos - 8192; byte b = _window[_bufPos]; while (search > num3) { if (_window[search + num] == b) { int i; for (i = 0; i < 258 && _window[_bufPos + i] == _window[search + i]; i++) { } if (i > num) { num = i; num2 = search; if (i > 32) { break; } b = _window[_bufPos + i]; } } if (--searchDepth == 0) { break; } search = _prev[search & 0x1FFF]; } matchPos = _bufPos - num2 - 1; if (num == 3 && matchPos >= 16384) { return 0; } return num; } [Conditional("DEBUG")] private void DebugAssertVerifyHashes() { } [Conditional("DEBUG")] private void DebugAssertRecalculatedHashesAreEqual(int position1, int position2, string message = "") { } } internal interface IFileFormatWriter { byte[] GetHeader(); void UpdateWithBytesRead(byte[] buffer, int offset, int bytesToCopy); byte[] GetFooter(); } internal interface IFileFormatReader { bool ReadHeader(System.IO.Compression.InputBuffer input); bool ReadFooter(System.IO.Compression.InputBuffer input); void UpdateWithBytesRead(byte[] buffer, int offset, int bytesToCopy); void Validate(); } internal sealed class HuffmanTree { internal const int MaxLiteralTreeElements = 288; internal const int MaxDistTreeElements = 32; internal const int EndOfBlockCode = 256; internal const int NumberOfCodeLengthTreeElements = 19; private readonly int _tableBits; private readonly short[] _table; private readonly short[] _left; private readonly short[] _right; private readonly byte[] _codeLengthArray; private readonly int _tableMask; public static System.IO.Compression.HuffmanTree StaticLiteralLengthTree { get; } = new System.IO.Compression.HuffmanTree(GetStaticLiteralTreeLength()); public static System.IO.Compression.HuffmanTree StaticDistanceTree { get; } = new System.IO.Compression.HuffmanTree(GetStaticDistanceTreeLength()); public HuffmanTree(byte[] codeLengths) { _codeLengthArray = codeLengths; if (_codeLengthArray.Length == 288) { _tableBits = 9; } else { _tableBits = 7; } _tableMask = (1 << _tableBits) - 1; _table = new short[1 << _tableBits]; _left = new short[2 * _codeLengthArray.Length]; _right = new short[2 * _codeLengthArray.Length]; CreateTable(); } private static byte[] GetStaticLiteralTreeLength() { byte[] array = new byte[288]; for (int i = 0; i <= 143; i++) { array[i] = 8; } for (int j = 144; j <= 255; j++) { array[j] = 9; } for (int k = 256; k <= 279; k++) { array[k] = 7; } for (int l = 280; l <= 287; l++) { array[l] = 8; } return array; } private static byte[] GetStaticDistanceTreeLength() { byte[] array = new byte[32]; for (int i = 0; i < 32; i++) { array[i] = 5; } return array; } private uint[] CalculateHuffmanCode() { uint[] array = new uint[17]; byte[] codeLengthArray = _codeLengthArray; foreach (int num in codeLengthArray) { array[num]++; } array[0] = 0u; uint[] array2 = new uint[17]; uint num2 = 0u; for (int j = 1; j <= 16; j++) { num2 = (array2[j] = num2 + array[j - 1] << 1); } uint[] array3 = new uint[288]; for (int k = 0; k < _codeLengthArray.Length; k++) { int num3 = _codeLengthArray[k]; if (num3 > 0) { array3[k] = FastEncoderStatics.BitReverse(array2[num3], num3); array2[num3]++; } } return array3; } private void CreateTable() { uint[] array = CalculateHuffmanCode(); short num = (short)_codeLengthArray.Length; for (int i = 0; i < _codeLengthArray.Length; i++) { int num2 = _codeLengthArray[i]; if (num2 <= 0) { continue; } int num3 = (int)array[i]; if (num2 <= _tableBits) { int num4 = 1 << num2; if (num3 >= num4) { throw new InvalidDataException("Failed to construct a huffman tree using the length array. The stream might be corrupted."); } int num5 = 1 << _tableBits - num2; for (int j = 0; j < num5; j++) { _table[num3] = (short)i; num3 += num4; } continue; } int num6 = num2 - _tableBits; int num7 = 1 << _tableBits; int num8 = num3 & ((1 << _tableBits) - 1); short[] array2 = _table; do { short num9 = array2[num8]; if (num9 == 0) { array2[num8] = (short)(-num); num9 = (short)(-num); num++; } if (num9 > 0) { throw new InvalidDataException("Failed to construct a huffman tree using the length array. The stream might be corrupted."); } array2 = (((num3 & num7) != 0) ? _right : _left); num8 = -num9; num7 <<= 1; num6--; } while (num6 != 0); array2[num8] = (short)i; } } public int GetNextSymbol(System.IO.Compression.InputBuffer input) { uint num = input.TryLoad16Bits(); if (input.AvailableBits == 0) { return -1; } int num2 = _table[num & _tableMask]; if (num2 < 0) { uint num3 = (uint)(1 << _tableBits); do { num2 = -num2; num2 = (((num & num3) != 0) ? _right[num2] : _left[num2]); num3 <<= 1; } while (num2 < 0); } int num4 = _codeLengthArray[num2]; if (num4 <= 0) { throw new InvalidDataException("Failed to construct a huffman tree using the length array. The stream might be corrupted."); } if (num4 > input.AvailableBits) { return -1; } input.SkipBits(num4); return num2; } } internal sealed class InflaterManaged { private static readonly byte[] s_extraLengthBits = new byte[29] { 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 16 }; private static readonly int[] s_lengthBase = new int[29] { 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 3 }; private static readonly int[] s_distanceBasePosition = new int[32] { 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577, 32769, 49153 }; private static readonly byte[] s_codeOrder = new byte[19] { 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 }; private static readonly byte[] s_staticDistanceTreeTable = new byte[32] { 0, 16, 8, 24, 4, 20, 12, 28, 2, 18, 10, 26, 6, 22, 14, 30, 1, 17, 9, 25, 5, 21, 13, 29, 3, 19, 11, 27, 7, 23, 15, 31 }; private readonly System.IO.Compression.OutputWindow _output; private readonly System.IO.Compression.InputBuffer _input; private System.IO.Compression.HuffmanTree _literalLengthTree; private System.IO.Compression.HuffmanTree _distanceTree; private System.IO.Compression.InflaterState _state; private bool _hasFormatReader; private int _bfinal; private System.IO.Compression.BlockType _blockType; private readonly byte[] _blockLengthBuffer = new byte[4]; private int _blockLength; private int _length; private int _distanceCode; private int _extraBits; private int _loopCounter; private int _literalLengthCodeCount; private int _distanceCodeCount; private int _codeLengthCodeCount; private int _codeArraySize; private int _lengthCode; private readonly byte[] _codeList; private readonly byte[] _codeLengthTreeCodeLength; private readonly bool _deflate64; private System.IO.Compression.HuffmanTree _codeLengthTree; private IFileFormatReader _formatReader; public int AvailableOutput => _output.AvailableBytes; internal InflaterManaged(IFileFormatReader reader, bool deflate64) { _output = new System.IO.Compression.OutputWindow(); _input = new System.IO.Compression.InputBuffer(); _codeList = new byte[320]; _codeLengthTreeCodeLength = new byte[19]; _deflate64 = deflate64; if (reader != null) { _formatReader = reader; _hasFormatReader = true; } Reset(); } private void Reset() { _state = ((!_hasFormatReader) ? System.IO.Compression.InflaterState.ReadingBFinal : System.IO.Compression.InflaterState.ReadingHeader); } public void SetInput(byte[] inputBytes, int offset, int length) { _input.SetInput(inputBytes, offset, length); } public bool Finished() { if (_state != System.IO.Compression.InflaterState.Done) { return _state == System.IO.Compression.InflaterState.VerifyingFooter; } return true; } public int Inflate(byte[] bytes, int offset, int length) { int num = 0; do { int num2 = _output.CopyTo(bytes, offset, length); if (num2 > 0) { if (_hasFormatReader) { _formatReader.UpdateWithBytesRead(bytes, offset, num2); } offset += num2; num += num2; length -= num2; } } while (length != 0 && !Finished() && Decode()); if (_state == System.IO.Compression.InflaterState.VerifyingFooter && _output.AvailableBytes == 0) { _formatReader.Validate(); } return num; } private bool Decode() { bool end_of_block_code_seen = false; bool flag = false; if (Finished()) { return true; } if (_hasFormatReader) { if (_state == System.IO.Compression.InflaterState.ReadingHeader) { if (!_formatReader.ReadHeader(_input)) { return false; } _state = System.IO.Compression.InflaterState.ReadingBFinal; } else if (_state == System.IO.Compression.InflaterState.StartReadingFooter || _state == System.IO.Compression.InflaterState.ReadingFooter) { if (!_formatReader.ReadFooter(_input)) { return false; } _state = System.IO.Compression.InflaterState.VerifyingFooter; return true; } } if (_state == System.IO.Compression.InflaterState.ReadingBFinal) { if (!_input.EnsureBitsAvailable(1)) { return false; } _bfinal = _input.GetBits(1); _state = System.IO.Compression.InflaterState.ReadingBType; } if (_state == System.IO.Compression.InflaterState.ReadingBType) { if (!_input.EnsureBitsAvailable(2)) { _state = System.IO.Compression.InflaterState.ReadingBType; return false; } _blockType = (System.IO.Compression.BlockType)_input.GetBits(2); if (_blockType == System.IO.Compression.BlockType.Dynamic) { _state = System.IO.Compression.InflaterState.ReadingNumLitCodes; } else if (_blockType == System.IO.Compression.BlockType.Static) { _literalLengthTree = System.IO.Compression.HuffmanTree.StaticLiteralLengthTree; _distanceTree = System.IO.Compression.HuffmanTree.
System.IO.Compression.FileSystem.dll
Decompiled 2 months agousing System.Buffers; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Security; using System.Security.Permissions; using System.Text; [assembly: AssemblyFileVersion("4.6.57.0")] [assembly: AssemblyInformationalVersion("4.6.57.0")] [assembly: AssemblyCopyright("(c) Various Mono authors")] [assembly: AssemblyProduct("Mono Common Language Infrastructure")] [assembly: AssemblyCompany("Mono development team")] [assembly: AssemblyDefaultAlias("System.IO.Compression.FileSystem.dll")] [assembly: AssemblyDescription("System.IO.Compression.FileSystem.dll")] [assembly: AssemblyTitle("System.IO.Compression.FileSystem.dll")] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: CompilationRelaxations(8)] [assembly: AssemblyDelaySign(true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("4.0.0.0")] [module: UnverifiableCode] internal static class Consts { public const string MonoCorlibVersion = "1A5E0066-58DC-428A-B21C-0AD6CDAE2789"; public const string MonoVersion = "6.13.0.0"; public const string MonoCompany = "Mono development team"; public const string MonoProduct = "Mono Common Language Infrastructure"; public const string MonoCopyright = "(c) Various Mono authors"; public const string FxVersion = "4.0.0.0"; public const string FxFileVersion = "4.6.57.0"; public const string EnvironmentVersion = "4.0.30319.42000"; public const string VsVersion = "0.0.0.0"; public const string VsFileVersion = "11.0.0.0"; private const string PublicKeyToken = "b77a5c561934e089"; public const string AssemblyI18N = "I18N, Version=4.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756"; public const string AssemblyMicrosoft_JScript = "Microsoft.JScript, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; public const string AssemblyMicrosoft_VisualStudio = "Microsoft.VisualStudio, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; public const string AssemblyMicrosoft_VisualStudio_Web = "Microsoft.VisualStudio.Web, Version=0.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; public const string AssemblyMicrosoft_VSDesigner = "Microsoft.VSDesigner, Version=0.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; public const string AssemblyMono_Http = "Mono.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756"; public const string AssemblyMono_Posix = "Mono.Posix, Version=4.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756"; public const string AssemblyMono_Security = "Mono.Security, Version=4.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756"; public const string AssemblyMono_Messaging_RabbitMQ = "Mono.Messaging.RabbitMQ, Version=4.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756"; public const string AssemblyCorlib = "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"; public const string AssemblySystem = "System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"; public const string AssemblySystem_Data = "System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"; public const string AssemblySystem_Design = "System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; public const string AssemblySystem_DirectoryServices = "System.DirectoryServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; public const string AssemblySystem_Drawing = "System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; public const string AssemblySystem_Drawing_Design = "System.Drawing.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; public const string AssemblySystem_Messaging = "System.Messaging, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; public const string AssemblySystem_Security = "System.Security, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; public const string AssemblySystem_ServiceProcess = "System.ServiceProcess, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; public const string AssemblySystem_Web = "System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"; public const string AssemblySystem_Windows_Forms = "System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"; public const string AssemblySystem_2_0 = "System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"; public const string AssemblySystemCore_3_5 = "System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"; public const string AssemblySystem_Core = "System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"; public const string WindowsBase_3_0 = "WindowsBase, Version=3.0.0.0, PublicKeyToken=31bf3856ad364e35"; public const string AssemblyWindowsBase = "WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"; public const string AssemblyPresentationCore_3_5 = "PresentationCore, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"; public const string AssemblyPresentationCore_4_0 = "PresentationCore, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"; public const string AssemblyPresentationFramework_3_5 = "PresentationFramework, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"; public const string AssemblySystemServiceModel_3_0 = "System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"; } internal class SR { public const string IO_DirectoryNameWithData = "Zip entry name ends in directory separator character but contains data."; public const string IO_ExtractingResultsInOutside = "Extracting Zip entry would have resulted in a file outside the specified destination directory."; } namespace System.IO { internal static class PathInternal { private static readonly bool s_isCaseSensitive = GetIsCaseSensitive(); internal static StringComparison StringComparison { get { if (!s_isCaseSensitive) { return StringComparison.OrdinalIgnoreCase; } return StringComparison.Ordinal; } } internal static bool IsCaseSensitive => s_isCaseSensitive; private static bool GetIsCaseSensitive() { try { string text = Path.Combine(Path.GetTempPath(), "CASESENSITIVETEST" + Guid.NewGuid().ToString("N")); using (new FileStream(text, FileMode.CreateNew, FileAccess.ReadWrite, FileShare.None, 4096, FileOptions.DeleteOnClose)) { return !File.Exists(text.ToLowerInvariant()); } } catch (Exception) { return false; } } } } namespace System.IO.Compression { public static class ZipFile { private const char PathSeparator = '/'; public static ZipArchive OpenRead(string archiveFileName) { return Open(archiveFileName, ZipArchiveMode.Read); } public static ZipArchive Open(string archiveFileName, ZipArchiveMode mode) { return Open(archiveFileName, mode, null); } public static ZipArchive Open(string archiveFileName, ZipArchiveMode mode, Encoding entryNameEncoding) { FileMode mode2; FileAccess access; FileShare share; switch (mode) { case ZipArchiveMode.Read: mode2 = FileMode.Open; access = FileAccess.Read; share = FileShare.Read; break; case ZipArchiveMode.Create: mode2 = FileMode.CreateNew; access = FileAccess.Write; share = FileShare.None; break; case ZipArchiveMode.Update: mode2 = FileMode.OpenOrCreate; access = FileAccess.ReadWrite; share = FileShare.None; break; default: throw new ArgumentOutOfRangeException("mode"); } FileStream fileStream = new FileStream(archiveFileName, mode2, access, share, 4096, useAsync: false); try { return new ZipArchive(fileStream, mode, leaveOpen: false, entryNameEncoding); } catch { fileStream.Dispose(); throw; } } public static void CreateFromDirectory(string sourceDirectoryName, string destinationArchiveFileName) { DoCreateFromDirectory(sourceDirectoryName, destinationArchiveFileName, null, includeBaseDirectory: false, null); } public static void CreateFromDirectory(string sourceDirectoryName, string destinationArchiveFileName, CompressionLevel compressionLevel, bool includeBaseDirectory) { DoCreateFromDirectory(sourceDirectoryName, destinationArchiveFileName, compressionLevel, includeBaseDirectory, null); } public static void CreateFromDirectory(string sourceDirectoryName, string destinationArchiveFileName, CompressionLevel compressionLevel, bool includeBaseDirectory, Encoding entryNameEncoding) { DoCreateFromDirectory(sourceDirectoryName, destinationArchiveFileName, compressionLevel, includeBaseDirectory, entryNameEncoding); } public static void ExtractToDirectory(string sourceArchiveFileName, string destinationDirectoryName) { ExtractToDirectory(sourceArchiveFileName, destinationDirectoryName, null); } public static void ExtractToDirectory(string sourceArchiveFileName, string destinationDirectoryName, bool overwrite) { ExtractToDirectory(sourceArchiveFileName, destinationDirectoryName, null, overwrite); } public static void ExtractToDirectory(string sourceArchiveFileName, string destinationDirectoryName, Encoding entryNameEncoding) { ExtractToDirectory(sourceArchiveFileName, destinationDirectoryName, entryNameEncoding, overwrite: false); } public static void ExtractToDirectory(string sourceArchiveFileName, string destinationDirectoryName, Encoding entryNameEncoding, bool overwrite) { if (sourceArchiveFileName == null) { throw new ArgumentNullException("sourceArchiveFileName"); } using ZipArchive source = Open(sourceArchiveFileName, ZipArchiveMode.Read, entryNameEncoding); source.ExtractToDirectory(destinationDirectoryName, overwrite); } private static void DoCreateFromDirectory(string sourceDirectoryName, string destinationArchiveFileName, CompressionLevel? compressionLevel, bool includeBaseDirectory, Encoding entryNameEncoding) { sourceDirectoryName = Path.GetFullPath(sourceDirectoryName); destinationArchiveFileName = Path.GetFullPath(destinationArchiveFileName); using ZipArchive zipArchive = Open(destinationArchiveFileName, ZipArchiveMode.Create, entryNameEncoding); bool flag = true; DirectoryInfo directoryInfo = new DirectoryInfo(sourceDirectoryName); string fullName = directoryInfo.FullName; if (includeBaseDirectory && directoryInfo.Parent != null) { fullName = directoryInfo.Parent.FullName; } char[] buffer = ArrayPool<char>.Shared.Rent(260); try { foreach (FileSystemInfo item in directoryInfo.EnumerateFileSystemInfos("*", SearchOption.AllDirectories)) { flag = false; int length = item.FullName.Length - fullName.Length; if (item is FileInfo) { string entryName = EntryFromPath(item.FullName, fullName.Length, length, ref buffer); ZipFileExtensions.DoCreateEntryFromFile(zipArchive, item.FullName, entryName, compressionLevel); } else if (item is DirectoryInfo possiblyEmptyDir && IsDirEmpty(possiblyEmptyDir)) { string entryName2 = EntryFromPath(item.FullName, fullName.Length, length, ref buffer, appendPathSeparator: true); zipArchive.CreateEntry(entryName2); } } if (includeBaseDirectory && flag) { zipArchive.CreateEntry(EntryFromPath(directoryInfo.Name, 0, directoryInfo.Name.Length, ref buffer, appendPathSeparator: true)); } } finally { ArrayPool<char>.Shared.Return(buffer, false); } } private static string EntryFromPath(string entry, int offset, int length, ref char[] buffer, bool appendPathSeparator = false) { while (length > 0 && (entry[offset] == Path.DirectorySeparatorChar || entry[offset] == Path.AltDirectorySeparatorChar)) { offset++; length--; } if (length == 0) { if (!appendPathSeparator) { return string.Empty; } return '/'.ToString(); } int num = (appendPathSeparator ? (length + 1) : length); EnsureCapacity(ref buffer, num); entry.CopyTo(offset, buffer, 0, length); for (int i = 0; i < length; i++) { char c = buffer[i]; if (c == Path.DirectorySeparatorChar || c == Path.AltDirectorySeparatorChar) { buffer[i] = '/'; } } if (appendPathSeparator) { buffer[length] = '/'; } return new string(buffer, 0, num); } private static void EnsureCapacity(ref char[] buffer, int min) { if (buffer.Length < min) { int num = buffer.Length * 2; if (num < min) { num = min; } ArrayPool<char>.Shared.Return(buffer, false); buffer = ArrayPool<char>.Shared.Rent(num); } } private static bool IsDirEmpty(DirectoryInfo possiblyEmptyDir) { using IEnumerator<string> enumerator = Directory.EnumerateFileSystemEntries(possiblyEmptyDir.FullName).GetEnumerator(); return !enumerator.MoveNext(); } } [EditorBrowsable(EditorBrowsableState.Never)] public static class ZipFileExtensions { public static ZipArchiveEntry CreateEntryFromFile(this ZipArchive destination, string sourceFileName, string entryName) { return DoCreateEntryFromFile(destination, sourceFileName, entryName, null); } public static ZipArchiveEntry CreateEntryFromFile(this ZipArchive destination, string sourceFileName, string entryName, CompressionLevel compressionLevel) { return DoCreateEntryFromFile(destination, sourceFileName, entryName, compressionLevel); } public static void ExtractToDirectory(this ZipArchive source, string destinationDirectoryName) { source.ExtractToDirectory(destinationDirectoryName, overwrite: false); } public static void ExtractToDirectory(this ZipArchive source, string destinationDirectoryName, bool overwrite) { if (source == null) { throw new ArgumentNullException("source"); } if (destinationDirectoryName == null) { throw new ArgumentNullException("destinationDirectoryName"); } string text = Directory.CreateDirectory(destinationDirectoryName).FullName; if (!text.EndsWith(Path.DirectorySeparatorChar)) { text += Path.DirectorySeparatorChar; } foreach (ZipArchiveEntry entry in source.Entries) { string fullPath = Path.GetFullPath(Path.Combine(text, entry.FullName)); if (!fullPath.StartsWith(text, System.IO.PathInternal.StringComparison)) { throw new IOException("Extracting Zip entry would have resulted in a file outside the specified destination directory."); } if (Path.GetFileName(fullPath).Length == 0) { if (entry.Length != 0L) { throw new IOException("Zip entry name ends in directory separator character but contains data."); } Directory.CreateDirectory(fullPath); } else { Directory.CreateDirectory(Path.GetDirectoryName(fullPath)); entry.ExtractToFile(fullPath, overwrite); } } } internal static ZipArchiveEntry DoCreateEntryFromFile(ZipArchive destination, string sourceFileName, string entryName, CompressionLevel? compressionLevel) { if (destination == null) { throw new ArgumentNullException("destination"); } if (sourceFileName == null) { throw new ArgumentNullException("sourceFileName"); } if (entryName == null) { throw new ArgumentNullException("entryName"); } using Stream stream = new FileStream(sourceFileName, FileMode.Open, FileAccess.Read, FileShare.Read, 4096, useAsync: false); ZipArchiveEntry zipArchiveEntry = (compressionLevel.HasValue ? destination.CreateEntry(entryName, compressionLevel.Value) : destination.CreateEntry(entryName)); DateTime dateTime = File.GetLastWriteTime(sourceFileName); if (dateTime.Year < 1980 || dateTime.Year > 2107) { dateTime = new DateTime(1980, 1, 1, 0, 0, 0); } zipArchiveEntry.LastWriteTime = dateTime; using (Stream destination2 = zipArchiveEntry.Open()) { stream.CopyTo(destination2); } return zipArchiveEntry; } public static void ExtractToFile(this ZipArchiveEntry source, string destinationFileName) { source.ExtractToFile(destinationFileName, overwrite: false); } public static void ExtractToFile(this ZipArchiveEntry source, string destinationFileName, bool overwrite) { if (source == null) { throw new ArgumentNullException("source"); } if (destinationFileName == null) { throw new ArgumentNullException("destinationFileName"); } FileMode mode = ((!overwrite) ? FileMode.CreateNew : FileMode.Create); using (Stream destination = new FileStream(destinationFileName, mode, FileAccess.Write, FileShare.None, 4096, useAsync: false)) { using Stream stream = source.Open(); stream.CopyTo(destination); } File.SetLastWriteTime(destinationFileName, source.LastWriteTime.DateTime); } } }