private double GetFactors(int i)
        {
            double v = 0.0d;

            string item = IniFile.GetItemFrom(factors, i, maxItemCount);

            if (String.IsNullOrEmpty(item))
            {
                v = 0.0d;
            }

            else
            {
                try
                {
                    v = double.Parse(item);
                }
                catch (InvalidCastException)
                {
                    v = 0.0d;
                }
            }

            return(v);
        }
Exemple #2
0
            internal void Parse(string values, int colCount)
            {
                string s = "";

                Signal_AixsItem tItem;

                for (int i = 0; i < colCount; i++)
                {
                    s = IniFile.GetItemFrom(values, i, colCount);

                    try
                    {
                        tItem = new Signal_AixsItem();

                        tItem.v = Convert.ToSingle(s);

                        tItems.Add(tItem);
                    }
                    catch (System.InvalidCastException)
                    {
                    }
                }

                Processing();
            }
        internal void LoadSettings()
        {
            string s  = "";
            string s1 = "";
            string s2 = "";

            RL0_TableItem tItem_temp;

            System.IO.StreamReader textReader = new System.IO.StreamReader(fileName);

            tItems = new List <RL0_TableItem>();

            //加载补偿项
            while (!textReader.EndOfStream)
            {
                s = (textReader.ReadLine()).Trim();

                if (String.IsNullOrEmpty(s))
                {
                    continue;
                }

                s1 = IniFile.GetItemFrom(s, 0, 2);

                s2 = IniFile.GetItemFrom(s, 1, 2);

                try
                {
                    tItem_temp = new RL0_TableItem();

                    tItem_temp.F  = float.Parse(s1);
                    tItem_temp.RL = float.Parse(s2);
                    tItems.Add(tItem_temp);
                }
                catch (System.InvalidCastException)
                {
                }
            }

            textReader.Close();
            textReader.Dispose();

            //生成自动校准辅助列表
            cal_items = new Auto_CAL_Items(tItems);
        }
Exemple #4
0
        private void FillTable(int N, int M)
        {
            int   i, j;
            float v = 0.0f;

            string s  = "";
            string s2 = "";
            string r  = "tx_row_";

            //初始化2维表格
            table = new float[N][];
            for (i = 0; i < table.Length; i++)
            {
                table[i] = new float[M];

                s = IniFile.GetString(sectionName, (r + (i + 1).ToString()), "");

                for (j = 0; j < M; j++)
                {
                    s2 = IniFile.GetItemFrom(s, j, M);

                    try
                    {
                        if (s2 != "")
                        {
                            v = Convert.ToSingle(s2);
                        }
                    }
                    catch (InvalidCastException)
                    {
                        v = 0.0f;
                    }

                    table[i][j] = v;
                }
            }
        }
        internal void LoadSettings()
        {
            string s  = "";
            string s1 = "";
            string s2 = "";

            tItems = new List <Spectrum_TableItem>();

            tItem = new Spectrum_TableItem();

            System.IO.StreamReader textReader = new System.IO.StreamReader(fileName);

            Spectrum_TableItem tItem_temp;

            //加载补偿项
            while (!textReader.EndOfStream)
            {
                s = (textReader.ReadLine()).Trim();

                if (String.IsNullOrEmpty(s))
                {
                    continue;
                }

                s1 = IniFile.GetItemFrom(s, 0, 2);

                s2 = IniFile.GetItemFrom(s, 1, 2);

                try
                {
                    tItem_temp = new Spectrum_TableItem();

                    tItem_temp.f = Convert.ToSingle(s1);
                    tItem_temp.v = Convert.ToSingle(s2);
                    tItems.Add(tItem_temp);
                } catch (System.InvalidCastException)
                {
                }
            }

            textReader.Close();

            textReader.Dispose();

            Processing();

            if (tItems.Count > 0)
            {
                tItem.f1 = tItems[0].f1;
                tItem.v1 = tItems[0].v1;
                tItem.f  = tItems[0].f;
                tItem.v  = tItems[0].v;
                tItem.f2 = tItems[0].f2;
                tItem.v2 = tItems[0].v2;
            }
            else
            {
                tItem.f1 = float.MaxValue;
                tItem.v1 = float.MinValue;
                tItem.f  = float.MaxValue;
                tItem.v  = float.MinValue;
                tItem.f2 = float.MaxValue;
                tItem.v2 = float.MinValue;
            }
        }