Exemplo n.º 1
0
        static void Main(string[] args)
        {
            DisplayBanner();
            if (args.Length < 1)
            {
                DisplayHelp();
                return;
            }

            IIocContainer iocContainer = InitializeIocContainer();

            ReadOnlyControlFile    control         = new ReadOnlyControlFile(args[0]);
            IFinder                finder          = iocContainer.Resolve <IFinder>();
            ICopier                copier          = iocContainer.Resolve <ICopier>();
            IUnwantedFileRemover   remover         = iocContainer.Resolve <IUnwantedFileRemover>();
            IUnwantedFolderRemover folderRemover   = iocContainer.Resolve <IUnwantedFolderRemover>();
            IFileUtilities         fileUtilities   = iocContainer.Resolve <IFileUtilities>();
            IPathUtilities         pathUtilities   = iocContainer.Resolve <IPathUtilities>();
            IPlaylistFactory       playlistFactory = iocContainer.Resolve <IPlaylistFactory>();

            Generator generator = new Generator(finder, fileUtilities, pathUtilities, playlistFactory);

            generator.StatusUpdate += new EventHandler <StatusUpdateEventArgs>(StatusUpdate);

            Synchronizer synchronizer = new Synchronizer(finder, copier, remover, folderRemover);

            synchronizer.StatusUpdate += new EventHandler <StatusUpdateEventArgs>(StatusUpdate);

            synchronizer.Synchronize(control, false);

            if (!string.IsNullOrEmpty(control.GetPlaylistFileName()))
            {
                generator.GeneratePlaylist(control, true);
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// construct a podcast synchroniser
 /// </summary>
 /// <param name="fileFinder">abstract interface to the file system to find media files</param>
 /// <param name="fileCopier">abstract file copier</param>
 /// <param name="fileRemover">abstract file remover, to synchronise deleted files in the source to the destination</param>
 /// <param name="folderRemover">abstract folder remover, to remove folder that have gone empty during sync</param>
 public Synchronizer(
     IFinder fileFinder,
     ICopier fileCopier,
     IUnwantedFileRemover fileRemover,
     IUnwantedFolderRemover folderRemover)
 {
     FileFinder    = fileFinder;
     FileCopier    = fileCopier;
     FileRemover   = fileRemover;
     FolderRemover = folderRemover;
 }