Decompiled source of Government Database Rework v1.0.1
GovernmentDatabaseRework.dll
Decompiled a week ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using BepInEx; using BepInEx.Configuration; using BepInEx.Core.Logging.Interpolation; using BepInEx.Logging; using BepInEx.Unity.IL2CPP; using HarmonyLib; using Il2CppInterop.Runtime.InteropTypes; using Il2CppSystem; using Il2CppSystem.Collections.Generic; using Microsoft.CodeAnalysis; using TMPro; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("GovernmentDatabaseRework")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+ea1649261c0fab9ed9de9ec6167599568b30696a")] [assembly: AssemblyProduct("GovernmentDatabaseRework")] [assembly: AssemblyTitle("GovernmentDatabaseRework")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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 GovernmentDatabaseRework { internal sealed class DirectoryEntry { internal Human Citizen; internal string Display; internal string SortKey; internal string MatchKey; } internal sealed class AppState { internal DatabaseApp App; internal ComputerOSMultiSelect List; internal RectTransform DataDisplay; internal RectTransform ActorEntry; internal RawImage Headshot; internal TextMeshProUGUI InfoText; internal RectTransform FingerprintCard; internal RawImage FingerprintImage; internal TextMeshProUGUI FingerprintLabel; internal TextMeshProUGUI PageLabel; internal RectTransform ElementParent; internal float RowHeight = 0.06f; internal readonly List<ComputerOSMultiSelectElement> Rows = new List<ComputerOSMultiSelectElement>(); internal List<OSMultiOption> CurrentOptions; internal bool Rendering; internal TextMeshProUGUI PreviewPageLabel; internal int PreviewPage; internal int PreviewPageCount = 1; internal readonly List<IntPtr> OwnedButtons = new List<IntPtr>(); internal bool LayoutApplied; internal int EntriesPerPage = 4; internal List<DirectoryEntry> Pool; internal List<DirectoryEntry> Matches; internal int PageIndex; internal int LastResultCount; internal string LastSearch; internal List<DataKey> PrintKeys; internal string PrintKeysDescription; internal bool LoggedFirstPreview; internal int FingerprintsLogged; internal int Reveals; internal bool LoggedRevealCap; internal int LoggedRowCount = -1; internal int LastChildCount = -1; internal Texture LastPhoto; internal int LastPhotoHumanId = int.MinValue; internal int LastPreviewHumanId = int.MinValue; internal bool LastPreviewWasEmpty; } internal static class AppRegistry { private static readonly Dictionary<IntPtr, AppState> ByApp = new Dictionary<IntPtr, AppState>(); private static readonly Dictionary<IntPtr, AppState> ByList = new Dictionary<IntPtr, AppState>(); private static readonly Dictionary<IntPtr, Action> ButtonActions = new Dictionary<IntPtr, Action>(); internal static void RegisterButton(AppState state, ComputerOSUIComponent component, Action action) { if (state != null && !((Object)(object)component == (Object)null) && action != null) { IntPtr pointer = ((Il2CppObjectBase)component).Pointer; ButtonActions[pointer] = action; state.OwnedButtons.Add(pointer); } } internal static Action ActionForButton(ComputerOSUIComponent component) { if ((Object)(object)component == (Object)null || ButtonActions.Count == 0) { return null; } Action value; return ButtonActions.TryGetValue(((Il2CppObjectBase)component).Pointer, out value) ? value : null; } internal static AppState GetOrCreate(DatabaseApp app) { if ((Object)(object)app == (Object)null) { return null; } IntPtr pointer = ((Il2CppObjectBase)app).Pointer; if (ByApp.TryGetValue(pointer, out var value)) { return value; } AppState appState = new AppState { App = app, List = app.list }; ByApp[pointer] = appState; if ((Object)(object)appState.List != (Object)null) { ByList[((Il2CppObjectBase)appState.List).Pointer] = appState; } return appState; } internal static AppState Get(DatabaseApp app) { if ((Object)(object)app == (Object)null) { return null; } AppState value; return ByApp.TryGetValue(((Il2CppObjectBase)app).Pointer, out value) ? value : null; } internal static AppState ForList(ComputerOSMultiSelect list) { if ((Object)(object)list == (Object)null) { return null; } AppState value; return ByList.TryGetValue(((Il2CppObjectBase)list).Pointer, out value) ? value : null; } internal static void Remove(DatabaseApp app) { if ((Object)(object)app == (Object)null) { return; } IntPtr pointer = ((Il2CppObjectBase)app).Pointer; if (!ByApp.TryGetValue(pointer, out var value)) { return; } ByApp.Remove(pointer); if ((Object)(object)value.List != (Object)null) { ByList.Remove(((Il2CppObjectBase)value.List).Pointer); } foreach (IntPtr ownedButton in value.OwnedButtons) { ButtonActions.Remove(ownedButton); } value.OwnedButtons.Clear(); } } internal static class ListingConfig { internal static ConfigEntry<bool> Enabled; internal static ConfigEntry<bool> SurnameFirst; internal static ConfigEntry<int> MinimumSearchLength; internal static ConfigEntry<bool> MatchAnywhereInName; internal static ConfigEntry<string> EmptySearchHint; internal static void Bind(ConfigFile config) { Enabled = config.Bind<bool>("Listing", "Enabled", true, "Master switch for the browsing rework. When false the databases go back to the vanilla behaviour of showing nothing until you have typed two letters."); SurnameFirst = config.Bind<bool>("Listing", "SurnameFirst", true, "List and sort citizens as \"Surname, Firstname\", the way a government register reads. Turn this off to sort and display by full name instead."); MinimumSearchLength = config.Bind<int>("Listing", "MinimumSearchLength", 0, "How many characters must be typed before the list is filtered. 0 means the whole database is browsable from the moment the app opens, which is the point of this mod. Vanilla was 2."); MatchAnywhereInName = config.Bind<bool>("Listing", "MatchAnywhereInName", true, "When filtering, match the typed characters anywhere in the name (vanilla behaviour). Turn this off to match only names that start with what you typed, which suits an alphabetical list better."); EmptySearchHint = config.Bind<string>("Listing", "EmptySearchHint", "ALL RECORDS - TYPE TO FILTER", "Text shown on the search line while nothing has been typed."); } } internal static class LayoutConfig { internal static ConfigEntry<bool> TwoColumnLayout; internal static ConfigEntry<bool> HideOnscreenKeyboard; internal static ConfigEntry<float> KeyboardHeight; internal static ConfigEntry<int> EntriesPerPage; internal static void Bind(ConfigFile config) { TwoColumnLayout = config.Bind<bool>("Layout", "TwoColumnLayout", true, "Split the app into a list on the left and a live profile on the right. When false the screen keeps its vanilla single-column shape and only the list contents change."); HideOnscreenKeyboard = config.Bind<bool>("Layout", "HideOnscreenKeyboard", false, "Hide the app's on-screen keyboard and give the space to the list, which fits noticeably more names per page. You can still type on a real keyboard; leave this off if you play on a controller."); KeyboardHeight = config.Bind<float>("Layout", "KeyboardHeight", 0.135f, "Height of the on-screen keyboard strip, in the cruncher screen's own units (the whole screen is roughly 1.0 tall). Vanilla is 0.28. Shorter keys mean more rows of names."); EntriesPerPage = config.Bind<int>("Layout", "EntriesPerPage", 0, "Names per page. 0 auto-fits as many as the list area can show without overflowing, which is what you want. A value larger than fits will be clamped down."); } } internal static class PreviewConfig { internal static ConfigEntry<bool> ShowPreview; internal static ConfigEntry<bool> ShowPhoto; internal static ConfigEntry<bool> ShowNameHeader; internal static ConfigEntry<float> FontScale; internal static ConfigEntry<bool> HideUnknownFields; internal static ConfigEntry<bool> FingerprintInCorner; internal static ConfigEntry<bool> RevealFingerprintOnPreview; internal static ConfigEntry<int> MaxRevealsPerSession; internal static void Bind(ConfigFile config) { FontScale = config.Bind<float>("Preview", "FontScale", 0.9f, "How much larger the profile text is than the size the screen was authored at. The profile spills onto extra pages rather than shrinking, so a bigger number here costs pages, not legibility."); FingerprintInCorner = config.Bind<bool>("Preview", "FingerprintInCorner", true, "Lift the fingerprint identifier out of the list of fields and set it in the top right corner, opposite the photo, the way the printed record carries it. It stays shown even when the record has no answer for it, because the corner is part of the form."); RevealFingerprintOnPreview = config.Bind<bool>("Preview", "RevealFingerprintOnPreview", true, "Looking a record up puts that citizen's prints on file, the same way meeting their print in the world would: the game hands out the next identifier in its sequence and the record keeps it for good. Turn this off and the card only shows prints you already had. Note that with this on, paging through the register files everyone you stop on, which spends the sequence quickly."); MaxRevealsPerSession = config.Bind<int>("Preview", "MaxRevealsPerSession", 500, "A ceiling on how many identifiers one session may hand out. This is a runaway guard rather than a balance setting - it exists so a fault can never sit there allocating forever."); HideUnknownFields = config.Bind<bool>("Preview", "HideUnknownFields", true, "Leave out the rows the record has no answer for. The game lists every field a citizen could have and marks the unknown ones with a question mark, which is most of a full-screen wall of text carrying no information."); ShowPreview = config.Bind<bool>("Preview", "ShowPreview", true, "Show the selected citizen's profile on the right-hand side before you print it. The information shown is generated from the same evidence entry and the same data keys the printout uses."); ShowPhoto = config.Bind<bool>("Preview", "ShowPhoto", true, "Include the citizen's photo in the preview. Turn this off if the photo is missing, slow, or you would rather have the extra room for text."); ShowNameHeader = config.Bind<bool>("Preview", "ShowNameHeader", true, "Print the citizen's name as a heading above the profile body. Turn this off if the body already leads with the name."); } } internal static class DebugConfig { internal static ConfigEntry<bool> VerboseLogging; internal static void Bind(ConfigFile config) { VerboseLogging = config.Bind<bool>("Debug", "VerboseLogging", false, "Log every list rebuild and every preview render. Noisy; only for diagnosing."); } } [HarmonyPatch(typeof(DatabaseApp), "OnSetup")] internal static class DatabaseAppOnSetupPatch { private static void Postfix(DatabaseApp __instance) { //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Expected O, but got Unknown if (!ListingConfig.Enabled.Value) { return; } try { AppState orCreate = AppRegistry.GetOrCreate(__instance); if (orCreate != null) { orCreate.FingerprintsLogged = 0; DatabaseLayout.Apply(__instance, orCreate); DatabaseListing.Invalidate(orCreate); __instance.UpdateSearch(); DatabasePreview.Show(__instance); } } catch (Exception ex) { ManualLogSource logger = Plugin.Logger; bool flag = default(bool); BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(39, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("["); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("CalebScott.GovernmentDatabaseRework"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("] Setting up the database app failed: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Exception>(ex); } logger.LogError(val); } } } [HarmonyPatch(typeof(DatabaseApp), "UpdateSearch")] internal static class DatabaseAppUpdateSearchPatch { private static bool Prefix(DatabaseApp __instance) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown if (!ListingConfig.Enabled.Value) { return true; } try { return !DatabaseListing.Rebuild(__instance); } catch (Exception ex) { ManualLogSource logger = Plugin.Logger; bool flag = default(bool); BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(67, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("["); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("CalebScott.GovernmentDatabaseRework"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("] Rebuilding the list failed, falling back to "); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("the vanilla search: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Exception>(ex); } logger.LogError(val); return true; } } } [HarmonyPatch(typeof(DatabaseApp), "UpdateSelected")] internal static class DatabaseAppUpdateSelectedPatch { private static void Postfix(DatabaseApp __instance) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Expected O, but got Unknown if (!ListingConfig.Enabled.Value || !PreviewConfig.ShowPreview.Value) { return; } try { DatabasePreview.Show(__instance); } catch (Exception ex) { ManualLogSource logger = Plugin.Logger; bool flag = default(bool); BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(41, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("["); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("CalebScott.GovernmentDatabaseRework"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("] Rendering the profile preview failed: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Exception>(ex); } logger.LogError(val); } } } [HarmonyPatch(typeof(DatabaseApp), "OnDestroy")] internal static class DatabaseAppOnDestroyPatch { private static void Postfix(DatabaseApp __instance) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown try { AppRegistry.Remove(__instance); } catch (Exception ex) { ManualLogSource logger = Plugin.Logger; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(32, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("["); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("CalebScott.GovernmentDatabaseRework"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("] Cleaning up app state threw: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message); } logger.LogWarning(val); } } } [HarmonyPatch(typeof(ComputerOSUIComponent), "OnLeftClick")] internal static class ComputerOSUIComponentOnLeftClickPatch { private static void Postfix(ComputerOSUIComponent __instance) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown try { AppRegistry.ActionForButton(__instance)?.Invoke(); } catch (Exception ex) { ManualLogSource logger = Plugin.Logger; bool flag = default(bool); BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(27, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("["); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("CalebScott.GovernmentDatabaseRework"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("] A button action failed: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Exception>(ex); } logger.LogError(val); } } } [HarmonyPatch(typeof(ComputerOSMultiSelect), "NextPage")] internal static class ComputerOSMultiSelectNextPagePatch { private static bool Prefix(ComputerOSMultiSelect __instance, int newPage) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown try { AppState appState = AppRegistry.ForList(__instance); if (appState == null) { return true; } DatabaseListing.TurnPage(appState, newPage); return false; } catch (Exception ex) { ManualLogSource logger = Plugin.Logger; bool flag = default(bool); BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(33, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("["); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("CalebScott.GovernmentDatabaseRework"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("] Turning the list page failed: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Exception>(ex); } logger.LogError(val); return false; } } } [HarmonyPatch(typeof(DatabaseApp), "Update")] internal static class DatabaseAppUpdatePatch { private static void Postfix(DatabaseApp __instance) { //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Expected O, but got Unknown if (!ListingConfig.Enabled.Value) { return; } try { AppState appState = AppRegistry.Get(__instance); if (appState != null && !((Object)(object)appState.ElementParent == (Object)null)) { int childCount = ((Transform)appState.ElementParent).childCount; if (childCount != appState.LastChildCount) { appState.LastChildCount = childCount; DatabaseLayout.LayOutRows(appState); } } } catch (Exception ex) { ManualLogSource logger = Plugin.Logger; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(21, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("["); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("CalebScott.GovernmentDatabaseRework"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("] Row upkeep threw: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message); } logger.LogWarning(val); } } } [HarmonyPatch(typeof(ComputerOSMultiSelect), "SpawnList")] internal static class ComputerOSMultiSelectSpawnListPatch { private static void Postfix(ComputerOSMultiSelect __instance) { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown try { AppState appState = AppRegistry.ForList(__instance); if (appState != null && !appState.Rendering) { if (appState.CurrentOptions != null) { DatabaseLayout.RenderRows(appState, appState.CurrentOptions); } DatabaseLayout.UpdatePageLabel(appState); } } catch (Exception ex) { ManualLogSource logger = Plugin.Logger; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(29, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("["); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("CalebScott.GovernmentDatabaseRework"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("] Page label refresh threw: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message); } logger.LogWarning(val); } } } internal static class DatabaseLayout { private const float ContentTop = -0.08f; private const float ContentHeight = 0.7f; private const float LeftMargin = 0.02f; private const float ColumnGap = 0.02f; private const float ListColumnWidth = 0.42f; private const float PreviewColumnX = 0.46f; private const float PreviewColumnWidth = 0.52f; private const float KeyboardWidth = 0.92f; private const float VanillaKeyboardHeight = 0.28f; private const float SearchLineHeight = 0.055f; private const float NavRowHeight = 0.05f; private const float NavButtonWidth = 0.07f; private const float PrintRowHeight = 0.08f; private const float PhotoSize = 0.128f; private const float FingerprintLabelHeight = 0.055f; private const float DefaultElementHeight = 0.06f; private static readonly Vector2 TopLeft = new Vector2(0f, 1f); private static readonly Vector2 TopRight = new Vector2(1f, 1f); private static readonly Vector2 BottomRight = new Vector2(1f, 0f); internal static void Apply(DatabaseApp app, AppState state) { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Expected O, but got Unknown //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Expected O, but got Unknown //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_030b: Unknown result type (might be due to invalid IL or missing references) //IL_0310: Unknown result type (might be due to invalid IL or missing references) //IL_0315: Unknown result type (might be due to invalid IL or missing references) //IL_0324: Unknown result type (might be due to invalid IL or missing references) //IL_0330: Unknown result type (might be due to invalid IL or missing references) //IL_034c: Unknown result type (might be due to invalid IL or missing references) //IL_0351: Unknown result type (might be due to invalid IL or missing references) //IL_0360: Unknown result type (might be due to invalid IL or missing references) //IL_036f: Unknown result type (might be due to invalid IL or missing references) //IL_037b: Unknown result type (might be due to invalid IL or missing references) //IL_0398: Unknown result type (might be due to invalid IL or missing references) //IL_039d: Unknown result type (might be due to invalid IL or missing references) //IL_03a2: Unknown result type (might be due to invalid IL or missing references) //IL_03b1: Unknown result type (might be due to invalid IL or missing references) //IL_03bd: Unknown result type (might be due to invalid IL or missing references) //IL_0455: Unknown result type (might be due to invalid IL or missing references) //IL_045c: Expected O, but got Unknown if (state.LayoutApplied) { return; } state.LayoutApplied = true; RectTransform val = As<RectTransform>((Object)(object)((Component)app).transform); bool flag = default(bool); if ((Object)(object)val == (Object)null) { ManualLogSource logger = Plugin.Logger; BepInExWarningLogInterpolatedStringHandler val2 = new BepInExWarningLogInterpolatedStringHandler(59, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("["); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>("CalebScott.GovernmentDatabaseRework"); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("] App root has no RectTransform; leaving the layout alone."); } logger.LogWarning(val2); return; } RectTransform val3 = Child((Transform)(object)val, "SearchDisplay"); RectTransform val4 = Child((Transform)(object)val, "DataDisplay"); RectTransform val5 = (((Object)(object)val3 != (Object)null) ? Child((Transform)(object)val3, "Results") : null); RectTransform val6 = (((Object)(object)val5 != (Object)null) ? Child((Transform)(object)val5, "ElementParent") : null); RectTransform val7 = (((Object)(object)val5 != (Object)null) ? Child((Transform)(object)val5, "ScrollUpButton") : null); RectTransform val8 = (((Object)(object)val5 != (Object)null) ? Child((Transform)(object)val5, "ScrollDownButton") : null); RectTransform val9 = (((Object)(object)val3 != (Object)null) ? Child((Transform)(object)val3, "OnscreenKeyboard") : null); ManualLogSource logger2 = Plugin.Logger; BepInExInfoLogInterpolatedStringHandler val10 = new BepInExInfoLogInterpolatedStringHandler(74, 9, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val10).AppendLiteral("["); ((BepInExLogInterpolatedStringHandler)val10).AppendFormatted<string>("CalebScott.GovernmentDatabaseRework"); ((BepInExLogInterpolatedStringHandler)val10).AppendLiteral("] Laying out "); ((BepInExLogInterpolatedStringHandler)val10).AppendFormatted<CitizenPool>(app.citizenPool); ((BepInExLogInterpolatedStringHandler)val10).AppendLiteral(" app: "); ((BepInExLogInterpolatedStringHandler)val10).AppendLiteral("search="); ((BepInExLogInterpolatedStringHandler)val10).AppendFormatted<string>(Found((Object)(object)val3)); ((BepInExLogInterpolatedStringHandler)val10).AppendLiteral(" data="); ((BepInExLogInterpolatedStringHandler)val10).AppendFormatted<string>(Found((Object)(object)val4)); ((BepInExLogInterpolatedStringHandler)val10).AppendLiteral(" results="); ((BepInExLogInterpolatedStringHandler)val10).AppendFormatted<string>(Found((Object)(object)val5)); ((BepInExLogInterpolatedStringHandler)val10).AppendLiteral(" "); ((BepInExLogInterpolatedStringHandler)val10).AppendLiteral("elements="); ((BepInExLogInterpolatedStringHandler)val10).AppendFormatted<string>(Found((Object)(object)val6)); ((BepInExLogInterpolatedStringHandler)val10).AppendLiteral(" prev="); ((BepInExLogInterpolatedStringHandler)val10).AppendFormatted<string>(Found((Object)(object)val7)); ((BepInExLogInterpolatedStringHandler)val10).AppendLiteral(" "); ((BepInExLogInterpolatedStringHandler)val10).AppendLiteral("next="); ((BepInExLogInterpolatedStringHandler)val10).AppendFormatted<string>(Found((Object)(object)val8)); ((BepInExLogInterpolatedStringHandler)val10).AppendLiteral(" keyboard="); ((BepInExLogInterpolatedStringHandler)val10).AppendFormatted<string>(Found((Object)(object)val9)); } logger2.LogInfo(val10); if ((Object)(object)val3 == (Object)null || (Object)(object)val5 == (Object)null || (Object)(object)val6 == (Object)null) { Plugin.Logger.LogWarning((object)"[CalebScott.GovernmentDatabaseRework] The app prefab is not the shape this mod expects, so the screen keeps its vanilla layout. Browsing still works."); state.EntriesPerPage = (((Object)(object)app.list != (Object)null) ? app.list.maxPerPage : 4); return; } float num = (LayoutConfig.HideOnscreenKeyboard.Value ? 0f : Mathf.Clamp(LayoutConfig.KeyboardHeight.Value, 0.06f, 0.4f)); float num2 = 0.7f - ((num > 0f) ? (num + 0.02f) : 0f); MoveKeyboard(val, val9, num); Place(val3, TopLeft, TopLeft, TopLeft, new Vector2(0.02f, -0.08f), new Vector2(0.42f, num2)); float num3 = num2 - 0.055f - 0.005f; Place(val5, TopLeft, TopRight, new Vector2(0.5f, 1f), new Vector2(0f, -0.055f), new Vector2(-0.04f, num3)); float num4 = num3 - 0.05f - 0.01f; Place(val6, TopLeft, TopLeft, TopLeft, new Vector2(0.015f, -0.005f), new Vector2(0.35f, num4)); state.ElementParent = val6; state.EntriesPerPage = EntriesThatFit(app, num4); state.RowHeight = num4 / (float)state.EntriesPerPage; BuildListPageNavigation(state, val5, val7, val8, app); if (LayoutConfig.TwoColumnLayout.Value && (Object)(object)val4 != (Object)null) { BuildPreviewPanel(state, val4, num2, app, val7, val8); } else if ((Object)(object)val4 == (Object)null) { Plugin.Logger.LogWarning((object)"[CalebScott.GovernmentDatabaseRework] No DataDisplay panel on this app prefab; the profile preview is unavailable."); } ManualLogSource logger3 = Plugin.Logger; val10 = new BepInExInfoLogInterpolatedStringHandler(72, 7, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val10).AppendLiteral("["); ((BepInExLogInterpolatedStringHandler)val10).AppendFormatted<string>("CalebScott.GovernmentDatabaseRework"); ((BepInExLogInterpolatedStringHandler)val10).AppendLiteral("] Layout done: column="); ((BepInExLogInterpolatedStringHandler)val10).AppendFormatted<float>(num2, "0.###"); ((BepInExLogInterpolatedStringHandler)val10).AppendLiteral(" "); ((BepInExLogInterpolatedStringHandler)val10).AppendLiteral("keyboard="); ((BepInExLogInterpolatedStringHandler)val10).AppendFormatted<float>(num, "0.###"); ((BepInExLogInterpolatedStringHandler)val10).AppendLiteral(" listArea="); ((BepInExLogInterpolatedStringHandler)val10).AppendFormatted<float>(num4, "0.###"); ((BepInExLogInterpolatedStringHandler)val10).AppendLiteral(" "); ((BepInExLogInterpolatedStringHandler)val10).AppendLiteral("perPage="); ((BepInExLogInterpolatedStringHandler)val10).AppendFormatted<int>(state.EntriesPerPage); ((BepInExLogInterpolatedStringHandler)val10).AppendLiteral(" rowHeight="); ((BepInExLogInterpolatedStringHandler)val10).AppendFormatted<float>(state.RowHeight, "0.####"); ((BepInExLogInterpolatedStringHandler)val10).AppendLiteral(" "); ((BepInExLogInterpolatedStringHandler)val10).AppendLiteral("preview="); ((BepInExLogInterpolatedStringHandler)val10).AppendFormatted<string>(((Object)(object)state.InfoText != (Object)null) ? "on" : "off"); } logger3.LogInfo(val10); } internal static void LayOutRows(AppState state) { //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Expected O, but got Unknown //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Expected O, but got Unknown //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) if (state == null || (Object)(object)state.ElementParent == (Object)null) { return; } bool flag = default(bool); try { int num = 0; int childCount = ((Transform)state.ElementParent).childCount; for (int i = 0; i < childCount; i++) { Transform child = ((Transform)state.ElementParent).GetChild(i); if (!((Object)(object)child == (Object)null) && ((Component)child).gameObject.activeSelf) { RectTransform val = As<RectTransform>((Object)(object)child); if (!((Object)(object)val == (Object)null)) { Place(val, TopLeft, TopRight, new Vector2(0.5f, 1f), new Vector2(0f, (float)(-num) * state.RowHeight), new Vector2(0f, state.RowHeight)); num++; } } } if (num != state.LoggedRowCount) { state.LoggedRowCount = num; ManualLogSource logger = Plugin.Logger; BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(106, 7, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("["); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>("CalebScott.GovernmentDatabaseRework"); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("] Row layout: "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<int>(num); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" row(s) placed of "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<int>(childCount); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" child object(s), widget tracks "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<int>(((Object)(object)state.List != (Object)null && state.List.options != null) ? state.List.options.Count : (-1)); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(", "); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("page holds "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<int>(state.EntriesPerPage); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(", each "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<float>(state.RowHeight, "0.####"); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" tall "); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("in a box "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<float>(state.ElementParent.sizeDelta.y, "0.####"); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" tall."); } logger.LogInfo(val2); } } catch (Exception ex) { ManualLogSource logger2 = Plugin.Logger; BepInExWarningLogInterpolatedStringHandler val3 = new BepInExWarningLogInterpolatedStringHandler(30, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("["); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>("CalebScott.GovernmentDatabaseRework"); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("] Laying out the rows threw: "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>(ex.Message); } logger2.LogWarning(val3); } } internal static void RenderRows(AppState state, List<OSMultiOption> options) { //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Expected O, but got Unknown //IL_029c: Unknown result type (might be due to invalid IL or missing references) //IL_02a3: Expected O, but got Unknown ComputerOSMultiSelect list = state.List; if ((Object)(object)list == (Object)null || (Object)(object)state.ElementParent == (Object)null || options == null) { return; } bool flag2 = default(bool); try { state.Rows.RemoveAll((ComputerOSMultiSelectElement row) => !IsAlive(row, state.ElementParent)); GameObject elementPrefab = list.elementPrefab; int count = options.Count; while (state.Rows.Count < count && (Object)(object)elementPrefab != (Object)null) { GameObject val = Clone(elementPrefab, state.ElementParent, "DatabaseListEntry"); ComputerOSMultiSelectElement val2 = (((Object)(object)val != (Object)null) ? val.GetComponent<ComputerOSMultiSelectElement>() : null); if ((Object)(object)val2 == (Object)null) { if ((Object)(object)val != (Object)null) { Object.Destroy((Object)(object)val); } Plugin.Logger.LogWarning((object)"[CalebScott.GovernmentDatabaseRework] The row prefab has no list-element component; cannot build the page."); break; } state.Rows.Add(val2); } for (int num = 0; num < state.Rows.Count; num++) { bool flag = num < count; ((Component)state.Rows[num]).gameObject.SetActive(flag); if (!flag) { continue; } try { state.Rows[num].Setup(options[num], list); } catch (Exception ex) { ManualLogSource logger = Plugin.Logger; BepInExWarningLogInterpolatedStringHandler val3 = new BepInExWarningLogInterpolatedStringHandler(26, 3, ref flag2); if (flag2) { ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("["); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>("CalebScott.GovernmentDatabaseRework"); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("] Setting up row "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<int>(num); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(" threw: "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>(ex.Message); } logger.LogWarning(val3); } } if (list.options != null) { list.options.Clear(); for (int num2 = 0; num2 < state.Rows.Count && num2 < count; num2++) { list.options.Add(state.Rows[num2]); } } LayOutRows(state); } catch (Exception ex2) { ManualLogSource logger2 = Plugin.Logger; BepInExWarningLogInterpolatedStringHandler val3 = new BepInExWarningLogInterpolatedStringHandler(27, 2, ref flag2); if (flag2) { ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("["); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>("CalebScott.GovernmentDatabaseRework"); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("] Drawing the page threw: "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>(ex2.Message); } logger2.LogWarning(val3); } } private static bool IsAlive(ComputerOSMultiSelectElement row, RectTransform parent) { try { if ((Object)(object)row == (Object)null) { return false; } GameObject gameObject = ((Component)row).gameObject; if ((Object)(object)gameObject == (Object)null) { return false; } Transform transform = gameObject.transform; return (Object)(object)transform != (Object)null && (Object)(object)transform.parent != (Object)null && ((Il2CppObjectBase)transform.parent).Pointer == ((Il2CppObjectBase)parent).Pointer; } catch (Exception) { return false; } } private static void MoveKeyboard(RectTransform root, RectTransform keyboard, float height) { //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Expected O, but got Unknown //IL_0034: 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_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00da: 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_00e5: 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) if ((Object)(object)keyboard == (Object)null) { return; } if (height <= 0f) { ((Component)keyboard).gameObject.SetActive(false); return; } float num = keyboard.sizeDelta.y; if (num <= 0f) { num = 0.28f; } ((Transform)keyboard).SetParent((Transform)(object)root, false); Place(keyboard, TopLeft, TopLeft, TopLeft, new Vector2(0.02f, -0.78f + height), new Vector2(0.92f, height)); try { GridLayoutGroup component = ((Component)keyboard).GetComponent<GridLayoutGroup>(); if ((Object)(object)component != (Object)null) { float num2 = height / num; Vector2 cellSize = component.cellSize; component.cellSize = new Vector2(cellSize.x, cellSize.y * num2); Vector2 spacing = component.spacing; component.spacing = new Vector2(spacing.x, spacing.y * num2); } } catch (Exception ex) { ManualLogSource logger = Plugin.Logger; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(40, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("["); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("CalebScott.GovernmentDatabaseRework"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("] Could not rescale the keyboard grid: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message); } logger.LogWarning(val); } } private static void BuildListPageNavigation(AppState state, RectTransform results, RectTransform prevButton, RectTransform nextButton, DatabaseApp app) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //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_0034: 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_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: 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_008b: 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_0103: 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) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)prevButton != (Object)null) { Place(prevButton, Vector2.zero, Vector2.zero, Vector2.zero, new Vector2(0.005f, 0.005f), new Vector2(0.07f, 0.05f)); TurnArrow(prevButton); } if ((Object)(object)nextButton != (Object)null) { Place(nextButton, BottomRight, BottomRight, BottomRight, new Vector2(-0.005f, 0.005f), new Vector2(0.07f, 0.05f)); TurnArrow(nextButton); } state.PageLabel = CloneLabel(app.searchText, results, "PageIndicator"); if (!((Object)(object)state.PageLabel == (Object)null)) { Place(As<RectTransform>((Object)(object)((TMP_Text)state.PageLabel).transform), new Vector2(0.5f, 0f), new Vector2(0.5f, 0f), new Vector2(0.5f, 0f), new Vector2(0f, 0.005f), new Vector2(0.22f, 0.05f)); TrySet(delegate { ((TMP_Text)state.PageLabel).alignment = (TextAlignmentOptions)514; }); KeepOnOneLine(state.PageLabel); ((TMP_Text)state.PageLabel).text = string.Empty; } } private static void BuildPreviewPanel(AppState state, RectTransform data, float columnHeight, DatabaseApp app, RectTransform prevSource, RectTransform nextSource) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: 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_0040: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0101: 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_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0124: 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_0229: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_023d: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Unknown result type (might be due to invalid IL or missing references) ((Component)data).gameObject.SetActive(true); Place(data, TopLeft, TopLeft, TopLeft, new Vector2(0.46f, -0.08f), new Vector2(0.52f, columnHeight)); state.DataDisplay = data; state.ActorEntry = Child((Transform)(object)data, "ActorEntry"); state.InfoText = ChildComponent<TextMeshProUGUI>((Transform)(object)data, "InformationText"); bool flag = PreviewConfig.ShowPhoto.Value && (Object)(object)state.ActorEntry != (Object)null; bool flag2 = PreviewConfig.FingerprintInCorner.Value && (Object)(object)state.ActorEntry != (Object)null && DatabasePreview.CarriesFingerprints(app); if ((Object)(object)state.ActorEntry != (Object)null) { if (flag) { Place(state.ActorEntry, TopLeft, TopLeft, TopLeft, new Vector2(0.014f, -0.012f), new Vector2(0.128f, 0.128f)); RectTransform val = Child((Transform)(object)state.ActorEntry, "ActorHeadshot"); if ((Object)(object)val != (Object)null) { val.sizeDelta = new Vector2(0.11264001f, 0.11264001f); state.Headshot = ((Component)val).GetComponent<RawImage>(); } } else { ((Component)state.ActorEntry).gameObject.SetActive(false); } } if ((Object)(object)state.InfoText != (Object)null) { float num = 0.14f + (flag2 ? 0.055f : 0f) + 0.012f; float num2 = ((flag || flag2) ? num : 0.014f); float infoHeight = Mathf.Max(0.08f, columnHeight - num2 - 0.08f); Place(As<RectTransform>((Object)(object)((TMP_Text)state.InfoText).transform), TopLeft, TopRight, new Vector2(0.5f, 1f), new Vector2(0f, 0f - num2), new Vector2(-0.03f, infoHeight)); TrySet(delegate { ((TMP_Text)state.InfoText).alignment = (TextAlignmentOptions)257; }); TrySet(delegate { //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Expected O, but got Unknown float num3 = (((TMP_Text)state.InfoText).enableAutoSizing ? ((TMP_Text)state.InfoText).fontSizeMax : ((TMP_Text)state.InfoText).fontSize); if (num3 <= 0f) { num3 = ((TMP_Text)state.InfoText).fontSize; } ((TMP_Text)state.InfoText).enableAutoSizing = false; ((TMP_Text)state.InfoText).fontSize = num3 * Mathf.Clamp(PreviewConfig.FontScale.Value, 0.5f, 6f); ((TMP_Text)state.InfoText).overflowMode = (TextOverflowModes)5; ((TMP_Text)state.InfoText).pageToDisplay = 1; ManualLogSource logger = Plugin.Logger; bool flag3 = default(bool); BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(51, 4, ref flag3); if (flag3) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("["); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>("CalebScott.GovernmentDatabaseRework"); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("] Preview text set at "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<float>(((TMP_Text)state.InfoText).fontSize, "0.####"); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" "); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("(authored "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<float>(num3, "0.####"); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(") in a box "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<float>(infoHeight, "0.###"); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" tall."); } logger.LogInfo(val2); }); if (flag2) { BuildFingerprintCorner(state, data); } BuildPreviewPageNavigation(state, data, app, prevSource, nextSource); } else { Plugin.Logger.LogWarning((object)"[CalebScott.GovernmentDatabaseRework] DataDisplay has no InformationText; the profile preview will stay blank."); } MovePrintButton(app, data); } private static void BuildFingerprintCorner(AppState state, RectTransform data) { //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_00ef: 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_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Expected O, but got Unknown //IL_0144: 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_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)state.ActorEntry == (Object)null) { return; } GameObject val = Clone(((Component)state.ActorEntry).gameObject, data, "FingerprintCard"); state.FingerprintCard = (((Object)(object)val != (Object)null) ? As<RectTransform>((Object)(object)val.transform) : null); if ((Object)(object)state.FingerprintCard == (Object)null) { ManualLogSource logger = Plugin.Logger; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val2 = new BepInExWarningLogInterpolatedStringHandler(40, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("["); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>("CalebScott.GovernmentDatabaseRework"); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("] Could not build the fingerprint card."); } logger.LogWarning(val2); return; } Place(state.FingerprintCard, TopRight, TopRight, TopRight, new Vector2(-0.014f, -0.012f), new Vector2(0.128f, 0.128f)); RectTransform val3 = Child((Transform)(object)state.FingerprintCard, "ActorHeadshot"); if ((Object)(object)val3 != (Object)null) { ((Object)val3).name = "FingerprintImage"; val3.sizeDelta = new Vector2(0.11264001f, 0.11264001f); state.FingerprintImage = ((Component)val3).GetComponent<RawImage>(); } state.FingerprintLabel = CloneLabel(state.InfoText, data, "FingerprintInitials"); if (!((Object)(object)state.FingerprintLabel == (Object)null)) { Place(As<RectTransform>((Object)(object)((TMP_Text)state.FingerprintLabel).transform), TopRight, TopRight, TopRight, new Vector2(-0.014f, -0.14f), new Vector2(0.128f, 0.055f)); TrySet(delegate { ((TMP_Text)state.FingerprintLabel).alignment = (TextAlignmentOptions)258; ((TMP_Text)state.FingerprintLabel).enableAutoSizing = false; ((TMP_Text)state.FingerprintLabel).overflowMode = (TextOverflowModes)3; ((TMP_Text)state.FingerprintLabel).fontSize = ((TMP_Text)state.InfoText).fontSize; }); ((TMP_Text)state.FingerprintLabel).text = string.Empty; } } private static void BuildPreviewPageNavigation(AppState state, RectTransform data, DatabaseApp app, RectTransform prevSource, RectTransform nextSource) { //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_0032: 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_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: 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_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) RectTransform val = CloneButton(prevSource, data, "PreviewPageBack"); if ((Object)(object)val != (Object)null) { Place(val, Vector2.zero, Vector2.zero, Vector2.zero, new Vector2(0.012f, 0.014f), new Vector2(0.06f, 0.06f)); Bind(state, val, delegate { DatabasePreview.TurnPage(state, -1); }); } RectTransform val2 = CloneButton(nextSource, data, "PreviewPageForward"); if ((Object)(object)val2 != (Object)null) { Place(val2, Vector2.zero, Vector2.zero, Vector2.zero, new Vector2(0.207f, 0.014f), new Vector2(0.06f, 0.06f)); Bind(state, val2, delegate { DatabasePreview.TurnPage(state, 1); }); } state.PreviewPageLabel = CloneLabel(app.searchText, data, "PreviewPageIndicator"); if (!((Object)(object)state.PreviewPageLabel == (Object)null)) { Place(As<RectTransform>((Object)(object)((TMP_Text)state.PreviewPageLabel).transform), Vector2.zero, Vector2.zero, Vector2.zero, new Vector2(0.072f, 0.014f), new Vector2(0.135f, 0.06f)); TrySet(delegate { ((TMP_Text)state.PreviewPageLabel).alignment = (TextAlignmentOptions)514; }); KeepOnOneLine(state.PreviewPageLabel); ((TMP_Text)state.PreviewPageLabel).text = string.Empty; } } private static void MovePrintButton(DatabaseApp app, RectTransform data) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown RectTransform printButton = app.printButton; if ((Object)(object)printButton == (Object)null) { ManualLogSource logger = Plugin.Logger; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(46, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("["); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("CalebScott.GovernmentDatabaseRework"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("] No print button on this app; leaving it be."); } logger.LogWarning(val); return; } RectTransform val2 = null; Transform parent = ((Transform)printButton).parent; if ((Object)(object)parent != (Object)null) { Transform val3 = parent.Find("PrintButtonBG"); val2 = (((Object)(object)val3 != (Object)null) ? As<RectTransform>((Object)(object)val3) : null); } Action<RectTransform> action = delegate(RectTransform rect) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //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) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) ((Transform)rect).SetParent((Transform)(object)data, false); Place(rect, BottomRight, BottomRight, BottomRight, new Vector2(-0.014f, 0.014f), new Vector2(0.19f, 0.07f)); }; if ((Object)(object)val2 != (Object)null) { action(val2); } action(printButton); } internal static void UpdatePageLabel(AppState state) { //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Expected O, but got Unknown if (state == null || (Object)(object)state.PageLabel == (Object)null) { return; } try { int value = DatabaseListing.PageCount(state); ((TMP_Text)state.PageLabel).text = ((state.LastResultCount == 0) ? "NONE" : $"{state.PageIndex + 1}/{value}"); } catch (Exception ex) { ManualLogSource logger = Plugin.Logger; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(28, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("["); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("CalebScott.GovernmentDatabaseRework"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("] Page label update threw: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message); } logger.LogWarning(val); } } private static int EntriesThatFit(DatabaseApp app, float listAreaHeight) { //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Expected O, but got Unknown //IL_004a: 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_015f: Expected O, but got Unknown //IL_0066: Unknown result type (might be due to invalid IL or missing references) float num = 0.06f; bool flag = default(bool); try { GameObject val = (((Object)(object)app.list != (Object)null) ? app.list.elementPrefab : null); RectTransform val2 = (((Object)(object)val != (Object)null) ? As<RectTransform>((Object)(object)val.transform) : null); if ((Object)(object)val2 != (Object)null && val2.sizeDelta.y > 0.001f) { num = val2.sizeDelta.y; } } catch (Exception ex) { ManualLogSource logger = Plugin.Logger; BepInExWarningLogInterpolatedStringHandler val3 = new BepInExWarningLogInterpolatedStringHandler(55, 3, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("["); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>("CalebScott.GovernmentDatabaseRework"); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("] Could not measure the list row prefab "); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("("); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>(ex.Message); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("); assuming "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<float>(0.06f); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("."); } logger.LogWarning(val3); } int num2 = Mathf.Max(1, Mathf.FloorToInt(listAreaHeight / num)); int value = LayoutConfig.EntriesPerPage.Value; if (value > 0 && value <= num2) { return value; } if (value > num2) { ManualLogSource logger2 = Plugin.Logger; BepInExInfoLogInterpolatedStringHandler val4 = new BepInExInfoLogInterpolatedStringHandler(56, 3, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("["); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<string>("CalebScott.GovernmentDatabaseRework"); ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("] EntriesPerPage "); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<int>(value); ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(" would overflow the "); ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("list area; using "); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<int>(num2); ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("."); } logger2.LogInfo(val4); } return num2; } private static void Bind(AppState state, RectTransform buttonRect, Action handler) { //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Expected O, but got Unknown //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown try { Button component = ((Component)buttonRect).GetComponent<Button>(); if ((Object)(object)component != (Object)null) { component.onClick = new ButtonClickedEvent(); } ComputerOSUIComponent component2 = ((Component)buttonRect).GetComponent<ComputerOSUIComponent>(); if ((Object)(object)component2 == (Object)null) { Plugin.Logger.LogWarning((object)($"[{"CalebScott.GovernmentDatabaseRework"}] {((Object)buttonRect).name} has no cruncher UI " + "component, so its clicks cannot be picked up.")); } else { AppRegistry.RegisterButton(state, component2, handler); } } catch (Exception ex) { ManualLogSource logger = Plugin.Logger; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(20, 3, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("["); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("CalebScott.GovernmentDatabaseRework"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("] Could not bind "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(((Object)buttonRect).name); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(": "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message); } logger.LogWarning(val); } } private static void TurnArrow(RectTransform button) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) Transform val = ((Transform)button).Find("Image"); if ((Object)(object)val != (Object)null) { val.localEulerAngles = new Vector3(0f, 0f, 90f); } } private static RectTransform CloneButton(RectTransform source, RectTransform parent, string name) { GameObject val = Clone(((Object)(object)source != (Object)null) ? ((Component)source).gameObject : null, parent, name); return ((Object)(object)val != (Object)null) ? As<RectTransform>((Object)(object)val.transform) : null; } private static TextMeshProUGUI CloneLabel(TextMeshProUGUI source, RectTransform parent, string name) { GameObject val = Clone(((Object)(object)source != (Object)null) ? ((Component)source).gameObject : null, parent, name); return ((Object)(object)val != (Object)null) ? val.GetComponent<TextMeshProUGUI>() : null; } private static GameObject Clone(GameObject source, RectTransform parent, string name) { //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Expected O, but got Unknown if ((Object)(object)source == (Object)null) { return null; } try { Object val = (Object)(object)Object.Instantiate<GameObject>(source); GameObject val2 = ((val != (Object)null) ? ((Il2CppObjectBase)val).TryCast<GameObject>() : null); if ((Object)(object)val2 == (Object)null) { return null; } ((Object)val2).name = name; val2.transform.SetParent((Transform)(object)parent, false); val2.SetActive(true); return val2; } catch (Exception ex) { ManualLogSource logger = Plugin.Logger; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val3 = new BepInExWarningLogInterpolatedStringHandler(21, 3, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("["); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>("CalebScott.GovernmentDatabaseRework"); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("] Could not clone "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>(name); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(": "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>(ex.Message); } logger.LogWarning(val3); return null; } } private static void Place(RectTransform rect, Vector2 anchorMin, Vector2 anchorMax, Vector2 pivot, Vector2 position, Vector2 size) { //IL_000f: 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_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0030: 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 (!((Object)(object)rect == (Object)null)) { rect.anchorMin = anchorMin; rect.anchorMax = anchorMax; rect.pivot = pivot; rect.sizeDelta = size; rect.anchoredPosition = position; ((Transform)rect).localScale = Vector3.one; } } private static RectTransform Child(Transform parent, string name) { if ((Object)(object)parent == (Object)null) { return null; } Transform val = parent.Find(name); return ((Object)(object)val != (Object)null) ? As<RectTransform>((Object)(object)val) : null; } private static T ChildComponent<T>(Transform parent, string name) where T : Object { RectTransform val = Child(parent, name); return ((Object)(object)val != (Object)null) ? ((Component)val).GetComponent<T>() : default(T); } private static T As<T>(Object source) where T : Object { return (source != null) ? ((Il2CppObjectBase)source).TryCast<T>() : default(T); } private static string Found(Object obj) { return (obj != (Object)null) ? "yes" : "NO"; } private static void KeepOnOneLine(TextMeshProUGUI label) { if ((Object)(object)label == (Object)null) { return; } TrySet(delegate { ((TMP_Text)label).enableWordWrapping = false; ((TMP_Text)label).overflowMode = (TextOverflowModes)0; if (!((TMP_Text)label).enableAutoSizing) { float fontSize = ((TMP_Text)label).fontSize; ((TMP_Text)label).fontSizeMax = fontSize; ((TMP_Text)label).fontSizeMin = fontSize * 0.9f; ((TMP_Text)label).enableAutoSizing = true; } }); } private static void TrySet(Action write) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown try { write(); } catch (Exception ex) { ManualLogSource logger = Plugin.Logger; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(29, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("["); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("CalebScott.GovernmentDatabaseRework"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("] UI property write failed: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message); } logger.LogWarning(val); } } } internal static class DatabaseListing { private const string Separator = "\u0001"; internal static bool Rebuild(DatabaseApp app) { //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Expected O, but got Unknown //IL_01a5: Unknown result type (might be due to invalid IL or missing references) AppState orCreate = AppRegistry.GetOrCreate(app); if (orCreate == null || (Object)(object)app.list == (Object)null) { return false; } if (orCreate.Pool == null) { orCreate.Pool = BuildPool(app); if (orCreate.Pool == null) { return false; } } string text = (app.searchString ?? string.Empty).Trim().ToUpperInvariant(); if (text == orCreate.LastSearch) { return true; } bool flag = text.Length >= Math.Max(1, ListingConfig.MinimumSearchLength.Value); List<DirectoryEntry> list = new List<DirectoryEntry>(flag ? 64 : orCreate.Pool.Count); for (int i = 0; i < orCreate.Pool.Count; i++) { DirectoryEntry directoryEntry = orCreate.Pool[i]; if (!flag || Matches(directoryEntry, text)) { list.Add(directoryEntry); } } orCreate.LastSearch = text; orCreate.Matches = list; orCreate.LastResultCount = list.Count; orCreate.PageIndex = 0; ShowPage(orCreate); UpdateSearchLine(app, text, list.Count); if (DebugConfig.VerboseLogging.Value) { ManualLogSource logger = Plugin.Logger; bool flag2 = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(49, 6, ref flag2); if (flag2) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("["); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("CalebScott.GovernmentDatabaseRework"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("] Rebuilt "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<CitizenPool>(app.citizenPool); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" list: "); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("search='"); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(text); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("' matches="); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(list.Count); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" of "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(orCreate.Pool.Count); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" "); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("perPage="); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(orCreate.EntriesPerPage); } logger.LogInfo(val); } return true; } internal static int PageCount(AppState state) { int num = Math.Max(1, state.EntriesPerPage); int num2 = ((state.Matches != null) ? state.Matches.Count : 0); return Math.Max(1, (num2 + num - 1) / num); } internal static void TurnPage(AppState state, int delta) { if (state != null && state.Matches != null) { int num = PageCount(state); int num2 = state.PageIndex + delta; if (num2 < 0) { num2 = num - 1; } else if (num2 >= num) { num2 = 0; } if (num2 != state.PageIndex) { state.PageIndex = num2; ShowPage(state); } } } internal static void ShowPage(AppState state) { //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Expected O, but got Unknown ComputerOSMultiSelect list = state.List; if (!((Object)(object)list == (Object)null) && state.Matches != null) { int num = Math.Max(1, state.EntriesPerPage); int num2 = Math.Min(state.PageIndex * num, Math.Max(0, state.Matches.Count - 1)); int num3 = Math.Min(num2 + num, state.Matches.Count); List<OSMultiOption> val = new List<OSMultiOption>(); for (int i = num2; i < num3; i++) { val.Add(new OSMultiOption(state.Matches[i].Display, state.Matches[i].Citizen)); } list.usePages = false; list.page = 0; list.maxPerPage = num; list.allOptions = val; state.CurrentOptions = val; state.Rendering = true; try { DatabaseLayout.RenderRows(state, val); } finally { state.Rendering = false; } DatabaseLayout.UpdatePageLabel(state); } } internal static void Invalidate(AppState state) { if (state != null) { state.LastSearch = null; } } private static bool Matches(DirectoryEntry entry, string search) { return ListingConfig.MatchAnywhereInName.Value ? entry.MatchKey.Contains(search) : entry.MatchKey.StartsWith(search, StringComparison.Ordinal); } private static void UpdateSearchLine(DatabaseApp app, string search, int matches) { //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Expected O, but got Unknown try { if (!((Object)(object)app.searchText == (Object)null)) { ((TMP_Text)app.searchText).text = ((search.Length > 0) ? $"{search} ({matches})" : ListingConfig.EmptySearchHint.Value); } } catch (Exception ex) { ManualLogSource logger = Plugin.Logger; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(36, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("["); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("CalebScott.GovernmentDatabaseRework"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("] Could not write the search line: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message); } logger.LogWarning(val); } } private static List<DirectoryEntry> BuildPool(DatabaseApp app) { //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) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Invalid comparison between Unknown and I4 //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Invalid comparison between Unknown and I4 //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Expected O, but got Unknown //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_0337: Unknown result type (might be due to invalid IL or missing references) //IL_033e: Expected O, but got Unknown //IL_036b: Unknown result type (might be due to invalid IL or missing references) CityData instance = CityData.Instance; bool flag = default(bool); if ((Object)(object)instance == (Object)null || instance.citizenDirectory == null) { ManualLogSource logger = Plugin.Logger; BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(56, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("["); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("CalebScott.GovernmentDatabaseRework"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("] No citizen directory yet; leaving the app to vanilla."); } logger.LogWarning(val); return null; } Company val2 = null; NewBuilding val3 = null; CitizenPool citizenPool = app.citizenPool; if ((int)citizenPool > 0) { NewGameLocation val4 = ResolveLocation(app); if ((Object)(object)val4 == (Object)null) { ManualLogSource logger2 = Plugin.Logger; BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(79, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("["); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("CalebScott.GovernmentDatabaseRework"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("] Could not work out where this "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<CitizenPool>(citizenPool); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" database is installed; leaving it to vanilla."); } logger2.LogWarning(val); return null; } if ((int)citizenPool == 1) { NewAddress thisAsAddress = val4.thisAsAddress; val2 = (((Object)(object)thisAsAddress != (Object)null) ? thisAsAddress.company : null); if (val2 == null) { Plugin.Logger.LogWarning((object)"[CalebScott.GovernmentDatabaseRework] Employee database is not in a company address; leaving it to vanilla."); return null; } } else { val3 = val4.building; if ((Object)(object)val3 == (Object)null) { Plugin.Logger.LogWarning((object)"[CalebScott.GovernmentDatabaseRework] Resident database is not in a building; leaving it to vanilla."); return null; } } } List<Citizen> citizenDirectory = instance.citizenDirectory; int count = citizenDirectory.Count; List<DirectoryEntry> list = new List<DirectoryEntry>(((int)citizenPool == 0) ? count : 32); bool value = ListingConfig.SurnameFirst.Value; for (int i = 0; i < count; i++) { Citizen val5 = citizenDirectory[i]; if (!((Object)(object)val5 == (Object)null) && InPool(val5, citizenPool, val2, val3)) { string text = ((Human)val5).firstName ?? string.Empty; string text2 = ((Human)val5).surName ?? string.Empty; string text3 = ((Human)val5).citizenName ?? (text + " " + text2).Trim(); string text4; string text5; if (value && text2.Length > 0) { text4 = ((text.Length > 0) ? (text2 + ", " + text) : text2); text5 = (text2 + "\u0001" + text).ToUpperInvariant(); } else { text4 = text3; text5 = text3.ToUpperInvariant(); } list.Add(new DirectoryEntry { Citizen = (Human)(object)val5, Display = text4, SortKey = text5 + "\u0001" + ((Human)val5).humanID, MatchKey = (text3 + "\u0001" + text4).ToUpperInvariant() }); } } list.Sort((DirectoryEntry a, DirectoryEntry b) => string.CompareOrdinal(a.SortKey, b.SortKey)); ManualLogSource logger3 = Plugin.Logger; BepInExInfoLogInterpolatedStringHandler val6 = new BepInExInfoLogInterpolatedStringHandler(50, 4, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val6).AppendLiteral("["); ((BepInExLogInterpolatedStringHandler)val6).AppendFormatted<string>("CalebScott.GovernmentDatabaseRework"); ((BepInExLogInterpolatedStringHandler)val6).AppendLiteral("] "); ((BepInExLogInterpolatedStringHandler)val6).AppendFormatted<CitizenPool>(citizenPool); ((BepInExLogInterpolatedStringHandler)val6).AppendLiteral(" pool built: "); ((BepInExLogInterpolatedStringHandler)val6).AppendFormatted<int>(list.Count); ((BepInExLogInterpolatedStringHandler)val6).AppendLiteral(" citizens "); ((BepInExLogInterpolatedStringHandler)val6).AppendLiteral("(city directory holds "); ((BepInExLogInterpolatedStringHandler)val6).AppendFormatted<int>(count); ((BepInExLogInterpolatedStringHandler)val6).AppendLiteral(")."); } logger3.LogInfo(val6); return list; } private static bool InPool(Citizen citizen, CitizenPool pool, Company company, NewBuilding building) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0005: 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_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Invalid comparison between Unknown and I4 //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Invalid comparison between Unknown and I4 try { if ((int)pool != 1) { if ((int)pool == 2) { NewAddress home = ((Human)citizen).home; NewBuilding val = (((Object)(object)home != (Object)null) ? ((NewGameLocation)home).building : null); return (Object)(object)val != (Object)null && (Object)(object)building != (Object)null && ((Il2CppObjectBase)val).Pointer == ((Il2CppObjectBase)building).Pointer; } return true; } Occupation job = ((Human)citizen).job; Company val2 = ((job != null) ? job.employer : null); return val2 != null && company != null && ((Il2CppObjectBase)val2).Pointer == ((Il2CppObjectBase)company).Pointer; } catch (Exception) { return false; } } private static NewGameLocation ResolveLocation(DatabaseApp app) { //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Expected O, but got Unknown try { ComputerController controller = ((CruncherAppContent)app).controller; InteractableController val = (((Object)(object)controller != (Object)null) ? controller.ic : null); Interactable val2 = (((Object)(object)val != (Object)null) ? val.interactable : null); NewNode val3 = ((val2 != null) ? val2.node : null); return (val3 != null) ? val3.gameLocation : null; } catch (Exception ex) { ManualLogSource logger = Plugin.Logger; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val4 = new BepInExWarningLogInterpolatedStringHandler(44, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("["); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<string>("CalebScott.GovernmentDatabaseRework"); ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("] Resolving the computer's location threw: "); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<string>(ex.Message); } logger.LogWarning(val4); return null; } } } internal static class DatabasePreview { private const string NothingSelected = "SELECT A RECORD TO PREVIEW IT."; private static readonly DataKey[] FallbackKeys; internal static void Show(DatabaseApp app) { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Expected O, but got Unknown //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Expected O, but got Unknown AppState appState = AppRegistry.Get(app); if (appState == null || (Object)(object)appState.InfoText == (Object)null) { return; } Human human = null; bool flag = default(bool); try { human = app.selectedHuman; } catch (Exception ex) { ManualLogSource logger = Plugin.Logger; BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(39, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("["); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("CalebScott.GovernmentDatabaseRework"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("] Reading the selected citizen threw: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message); } logger.LogWarning(val); } if ((Object)(object)human == (Object)null) { if (!appState.LastPreviewWasEmpty) { appState.LastPreviewWasEmpty = true; appState.LastPreviewHumanId = int.MinValue; SetBody(appState, "SELECT A RECORD TO PREVIEW IT."); SetFingerprint(appState, null, null); ClearPhoto(appState); } return; } int num = Try(() => human.humanID, int.MinValue); if (!appState.LastPreviewWasEmpty && num != int.MinValue && num == appState.LastPreviewHumanId) { return; } appState.LastPreviewWasEmpty = false; appState.LastPreviewHumanId = num; List<DataKey> keys = EnsurePrintKeys(app, appState); Evidence entry = SafeEvidence(human); string text = RenderBody(appState, human, entry, keys); string text2 = (PreviewConfig.ShowNameHeader.Value ? SafeName(human) : null); SetBody(appState, string.IsNullOrEmpty(text2) ? text : (text2 + "\n" + text)); UpdatePhoto(appState, human, entry, keys); if (DebugConfig.VerboseLogging.Value) { ManualLogSource logger2 = Plugin.Logger; BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(21, 3, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("["); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>("CalebScott.GovernmentDatabaseRework"); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("] Preview: "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(SafeName(human)); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" ("); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<int>(text.Length); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" chars)"); } logger2.LogInfo(val2); } } private static string RenderBody(AppState state, Human human, Evidence entry, List<DataKey> keys) { //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Expected O, but got Unknown string text = null; string text2 = null; if (entry != null && keys != null) { text = Try(() => entry.GetNoteComposed(keys, false)); if (string.IsNullOrWhiteSpace(text)) { text2 = Try(() => entry.GetNote(keys)); } } if (!state.LoggedFirstPreview) { state.LoggedFirstPreview = true; ManualLogSource logger = Plugin.Logger; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(54, 6, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("["); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("CalebScott.GovernmentDatabaseRework"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("] First preview for "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(SafeName(human)); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(". "); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("keys="); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(state.PrintKeysDescription); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" "); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("evidence="); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>((entry != null) ? "yes" : "NO"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" "); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("composed="); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(Describe(text)); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" note="); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(Describe(text2)); } logger.LogInfo(val); } string text3 = ((!string.IsNullOrWhiteSpace(text)) ? text : ((!string.IsNullOrWhiteSpace(text2)) ? text2 : null)); if (text3 == null) { SetFingerprint(state, human, null); return ComposeFallback(human); } return Condense(LiftFingerprint(state, human, text3)); } private static string LiftFingerprint(AppState state, Human human, string body) { if (!PreviewConfig.FingerprintInCorner.Value || (Object)(object)state.FingerprintCard == (Object)null) { return body; } string[] array = body.Split('\n'); StringBuilder stringBuilder = new StringBuilder(body.Length); string text = null; string[] array2 = array; foreach (string text2 in array2) { if (text == null && IsFingerprintRow(text2)) { text = text2.Trim(); } else { stringBuilder.Append(text2).Append('\n'); } } SetFingerprint(state, human, text); return (text == null) ? body : stringBuilder.ToString().TrimEnd(); } private static bool IsFingerprintRow(string line) { string text = StripMarkup(line).Trim(); int num = text.IndexOf(':'); string text2 = ((num < 0) ? text : text.Substring(0, num)); return text2.IndexOf("fingerprint", StringComparison.OrdinalIgnoreCase) >= 0; } private static void SetFingerprint(AppState state, Human human, string row) { if (!((Object)(object)state.FingerprintCard == (Object)null)) { bool flag = (Object)(object)human != (Object)null && row != null && !IsUnknownRow(row); int num = (((Object)(object)human != (Object)null) ? Try(() => human.fingerprintLoop, -1) : (-1)); if (flag && num < 0 && PreviewConfig.RevealFingerprintOnPreview.Value) { num = AllocatePrintIndex(state, human); } bool flag2 = flag && num >= 0; if ((Object)(object)state.FingerprintImage != (Object)null) { state.FingerprintImage.texture = (flag2 ? PrintTexture(num) : UnknownPrint()); } if ((Object)(object)state.FingerprintLabel != (Object)null) { ((TMP_Text)state.FingerprintLabel).text = (flag2 ? PrintIdentifier(num) : "?"); } LogFingerprintState(state, human, flag, num); ((Component)state.FingerprintCard).gameObject.SetActive((Object)(object)human != (Object)null); } } private static string PrintIdentifier(int loop) { if (loop < 0) { return "?"; } if (loop < 26) { return new string(new char[1] { (char)(65 + loop) }); } int num = loop - 26; int num2 = num / 26; int num3 = num % 26; if (num2 > 25) { return loop.ToString(); } return new string(new char[2] { (char)(65 + num2), (char)(65 + num3) }); } private static int AllocatePrintIndex(AppState state, Human human) { //IL_0345: Unknown result type (might be due to invalid IL or missing references) //IL_034c: Expected O, but got Unknown //IL_0260: Unknown result type (might be due to invalid IL or missing references) //IL_0267: Expected O, but got Unknown if (state.Reveals >= Math.Max(0, PreviewConfig.MaxRevealsPerSession.Value)) { if (!state.LoggedRevealCap) { state.LoggedRevealCap = true; Plugin.Logger.LogWarning((object)($"[{"CalebScott.GovernmentDatabaseRework"}] Reached the cap of {PreviewConfig.MaxRevealsPerSession.Value} print identifiers this " + "session; no more will be handed out until the game is restarted.")); } return -1; } bool flag = default(bool); try { GameplayController instance = GameplayController.Instance; if ((Object)(object)instance == (Object)null) { return -1; } int num = instance.printsLetterLoop; if (num < 0) { num = 0; } human.fingerprintLoop = num; if (human.fingerprintLoop != num) { Plugin.Logger.LogError((object)($"[{"CalebScott.GovernmentDatabaseRework"}] The game rejected a print index for {SafeName(human)} (wrote {num}, read back {human.fingerprintLoop}). " + "Leaving the counter alone and giving up on revealing prints.")); state.Reveals = int.MaxValue; return -1; } instance.printsLetterLoop = num + 1; if (instance.printsLetterLoop != num + 1) { Plugin.Logger.LogError((object)($"[{"CalebScott.GovernmentDatabaseRework"}] The print counter did not move past {num}. " + "Stopping, rather than handing the same identifier to two citizens.")); state.Reveals = int.MaxValue; return num; } state.Reveals++; ManualLogSource logger = Plugin.Logger; BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(67, 6, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("["); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("CalebScott.GovernmentDatabaseRework"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("] Filed prints for "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(SafeName(human)); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(": "); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("index "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(num); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" ("); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(PrintIdentifier(num)); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("). Counter now "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(instance.printsLetterLoop); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(". "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(state.Reveals); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" filed this session."); } logger.LogInfo(val); return num; } catch (Exception ex) { ManualLogSource logger2 = Plugin.Logger; BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(30, 3, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("["); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>("CalebScott.GovernmentDatabaseRework"); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("] Filing prints for "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(SafeName(human)); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" failed: "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<Exception>(ex); } logger2.LogError(val2); return -1; } } private static void LogFingerprintState(AppState state, Human human, bool granted, int loop) { //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Expected O, but got Unknown if (!((Object)(object)human == (Object)null) && (loop >= 0 || state.FingerprintsLogged < 3)) { state.FingerprintsLogged++; string text = Try(delegate { Evidence evidenceEntry = (Evidence)(object)((Actor)human).evidenceEntry; return (evidenceEntry != null) ? ((CaseComponent)evidenceEntry).GetIdentifier() : "<no evidence>"; }) ?? "<threw>"; int num = Try(delegate { Evidence evidenceEntry = (Evidence)(object)((Actor)human).evidenceEntry; return ((evidenceEntry != null) ? evidenceEntry.children : null)?.Count ?? (-1); }, -1); string text2 = Try(delegate { Evidence evidenceEntry = (Evidence)(object)((Actor)human).evidenceEntry; return (evidenceEntry != null) ? evidenceEntry.evID : null; }) ?? "<none>"; ManualLogSource logger = Plugin.Logger; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(96, 8, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("["); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("CalebScott.GovernmentDatabaseRework"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("] Print state for "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(SafeName(human)); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(": "); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("identifier='"); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(text); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("' fingerprintLoop="); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(loop); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" "); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("evidenceChildren="); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(num); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" evID="); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(text2); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" rowGranted="); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<bool>(granted); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" caption="); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(PrintIdentifier(loop)); } logger.LogInfo(val); } } internal static bool CarriesFingerprints(DatabaseApp app) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Invalid comparison between Unknown and I4 try { if ((Object)(object)app == (Object)null) { return false; } return (int)app.citizenPool != 2; } catch (Exception) { return false; } } private static Texture PrintTexture(int loop) { //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Expected O, but got Unknown try { if (loop < 0) { return UnknownPrint(); } CitizenControls instance = CitizenControls.Instance; List<Texture2D> val = (((Object)(object)instance != (Object)null) ? instance.prints : null); int num = val?.Count ?? 0; if (num == 0) { return UnknownPrint(); } return (Texture)(object)val[loop % num]; } catch (Exception ex) { ManualLogSource logger = Plugin.Logger; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val2 = new BepInExWarningLogInterpolatedStringHandler(40, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("["); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>("CalebScott.GovernmentDatabaseRework"); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("] Reading the fingerprint image threw: "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(ex.Message); } logger.LogWarning(val2); return UnknownPrint(); } } private static Texture UnknownPrint() { try { CitizenControls instance = CitizenControls.Instance; return (Texture)(object)(((Object)(object)instance != (Object)null) ? instance.unknownPrint : null); } catch (Exception) { return null; } } private static string Condense(string body) { //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Expected O, but got Unknown body = body.Trim(); if (!PreviewConfig.HideUnknownFields.Value) { return body; } string[] array = body.Split('\n'); StringBuilder stringBuilder = new StringBuilder(body.Length); int num = 0; string[] array2 = array; foreach (string text in array2) { if (IsUnknownRow(text)) { num++; } else { stringBuilder.Append(text).Append('\n'); } } if (stringBuilder.Length == 0) { return body; } if (num > 0 && DebugConfig.VerboseLogging.Value) { ManualLogSource logger = Plugin.Logger; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(33, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("["); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("CalebScott.GovernmentDatabaseRework"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("] Preview dropped "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(num); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" unknown rows."); } logger.LogInfo(val); } return stringBuilder.ToString().TrimEnd(); } private static bool IsUnknownRow(string line) { if (string.IsNullOrWhiteSpace(line)) { return true; } if (line.Contains("Name Empty")) { return true; } string text = StripMarkup(line).Trim(); if (text.Length == 0) { return true; } if (!text.EndsWith("?", StringComparison.Ordinal)) { return false; } int num = text.IndexOf(':'); if (num < 0) { return text == "?"; } return text.Substring(num + 1).Trim() == "?"; } private static string StripMarkup(string line) { StringBuilder stringBuilder = new StringBuilder(line.Length); bool flag = false; for