private static TreeNode CreateNodeForSequence(Sequence sequence) { TreeNode node = new TreeNode("Sequence"); foreach (DataItem item in sequence.Enties) { node.Nodes.Add(CreateNode(item)); } return node; }
private Sequence ParseBlockSequence(out bool success) { int errorCount = Errors.Count; Sequence sequence = new Sequence(); while (true) { int seq_start_position1 = position; DataItem dataItem = ParseBlockSequenceEntry(out success); if (success) { sequence.Enties.Add(dataItem); } else { Error("Failed to parse BlockSequenceEntry of BlockSequence."); break; } while (true) { while (true) { int seq_start_position2 = position; ParseIndent(out success); if (!success) { Error("Failed to parse Indent of BlockSequence."); break; } dataItem = ParseBlockSequenceEntry(out success); if (success) { sequence.Enties.Add(dataItem); } else { Error("Failed to parse BlockSequenceEntry of BlockSequence."); position = seq_start_position2; } break; } if (!success) { break; } } success = true; break; } if (success) { ClearError(errorCount); } else { Error("Failed to parse Enties of BlockSequence."); } return sequence; }
private Sequence ParseFlowSequence(out bool success) { int errorCount = Errors.Count; Sequence sequence = new Sequence(); int start_position = position; MatchTerminal('[', out success); if (!success) { Error("Failed to parse '[' of FlowSequence."); position = start_position; return sequence; } ParseSeparationLinesInFlow(out success); success = true; while (true) { int seq_start_position1 = position; DataItem dataItem = ParseFlowSequenceEntry(out success); if (success) { sequence.Enties.Add(dataItem); } else { Error("Failed to parse FlowSequenceEntry of FlowSequence."); break; } while (true) { while (true) { int seq_start_position2 = position; MatchTerminal(',', out success); if (!success) { Error("Failed to parse ',' of FlowSequence."); break; } ParseSeparationLinesInFlow(out success); success = true; dataItem = ParseFlowSequenceEntry(out success); if (success) { sequence.Enties.Add(dataItem); } else { Error("Failed to parse FlowSequenceEntry of FlowSequence."); position = seq_start_position2; } break; } if (!success) { break; } } success = true; break; } if (!success) { Error("Failed to parse Enties of FlowSequence."); position = start_position; return sequence; } MatchTerminal(']', out success); if (!success) { Error("Failed to parse ']' of FlowSequence."); position = start_position; } if (success) { ClearError(errorCount); } return sequence; }
/// <summary> /// Gets the value from post. /// </summary> /// <param name="post">The post.</param> /// <param name="fldInfo">The FLD info.</param> /// <returns></returns> private string GetValueFromPost(PostInfo post, FieldInfo fldInfo, out Sequence vals) { string value=string.Empty; vals = null; // vals will be null initially, switch(fldInfo.FieldType.Name) { case "DateTime": DateTime d=DateTime.Parse(fldInfo.GetValue(post).ToString()); value= d.ToString(); break; case "String": value = fldInfo.GetValue(post) as string; break; // vals will be updated in this case case "String[]": string []values = fldInfo.GetValue(post) as string[]; if(values==null) { return string.Empty; } vals=new Sequence(); foreach(string val in values) { Scalar ss = new Scalar {Text = val}; vals.Enties.Add(ss); } break; } return value; }