Esempio n. 1
0
        public void AutoMountRepos()
        {
            List <string> activeRepos = this.GetAllActiveRepos();

            if (activeRepos.Count == 0)
            {
                return;
            }

            using (ITracer activity = this.tracer.StartActivity("AutoMount", EventLevel.Informational))
            {
                this.SendNotification("GVFS AutoMount", "Attempting to mount {0} GVFS repo(s)", activeRepos.Count);

                EventLevel verbosity = EventLevel.Informational;
                if (!Enum.TryParse(MountParameters.DefaultVerbosity, out verbosity))
                {
                    this.tracer.RelatedError("Unable to parse DefaultVerbosity'{0}'", MountParameters.DefaultVerbosity);
                }

                foreach (string repoRoot in activeRepos)
                {
                    GVFSMountProcess process = new GVFSMountProcess(activity, repoRoot);
                    if (process.Mount(verbosity, Keywords.Any, false))
                    {
                        this.SendNotification("GVFS AutoMount", "The following GVFS repo is now mounted: \n{0}", repoRoot);
                    }
                    else
                    {
                        this.SendNotification("GVFS AutoMount", "The following GVFS repo failed to mount: \n{0}", repoRoot);
                    }
                }
            }
        }
Esempio n. 2
0
        public void AutoMountRepos(int sessionId)
        {
            using (ITracer activity = this.tracer.StartActivity("AutoMount", EventLevel.Informational))
            {
                using (GVFSMountProcess process = new GVFSMountProcess(activity, sessionId))
                {
                    List <RepoRegistration> activeRepos = this.GetActiveReposForUser(process.CurrentUser.Identity.User.Value);
                    if (activeRepos.Count == 0)
                    {
                        return;
                    }

                    this.SendNotification(sessionId, "GVFS AutoMount", "Attempting to mount {0} GVFS repo(s)", activeRepos.Count);

                    foreach (RepoRegistration repo in activeRepos)
                    {
                        // TODO #1043088: We need to respect the elevation level of the original mount
                        if (process.Mount(repo.EnlistmentRoot))
                        {
                            this.SendNotification(sessionId, "GVFS AutoMount", "The following GVFS repo is now mounted: \n{0}", repo.EnlistmentRoot);
                        }
                        else
                        {
                            this.SendNotification(sessionId, "GVFS AutoMount", "The following GVFS repo failed to mount: \n{0}", repo.EnlistmentRoot);
                        }
                    }
                }
            }
        }