public void Init() { BaseParser<float> parser = new BaseParser<float>("type", "data"); // ParserResult<float> result = parser.Parse(System.IO.File.ReadAllLines("types.txt")); // dataGrid1.Columns.Add("number", "№"); dataGrid1.Columns.Add("h", "h"); dataGrid1.Columns.Add("b", "b"); dataGrid1.Columns.Add("d", "d"); dataGrid1.Columns.Add("t", "t"); dataGrid1.Columns.Add("S", "S"); dataGrid1.Columns.Add("m", "m"); // foreach(List<float> values in result.data[PipelinesManager.args["profileType"] as string]) { DataGridViewRow row = (DataGridViewRow)dataGrid1.Rows[0].Clone(); int iterator = 0; foreach (float value in values) { row.Cells[iterator].Value = value; iterator++; } dataGrid1.Rows.Add(row); } // }
/// <summary> /// Used to get and instance of the BaseParser that will parse the Xml response from the Fabric /// </summary> /// <param name="response">the HttpWebResponse that is returned</param> /// <param name="root">the root element neededs</param> /// <param name="baseParser">used to parse the response coming back</param> /// <returns>A dynamic type based on the expected return</returns> public static dynamic Parse(HttpWebResponse response, string root, BaseParser baseParser = null) { BaseParser parser = BaseParser.GetInstance(response, root, baseParser); parser.Parse(); return(parser.CommandResponse); }
void Parse() { BaseParser parser = CreateParser(); parser.VirtualPath = this.VirtualPath; parser.PhysicalPath = this.PhysicalPath; this.Parser = parser; try { using (TextReader reader = OpenReader()) { parser.Parse(reader); } } catch (TypeInitializationException ex) { ReportParseError(new ParserError(ex.InnerException.Message, this.VirtualPath, 1)); throw new HttpParseException(ex.InnerException.Message, ex.InnerException); } catch (HttpParseException ex) { ReportParseError(new ParserError(ex.Message, this.VirtualPath, ex.Line)); throw; } if (parser.GeneratedTypeFullName != null) { this.GeneratedTypeFullName = parser.GeneratedTypeFullName; } }
//テキストから予定を解析するメソッド public string Parse(string text) { //場所 var places = m_parserOfPlace.Parse(text); if (places.Count <= 0) { return(""); } // 先読みで量指定子が使えないのでTrimする char[] trimed = { ' ', ' ', '\n', '\r', ':', ':', ']', ']', '】' }; return(places[0].Trim(trimed)); }