public void Test() { long StopBytes = 0; var watch = Stopwatch.StartNew(); long StartBytes = System.GC.GetTotalMemory(true); while (true) // work to end of times { line = file.ReadLine(); if (line == null) { Run = false; break; } ramec = new Ramec(line); Value value = CarInterface.GrepDataString(line); var result = ParseFrame(ramec); if ((result != null) && (result.GetType() == typeof(CAN_0x02C1))) { if (winkersPrevious != winkers) { value.data = winkers; winkerChangeList.Add(value); winkersPrevious = winkers; } } } GC.KeepAlive(listOfFrame); watch.Stop(); var elapsedMs = watch.ElapsedMilliseconds; MessageBox.Show("Loaded " + winkerChangeList.Count + " items\n" + "Size is " + Math.Round(((long)(StopBytes - StartBytes)) / 1024.0, 2) + " kB\n" + "Loading time is " + elapsedMs / 1000 + " sec", "Loaded", MessageBoxButtons.OK, MessageBoxIcon.Information); }
public void Test() { long StopBytes = 0; var watch = Stopwatch.StartNew(); long StartBytes = System.GC.GetTotalMemory(true); while (true) // work to end of times { line = file.ReadLine(); if (line == null) { Run = false; break; } Value value = CarInterface.GrepDataString(line); var result = ParseLine(value); if ((result != null) && (result.GetType() == typeof(GGA)) && (((GGA)result).Poloha.Kvalita != kvalitaSignaluGPS.NeurcenaPozice)) { value.data = result; PositionList.Add(value); } } StopBytes = System.GC.GetTotalMemory(true); GC.KeepAlive(PositionList); watch.Stop(); var elapsedMs = watch.ElapsedMilliseconds; MessageBox.Show("Loaded " + PositionList.Count + " items\n" + "Size is " + Math.Round(((long)(StopBytes - StartBytes)) / 1024.0, 2) + " kB\n" + "Loading time is " + elapsedMs + " ms", "Loaded", MessageBoxButtons.OK, MessageBoxIcon.Information); }
public static void Main() { CarValue <int> c = new CarValue <int>(); // struct 성공 CarReference <string> cs = new CarReference <string>(); // class 성공 CarNew <GoodCar> cn = new CarNew <GoodCar>(); // new() 성공 CarClass <OfficeCamper> cc = new CarClass <OfficeCamper>(); // 사용자 정의 타입 CarInterface <IKs> h = new CarInterface <IKs>(); // 인터페이스 지정 }
public static void Main() { CarValue <int> c = new CarValue <int>(); // struct 성공 CarReference <string> cs = new CarReference <string>(); // class 성공 CarNew <Hyundai> cn = new CarNew <Hyundai>(); // new() 성공 CarClass <Sonata> cc = new CarClass <Sonata>(); // 사용자 정의 타입 CarInterface <IKs> h = new CarInterface <IKs>(); // 인터페이스 }
public static void Main() { CarValue <int> c = new CarValue <int>(); // struct 성공 //CarValue<string> c = new CarValue<string>(); CarReference <string> cs = new CarReference <string>(); // class 성공 //CarReference<decimal> cs = new CarReference<decimal>(); CarNew <GoodCar> cn = new CarNew <GoodCar>(); // new() 성공 //CarNew<BadCar> bad = new CarNew<BadCar>(); CarClass <OfficeCamper> cc = new CarClass <OfficeCamper>(); // 사용자 정의 타입 //CarClass<BadCar> badCar; CarInterface <IKs> h = new CarInterface <IKs>(); // 인터페이스 지정 //CarInterface<object> ie; }
DateTime Cas; // Time of arrive packet public Ramec(string Radek) // parse string from format "0x0000 01 02 03 04\r\n" { // 24.01.2016 8:48:02 0x0439 0B 31 00 00 00 00 // 24.01.2016 8:48:02:123 0x0439 0B 31 00 00 00 00 // 0x0439 0B 31 00 00 00 00 this.Cas = DateTime.Now; // Now arrived Radek = (string)(CarInterface.GrepDataString(Radek)).data; this.ID = Convert.ToUInt16(Radek.Substring(Radek.IndexOf("0x") + 2, 4), 16); // get ID, from hex Radek = Radek.Substring(7); byte i = 0; this.CTL = (byte)(Regex.Matches(Radek, " ").Count + 1); // get num of Data bytes if (this.CTL == 1) { this.CTL = (byte)(Regex.Matches(Radek, "\t").Count + 1); // get num of Data bytes } this.Data = new byte[this.CTL]; for (; i < this.CTL; i++) // parse data Bytes from hex { this.Data[i] = Convert.ToByte(Radek.Substring(i * 3, 2), 16); } }
// Start is called before the first frame update void Start() { ci = GetComponent <CarInterface>(); }
public _4x4(CarInterface ci) { this.ci = ci; }
public ElectricWindows(CarInterface ci) { this.ci = ci; }
public AirConditioning(CarInterface ci) { this.ci = ci; }
public Tempomat(CarInterface ci) { this.ci = ci; }
public Navigation(CarInterface ci) { this.ci = ci; }
public HeatedSeats(CarInterface ci) { this.ci = ci; }
void proc() { long counter = 0; switch (source) { case Source.File: { while (Run) // work to end of times { line = file.ReadLine(); if (line == null) { Run = false; break; } if (LogFile != null) { LogFile.WriteLine(line); } counter++; Value value = CarInterface.GrepDataString(line); line = (string)value.data; ParseLine(line); } MessageBox.Show("Data načtena. (celkem " + counter + " CAN bus rámců)", "", MessageBoxButtons.OK, MessageBoxIcon.Information); break; } case Source.SerialPort: { port.NewLine = "\r\n"; // define string of end of line (\r and \n) try { port.Open(); // try to open serial port } catch (Exception ex) // problem with opening serial port { throw new Exception("Problém s otevřením sériového portu. " + ex.Message); } while (Run) // work to end of times { //ramec = new Ramec(port.ReadLine()); if (LogFile != null) { LogFile.WriteLine(line); } //ParseFrame(ramec); } break; } default: break; } if (LogFile != null) { LogFile.Flush(); LogFile.Close(); } }