コード例 #1
0
ファイル: Match.cs プロジェクト: xcrash/rsync.net
        public void Matched(IOStream f, SumStruct s, MapFile buf, int offset, int i, Sum sum)
        {
            int n = offset - lastMatch;
            int j;

            if (options.verbose > 2 && i >= 0)
            {
                Log.WriteLine("match at " + offset + " last_match=" + lastMatch + " j=" + i + " len=" + s.sums[i].len + " n=" + n);
            }

            Token token = new Token(options);

            token.SendToken(f, i, buf, lastMatch, n, (int)(i < 0?0:s.sums[i].len));
            dataTransfer += n;

            if (i >= 0)
            {
                Options.stats.matchedData += s.sums[i].len;
                n += (int)s.sums[i].len;
            }

            for (j = 0; j < n; j += CHUNK_SIZE)
            {
                int n1  = Math.Min(CHUNK_SIZE, n - j);
                int off = buf.MapPtr(lastMatch + j, n1);
                sum.Update(buf.p, off, n1);
            }

            if (i >= 0)
            {
                lastMatch = (int)(offset + s.sums[i].len);
            }
            else
            {
                lastMatch = offset;
            }

            if (buf != null && options.doProgress)
            {
                Progress.ShowProgress(lastMatch, buf.fileSize);
                if (i == -1)
                {
                    Progress.EndProgress(buf.fileSize);
                }
            }
        }
コード例 #2
0
ファイル: Match.cs プロジェクト: muratoflu/rsync.net
        public void Matched(IoStream f, SumStruct s, MapFile buf, int offset, int i, Sum sum)
        {
            var n = offset - _lastMatch;
            int j;

            if (_options.Verbose > 2 && i >= 0)
            {
                Log.WriteLine("match at " + offset + " last_match=" + _lastMatch + " j=" + i + " len=" + s.Sums[i].Len + " n=" + n);
            }

            var token = new Token(_options);

            token.SendToken(f, i, buf, _lastMatch, n, (int)(i < 0 ? 0 : s.Sums[i].Len));
            _dataTransfer += n;

            if (i >= 0)
            {
                Options.Stats.MatchedData += s.Sums[i].Len;
                n += (int)s.Sums[i].Len;
            }

            for (j = 0; j < n; j += ChunkSize)
            {
                var n1  = Math.Min(ChunkSize, n - j);
                var off = buf.MapPtr(_lastMatch + j, n1);
                sum.Update(buf.P, off, n1);
            }

            if (i >= 0)
            {
                _lastMatch = (int)(offset + s.Sums[i].Len);
            }
            else
            {
                _lastMatch = offset;
            }

            if (buf != null && _options.DoProgress)
            {
                Progress.ShowProgress(_lastMatch, buf.FileSize);
                if (i == -1)
                {
                    Progress.EndProgress(buf.FileSize);
                }
            }
        }
コード例 #3
0
ファイル: Match.cs プロジェクト: santosh-mnrec/rsync.net
		public void Matched(IOStream f, SumStruct s, MapFile buf, int offset, int i, Sum sum)
		{
			int n = offset - lastMatch;
			int j;

			if (options.verbose > 2 && i >= 0)
				Log.WriteLine("match at " + offset +" last_match=" + lastMatch + " j=" + i + " len=" + s.sums[i].len + " n=" + n);

			Token token = new Token(options);
			token.SendToken(f,i,buf,lastMatch,n,(int)(i<0?0:s.sums[i].len));
			dataTransfer += n;

			if (i >= 0) 
			{
				Options.stats.matchedData += s.sums[i].len;
				n += (int)s.sums[i].len;
			}

			for (j = 0; j < n; j += CHUNK_SIZE) 
			{
				int n1 = Math.Min(CHUNK_SIZE,n-j);
				int off = buf.MapPtr(lastMatch + j, n1);
				sum.Update(buf.p , off, n1);
			}

			if (i >= 0)
				lastMatch = (int)(offset + s.sums[i].len);
			else
				lastMatch = offset;

			if (buf != null && options.doProgress) 
			{
				Progress.ShowProgress(lastMatch, buf.fileSize);
				if (i == -1)
					Progress.EndProgress(buf.fileSize);
			}
		}