public void MountRepository(GinRepository repo)
 {
     if (!repo.Mounted)
     {
         var thread = new Thread(repo.Mount);
         thread.Start();
     }
 }
        public void DeleteRepository(GinRepository repo)
        {
            lock (this)
            {
                UnmountRepository(repo);
                repo.DeleteRepository();

                Repositories.Remove(repo);
            }
        }
 /// <summary>
 ///     Mount a repository
 /// </summary>
 /// <param name="repo"></param>
 public void MountRepository(GinRepository repo)
 {
     if (!repo.Mounted)
     {
         //The Dokan Mount() function, as of Version 1.2, is a blocking operation that does not return
         //as long as the file path remains mounted.
         var thread = new Thread(repo.Mount);
         thread.Start();
     }
 }
 private void OnFileRetrievalStarted(DokanInterface.FileOperationEventArgs e, GinRepository sender)
 {
     if (!string.Equals(e.File, "."))
     {
         AppIcon.ShowBalloonTip(1000, "GIN activity in progress", "Repository " + sender.Name + " operating on " + e.File, ToolTipIcon.Info);
     }
     else
     {
         AppIcon.ShowBalloonTip(1000, "GIN activity in progress", "Repository " + sender.Name + " operating on all files.", ToolTipIcon.Info);
     }
 }
        public bool UpdateRepository(string repoName, GinRepositoryData data)
        {
            lock (this)
            {
                var repo = Repositories.Single(r => CompareOrdinal(r.Name, repoName) == 0);
                UnmountRepository(repo);
                Repositories.Remove(repo);
                repo = new GinRepository(data);
                Repositories.Add(repo);
                MountRepository(repo);

                return(true);
            }
        }
        public void AddRepository(DirectoryInfo physicalDirectory, DirectoryInfo mountpoint, string name, string commandline, bool performFullCheckout, bool createNew)
        {
            var repo = new GinRepository(
                physicalDirectory,
                mountpoint,
                name,
                commandline, createNew);

            repo.FileOperationStarted   += Repo_FileOperationStarted;
            repo.FileOperationCompleted += Repo_FileOperationCompleted;
            repo.FileOperationProgress  += Repo_FileOperationProgress;
            repo.FileOperationError     += RepoOnFileOperationError;
            repo.CreateDirectories(performFullCheckout);
            MountRepository(repo);
            repo.Initialize();

            Repositories.Add(repo);
        }
 private void OnRepositoryOperationError(GinRepository sender,
                                         GinRepository.FileOperationErrorEventArgs message)
 {
     RepositoryOperationError?.Invoke(sender, message);
 }
 private void OnFileRetrievalCompleted(DokanInterface.FileOperationEventArgs e, GinRepository sender)
 {
     FileRetrievalCompleted?.Invoke(this, sender, e.File, e.Success);
 }
 private void OnFileRetrievalStarted(DokanInterface.FileOperationEventArgs e, GinRepository sender)
 {
     FileRetrievalStarted?.Invoke(this, sender, e.File);
 }
 public void UnmountRepository(GinRepository repo)
 {
     Dokan.RemoveMountPoint(repo.Mountpoint.FullName.Trim('\\'));
     repo.Mounted = false;
 }
 public string GetRepositoryFileInfo(GinRepository ginRepository)
 {
     return(ginRepository.GetStatusCacheJson());
 }
 private void OnRepositoryOperationError(GinRepository sender,
                                         GinRepository.FileOperationErrorEventArgs message)
 {
     MessageBox.Show(ginError + message.Message, "GIN Service Error",
                     MessageBoxButtons.OK, MessageBoxIcon.Error);
 }
 private void OnFileRetrievalCompleted(DokanInterface.FileOperationEventArgs e, GinRepository sender)
 {
     FileRetrievalCompleted?.Invoke(this, sender, e.File, e.Success);
     try
     {
         AppIcon.Text = "";
         AppIcon.ShowBalloonTip(1500, "GIN activity done", "Repository " + sender.Name + " work finished.", ToolTipIcon.Info);
     }
     catch
     {
     }
 }