コード例 #1
0
ファイル: AbstractSyncTests.cs プロジェクト: errotu/CmisSync
        /// <summary>
        /// Sync and wait, several times until a particular condition is satisfied.
        /// </summary>
        /// <returns>
        /// True if the condition got satisfied, false if the condition did not get satisfied within the time limit.
        /// </returns>
        /// <param name='synchronizedFolder'>
        /// Folder to synchronize.
        /// </param>
        /// <param name='checkStop'>
        /// If returns <c>true</c> wait returns true, otherwise a retry will be executed until reaching maxTries.
        /// </param>
        /// <param name='maxTries'>
        /// Number of retries, until false is returned, if checkStop could not be true.
        /// </param>
        /// <param name='pollInterval'>
        /// Sleep interval duration in miliseconds between synchronization calls.
        /// </param>
        public static bool SyncAndWaitUntilCondition(SynchronizedFolder synchronizedFolder, Func <bool> checkStop, int maxTries = 4, int pollInterval = 5000)
        {
            int i = 0;

            while (i < maxTries)
            {
                try
                {
                    synchronizedFolder.Sync();
                }
                catch (DotCMIS.Exceptions.CmisRuntimeException e)
                {
                    Console.WriteLine("{0} Exception caught and swallowed, retry.", e);
                    System.Threading.Thread.Sleep(pollInterval);
                    continue;
                }
                if (checkStop())
                {
                    return(true);
                }
                Console.WriteLine(String.Format("Retry Sync in {0}ms", pollInterval));
                System.Threading.Thread.Sleep(pollInterval);
                i++;
            }
            Console.WriteLine("Sync call was not successful");
            return(false);
        }
コード例 #2
0
ファイル: CmisRepo.cs プロジェクト: j2m2/CmisSync
 /// <summary>
 /// Constructor.
 /// </summary>
 public CmisRepo(RepoInfo repoInfo, IActivityListener activityListener)
     : base(repoInfo, activityListener)
 {
     this.synchronizedFolder = new SynchronizedFolder(repoInfo, this, activityListener);
     this.Watcher.ChangeEvent += OnFileActivity;
     this.Watcher.EnableEvent = true;
     Logger.Info(synchronizedFolder);
 }
コード例 #3
0
 /// <summary>
 /// Constructor.
 /// </summary>
 public CmisRepo(RepoInfo repoInfo, IActivityListener activityListener)
     : base(repoInfo, activityListener)
 {
     this.synchronizedFolder   = new SynchronizedFolder(repoInfo, this, activityListener);
     this.Watcher.ChangeEvent += OnFileActivity;
     this.Watcher.EnableEvent  = true;
     Logger.Info(synchronizedFolder);
 }
コード例 #4
0
ファイル: CmisRepo.cs プロジェクト: lefty01/CmisSync
 public CmisRepo(RepoInfo repoInfo, ActivityListener activityListener)
     : base(repoInfo)
 {
     cmis = new SynchronizedFolder(repoInfo, activityListener, this);
     Logger.Info("CmisRepo | " + cmis);
 }
コード例 #5
0
ファイル: CmisRepo.cs プロジェクト: jmanuelnavarro/CmisSync
 /// <summary>
 /// Constructor.
 /// </summary>
 public CmisRepo(RepoInfo repoInfo, IActivityListener activityListener)
     : base(repoInfo)
 {
     this.synchronizedFolder = new SynchronizedFolder(repoInfo, activityListener, this);
     Logger.Info(synchronizedFolder);
 }
コード例 #6
0
ファイル: CmisRepo.cs プロジェクト: errotu/CmisSync
 /// <summary>
 /// Constructor.
 /// </summary>
 public CmisRepo(RepoInfo repoInfo, IActivityListener activityListener, bool enableWatcher)
     : base(repoInfo, activityListener, enableWatcher)
 {
     this.synchronizedFolder = new SynchronizedFolder(repoInfo, this, activityListener);
     Logger.Info(synchronizedFolder);
 }
コード例 #7
0
 /// <summary>
 /// Constructor.
 /// </summary>
 public CmisRepo(RepoInfo repoInfo, IActivityListener activityListener)
     : base(repoInfo)
 {
     this.synchronizedFolder = new SynchronizedFolder(repoInfo, activityListener, this);
     Logger.Info(synchronizedFolder);
 }
コード例 #8
0
ファイル: CmisRepo.cs プロジェクト: pzsysa/CmisSync
 /// <summary>
 /// Update repository settings.
 /// </summary>
 public override void UpdateSettings(string password, int pollInterval)
 {
     base.UpdateSettings(password, pollInterval);
     this.synchronizedFolder = new SynchronizedFolder(RepoInfo, this);
     Logger.Info(synchronizedFolder);
 }