/[RomCheater]/trunk/RomCheater/Docking/MemorySearch/RangedComparer.cs
ViewVC logotype

Contents of /trunk/RomCheater/Docking/MemorySearch/RangedComparer.cs

Parent Directory Parent Directory | Revision Log Revision Log


Revision 578 - (show annotations) (download)
Thu Jun 6 08:18:44 2013 UTC (6 years, 8 months ago) by william
File size: 3283 byte(s)

1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Text;
5
6 namespace RomCheater.Docking.MemorySearch
7 {
8 public class RangedComparer<T> : ICompareValue<T>, ICompareAddress, IDisposable
9 {
10 public RangedComparer(ulong address, T value)
11 {
12 this.Address = address;
13 this.Value = value;
14 }
15 #region ICompareValue<T> Members
16 private T _Value;
17 public T Value { get { return _Value; } set { _Value = value; } }
18 #endregion
19
20 #region ICompareAddress Members
21 private ulong _Address;
22 public ulong Address { get { return _Address; } set { _Address = value; } }
23 #endregion
24
25 #region IDisposable Support
26 // Track whether Dispose has been called.
27 private bool disposed = false;
28 // Implement IDisposable.
29 // Do not make this method virtual.
30 // A derived class should not be able to override this method.
31 public void Dispose()
32 {
33 Dispose(true);
34 // This object will be cleaned up by the Dispose method.
35 // Therefore, you should call GC.SupressFinalize to
36 // take this object off the finalization queue
37 // and prevent finalization code for this object
38 // from executing a second time.
39 GC.SuppressFinalize(this);
40 }
41 // Dispose(bool disposing) executes in two distinct scenarios.
42 // If disposing equals true, the method has been called directly
43 // or indirectly by a user's code. Managed and unmanaged resources
44 // can be disposed.
45 // If disposing equals false, the method has been called by the
46 // runtime from inside the finalizer and you should not reference
47 // other objects. Only unmanaged resources can be disposed.
48 protected virtual void Dispose(bool disposing)
49 {
50 // Check to see if Dispose has already been called.
51 if (!this.disposed)
52 {
53 // If disposing equals true, dispose all managed
54 // and unmanaged resources.
55 if (disposing)
56 {
57 // Dispose managed resources.
58 //component.Dispose();
59 }
60
61 // Call the appropriate methods to clean up
62 // unmanaged resources here.
63 // If disposing is false,
64 // only the following code is executed.
65
66 // empty
67
68 // Note disposing has been done.
69 disposed = true;
70
71 }
72 }
73 // Use C# destructor syntax for finalization code.
74 // This destructor will run only if the Dispose method
75 // does not get called.
76 // It gives your base class the opportunity to finalize.
77 // Do not provide destructors in types derived from this class.
78 ~RangedComparer()
79 {
80 // Do not re-create Dispose clean-up code here.
81 // Calling Dispose(false) is optimal in terms of
82 // readability and maintainability.
83 Dispose(false);
84 }
85 #endregion
86 }
87 }

  ViewVC Help
Powered by ViewVC 1.1.22