GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — ReClass.NET-DotNetInspectorPlugin/DotNetObject.cs at master · ReClassNET/ReClass.NET-DotNetInspectorPlugin Expand file tree/ Copy pathDotNetObject.csMore file actions 158 lines (132 loc) · 3.62 KB / Copy pathDotNetObject.csFile metadata and controls158 lines (132 loc) · 3.62 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 using System; using System.Collections.Generic; using System.Diagnostics; using System.Diagnostics.Contracts; using System.Globalization; using Microsoft.Diagnostics.Runtime; namespace DotNetInspectorPlugin { [DebuggerDisplay("{" + nameof(DebuggerDisplay) + ",nq}")] internal class DotNetObject : IComparable<DotNetObject> { public string DebuggerDisplay => $"{Type.Name} {Name}"; public DotNetObject Parent { get; } public ulong Reference { get; } public string Name { get; } public ClrType Type { get; } public ClrInstanceField Field { get; } public bool IsValueType => IsFloatingPointValueType || IsIntegerValueType || Type.ElementType == ClrElementType.Boolean || Type.ElementType == ClrElementType.Char || Type.ElementType == ClrElementType.FunctionPointer || Type.ElementType == ClrElementType.String; public bool IsFloatingPointValueType => Type.ElementType == ClrElementType.Double || Type.ElementType == ClrElementType.Float; public bool IsIntegerValueType => Type.ElementType == ClrElementType.Int8 || Type.ElementType == ClrElementType.Int16 || Type.ElementType == ClrElementType.Int32 || Type.ElementType == ClrElementType.Int64 || Type.ElementType == ClrElementType.UInt8 || Type.ElementType == ClrElementType.UInt16 || Type.ElementType == ClrElementType.UInt32 || Type.ElementType == ClrElementType.UInt64 || Type.ElementType == ClrElementType.NativeInt || Type.ElementType == ClrElementType.NativeUInt; public List<DotNetObject> Children { get; } = new List<DotNetObject>(); public DotNetObject(ulong reference, ClrType type, string name) : this(null, null, reference, type, name) { } public DotNetObject(DotNetObject parent, ClrInstanceField field, ulong reference, ClrType type, string name) { Contract.Requires(type != null); Parent = parent; Field = field; Reference = reference; Type = type; var rootName = GetRootName(); if (!string.IsNullOrEmpty(rootName) && name.StartsWith(rootName)) { name = name.Remove(0, rootName.Length); } Name = name; } public string GetFullName() { return GetFullNamespace(); } private string GetRootName() { if (Parent == null) { return Name ?? string.Empty; } return Parent.GetRootName(); } private string GetFullNamespace() { if (Parent == null) { return GetRootName(); } return Parent.GetFullNamespace() + "." + Name; } public object GetValue() { return Field.GetValue(Reference); } public string GetFormattedValue(bool hex) { const string NullString = "null"; if (Field != null && IsValueType) { var value = GetValue(); if (Type.ElementType == ClrElementType.Boolean) { return (bool)value ? bool.TrueString : bool.FalseString; } if (Type.ElementType == ClrElementType.Char) { return $"'{value}'"; } if (Type.ElementType == ClrElementType.String) { if (value == null) { return NullString; } return $"\"{value}\""; } if (IsFloatingPointValueType || IsIntegerValueType) { if (value is IFormattable formattable) { string format = null; if (IsIntegerValueType && hex) { format = "X"; } return formattable.ToString(format, CultureInfo.InvariantCulture); } return value.ToString(); } if (Type.ElementType == ClrElementType.FunctionPointer) { return $"0x{value:X}"; } } return $"{{{Type}}}"; } public void SetValue(object value) { } public int CompareTo(DotNetObject other) { return string.Compare(Name, other?.Name, StringComparison.Ordinal); } } } |
| You are visitor 01402520 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |