void HandleDetectorsMessage(List <string> msg) { var message = new DetectorsMessage(); for (int i = 1; i < msg.Count; i++) { var rawDetection = msg[i].Split(','); message.Detectors.Add( new Detector { HostName = rawDetection[0], Channel = Convert.ToInt16(rawDetection[1]), Name = Regex.Match(rawDetection[2], @"\w+").Value, Location = new GenericLocation <float>(float.Parse(rawDetection[3], CultureInfo.InvariantCulture.NumberFormat), float.Parse(rawDetection[4], CultureInfo.InvariantCulture.NumberFormat)), FloorPlan = Convert.ToInt16(rawDetection[5]), Radius = float.Parse((rawDetection[6]), CultureInfo.InvariantCulture.NumberFormat), }); } DetectorsReceived(this, new SonitorEventArgs(message)); }
void HandleDetectorsMessage( List<string> msg ) { var message = new DetectorsMessage(); for ( int i = 1; i < msg.Count; i++ ) { var rawDetection = msg[ i ].Split( ',' ); message.Detectors.Add( new Detector { HostName = rawDetection[ 0 ], Channel = Convert.ToInt16( rawDetection[ 1 ] ), Name = Regex.Match(rawDetection[ 2 ], @"\w+").Value, Location = new GenericLocation<float>( float.Parse( rawDetection[ 3 ], CultureInfo.InvariantCulture.NumberFormat ), float.Parse( rawDetection[ 4 ], CultureInfo.InvariantCulture.NumberFormat ) ), FloorPlan = Convert.ToInt16( rawDetection[ 5 ] ), Radius = float.Parse( ( rawDetection[ 6 ] ), CultureInfo.InvariantCulture.NumberFormat ), } ); } DetectorsReceived( this, new SonitorEventArgs( message ) ); }