コード例 #1
0
        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;
        }
コード例 #2
0
 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);
 }
コード例 #3
0
 public Builder AddDataSource(DataSource ds)
 {
     _ds.Add(ds);
     return this;
 }
コード例 #4
0
 public void AddDatasource(DataSource dataSource)
 {
     this.dataSources.Add(dataSource);
 }