public APIAction(APIPage InParent, string InName, Dictionary <string, object> ActionProperties) : base(InParent, InName) { object Value; if (ActionProperties.TryGetValue("Tooltip", out Value)) { Tooltip = String.Concat(((string)Value).Split('\n').Select(Line => Line.Trim() + '\n')); } else { Tooltip = ""; } if (ActionProperties.TryGetValue("CompactTitle", out Value)) { CompactName = (string)Value; } if (ActionProperties.TryGetValue("NodeType", out Value)) { NodeType = (string)Value; } else { NodeType = "function"; } if (ActionProperties.TryGetValue("Pins", out Value)) { Pins = new List <APIActionPin>(); foreach (var Pin in (Dictionary <string, object>)Value) { Pins.Add(new APIActionPin(this, APIActionPin.GetPinName((Dictionary <string, object>)Pin.Value), (Dictionary <string, object>)Pin.Value)); } } if (ActionProperties.TryGetValue("ShowAddPin", out Value)) { bShowAddPin = Convert.ToBoolean((string)Value); } }
public APIAction(APIPage InParent, string InName, Dictionary <string, object> ActionProperties) : base(InParent, InName) { object Value; TooltipNormalText = ""; TooltipLine.LineType CurrentLineType = TooltipLine.LineType.Count; //Invalid if (ActionProperties.TryGetValue("Tooltip", out Value)) { //Create an interleaved list of normal text and note regions. Also, store all normal text as a single block (i.e. notes stripped out) in a separate place. foreach (string Line in ((string)Value).Split('\n')) { string TrimmedLine = Line.Trim(); if (TrimmedLine.StartsWith("@note")) { if (TrimmedLine.Length > 6) { if (CurrentLineType != TooltipLine.LineType.Note) { CurrentLineType = TooltipLine.LineType.Note; TooltipData.Add(new TooltipLine(CurrentLineType)); } TooltipData[TooltipData.Count - 1].Text += (TrimmedLine.Substring(6) + '\n'); } } else { if (CurrentLineType != TooltipLine.LineType.Normal) { CurrentLineType = TooltipLine.LineType.Normal; TooltipData.Add(new TooltipLine(CurrentLineType)); } TooltipData[TooltipData.Count - 1].Text += (TrimmedLine + '\n'); TooltipNormalText += (TrimmedLine + '\n'); } } } if (ActionProperties.TryGetValue("CompactTitle", out Value)) { CompactName = (string)Value; } if (ActionProperties.TryGetValue("NodeType", out Value)) { NodeType = (string)Value; } else { NodeType = "function"; } if (ActionProperties.TryGetValue("Pins", out Value)) { Pins = new List <APIActionPin>(); foreach (var Pin in (Dictionary <string, object>)Value) { Pins.Add(new APIActionPin(this, APIActionPin.GetPinName((Dictionary <string, object>)Pin.Value), (Dictionary <string, object>)Pin.Value)); } } if (ActionProperties.TryGetValue("ShowAddPin", out Value)) { bShowAddPin = Convert.ToBoolean((string)Value); } }