예제 #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
        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
		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);
			}
		}