public SynchronizationReport GetReport (SynchronizationReportName name) { using (var fileStream = File.OpenRead (Path.Combine (_reportDirectory, name.ToString()))) { return Serializer<SynchronizationReport>.DeserializeFrom (fileStream); } }
private void AddReportViewModel (SynchronizationReportName reportName) { string profileName; if (!_currentProfileNamesById.TryGetValue (reportName.SyncronizationProfileId, out profileName)) profileName = "<Not existing anymore>"; var reportProxy = new ReportProxy (reportName, () => _reportRepository.GetReport (reportName), profileName); var reportViewModel = new ReportViewModel (reportProxy, _reportRepository, this); _reports.Add (reportViewModel); }
public static bool TryParse (string value, out SynchronizationReportName name) { var match = Regex.Match (value, @"^(?<id>.*)(?<start>\d{14})(?<warnings>[01])(?<errors>[01])(?<sequence>\d+).log$"); if (match.Success) { name = new SynchronizationReportName ( new Guid (match.Groups["id"].Value), DateTime.SpecifyKind (DateTime.ParseExact (match.Groups["start"].Value, "yyyyMMddHHmmss", CultureInfo.InvariantCulture), DateTimeKind.Utc), match.Groups["warnings"].Value == "1", match.Groups["errors"].Value == "1", int.Parse (match.Groups["sequence"].Value)); return true; } else { name = null; return false; } }
public static bool TryParse(string value, out SynchronizationReportName name) { var match = Regex.Match(value, @"^(?<id>.{36})(?<start>\d{14})(?<warnings>[01])(?<errors>[01])(?<sequence>\d+).log$"); if (match.Success) { name = new SynchronizationReportName( new Guid(match.Groups["id"].Value), DateTime.SpecifyKind(DateTime.ParseExact(match.Groups["start"].Value, "yyyyMMddHHmmss", CultureInfo.InvariantCulture), DateTimeKind.Utc), match.Groups["warnings"].Value == "1", match.Groups["errors"].Value == "1", int.Parse(match.Groups["sequence"].Value)); return(true); } else { name = null; return(false); } }
public ReportAddedEventArgs (SynchronizationReport report, SynchronizationReportName reportName) : base(report) { _reportName = reportName; }
public ReportProxy (SynchronizationReportName name, Func<SynchronizationReport> getValue, string profileName) { _name = name; _getValue = getValue; _profileName = profileName; }
public Stream GetReportStream (SynchronizationReportName name) { return File.OpenRead (Path.Combine (_reportDirectory, name.ToString())); }
public void DeleteReport (SynchronizationReportName name) { File.Delete (Path.Combine (_reportDirectory, name.ToString())); }
protected virtual void OnReportAdded (SynchronizationReportName name, SynchronizationReport report) { var handler = ReportAdded; if (handler != null) handler (this, new ReportAddedEventArgs (report, name)); }
public Stream GetReportStream (SynchronizationReportName name) { return new MemoryStream(); }
public void DeleteReport (SynchronizationReportName name) { }
public SynchronizationReport GetReport (SynchronizationReportName name) { return null; }
public Stream GetReportStream (SynchronizationReportName name) { return _inner.GetReportStream (name); }
public void DeleteReport (SynchronizationReportName name) { _inner.DeleteReport (name); }
public SynchronizationReport GetReport (SynchronizationReportName name) { return _inner.GetReport(name); }