public NetworkReceiver(byte[] bytes) { WaveSerializer = SerializerUtil.ToSerializer(bytes[0]); Port = BitConverter.ToInt32(bytes, 4); var strByte = bytes.Where((x, i) => i > 7 && x != '\0').ToArray(); ServerIp = StringUTil.ToString(strByte); }
public FileRecoder(byte[] bytes) { WaveSerializer = SerializerUtil.ToSerializer(bytes[0]); FilePath = StringUTil.ToString(bytes.Where((x, i) => i > 0).ToArray()); }
public NetworkRecoder(byte[] bytes) { WaveSerializer = SerializerUtil.ToSerializer(bytes[0]); Port = BitConverter.ToInt32(bytes, 1); }
public WaveMonitor() { InitializeComponent(); SQLRepository.Init(); if (Settings.Default.EnableDBMode) { foreach (var row in SQLRepository.MeasurementCache.Values) { switch ((MeasureType)row.MeasureType) { case MeasureType.MeasureType_RMS: MeasureList.Add(new RMSMeasure(row.Idx, row.ChannelId, row.LowFreq, row.HighFreq)); break; case MeasureType.MeasureType_P2P: MeasureList.Add(new PeakToPeakMeasure(row.Idx, row.ChannelId)); break; case MeasureType.MeasureType_PK: MeasureList.Add(new PeakMeasure(row.Idx, row.ChannelId)); break; case MeasureType.MeasureType_LiftShock: MeasureList.Add(new Lift_ShockMeasure(row.Idx, row.ChannelId, row.Interval1, row.Interval2, row.Interval3)); break; case MeasureType.MeasureType_LiftMove: MeasureList.Add(new Lift_MoveMeasure(row.Idx, row.ChannelId, row.Interval1, row.Interval2, row.Interval3)); break; } } foreach (var row in SQLRepository.ReceiverCache.Values) { switch ((ReceiverType)row.ReceiverType) { case ReceiverType.ReceiverType_Vdpm: ReceiverList.Add(new VDPMReceiver(row.Ip)); break; case ReceiverType.ReceiverType_File: ReceiverList.Add(new FileReceiver(row.FilePath, SerializerUtil.ToSerializer(row.SerializerType))); break; case ReceiverType.ReceiverType_Network: ReceiverList.Add(new NetworkReceiver(row.Ip, row.Port, SerializerUtil.ToSerializer(row.SerializerType))); break; case ReceiverType.ReceiverType_Simulate: ReceiverList.Add(new SimulateReceiver()); break; } } } if (File.Exists("Config.dat")) { using (FileStream fStream = new FileStream("Config.dat", FileMode.Open)) { while (fStream.Position != fStream.Length) { ConfigPacket packet = new ConfigPacket(); packet.Read(fStream); UnPacking(packet); } } } FFTChart.Axes.Bottom.Maximum = Settings.Default.AsyncFMax; TrendChart.Axes.Bottom.Labels.DateTimeFormat = "yyyy.M.d\nHH:mm:ss"; lb_Receiver.DataSource = ReceiverList; lb_Measure.DataSource = MeasureList; lb_Recoder.DataSource = RecoderList; AddButtons = new SimpleButton[] { btn_AddMeasure, btn_AddRceive, btn_AddRecode }; btn_AddMeasure.Tag = new MeasureEditForm(MeasureList.LastOrDefault()); btn_AddRceive.Tag = new ReceiverEditForm(); btn_AddRecode.Tag = new RecoderEditForm(); foreach (var btn in AddButtons) { btn.Click += AddBtn_Click; } DelButtons = new SimpleButton[] { btn_DelMeasure, btn_DelReceive, btn_DelRecode }; btn_DelReceive.Tag = lb_Receiver; btn_DelMeasure.Tag = lb_Measure; btn_DelRecode.Tag = lb_Recoder; foreach (var btn in DelButtons) { btn.Click += DelBtn_Click; } }
public FileReceiver(byte[] bytes) { WaveSerializer = SerializerUtil.ToSerializer(bytes[0]); //FilePath = StringUTil.ToString(bytes.Where((x, i) => i > 4 && x != '\0').ToArray()); FilePath = StringUTil.ToString(bytes.Where((x, i) => i > 0 && x != '\0').ToArray()); }