Esempio n. 1
0
        public void Add(DeploymentFile file)
        {
            string folderpath = Path.GetDirectoryName(file.LocalPath);
            DeploymentFolder folder;
            if (_folders.ContainsKey(folderpath))
                folder = _folders[folderpath];
            else {
                folder = new DeploymentFolder(folderpath);
                _folders.Add(folderpath, folder);
            }

            folder.Files.Add(file);

            _files.Add(file);
        }
Esempio n. 2
0
        /// <summary>
        /// Tries to add a file to the specified deploymentstructure...
        /// </summary>
        private void AddFile(string localFilePath, string virtualPath, DateTime modifiedSince)
        {
            if (!File.Exists(localFilePath))
                return;

            if (File.GetLastWriteTime(localFilePath) >= modifiedSince) {
                virtualPath = virtualPath.TrimEnd(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar);		// Remove trailing slash

                // Check if file matches any of the filters
                //string filePath = Path.Combine(virtualPath, Path.GetFileName(localFilePath));
                //Filter filter = _filtersettings.IncludeFiles.GetMatchingFilter(filePath);
                FilterSettings fs = _config.FindFilterSettings(virtualPath);
                if (fs == null)
                    throw new ApplicationException(string.Format("No filter settings found for path '{0}'", virtualPath));

                // This is the path that will be matched
                string filePath = Path.Combine(virtualPath, Path.GetFileName(localFilePath));

                // Ensure that we are matching relative to the virtual path of the current filter settings
                string pathToMatch = filePath.Substring(fs.VirtualPath.Length).TrimStart('\\');

                // Is file in the exclude list?
                if (fs.ExcludeFiles.IsMatching(pathToMatch))
                    return;

                // Try to find a matching filter
                Filter filter = fs.IncludeFiles.GetMatchingFilter(pathToMatch);
                if (filter != null) {
                    // A matching filter was found, which means the file should be included
                    if (filter.RemotePath != null)
                        virtualPath = filter.RemotePath;		// Filter overrides remote path
                    else
                        virtualPath = fs.BuildRelativeRemotePath(virtualPath);

                    DeploymentFile df = new DeploymentFile(localFilePath, virtualPath, filter);
                    df.DeployDestinationIdentifier = filter.DeployDestinationIdentifier;

                    // Does filter want a specific remote file name? (Only supported for exact matches)
                    if (!string.IsNullOrEmpty(filter.RemoteFileName) && filter.ExpressionType == FilterExpressionType.ExactFileName)
                        df.RemoteName = filter.RemoteFileName;

                    _structure.Add(df);
                }
            }
        }
Esempio n. 3
0
 /// <summary>
 /// Gets the display name for the deploy plugin type.
 /// </summary>
 /// <param name="file"></param>
 /// <returns></returns>
 private string GetDeployType(DeploymentFile file)
 {
     //string id = _currentProject.GetDeployPluginIdentifier(file);
     //IDeployerPlugin plugin = PluginManager.Plugins.Get(id);
     //if (plugin == null)
     //    return "Unknown";
     //return plugin.Name;
     DeployDestination destination = _currentProject.ActiveDeployConfig.Destinations.Get(file.DeployDestinationIdentifier);
     if (destination == null)
         return "Unknown";
     return destination.Name;
 }
Esempio n. 4
0
        /// <summary>
        /// Adds a file to the deployment queue.
        /// </summary>
        private void AddToQueue(DeploymentFile file)
        {
            GLItem item = _fileQueueList.Items.Add(file.LocalPath);
            item.SubItems[(int)FileQueueListColumns.LastModified].Text = file.GetLastWriteTime().ToString();
            item.SubItems[(int)FileQueueListColumns.Size].Text = Utility.FormatFileSize(file.Size);

            item.SubItems[(int)FileQueueListColumns.DeployType].Text = GetDeployType(file);
            item.SubItems[(int)FileQueueListColumns.RemotePath].Text = file.RemotePath;
            item.SubItems[(int)FileQueueListColumns.RemoteName].Text = file.RemoteName;

            ProgressBar pb = new ProgressBar();
            pb.Maximum = 100;
            item.SubItems[(int)FileQueueListColumns.Progress].Control = pb;

            item.Tag = file;
        }