using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using ENA_Utils;
using JoelG.ENA4;
using LMirman.VespaIO;
using Logger;
using Microsoft.CodeAnalysis;
using MonoMod.RuntimeDetour;
using On.JoelG.ENA4;
using On.LMirman.VespaIO;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.ResourceManagement.AsyncOperations;
using UnityEngine.SceneManagement;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("DevConsole")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+e5989009a42b81623359be2c55b302eb93ac0a1c")]
[assembly: AssemblyProduct("DevConsole")]
[assembly: AssemblyTitle("DevConsole")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[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;
}
}
}
public static class ModdedCommands
{
[VespaCommand("noclip", Name = "noclip", Description = "toggle noclip")]
public static void Noclip()
{
if (Object.op_Implicit((Object)(object)NoClipController.noClipController))
{
NoClipController.noclip = !NoClipController.noclip;
DevConsole.Log("Set noclip: " + NoClipController.noclip, (LogStyling)0);
}
else
{
DevConsole.Log("player not found", (LogStyling)5);
}
}
[VespaCommand("walljump", Name = "toggle walljumps", Description = "toggle walljumps")]
public static void WallJump()
{
PlayerCore.Instance.Mover.Config.canJumpOnSteep = !PlayerCore.Instance.Mover.Config.canJumpOnSteep;
DevConsole.Log("toggled walljumps: " + PlayerCore.Instance.Mover.Config.canJumpOnSteep, (LogStyling)0);
}
[VespaCommand("airjumps", Name = "Air Jumps", Description = "number of air jumps")]
public static void AirJumps(int jumpCount)
{
PlayerCore.Instance.Mover.Config.airJumps = jumpCount;
DevConsole.Log("Set number of air jumps: " + jumpCount, (LogStyling)0);
}
[CommandAutofill("airjumps")]
private static AutofillValue AirJumpsAutofill(AutofillBuilder autofillBuilder)
{
return autofillBuilder.CreateAutofill("<number>");
}
[VespaCommand("spawngo", Name = "Spawn Game Object", Description = "spawn a game object from its addressable name")]
public static void SpawnGO(string path)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
AsyncOperationHandle<GameObject> val = Addressables.LoadAssetAsync<GameObject>((object)path);
val.Completed += delegate(AsyncOperationHandle<GameObject> x)
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
Object.Instantiate<GameObject>(x.Result, ((Component)PlayerCore.Instance).transform.position, Quaternion.identity);
};
}
[CommandAutofill("spawngo")]
private static AutofillValue SpawnAutofill(AutofillBuilder autofillBuilder)
{
return autofillBuilder.CreateAutofill("<object path>");
}
}
public class NoClipController : MonoBehaviour
{
[CompilerGenerated]
private static class <>O
{
public static hook_Awake <0>__PlayerCore_Awake;
}
public static NoClipController noClipController;
private Transform Viewpoint;
private float flyspeed = 5f;
private bool _noclip;
public static bool noclip
{
get
{
if (Object.op_Implicit((Object)(object)noClipController))
{
return noClipController._noclip;
}
return false;
}
set
{
if (Object.op_Implicit((Object)(object)noClipController))
{
PlayerCore.Instance.Rigidbody.isKinematic = !value;
((Collider)PlayerCore.Instance.Mover.collider).enabled = false;
((Behaviour)((Component)noClipController).GetComponent<PlayerMover>()).enabled = !value;
noClipController._noclip = value;
}
}
}
[Initializer(0f)]
private static void Init()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Expected O, but got Unknown
object obj = <>O.<0>__PlayerCore_Awake;
if (obj == null)
{
hook_Awake val = PlayerCore_Awake;
<>O.<0>__PlayerCore_Awake = val;
obj = (object)val;
}
PlayerCore.Awake += (hook_Awake)obj;
}
private static void PlayerCore_Awake(orig_Awake orig, PlayerCore self)
{
orig.Invoke(self);
noClipController = ((Component)self).gameObject.AddComponent<NoClipController>();
noClipController.Viewpoint = ((Component)self).gameObject.transform.Find("Rendering/View Point");
}
private void FixedUpdate()
{
//IL_00af: 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_00be: Unknown result type (might be due to invalid IL or missing references)
//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
//IL_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)
if (_noclip || !Object.op_Implicit((Object)(object)PlayerCore.Instance) || !Object.op_Implicit((Object)(object)PlayerCore.Instance.Mover))
{
float axis = Input.GetAxis("Mouse ScrollWheel");
if (axis != 0f)
{
flyspeed = Mathf.Clamp(flyspeed * (axis + 1f), 1f, 9000f);
Debug.Log((object)("flyspeed: " + flyspeed));
}
Vector3 val = Vector3.ClampMagnitude(new Vector3(PlayerCore.Instance.Input.GetAxis(0), 0f, PlayerCore.Instance.Input.GetAxis(1)), 1f);
PlayerCore.Instance.Mover.rigidbody.velocity = Viewpoint.TransformDirection(val * flyspeed);
}
}
}
public static class NativeCommands
{
private const int HelpPageLength = 10;
private static bool hasBuiltSceneNameList;
private static readonly List<string> SceneNameList = new List<string>();
private const int AliasPageLength = 10;
[VespaCommand("quit", Name = "Quit Application", Description = "Closes the application", ManualPriority = 70)]
public static void Quit()
{
Application.Quit();
}
[VespaCommand("welcome", Name = "Welcome Prompt", Description = "Log the welcome prompt into the console")]
public static void Welcome()
{
DevConsole.PrintWelcome();
}
[VespaCommand("clear", Name = "Clear Console History", Description = "Clears the entire console history including this command's execution. Usage is recommended when the history grows too large or the application freezes when logging occurs.", ManualPriority = 80)]
public static void Clear()
{
((Console)DevConsole.console).Clear();
}
[VespaCommand("scene", Name = "Change Scene", Description = "Changes the scene to the scene name provided by the user", Cheat = true)]
public static void Scene()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
Scene activeScene = SceneManager.GetActiveScene();
DevConsole.Log("Current Scene: " + ((Scene)(ref activeScene)).name, (LogStyling)0);
}
[VespaCommand("scene", Cheat = true)]
public static void Scene(string target)
{
DevConsole.Log("Attempting to load scene: " + target, (LogStyling)0);
SceneManager.LoadScene(target);
}
[CommandAutofill("scene")]
private static AutofillValue GetSceneAutofillValue(AutofillBuilder autofillBuilder)
{
if (!hasBuiltSceneNameList)
{
SceneNameList.Clear();
int sceneCountInBuildSettings = SceneManager.sceneCountInBuildSettings;
for (int i = 0; i < sceneCountInBuildSettings; i++)
{
SceneNameList.Add(Path.GetFileNameWithoutExtension(SceneUtility.GetScenePathByBuildIndex(i)));
}
}
if (autofillBuilder.RelevantParameterIndex != 0)
{
return null;
}
string relevantWordText = autofillBuilder.GetRelevantWordText();
return autofillBuilder.CreateAutofillFromFirstMatch((IEnumerable<string>)SceneNameList, relevantWordText, StringComparison.OrdinalIgnoreCase);
}
[VespaCommand("echo", Name = "Echo", Description = "Repeat the input back to the console.")]
public static void Echo(string message)
{
DevConsole.Log(message, (LogStyling)0);
}
[VespaCommand("cheats", Name = "Enable Cheats", Description = "Enable cheats for this play session.")]
public static void EnableCheats(string value = "")
{
if (((Console)DevConsole.console).CheatsEnabled)
{
DevConsole.Log("Cheats are already enabled! Cheats can't be disabled on this save slot.", (LogStyling)3);
}
else if (Application.isEditor || value == "enable")
{
DevConsole.console.EnableCheats();
}
else
{
DevConsole.Log("WARNING: By enabling cheats you understand and agree to the following:\n<color=red>- You will be unable to disable cheats for this session.\n- Cheat commands will compromise the standard gameplay experience.\n- The game may become unstable with the use of cheat commands.\n- Some features like saving and achievements may be disabled.\n\n</color>It is highly recommended you don't enable cheats unless you are comfortable with the unstable experience.\nIf you are still sure you would like to enable cheat commands please enter the following command <b>exactly</b> as follows: cheats enable", (LogStyling)0);
}
}
[VespaCommand("help", Name = "Help Manual", Description = "Search for commands and get assistance with particular commands.", ManualPriority = 90)]
public static void Help()
{
LogPage();
}
[VespaCommand("help")]
public static void Help(int pageNum)
{
LogPage(pageNum);
}
[VespaCommand("help")]
public static void Help(string query)
{
string text = query.ToLower();
Command val = default(Command);
if (Commands.commandSet.TryGetCommand(text, ref val))
{
DevConsole.Log(val.Guide, (LogStyling)0);
}
else
{
PrintMatching(text);
}
}
[CommandAutofill("help")]
private static AutofillValue GetHelpAutofillValue(AutofillBuilder autofillBuilder)
{
if (autofillBuilder.RelevantParameterIndex != 0)
{
return null;
}
string text = VespaFunctions.CleanseKey(autofillBuilder.GetRelevantWordText());
IEnumerable<string> enumerable = from command in Commands.commandSet.GetPublicCommands(false)
select command.Key;
return autofillBuilder.CreateAutofillFromFirstMatch(enumerable, text, StringComparison.OrdinalIgnoreCase);
}
private static int CountPages()
{
int num = 0;
foreach (Command publicCommand in Commands.commandSet.GetPublicCommands(((Console)DevConsole.console).CheatsEnabled))
{
num++;
}
return Mathf.CeilToInt((float)num / 10f);
}
private static void LogPage(int page = 1)
{
int num = CountPages();
page = Mathf.Clamp(page, 1, num);
int num2 = 10;
int num3 = (page - 1) * 10;
DevConsole.Log($"========== Help: Page {page}/{num} ==========", (LogStyling)0);
foreach (Command publicCommand in Commands.commandSet.GetPublicCommands(((Console)DevConsole.console).CheatsEnabled))
{
if (num2 <= 0)
{
break;
}
if (num3 <= 0)
{
PrintLookup(publicCommand);
num2--;
}
else
{
num3--;
}
}
DevConsole.Log($"========== END OF PAGE {page}/{num} ==========", (LogStyling)0);
DevConsole.Log("========== Use \"help {page #}\" for more ==========", (LogStyling)0);
}
private static void PrintMatching(string key)
{
DevConsole.Log("========== Commands Containing \"" + key + "\" ==========", (LogStyling)0);
foreach (Command publicCommand in Commands.commandSet.GetPublicCommands(((Console)DevConsole.console).CheatsEnabled))
{
if (publicCommand.Key.Contains(VespaFunctions.CleanseKey(key)) || publicCommand.Name.ToLower().Contains(key.ToLower()))
{
PrintLookup(publicCommand);
}
}
}
private static void PrintLookup(Command command)
{
DevConsole.Log("- [" + command.Key + "] \"" + command.Name + "\"\n - " + command.Description, (LogStyling)0);
}
[VespaCommand("alias", Name = "Set Alias", Description = "Set a particular alias definition")]
public static void SetAlias(string alias, string value)
{
alias = VespaFunctions.CleanseKey(alias);
if (alias.Length == 0 || value.Length == 0)
{
DevConsole.Log("Your alias or value was empty.", (LogStyling)3);
return;
}
bool flag = Aliases.aliasSet.SetAlias(alias, value);
Aliases.WriteToDisk();
DevConsole.Log(flag ? ("<color=green>+</color> Added alias \"" + alias + "\" to represent \"" + value + "\"") : ("<color=yellow>*</color> Modified alias \"" + alias + "\" to represent \"" + value + "\""), (LogStyling)0);
}
[VespaCommand("alias_delete", Name = "Delete Alias", Description = "Delete a particular alias definition")]
public static void DeleteAlias(string alias)
{
alias = VespaFunctions.CleanseKey(alias);
bool flag = Aliases.aliasSet.RemoveAlias(alias);
if (flag)
{
Aliases.WriteToDisk();
}
DevConsole.Log(flag ? ("<color=red>-</color> Removed alias \"" + alias + "\".") : ("<color=yellow>Warning:</color> Tried to remove alias \"" + alias + "\" but no such alias was found."), (LogStyling)0);
}
[CommandAutofill("alias_view")]
[CommandAutofill("alias_delete")]
private static AutofillValue GetAliasAutofillValue(AutofillBuilder autofillBuilder)
{
if (autofillBuilder.RelevantParameterIndex != 0)
{
return null;
}
string text = VespaFunctions.CleanseKey(autofillBuilder.GetRelevantWordText());
return autofillBuilder.CreateAutofillFromFirstMatch((IEnumerable<string>)Aliases.aliasSet.Keys, text, StringComparison.OrdinalIgnoreCase);
}
[VespaCommand("alias_reset_all", Name = "Reset All Aliases", Description = "Reset all alias definitions")]
public static void ResetAllAliasesWarning()
{
DevConsole.Log("This will remove <b>ALL</b> alias definitions!\nTo confirm alias reset please enter the following command: \"alias_reset_all CONFIRM\"", (LogStyling)3);
}
[VespaCommand("alias_reset_all", Name = "Reset All Aliases", Description = "Reset all alias definitions")]
public static void ResetAllAliases(string confirmation)
{
if (confirmation == "CONFIRM")
{
Aliases.ResetAliasesAndFile();
DevConsole.Log("<color=red>-</color> All aliases have been removed!", (LogStyling)0);
}
else
{
ResetAllAliasesWarning();
}
}
[VespaCommand("alias")]
[VespaCommand("alias_view", Name = "View Alias", Description = "View the definition for a particular alias")]
public static void ViewAlias(string alias)
{
alias = VespaFunctions.CleanseKey(alias);
string text = default(string);
DevConsole.Log(Aliases.aliasSet.TryGetAlias(alias, ref text) ? ("\"" + alias + "\" -> \"" + text + "\"") : ("<color=red>Error:</color> Tried to view alias \"" + alias + "\" but no such alias was found."), (LogStyling)0);
}
[VespaCommand("alias_list", Name = "List Aliases", Description = "View list of all aliases that have been defined")]
public static void ListAlias(string filter)
{
filter = VespaFunctions.CleanseKey(filter);
DevConsole.Log("--- Aliases Containing \"" + filter + "\" ---", (LogStyling)0);
foreach (KeyValuePair<string, string> allAlias in Aliases.aliasSet.AllAliases)
{
if (allAlias.Key.Contains(filter) || allAlias.Value.ToLower().Contains(filter))
{
DevConsole.Log("'" + allAlias.Key + "' -> '" + allAlias.Value + "'", (LogStyling)0);
}
}
}
[VespaCommand("alias_list", Name = "List Aliases", Description = "View list of all aliases that have been defined")]
public static void ListAlias(int pageNum = 0)
{
int num = Mathf.Max(Mathf.CeilToInt((float)Aliases.aliasSet.AliasCount / 10f), 1);
pageNum = Mathf.Clamp(pageNum, 1, num);
int num2 = 10;
int num3 = (pageNum - 1) * 10;
DevConsole.Log($"--- Aliases {pageNum}/{num} ---", (LogStyling)0);
foreach (KeyValuePair<string, string> allAlias in Aliases.aliasSet.AllAliases)
{
if (num2 <= 0)
{
break;
}
if (num3 > 0)
{
num3--;
continue;
}
DevConsole.Log("'" + allAlias.Key + "' -> '" + allAlias.Value + "'", (LogStyling)0);
num2--;
}
DevConsole.Log($"--- END OF PAGE {pageNum}/{num} ---", (LogStyling)0);
DevConsole.Log("--- Use \"alias_list {page #}\" for more ---", (LogStyling)0);
}
}
namespace Logger
{
internal static class Log
{
private static ManualLogSource _logSource;
internal static void Init(ManualLogSource logSource)
{
_logSource = logSource;
}
internal static void Debug(object data)
{
StackFrame stackFrame = new StackFrame(1);
MethodBase method = stackFrame.GetMethod();
_logSource.LogDebug((object)("[" + method.Name + "]: " + data));
}
internal static void Error(object data)
{
_logSource.LogError(data);
}
internal static void Fatal(object data)
{
_logSource.LogFatal(data);
}
internal static void Info(object data)
{
StackFrame stackFrame = new StackFrame(1);
MethodBase method = stackFrame.GetMethod();
_logSource.LogInfo((object)("[" + method.Name + "]: " + data));
}
internal static void Warning(object data)
{
_logSource.LogWarning(data);
}
}
}
namespace EnableConsole
{
[BepInPlugin("Onyx.EnableConsole", "EnableConsole", "1.0.1")]
public class EnableConsole : BaseUnityPlugin
{
[CompilerGenerated]
private static class <>O
{
public static hook_RunInvocation <0>__RunInvocation;
public static Func<Func<bool>, bool> <1>__ConsoleActive_get;
public static Action<Action<bool>, bool> <2>__ConsoleActive_set;
}
public const string PluginGUID = "Onyx.EnableConsole";
public const string PluginAuthor = "Onyx";
public const string PluginName = "EnableConsole";
public const string PluginVersion = "1.0.1";
private static bool _consoleState;
public void Awake()
{
Log.Init(((BaseUnityPlugin)this).Logger);
}
[Initializer(0f)]
private static void Init()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Expected O, but got Unknown
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
AsyncOperationHandle<GameObject> val = Addressables.LoadAssetAsync<GameObject>((object)"VespaIO/Dev Console");
val.Completed += delegate(AsyncOperationHandle<GameObject> x)
{
GameObject result = x.Result;
Object.Instantiate<GameObject>(result);
};
object obj = <>O.<0>__RunInvocation;
if (obj == null)
{
hook_RunInvocation val2 = RunInvocation;
<>O.<0>__RunInvocation = val2;
obj = (object)val2;
}
Invocation.RunInvocation += (hook_RunInvocation)obj;
new Hook((MethodBase)Reflection.GetPropertyGetter(typeof(DevConsole), "ConsoleActive"), (Delegate)new Func<Func<bool>, bool>(ConsoleActive_get));
new Hook((MethodBase)Reflection.GetPropertySetter(typeof(DevConsole), "ConsoleActive"), (Delegate)new Action<Action<bool>, bool>(ConsoleActive_set));
((Console)DevConsole.console).Enabled = true;
((Console)DevConsole.console).cheatsEnabled = true;
}
private static InvokeResult RunInvocation(orig_RunInvocation orig, Invocation self, Console console, out Exception exception)
{
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Invalid comparison between Unknown and I4
//IL_012b: 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_012e: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: 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_009d: Invalid comparison between Unknown and I4
//IL_008b: Unknown result type (might be due to invalid IL or missing references)
//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
//IL_00dd: Invalid comparison between Unknown and I4
//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
//IL_00fe: Invalid comparison between Unknown and I4
//IL_00ef: 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_0110: Unknown result type (might be due to invalid IL or missing references)
orig.Invoke(self, console, ref exception);
try
{
exception = null;
if ((int)self.validState != 1)
{
return (InvokeResult)2;
}
if (!console.Enabled)
{
return (InvokeResult)4;
}
if (self.command.Cheat && !console.CheatsEnabled)
{
return (InvokeResult)3;
}
if ((int)self.invocationType == 0)
{
self.methodInfo.Invoke(self.targetObject, self.methodParameters);
return (InvokeResult)0;
}
if ((int)self.invocationType == 1)
{
InvokeProperty();
return (InvokeResult)0;
}
if ((int)self.invocationType == 2)
{
InvokeField();
return (InvokeResult)0;
}
return (InvokeResult)1;
}
catch (Exception ex)
{
exception = ex.InnerException ?? ex;
return (InvokeResult)1;
}
void InvokeField()
{
object value = self.fieldInfo.GetValue(self.targetObject);
if (self.fieldInfo.IsInitOnly)
{
console.Log(string.Format("{0} has readonly value \"{1}\"", self.GetLogValue("Field", self.fieldInfo.Name), value), (LogStyling)0);
}
else if (self.arguments.Length == 0)
{
console.Log(string.Format("{0} has value \"{1}\"", self.GetLogValue("Field", self.fieldInfo.Name), value), (LogStyling)0);
}
else
{
string text = self.arguments[0].text;
TypeConverter converter = TypeDescriptor.GetConverter(self.fieldInfo.FieldType);
if (converter.IsValid(text))
{
object obj = converter.ConvertFrom(text);
self.fieldInfo.SetValue(self.targetObject, obj);
console.Log(string.Format("Set {0} from \"{1}\" to \"{2}\"", self.GetLogValue("field", self.fieldInfo.Name), value, obj), (LogStyling)0);
}
else
{
console.Log($"Cannot set value of field \"{self.fieldInfo.Name}\" ({self.fieldInfo.FieldType}) to \"{text}\"", (LogStyling)5);
}
}
}
void InvokeProperty()
{
object arg = (self.propertyInfo.CanRead ? self.propertyInfo.GetValue(self.targetObject) : string.Empty);
if (!self.propertyInfo.CanWrite)
{
console.Log(string.Format("{0} has readonly value \"{1}\"", self.GetLogValue("Property", self.propertyInfo.Name), arg), (LogStyling)0);
}
else if (self.arguments.Length == 0 && !self.propertyInfo.CanRead)
{
console.Log("Property \"" + self.propertyInfo.Name + "\" can only have its value set.", (LogStyling)5);
}
else if (self.arguments.Length == 0)
{
console.Log(string.Format("{0} has value \"{1}\"", self.GetLogValue("Property", self.propertyInfo.Name), arg), (LogStyling)0);
}
else
{
string text = self.arguments[0].text;
TypeConverter converter = TypeDescriptor.GetConverter(self.propertyInfo.PropertyType);
if (converter.IsValid(text))
{
object obj = converter.ConvertFrom(text);
self.propertyInfo.SetValue(self.targetObject, obj);
console.Log(self.propertyInfo.CanRead ? string.Format("Set {0} from \"{1}\" to \"{2}\"", self.GetLogValue("property", self.propertyInfo.Name), arg, obj) : string.Format("Set {0} to \"{1}\"", self.GetLogValue("property", self.propertyInfo.Name), obj), (LogStyling)0);
}
else
{
console.Log($"Cannot set value of property \"{self.propertyInfo.Name}\" ({self.propertyInfo.PropertyType}) to \"{text}\"", (LogStyling)5);
}
}
}
}
public static bool ConsoleActive_get(Func<bool> orig)
{
orig();
return _consoleState;
}
public static void ConsoleActive_set(Action<bool> orig, bool value)
{
orig(value);
_consoleState = value;
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}