private static void AddGraphAttributes(MainGraphExportContext mainExportContext, StreamWriter writer) { foreach (KeyValuePair <string, GraphExportContext> kvp in mainExportContext.nameToContext) { GraphExportContext context = kvp.Value; GRSExport.EmitSubgraphAttributes(mainExportContext, context, writer); } }
void EmitObjectAttributeAssignmentCreatingAsNeeded(IObject owner, AttributeType attrType, MainGraphExportContext mainExportContext, RecordingState recordingState) { if (!mainExportContext.HasPersistentName(owner)) { StringBuilder deferredInits = new StringBuilder(); GRSExport.EmitObjectCreation(mainExportContext, owner.Type, owner, graph, recordingState.writer, deferredInits); recordingState.writer.WriteLine(); recordingState.writer.Write(deferredInits.ToString()); } recordingState.writer.Write("@@(\"" + mainExportContext.GetOrAssignPersistentName((IObject)owner) + "\")." + attrType.Name + " = "); }
private bool AddSubgraphsAsNeeded(MainGraphExportContext mainExportContext, IGraphElement element, AttributeType attrType, Object value, StreamWriter writer) { if (!GRSExport.IsGraphUsedInAttribute(attrType)) { return(false); } if (value == null) { return(false); } if (!(value is INamedGraph)) { return(false); } bool wasAdded = GRSExport.AddSubgraphAsNeeded(mainExportContext, (INamedGraph)value); if (wasAdded) { restart: foreach (KeyValuePair <string, GraphExportContext> kvp in mainExportContext.nameToContext) { GraphExportContext context = kvp.Value; if (!context.isExported) { wasAdded = GRSExport.ExportSingleGraph(mainExportContext, context, writer); if (wasAdded) { goto restart; } } } AddGraphAttributes(mainExportContext, writer); writer.WriteLine("in \"" + mainExportContext.graphToContext[graph].name + "\" # after emitting new subgraph for attribute"); return(true); } return(false); }
/// <summary> /// Exports the given named graph to a file with the given filename. /// The format is determined by the file extension. /// Currently available are: .grs/.grsi or .gxl or .xmi. /// Optionally suffixed by .gz; in this case they are saved gzipped. /// Any errors will be reported by exception. /// </summary> /// <param name="graph">The named graph to export. /// The .grs/.grsi exporter is exporting the names/including the names; import will return a named graph again. /// The .gxl exporter is exporting without the names, which is equivalent of calling the non-named graph export.</param> /// The .xmi exporter is using the names as xmi ids.</param> /// <param name="filenameParameters">The names of the files to be exported. /// The first must be a filename, the following may be used for giving export parameters /// (in fact currently no exporter supports multiple files).</param> public static void Export(INamedGraph graph, List <String> filenameParameters) { String first = ListGet(filenameParameters, 0); StreamWriter writer = null; if (first.EndsWith(".gz", StringComparison.InvariantCultureIgnoreCase)) { FileStream filewriter = new FileStream(first, FileMode.OpenOrCreate, FileAccess.Write); writer = new StreamWriter(new GZipStream(filewriter, CompressionMode.Compress)); first = first.Substring(0, first.Length - 3); } else { writer = new StreamWriter(first); } using (writer) { if (first.EndsWith(".gxl", StringComparison.InvariantCultureIgnoreCase)) { GXLExport.Export(graph, writer); } else if (first.EndsWith(".grs", StringComparison.InvariantCultureIgnoreCase) || first.EndsWith(".grsi", StringComparison.InvariantCultureIgnoreCase)) { GRSExport.Export(graph, writer); } else if (first.EndsWith(".xmi", StringComparison.InvariantCultureIgnoreCase)) { XMIExport.Export(graph, writer); } else if (first.EndsWith(".grg", StringComparison.InvariantCultureIgnoreCase)) { GRGExport.Export(graph, writer); } else { throw new NotSupportedException("File format not supported"); } } }
public void StartRecording(string filename) { if (!recordings.ContainsKey(filename)) { if (recordings.Count == 0) { SubscribeEvents(); } StreamWriter writer = null; if (filename.EndsWith(".gz", StringComparison.InvariantCultureIgnoreCase)) { FileStream filewriter = new FileStream(filename, FileMode.OpenOrCreate, FileAccess.Write); writer = new StreamWriter(new GZipStream(filewriter, CompressionMode.Compress)); } else { writer = new StreamWriter(filename); } String pathPrefix = ""; if (filename.LastIndexOf("/") != -1 || filename.LastIndexOf("\\") != -1) { int lastIndex = filename.LastIndexOf("/"); if (lastIndex == -1) { lastIndex = filename.LastIndexOf("\\"); } pathPrefix = filename.Substring(0, lastIndex + 1); } MainGraphExportContext mainGraphContext = GRSExport.ExportYouMustCloseStreamWriter(graph, writer, pathPrefix, false, null); recordings.Add(new KeyValuePair <string, RecordingState>(filename, new RecordingState(writer, mainGraphContext))); } }
private static bool AddSubgraphsAsNeeded(INamedGraph potentialNewGraph, RecordingState recordingState) { bool wasAdded = GRSExport.AddSubgraphAsNeeded(recordingState.mainExportContext, potentialNewGraph); if (wasAdded) { restart: foreach (KeyValuePair <string, GraphExportContext> kvp in recordingState.mainExportContext.nameToContext) { GraphExportContext context = kvp.Value; if (!context.isExported) { wasAdded = GRSExport.ExportSingleGraph(recordingState.mainExportContext, context, recordingState.writer); if (wasAdded) { goto restart; } } } AddGraphAttributes(recordingState.mainExportContext, recordingState.writer); return(true); } return(false); }
/// <summary> /// Event handler for IGraph.OnChangingNodeAttribute and IGraph.OnChangingEdgeAttribute. /// </summary> /// <param name="element">The node or edge whose attribute is changed.</param> /// <param name="attrType">The type of the attribute to be changed.</param> /// <param name="changeType">The type of the change which will be made.</param> /// <param name="newValue">The new value of the attribute, if changeType==Assign. /// Or the value to be inserted/removed if changeType==PutElement/RemoveElement on set. /// Or the new map pair value to be inserted if changeType==PutElement on map. /// Or the new value to be inserted/added if changeType==PutElement on array. /// Or the new value to be assigned to the given position if changeType==AssignElement on array.</param> /// <param name="keyValue">The map pair key to be inserted/removed if changeType==PutElement/RemoveElement on map. /// The array index to be removed/written to if changeType==RemoveElement/AssignElement on array.</param> void ChangingAttribute(IGraphElement element, AttributeType attrType, AttributeChangeType changeType, Object newValue, Object keyValue) { foreach (RecordingState recordingState in recordings.Values) { MainGraphExportContext mainExportContext = recordingState.mainExportContext; AddSubgraphsAsNeeded(mainExportContext, element, attrType, newValue, recordingState.writer); AddSubgraphsAsNeeded(mainExportContext, element, attrType, keyValue, recordingState.writer); switch (changeType) { case AttributeChangeType.Assign: recordingState.writer.Write("@(\"" + graph.GetElementName(element) + "\")." + attrType.Name + " = "); GRSExport.EmitAttribute(mainExportContext, attrType, newValue, graph, recordingState.writer); recordingState.writer.WriteLine(); break; case AttributeChangeType.PutElement: recordingState.writer.Write("@(\"" + graph.GetElementName(element) + "\")." + attrType.Name); switch (attrType.Kind) { case AttributeKind.SetAttr: recordingState.writer.Write(".add("); recordingState.writer.Write(GRSExport.ToString(mainExportContext, newValue, attrType.ValueType, graph)); recordingState.writer.WriteLine(")"); break; case AttributeKind.MapAttr: recordingState.writer.Write(".add("); recordingState.writer.Write(GRSExport.ToString(mainExportContext, keyValue, attrType.KeyType, graph)); recordingState.writer.Write(", "); recordingState.writer.Write(GRSExport.ToString(mainExportContext, newValue, attrType.ValueType, graph)); recordingState.writer.WriteLine(")"); break; case AttributeKind.ArrayAttr: if (keyValue == null) { recordingState.writer.Write(".add("); recordingState.writer.Write(GRSExport.ToString(mainExportContext, newValue, attrType.ValueType, graph)); recordingState.writer.WriteLine(")"); } else { recordingState.writer.Write(".add("); recordingState.writer.Write(GRSExport.ToString(mainExportContext, newValue, attrType.ValueType, graph)); recordingState.writer.Write(", "); recordingState.writer.Write(GRSExport.ToString(mainExportContext, keyValue, new AttributeType(null, null, AttributeKind.IntegerAttr, null, null, null, null, null, null, typeof(int)), graph)); recordingState.writer.WriteLine(")"); } break; case AttributeKind.DequeAttr: if (keyValue == null) { recordingState.writer.Write(".add("); recordingState.writer.Write(GRSExport.ToString(mainExportContext, newValue, attrType.ValueType, graph)); recordingState.writer.WriteLine(")"); } else { recordingState.writer.Write(".add("); recordingState.writer.Write(GRSExport.ToString(mainExportContext, newValue, attrType.ValueType, graph)); recordingState.writer.Write(", "); recordingState.writer.Write(GRSExport.ToString(mainExportContext, keyValue, new AttributeType(null, null, AttributeKind.IntegerAttr, null, null, null, null, null, null, typeof(int)), graph)); recordingState.writer.WriteLine(")"); } break; default: throw new Exception("Wrong attribute type for attribute change type"); } break; case AttributeChangeType.RemoveElement: recordingState.writer.Write("@(\"" + graph.GetElementName(element) + "\")." + attrType.Name); switch (attrType.Kind) { case AttributeKind.SetAttr: recordingState.writer.Write(".rem("); recordingState.writer.Write(GRSExport.ToString(mainExportContext, newValue, attrType.ValueType, graph)); recordingState.writer.WriteLine(")"); break; case AttributeKind.MapAttr: recordingState.writer.Write(".rem("); recordingState.writer.Write(GRSExport.ToString(mainExportContext, keyValue, attrType.KeyType, graph)); recordingState.writer.WriteLine(")"); break; case AttributeKind.ArrayAttr: recordingState.writer.Write(".rem("); if (keyValue != null) { recordingState.writer.Write(GRSExport.ToString(mainExportContext, keyValue, new AttributeType(null, null, AttributeKind.IntegerAttr, null, null, null, null, null, null, typeof(int)), graph)); } recordingState.writer.WriteLine(")"); break; case AttributeKind.DequeAttr: recordingState.writer.Write(".rem("); if (keyValue != null) { recordingState.writer.Write(GRSExport.ToString(mainExportContext, keyValue, new AttributeType(null, null, AttributeKind.IntegerAttr, null, null, null, null, null, null, typeof(int)), graph)); } recordingState.writer.WriteLine(")"); break; default: throw new Exception("Wrong attribute type for attribute change type"); } break; case AttributeChangeType.AssignElement: recordingState.writer.Write("@(\"" + graph.GetElementName(element) + "\")." + attrType.Name); switch (attrType.Kind) { case AttributeKind.ArrayAttr: recordingState.writer.Write("["); recordingState.writer.Write(GRSExport.ToString(mainExportContext, keyValue, new AttributeType(null, null, AttributeKind.IntegerAttr, null, null, null, null, null, null, typeof(int)), graph)); recordingState.writer.Write("] = "); recordingState.writer.WriteLine(GRSExport.ToString(mainExportContext, newValue, attrType.ValueType, graph)); break; case AttributeKind.DequeAttr: recordingState.writer.Write("["); recordingState.writer.Write(GRSExport.ToString(mainExportContext, keyValue, new AttributeType(null, null, AttributeKind.IntegerAttr, null, null, null, null, null, null, typeof(int)), graph)); recordingState.writer.Write("] = "); recordingState.writer.WriteLine(GRSExport.ToString(mainExportContext, newValue, attrType.ValueType, graph)); break; case AttributeKind.MapAttr: recordingState.writer.Write("["); recordingState.writer.Write(GRSExport.ToString(mainExportContext, keyValue, attrType.KeyType, graph)); recordingState.writer.Write("] = "); recordingState.writer.WriteLine(GRSExport.ToString(mainExportContext, newValue, attrType.ValueType, graph)); break; default: throw new Exception("Wrong attribute type for attribute change type"); } break; default: throw new Exception("Unknown attribute change type"); } } }
/// <summary> /// Event handler for IGraph.OnChangingNodeAttribute and IGraph.OnChangingEdgeAttribute and IGraph.OnChangingObjectAttribute. /// </summary> /// <param name="owner">The node or edge or object whose attribute is changed.</param> /// <param name="attrType">The type of the attribute to be changed.</param> /// <param name="changeType">The type of the change which will be made.</param> /// <param name="newValue">The new value of the attribute, if changeType==Assign. /// Or the value to be inserted/removed if changeType==PutElement/RemoveElement on set. /// Or the new map pair value to be inserted if changeType==PutElement on map. /// Or the new value to be inserted/added if changeType==PutElement on array. /// Or the new value to be assigned to the given position if changeType==AssignElement on array.</param> /// <param name="keyValue">The map pair key to be inserted/removed if changeType==PutElement/RemoveElement on map. /// The array index to be removed/written to if changeType==RemoveElement/AssignElement on array.</param> void ChangingAttribute(IAttributeBearer owner, AttributeType attrType, AttributeChangeType changeType, object newValue, object keyValue) { foreach (RecordingState recordingState in recordings.Values) { MainGraphExportContext mainExportContext = recordingState.mainExportContext; StringBuilder deferredInits = new StringBuilder(); AddSubgraphsAsNeeded(mainExportContext, owner, attrType, newValue, recordingState.writer); AddSubgraphsAsNeeded(mainExportContext, owner, attrType, keyValue, recordingState.writer); switch (changeType) { case AttributeChangeType.Assign: if (owner is IGraphElement) { recordingState.writer.Write("@(\"" + graph.GetElementName((IGraphElement)owner) + "\")." + attrType.Name + " = "); } else { EmitObjectAttributeAssignmentCreatingAsNeeded((IObject)owner, attrType, mainExportContext, recordingState); } StringBuilder sb = new StringBuilder(); GRSExport.EmitAttribute(mainExportContext, attrType, newValue, graph, recordingState.writer, sb); recordingState.writer.WriteLine(); recordingState.writer.Write(sb.ToString()); break; case AttributeChangeType.PutElement: if (owner is IGraphElement) { recordingState.writer.Write("@(\"" + graph.GetElementName((IGraphElement)owner) + "\")." + attrType.Name); } else { EmitObjectAttributeAssignmentCreatingAsNeeded((IObject)owner, attrType, mainExportContext, recordingState); } switch (attrType.Kind) { case AttributeKind.SetAttr: recordingState.writer.Write(".add("); GRSExport.EmitAttributeValue(mainExportContext, newValue, attrType.ValueType, graph, recordingState.writer, deferredInits); recordingState.writer.WriteLine(")"); break; case AttributeKind.MapAttr: recordingState.writer.Write(".add("); GRSExport.EmitAttributeValue(mainExportContext, keyValue, attrType.KeyType, graph, recordingState.writer, deferredInits); recordingState.writer.Write(", "); GRSExport.EmitAttributeValue(mainExportContext, newValue, attrType.ValueType, graph, recordingState.writer, deferredInits); recordingState.writer.WriteLine(")"); break; case AttributeKind.ArrayAttr: if (keyValue == null) { recordingState.writer.Write(".add("); GRSExport.EmitAttributeValue(mainExportContext, newValue, attrType.ValueType, graph, recordingState.writer, deferredInits); recordingState.writer.WriteLine(")"); } else { recordingState.writer.Write(".add("); GRSExport.EmitAttributeValue(mainExportContext, newValue, attrType.ValueType, graph, recordingState.writer, deferredInits); recordingState.writer.Write(", "); GRSExport.EmitAttributeValue(mainExportContext, keyValue, new AttributeType(null, null, AttributeKind.IntegerAttr, null, null, null, null, null, null, typeof(int)), graph, recordingState.writer, deferredInits); recordingState.writer.WriteLine(")"); } break; case AttributeKind.DequeAttr: if (keyValue == null) { recordingState.writer.Write(".add("); GRSExport.EmitAttributeValue(mainExportContext, newValue, attrType.ValueType, graph, recordingState.writer, deferredInits); recordingState.writer.WriteLine(")"); } else { recordingState.writer.Write(".add("); GRSExport.EmitAttributeValue(mainExportContext, newValue, attrType.ValueType, graph, recordingState.writer, deferredInits); recordingState.writer.Write(", "); GRSExport.EmitAttributeValue(mainExportContext, keyValue, new AttributeType(null, null, AttributeKind.IntegerAttr, null, null, null, null, null, null, typeof(int)), graph, recordingState.writer, deferredInits); recordingState.writer.WriteLine(")"); } break; default: throw new Exception("Wrong attribute type for attribute change type"); } break; case AttributeChangeType.RemoveElement: if (owner is IGraphElement) { recordingState.writer.Write("@(\"" + graph.GetElementName((IGraphElement)owner) + "\")." + attrType.Name); } else { EmitObjectAttributeAssignmentCreatingAsNeeded((IObject)owner, attrType, mainExportContext, recordingState); } switch (attrType.Kind) { case AttributeKind.SetAttr: recordingState.writer.Write(".rem("); GRSExport.EmitAttributeValue(mainExportContext, newValue, attrType.ValueType, graph, recordingState.writer, deferredInits); recordingState.writer.WriteLine(")"); break; case AttributeKind.MapAttr: recordingState.writer.Write(".rem("); GRSExport.EmitAttributeValue(mainExportContext, keyValue, attrType.KeyType, graph, recordingState.writer, deferredInits); recordingState.writer.WriteLine(")"); break; case AttributeKind.ArrayAttr: recordingState.writer.Write(".rem("); if (keyValue != null) { GRSExport.EmitAttributeValue(mainExportContext, keyValue, new AttributeType(null, null, AttributeKind.IntegerAttr, null, null, null, null, null, null, typeof(int)), graph, recordingState.writer, deferredInits); } recordingState.writer.WriteLine(")"); break; case AttributeKind.DequeAttr: recordingState.writer.Write(".rem("); if (keyValue != null) { GRSExport.EmitAttributeValue(mainExportContext, keyValue, new AttributeType(null, null, AttributeKind.IntegerAttr, null, null, null, null, null, null, typeof(int)), graph, recordingState.writer, deferredInits); } recordingState.writer.WriteLine(")"); break; default: throw new Exception("Wrong attribute type for attribute change type"); } break; case AttributeChangeType.AssignElement: if (owner is IGraphElement) { recordingState.writer.Write("@(\"" + graph.GetElementName((IGraphElement)owner) + "\")." + attrType.Name); } else { EmitObjectAttributeAssignmentCreatingAsNeeded((IObject)owner, attrType, mainExportContext, recordingState); } switch (attrType.Kind) { case AttributeKind.ArrayAttr: recordingState.writer.Write("["); GRSExport.EmitAttributeValue(mainExportContext, keyValue, new AttributeType(null, null, AttributeKind.IntegerAttr, null, null, null, null, null, null, typeof(int)), graph, recordingState.writer, deferredInits); recordingState.writer.Write("] = "); GRSExport.EmitAttributeValue(mainExportContext, newValue, attrType.ValueType, graph, recordingState.writer, deferredInits); recordingState.writer.WriteLine(); break; case AttributeKind.DequeAttr: recordingState.writer.Write("["); GRSExport.EmitAttributeValue(mainExportContext, keyValue, new AttributeType(null, null, AttributeKind.IntegerAttr, null, null, null, null, null, null, typeof(int)), graph, recordingState.writer, deferredInits); recordingState.writer.Write("] = "); GRSExport.EmitAttributeValue(mainExportContext, newValue, attrType.ValueType, graph, recordingState.writer, deferredInits); recordingState.writer.WriteLine(); break; case AttributeKind.MapAttr: recordingState.writer.Write("["); GRSExport.EmitAttributeValue(mainExportContext, keyValue, attrType.KeyType, graph, recordingState.writer, deferredInits); recordingState.writer.Write("] = "); GRSExport.EmitAttributeValue(mainExportContext, newValue, attrType.ValueType, graph, recordingState.writer, deferredInits); recordingState.writer.WriteLine(); break; default: throw new Exception("Wrong attribute type for attribute change type"); } break; default: throw new Exception("Unknown attribute change type"); } recordingState.writer.Write(deferredInits.ToString()); } }
/// <summary> /// Exports the given graph to a GRS file with the given filename. /// Any errors will be reported by exception. /// </summary> /// <param name="graph">The graph to export. Must be a named graph.</param> /// <param name="exportFilename">The filename for the exported file.</param> public static void Export(INamedGraph graph, String exportFilename) { using (GRSExport export = new GRSExport(exportFilename)) export.Export(graph); }
/// <summary> /// Exports the given graph to the file given by the stream writer in grs format. /// Any errors will be reported by exception. /// </summary> /// <param name="graph">The graph to export. Must be a named graph.</param> /// <param name="writer">The stream writer to export to.</param> public static void Export(INamedGraph graph, StreamWriter writer) { using (GRSExport export = new GRSExport(writer)) export.Export(graph); }
/// <summary> /// Exports the given graph to the file given by the stream writer in grs format. /// Any errors will be reported by exception. /// </summary> /// <param name="graph">The graph to export. Must be a named graph.</param> /// <param name="writer">The stream writer to export to.</param> /// <param name="nonewgraph">If true, the new graph command is not emitted.</param> /// <param name="typesToAttributesToSkip">Gives a dictionary with type names containing a dictionary with attribute names that are not to be emitted</param> public static void Export(INamedGraph graph, StreamWriter writer, bool noNewGraph, Dictionary <String, Dictionary <String, String> > typesToAttributesToSkip) { using (GRSExport export = new GRSExport(writer)) export.Export(graph, noNewGraph, typesToAttributesToSkip); }
/// <summary> /// Exports the given graph to a GRS file with the given filename. /// Any errors will be reported by exception. /// </summary> /// <param name="graph">The graph to export. Must be a named graph.</param> /// <param name="exportFilename">The filename for the exported file.</param> /// <param name="nonewgraph">If true, the new graph command is not emitted.</param> /// <param name="typesToAttributesToSkip">Gives a dictionary with type names containing a dictionary with attribute names that are not to be emitted</param> public static void Export(INamedGraph graph, String exportFilename, bool noNewGraph, Dictionary <String, Dictionary <String, String> > typesToAttributesToSkip) { using (GRSExport export = new GRSExport(exportFilename)) export.Export(graph, noNewGraph, typesToAttributesToSkip); }
/// <summary> /// Exports the given graph to a GRS file with the given filename. /// Any errors will be reported by exception. /// </summary> /// <param name="graph">The graph to export. Must be a named graph.</param> /// <param name="exportFilename">The filename for the exported file.</param> public static void Export(INamedGraph graph, String exportFilename) { using(GRSExport export = new GRSExport(exportFilename)) export.Export(graph); }
/// <summary> /// Exports the given graph to the file given by the stream writer in grs format. /// Any errors will be reported by exception. /// </summary> /// <param name="graph">The graph to export. Must be a named graph.</param> /// <param name="writer">The stream writer to export to.</param> public static void Export(INamedGraph graph, StreamWriter writer) { using(GRSExport export = new GRSExport(writer)) export.Export(graph); }
/// <summary> /// Exports the given named graph to a file with the given filename. /// The format is determined by the file extension. /// Currently available are: .grs/.grsi or .gxl or .xmi. /// Optionally suffixed by .gz; in this case they are saved gzipped. /// Any errors will be reported by exception. /// </summary> /// <param name="graph">The named graph to export. /// The .grs/.grsi exporter is exporting the names/including the names; import will return a named graph again. /// The .gxl exporter is exporting without the names, which is equivalent of calling the non-named graph export.</param> /// The .xmi exporter is using the names as xmi ids.</param> /// <param name="filenameParameters">The names of the files to be exported. /// The first must be a filename, the following may be used for giving export parameters /// (in fact currently no exporter supports multiple files).</param> public static void Export(INamedGraph graph, List <String> filenameParameters) { String first = ListGet(filenameParameters, 0); StreamWriter writer = null; if (first.EndsWith(".gz", StringComparison.InvariantCultureIgnoreCase)) { FileStream filewriter = new FileStream(first, FileMode.OpenOrCreate, FileAccess.Write); writer = new StreamWriter(new GZipStream(filewriter, CompressionMode.Compress), System.Text.Encoding.UTF8); first = first.Substring(0, first.Length - 3); } else { writer = new StreamWriter(first, false, System.Text.Encoding.UTF8); } using (writer) { if (first.EndsWith(".gxl", StringComparison.InvariantCultureIgnoreCase)) { GXLExport.Export(graph, writer); } else if (first.EndsWith(".grs", StringComparison.InvariantCultureIgnoreCase) || first.EndsWith(".grsi", StringComparison.InvariantCultureIgnoreCase)) { bool noNewGraph = false; Dictionary <String, Dictionary <String, String> > typesToAttributesToSkip = new Dictionary <string, Dictionary <string, string> >(); for (int i = 1; i < filenameParameters.Count; ++i) { if (filenameParameters[i].StartsWith("skip/") || filenameParameters[i].StartsWith("skip\\")) { String toSkip = filenameParameters[i].Substring(5); String type = toSkip.Substring(0, toSkip.IndexOf('.')); String attribute = toSkip.Substring(toSkip.IndexOf('.') + 1); Dictionary <String, String> attributesToSkip; if (!typesToAttributesToSkip.TryGetValue(type, out attributesToSkip)) { typesToAttributesToSkip[type] = new Dictionary <string, string>(); } typesToAttributesToSkip[type].Add(attribute, null); } else if (filenameParameters[i] == "nonewgraph") { noNewGraph = true; } else { throw new NotSupportedException("Export Parameter " + i + " not supported: " + filenameParameters[i]); } } GRSExport.Export(graph, writer, noNewGraph, typesToAttributesToSkip.Count > 0 ? typesToAttributesToSkip : null); } else if (first.EndsWith(".xmi", StringComparison.InvariantCultureIgnoreCase)) { XMIExport.Export(graph, writer); } else if (first.EndsWith(".grg", StringComparison.InvariantCultureIgnoreCase)) { GRGExport.Export(graph, writer); } else { throw new NotSupportedException("File format not supported"); } } }