public SparkleRepo(string path, SparkleConfig config) : base(path, config) { // TODO: Set git locale to en-US // Check if we should use git-bin SparkleGit git = new SparkleGit (LocalPath, "config --get filter.bin.clean"); git.StartAndWaitForExit (); this.use_git_bin = (git.ExitCode == 0); git = new SparkleGit (LocalPath, "config remote.origin.url \"" + RemoteUrl + "\""); git.StartAndWaitForExit (); string rebase_apply_path = new string [] { LocalPath, ".git", "rebase-apply" }.Combine (); if (Directory.Exists (rebase_apply_path)) { git = new SparkleGit (LocalPath, "rebase --abort"); git.StartAndWaitForExit (); } string password_file_path = Path.Combine (LocalPath, ".git", "password"); if (File.Exists (password_file_path)) this.is_encrypted = true; }
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 SparkleRepo(string path, SparkleConfig config) : base(path, config) { // TODO: Set git locale to en-US SparkleGit git = new SparkleGit (LocalPath, "config core.ignorecase false"); git.StartAndWaitForExit (); // Check if we should use git-bin git = new SparkleGit (LocalPath, "config --get filter.bin.clean"); git.StartAndWaitForExit (); this.use_git_bin = (git.ExitCode == 0); if (this.use_git_bin) { git = new SparkleGit (LocalPath, "config git-bin.sshUrl \"" + RemoteUrl + "\""); git.StartAndWaitForExit (); git = new SparkleGit (LocalPath, "config git-bin.sshPrivateKeyFile \"" + config.User.PrivateKeyFilePath + "\""); git.StartAndWaitForExit (); } git = new SparkleGit (LocalPath, "config remote.origin.url \"" + RemoteUrl + "\""); git.StartAndWaitForExit (); string password_file_path = Path.Combine (LocalPath, ".git", "password"); if (File.Exists (password_file_path)) this.is_encrypted = true; }
public SparkleRepo(string path, SparkleConfig config) : base(path, config) { SparkleGit git = new SparkleGit (LocalPath, "config --get filter.bin.clean"); git.Start (); git.WaitForExit (); this.use_git_bin = (git.ExitCode == 0); }
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 SparkleRepo(string path, SparkleConfig config) : base(path, config) { MoveToQloudSyncFolder(); Initialize(); EnableHasChanges = false; fileWatcher = new OSXFileWatcher(LocalRepo.LocalFolder); BacklogSynchronizer.GetInstance().Synchronize(); EnableHasChanges = true; }
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 SparkleRepo(string path, SparkleConfig config) : base(path, config) { Console.WriteLine("Cmis SparkleRepo constructor"); Dictionary<string, string> parameters = new Dictionary<string, string>(); parameters[SessionParameter.BindingType] = BindingType.AtomPub; parameters[SessionParameter.AtomPubUrl] = "http://localhost:8080/alfresco/service/cmis"; parameters[SessionParameter.User] = "admin"; parameters[SessionParameter.Password] = "admin"; SessionFactory factory = SessionFactory.NewInstance(); ISession session = factory.GetRepositories(parameters)[0].CreateSession(); Console.WriteLine("Created CMIS session"); }
public SparkleRepo(string path, SparkleConfig config) : base(path, config) { SparkleGit git = new SparkleGit (LocalPath, "config --get filter.bin.clean"); git.Start (); git.WaitForExit (); this.use_git_bin = (git.ExitCode == 0); string rebase_apply_path = SparkleHelpers.CombineMore (LocalPath, ".git", "rebase-apply"); if (Directory.Exists (rebase_apply_path)) { git = new SparkleGit (LocalPath, "rebase --abort"); git.StartAndWaitForExit (); } }
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; SyncStatusChanged += delegate (SyncStatus status) { Status = status; }; this.identifier = Identifier; ChangeSets = GetChangeSets (); SparkleWatcherFactory.CreateWatcher (this); 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 SparkleRepo(string path, SparkleConfig config) : base(path, config) { // TODO: Set git locale to en-US SparkleGit git = new SparkleGit (LocalPath, "config --get filter.bin.clean"); git.StartAndWaitForExit (); this.use_git_bin = (git.ExitCode == 0); git = new SparkleGit (LocalPath, "config remote.origin.url \"" + RemoteUrl + "\""); git.StartAndWaitForExit (); string rebase_apply_path = new string [] { LocalPath, ".git", "rebase-apply" }.Combine (); if (Directory.Exists (rebase_apply_path)) { git = new SparkleGit (LocalPath, "rebase --abort"); git.StartAndWaitForExit (); } }
public SparkleRepo(string path, SparkleConfig config) : base(path, config) { SparkleGit git = new SparkleGit (LocalPath, "config core.ignorecase false"); git.StartAndWaitForExit (); // Check if we should use git-bin git = new SparkleGit (LocalPath, "config --get filter.bin.clean"); git.StartAndWaitForExit (); this.use_git_bin = (git.ExitCode == 0); if (this.use_git_bin) ConfigureGitBin (); git = new SparkleGit (LocalPath, "config remote.origin.url \"" + RemoteUrl + "\""); git.StartAndWaitForExit (); string password_file_path = Path.Combine (LocalPath, ".git", "password"); if (File.Exists (password_file_path)) this.is_encrypted = true; }
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 SparkleRepo(string path, SparkleConfig config) : base(path, config) { cmis = new Cmis(path, config); SparkleLogger.LogInfo("Sync", "Cmis:" + cmis); }
public SparkleRepo(string path, SparkleConfig config, ActivityListener activityListener) : base(path, config) { cmis = new Cmis(path, config, activityListener); SparkleLogger.LogInfo("Sync", "Cmis:" + cmis); }
public virtual void Initialize() { string app_data_path = Environment.GetFolderPath (Environment.SpecialFolder.ApplicationData); string config_path = Path.Combine (app_data_path, "sparkleshare"); this.config = new SparkleConfig (config_path, "config.xml"); SparkleConfig.DefaultConfig = this.config; FoldersPath = this.config.FoldersPath; SparklePlugin.PluginsPath = PluginsPath; InstallProtocolHandler (); // Create the SparkleShare folder and add it to the bookmarks if (CreateSparkleShareFolder ()) AddToBookmarks (); if (FirstRun) { this.config.SetConfigOption ("notifications", bool.TrueString); } else { string keys_path = Path.GetDirectoryName (this.config.FullPath); string key_file_name = "sparkleshare." + CurrentUser.Email + ".key"; string key_file_path = Path.Combine (keys_path, key_file_name); // Be forgiving about the key's file name if (!File.Exists (key_file_path)) { foreach (string file_name in Directory.GetFiles (keys_path)) { if (file_name.StartsWith ("sparkleshare") && file_name.EndsWith (".key")) { key_file_path = Path.Combine (keys_path, file_name); break; } } } string pubkey_file_path = key_file_path + ".pub"; string link_code_file_path = Path.Combine (FoldersPath, CurrentUser.Name + "'s link code.txt"); // Create an easily accessible copy of the public // key in the user's SparkleShare folder if (File.Exists (pubkey_file_path) && !File.Exists (link_code_file_path)) File.Copy (pubkey_file_path, link_code_file_path, true /* Overwriting allowed */ ); SparkleKeys.ImportPrivateKey (key_file_path); SparkleKeys.ListPrivateKeys (); } // Watch the SparkleShare folder FileSystemWatcher watcher = new FileSystemWatcher () { Filter = "*", IncludeSubdirectories = false, Path = FoldersPath }; watcher.Deleted += OnFolderActivity; watcher.Created += OnFolderActivity; watcher.Renamed += OnFolderActivity; watcher.EnableRaisingEvents = true; }
public SparkleControllerBase () { string app_data_path = Environment.GetFolderPath (Environment.SpecialFolder.ApplicationData); string config_path = Path.Combine (app_data_path, "sparkleshare"); this.config = new SparkleConfig (config_path, "config.xml"); SparkleConfig.DefaultConfig = this.config; FoldersPath = this.config.FoldersPath; }
public SparkleControllerBase () { activityListenerAggregator = new ActivityListenerAggregator(this); string app_data_path = Environment.GetFolderPath (Environment.SpecialFolder.ApplicationData); string config_path = Path.Combine (app_data_path, "cmissync"); this.config = new SparkleConfig (config_path, "config.xml"); SparkleConfig.DefaultConfig = this.config; FoldersPath = this.config.FoldersPath; }