/// <summary>
        /// Opens a folder on disk as a MusicFolder
        /// </summary>       
        public ImportResult Import(string fullPath)
        {
            if (string.IsNullOrEmpty(fullPath)) return ImportResult.PathNotFound();            
            if (!fs.Directory.Exists(fullPath)) return ImportResult.PathNotFound();

            var folder = new ImportedFolder();
            folder.FullPath = fullPath;
            folder.FileName = fullPath.Split(fs.Path.DirectorySeparatorChar).Last();

            try
            {
                folder.Date = new Date(folder.FileName.Split(' ')[0]);
            }
            catch(Exception ex)
            {
                return ImportResult.InvalidDate();
            }

            //var folderCaption = folderName.Substring(folderName.Split(' ')[0].Length);

            foreach (var file in GetFiles(fullPath))
            {
                folder.Files.Add(file);
            }            

            return new ImportResult
            {
                Folder = folder,
                // include analysis cache if it already exists
            };
        }
예제 #2
0
        /// <summary>
        /// Opens a folder on disk as a MusicFolder
        /// </summary>
        public ImportResult Import(string fullPath)
        {
            if (string.IsNullOrEmpty(fullPath))
            {
                return(ImportResult.PathNotFound());
            }
            if (!fs.Directory.Exists(fullPath))
            {
                return(ImportResult.PathNotFound());
            }

            var folder = new ImportedFolder();

            folder.FullPath = fullPath;
            folder.FileName = fullPath.Split(fs.Path.DirectorySeparatorChar).Last();

            try
            {
                folder.Date = new Date(folder.FileName.Split(' ')[0]);
            }
            catch (Exception ex)
            {
                return(ImportResult.InvalidDate());
            }

            //var folderCaption = folderName.Substring(folderName.Split(' ')[0].Length);

            foreach (var file in GetFiles(fullPath))
            {
                folder.Files.Add(file);
            }

            return(new ImportResult
            {
                Folder = folder,
                // include analysis cache if it already exists
            });
        }