public virtual FileInfo GetArchiveFileInfoForDate(DateTime archiveDate, IDataLoadEventListener listener) { var loadCacheDirectory = GetLoadCacheDirectory(listener); if (ArchiveType == CacheArchiveType.None) { var matching = loadCacheDirectory.GetFiles(archiveDate.ToString(DateFormat) + ".*").ToArray(); if (matching.Length > 1) { throw new Exception("Mulitple files found in Cache that share the date " + archiveDate + ", matching files were:" + string.Join(",", matching.Select(m => m.Name)) + ". Cache directory is:" + loadCacheDirectory); } if (matching.Length == 1) { return(matching[0]); } //no matching archive is problem? return(null); } var filename = archiveDate.ToString(DateFormat) + "." + ArchiveType.ToString().ToLower(); listener.OnNotify(this, new NotifyEventArgs(ProgressEventType.Information, "Looking for a file called '" + filename + "' in '" + loadCacheDirectory.FullName + "'")); return(new FileInfo(Path.Combine(loadCacheDirectory.FullName, filename))); }
// archives files into <modality>/<year>/<month>/<day>/<date>.dcm public string GetArchiveFilepathForDate(DateTime archiveDate, IDataLoadEventListener listener) { var loadCacheDirectory = GetLoadCacheDirectory(listener); var yearDirectory = archiveDate.ToString("yyyy"); var monthDirectory = archiveDate.ToString("MM"); var dayDirectory = archiveDate.ToString("dd"); var filename = archiveDate.ToString(DateFormat) + "." + ArchiveType.ToString().ToLower(); return(Path.Combine(loadCacheDirectory.FullName, yearDirectory, monthDirectory, dayDirectory, filename)); }
void GeneratePage(ISiteContext context, PageModel model, string path, string segment, string name, List <PageInfo> list, int page, int skip, int take) { string format = FileUtility.GetArchiveUrl(context, segment, name, "{0}"); string first = FileUtility.GetArchiveUrl(context, segment, name); string file = FileUtility.GetArchivePath(context, segment, name, false, page); // Provide a default list to the template. The template // may present their own ordering using skip/take. PageInfo[] pages = list .OrderByDescending(p => p.Date) .Skip(skip) .Take(take) .ToArray(); model.Paginator = new PaginatorInfo(pages, page, list.Count, skip, take, first, format); string result = _template.Build(model, file, true, (ctx) => { ctx.ViewBag.ArchiveName = name; ctx.ViewBag.ArchiveType = _type.ToString(); }); }
public TestSessionLogXmlAssert AssertArchiveType(ArchiveType archiveType) { _testSessionLog.archiveType.Should().Be(archiveType.ToString()); return(this); }
private IEnumerable <FileInfo> GetArchiveFilesInLoadCacheDirectory(IDataLoadEventListener listener) { var disciplineRoot = GetLoadCacheDirectory(listener); return(disciplineRoot.EnumerateFiles("*." + (ArchiveType != CacheArchiveType.None ?ArchiveType.ToString():"*"))); }
public void Cleanup(IDataLoadEventListener listener) { // removes all non-archive files from the download directory var downloadDirectory = GetLoadCacheDirectory(listener); var nonArchiveFiles = downloadDirectory.EnumerateFiles("*").Where(info => info.Extension.ToLower() != ("." + ArchiveType.ToString().ToLower())); nonArchiveFiles.ToList().ForEach(info => info.Delete()); }
private void ArchiveInformationEvent(string archiveFileName, ArchiveType archiveType, Uuid uuid) { _statusEventHandler.RaiseEventNewArchiveInformation(new ArchiveInformationEventArgs( archiveType.ToString(), uuid.ToString(), archiveFileName)); }