public static DataSet Parse(string line) { var ds = new DataSet(); if (string.IsNullOrEmpty(line)) { return null; } var match = lineRegex.Match(line); if (!match.Success) return null; ds.Type = match.Groups[1].Value; var dsLine = match.Groups[2].Value; foreach (var field in dsLine.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries)) { var dataSource = new DataSource(field); if (dataSource == null) continue; ds.AddDatasource(dataSource); } return ds; }
public void ParseWorks() { var source = new DataSource("cpu:GAUGE:0:U"); Assert.AreEqual("cpu", source.Name); Assert.AreEqual(1, source.Type); Assert.AreEqual(0, source.Min); Assert.AreEqual(double.NaN, source.Max); }
public Builder AddDataSource(DataSource ds) { _ds.Add(ds); return this; }
public void AddDatasource(DataSource dataSource) { this.dataSources.Add(dataSource); }