private void SyncDownBase ()
{
if (!UseCustomWatcher)
this.watcher.Disable ();
SparkleLogger.LogInfo ("SyncDown", Name + " | Initiated");
SyncStatusChanged (SyncStatus.SyncDown);
string pre_sync_revision = CurrentRevision;
if (SyncDown ()) {
SparkleLogger.LogInfo ("SyncDown", Name + " | Done");
Error = ErrorStatus.None;
string identifier_file_path = Path.Combine (LocalPath, ".sparkleshare");
File.SetAttributes (identifier_file_path, FileAttributes.Hidden);
ChangeSets = GetChangeSets ();
if (!pre_sync_revision.Equals (CurrentRevision) &&
ChangeSets != null && ChangeSets.Count > 0 &&
!ChangeSets [0].User.Name.Equals (this.local_config.User.Name)) {
bool emit_change_event = true;
foreach (SparkleChange change in ChangeSets [0].Changes) {
if (change.Path.EndsWith (".sparkleshare")) {
emit_change_event = false;
break;
}
}
if (emit_change_event)
NewChangeSet (ChangeSets [0]);
}
// There could be changes from a resolved
// conflict. Tries only once, then lets
// the timer try again periodically
if (HasUnsyncedChanges) {
SyncStatusChanged (SyncStatus.SyncUp);
if (SyncUp ())
HasUnsyncedChanges = false;
}
SyncStatusChanged (SyncStatus.Idle);
} else {
SparkleLogger.LogInfo ("SyncDown", Name + " | Error");
ChangeSets = GetChangeSets ();
SyncStatusChanged (SyncStatus.Error);
}
ProgressPercentage = 0.0;
ProgressSpeed = 0.0;
SyncStatusChanged (SyncStatus.Idle);
if (!UseCustomWatcher)
this.watcher.Enable ();
}