Ejemplo n.º 1
0
        /// <summary>
        /// Retrieves the specified file.
        /// </summary>
        /// <exception>Exception</exception>
        private void GetFile(string fileName)
        {
            if (IsVaultFolder(fileName))
            {
                VaultClientFolder vaultClientFolder = ClientInstance.TreeCache.Repository.Root.FindFolderRecursive(fileName);

                if (Destination.Length == 0)
                {
                    if (!String.IsNullOrEmpty(WorkingFolder))
                    {
                        ClientInstance.TreeCache.SetWorkingFolder(vaultClientFolder.FullPath, WorkingFolder);
                    }

                    ClientInstance.Get(vaultClientFolder, true, true, MakeWritableType.MakeAllFilesWritable, SetFileTimeType.Current, MergeType.OverwriteWorkingCopy, null);
                }
                else
                {
                    ClientInstance.GetToNonWorkingFolder(vaultClientFolder, true, true, true, MakeWritableType.MakeAllFilesWritable, SetFileTimeType.Current, Destination, null);
                }
            }

            if (IsVaultFile(fileName))
            {
                VaultClientFile vaultClientFile = ClientInstance.TreeCache.Repository.Root.FindFileRecursive(fileName);

                if (Destination.Length == 0)
                {
                    if (!String.IsNullOrEmpty(WorkingFolder))
                    {
                        ClientInstance.TreeCache.SetWorkingFolder(vaultClientFile.Parent.FullPath, WorkingFolder);
                    }

                    ClientInstance.Get(vaultClientFile, true, MakeWritableType.MakeAllFilesWritable, SetFileTimeType.Current, MergeType.OverwriteWorkingCopy, null);
                }
                else
                {
                    ClientInstance.GetToNonWorkingFolder(vaultClientFile, true, true, MakeWritableType.MakeAllFilesWritable, SetFileTimeType.Current, vaultClientFile.Parent.FullPath, Destination, null);
                }
            }
        }