private void CreateWatcher() { this.watcher = new SparkleWatcher(LocalPath); this.watcher.ChangeEvent += delegate(FileSystemEventArgs args) { OnFileActivity(args); }; }
public SparkleRepoBase(string path, SparkleConfig config) { SparkleLogger.LogInfo(path, "Initializing..."); Status = SyncStatus.Idle; Error = ErrorStatus.None; this.local_config = config; LocalPath = path; Name = Path.GetFileName(LocalPath); RemoteUrl = new Uri(this.local_config.GetUrlForFolder(Name)); IsBuffering = false; this.identifier = Identifier; ChangeSets = GetChangeSets(); string is_paused = this.local_config.GetFolderOptionalAttribute(Name, "paused"); if (is_paused != null && is_paused.Equals(bool.TrueString)) { Status = SyncStatus.Paused; } string identifier_file_path = Path.Combine(LocalPath, ".sparkleshare"); File.SetAttributes(identifier_file_path, FileAttributes.Hidden); if (!UseCustomWatcher) { this.watcher = new SparkleWatcher(LocalPath); } new Thread(() => CreateListener()).Start(); this.remote_timer.Elapsed += RemoteTimerElapsedDelegate; }
public SparkleRepoBase(string path, SparkleConfig config) { SparkleLogger.LogInfo(path, "Initializing..."); Status = SyncStatus.Idle; Error = ErrorStatus.None; this.local_config = config; LocalPath = path; Name = Path.GetFileName(LocalPath); RemoteUrl = new Uri(this.local_config.GetUrlForFolder(Name)); IsBuffering = false; this.identifier = Identifier; ChangeSets = GetChangeSets(); string identifier_file_path = Path.Combine(LocalPath, ".sparkleshare"); File.SetAttributes(identifier_file_path, FileAttributes.Hidden); SyncStatusChanged += delegate(SyncStatus status) { Status = status; }; if (!UseCustomWatcher) { this.watcher = new SparkleWatcher(LocalPath); } new Thread(() => CreateListener()).Start(); this.remote_timer.Elapsed += delegate { if (this.is_syncing || IsBuffering) { return; } int time_comparison = DateTime.Compare(this.last_poll, DateTime.Now.Subtract(this.poll_interval)); bool time_to_poll = (time_comparison < 0); if (time_to_poll && !is_syncing) { this.last_poll = DateTime.Now; if (HasRemoteChanges) { this.poll_interval = PollInterval.Long; SyncDownBase(); } } // In the unlikely case that we haven't synced up our // changes or the server was down, sync up again if (HasUnsyncedChanges && !is_syncing && Error == ErrorStatus.None) { SyncUpBase(); } }; }
private SparkleWatcher CreateWatcher() { SparkleWatcher watcher = new SparkleWatcher(LocalPath); watcher.ChangeEvent += delegate(FileSystemEventArgs args) { OnFileActivity(args); }; return(watcher); }
public SparkleRepoBase(string path) { LocalPath = path; Name = Path.GetFileName(LocalPath); RemoteUrl = new Uri(SparkleConfig.DefaultConfig.GetUrlForFolder(Name)); IsBuffering = false; ServerOnline = true; SyncStatusChanged += delegate(SyncStatus status) { Status = status; }; this.identifier = Identifier; if (CurrentRevision == null) { CreateInitialChangeSet(); } ChangeSets = GetChangeSets(); this.watcher = CreateWatcher(); new Thread( new ThreadStart(delegate { CreateListener(); }) ).Start(); this.remote_timer.Elapsed += delegate { bool time_to_poll = (DateTime.Compare(this.last_poll, DateTime.Now.Subtract(this.poll_interval)) < 0); if (time_to_poll && !is_syncing) { this.last_poll = DateTime.Now; if (HasRemoteChanges) { SyncDownBase(); } } // In the unlikely case that we haven't synced up our // changes or the server was down, sync up again if (HasUnsyncedChanges && !is_syncing && ServerOnline) { SyncUpBase(); } }; }
public SparkleRepoBase(string path, SparkleConfig config) { this.local_config = config; LocalPath = path; Name = Path.GetFileName(LocalPath); RemoteUrl = new Uri(this.local_config.GetUrlForFolder(Name)); IsBuffering = false; ServerOnline = true; this.identifier = Identifier; ChangeSets = GetChangeSets(); SyncStatusChanged += delegate(SyncStatus status) { Status = status; }; if (!UseCustomWatcher) { this.watcher = new SparkleWatcher(LocalPath); } new Thread(() => CreateListener()).Start(); this.remote_timer.Elapsed += delegate { if (this.is_syncing || IsBuffering) { return; } int time_comparison = DateTime.Compare(this.last_poll, DateTime.Now.Subtract(this.poll_interval)); bool time_to_poll = (time_comparison < 0); if (time_to_poll && !is_syncing) { this.last_poll = DateTime.Now; if (HasRemoteChanges) { SyncDownBase(); } } // In the unlikely case that we haven't synced up our // changes or the server was down, sync up again if (HasUnsyncedChanges && !is_syncing && ServerOnline) { SyncUpBase(); } }; }
public SparkleRepoBase(string path) { LocalPath = path; Name = Path.GetFileName (LocalPath); RemoteUrl = new Uri (SparkleConfig.DefaultConfig.GetUrlForFolder (Name)); IsBuffering = false; ServerOnline = true; SyncStatusChanged += delegate (SyncStatus status) { Status = status; }; this.identifier = Identifier; if (CurrentRevision == null) CreateInitialChangeSet (); ChangeSets = GetChangeSets (); this.watcher = CreateWatcher (); new Thread ( new ThreadStart (delegate { CreateListener (); }) ).Start (); this.remote_timer.Elapsed += delegate { bool time_to_poll = (DateTime.Compare (this.last_poll, DateTime.Now.Subtract (this.poll_interval)) < 0); if (time_to_poll && !is_syncing) { this.last_poll = DateTime.Now; if (HasRemoteChanges) SyncDownBase (); } // In the unlikely case that we haven't synced up our // changes or the server was down, sync up again if (HasUnsyncedChanges && !is_syncing && ServerOnline) SyncUpBase (); }; }
private void CreateWatcher() { this.watcher = new SparkleWatcher (LocalPath); this.watcher.ChangeEvent += delegate (FileSystemEventArgs args) { OnFileActivity (args); }; }
public SparkleRepoBase (string path, SparkleConfig config) { SparkleLogger.LogInfo (path, "Initializing..."); Status = SyncStatus.Idle; Error = ErrorStatus.None; this.local_config = config; LocalPath = path; Name = Path.GetFileName (LocalPath); RemoteUrl = new Uri (this.local_config.GetUrlForFolder (Name)); IsBuffering = false; this.identifier = Identifier; ChangeSets = GetChangeSets (); string identifier_file_path = Path.Combine (LocalPath, ".sparkleshare"); File.SetAttributes (identifier_file_path, FileAttributes.Hidden); SyncStatusChanged += delegate (SyncStatus status) { Status = status; }; if (!UseCustomWatcher) this.watcher = new SparkleWatcher (LocalPath); new Thread (() => CreateListener ()).Start (); this.remote_timer.Elapsed += delegate { if (this.is_syncing || IsBuffering) return; int time_comparison = DateTime.Compare (this.last_poll, DateTime.Now.Subtract (this.poll_interval)); bool time_to_poll = (time_comparison < 0); if (time_to_poll && !is_syncing) { this.last_poll = DateTime.Now; if (HasRemoteChanges) { this.poll_interval = PollInterval.Long; SyncDownBase (); } } // In the unlikely case that we haven't synced up our // changes or the server was down, sync up again if (HasUnsyncedChanges && !is_syncing && Error == ErrorStatus.None) SyncUpBase (); }; }
public SparkleRepoBase (string path, SparkleConfig config) { SparkleLogger.LogInfo (path, "Initializing..."); Status = SyncStatus.Idle; Error = ErrorStatus.None; this.local_config = config; LocalPath = path; Name = Path.GetFileName (LocalPath); RemoteUrl = new Uri (this.local_config.GetUrlForFolder (Name)); IsBuffering = false; this.identifier = Identifier; ChangeSets = GetChangeSets (); string is_paused = this.local_config.GetFolderOptionalAttribute (Name, "paused"); if (is_paused != null && is_paused.Equals (bool.TrueString)) Status = SyncStatus.Paused; string identifier_file_path = Path.Combine (LocalPath, ".sparkleshare"); File.SetAttributes (identifier_file_path, FileAttributes.Hidden); if (!UseCustomWatcher) this.watcher = new SparkleWatcher (LocalPath); new Thread (() => CreateListener ()).Start (); this.remote_timer.Elapsed += RemoteTimerElapsedDelegate; }
public SparkleRepoBase (string path, SparkleConfig config) { this.local_config = config; LocalPath = path; Name = Path.GetFileName (LocalPath); RemoteUrl = new Uri (this.local_config.GetUrlForFolder (Name)); IsBuffering = false; ServerOnline = true; this.identifier = Identifier; ChangeSets = GetChangeSets (); SyncStatusChanged += delegate (SyncStatus status) { Status = status; }; if (!UseCustomWatcher) this.watcher = new SparkleWatcher (LocalPath); new Thread (() => CreateListener ()).Start (); this.remote_timer.Elapsed += delegate { if (this.is_syncing || IsBuffering) return; int time_comparison = DateTime.Compare (this.last_poll, DateTime.Now.Subtract (this.poll_interval)); bool time_to_poll = (time_comparison < 0); if (time_to_poll && !is_syncing) { this.last_poll = DateTime.Now; if (HasRemoteChanges) SyncDownBase (); } // In the unlikely case that we haven't synced up our // changes or the server was down, sync up again if (HasUnsyncedChanges && !is_syncing && ServerOnline) SyncUpBase (); }; }
private SparkleWatcher CreateWatcher() { SparkleWatcher watcher = new SparkleWatcher (LocalPath); watcher.ChangeEvent += delegate (FileSystemEventArgs args) { OnFileActivity (args); }; return watcher; }