Inheritance: IDataErrorInfo
		public object CreateTestConfigurationRequestMessage(Guid correlationId, Guid requestorCorrelationId, IDictionary<string, string> appSettings, ProjectElement project)
		{
			var configuration = project.GetElementCollection<CommandLineElementCollection>(Settings.ElementCollectionSettingName);
			return new CommandLineConfigurationTestRequestMessage
			{
				CorrelationId = correlationId,
				RequestorCorrelationId = requestorCorrelationId,
				AppSettings = appSettings,
				ProjectName = project.Name,
				Configuration = configuration
			};
		}
        private static void AddBoxNetUploaderSetting(ProjectElement project)
        {
            var configurationProperty = project.GetConfigurationProperty(BoxNetUploaderConfiguration.Instance.ElementCollectionSettingName);
            var commandElementCollection = project.GetElementCollection<BoxNetUploaderElementCollection>(configurationProperty);

            var element = new BoxNetUploaderElement
            {
                Name = "BoxNetUploaderElement",
                OutPutPath = @"c:\",
            };

            commandElementCollection.Add(element);
        }
        private static void AddAudioConversionSetting(ProjectElement project)
        {
            var configurationProperty = project.GetConfigurationProperty(AudioConversionConfiguration.Instance.ElementCollectionSettingName);
            var commandElementCollection = project.GetElementCollection<AudioConversionElementCollection>(configurationProperty);

            var element = new AudioConversionElement
            {
                Name = "AudioConversionElement",
                OutPutPath = @"c:\",
            };

            commandElementCollection.Add(element);
        }
		public object CreateRequestMessage(Guid correlationId, Guid requestorCorrelationId, IDictionary<string, string> appSettings, ProjectElement project, string workingFilePath, FileMatchElement fileMatch)
		{
			var configuration = project.GetElement<CommandLineElement>(fileMatch, Settings.ElementCollectionSettingName);

			return new CommandLineRequestMessage
			{
				CorrelationId = correlationId,
				RequestorCorrelationId = requestorCorrelationId,
				AppSettings = appSettings,
				Configuration = configuration,
				InputFilePath = workingFilePath,
				FileMatch = fileMatch
			};
		}
		private static void AddAntiVirusSetting(ProjectElement project)
		{
			var configurationProperty = project.GetConfigurationProperty(AntiVirusConfiguration.Instance.ElementCollectionSettingName);
			var commandElementCollection = project.GetElementCollection<AntiVirusElementCollection>(configurationProperty);

			var element = new AntiVirusElement
			{
				Name = "AntiVirusElement",
				OutPutPath = @"c:\",
				VirusScannerType = VirusScannerType.NotSpecified,
			};

			commandElementCollection.Add(element);
		}
    	/// <summary>
    	/// This is all the command settings that are related to the file match element.
    	/// </summary>
    	/// <param name="container">The container for all the plugins.</param>
    	/// <param name="project">The project to get all the command settings for.</param>
    	/// <returns>Dictionary of command type/command </returns>
    	private Dictionary<string, List<string>> GetCommandSettings(ExportProvider container, ProjectElement project)
		{
			var currentConfigurationElementCollections = container.GetExportedValues<CurrentConfigurationElementCollection>()
				.Where(x => !_excludedElements.Contains(x.Setting.ElementSettingName));

			var commandSettings = new Dictionary<string, List<string>>();

			foreach (var configurationElementCollection in currentConfigurationElementCollections)
			{
				var collectionSettingName = configurationElementCollection.Setting.ElementCollectionSettingName;
				var configurationProperty = project.GetConfigurationProperty(collectionSettingName);
				var commandElementCollection = project.GetElementCollection<CurrentConfigurationElementCollection>(configurationProperty);
				var conversionType = commandElementCollection.Setting.ConversionType;
				var commandSettingKeys = new List<string>();
				for (var i = 0; i < commandElementCollection.Count; i++)
				{
					var commandElement = commandElementCollection[i];
					commandSettingKeys.Add(commandElement.Name);
				}
				commandSettings.Add(conversionType, commandSettingKeys);
			}

			return commandSettings;
		}
        public void Run(ICommanderManager commanderManager, FileInfo inputFilePath, ProjectElement project, FileMatchElement fileMatch)
        {
            var commandSettings = new ProjectElementCommand<AntiVirusSettingElementCollection>(AntiVirusSettingConfiguration.CollectionSettingName, project);
            var antiVirusSettings = commandSettings.Settings;

            var commandSettingsKey = fileMatch.CommandSettingsKey;

            var antiVirusSetting = antiVirusSettings[commandSettingsKey];
            if (antiVirusSetting == null)
                throw new ConfigurationErrorsException("fileMatch attribute conversionSettingsKey='" +
                                                       antiVirusSetting +
                                                       "' does not match any key found in antiVirusSettings name attributes");


            var uniqueProcessingNumber = Guid.NewGuid().ToString();
            var uniqueDirectoryName = "antiVirus." + inputFilePath.Name + "." + uniqueProcessingNumber;

            DirectoryInfo workingDirectoryPath = null;
            if (!string.IsNullOrEmpty(antiVirusSetting.WorkingPath))
            {
                workingDirectoryPath = new DirectoryInfo(Path.Combine(antiVirusSetting.WorkingPath, uniqueDirectoryName));
            }
            else
            {
                workingDirectoryPath = new DirectoryInfo(Path.Combine(Path.GetTempPath(), uniqueDirectoryName));
            }

            try
            {
                workingDirectoryPath.Create();

                var output = string.Empty;
                FileInfo workingFilePath = null;

                var fileVirusFree = false;

                switch (antiVirusSetting.VirusScannerType)
                {
                    case VirusScannerType.NotSpecified:
                    case VirusScannerType.McAfee:
                        var mcAfeeSettings = GetMcAfeeSettings(antiVirusSetting);
                        var mcAfeeCommand = new McAfeeCommand();
                        fileVirusFree = mcAfeeCommand.Run(mcAfeeSettings, inputFilePath, workingDirectoryPath, out workingFilePath, out output);
                        break;
                }

                if (!fileVirusFree)
                {
                    var filename = workingFilePath.Name;

                    if (!string.IsNullOrEmpty(antiVirusSetting.FileNameFormat))
                    {
                        filename = string.Format(antiVirusSetting.FileNameFormat, filename);
                    }

                    var outputFilePath = new FileInfo(Path.Combine(antiVirusSetting.OutPutPath, filename));
                    if (outputFilePath.Exists)
                    {
                        outputFilePath.Delete();
                    }

                    workingFilePath.MoveTo(outputFilePath.FullName);
                }
                else
                {
                    FileInfo errorProcessingFilePath = null;
                    if (!string.IsNullOrEmpty(antiVirusSetting.ErrorProcessingPath))
                    {
                        errorProcessingFilePath = new FileInfo(Path.Combine(antiVirusSetting.ErrorProcessingPath, uniqueProcessingNumber + "." + inputFilePath.Name));
                    }

                    if (errorProcessingFilePath == null)
                    {
                        var exceptionOccurred = new Exception(output);
                        commanderManager.LogException(null, exceptionOccurred);
                    }
                    else
                    {
                        if (errorProcessingFilePath.Exists)
                        {
                            errorProcessingFilePath.Delete();
                        }

                        var errorProcessingLogFilePath = new FileInfo(errorProcessingFilePath.FullName + ".txt");

                        if (errorProcessingLogFilePath.Exists)
                        {
                            errorProcessingLogFilePath.Delete();
                        }

                        var exceptionOccurred = new Exception(output);
                        commanderManager.LogException(errorProcessingLogFilePath, exceptionOccurred);

                        //Anti-virus program may delete file but we will have log file at least
                        if (inputFilePath.Exists)
                        {
                            inputFilePath.CopyTo(errorProcessingFilePath.FullName);
                        }
                    }
                }
            }
            finally
            {
                if (workingDirectoryPath.Exists)
                {
                    workingDirectoryPath.Delete(true);
                }
            }
        }
        private static void AddCommandLineSetting(ProjectElement project)
        {
            var configurationProperty = project.GetConfigurationProperty(CommandLineConfiguration.Instance.ElementCollectionSettingName);
            var commandElementCollection = project.GetElementCollection<CommandLineElementCollection>(configurationProperty);

            var element = new CommandLineElement
            {
                Name = "CommandLineElement",
                OutPutPath = @"c:\",
            };

            commandElementCollection.Add(element);
        }
		private static CommandConfigurationTestRequestMessageTestDouble GetRequestCommandConfigurationTestMessage()
		{
		    var fileMatches = new FileMatchElementCollection
		    {
                new FileMatchElement
                    {
                        Name = "AntiVirusFileMatchElement",
                        Expression = @".+?\.(pdf|doc|xls|ppt)$",
                        ConversionType = "AntiVirus",
                        CommandSettingsKey = "AntiVirusElement"
                    }
		    };

			var folders = new FolderElementCollection
			{
				new FolderElement
					{
						Name = "Folder1",
						FolderToWatch = @"c:\",
						WorkingPath = @"c:\",
						CompletedPath = @"c:\",
                        FileMatches = fileMatches
					}
			};

			var project = new ProjectElement
			{
				Name = "test",
				Folders = folders,				
			};

			AddAntiVirusSetting(project);
		    AddAudioConversionSetting(project);
		    AddBoxNetUploaderSetting(project);
		    AddCommandLineSetting(project);
		    AddDropBoxUploaderSetting(project);
		    AddFlickrUploaderSetting(project);
		    AddImageConversionSetting(project);
		    AddPicasaUploaderSetting(project);
		    AddVideoConversionSetting(project);
		    AddVideoThumbnailerSetting(project);
		    AddYouTubeUploaderSetting(project);

			var appSettings = new AppSettingsSection();
			appSettings.Settings.Add("Key", "Value");

			return new CommandConfigurationTestRequestMessageTestDouble
			{
				CorrelationId = CombGuid.Generate(),
				ProjectName = project.Name,
				AppSettings = appSettings.Settings.ToDictionary()
			};
		}
        private static void AddVideoThumbnailerSetting(ProjectElement project)
        {
            var configurationProperty = project.GetConfigurationProperty(VideoThumbnailerConfiguration.Instance.ElementCollectionSettingName);
            var commandElementCollection = project.GetElementCollection<VideoThumbnailerElementCollection>(configurationProperty);

            var element = new VideoThumbnailerElement
            {
                Name = "VideoThumbnailerElement",
                OutPutPath = @"c:\",
            };

            commandElementCollection.Add(element);
        }