Revision a27aa447 trunk/Pithos.Core/FileState.cs
b/trunk/Pithos.Core/FileState.cs | ||
---|---|---|
109 | 109 |
if (Directory.Exists(FilePath)) |
110 | 110 |
return Task.Factory.StartNew(() => this); |
111 | 111 |
|
112 |
return Task.Factory.StartNew(() => |
|
113 |
{ |
|
114 |
Checksum = Signature.CalculateMD5(FilePath); |
|
115 |
TopHash = |
|
116 |
Signature.CalculateTreeHash(FilePath, blockSize, algorithm) |
|
117 |
.TopHash.ToHashString(); |
|
118 |
}) |
|
119 |
.ContinueWith( |
|
120 |
t => this); |
|
112 |
var results=Task.Factory.TrackedSequence( |
|
113 |
() => Task.Factory.StartNew(() => Signature.CalculateMD5(FilePath)), |
|
114 |
() => Signature.CalculateTreeHashAsync(FilePath, blockSize, algorithm) |
|
115 |
); |
|
116 |
|
|
117 |
results.ContinueWith(t => |
|
118 |
{ |
|
119 |
var hashes = t.Result; |
|
120 |
Checksum = (hashes[0] as Task<string>).Result; |
|
121 |
TopHash = (hashes[0] as Task<TreeHash>).Result.TopHash.ToHashString(); |
|
122 |
}); |
|
123 |
|
|
124 |
return results.ContinueWith(t => this); |
|
121 | 125 |
} |
122 | 126 |
} |
123 | 127 |
|
Also available in: Unified diff