Synchronize() public method

public Synchronize ( string pattern ) : bool
pattern string
return bool
Ejemplo n.º 1
0
        public void BadFileSynch()
        {
            var expect = new Dictionary<FrameType, string>()
            {
                {FrameType.Artist, "my artist"},
                {FrameType.Title, "my song"}
            };

            var fileHandler = new FileSystemBuilder().
                ActualFile(new FileBuilder().
                    FilePath("my artist - my song").
                    Build()).
                Build();

            fileHandler.Tags.Add(FrameType.Artist, "artist");
            var fileProcesor = new Mp3FileProcessor(fileHandler);

            Assert.AreEqual(true, fileProcesor.Synchronize("<ar> - <ti>"));

            CollectionAssert.AreEquivalent(expect, fileHandler.Tags);
        }
Ejemplo n.º 2
0
        public bool PrepareSynch(string path, string pattern)
        {
            if (!_synchInProgres)
            {
                var mp3Processor = new Mp3FileProcessor(_lateFileHandler);

                var files = _folderHandler.GetAllMp3s(path);
                if (files.Count == 0)
                    return false;
                _synchInProgres = true;

                foreach (var file in files)
                {
                    _lateFileHandler.FilePath = file;
                    mp3Processor.Synchronize(pattern);
                }
                return true;
            }
            return false;
        }