public void ExportFrames(string path, string contextExpression = "", string standardIdentityExpression = "", string dimensionExpression = "", ETLExportEnum exportType = ETLExportEnum.ETLExportSimple, bool append = false, bool omitSource = false, bool omitLegacy = false, long size = 32) { // The public entry point for exporting frames from the JMSML library // into CSV format. // Accepts a path for the output (sans file name extension). The caller // may also provide optional regular expressions to filter on the Label // attributes of the objects being exported. IFrameExport frameExporter = null; string line = ""; _configHelper.PointSize = (int)size; switch (exportType) { case ETLExportEnum.ETLExportDomain: frameExporter = new DomainFrameExport(_configHelper); break; case ETLExportEnum.ETLExportImage: frameExporter = new ImageFrameExport(_configHelper, omitSource, omitLegacy); break; } if (frameExporter != null) { using (var w = new StreamWriter(path + ".csv", append)) { if (!append) { line = string.Format("{0}", frameExporter.Headers); w.WriteLine(line); w.Flush(); } if (exportType == ETLExportEnum.ETLExportImage) { foreach (LibraryContext context in _library.Contexts) { if (contextExpression != "" && !System.Text.RegularExpressions.Regex.IsMatch(context.Label, contextExpression, System.Text.RegularExpressions.RegexOptions.IgnoreCase)) continue; foreach (LibraryStandardIdentity identity in _library.StandardIdentities) { if (standardIdentityExpression != "" && !System.Text.RegularExpressions.Regex.IsMatch(identity.Label, standardIdentityExpression, System.Text.RegularExpressions.RegexOptions.IgnoreCase)) continue; foreach (LibraryDimension dimension in _library.Dimensions) { if (dimensionExpression != "" && !System.Text.RegularExpressions.Regex.IsMatch(dimension.Label, dimensionExpression, System.Text.RegularExpressions.RegexOptions.IgnoreCase)) continue; // Export a frame for Status = Current line = frameExporter.Line(_librarian, context, identity, dimension, _library.Statuses[0], false, false); if (line != "") { w.WriteLine(line); w.Flush(); } // Export the frame for Status = Planned (not every frame will have a Planned version) // Shortened the label for this export so the stylx file will use the shorter name. LibraryStatus status = _library.Statuses[1]; status.LabelAlias = "Planned"; line = frameExporter.Line(_librarian, context, identity, dimension, status, false, false); status.LabelAlias = ""; if (line != "") { w.WriteLine(line); w.Flush(); } // Export the frame for the Civilian option (not every frame has one) line = frameExporter.Line(_librarian, context, identity, dimension, _library.Statuses[0], true, false); if (line != "") { w.WriteLine(line); w.Flush(); } // Export the frame for the Planned Civilian option (not every frame has one) line = frameExporter.Line(_librarian, context, identity, dimension, _library.Statuses[1], false, true); if (line != "") { w.WriteLine(line); w.Flush(); } } } } } else { foreach (LibraryStandardIdentity identity in _library.StandardIdentities) { if (standardIdentityExpression != "" && !System.Text.RegularExpressions.Regex.IsMatch(identity.Label, standardIdentityExpression, System.Text.RegularExpressions.RegexOptions.IgnoreCase)) continue; line = frameExporter.Line(null, null, identity, null, null, false, false); if (!identity.IsExtension) { if (line != "") { w.WriteLine(line); w.Flush(); } } } } w.Close(); } } }
public void ExportFrames(string path, string contextExpression = "", string standardIdentityExpression = "", string dimensionExpression = "", ETLExportEnum exportType = ETLExportEnum.ETLExportSimple, bool omitSource = false) { // The public entry point for exporting frames from the JMSML library // into CSV format. // Accepts a path for the output (sans file name extension). The caller // may also provide optional regular expressions to filter on the Label // attributes of the objects being exported. IFrameExport frameExporter = null; switch (exportType) { case ETLExportEnum.ETLExportImage: frameExporter = new ImageFrameExport(_configHelper, omitSource); break; } if (frameExporter != null) { using (var w = new StreamWriter(path + ".csv")) { var line = string.Format("{0}", frameExporter.Headers); w.WriteLine(line); w.Flush(); foreach (LibraryContext context in _library.Contexts) { if (contextExpression != "" && !System.Text.RegularExpressions.Regex.IsMatch(context.Label, contextExpression, System.Text.RegularExpressions.RegexOptions.IgnoreCase)) { continue; } foreach (LibraryStandardIdentity identity in _library.StandardIdentities) { if (standardIdentityExpression != "" && !System.Text.RegularExpressions.Regex.IsMatch(identity.Label, standardIdentityExpression, System.Text.RegularExpressions.RegexOptions.IgnoreCase)) { continue; } foreach (LibraryDimension dimension in _library.Dimensions) { if (dimensionExpression != "" && !System.Text.RegularExpressions.Regex.IsMatch(dimension.Label, dimensionExpression, System.Text.RegularExpressions.RegexOptions.IgnoreCase)) { continue; } line = frameExporter.Line(_librarian, context, identity, dimension); if (line != "") { w.WriteLine(line); w.Flush(); } } } } w.Close(); } } }