public bool DoEditReplicationGuide(uint compId, int replicationIndex) { GraphCommand command = new GraphCommand(GraphCommand.Name.EditReplicationGuide); command.AppendArgument(compId); command.AppendArgument(replicationIndex); return(RerouteToHandler(command)); }
public bool DoCreateDriverNode(double mouseX, double mouseY) { GraphCommand command = new GraphCommand(GraphCommand.Name.CreateDriverNode); command.AppendArgument(mouseX); command.AppendArgument(mouseY); return(RerouteToHandler(command)); }
public bool DoBeginHighFrequencyUpdate(uint nodeId, NodePart nodePart) { GraphCommand command = new GraphCommand(GraphCommand.Name.BeginHighFrequencyUpdate); command.AppendArgument(nodeId); command.AppendArgument(nodePart); return(RerouteToHandler(command)); }
public bool DoBeginNodeEdit(uint compId, NodePart nodePart) { GraphCommand command = new GraphCommand(GraphCommand.Name.BeginNodeEdit); command.AppendArgument(compId); command.AppendArgument(nodePart); return(RerouteToHandler(command)); }
public bool DoCreateRadialMenu(NodePart nodePart, uint nodeId) { GraphCommand command = new GraphCommand(GraphCommand.Name.CreateRadialMenu); command.AppendArgument(nodePart); command.AppendArgument(nodeId); return(RerouteToHandler(command)); }
public bool DoSelectComponent(uint compId, ModifierKeys modifiers) { GraphCommand command = new GraphCommand(GraphCommand.Name.SelectComponent); command.AppendArgument(compId); command.AppendArgument(modifiers); return(RerouteToHandler(command)); }
public bool DoSetReplicationGuideText(uint nodeId, int replicationIndex, string text) { GraphCommand command = new GraphCommand(GraphCommand.Name.SetReplicationGuide); command.AppendArgument(nodeId); command.AppendArgument(replicationIndex); command.AppendArgument(text); return(RerouteToHandler(command)); }
public bool DoEndNodeEdit(uint compId, string text, bool updateFlag) { GraphCommand command = new GraphCommand(GraphCommand.Name.EndNodeEdit); command.AppendArgument(compId); command.AppendArgument(text); command.AppendArgument(updateFlag); return(RerouteToHandler(command)); }
public bool DoCreateCodeBlockNode(double mouseX, double mouseY, string content) { GraphCommand command = new GraphCommand(GraphCommand.Name.CreateCodeBlockNode); command.AppendArgument(mouseX); command.AppendArgument(mouseY); command.AppendArgument(content); return(RerouteToHandler(command)); }
public bool DoSelectMenuItem(int menuItemId, double x, double y, uint nodeId, NodePart nodePart) { GraphCommand command = new GraphCommand(GraphCommand.Name.SelectMenuItem); command.AppendArgument(menuItemId); command.AppendArgument(x); command.AppendArgument(y); command.AppendArgument(nodeId); command.AppendArgument(nodePart); return(RerouteToHandler(command)); }
public bool DoCreatePropertyNode(double mouseX, double mouseY, string assembly, string qualifiedName, string argumentTypes) { GraphCommand command = new GraphCommand(GraphCommand.Name.CreatePropertyNode); command.AppendArgument(mouseX); command.AppendArgument(mouseY); command.AppendArgument(assembly); command.AppendArgument(qualifiedName); command.AppendArgument(argumentTypes); return(RerouteToHandler(command)); }
public bool DoMouseUp(MouseButton button, uint compId, NodePart nodePart, int index, ModifierKeys modifier) { GraphCommand command = new GraphCommand(GraphCommand.Name.MouseUp); command.AppendArgument(button); command.AppendArgument(compId); command.AppendArgument(nodePart); command.AppendArgument(index); command.AppendArgument(modifier); return(RerouteToHandler(command)); }
public bool DoTogglePreview(uint bubbleId) { GraphCommand command = new GraphCommand(GraphCommand.Name.TogglePreview); command.AppendArgument(bubbleId); return(RerouteToHandler(command)); }
public bool DoImportScript(string scriptPath) { GraphCommand command = new GraphCommand(GraphCommand.Name.ImportScript); command.AppendArgument(scriptPath); return(RerouteToHandler(command)); }
public bool DoCreateSubRadialMenu(int selectedItemId) { GraphCommand command = new GraphCommand(GraphCommand.Name.CreateSubRadialMenu); command.AppendArgument(selectedItemId); return(RerouteToHandler(command)); }
public bool DoSaveGraph(string filePath) { GraphCommand command = new GraphCommand(GraphCommand.Name.SaveGraph); command.AppendArgument(filePath); return(RerouteToHandler(command)); }
public bool DoRemoveReplicationGuide(uint nodeId) { GraphCommand command = new GraphCommand(GraphCommand.Name.RemoveReplicationGuide); command.AppendArgument(nodeId); return(RerouteToHandler(command)); }
public bool DoEndHighFrequencyUpdate(string text) { GraphCommand command = new GraphCommand(GraphCommand.Name.EndHighFrequencyUpdate); command.AppendArgument(text); return(RerouteToHandler(command)); }
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 bool DoEndDrag(MouseButton button, uint compId, NodePart nodePart, int index, ModifierKeys modifier, double mouseX, double mouseY) { GraphCommand command = new GraphCommand(GraphCommand.Name.EndDrag); command.AppendArgument(button); command.AppendArgument(compId); command.AppendArgument(nodePart); command.AppendArgument(index); command.AppendArgument(modifier); command.AppendArgument(mouseX); command.AppendArgument(mouseY); return(RerouteToHandler(command)); }
public bool DoCreateFunctionNode(double mouseX, double mouseY, string assembly, string qualifiedName, string argumentTypes) { if (null == assembly) { assembly = String.Empty; } if (null == argumentTypes) { argumentTypes = String.Empty; } if (string.IsNullOrEmpty(qualifiedName)) { throw new ArgumentNullException("qualifiedName"); } GraphCommand command = new GraphCommand(GraphCommand.Name.CreateFunctionNode); command.AppendArgument(mouseX); command.AppendArgument(mouseY); command.AppendArgument(assembly); command.AppendArgument(qualifiedName); command.AppendArgument(argumentTypes); return(RerouteToHandler(command)); }
internal static GraphCommand FromString(string content) { if (String.IsNullOrEmpty(content)) { throw new ArgumentException("Invalid argument", "content"); } content = content.Trim(); if (String.IsNullOrEmpty(content)) { throw new ArgumentException("Invalid argument", "content"); } char[] delimiter = new char[] { textDelimiter }; string[] inputs = content.Split(delimiter, StringSplitOptions.RemoveEmptyEntries); if (null == inputs || (inputs.Length <= 0)) { return(null); } Type enumType = typeof(GraphCommand.Name); object commandName = Enum.Parse(enumType, inputs[0]); GraphCommand command = new GraphCommand((Name)commandName); int inputIndex = 0; foreach (string input in inputs) { // Skip past the command name. if (inputIndex++ < 1) { continue; } if (String.IsNullOrEmpty(input)) { throw new ArgumentException("Invalid argument", "content"); } if ((input.Length < 2) || (input[1] != ':')) { throw new ArgumentException("Invalid argument", "content"); } int intValue = 0; bool boolValue = false; double doubleValue = 0.0; string value = input.Substring(2); // Skip past the "x:" portion. switch (input[0]) { case 'b': if (!Boolean.TryParse(value, out boolValue)) { throw new InvalidCastException("Invalid 'bool' value"); } command.AppendArgument(boolValue); break; case 'd': if (!Double.TryParse(value, out doubleValue)) { throw new InvalidCastException("Invalid 'double' value"); } command.AppendArgument(doubleValue); break; case 'e': int commaIndex = value.IndexOf(','); if (-1 == commaIndex) { throw new ArgumentException("Invalid argument", "content"); } string fullTypeName = value.Substring(0, commaIndex); string enumValue = value.Substring(commaIndex + 1); // Skip ','. System.Type type = GraphCommand.GetEnumType(fullTypeName); command.AppendArgument(Enum.Parse(type, enumValue)); break; case 'i': if (!Int32.TryParse(value, out intValue)) { throw new InvalidCastException("Invalid 'int' value"); } command.AppendArgument(intValue); break; case 's': string transformed = value.Replace("\\n", "\n"); command.AppendArgument(transformed); break; case 'u': if (value.StartsWith("0x") || value.StartsWith("0X")) { value = value.Substring(2); } uint unsignedValue = UInt32.Parse(value, NumberStyles.HexNumber); command.AppendArgument(unsignedValue); break; } } return(command); }
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 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()); }
internal static GraphCommand FromString(string content) { if (String.IsNullOrEmpty(content)) throw new ArgumentException("Invalid argument", "content"); content = content.Trim(); if (String.IsNullOrEmpty(content)) throw new ArgumentException("Invalid argument", "content"); char[] delimiter = new char[] { textDelimiter }; string[] inputs = content.Split(delimiter, StringSplitOptions.RemoveEmptyEntries); if (null == inputs || (inputs.Length <= 0)) return null; Type enumType = typeof(GraphCommand.Name); object commandName = Enum.Parse(enumType, inputs[0]); GraphCommand command = new GraphCommand((Name)commandName); int inputIndex = 0; foreach (string input in inputs) { // Skip past the command name. if (inputIndex++ < 1) continue; if (String.IsNullOrEmpty(input)) throw new ArgumentException("Invalid argument", "content"); if ((input.Length < 2) || (input[1] != ':')) throw new ArgumentException("Invalid argument", "content"); int intValue = 0; bool boolValue = false; double doubleValue = 0.0; string value = input.Substring(2); // Skip past the "x:" portion. switch (input[0]) { case 'b': if (!Boolean.TryParse(value, out boolValue)) throw new InvalidCastException("Invalid 'bool' value"); command.AppendArgument(boolValue); break; case 'd': if (!Double.TryParse(value, out doubleValue)) throw new InvalidCastException("Invalid 'double' value"); command.AppendArgument(doubleValue); break; case 'e': int commaIndex = value.IndexOf(','); if (-1 == commaIndex) throw new ArgumentException("Invalid argument", "content"); string fullTypeName = value.Substring(0, commaIndex); string enumValue = value.Substring(commaIndex + 1); // Skip ','. System.Type type = GraphCommand.GetEnumType(fullTypeName); command.AppendArgument(Enum.Parse(type, enumValue)); break; case 'i': if (!Int32.TryParse(value, out intValue)) throw new InvalidCastException("Invalid 'int' value"); command.AppendArgument(intValue); break; case 's': string transformed = value.Replace("\\n", "\n"); command.AppendArgument(transformed); break; case 'u': if (value.StartsWith("0x") || value.StartsWith("0X")) value = value.Substring(2); uint unsignedValue = UInt32.Parse(value, NumberStyles.HexNumber); command.AppendArgument(unsignedValue); break; } } return command; }
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()); }