//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: public void dump(java.util.Set<String> classifiers, java.nio.file.Path destination, DiagnosticsReporterProgress progress, boolean force) throws java.io.IOException public virtual void Dump(ISet <string> classifiers, Path destination, DiagnosticsReporterProgress progress, bool force) { // Collect sources IList <DiagnosticsReportSource> sources = new List <DiagnosticsReportSource>(); foreach (DiagnosticsOfflineReportProvider provider in _providers) { ((IList <DiagnosticsReportSource>)sources).AddRange(provider.GetDiagnosticsSources(classifiers)); } // Add additional sources foreach (KeyValuePair <string, IList <DiagnosticsReportSource> > classifier in _additionalSources.SetOfKeyValuePairs()) { if (classifiers.Contains("all") || classifiers.Contains(classifier.Key)) { ((IList <DiagnosticsReportSource>)sources).AddRange(classifier.Value); } } // Make sure target directory exists Path destinationFolder = destination.Parent; Files.createDirectories(destinationFolder); // Estimate an upper bound of the final size and make sure it will fit, if not, end reporting EstimateSizeAndCheckAvailableDiskSpace(destination, progress, sources, destinationFolder, force); // Compress all files to destination IDictionary <string, object> env = new Dictionary <string, object>(); env["create"] = "true"; env["useTempFile"] = true; // NOTE: we need the toUri() in order to handle windows file paths URI uri = URI.create("jar:file:" + destination.toAbsolutePath().toUri().RawPath); using (FileSystem fs = FileSystems.newFileSystem(uri, env)) { progress.TotalSteps = sources.Count; for (int i = 0; i < sources.Count; i++) { DiagnosticsReportSource source = sources[i]; Path path = fs.getPath(source.DestinationPath()); if (path.Parent != null) { Files.createDirectories(path.Parent); } progress.Started(i + 1, path.ToString()); try { source.AddToArchive(path, progress); } catch (Exception e) { progress.Error("Step failed", e); continue; } progress.Finished(); } } }
public virtual void RegisterSource(string classifier, DiagnosticsReportSource source) { _availableClassifiers.Add(classifier); _additionalSources.computeIfAbsent(classifier, c => new List <>()).add(source); }