public static ConversationNode DataNodeToConversationNode (DataNode node) { return new ConversationNode ( node[SPEAKER_TAG], node[TEXT_TAG], GetResponsesAsArray(node) ); }
/// <summary> /// Called to make a match /// </summary> /// <param name="node">The node on which to match this filter</param> /// <returns>True if the filter matched</returns> protected override bool OnMatch(DataNode node) { bool ret = false; // If this is a value object but not a byte array we can try and match without conversion if ((node is DataValue) && !(node is ByteArrayDataValue)) { string value = ((DataValue)node).Value.ToString(); ret = _re.IsMatch(value); } else { byte[] data = node.ToArray(); try { string str = _encoding.GetString(data); ret = _re.IsMatch(str); } catch (ArgumentException) { } } return ret; }
/// <summary> /// If we matched something then we must have succeeded /// </summary> /// <param name="nodes">An array of nodes to test</param> /// <returns>Always true</returns> protected override bool OnMatch(DataNode[] nodes) { bool ret = false; switch (_comparer) { case ComparisonOperator.Equal: ret = nodes.Length == _count; break; case ComparisonOperator.GreaterThan: ret = nodes.Length > _count; break; case ComparisonOperator.GreaterThanOrEqual: ret = nodes.Length >= _count; break; case ComparisonOperator.LessThan: ret = nodes.Length < _count; break; case ComparisonOperator.LessThanOrEqual: ret = nodes.Length <= _count; break; case ComparisonOperator.NotEqual: ret = nodes.Length != _count; break; } return ret; }
/// <summary> /// Overridden method to match on a set of data nodes /// </summary> /// <param name="nodes">The nodes to match against</param> /// <returns>True if the nodes match</returns> protected override bool OnMatch(DataNode[] nodes) { bool ret = false; foreach (DataNode node in nodes) { ret = OnMatch(node); if (MatchAllNodes) { // Exit on first mismatch if (!ret) { break; } } else { // Exit on first match if (ret) { break; } } } return ret; }
public Recipe(DataNode recipe) { Objective = recipe [0].Value; int i = 1; while (recipe [i] != null) { Ingredients.Add(recipe [i] [0].Value,int.Parse(recipe [i] [1].Value)); } }
public void SetNode(DataNode node, DataNode selected, System.Drawing.Color color, bool readOnly) { // Quick hack for now if (node is DataValue) { ChangeValue((DataValue)node, readOnly); } }
/// <summary> /// Set the ndoe /// </summary> /// <param name="node"></param> /// <param name="selected"></param> /// <param name="color"></param> /// <param name="readOnly"></param> public void SetNode(DataNode node, DataNode selected, Color color, bool readOnly) { _node = node; _color = color; _readOnly = readOnly; SetupFrame(); }
public static string ConvertPacketToTreeString(DataNode p) { using (TextWriter writer = new StringWriter()) { WriteNodeToTreeString(writer, "", p); return writer.ToString(); } }
public void SetNode(DataNode node, DataNode selected, Color color, bool readOnly) { _node = node as EnumDataValue; _readOnly = readOnly; if (_isLoaded) { SetupFrame(); } }
public void SetNode(DataNode node, DataNode selected, Color color, bool readOnly) { _node = node; _selected = selected; _color = color; _readOnly = readOnly; if (_isLoaded) { SetupNode(); } }
/// <summary> /// Called to make a match /// </summary> /// <param name="node">The node on which to match this filter</param> /// <returns>True if the filter matched</returns> protected override bool OnMatch(DataNode node) { bool ret = false; string dataSet = null; try { // If this is a value object but not a byte array we can try and match without conversion if (node is DataValue) { DataValue value = (DataValue)node; if (value.Value is byte[]) { dataSet = _encoding.GetString(value.Value); } else { dataSet = ((DataValue)node).Value.ToString(); } } else { dataSet = node.ToEncodedString(_encoding); } if (!_caseSensitive) { dataSet = dataSet.ToLower(); } switch (SearchMode) { case DataFrameFilterSearchMode.Contains: ret = dataSet.Contains(_match); break; case DataFrameFilterSearchMode.BeginsWith: ret = dataSet.StartsWith(_match); break; case DataFrameFilterSearchMode.EndsWith: ret = dataSet.EndsWith(_match); break; case DataFrameFilterSearchMode.Equals: ret = dataSet.Equals(_match); break; } } catch (ArgumentException) { // Should we be logging this? } return ret; }
public void InitializeItem(DataNode item) { ItemName = item[0].Value; ItemDescription = item[1].Value; if(item[2].Value.Equals("true")) { ItemType = MERGE; } else { ItemType = SINGLE; } int i = 3; while (item [i] != null) { Icons[i] = "Visual/"+item [i]; } }
public static string [] GetResponsesAsArray (DataNode node) { DataNode[] responseNodes = node.GetGrandChildrenByKey(RESPONSES_TAG); string [] responses = new string[responseNodes.Length]; for (int i = 0; i < responses.Length; i++) { responses[i] = responseNodes[i][0].Value; } return responses; }
public int ItemType; //merged or non-merged //enum for item type //[System.NonSerialized] // Texture2D's are non-serializable public Item(DataNode item) { ItemName = item[0].Value; ItemDescription = item[1].Value; if(item[2].Value.Equals("yes")) { ItemType = MERGE; } else { ItemType = SINGLE; } int i = 3; while (item [i] != null) { // read all sprite names Icons [i] = "Visual/"+item [i]; } }
public void SetNode(DataNode node, DataNode selected, Color color, bool readOnly) { if (node is DataKey) { _key = node as DataKey; _color = color; _readOnly = readOnly; UpdateList(); } else { throw new ArgumentException("Node needs to be a DataKey type"); } }
public static string [] GetChildNodeValues (DataNode node) { if (node.HasChildren) { string[] childrenValues = new string[node.ChildCount]; for (int i = 0; i < node.ChildCount; i++) { childrenValues[i] = node.Children[i].Value; } return childrenValues; } else { return null; } }
private IEnumerable<DataNode> FindNode(DataNode node) { lock (_lock) { if (_cancel) yield break; } if (node == null) yield break; bool searchExpanded = false; if (!node.IsExpanded) { node.Expand(); searchExpanded = true; } TagDataNode tagNode = node as TagDataNode; if (tagNode != null) { bool mName = _state.SearchName == null; bool mValue = _state.SearchValue == null; if (_state.SearchName != null) { string tagName = node.NodeName; if (tagName != null) mName = tagName.Contains(_state.SearchName); } if (_state.SearchValue != null) { string tagValue = node.NodeDisplay; if (tagValue != null) mValue = tagValue.Contains(_state.SearchValue); } if (mName && mValue) { InvokeDiscoverCallback(node); yield return node; } } foreach (DataNode sub in node.Nodes) { foreach (DataNode s in FindNode(sub)) yield return s; } if (searchExpanded) { if (!node.IsModified) { node.Collapse(); InvokeCollapseCallback(node); } } }
public bool test_GetValue_Obj(out string message) { message = ""; DataNode node = new DataNode(DataNode.NodeType.Leaf); DataNodeTest obj = new DataNodeTest(); node.NodeValue = obj; if (node.GetValue<DataNodeTest>() != obj) { message = "Wrong GetValue result (object)"; return false; } return true; }
public static DataNode ParseNode(DataNode dataNode, ScriptContainer container, string classname) { DataNode ret = null; if (dataNode != null) { string selectionPath = String.Format("/{0}", dataNode.PathName); DataFrame frame = new DataFrame(new DataKey("Root")); frame.Root.AddSubNode(dataNode.CloneNode()); DataFrame[] frames = ParseFrames(new DataFrame[1] { frame }, selectionPath, container, classname).ToArray(); if(frames.Length > 0) { // We only replace the node with the first DataNode for now ret = frames[0].SelectSingleNode(selectionPath); } } return ret; }
// Recursive Function public static void ReadNode (XmlNode xmlNode, ref DataNode dataWriteNode) { dataWriteNode.Value = xmlNode.Value == null ? getLeadingTag(xmlNode) : xmlNode.Value.Trim(); if (xmlNode.HasChildNodes) { foreach (XmlNode childXMLNode in xmlNode.ChildNodes) { DataNode newDataNode = new DataNode(""); dataWriteNode.AddChild (newDataNode); ReadNode( childXMLNode, ref newDataNode ); } } }
public void UpdateElements() { treeControl.Tree.BeginUpdate(); treeControl.Nodes.Clear(); foreach (String item in watches) { DataNode node = new DataNode(item); // todo, introduce new Node types. try { IASTBuilder builder = new ASTBuilder(false); ValueExp exp = builder.parse(new java.io.StringReader(item)); var ctx = new ExpressionContext(PluginMain.debugManager.FlashInterface.Session, PluginMain.debugManager.FlashInterface.Session.getFrames()[PluginMain.debugManager.CurrentFrame]); var obj = exp.evaluate(ctx); node = new DataNode((Variable)obj); } catch { } node.Text = item; treeControl.AddNode(node); } treeControl.Tree.EndUpdate(); treeControl.Enabled = true; }
/// <summary> /// Set the data to difference /// </summary> /// <param name="left">The left data</param> /// <param name="right">The right data</param> public void SetData(DataNode left, DataNode right) { _left = left.ToArray(); _right = right.ToArray(); BinaryEncoding enc = new BinaryEncoding(true); string leftStr = left.ToDataString(); string rightStr = right.ToDataString(); leftStr = leftStr.Replace('\0', ' '); rightStr = rightStr.Replace('\0', ' '); _leftlines = SplitLines(leftStr); _rightlines = SplitLines(rightStr); richTextBoxLeft.Lines = _leftlines; richTextBoxRight.Lines = _rightlines; hexEditorControlLeft.Bytes = _left; hexEditorControlRight.Bytes = _right; }
public bool TestNode (DataNode node) { bool mName = SearchName == null; bool mValue = SearchValue == null; if (SearchName != null) { string tagName = node.NodeName; if (tagName != null) mName = CultureInfo.InvariantCulture.CompareInfo.IndexOf(tagName, SearchName, CompareOptions.IgnoreCase) >= 0; } if (SearchValue != null) { string tagValue = node.NodeDisplay; if (tagValue != null) mValue = CultureInfo.InvariantCulture.CompareInfo.IndexOf(tagValue, SearchValue, CompareOptions.IgnoreCase) >= 0; } if (mName && mValue) { return true; } return false; }
public void UpdateElements() { treeControl.Tree.BeginUpdate(); treeControl.Nodes.Clear(); foreach (String item in watches) { DataNode node = new DataNode(item); // todo, introduce new Node types. try { ASTBuilder builder = new ASTBuilder(true); ValueExp exp = builder.parse(new System.IO.StringReader(item)); ExpressionContext context = new ExpressionContext(PluginMain.debugManager.FlashInterface.Session); context.Depth = PluginMain.debugManager.CurrentFrame; Object obj = exp.evaluate(context); node = new DataNode((Variable)obj); } catch { } node.Text = item; treeControl.AddNode(node); } treeControl.Tree.EndUpdate(); treeControl.Enabled = true; }
protected override IDataNode ReadPrimitiveExtensionDataValue(XmlReaderDelegator xmlReader, string dataContractName, string dataContractNamespace) { IDataNode dataNode; switch (extensionDataValueType) { case null: case JsonGlobals.stringString: dataNode = new DataNode<string>(xmlReader.ReadContentAsString()); break; case JsonGlobals.booleanString: dataNode = new DataNode<bool>(xmlReader.ReadContentAsBoolean()); break; case JsonGlobals.numberString: dataNode = ReadNumericalPrimitiveExtensionDataValue(xmlReader); break; default: throw DiagnosticUtility.ExceptionUtility.ThrowHelperError( XmlObjectSerializer.CreateSerializationException(SR.GetString(SR.JsonUnexpectedAttributeValue, extensionDataValueType))); } xmlReader.ReadEndElement(); return dataNode; }
/// <summary> /// Called to make a match /// </summary> /// <param name="node">The node on which to matche this filter</param> /// <returns>True if the filter matched</returns> protected override bool OnMatch(DataNode node) { bool match = false; byte[] data = node.ToArray(); if (SearchMode == DataFrameFilterSearchMode.BeginsWith) { if (_match.Length <= data.Length) { match = GeneralUtils.MatchArray(data, 0, _match); } } else if (SearchMode == DataFrameFilterSearchMode.EndsWith) { if (_match.Length <= data.Length) { match = GeneralUtils.MatchArray(data, data.Length - _match.Length, _match); } } else if(SearchMode == DataFrameFilterSearchMode.Contains) { for (int i = 0; i < (data.Length - _match.Length + 1) && !match; ++i) { match = GeneralUtils.MatchArray(data, i, _match); } } else if(SearchMode == DataFrameFilterSearchMode.Equals) { if (data.Length == _match.Length) { match = GeneralUtils.MatchArray(data, 0, _match); } } return match; }
private static DataNode ReadNode(string contents, ref int index, string name) { DataNode result = null; var state = State.Type; char c; var mode = InputMode.None; StringBuilder name_content = new StringBuilder(); StringBuilder value_content = new StringBuilder(); int rewind_index = index; bool is_escaped = false; do { bool isWhiteSpace; bool next = false; do { if (index >= contents.Length) { if (state == State.Next) { return(result); } throw new Exception($"JSON parsing exception, unexpected end of data"); } c = contents[index]; isWhiteSpace = Char.IsWhiteSpace(c); if (!isWhiteSpace) { rewind_index = index; } index++; next = (mode == InputMode.None) ? isWhiteSpace : false; } while (next); switch (state) { case State.Type: { switch (c) { case '{': { result = DataNode.CreateObject(name); state = State.Name; break; } case '[': { result = DataNode.CreateArray(name); state = State.Value; break; } default: { throw new Exception($"JSON parsing exception at {ParserUtils.GetOffsetError(contents, index)}, unexpected character"); } } break; } case State.Name: { if (c == '}' && result.Kind == NodeKind.Object) { return(result); } switch (c) { case '"': { if (mode == InputMode.None) { mode = InputMode.Text; name_content.Length = 0; } else { mode = InputMode.None; state = State.Colon; } break; } default: { if (mode == InputMode.Text) { name_content.Append(c); } else { throw new Exception($"JSON parsing exception at {ParserUtils.GetOffsetError(contents, index)}, unexpected character"); } break; } } break; } case State.Colon: { switch (c) { case ':': { state = State.Value; break; } default: { throw new Exception($"JSON parsing exception at {ParserUtils.GetOffsetError(contents, index)}, expected collon"); } } break; } case State.Value: { if (c == '\\' && !is_escaped) { is_escaped = true; } else if (is_escaped) { is_escaped = false; if (c == 'n') // Newline { value_content.Append('\n'); } else if (c == 'r') // Carriage return { value_content.Append('\r'); } else if (c == 't') // Tab { value_content.Append('\t'); } else if (c == 'b') // Backspace { value_content.Append('\b'); } else if (c == 'f') // Form feed { value_content.Append('\f'); } else { if (c == 'u') { var hex = ""; for (int i = 0; i < 4; i++) { if (index >= contents.Length) { throw new Exception($"JSON parsing exception, unexpected end of data"); } hex += contents[index]; index++; } ushort unicode_val; unicode_val = ushort.Parse(hex, System.Globalization.NumberStyles.HexNumber); c = (char)unicode_val; } value_content.Append(c); } } else if (c == 'n' && mode == InputMode.None) { ReadString("null", contents, ref index); result.AddField(name_content.Length == 0 ? null : name_content.ToString(), null); state = State.Next; } else if (c == 'f' && mode == InputMode.None) { ReadString("false", contents, ref index); result.AddField(name_content.Length == 0 ? null : name_content.ToString(), false); state = State.Next; } else if (c == 't' && mode == InputMode.None) { ReadString("true", contents, ref index); result.AddField(name_content.Length == 0 ? null : name_content.ToString(), true); state = State.Next; } else if (c == ']' && mode == InputMode.None && result.Kind == NodeKind.Array) { return(result); } else { switch (c) { case '"': { if (mode == InputMode.None) { mode = InputMode.Text; value_content.Length = 0; } else { object value; var str = value_content.ToString(); if (mode == InputMode.Number) { if (str.Contains("e")) { // TODO } value = str; } else { value = str; } mode = InputMode.None; result.AddField(name_content.Length == 0 ? null : name_content.ToString(), value); state = State.Next; } break; } case '[': case '{': { if (mode == InputMode.Text) { value_content.Append(c); } else { index = rewind_index; var node = ReadNode(contents, ref index, name_content.Length == 0 ? null : name_content.ToString()); result.AddNode(node); state = State.Next; } break; } default: { if (mode == InputMode.Text) { value_content.Append(c); } else if (char.IsNumber(c) || (c == '.' || c == 'e' || c == 'E' || c == '-' || c == '+')) { if (mode != InputMode.Number) { value_content.Length = 0; mode = InputMode.Number; } if (c == 'E') { c = 'e'; } value_content.Append(c); } else { if (mode == InputMode.Number) { mode = InputMode.None; var numStr = value_content.ToString(); if (numStr.Contains("e")) { var num = double.Parse(numStr, NumberStyles.Any, CultureInfo.InvariantCulture); result.AddField(name_content.Length == 0 ? null : name_content.ToString(), num); } else { var num = decimal.Parse(numStr, NumberStyles.Any, CultureInfo.InvariantCulture); result.AddField(name_content.Length == 0 ? null : name_content.ToString(), num); } state = State.Next; if (c == ',' || c == ']' || c == '}') { index = rewind_index; } } else { throw new Exception($"JSON parsing exception at {ParserUtils.GetOffsetError(contents, index)}, unexpected character"); } } break; } } } break; } case State.Next: { switch (c) { case ',': { state = result.Kind == NodeKind.Array ? State.Value : State.Name; break; } case '}': { if (result.Kind != NodeKind.Object) { throw new Exception($"JSON parsing exception at {ParserUtils.GetOffsetError(contents, index)}, unexpected }}"); } return(result); } case ']': { if (result.Kind != NodeKind.Array) { throw new Exception($"JSON parsing exception at {ParserUtils.GetOffsetError(contents, index)}, unexpected ]"); } return(result); } default: { throw new Exception($"JSON parsing exception at {ParserUtils.GetOffsetError(contents, index)}, expected collon"); } } break; } } } while (true); }
private static DataNode GetConstructorNode(ConstructorInfo constructorInfo, DataNode methodsNode, DataNode node) { var paramList = new List <string>(); foreach (var parameter in constructorInfo.GetParameters()) { paramList.Add(OccApiGenerator.PrettyName(node, parameter.ParameterType)); } return(IdentifyUniqueConstruct(string.Empty, paramList, Consts.Constructor, methodsNode)); }
// Update is called once per frame void Update() { if (Input.GetAxis("Mouse ScrollWheel") > 0f && scroll) { foreach (GameObject fi in files) { fi.transform.RotateAround(Vector2.zero, Vector3.right, 200 * Time.deltaTime); } } else if (Input.GetAxis("Mouse ScrollWheel") < 0f && scroll) { foreach (GameObject fi in files) { fi.transform.RotateAround(Vector2.zero, Vector3.right, -200 * Time.deltaTime); } } else if (Input.GetMouseButtonDown(0)) { // Create a raycast from the screen-space into World Space, store the data in hitInfo Object bool hit = Physics.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), out hitInfo); if (hit) { print(hitInfo.transform.name); // if there is a hit, we want to get the DataNode component to extract the information currentSelectedNode = hitInfo.transform.GetComponent <DataNode>(); if (!inside && files.Count() > minPerPage) { RotateToFile(hitInfo.transform.gameObject); } else if (hitInfo.transform.GetComponent <DataNode>() != null) { // if there is a hit, we want to get the DataNode component to extract the information if (currentSelectedNode.IsFolder || currentSelectedNode.IsDrive) { ExpandExplorer(currentSelectedNode.FullPath); inside = false; } else { RotateToFile(hitInfo.transform.gameObject); } } GetProperties(); properties.Panel.GetComponent <Animator>().SetTrigger("Highlighted"); } } #region HANDLE MOUSE INTERACTION // Create a raycase from the screen-space into World Space, store the data in hitInfo Object bool Hoverhit = Physics.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), out hitInfo); if (Hoverhit) { if (hitInfo.transform.GetComponentInChildren <TextMeshProUGUI>() != null) { // if there is a hit, we want to get the DataNode component to extract the information String name = hitInfo.transform.GetComponentInChildren <TextMeshProUGUI>().text; txtHoveredOverNode.GetComponent <TextMeshProUGUI>().text = $"{name}"; } } else { txtHoveredOverNode.GetComponent <TextMeshProUGUI>().text = $""; } #endregion }
private void InvokeDiscoverCallback(DataNode node) { _state.InvokeDiscoverCallback(node); }
public abstract void InvokeCollapseCallback(DataNode node);
public abstract void InvokeDiscoverCallback(DataNode node);
protected DataTreeNode(DataNode data) { this.data = data; this.Text = this.NodeTypeName; this.Image = GetIcon(this.data); }
public override bool Process(DataNode dataNode, ConsoleOptions options) { PrintSubTree(dataNode, options, "", true); return(true); }
public virtual void TestDFSAddressConfig() { Configuration conf = new HdfsConfiguration(); /*------------------------------------------------------------------------- * By default, the DataNode socket address should be localhost (127.0.0.1). *------------------------------------------------------------------------*/ MiniDFSCluster cluster = new MiniDFSCluster.Builder(conf).Build(); cluster.WaitActive(); AList <DataNode> dns = cluster.GetDataNodes(); DataNode dn = dns[0]; string selfSocketAddr = dn.GetXferAddress().ToString(); System.Console.Out.WriteLine("DN Self Socket Addr == " + selfSocketAddr); NUnit.Framework.Assert.IsTrue(selfSocketAddr.Contains("/127.0.0.1:")); /*------------------------------------------------------------------------- * Shut down the datanodes, reconfigure, and bring them back up. * Even if told to use the configuration properties for dfs.datanode, * MiniDFSCluster.startDataNodes() should use localhost as the default if * the dfs.datanode properties are not set. *------------------------------------------------------------------------*/ for (int i = 0; i < dns.Count; i++) { MiniDFSCluster.DataNodeProperties dnp = cluster.StopDataNode(i); NUnit.Framework.Assert.IsNotNull("Should have been able to stop simulated datanode" , dnp); } conf.Unset(DFSConfigKeys.DfsDatanodeAddressKey); conf.Unset(DFSConfigKeys.DfsDatanodeHttpAddressKey); conf.Unset(DFSConfigKeys.DfsDatanodeIpcAddressKey); cluster.StartDataNodes(conf, 1, true, HdfsServerConstants.StartupOption.Regular, null, null, null, false, true); dns = cluster.GetDataNodes(); dn = dns[0]; selfSocketAddr = dn.GetXferAddress().ToString(); System.Console.Out.WriteLine("DN Self Socket Addr == " + selfSocketAddr); // assert that default self socket address is 127.0.0.1 NUnit.Framework.Assert.IsTrue(selfSocketAddr.Contains("/127.0.0.1:")); /*------------------------------------------------------------------------- * Shut down the datanodes, reconfigure, and bring them back up. * This time, modify the dfs.datanode properties and make sure that they * are used to configure sockets by MiniDFSCluster.startDataNodes(). *------------------------------------------------------------------------*/ for (int i_1 = 0; i_1 < dns.Count; i_1++) { MiniDFSCluster.DataNodeProperties dnp = cluster.StopDataNode(i_1); NUnit.Framework.Assert.IsNotNull("Should have been able to stop simulated datanode" , dnp); } conf.Set(DFSConfigKeys.DfsDatanodeAddressKey, "0.0.0.0:0"); conf.Set(DFSConfigKeys.DfsDatanodeHttpAddressKey, "0.0.0.0:0"); conf.Set(DFSConfigKeys.DfsDatanodeIpcAddressKey, "0.0.0.0:0"); cluster.StartDataNodes(conf, 1, true, HdfsServerConstants.StartupOption.Regular, null, null, null, false, true); dns = cluster.GetDataNodes(); dn = dns[0]; selfSocketAddr = dn.GetXferAddress().ToString(); System.Console.Out.WriteLine("DN Self Socket Addr == " + selfSocketAddr); // assert that default self socket address is 0.0.0.0 NUnit.Framework.Assert.IsTrue(selfSocketAddr.Contains("/0.0.0.0:")); cluster.Shutdown(); }
public abstract void InvokeProgressCallback(DataNode node);
public string GetFullPath(DataNode node) { return _model.GetFullPath(node); }
//convert a DataNode to a DirectedGraphNode public DirectedGraphNode<string> TreeToGraphNode(DataNode node) { return new DirectedGraphNode<string> (node.Value); }
private DataNode[,] Calculate(DataNode[,] data) { int[,] toOP = new int[9, 9]; for (int i = 0; i < 9; i++) { for (int j = 0; j < 9; j++) { toOP[i, j] = data[i, j].NowNum; } } outPutplz(toOP); DataNode[,] tmp = new DataNode[9, 9]; //data.CopyTo(tmp, 0); //check for end bool atEnd = true; bool noAnswer = false; for (int i = 0; i < 9; i++) { for (int j = 0; j < 9; j++) { if (data[i, j].KanoNums != null) { atEnd = false; } if (data[i, j].KanoNums == null && data[i, j].NowNum == 0) { atEnd = true; noAnswer = true; } if (atEnd == false || noAnswer == true) { break; } } if (atEnd == false || noAnswer == true) { break; } } System.Diagnostics.Debug.WriteLine("Check for end done..."); if (atEnd == true && noAnswer == false) { //if (CheckEachUnit(data)) return(data); //else // return null; } else if (noAnswer == true) { return(null); } //select a number at the pattern for now int line = 0, column = 0; bool find = false; for (int i = 0; i < 9; i++) { for (int j = 0; j < 9; j++) { if (data[i, j].NowNum == 0) { line = i; column = j; find = true; break; } } if (find) { break; } } //System.Diagnostics.Debug.WriteLine("Select done..."); DataNode dn = data[line, column].KanoNums; while (dn != null) { //System.Diagnostics.Debug.WriteLine("in..."); DeepCopy(data, tmp); //System.Diagnostics.Debug.WriteLine("Deep Copy done..."); tmp[line, column].NowNum = dn.NowNum; DeleteLineAndColumnWithCertainNumber(tmp, line, column, dn.NowNum); CheckEachUnit(tmp, line, column, dn.NowNum); //System.Diagnostics.Debug.WriteLine("Await For Task..."); DataNode[,] answer = Calculate(tmp); System.Diagnostics.Debug.WriteLine("Task Done..."); if (answer != null) { return(answer); } dn = dn.KanoNums; } return(null); }
public static IEnumerator RPCRequest(string url, string method, int timeout, Action <EPHANTASMA_SDK_ERROR_TYPE, string> errorHandlingCallback, Action <DataNode> callback, params object[] parameters) { var paramData = DataNode.CreateArray("params"); if (parameters != null && parameters.Length > 0) { foreach (var obj in parameters) { paramData.AddField(null, obj); } } var jsonRpcData = DataNode.CreateObject(null); jsonRpcData.AddField("jsonrpc", "2.0"); jsonRpcData.AddField("method", method); jsonRpcData.AddField("id", "1"); jsonRpcData.AddNode(paramData); UnityWebRequest request; string json; try { json = JSONWriter.WriteToString(jsonRpcData); } catch (Exception e) { throw e; } Log.Write($"RPC request\nurl: {url}\njson: {json}", Log.Level.Networking); request = new UnityWebRequest(url, "POST"); byte[] bodyRaw = Encoding.UTF8.GetBytes(json); request.uploadHandler = (UploadHandler) new UploadHandlerRaw(bodyRaw); request.downloadHandler = (DownloadHandler) new DownloadHandlerBuffer(); request.SetRequestHeader("Content-Type", "application/json"); DateTime startTime = DateTime.Now; if (timeout > 0) { request.timeout = timeout; } yield return(request.SendWebRequest()); TimeSpan responseTime = DateTime.Now - startTime; if (request.isNetworkError || request.isHttpError) { Log.Write($"RPC error\nurl: {url}\nResponse time: {responseTime.Seconds}.{responseTime.Milliseconds} sec\n{request.error}\nisNetworkError: {request.isNetworkError}\nisHttpError: {request.isHttpError}\nresponseCode: {request.responseCode}", Log.Level.Networking); if (errorHandlingCallback != null) { errorHandlingCallback(EPHANTASMA_SDK_ERROR_TYPE.WEB_REQUEST_ERROR, request.error + $"\nURL: {url}\nIs network error: {request.isNetworkError}\nIs HTTP error: {request.isHttpError}\nResponse code: {request.responseCode}"); } } else { Log.Write($"RPC response\nurl: {url}\nResponse time: {responseTime.Seconds}.{responseTime.Milliseconds} sec\n{request.downloadHandler.text}", Log.Level.Networking); DataNode root = null; try { root = JSONReader.ReadFromString(request.downloadHandler.text); } catch (Exception e) { Log.Write("RPC response\nurl: {url}\nFailed to parse JSON: " + e.Message, Log.Level.Networking); if (errorHandlingCallback != null) { errorHandlingCallback(EPHANTASMA_SDK_ERROR_TYPE.FAILED_PARSING_JSON, "Failed to parse JSON: " + e.Message); } yield break; } if (root == null) { Log.Write("RPC response\nurl: {url}\nFailed to parse JSON", Log.Level.Networking); if (errorHandlingCallback != null) { errorHandlingCallback(EPHANTASMA_SDK_ERROR_TYPE.FAILED_PARSING_JSON, "failed to parse JSON"); } } else if (root.HasNode("error")) { var errorDesc = root["error"].GetString("message"); Log.Write($"RPC response\nurl: {url}\nError node found: {errorDesc}", Log.Level.Networking); if (errorHandlingCallback != null) { errorHandlingCallback(EPHANTASMA_SDK_ERROR_TYPE.API_ERROR, errorDesc); } } else if (root.HasNode("result")) { var result = root["result"]; if (result.HasNode("error")) { // This is incorrect way of RPC error reporting, // but it happens sometimes and should be handeled at least for now. var errorDesc = result.GetString("error"); Log.Write($"RPC response\nurl: {url}\nError node found (2): {errorDesc}", Log.Level.Networking); if (errorHandlingCallback != null) { errorHandlingCallback(EPHANTASMA_SDK_ERROR_TYPE.API_ERROR, errorDesc); } } else { callback(result); } } else { if (errorHandlingCallback != null) { errorHandlingCallback(EPHANTASMA_SDK_ERROR_TYPE.MALFORMED_RESPONSE, "malformed response"); } } } yield break; }
public static Image GetIcon(DataNode data) { return(data.GetType().GetEditorImage()); }
internal protected override object OnDeserialize(SerializationContext serCtx, object mapData, DataNode data) { string file = ((DataValue)data).Value; if (!string.IsNullOrEmpty(file)) { if (Path.DirectorySeparatorChar != serCtx.DirectorySeparatorChar) { file = file.Replace(serCtx.DirectorySeparatorChar, Path.DirectorySeparatorChar); } string basePath = Path.GetDirectoryName(serCtx.BaseFile); file = FileService.RelativeToAbsolutePath(basePath, file); } if (ValueType == typeof(string)) { return(file); } else { return((FilePath)file); } }
internal protected override object OnDeserialize(SerializationContext serCtx, object mapData, DataNode data) { string file = ((DataValue)data).Value; if (!string.IsNullOrEmpty(file)) { if (Path.DirectorySeparatorChar != serCtx.DirectorySeparatorChar) { file = file.Replace(serCtx.DirectorySeparatorChar, Path.DirectorySeparatorChar); } } if (ValueType == typeof(string)) { return(file); } else { return((FilePath)file); } }
private void ExpandExplorer(String filePath) { try { DirectoryInfo directoryInfo = new DirectoryInfo(filePath); IEnumerable <FileInfo> fileList = directoryInfo.EnumerateFiles(); IEnumerable <DirectoryInfo> folderList = directoryInfo.EnumerateDirectories("*"); int length = fileList.Count() + folderList.Count(); if (length > 0) { DirectoryDown(filePath); InstantiateInCircle(file, Vector3.zero, length); SetCamera(); try { int i = 0; foreach (FileInfo file in fileList) { try { var child = files[i]; child.name = file.Name; TextMeshProUGUI[] texts = child.transform.GetComponentsInChildren <TextMeshProUGUI>(); texts[0].text = file.Name; texts[1].text = file.Extension; DataNode dataNode = child.gameObject.AddComponent <DataNode>(); dataNode.Name = file.Name; dataNode.FullPath = file.FullName; dataNode.Size = file.Length; dataNode.fileAttributes = file.Attributes; dataNode.Extension = file.Extension; dataNode.CreationTime = file.CreationTime; dataNode.LastAccessTime = file.LastAccessTime; dataNode.LastWriteTime = file.LastWriteTime; colors.ColorObject(child); if (file.IsReadOnly) { dataNode.Access = "ReadOnly"; } i++; } catch (UnauthorizedAccessException unAuthTop) { Debug.LogWarning($"{unAuthTop.Message}"); currentSelectedNode.Access = "Access Denied"; } } foreach (DirectoryInfo directory in folderList) { try { var child = files[i]; files[i] = Instantiate(this.folder, child.transform.position, child.transform.rotation, explorer.transform); Destroy(child); child = files[i]; child.name = directory.Name; child.transform.GetComponentInChildren <TextMeshProUGUI>().text = directory.Name; colors.ColorChildObjects(child); DataNode dataNode = child.gameObject.AddComponent <DataNode>(); dataNode.Name = directory.Name; dataNode.FullPath = directory.FullName; dataNode.IsFolder = true; dataNode.CreationTime = directory.CreationTime; dataNode.LastAccessTime = directory.LastAccessTime; dataNode.LastWriteTime = directory.LastWriteTime; } catch (UnauthorizedAccessException unAuthDir) { Debug.LogWarning($"{unAuthDir.Message}"); currentSelectedNode.Access = "Access Denied"; } i++; } if (files.Count() == 1) { inside = true; scroll = false; RotateToFile(files[0]); } } catch (DirectoryNotFoundException dirNotFound) { Debug.LogWarning($"{dirNotFound.Message}"); currentSelectedNode.Access = "Directory Not Found"; } catch (UnauthorizedAccessException unAuthDir) { Debug.LogWarning($"unAuthDir: {unAuthDir.Message}"); currentSelectedNode.Access = "Access Denied"; } catch (PathTooLongException longPath) { Debug.LogWarning($"{longPath.Message}"); currentSelectedNode.Access = "ReadOnly"; } } } catch (DirectoryNotFoundException dirNotFound) { Debug.LogWarning($"{dirNotFound.Message}"); currentSelectedNode.Access = "Directory Not Found"; } catch (UnauthorizedAccessException unAuthDir) { Debug.LogWarning($"unAuthDir: {unAuthDir.Message}"); currentSelectedNode.Access = "Access Denied"; } catch (PathTooLongException longPath) { Debug.LogWarning($"{longPath.Message}"); currentSelectedNode.Access = "ReadOnly"; } }
public WebresourceNode AddSingleNode(Webresource resource, string[] nameParts, FolderNode folder = null) { var fileName = nameParts.Last(); WebresourceType type = WebresourceType.Auto; if (resource.Type != 0) { type = (WebresourceType)resource.Type; } if (type == WebresourceType.Auto) { if (fileName.IndexOf(".", StringComparison.Ordinal) < 0) { if (resource.Type == 0) { return(null); } type = (WebresourceType)resource.Type; } else { type = Webresource.GetTypeFromExtension(fileName .Split(new[] { '.' }, StringSplitOptions.RemoveEmptyEntries).Last()); } } WebresourceNode node = null; switch (type) { case WebresourceType.WebPage: node = new WebpageNode(resource); break; case WebresourceType.Css: node = new CssNode(resource); break; case WebresourceType.Data: node = new DataNode(resource); break; case WebresourceType.Gif: node = new GifNode(resource); break; case WebresourceType.Ico: node = new IcoNode(resource); break; case WebresourceType.Jpg: node = new JpgNode(resource); break; case WebresourceType.Png: node = new PngNode(resource); break; case WebresourceType.Resx: node = new ResxNode(resource); break; case WebresourceType.Script: node = new JavaScriptNode(resource); break; case WebresourceType.Silverlight: node = new SilverlightNode(resource); break; case WebresourceType.Vector: node = new VectorNode(resource); break; case WebresourceType.Xsl: node = new XslNode(resource); break; } resource.Node = node; if (folder != null && node != null) { folder.Nodes.Add(node); } return(node); }
public DataNodeDataReplacedEventArgs(DataNode node, object oldData) { Node = node; OldData = oldData; }
private void InvokeCollapseCallback(DataNode node) { _state.InvokeCollapseCallback(node); }
public void SearchCollapseCallback(DataNode node) { _controller.CollapseBelow(node); }
/// <exception cref="System.Exception"/> public virtual void Start() { System.Console.Error.WriteLine("Starting regular datanode initialization"); DataNode.SecureMain(args, resources); }
private static void Main(string[] args) { var log = new SynkServer.Core.Logger(); var settings = ServerSettings.Parse(args); var server = new HTTPServer(log, settings); var site = new Site(server, "public"); var keys = new Dictionary <string, KeyPair>(); var lines = File.ReadAllLines(rootPath + "keys.txt"); log.Info("Loadking keys..."); foreach (var line in lines) { var temp = line.Split(','); var mail = temp[0]; var key = temp[1]; keys[mail] = new KeyPair(key.HexToBytes()); } log.Info($"Loaded {keys.Count} keys!"); log.Info("Initializing mailboxes..."); var custom_mailboxes = new ConcurrentDictionary <string, Mailbox>(); var default_mailboxes = new ConcurrentDictionary <string, Mailbox>(); foreach (var entry in keys) { var mailbox = new Mailbox(entry.Value); default_mailboxes[entry.Key] = mailbox; if (string.IsNullOrEmpty(mailbox.name)) { log.Info("Registering mail: " + entry.Key); mailbox.RegisterName(entry.Key); } } if (File.Exists(rootPath + whitelistFileName)) { var xml = File.ReadAllText(rootPath + whitelistFileName); var root = XMLReader.ReadFromString(xml); try { root = root["users"]; foreach (var node in root.Children) { if (node.Name.Equals("whitelistuser")) { var user = node.ToObject <WhitelistUser>(); if (user != null) { whitelist.Add(user); whitelistEmailMap[user.email] = user; whitelistWalletMap[user.wallet] = user; } } } } catch { Console.WriteLine("Error loading whitelist!"); } } Console.WriteLine("Initializing server..."); var cache = new FileCache(log, rootPath); Console.CancelKeyPress += delegate { Console.WriteLine("Closing service."); server.Stop(); Environment.Exit(0); }; var templateEngine = new TemplateEngine("views"); site.Get("/", (request) => { return(HTTPResponse.FromString(File.ReadAllText(rootPath + "home.html"))); }); site.Get("/terms", (request) => { return(File.ReadAllBytes(rootPath + "terms.html")); }); site.Get("/demo", (request) => { var currentMailbox = request.session.Get <Mailbox>("current", default_mailboxes.Values.FirstOrDefault()); var context = new Dictionary <string, object>(); var mailboxList = default_mailboxes.Values.ToList(); var customMailbox = request.session.Get <Mailbox>("custom"); if (customMailbox != null) { mailboxList.Add(customMailbox); } context["mailboxes"] = mailboxList; context["currentMailbox"] = currentMailbox.name; context["currentAddress"] = currentMailbox.address; var mails = new List <MailEntry>(); lock (currentMailbox) { foreach (Mail entry in currentMailbox.messages) { var mail = new MailEntry() { from = entry.fromAddress.Split('@')[0], subject = entry.subject, body = entry.body, date = "12:10 AM" }; mails.Insert(0, mail); } } context["mails"] = mails.ToArray(); context["empty"] = mails.Count == 0; var flash = request.session.Get <string>("flash"); if (flash != null) { context["flash"] = flash; request.session.Remove("flash"); } return(templateEngine.Render(site, context, new string[] { "demo" })); }); site.Get("/demo/inbox/{id}", (request) => { var id = request.args["id"]; if (default_mailboxes.ContainsKey(id)) { var mailbox = default_mailboxes[id]; request.session.Set("current", mailbox); } else if (custom_mailboxes.ContainsKey(id)) { var mailbox = custom_mailboxes[id]; request.session.Set("current", mailbox); } return(HTTPResponse.Redirect("/demo")); }); site.Post("/demo/custom", (request) => { var emailStr = request.args["email"]; var privateStr = request.args["private"]; var privateKey = privateStr.HexToBytes(); if (privateKey.Length == 32) { var customKeys = new KeyPair(privateKey); var mailbox = new Mailbox(customKeys); if (string.IsNullOrEmpty(mailbox.name)) { mailbox.RegisterName(emailStr); } else if (mailbox.name != emailStr) { request.session.Set("flash", "Wrong mail for this address"); return(HTTPResponse.Redirect("/demo")); } request.session.Set("current", mailbox); request.session.Set("custom", mailbox); if (!custom_mailboxes.ContainsKey(emailStr)) { custom_mailboxes[emailStr] = mailbox; lock (mailbox) { mailbox.SyncMessages(); } } } return(HTTPResponse.Redirect("/demo")); }); site.Post("/demo/send", (request) => { var to = request.args["to"]; var subject = request.args["subject"]; var body = request.args["body"]; var script = NeoAPI.GenerateScript(Protocol.scriptHash, "getAddressFromMailbox", new object[] { to }); var invoke = NeoAPI.TestInvokeScript(Protocol.net, script); var temp = (byte[])invoke.result; if (temp != null && temp.Length > 0) { var currentMailbox = request.session.Get <Mailbox>("current"); if (currentMailbox == null || string.IsNullOrEmpty(currentMailbox.name)) { request.session.Set("flash", "Invalid mailbox selected"); } else { var msg = Mail.Create(currentMailbox, to, subject, body); try { if (currentMailbox.SendMessage(msg)) { request.session.Set("flash", "Your message was sent to " + to); } } catch (Exception e) { request.session.Set("flash", e.Message); } } } else { request.session.Set("flash", to + " is not a valid Phantasma mailbox address"); } return(HTTPResponse.Redirect("/demo")); }); site.Post("/signup", (request) => { var fullName = request.GetVariable("whitelist_name"); var email = request.GetVariable("whitelist_email"); var wallet = request.GetVariable("whitelist_wallet"); var country = request.GetVariable("whitelist_country"); var captcha = request.GetVariable("whitelist_captcha"); var signature = request.GetVariable("whitelist_signature"); string error = null; if (string.IsNullOrEmpty(fullName) || fullName.Length <= 5) { error = "Full name is invalid"; } else if (string.IsNullOrEmpty(email) || !email.Contains("@") || !email.Contains(".")) { error = "Email is invalid"; } else if (string.IsNullOrEmpty(wallet) || !wallet.ToLower().StartsWith("a") || !WalletHelper.IsValidWallet(wallet)) { error = "Wallet does not seems to be a valid NEO address"; } else if (string.IsNullOrEmpty(country)) { error = "Country is invalid"; } else if (string.IsNullOrEmpty(captcha) || !CaptchaUtils.VerifyCatcha(captcha, signature)) { error = "Captcha is invalid"; } else if (PhantasmaSite.whitelistEmailMap.ContainsKey(email)) { error = "Email already registered"; } else if (PhantasmaSite.whitelistWalletMap.ContainsKey(wallet)) { error = "Wallet already registered"; } var root = DataNode.CreateObject("signup"); root.AddField("result", error != null ? "fail" : "success"); if (error != null) { root.AddField("error", error); } else { var user = new WhitelistUser(); user.name = fullName; user.email = email; user.wallet = wallet; user.country = country; PhantasmaSite.AddToWhitelist(user); } var json = JSONWriter.WriteToString(root); return(Encoding.UTF8.GetBytes(json)); }); site.Get("captcha/", (request) => { var content = File.ReadAllText(rootPath + "captcha.html"); string sign; string pic; CaptchaUtils.GenerateCaptcha(rootPath + "captcha.fnt", out sign, out pic); content = content.Replace("$SIGNATURE", sign).Replace("$CAPTCHA", pic); return(Encoding.UTF8.GetBytes(content)); }); #region EMAIL SYNC THREAD log.Info("Running email thread"); var emailThread = new Thread(() => { Thread.CurrentThread.IsBackground = true; do { foreach (var mailbox in default_mailboxes.Values) { try { lock (mailbox) { mailbox.SyncMessages(); } } catch { continue; } } foreach (var mailbox in custom_mailboxes.Values) { try { lock (mailbox) { mailbox.SyncMessages(); } } catch { continue; } } var delay = (int)(TimeSpan.FromSeconds(5).TotalMilliseconds); Thread.Sleep(delay); } while (true); }); emailThread.Start(); #endregion server.Run(); }
public override bool CanProcess(DataNode dataNode) { return(true); }
private static DataNode GetMethodNode(MethodInfo methodInfo, DataNode methodsNode, DataNode node) { var paramList = new List <string>(); foreach (var parameter in methodInfo.GetParameters()) { paramList.Add(OccApiGenerator.PrettyName(node, parameter.ParameterType)); } var result = IdentifyUniqueConstruct(methodInfo.Name, paramList, Consts.Method, methodsNode); result.Name = methodInfo.Name; return(result); }
public DataNodeNameChangedEventArgs(DataNode node, string oldName) { Node = node; OldName = oldName; }
public DataNodeNodeEventArgs(DataNode parentNode, DataNode childNode) { ParentNode = parentNode; ChildNode = childNode; }
private DataNode[,] CopyData(DataNode[,] data) { DataNode[,] tmp = new DataNode[9, 9]; data.CopyTo(tmp, 0); return(tmp); }
public abstract void InvokeEndCallback(DataNode node);
public DataNode AddNode(DataNode node) { _model.Root.Nodes.Add(node); RestoreExpanded(); return node; }
void IReference.Clear() { m_Name = null; m_Parent = null; Clear(); }
void TreeExpanding(Object sender, TreeViewAdvEventArgs e) { if (e.Node.Index >= 0) { DataNode node = e.Node.Tag as DataNode; if (node.Nodes.Count == 0) { FlashInterface flashInterface = PluginMain.debugManager.FlashInterface; SortedList<DataNode, DataNode> nodes = new SortedList<DataNode, DataNode>(); SortedList<DataNode, DataNode> inherited = new SortedList<DataNode, DataNode>(); SortedList<DataNode, DataNode> statics = new SortedList<DataNode, DataNode>(); foreach (Variable member in node.Variable.getValue().getMembers(flashInterface.Session)) { DataNode memberNode = new DataNode(member); if (member.isAttributeSet(VariableAttribute.IS_STATIC)) { statics.Add(memberNode, memberNode); } else if (member.Level > 0) { inherited.Add(memberNode, memberNode); } else { nodes.Add(memberNode, memberNode); } } if (inherited.Count > 0) { DataNode inheritedNode = new DataNode("[inherited]"); foreach (DataNode item in inherited.Keys) { inheritedNode.Nodes.Add(item); } node.Nodes.Add(inheritedNode); } if (statics.Count > 0) { DataNode staticNode = new DataNode("[static]"); foreach (DataNode item in statics.Keys) { staticNode.Nodes.Add(item); } node.Nodes.Add(staticNode); } foreach (DataNode item in nodes.Keys) { node.Nodes.Add(item); } } } }
public static OrbitGenerator Create(ConfigNode configNode, OrbitGeneratorFactory factory) { OrbitGenerator obGenerator = new OrbitGenerator(); bool valid = true; int index = 0; foreach (ConfigNode child in ConfigNodeUtil.GetChildNodes(configNode)) { DataNode dataNode = new DataNode("ORBIT_" + index++, factory.dataNode, factory); try { ConfigNodeUtil.SetCurrentDataNode(dataNode); OrbitData obData = new OrbitData(child.name); // Get settings that differ by type if (child.name == "FIXED_ORBIT") { valid &= ConfigNodeUtil.ParseValue <Orbit>(child, "ORBIT", x => obData.orbit = x, factory); } else if (child.name == "RANDOM_ORBIT") { valid &= ConfigNodeUtil.ParseValue <OrbitType>(child, "type", x => obData.orbitType = x, factory); valid &= ConfigNodeUtil.ParseValue <int>(child, "count", x => obData.count = x, factory, 1, x => Validation.GE(x, 1)); valid &= ConfigNodeUtil.ParseValue <double>(child, "altitudeFactor", x => obData.altitudeFactor = x, factory, 0.8, x => Validation.Between(x, 0.0, 1.0)); valid &= ConfigNodeUtil.ParseValue <double>(child, "inclinationFactor", x => obData.inclinationFactor = x, factory, 0.8, x => Validation.Between(x, 0.0, 1.0)); valid &= ConfigNodeUtil.ParseValue <double>(child, "eccentricity", x => obData.eccentricity = x, factory, 0.0, x => Validation.GE(x, 0.0)); valid &= ConfigNodeUtil.ParseValue <double>(child, "deviationWindow", x => obData.deviationWindow = x, factory, 10.0, x => Validation.GE(x, 0.0)); } else { throw new ArgumentException("Unrecognized orbit node: '" + child.name + "'"); } // Use an expression to default - then it'll work for dynamic contracts if (!child.HasValue("targetBody")) { child.AddValue("targetBody", "@/targetBody"); } valid &= ConfigNodeUtil.ParseValue <CelestialBody>(child, "targetBody", x => obData.targetBody = x, factory); // Check for unexpected values valid &= ConfigNodeUtil.ValidateUnexpectedValues(child, factory); // Add to the list obGenerator.orbits.Add(obData); if (dataNode.IsInitialized("targetBody") && dataNode.IsInitialized("type")) { valid &= obGenerator.ValidateOrbitType(obData, factory); } } finally { ConfigNodeUtil.SetCurrentDataNode(factory.dataNode); } } return(valid ? obGenerator : null); }