Ejemplo n.º 1
0
    // =============================================================================
    // =============================================================================
    // METHODS ---------------------------------------------------------------------
    public MeasurementValues GetValues( string name )
    {
        MeasurementValues values = new MeasurementValues(0f, 0f, 0f, 0f);;

        if ( name.Equals("") || name.Length == 0 )
        {
            return values;
        }

        System.IO.StreamReader sr = new System.IO.StreamReader ( DataFile );
        try
        {

            bool found = false;
            string line = sr.ReadLine ();
            while ( line != null && !found )
            {
                line = line.Split ( "|"[0] )[0]; // without comments

                if ( line.Length <= 0 )
                {
                    line = sr.ReadLine ();
                    continue;
                }

                String[] parts = line.Split ( ";"[0] );
                for ( int i = 0; i< parts.Length; i++ )
                {
                    parts[i] = parts[i].Replace ( " ", "" );  // delete all spaces
                }

                if ( parts.Length < 5 )
                {
                    line = sr.ReadLine ();
                    continue;
                }

                if ( parts[0].Equals ( name ) )
                {
                    values = new MeasurementValues ( float.Parse ( parts[1] ), float.Parse ( parts[2] ), float.Parse ( parts[3] ), float.Parse ( parts[4] ) );
                    found = true;
                }

                line = sr.ReadLine ();
            }
        }
        catch ( Exception e )
        {
            //dan
            //            Config.Log ( e.ToString (), true );
        }
        finally
        {
            sr.Close ();
        }

        return values;
    }
Ejemplo n.º 2
0
    protected void DisplayValues( MeasurementValues values )
    {
        if ( values.isNull() )
        {
            DisplayValues ( "ERR" + System.Environment.NewLine + "", "" );
            return;
        }

        string textLeft = GetDotValue ( values.O2 ) + System.Environment.NewLine + GetDotValue ( values.HCN );
        string textRight = GetDotValue ( values.CO ) + System.Environment.NewLine + GetDotValue ( values.HCL );
        DisplayValues ( textLeft, textRight );
    }