33using System . Runtime . InteropServices ;
44using System . Text ;
55using ReClassNET . Extensions ;
6- using ReClassNET . Util ;
76
87namespace ReClassNET . Memory
98{
@@ -119,11 +118,6 @@ public void Update(IntPtr address, bool setHistory)
119118 }
120119 }
121120
122- public byte [ ] ReadBytes ( IntPtr offset , int length )
123- {
124- return ReadBytes ( offset . ToInt32 ( ) , length ) ;
125- }
126-
127121 public byte [ ] ReadBytes ( int offset , int length )
128122 {
129123 Contract . Requires ( offset >= 0 ) ;
@@ -136,13 +130,6 @@ public byte[] ReadBytes(int offset, int length)
136130 return buffer ;
137131 }
138132
139- public void ReadBytes ( IntPtr offset , byte [ ] buffer )
140- {
141- Contract . Requires ( buffer != null ) ;
142-
143- ReadBytes ( offset . ToInt32 ( ) , buffer ) ;
144- }
145-
146133 public void ReadBytes ( int offset , byte [ ] buffer )
147134 {
148135 Contract . Requires ( offset >= 0 ) ;
@@ -157,13 +144,6 @@ public void ReadBytes(int offset, byte[] buffer)
157144 Array . Copy ( data , offset , buffer , 0 , buffer . Length ) ;
158145 }
159146
160- public T ReadObject < T > ( IntPtr offset ) where T : unmanaged
161- {
162- Contract . Requires ( offset . ToInt32 ( ) >= 0 ) ;
163-
164- return ReadObject < T > ( offset . ToInt32 ( ) ) ;
165- }
166-
167147 public T ReadObject < T > ( int offset ) where T : unmanaged
168148 {
169149 Contract . Requires ( offset >= 0 ) ;
@@ -183,16 +163,6 @@ public T ReadObject<T>(int offset) where T : unmanaged
183163
184164 #region Read Primitive Types
185165
186- /// <summary>Reads a <see cref="sbyte"/> from the specific offset.</summary>
187- /// <param name="offset">The offset into the data.</param>
188- /// <returns>The data read as <see cref="sbyte"/> or 0 if the offset is outside the data.</returns>
189- public sbyte ReadInt8 ( IntPtr offset )
190- {
191- Contract . Requires ( offset . ToInt32 ( ) >= 0 ) ;
192-
193- return ReadInt8 ( offset . ToInt32 ( ) ) ;
194- }
195-
196166 /// <summary>Reads a <see cref="sbyte"/> from the specific offset.</summary>
197167 /// <param name="offset">The offset into the data.</param>
198168 /// <returns>The data read as <see cref="sbyte"/> or 0 if the offset is outside the data.</returns>
@@ -209,16 +179,6 @@ public sbyte ReadInt8(int offset)
209179 return ( sbyte ) data [ offset ] ;
210180 }
211181
212- /// <summary>Reads a <see cref="byte"/> from the specific offset.</summary>
213- /// <param name="offset">The offset into the data.</param>
214- /// <returns>The data read as <see cref="byte"/> or 0 if the offset is outside the data.</returns>
215- public byte ReadUInt8 ( IntPtr offset )
216- {
217- Contract . Requires ( offset . ToInt32 ( ) >= 0 ) ;
218-
219- return ReadUInt8 ( offset . ToInt32 ( ) ) ;
220- }
221-
222182 /// <summary>Reads a <see cref="byte"/> from the specific offset.</summary>
223183 /// <param name="offset">The offset into the data.</param>
224184 /// <returns>The data read as <see cref="byte"/> or 0 if the offset is outside the data.</returns>
@@ -235,16 +195,6 @@ public byte ReadUInt8(int offset)
235195 return data [ offset ] ;
236196 }
237197
238- /// <summary>Reads a <see cref="short"/> from the specific offset.</summary>
239- /// <param name="offset">The offset into the data.</param>
240- /// <returns>The data read as <see cref="short"/> or 0 if the offset is outside the data.</returns>
241- public short ReadInt16 ( IntPtr offset )
242- {
243- Contract . Requires ( offset . ToInt32 ( ) >= 0 ) ;
244-
245- return ReadInt16 ( offset . ToInt32 ( ) ) ;
246- }
247-
248198 /// <summary>Reads a <see cref="short"/> from the specific offset.</summary>
249199 /// <param name="offset">The offset into the data.</param>
250200 /// <returns>The data read as <see cref="short"/> or 0 if the offset is outside the data.</returns>
@@ -261,16 +211,6 @@ public short ReadInt16(int offset)
261211 return BitConverter . ToInt16 ( data , offset ) ;
262212 }
263213
264- /// <summary>Reads a <see cref="ushort"/> from the specific offset.</summary>
265- /// <param name="offset">The offset into the data.</param>
266- /// <returns>The data read as <see cref="ushort"/> or 0 if the offset is outside the data.</returns>
267- public ushort ReadUInt16 ( IntPtr offset )
268- {
269- Contract . Requires ( offset . ToInt32 ( ) >= 0 ) ;
270-
271- return ReadUInt16 ( offset . ToInt32 ( ) ) ;
272- }
273-
274214 /// <summary>Reads a <see cref="ushort"/> from the specific offset.</summary>
275215 /// <param name="offset">The offset into the data.</param>
276216 /// <returns>The data read as <see cref="ushort"/> or 0 if the offset is outside the data.</returns>
@@ -287,16 +227,6 @@ public ushort ReadUInt16(int offset)
287227 return BitConverter . ToUInt16 ( data , offset ) ;
288228 }
289229
290- /// <summary>Reads a <see cref="int"/> from the specific offset.</summary>
291- /// <param name="offset">The offset into the data.</param>
292- /// <returns>The data read as <see cref="int"/> or 0 if the offset is outside the data.</returns>
293- public int ReadInt32 ( IntPtr offset )
294- {
295- Contract . Requires ( offset . ToInt32 ( ) >= 0 ) ;
296-
297- return ReadInt32 ( offset . ToInt32 ( ) ) ;
298- }
299-
300230 /// <summary>Reads a <see cref="int"/> from the specific offset.</summary>
301231 /// <param name="offset">The offset into the data.</param>
302232 /// <returns>The data read as <see cref="int"/> or 0 if the offset is outside the data.</returns>
@@ -313,16 +243,6 @@ public int ReadInt32(int offset)
313243 return BitConverter . ToInt32 ( data , offset ) ;
314244 }
315245
316- /// <summary>Reads a <see cref="uint"/> from the specific offset.</summary>
317- /// <param name="offset">The offset into the data.</param>
318- /// <returns>The data read as <see cref="uint"/> or 0 if the offset is outside the data.</returns>
319- public uint ReadUInt32 ( IntPtr offset )
320- {
321- Contract . Requires ( offset . ToInt32 ( ) >= 0 ) ;
322-
323- return ReadUInt32 ( offset . ToInt32 ( ) ) ;
324- }
325-
326246 /// <summary>Reads a <see cref="uint"/> from the specific offset.</summary>
327247 /// <param name="offset">The offset into the data.</param>
328248 /// <returns>The data read as <see cref="uint"/> or 0 if the offset is outside the data.</returns>
@@ -339,16 +259,6 @@ public uint ReadUInt32(int offset)
339259 return BitConverter . ToUInt32 ( data , offset ) ;
340260 }
341261
342- /// <summary>Reads a <see cref="long"/> from the specific offset.</summary>
343- /// <param name="offset">The offset into the data.</param>
344- /// <returns>The data read as <see cref="long"/> or 0 if the offset is outside the data.</returns>
345- public long ReadInt64 ( IntPtr offset )
346- {
347- Contract . Requires ( offset . ToInt32 ( ) >= 0 ) ;
348-
349- return ReadInt64 ( offset . ToInt32 ( ) ) ;
350- }
351-
352262 /// <summary>Reads a <see cref="long"/> from the specific offset.</summary>
353263 /// <param name="offset">The offset into the data.</param>
354264 /// <returns>The data read as <see cref="long"/> or 0 if the offset is outside the data.</returns>
@@ -365,16 +275,6 @@ public long ReadInt64(int offset)
365275 return BitConverter . ToInt64 ( data , offset ) ;
366276 }
367277
368- /// <summary>Reads a <see cref="ulong"/> from the specific offset.</summary>
369- /// <param name="offset">The offset into the data.</param>
370- /// <returns>The data read as <see cref="ulong"/> or 0 if the offset is outside the data.</returns>
371- public ulong ReadUInt64 ( IntPtr offset )
372- {
373- Contract . Requires ( offset . ToInt32 ( ) >= 0 ) ;
374-
375- return ReadUInt64 ( offset . ToInt32 ( ) ) ;
376- }
377-
378278 /// <summary>Reads a <see cref="ulong"/> from the specific offset.</summary>
379279 /// <param name="offset">The offset into the data.</param>
380280 /// <returns>The data read as <see cref="ulong"/> or 0 if the offset is outside the data.</returns>
@@ -391,16 +291,6 @@ public ulong ReadUInt64(int offset)
391291 return BitConverter . ToUInt64 ( data , offset ) ;
392292 }
393293
394- /// <summary>Reads a <see cref="float"/> from the specific offset.</summary>
395- /// <param name="offset">The offset into the data.</param>
396- /// <returns>The data read as <see cref="float"/> or 0 if the offset is outside the data.</returns>
397- public float ReadFloat ( IntPtr offset )
398- {
399- Contract . Requires ( offset . ToInt32 ( ) >= 0 ) ;
400-
401- return ReadFloat ( offset . ToInt32 ( ) ) ;
402- }
403-
404294 /// <summary>Reads a <see cref="float"/> from the specific offset.</summary>
405295 /// <param name="offset">The offset into the data.</param>
406296 /// <returns>The data read as <see cref="float"/> or 0 if the offset is outside the data.</returns>
@@ -417,16 +307,6 @@ public float ReadFloat(int offset)
417307 return BitConverter . ToSingle ( data , offset ) ;
418308 }
419309
420- /// <summary>Reads a <see cref="double"/> from the specific offset.</summary>
421- /// <param name="offset">The offset into the data.</param>
422- /// <returns>The data read as <see cref="double"/> or 0 if the offset is outside the data.</returns>
423- public double ReadDouble ( IntPtr offset )
424- {
425- Contract . Requires ( offset . ToInt32 ( ) >= 0 ) ;
426-
427- return ReadDouble ( offset . ToInt32 ( ) ) ;
428- }
429-
430310 /// <summary>Reads a <see cref="double"/> from the specific offset.</summary>
431311 /// <param name="offset">The offset into the data.</param>
432312 /// <returns>The data read as <see cref="double"/> or 0 if the offset is outside the data.</returns>
@@ -443,16 +323,6 @@ public double ReadDouble(int offset)
443323 return BitConverter . ToDouble ( data , offset ) ;
444324 }
445325
446- /// <summary>Reads a <see cref="IntPtr"/> from the specific offset.</summary>
447- /// <param name="offset">The offset into the data.</param>
448- /// <returns>The data read as <see cref="IntPtr"/> or 0 if the offset is outside the data.</returns>
449- public IntPtr ReadIntPtr ( IntPtr offset )
450- {
451- Contract . Requires ( offset . ToInt32 ( ) >= 0 ) ;
452-
453- return ReadIntPtr ( offset . ToInt32 ( ) ) ;
454- }
455-
456326 /// <summary>Reads a <see cref="IntPtr"/> from the specific offset.</summary>
457327 /// <param name="offset">The offset into the data.</param>
458328 /// <returns>The data read as <see cref="IntPtr"/> or 0 if the offset is outside the data.</returns>
@@ -469,15 +339,6 @@ public IntPtr ReadIntPtr(int offset)
469339
470340 #endregion
471341
472- public string ReadPrintableAsciiString ( IntPtr offset , int length )
473- {
474- Contract . Requires ( offset . ToInt32 ( ) >= 0 ) ;
475- Contract . Requires ( length >= 0 ) ;
476- Contract . Ensures ( Contract . Result < string > ( ) != null ) ;
477-
478- return ReadPrintableAsciiString ( offset . ToInt32 ( ) , length ) ;
479- }
480-
481342 public string ReadPrintableAsciiString ( int offset , int length )
482343 {
483344 Contract . Requires ( offset >= 0 ) ;
@@ -503,16 +364,6 @@ public string ReadPrintableAsciiString(int offset, int length)
503364 return sb . ToString ( ) ;
504365 }
505366
506- public string ReadString ( Encoding encoding , IntPtr offset , int length )
507- {
508- Contract . Requires ( encoding != null ) ;
509- Contract . Requires ( offset . ToInt32 ( ) >= 0 ) ;
510- Contract . Requires ( length >= 0 ) ;
511- Contract . Ensures ( Contract . Result < string > ( ) != null ) ;
512-
513- return ReadString ( encoding , offset . ToInt32 ( ) , length ) ;
514- }
515-
516367 public string ReadString ( Encoding encoding , int offset , int length )
517368 {
518369 Contract . Requires ( encoding != null ) ;
@@ -536,11 +387,6 @@ public string ReadString(Encoding encoding, int offset, int length)
536387 return sb . ToString ( ) ;
537388 }
538389
539- public bool HasChanged ( IntPtr offset , int length )
540- {
541- return HasChanged ( offset . ToInt32 ( ) , length ) ;
542- }
543-
544390 public bool HasChanged ( int offset , int length )
545391 {
546392 if ( ! hasHistory )
0 commit comments