77 using System . Diagnostics ;
88 using System . Linq ;
99 using System . Text ;
10- using HackF5 . UnitySpy . Util ;
1110 using JetBrains . Annotations ;
1211
1312 /// <summary>
@@ -58,17 +57,17 @@ public TypeDefinition([NotNull] AssemblyImage image, IntPtr address)
5857 this . NamespaceName = this . ReadString ( image . Process . MonoLibraryOffsets . TypeDefinitionNamespace ) ;
5958 this . Size = this . ReadInt32 ( image . Process . MonoLibraryOffsets . TypeDefinitionSize ) ;
6059 var vtablePtr = this . ReadPtr ( image . Process . MonoLibraryOffsets . TypeDefinitionRuntimeInfo ) ;
61- this . VTable = vtablePtr == Constants . NullPtr ? Constants . NullPtr : image . Process . ReadPtr ( vtablePtr + image . Process . MonoLibraryOffsets . TypeDefinitionRuntimeInfoDomainVTables ) ;
60+ this . VTable = vtablePtr == IntPtr . Zero ? IntPtr . Zero : image . Process . ReadPtr ( vtablePtr + image . Process . MonoLibraryOffsets . TypeDefinitionRuntimeInfoDomainVTables ) ;
6261 this . TypeInfo = new TypeInfo ( image , this . Address + image . Process . MonoLibraryOffsets . TypeDefinitionByValArg ) ;
63- this . VTableSize = vtablePtr == Constants . NullPtr ? 0 : this . ReadInt32 ( image . Process . MonoLibraryOffsets . TypeDefinitionVTableSize ) ;
62+ this . VTableSize = vtablePtr == IntPtr . Zero ? 0 : this . ReadInt32 ( image . Process . MonoLibraryOffsets . TypeDefinitionVTableSize ) ;
6463 this . ClassKind = ( MonoClassKind ) ( this . ReadByte ( image . Process . MonoLibraryOffsets . TypeDefinitionClassKind ) & 0x7 ) ;
6564
6665 // Get the generic type arguments
6766 if ( this . TypeInfo . TypeCode == TypeCode . GENERICINST )
6867 {
6968 var monoGenericClassAddress = this . TypeInfo . Data ;
7069 var monoClassAddress = this . Process . ReadPtr ( monoGenericClassAddress ) ;
71- TypeDefinition monoClass = this . Image . GetTypeDefinition ( monoClassAddress ) ;
70+ this . Image . GetTypeDefinition ( monoClassAddress ) ;
7271
7372 var monoGenericContainerPtr = monoClassAddress + this . Process . MonoLibraryOffsets . TypeDefinitionGenericContainer ;
7473 var monoGenericContainerAddress = this . Process . ReadPtr ( monoGenericContainerPtr ) ;
@@ -165,9 +164,7 @@ public TValue GetStaticValue<TValue>(string fieldName)
165164 }
166165 catch ( Exception e )
167166 {
168- throw new Exception (
169- $ "Exception received when trying to get static value for field '{ fieldName } ' in class '{ this . FullName } ': ${ e . Message } .",
170- e ) ;
167+ throw new Exception ( $ "Exception received when trying to get static value for field '{ fieldName } ' in class '{ this . FullName } ': ${ e . Message } .", e ) ;
171168 }
172169 }
173170
@@ -190,7 +187,7 @@ private TypeDefinition GetClassDefinition(int address) =>
190187 private IReadOnlyList < FieldDefinition > GetFields ( )
191188 {
192189 var firstField = this . ReadPtr ( this . Image . Process . MonoLibraryOffsets . TypeDefinitionFields ) ;
193- if ( firstField == Constants . NullPtr )
190+ if ( firstField == IntPtr . Zero )
194191 {
195192 return this . Parent ? . Fields ?? new List < FieldDefinition > ( ) ;
196193 }
@@ -205,7 +202,7 @@ private IReadOnlyList<FieldDefinition> GetFields()
205202 for ( var fieldIndex = 0 ; fieldIndex < this . fieldCount ; fieldIndex ++ )
206203 {
207204 var field = firstField + ( fieldIndex * this . Process . MonoLibraryOffsets . TypeDefinitionFieldSize ) ;
208- if ( this . Process . ReadPtr ( field ) == Constants . NullPtr )
205+ if ( this . Process . ReadPtr ( field ) == IntPtr . Zero )
209206 {
210207 break ;
211208 }
@@ -222,7 +219,6 @@ private IReadOnlyList<FieldDefinition> GetFields()
222219 private string GetFullName ( )
223220 {
224221 var builder = new StringBuilder ( ) ;
225-
226222 var hierarchy = this . NestedHierarchy ( ) . Reverse ( ) . ToArray ( ) ;
227223 if ( ! string . IsNullOrWhiteSpace ( this . NamespaceName ) )
228224 {
0 commit comments