--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Pithos.Client.WPF.FileProperties
+{
+ public class ConflictResolver:IConflictResolver
+ {
+ public void Resolve(IEnumerable<ConflictFile> conflicts)
+ {
+ KeepServer(conflicts.Where(c => c.Action == ConflictAction.KeepServer));
+ KeepLocal(conflicts.Where(c => c.Action == ConflictAction.KeepLocal));
+ KeepBoth(conflicts.Where(c => c.Action == ConflictAction.KeepBoth));
+ ClearLocal(conflicts.Where(c => c.Action == ConflictAction.ClearLocal));
+ }
+
+
+ //Clearing the local state means that we clear the conflict state of the local file.
+ //This is needed to clear wrong conflicts
+ private void ClearLocal(IEnumerable<ConflictFile> conflicts)
+ {
+ //This can be done simply by changing the local Filestate status to normal
+ }
+
+
+ //Keeping the server version means that we need to
+ //download the server's version of the file.
+ private void KeepServer(IEnumerable<ConflictFile> conflicts)
+ {
+ //This can be done either by scheduling the appropriate action, ignoring the hash
+ //Or directly downloading the file.
+
+ }
+
+ //Keeping the server version means that we need to
+ //upload the local version of the file to the server
+ private void KeepLocal(IEnumerable<ConflictFile> conflicts)
+ {
+ //This can be done either by scheduling the appropriate action, ignoring the hash
+ //Or directly uploading the file.
+
+ }
+
+ //Keeping both versions means that we need to copy one of them
+ //somewhere and keep the other
+ private void KeepBoth(IEnumerable<ConflictFile> conflicts)
+ {
+ //We can copy the rename the local file to another name and download the server file
+ //Or rename the server file and upload the local file
+
+ //Downloading the server file is probably much faster with ADSL connections
+
+ //We could probably use the local file as a source of blocks to download fewer data,
+ //We create a hashmap of the local file, download the differences from the server
+ //and merge common and changed blocks to create the new file.
+ }
+ }
+}