public static IEnumerable <T> LoadTests(SynoReportType run, Dictionary <SynoReportType, List <string> > tests) { foreach (string file in tests[run]) { yield return(SynoCSVReader <T> .LoadReport(From(file))); } }
public ISynoCSVReportPair GetReport(DateTime ts, SynoReportType first, SynoReportType second) { ISynoCSVReportPair result = null; DownloadUpdate?.Invoke(this, new SynoReportCacheDownloadEventArgs(CacheStatus.Processing)); if (_allreports.ContainsKey(ts)) { if (_allreports[ts].ContainsKey(first) && _allreports[ts].ContainsKey(second)) { switch ((1 + (int)first) * (1 + (int)second)) { case ((1 + (int)SynoReportType.ShareList) * (1 + (int)SynoReportType.VolumeUsage)): { result = new SynoReportVolumePieData(GetReport(ts, first), GetReport(ts, second)); } break; default: break; } } } DownloadUpdate?.Invoke(this, new SynoReportCacheDownloadEventArgs(CacheStatus.Idle)); return(result); }
private void setDataSource <T>(SynoReportDataGridView grid, DateTime ts, SynoReportType type) where T : class, ISynoReportDetail { if (cache != null) { grid.setDataSource <T>(cache.GetReport(ts, type)); } }
public CachedReportFile(FileInfo local, SynoReportType type, string path, string preTs, string postTs, string match, DateTime ts) { if (local.FullName.StartsWith(path) == false) { throw new ArgumentException("File is not located in configured Path", "local"); } string tmp = postTs.Replace(match, match.Replace("_", ">")).Replace('_', Path.DirectorySeparatorChar).Replace(match.Replace("_", ">"), match).Replace(Path.DirectorySeparatorChar, '/'); tmp = (preTs.Substring(path.Length).Replace('_', Path.DirectorySeparatorChar)).Replace(Path.DirectorySeparatorChar, '/') + "/" + ts.ToString("yyyy-MM-dd_HH-mm-ss") + "/" + tmp; _path = path; _src = tmp.Substring(1); _type = type; }
public ISynoCSVReport GetReport(DateTime ts, SynoReportType type) { ISynoCSVReport result = null; DownloadUpdate?.Invoke(this, new SynoReportCacheDownloadEventArgs(CacheStatus.Processing)); if (_allreports.ContainsKey(ts)) { if (_allreports[ts].ContainsKey(type)) { result = GetReport(_allreports[ts][type]); } } DownloadUpdate?.Invoke(this, new SynoReportCacheDownloadEventArgs(CacheStatus.Idle)); return(result); }
public ISynoCSVReport GetReport(SynoReportType type) { DownloadUpdate?.Invoke(this, new SynoReportCacheDownloadEventArgs(CacheStatus.Processing)); ISynoCSVReport report = null; switch (type) { case SynoReportType.DuplicateCandidates: report = SynoCSVReader <SynoReportDuplicateCandidates> .LoadReport(GetReports(type).First().LocalFile); break; case SynoReportType.VolumeUsage: report = SynoCSVReader <SynoReportVolumeUsage, SynoReportVolumeUsageValues> .LoadReport(GetReports(type)); break; case SynoReportType.ShareList: report = SynoCSVReader <SynoReportShares, SynoReportSharesValues> .LoadReport(GetReports(type)); break; case SynoReportType.LargeFiles: case SynoReportType.LeastModified: case SynoReportType.MostModified: report = SynoCSVReader <SynoReportContentTimeLine, SynoReportFileDetails> .LoadReport(GetReports(type)); break; case SynoReportType.FileGroup: report = SynoCSVReader <SynoReportContentTimeLine, SynoReportGroups> .LoadReport(GetReports(type)); break; case SynoReportType.FileOwner: report = SynoCSVReader <SynoReportContentTimeLine, SynoReportOwners> .LoadReport(GetReports(type)); break; default: report = SynoCSVReader <SynoReportContentTimeLine, SynoReportContents> .LoadReport(GetReports(type)); break; } DownloadUpdate?.Invoke(this, new SynoReportCacheDownloadEventArgs(CacheStatus.Idle)); return(report); }
public CachedReportFile(string source, SynoReportType type, string path) { _path = path; _src = source.Substring(1); _type = type; }
public IList <ICachedReportFile> GetReports(SynoReportType type) { return(_files.Values.Where(r => r.Type.Equals(type)).OrderByDescending(r => r.LocalFile.LastWriteTimeUtc).ToList()); }