public override void EstablishContext() { using( var container = new UnityContainer( ) ) { _processFacade = mockedProcessFacade( ) ; container.RegisterInstance<IProcessFacade>( _processFacade.Object ); _plugin = container.Resolve< Plugin >( ) ; _runtimeSettings = stubRuntimeSettings( string.Empty ) ; } }
public void Run(IPluginRuntimeSettings settings, IPlugin lastPlugin) { _workingPath = lastPlugin.WorkingPath ; IEnumerable< string > childDirectories = _disk.GetChildDirectoriesRecursively( _workingPath ) ; foreach ( string eachDirectory in childDirectories ) { if( isSubversionFolder(eachDirectory) ) { _disk.DeleteFileOrDirectory( eachDirectory ); } } }
public override void EstablishContext() { using (var container = new UnityContainer( )) { _processFacade = mockedProcessFacade( ); container.RegisterInstance <IProcessFacade>(_processFacade.Object); _plugin = container.Resolve <Plugin>( ); _runtimeSettings = stubRuntimeSettings(string.Empty); } }
public void Run(IPluginRuntimeSettings settings, IPlugin lastPlugin) { if (lastPlugin == null) { throw new InvalidOperationException( @"The 'show in explorer' plugin cannot run because no previous plugin had run to show in Explorer."); } _workingPath = lastPlugin.WorkingPath; _processFacade.Start( @"explorer.exe", @"/select," + _workingPath ) ; }
static string getPasswordIfSpecified(IPluginRuntimeSettings runtimeSettings) { if (runtimeSettings.ContainsPropertyNamed(@"password")) { return(runtimeSettings[@"password"]); } if (string.IsNullOrEmpty(Settings.Password)) { return(Settings.Password); } return(string.Empty); }
public void Run(IPluginRuntimeSettings settings, IPlugin lastPlugin) { if (lastPlugin == null) { throw new InvalidOperationException( @"The 'show in explorer' plugin cannot run because no previous plugin had run to show in Explorer."); } _workingPath = lastPlugin.WorkingPath; _processFacade.Start( @"explorer.exe", @"/select," + _workingPath); }
public void Run(IPluginRuntimeSettings settings, IPlugin lastPlugin) { _workingPath = lastPlugin.WorkingPath; _pluginSettings = settings; populateSender( ); populateRecipients( ); populateEmailContent( ); includeAttachmentFromPreviousPlugin(lastPlugin); includeAnyAdditionalAttachments( ); send( ); }
public void Run(IPluginRuntimeSettings settings, IPlugin lastPlugin) { _workingPath = lastPlugin.WorkingPath ; _pluginSettings = settings ; populateSender( ) ; populateRecipients( ) ; populateEmailContent( ) ; includeAttachmentFromPreviousPlugin( lastPlugin) ; includeAnyAdditionalAttachments( ) ; send( ) ; }
public void Run(IPluginRuntimeSettings settings, IPlugin lastPlugin) { _workingPath = lastPlugin.WorkingPath; IEnumerable <string> childDirectories = _disk.GetChildDirectoriesRecursively(_workingPath); foreach (string eachDirectory in childDirectories) { if (isSubversionFolder(eachDirectory)) { _disk.DeleteFileOrDirectory(eachDirectory); } } }
public void Run(IPluginRuntimeSettings settings, IPlugin lastPlugin) { _runtimeSettings = settings; if (_runtimeSettings.ContainsPropertyNamed(@"writeTo")) { _workingPath = settings[@"writeTo"]; } else { _workingPath = getTempLocation(lastPlugin.WorkingPath); } _disk.CopyFolder(lastPlugin.WorkingPath, _workingPath); }
public void Run(IPluginRuntimeSettings settings, IPlugin lastPlugin) { _runtimeSettings = settings ; _workingPath = settings.ContainsPropertyNamed( @"writeTo" ) ? settings[ @"writeTo" ] : getTempLocation(lastPlugin.WorkingPath) ; if( !Directory.Exists( _workingPath ) ) { Directory.CreateDirectory( Path.GetDirectoryName( _workingPath ) ) ; } zipFolder(lastPlugin.WorkingPath, _workingPath ); }
public void Run(IPluginRuntimeSettings settings, IPlugin lastPlugin) { _runtimeSettings = settings; _workingPath = settings.ContainsPropertyNamed(@"writeTo") ? settings[@"writeTo"] : getTempLocation(lastPlugin.WorkingPath); if (!Directory.Exists(_workingPath)) { Directory.CreateDirectory(Path.GetDirectoryName(_workingPath)); } zipFolder(lastPlugin.WorkingPath, _workingPath); }
public void Run(IPluginRuntimeSettings settings, IPlugin lastPlugin) { _runtimeSettings = settings ; if(_runtimeSettings.ContainsPropertyNamed( @"writeTo" )) { _workingPath = settings[ @"writeTo" ]; } else { _workingPath = getTempLocation( lastPlugin.WorkingPath) ; } _disk.CopyFolder( lastPlugin.WorkingPath, _workingPath ); }
public override void EstablishContext() { using (var container = new UnityContainer( )) { _emailServer = new Mock <IEmailServer>( ); container.RegisterType <IEmailMessage, StubEmailMessage>( ) .RegisterType <IStaticSettings, StubEmailStaticSettings>( ) .RegisterInstance(mockedDisk( )) .RegisterInstance(_emailServer.Object); _plugin = container.Resolve <Plugin>( ); _runtimeSettings = stubRuntimeSettings( @"additionalAttachments:c:\temp\1.txt;c:\temp\2.txt+serverAddress:1.2.3.4+userName:Joe Bloggs+password:password123+timeout:666+recipients:[email protected],[email protected]+sendersEmail:[email protected]+sendersName:My Name+body:this is the body+subject:this is the subject"); } }
static string getPathToSaveZippedFileTo(IPluginRuntimeSettings runtimeSettings, string lastPath) { string currentPath = string.Empty; if (runtimeSettings.ContainsPropertyNamed(@"writeto")) { currentPath = runtimeSettings[@"writeto"]; } if (string.IsNullOrEmpty(currentPath)) { currentPath = Settings.WriteTo; } if (string.IsNullOrEmpty(currentPath)) { currentPath = getTempLocation(lastPath); } Directory.CreateDirectory(Path.GetDirectoryName(currentPath)); return(currentPath); }
public override void EstablishContext() { using (var container = new UnityContainer( )) { var mockStaticSettings = new Mock <IWriteableStaticSettings>( ); mockStaticSettings.SetupProperty(t => t.AdditionalAttachments, new List <string> { TestData.AdditionalAttachment1, TestData.AdditionalAttachment2 }); mockStaticSettings.SetupProperty(t => t.SmtpServerAddress, TestData.SmtpServerAddress); mockStaticSettings.SetupProperty(t => t.SmtpUsername, TestData.SmtpUsername); mockStaticSettings.SetupProperty(t => t.SmtpPassword, TestData.SmtpPassword); mockStaticSettings.SetupProperty(t => t.TimeoutInSeconds, TestData.TimeoutInSeconds); mockStaticSettings.SetupProperty(t => t.RecipientsEmailAddresses, new List <string> { TestData.RecipientEmailAddress1, TestData.RecipientEmailAddress2 }); mockStaticSettings.SetupProperty(t => t.SendersEmailAddress, TestData.SendersEmailAddress); mockStaticSettings.SetupProperty(t => t.SendersEmailDisplayName, TestData.SendersDisplayName); mockStaticSettings.SetupProperty(t => t.Body, TestData.Body); mockStaticSettings.SetupProperty(t => t.Subject, TestData.Subject); _emailServer = new Mock <IEmailServer>( ); container.RegisterType <IEmailMessage, StubEmailMessage>( ) .RegisterInstance <IStaticSettings>(mockStaticSettings.Object) .RegisterInstance(mockedDisk( )) .RegisterInstance(_emailServer.Object); _plugin = container.Resolve <Plugin>( ); _runtimeSettings = stubRuntimeSettings(string.Empty); } }
/// <summary> /// Performs some work based on the settings passed. /// </summary> /// <param name="settings">The settings. These specify the settings that the plugin /// should use and normally contain key/value pairs of parameters.</param> /// <param name="lastPlugin">The last plugin run. This is often useful as /// normally, plugins need to work with the output produced from the last plugin.</param> public void Run(IPluginRuntimeSettings settings, IPlugin lastPlugin) { _runtimeSettings = settings; string lastPath = lastPlugin.WorkingPath; _workingPath = getPathToSaveZippedFileTo(settings, lastPath); if (File.Exists(_workingPath)) { File.Delete(_workingPath); } var compressor = new SevenZipCompressor(); SevenZipLibraryManager.LibraryFileName = Settings.PathTo7ZipBinary; string password = getPasswordIfSpecified(settings); if (Directory.Exists(lastPath)) { compressor.CompressDirectory( lastPath, _workingPath, OutArchiveFormat.SevenZip, password); } else { compressor.CompressFiles( new[] { lastPath }, _workingPath, OutArchiveFormat.SevenZip, password); } }
/// <summary> /// Runs the specified runtime settings. /// </summary> /// <param name="settings">The runtime settings.</param> /// <param name="lastPlugin">The last plugin.</param> public void Run( IPluginRuntimeSettings settings, IPlugin lastPlugin ) { }
/// <summary> /// Runs the specified settings. /// </summary> /// <param name="settings">The settings.</param> /// <param name="lastPlugin">The last plugin run.</param> public void Run(IPluginRuntimeSettings settings, IPlugin lastPlugin) { _workingPath = lastPlugin.WorkingPath; analyse(lastPlugin.WorkingPath); }
static string getPasswordIfSpecified( IPluginRuntimeSettings runtimeSettings ) { if(runtimeSettings.ContainsPropertyNamed( @"password" )) { return runtimeSettings[ @"password" ] ; } if(string.IsNullOrEmpty( Settings.Password ) ) { return Settings.Password ; } return string.Empty ; }
static string getPathToSaveZippedFileTo( IPluginRuntimeSettings runtimeSettings, string lastPath ) { string currentPath = string.Empty ; if(runtimeSettings.ContainsPropertyNamed( @"writeto" )) { currentPath = runtimeSettings[ @"writeto" ] ; } if (string.IsNullOrEmpty(currentPath)) { currentPath = Settings.WriteTo ; } if (string.IsNullOrEmpty(currentPath)) { currentPath = getTempLocation(lastPath); } Directory.CreateDirectory(Path.GetDirectoryName(currentPath)); return currentPath; }
public void Run(IPluginRuntimeSettings settings, IPlugin lastPlugin) { _workingPath = lastPlugin.WorkingPath ; analayse(lastPlugin.WorkingPath); }
/// <summary> /// Performs some work based on the settings passed. /// </summary> /// <param name="settings">The settings. These specify the settings that the plugin /// should use and normally contain key/value pairs of parameters.</param> /// <param name="lastPlugin">The last plugin run. This is often useful as /// normally, plugins need to work with the output produced from the last plugin.</param> public void Run(IPluginRuntimeSettings settings, IPlugin lastPlugin) { _runtimeSettings = settings ; string lastPath = lastPlugin.WorkingPath ; _workingPath = getPathToSaveZippedFileTo( settings, lastPath ) ; if(File.Exists( _workingPath )) { File.Delete( _workingPath ); } var compressor = new SevenZipCompressor(); SevenZipLibraryManager.LibraryFileName = Settings.PathTo7ZipBinary ; string password = getPasswordIfSpecified( settings ) ; if( Directory.Exists( lastPath )) { compressor.CompressDirectory( lastPath, _workingPath, OutArchiveFormat.SevenZip, password ); } else { compressor.CompressFiles( new[] { lastPath }, _workingPath, OutArchiveFormat.SevenZip, password ); } }
public void Run(IPluginRuntimeSettings settings, IPlugin lastPlugin) { }