Revision dccd340f trunk/Pithos.Core/PithosMonitor.cs
b/trunk/Pithos.Core/PithosMonitor.cs | ||
---|---|---|
317 | 317 |
} |
318 | 318 |
}*/ |
319 | 319 |
|
320 |
internal class LocalFileComparer:EqualityComparer<CloudAction> |
|
321 |
{ |
|
322 |
public override bool Equals(CloudAction x, CloudAction y) |
|
323 |
{ |
|
324 |
if (x.Action != y.Action) |
|
325 |
return false; |
|
326 |
if (x.LocalFile != null && y.LocalFile != null && !x.LocalFile.FullName.Equals(y.LocalFile.FullName)) |
|
327 |
return false; |
|
328 |
if (x.CloudFile != null && y.CloudFile != null ) |
|
329 |
{ |
|
330 |
if (x.CloudFile.Hash == null & y.CloudFile.Hash != null) |
|
331 |
return false; |
|
332 |
if (x.CloudFile.Hash != null & y.CloudFile.Hash == null) |
|
333 |
return false; |
|
334 |
if (x.CloudFile.Hash == null & y.CloudFile.Hash == null) |
|
335 |
return (x.CloudFile.Name == y.CloudFile.Name); |
|
336 |
if (!x.CloudFile.Hash.Equals(y.CloudFile.Hash)) |
|
337 |
return false; |
|
338 |
} |
|
339 |
if (x.CloudFile == null ^ y.CloudFile == null || |
|
340 |
x.LocalFile == null ^ y.LocalFile == null) |
|
341 |
return false; |
|
342 |
return true; |
|
343 |
} |
|
344 |
|
|
345 |
public override int GetHashCode(CloudAction obj) |
|
346 |
{ |
|
347 |
if (obj == null) |
|
348 |
return 0; |
|
349 |
var hash1 = (obj.LocalFile == null) ? int.MaxValue : obj.LocalFile.FullName.GetHashCode(); |
|
350 |
var hash2 = (obj.CloudFile == null) ? int.MaxValue : (obj.CloudFile.Hash ?? obj.CloudFile.Name??"").GetHashCode(); |
|
351 |
var hash3 = obj.Action.GetHashCode(); |
|
352 |
return hash1 ^ hash2 & hash3; |
|
353 |
} |
|
354 |
} |
|
355 |
|
|
356 | 320 |
|
357 | 321 |
private void StartNetworkAgent() |
358 | 322 |
{ |
Also available in: Unified diff