protected static bool CompareBinaryContents( FileContents item1, IntPtr ptr1, long byteSize1, FileContents item2, IntPtr ptr2, long byteSize2) { if (byteSize1 != byteSize2) { return(false); } const int smallPrefixSize = 256; if (byteSize1 < smallPrefixSize) { return(NativeMethods.Ascii_Compare( ptr1, byteSize1, ptr2, byteSize2)); } if (!NativeMethods.Ascii_Compare(ptr1, smallPrefixSize, ptr2, smallPrefixSize)) { return(false); } return(item1.Hash.Equals(item2.Hash)); }
public FileContentsPiece(FileName fileName, FileContents fileContents, int fileId, TextRange textRange) { _fileName = fileName; _fileContents = fileContents; _fileId = fileId; _textRange = textRange; }
public FileData(FileName fileName, FileContents contents) { if (fileName == null) throw new ArgumentNullException("fileName"); _fileName = fileName; _contents = contents; }
public override bool HasSameContents(FileContents other) { var other2 = other as AsciiFileContents; if (other2 == null) return false; return CompareBinaryContents( this, Contents.Pointer, ByteLength, other2, other2.Contents.Pointer, other2.ByteLength); }
public override bool HasSameContents(FileContents other) { var other2 = other as Utf16FileContents; if (other2 == null) { return(false); } return(CompareBinaryContents( this, Contents.Pointer, ByteLength, other2, other2.Contents.Pointer, other2.ByteLength)); }
protected static bool CompareBinaryContents( FileContents item1, IntPtr ptr1, long byteSize1, FileContents item2, IntPtr ptr2, long byteSize2) { if (byteSize1 != byteSize2) return false; const int smallPrefixSize = 256; if (byteSize1 < smallPrefixSize) { return NativeMethods.Ascii_Compare( ptr1, byteSize1, ptr2, byteSize2); } if (!NativeMethods.Ascii_Compare(ptr1, smallPrefixSize, ptr2, smallPrefixSize)) { return false; } return item1.Hash.Equals(item2.Hash); }
public abstract bool HasSameContents(FileContents other);
public override bool HasSameContents(FileContents other) { return other is BinaryFileContents; }
public FileContents Get(FileName fileName, FileContents fileContents) { Interlocked.Increment(ref _count); return fileContents; }
public void UpdateContents(FileContents fileContents) { Interlocked.Exchange(ref _contents, fileContents); }
public override bool HasSameContents(FileContents other) { return(other is BinaryFileContents); }