Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of MarkAllSeen v1.0.2
MarkAllSeen.dll
Decompiled a month agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security.Permissions; using System.Xml; using BepInEx; using BepInEx.Logging; using Microsoft.CodeAnalysis; using RiskOfOptions; using RiskOfOptions.Options; using RoR2; using RoR2.UI; using UnityEngine; using UnityEngine.Events; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("MarkAllSeen")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.2.0")] [assembly: AssemblyInformationalVersion("1.0.2")] [assembly: AssemblyProduct("MarkAllSeen")] [assembly: AssemblyTitle("MarkAllSeen")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.2.0")] [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 MarkAllSeen { [BepInPlugin("revor.MarkAllSeen", "MarkAllSeen", "1.0.2")] [BepInDependency(/*Could not decode attribute arguments.*/)] public sealed class MarkAllSeenPlugin : BaseUnityPlugin { [CompilerGenerated] private static class <>O { public static UnityAction <0>__OnMarkAllPressed; } public const string PluginGUID = "revor.MarkAllSeen"; public const string PluginName = "MarkAllSeen"; public const string PluginVersion = "1.0.2"; private const string RiskOfOptionsGuid = "com.rune580.riskofoptions"; private const string IconResource = "MarkAllSeen.icon.png"; private const string Title = "Mark all as seen"; private const string SurvivorsFolder = "/Survivors/"; private const string LoadoutBodiesFolder = "/Loadout/Bodies/"; internal static ManualLogSource Log { get; private set; } private void Awake() { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; ModSettingsManager.SetModDescription("Clears the \"New!\" markers on your profile with one button."); object obj = <>O.<0>__OnMarkAllPressed; if (obj == null) { UnityAction val = OnMarkAllPressed; <>O.<0>__OnMarkAllPressed = val; obj = (object)val; } ModSettingsManager.AddOption((BaseOption)new GenericButtonOption("Mark all as seen", "General", "Marks what is showing \"New!\" as seen: logbook entries, and survivors, skills and skins in character select. Anything you unlock or discover later still shows as new, and so do the skills and skins of survivors you haven't unlocked or whose DLC you don't own. There is no undo.", "Mark all", (UnityAction)obj)); ModSettingsManager.SetModIcon(LoadIcon()); } private static Sprite LoadIcon() { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Expected O, but got Unknown //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) byte[] array; using (Stream stream = typeof(MarkAllSeenPlugin).Assembly.GetManifestResourceStream("MarkAllSeen.icon.png")) { using MemoryStream memoryStream = new MemoryStream(); stream.CopyTo(memoryStream); array = memoryStream.ToArray(); } Texture2D val = new Texture2D(2, 2); ImageConversion.LoadImage(val, array); ((Texture)val).wrapMode = (TextureWrapMode)1; return Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f)); } private static void OnMarkAllPressed() { //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) int num = 0; foreach (LocalUser readOnlyLocalUsers in LocalUserManager.readOnlyLocalUsersList) { num += MarkAllFor(readOnlyLocalUsers); } Log.LogInfo((object)$"Marked {num} entries as seen."); SimpleDialogBox obj = SimpleDialogBox.Create((MPEventSystem)null); obj.headerToken = new TokenParamsPair("Mark all as seen", Array.Empty<object>()); obj.descriptionToken = new TokenParamsPair((num == 0) ? "Nothing to mark." : string.Format("Marked {0} {1} as seen.", num, (num == 1) ? "entry" : "entries"), Array.Empty<object>()); obj.AddCancelButton(CommonLanguageTokens.ok, Array.Empty<object>()); } private static int MarkAllFor(LocalUser user) { UserProfile userProfile = user.userProfile; HashSet<string> entriesOfUnavailableSurvivors = GetEntriesOfUnavailableSurvivors(user); List<string> list = new List<string>(); List<string> list2 = new List<string>(); foreach (Node value in ViewablesCatalog.fullNameToNodeMap.Values) { if (!value.isFolder && !entriesOfUnavailableSurvivors.Contains(value.fullName) && value.shouldShowUnviewed(userProfile)) { if (CanBeSaved(value.fullName)) { list.Add(value.fullName); } else { list2.Add(value.fullName); } } } if (list2.Count > 0) { Log.LogWarning((object)($"Left {list2.Count} entries showing \"New!\": the game can't save names with a " + "space, a carriage return or a character XML can't hold. " + string.Join(", ", list2))); } foreach (string item in list) { userProfile.MarkViewableAsViewed(item); } if (list.Count > 0) { userProfile.RequestEventualSave(); } return list.Count; } private static HashSet<string> GetEntriesOfUnavailableSurvivors(LocalUser user) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) HashSet<string> hashSet = new HashSet<string>(); foreach (SurvivorDef allSurvivorDef in SurvivorCatalog.allSurvivorDefs) { if (user.userProfile.HasSurvivorUnlocked(allSurvivorDef.survivorIndex) && allSurvivorDef.CheckUserHasRequiredEntitlement(user)) { continue; } hashSet.Add("/Survivors/" + allSurvivorDef.cachedName); BodyIndex bodyIndexFromSurvivorIndex = SurvivorCatalog.GetBodyIndexFromSurvivorIndex(allSurvivorDef.survivorIndex); Node val = ViewablesCatalog.FindNode("/Loadout/Bodies/" + BodyCatalog.GetBodyName(bodyIndexFromSurvivorIndex) + "/"); if (val == null) { continue; } foreach (Node item in val.Descendants()) { hashSet.Add(item.fullName); } } return hashSet; } private static bool CanBeSaved(string name) { if (name.Contains(' ') || name.Contains('\r')) { return false; } try { XmlConvert.VerifyXmlChars(name); return true; } catch (XmlException) { return false; } } } }