Пример #1
0
        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));
        }
Пример #2
0
 public FileContentsPiece(FileName fileName, FileContents fileContents, int fileId, TextRange textRange)
 {
     _fileName     = fileName;
     _fileContents = fileContents;
     _fileId       = fileId;
     _textRange    = textRange;
 }
Пример #3
0
    public FileData(FileName fileName, FileContents contents) {
      if (fileName == null)
        throw new ArgumentNullException("fileName");

      _fileName = fileName;
      _contents = contents;
    }
Пример #4
0
    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);
    }
Пример #5
0
        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));
        }
Пример #6
0
    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);
    }
Пример #7
0
 public abstract bool HasSameContents(FileContents other);
Пример #8
0
 public abstract bool HasSameContents(FileContents other);
Пример #9
0
 public FileContentsPiece(FileName fileName, FileContents fileContents, int fileId, TextRange textRange) {
   _fileName = fileName;
   _fileContents = fileContents;
   _fileId = fileId;
   _textRange = textRange;
 }
Пример #10
0
 public override bool HasSameContents(FileContents other) {
   return other is BinaryFileContents;
 }
 public FileContents Get(FileName fileName, FileContents fileContents) {
   Interlocked.Increment(ref _count);
   return fileContents;
 }
Пример #12
0
 public void UpdateContents(FileContents fileContents) {
   Interlocked.Exchange(ref _contents, fileContents);
 }
Пример #13
0
 public override bool HasSameContents(FileContents other)
 {
     return(other is BinaryFileContents);
 }