public SimpleController() { if (Environment.GetCommandLineArgs().Length <= 1) { throw new ArgumentException("No filename argument given!"); } var filename = Environment.GetCommandLineArgs()[1]; var dotContent = File.ReadAllText(filename); try { GraphParser.CheckSyntax(dotContent); } catch (Exception e) { throw new ArgumentException("Invalid graph syntax:" + Environment.NewLine + e.Message); } var graph = GraphParser.GetGraph(dotContent); var layoutGraph = GraphParser.GetGraphLayout(graph.ToDot()); Graph = new WpfGraph(layoutGraph); }
private void UpdateOriginalGraphFromDotContent() { try { var graph = GraphParser.GetGraph(OriginalDotContent); GraphParser.CheckSyntax(OriginalDotContent); OriginalGraph = graph; ParseFailureMessage = ""; } catch (Exception e) { ParseFailureMessage = e.Message; } if (OriginalGraph == null) { OriginalGraph = Graph.CreateGraph(); } if (string.IsNullOrEmpty(ParseFailureMessage)) { RestrictSelection(); RaiseContentChanged(); } }