// // Copyright (c) 2008-2011, Kenneth Bell // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), // to deal in the Software without restriction, including without limitation // the rights to use, copy, modify, merge, publish, distribute, sublicense, // and/or sell copies of the Software, and to permit persons to whom the // Software is furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. // namespace DiscUtils.Ntfs.Internals { /// /// A reference to a Master File Table entry. /// public struct MasterFileTableReference { private FileRecordReference _ref; internal MasterFileTableReference(FileRecordReference recordRef) { _ref = recordRef; } /// /// Gets the index of the referred entry in the Master File Table. /// public long RecordIndex { get { return _ref.MftIndex; } } /// /// Gets the revision number of the entry. /// /// /// This value prevents accidental reference to an entry - it will get out /// of sync with the actual entry if the entry is re-allocated or de-allocated. /// public int RecordSequenceNumber { get { return _ref.SequenceNumber; } } /// /// Compares to instances for equality. /// /// The first instance to compare. /// The second instance to compare. /// true if the instances are equivalent, else false. public static bool operator ==(MasterFileTableReference a, MasterFileTableReference b) { return a._ref == b._ref; } /// /// Compares to instances for equality. /// /// The first instance to compare. /// The second instance to compare. /// true if the instances are not equivalent, else false. public static bool operator !=(MasterFileTableReference a, MasterFileTableReference b) { return a._ref != b._ref; } /// /// Compares another object for equality. /// /// The object to compare. /// true if the other object is equivalent, else false. public override bool Equals(object obj) { if (obj == null || !(obj is MasterFileTableReference)) { return false; } return _ref == ((MasterFileTableReference)obj)._ref; } /// /// Gets a hash code for this instance. /// /// The hash code. public override int GetHashCode() { return _ref.GetHashCode(); } } }