public void TestToStringForUnsigned() { GraphCommand command = new GraphCommand(GraphCommand.Name.UndoOperation); command.AppendArgument("Math.Sin"); command.AppendArgument(12.34); command.AppendArgument((uint)5678); Assert.AreEqual("UndoOperation|s:Math.Sin|d:12.34|u:0x0000162e", command.ToString()); }
public void TestToStringForEnum() { GraphCommand command = new GraphCommand(GraphCommand.Name.UndoOperation); command.AppendArgument(NodeType.Function); command.AppendArgument("Math.Sin"); command.AppendArgument(12.34); command.AppendArgument(56.78); Assert.AreEqual("UndoOperation|e:DesignScriptStudio.Graph.Core.NodeType,Function|s:Math.Sin|d:12.34|d:56.78", command.ToString()); }
public void TestToStringWithLineBreak() { GraphCommand command = new GraphCommand(GraphCommand.Name.EndNodeEdit); command.AppendArgument((uint)0x10000001); command.AppendArgument("a=3;\nb=4;"); command.AppendArgument(true); Assert.AreEqual("EndNodeEdit|u:0x10000001|s:a=3;\\nb=4;|b:True", command.ToString()); }
public void TestToStringWithArguments() { GraphCommand command = new GraphCommand(GraphCommand.Name.UndoOperation); command.AppendArgument(1234); command.AppendArgument(56.78); command.AppendArgument(true); command.AppendArgument("DesignScript Rocks!"); Assert.AreEqual("UndoOperation|i:1234|d:56.78|b:True|s:DesignScript Rocks!", command.ToString()); }
public void TestToStringNoArgument() { GraphCommand command = new GraphCommand(GraphCommand.Name.UndoOperation); Assert.AreEqual("UndoOperation", command.ToString()); }
private bool RerouteToHandler(GraphCommand command) { try { if (null != visualHost && (false != visualHost.IsInRecordingMode)) recordedCommands.Add(command.ToString()); bool callResult = false; currentCommand = command.CommandName; this.PreProcessCommand(command.CommandName); switch (command.CommandName) { case GraphCommand.Name.CreateCodeBlockNode: callResult = HandleCreateCodeBlockNode(command); break; case GraphCommand.Name.CreateDriverNode: callResult = HandleCreateDriverNode(command); break; case GraphCommand.Name.CreateFunctionNode: callResult = HandleCreateFunctionNode(command); break; case GraphCommand.Name.CreateIdentifierNode: callResult = HandleCreateIdentifierNode(command); break; case GraphCommand.Name.CreateRenderNode: callResult = HandleCreateRenderNode(command); break; case GraphCommand.Name.CreatePropertyNode: callResult = HandleCreatePropertyNode(command); break; case GraphCommand.Name.SaveGraph: callResult = HandleSaveGraph(command); break; case GraphCommand.Name.MouseDown: callResult = HandleMouseDown(command); break; case GraphCommand.Name.MouseUp: callResult = HandleMouseUp(command); break; case GraphCommand.Name.BeginDrag: callResult = HandleBeginDrag(command); break; case GraphCommand.Name.EndDrag: callResult = HandleEndDrag(command); break; case GraphCommand.Name.BeginNodeEdit: callResult = HandleBeginNodeEdit(command); break; case GraphCommand.Name.EndNodeEdit: callResult = HandleEndNodeEdit(command); break; case GraphCommand.Name.BeginHighFrequencyUpdate: callResult = HandleBeginHighFrequencyUpdate(command); break; case GraphCommand.Name.EndHighFrequencyUpdate: callResult = HandleEndHighFrequencyUpdate(command); break; case GraphCommand.Name.DeleteComponents: callResult = HandleDeleteComponents(command); break; case GraphCommand.Name.SelectComponent: callResult = HandleSelectComponent(command); break; case GraphCommand.Name.ClearSelection: callResult = HandleClearSelection(command); break; case GraphCommand.Name.UndoOperation: callResult = HandleUndoOperation(command); break; case GraphCommand.Name.RedoOperation: callResult = HandleRedoOperation(command); break; case GraphCommand.Name.EditReplicationGuide: callResult = HandleEditReplicationGuide(command); break; case GraphCommand.Name.SetReplicationGuide: callResult = HandleSetReplicationGuideText(command); break; case GraphCommand.Name.SelectMenuItem: callResult = HandleSelectedMenuItem(command); break; case GraphCommand.Name.CreateRadialMenu: callResult = HandleCreateRadialMenu(command); break; case GraphCommand.Name.CreateSubRadialMenu: callResult = HandleCreateSubRadialMenu(command); break; case GraphCommand.Name.ImportScript: callResult = HandleImportScript(command); break; case GraphCommand.Name.ConvertSelectionToCode: callResult = HandleConvertSelectionToCode(); break; case GraphCommand.Name.TogglePreview: callResult = HandleTogglePreview(command); break; } this.PostProcessCommand(this.currentCommand); currentCommand = GraphCommand.Name.None; return callResult; } catch (Exception exception) { if (null != visualHost && (false != visualHost.IsInRecordingMode)) { string filePath = this.DumpUiStatesToExternalFile(exception); if (System.IO.File.Exists(filePath)) System.Diagnostics.Process.Start(filePath); string xmlFilePath = this.DumpVmStatesToExternalFile(); if (System.IO.File.Exists(xmlFilePath)) System.Diagnostics.Process.Start(xmlFilePath); } throw exception; // Rethrow to external handler. } throw new InvalidOperationException("Unhandled command in 'RerouteToHandler'"); }