static void Main(string[] args) { Console.WriteLine(string.Format("Программа генерации DpkLog-файла версии {0}.{1}", Version, Revision)); DpkDataBuf dpkLogFile = new DpkDataBuf(); List <object> dpkWords = new List <object>(); Random ramdomizer = new Random(); Console.WriteLine("Введите кол-во слов ДПК в файле и нажмите клавишу 'Enter':"); int countWords = 10000; if (!int.TryParse(Console.ReadLine(), out countWords)) { countWords = 10000; } TimeSpan time = TimeSpan.Zero; for (int i = 0; i < countWords; i++) { DpkWordItem word = new DpkWordItem(); word.IsGood = true; word.Flags = 0; word.ADR = 1; word.DATA = ramdomizer.Next(0, 0xFFFF); word.Time = time; time = time.Add(new TimeSpan(0, 0, 0, 0, ramdomizer.Next(10, 30))); dpkWords.Add(word); } dpkLogFile.PutData(dpkWords); Console.WriteLine("Введите имя DpkLog-файла и нажмите клавишу 'Enter':"); string fileName = Console.ReadLine(); dpkLogFile.SaveToFile(fileName + ".dpklog"); }
public static SourceGraphic Construct(DpkDataBuf dpkLogFile, int address, int maxValue) { SourceGraphic srcGraphic = new SourceGraphic(); srcGraphic.Name = string.Format("Адрес {0}", address); srcGraphic.MaxValue = maxValue; int countWords = dpkLogFile.Count; for (int i = 0; i < countWords; i++) { if (dpkLogFile[i].ADR == address) { srcGraphic.Points.Add(new SourcePoint(dpkLogFile[i].Time, dpkLogFile[i].DATA)); } } return(srcGraphic); }
public static SourceGraphic Construct(DpkDataBuf dpkLogFile, int address, int numBit) { SourceGraphic namedGraphic = new SourceGraphic(); namedGraphic.Name = string.Format("Адрес {0} {1}Бит {2} [{3}]", address, '\n', numBit, numBit + 9); namedGraphic.MaxValue = 1; if (numBit >= 26) { return(namedGraphic); } int countWords = dpkLogFile.Count; for (int i = 0; i < countWords; i++) { if (dpkLogFile[i].ADR == address) { namedGraphic.Points.Add(new SourcePoint(dpkLogFile[i].Time, ((dpkLogFile[i].DATA & (1 << numBit)) > 0) ? 1:0)); } } return(namedGraphic); }
public DpkViewerApp() { DpkLogFile = new DpkDataBuf(); ListAddressesInDpkLogFile = new List <int>(); ListFilteredAddresses = new List <int>(); }