3
3
using System . Runtime . InteropServices ;
4
4
using System . Text ;
5
5
using ReClassNET . Extensions ;
6
- using ReClassNET . Util ;
7
6
8
7
namespace ReClassNET . Memory
9
8
{
@@ -119,11 +118,6 @@ public void Update(IntPtr address, bool setHistory)
119
118
}
120
119
}
121
120
122
- public byte [ ] ReadBytes ( IntPtr offset , int length )
123
- {
124
- return ReadBytes ( offset . ToInt32 ( ) , length ) ;
125
- }
126
-
127
121
public byte [ ] ReadBytes ( int offset , int length )
128
122
{
129
123
Contract . Requires ( offset >= 0 ) ;
@@ -136,13 +130,6 @@ public byte[] ReadBytes(int offset, int length)
136
130
return buffer ;
137
131
}
138
132
139
- public void ReadBytes ( IntPtr offset , byte [ ] buffer )
140
- {
141
- Contract . Requires ( buffer != null ) ;
142
-
143
- ReadBytes ( offset . ToInt32 ( ) , buffer ) ;
144
- }
145
-
146
133
public void ReadBytes ( int offset , byte [ ] buffer )
147
134
{
148
135
Contract . Requires ( offset >= 0 ) ;
@@ -157,13 +144,6 @@ public void ReadBytes(int offset, byte[] buffer)
157
144
Array . Copy ( data , offset , buffer , 0 , buffer . Length ) ;
158
145
}
159
146
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
-
167
147
public T ReadObject < T > ( int offset ) where T : unmanaged
168
148
{
169
149
Contract . Requires ( offset >= 0 ) ;
@@ -183,16 +163,6 @@ public T ReadObject<T>(int offset) where T : unmanaged
183
163
184
164
#region Read Primitive Types
185
165
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
-
196
166
/// <summary>Reads a <see cref="sbyte"/> from the specific offset.</summary>
197
167
/// <param name="offset">The offset into the data.</param>
198
168
/// <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)
209
179
return ( sbyte ) data [ offset ] ;
210
180
}
211
181
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
-
222
182
/// <summary>Reads a <see cref="byte"/> from the specific offset.</summary>
223
183
/// <param name="offset">The offset into the data.</param>
224
184
/// <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)
235
195
return data [ offset ] ;
236
196
}
237
197
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
-
248
198
/// <summary>Reads a <see cref="short"/> from the specific offset.</summary>
249
199
/// <param name="offset">The offset into the data.</param>
250
200
/// <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)
261
211
return BitConverter . ToInt16 ( data , offset ) ;
262
212
}
263
213
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
-
274
214
/// <summary>Reads a <see cref="ushort"/> from the specific offset.</summary>
275
215
/// <param name="offset">The offset into the data.</param>
276
216
/// <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)
287
227
return BitConverter . ToUInt16 ( data , offset ) ;
288
228
}
289
229
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
-
300
230
/// <summary>Reads a <see cref="int"/> from the specific offset.</summary>
301
231
/// <param name="offset">The offset into the data.</param>
302
232
/// <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)
313
243
return BitConverter . ToInt32 ( data , offset ) ;
314
244
}
315
245
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
-
326
246
/// <summary>Reads a <see cref="uint"/> from the specific offset.</summary>
327
247
/// <param name="offset">The offset into the data.</param>
328
248
/// <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)
339
259
return BitConverter . ToUInt32 ( data , offset ) ;
340
260
}
341
261
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
-
352
262
/// <summary>Reads a <see cref="long"/> from the specific offset.</summary>
353
263
/// <param name="offset">The offset into the data.</param>
354
264
/// <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)
365
275
return BitConverter . ToInt64 ( data , offset ) ;
366
276
}
367
277
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
-
378
278
/// <summary>Reads a <see cref="ulong"/> from the specific offset.</summary>
379
279
/// <param name="offset">The offset into the data.</param>
380
280
/// <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)
391
291
return BitConverter . ToUInt64 ( data , offset ) ;
392
292
}
393
293
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
-
404
294
/// <summary>Reads a <see cref="float"/> from the specific offset.</summary>
405
295
/// <param name="offset">The offset into the data.</param>
406
296
/// <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)
417
307
return BitConverter . ToSingle ( data , offset ) ;
418
308
}
419
309
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
-
430
310
/// <summary>Reads a <see cref="double"/> from the specific offset.</summary>
431
311
/// <param name="offset">The offset into the data.</param>
432
312
/// <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)
443
323
return BitConverter . ToDouble ( data , offset ) ;
444
324
}
445
325
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
-
456
326
/// <summary>Reads a <see cref="IntPtr"/> from the specific offset.</summary>
457
327
/// <param name="offset">The offset into the data.</param>
458
328
/// <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)
469
339
470
340
#endregion
471
341
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
-
481
342
public string ReadPrintableAsciiString ( int offset , int length )
482
343
{
483
344
Contract . Requires ( offset >= 0 ) ;
@@ -503,16 +364,6 @@ public string ReadPrintableAsciiString(int offset, int length)
503
364
return sb . ToString ( ) ;
504
365
}
505
366
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
-
516
367
public string ReadString ( Encoding encoding , int offset , int length )
517
368
{
518
369
Contract . Requires ( encoding != null ) ;
@@ -536,11 +387,6 @@ public string ReadString(Encoding encoding, int offset, int length)
536
387
return sb . ToString ( ) ;
537
388
}
538
389
539
- public bool HasChanged ( IntPtr offset , int length )
540
- {
541
- return HasChanged ( offset . ToInt32 ( ) , length ) ;
542
- }
543
-
544
390
public bool HasChanged ( int offset , int length )
545
391
{
546
392
if ( ! hasHistory )
0 commit comments