Пример #1
0
        private Episode EpisodeFactory(FileInfo file)
        {
            var episode = new Episode();
            var originalFileName = Path.GetFileNameWithoutExtension(file.Name);
            var sections = originalFileName.Split('_');
            episode.FilePath = UtilityMethods.MakeRelative(file.FullName, Location);
            bool canParse = false;
            if (sections.Length == 3)
            {
                episode.Name = sections[0];
                var dt = string.Format("{0}{1}", sections[1], sections[2]);
                DateTime time;

                canParse = DateTime.TryParseExact(dt,
                    "yyyyMMddHHmm",
                    CultureInfo.InvariantCulture,
                    DateTimeStyles.None, out time);
                episode.Time = time;
            }
            if (!canParse)
            {
                episode.Name = originalFileName;
            }
            return episode;
        }
Пример #2
0
 public void CopyEpisodeToTempDir(Episode episode)
 {
     string destFileName = ConfigurationManager.AppSettings["ScratchDir"];
     File.Copy(episode.FilePath, destFileName);
     episode.IntermediateTempPath = Path.Combine(destFileName, episode.Name);
 }