public void Dispose()
 {
     ServerOperations.ProcessCommandUndoCheckout(new [] { _repoFolder }, true, LocalCopyType.Leave);
     ClearChangeSet();
     ServerOperations.RemoveWorkingFolder(_repoFolder);
     ServerOperations.Logout();
 }
        public void SetVaultWorkingFolder(string repoPath, string diskPath)
        {
            // Save the current working folder
            var list = ServerOperations.GetWorkingFolderAssignments();

            foreach (DictionaryEntry dict in list)
            {
                if (dict.Key.ToString().Equals(repoPath, StringComparison.OrdinalIgnoreCase))
                {
                    _originalWorkingFolder = dict.Value.ToString();
                    break;
                }
            }

            try
            {
                ServerOperations.SetWorkingFolder(repoPath, diskPath, true);
            }
            catch (WorkingFolderConflictException ex)
            {
                // Remove the working folder assignment and try again
                ServerOperations.RemoveWorkingFolder((string)ex.ConflictList[0]);
                ServerOperations.SetWorkingFolder(repoPath, diskPath, true);
            }
        }
Beispiel #3
0
        private int setVaultWorkingFolder(string repoPath)
        {
            var ticks = Environment.TickCount;

            //check for existing assignment and remove if found
            var workingFolders = ServerOperations.GetWorkingFolderAssignments();

            if (workingFolders.ContainsValue(this.WorkingFolder))
            {
                ServerOperations.RemoveWorkingFolder(workingFolders.GetKey(workingFolders.IndexOfValue(this.WorkingFolder)).ToString());
            }

            ServerOperations.SetWorkingFolder(repoPath, this.WorkingFolder, true);
            return(Environment.TickCount - ticks);
        }
Beispiel #4
0
        private int unSetVaultWorkingFolder(string repoPath)
        {
            var ticks = Environment.TickCount;
            //remove any assignment first
            //it is case sensitive, so we have to find how it is recorded first
            var exPath = ServerOperations.GetWorkingFolderAssignments()
                         .Cast <DictionaryEntry>()
                         .Select(e => e.Key.ToString())
                         .Where(e => repoPath.Equals(e, StringComparison.OrdinalIgnoreCase)).FirstOrDefault();

            if (null != exPath)
            {
                ServerOperations.RemoveWorkingFolder(exPath);
            }
            return(Environment.TickCount - ticks);
        }
        private void Login()
        {
            Console.WriteLine($"About to log in to {_vaultServer}");
            ServerOperations.SetLoginOptions($"http://{_vaultServer}/VaultService", _user, _password, _vaultRepository, false);
            ServerOperations.Login();
            Console.WriteLine("Connected");

            ServerOperations.client.MakeBackups = false;
            ServerOperations.client.AutoCommit  = false;
            ServerOperations.client.Verbose     = true;
            ServerOperations.client.ClientInstance.WorkingFolderOptions.RequireCheckOutBeforeCheckIn = false;

            Console.WriteLine($"Setting working folder to {_workingFolder}");
            ServerOperations.RemoveWorkingFolder(_repoFolder);
            ServerOperations.SetWorkingFolder(_repoFolder, _workingFolder, true);

            Console.WriteLine($"{nameof(ServerOperations.isConnected)}: {ServerOperations.isConnected()}");
        }
        public void UnSetVaultWorkingFolder(string repoPath)
        {
            //remove any assignment first
            //it is case sensitive, so we have to find how it is recorded first
            var exPath = ServerOperations.GetWorkingFolderAssignments().Cast <DictionaryEntry>()
                         .Select(e => e.Key.ToString()).FirstOrDefault(e => repoPath.Equals(e, StringComparison.OrdinalIgnoreCase));

            if (null != exPath)
            {
                ServerOperations.RemoveWorkingFolder(exPath);
            }

            if (_originalWorkingFolder != null)
            {
                ServerOperations.SetWorkingFolder(repoPath, _originalWorkingFolder, true);
                _originalWorkingFolder = null;
            }
        }