using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Txgy.EWS.Client.PageModule.Models { public class ChannelModel { public string Name { get; set; } public double[] datas { get; set; } public void ReadDataFromTxt(string fn, int channelIndex) { datas = new double[30000]; string allline; using (StreamReader streamReader = new StreamReader(fn)) { allline = streamReader.ReadToEnd(); } string[] strs = allline.Split(new char[] { '\n' }); for (int i = 0; i < datas.Length; i++) { datas[i] = double.Parse(strs[channelIndex * 30001 + i + 1]); } } } }