示例#1
0
        /// <summary>
        /// Add a file to the change set collection.
        /// </summary>
        /// <param name="fileName">Full path and filename of the file to add.</param>
        /// <exception>Exception</exception>
        private void AddFileToCollection(string fileName)
        {
            string repositoryPath = Folder.FullPath + "/" + System.IO.Path.GetFileName(fileName);

            if (File.Exists(fileName))
            {
                ChangeSetItem_AddFile changeSetItem = new ChangeSetItem_AddFile(DateTime.Now, Comment, String.Empty, fileName, repositoryPath);
                _changeSetCollection.Add(changeSetItem);
                Log.LogMessage(MessageImportance.Normal, string.Format(Properties.Resources.VaultFileAddedToChangeSet, fileName));
            }
            else if (Directory.Exists(fileName))
            {
                ChangeSetItem_AddFolder changeSetItem = new ChangeSetItem_AddFolder(DateTime.Now, Comment, String.Empty, fileName, repositoryPath);
                _changeSetCollection.Add(changeSetItem);
                Log.LogMessage(MessageImportance.Normal, string.Format(Properties.Resources.VaultFolderAddedToChangeSet, fileName));
            }
            else
            {
                throw new Exception(Properties.Resources.VaultAddFilesException);
            }
        }
示例#2
0
        /// <summary>
        /// Add a file to the change set collection.
        /// </summary>
        /// <param name="fileName">Full path and filename of the file to add.</param>
        /// <exception>Exception</exception>
        private void AddFileToCollection(string fileName)
        {
            string repositoryPath = Folder.FullPath + "/" + System.IO.Path.GetFileName(fileName);

            if (File.Exists(fileName))
            {
                ChangeSetItem_AddFile changeSetItem = new ChangeSetItem_AddFile(DateTime.Now, Comment, String.Empty, fileName, repositoryPath);
                _changeSetCollection.Add(changeSetItem);
                Log.LogMessage(MessageImportance.Normal, string.Format(Properties.Resources.VaultFileAddedToChangeSet, fileName));
            }
            else if (Directory.Exists(fileName))
            {
                ChangeSetItem_AddFolder changeSetItem = new ChangeSetItem_AddFolder(DateTime.Now, Comment, String.Empty, fileName, repositoryPath);
                _changeSetCollection.Add(changeSetItem);
                Log.LogMessage(MessageImportance.Normal, string.Format(Properties.Resources.VaultFolderAddedToChangeSet, fileName));
            }
            else
            {
                throw new Exception(Properties.Resources.VaultAddFilesException);
            }
        }