public override void EstablishContext()
            {
                using( var container = new UnityContainer( ) )
                {
                    _processFacade = mockedProcessFacade( ) ;

                    container.RegisterInstance<IProcessFacade>( _processFacade.Object );

                    _plugin  = container.Resolve< Plugin >( ) ;

                    _runtimeSettings = stubRuntimeSettings( string.Empty ) ;
                }
            }
示例#2
0
        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);
                }
            }
示例#4
0
        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 ) ;
        }
示例#5
0
        static string getPasswordIfSpecified(IPluginRuntimeSettings runtimeSettings)
        {
            if (runtimeSettings.ContainsPropertyNamed(@"password"))
            {
                return(runtimeSettings[@"password"]);
            }

            if (string.IsNullOrEmpty(Settings.Password))
            {
                return(Settings.Password);
            }

            return(string.Empty);
        }
示例#6
0
        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);
        }
示例#7
0
        public void Run(IPluginRuntimeSettings settings, IPlugin lastPlugin)
        {
            _workingPath = lastPlugin.WorkingPath;

            _pluginSettings = settings;

            populateSender( );
            populateRecipients( );
            populateEmailContent( );
            includeAttachmentFromPreviousPlugin(lastPlugin);
            includeAnyAdditionalAttachments(  );

            send(  );
        }
示例#8
0
        public void Run(IPluginRuntimeSettings settings, IPlugin lastPlugin)
        {
            _workingPath = lastPlugin.WorkingPath ;

            _pluginSettings = settings ;

            populateSender( ) ;
            populateRecipients( ) ;
            populateEmailContent( ) ;
            includeAttachmentFromPreviousPlugin( lastPlugin) ;
            includeAnyAdditionalAttachments(  ) ;

            send(  ) ;
        }
示例#9
0
        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);
                }
            }
        }
示例#10
0
        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);
        }
示例#11
0
        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 );
        }
示例#12
0
        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);
        }
示例#13
0
        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 );
        }
示例#14
0
            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");
                }
            }
示例#15
0
        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);
        }
示例#16
0
            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);
                }
            }
示例#17
0
        /// <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);
            }
        }
示例#18
0
 /// <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 )
 {
 }
示例#19
0
        /// <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);
        }
示例#20
0
        static string getPasswordIfSpecified( IPluginRuntimeSettings runtimeSettings )
        {
            if(runtimeSettings.ContainsPropertyNamed( @"password" ))
            {
                return runtimeSettings[ @"password" ] ;
            }

            if(string.IsNullOrEmpty( Settings.Password ) )
            {
                return Settings.Password ;
            }

            return string.Empty ;
        }
示例#21
0
        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;
        }
示例#22
0
        public void Run(IPluginRuntimeSettings settings, IPlugin lastPlugin)
        {
            _workingPath = lastPlugin.WorkingPath ;

            analayse(lastPlugin.WorkingPath);
        }
示例#23
0
        /// <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 );
            }
        }
示例#24
0
 public void Run(IPluginRuntimeSettings settings, IPlugin lastPlugin)
 {
 }