Esempio n. 1
0
        public static BlobCommand BuildBlob(byte[] data, int?markId)
        {
            var hasher = SHA1.Create();
            var hash   = hasher.ComputeHash(data);

            if (_DataBlobs.ContainsKey(hash))
            {
                var blob = _DataBlobs[hash];
                if (blob.DataCommand._Bytes.Length != data.Length)
                {
                    throw new InvalidOperationException("There are two matching hashes, but the data are of two different lengths.");
                }
                return(blob);
            }
            else
            {
                var blob = new BlobCommand(data, markId);
                _DataBlobs[hash] = blob;
                return(blob);
            }
        }
Esempio n. 2
0
 public FileModifyCommand(string path, BlobCommand blob)
 {
     base.Path = path;
     this.Blob = blob;
 }