Exemple #1
0
        }// SaveTable

        //
        //
        //
        //
        //
        //
        //
        #endregion//Public Methods


        #region no Private Methods
        // *****************************************************************
        // ****                     Private Methods                     ****
        // *****************************************************************
        //
        //
        //
        //
        // ****             Read Product Table()                ****
        //
        // Product table format:   breProductName, RcgProductName
        private void ReadTable()
        {
            using (System.IO.StreamReader reader = new System.IO.StreamReader(this.FilePath))
            {
                string aLine;
                bool   continueReading = true;
                while (continueReading)
                {
                    aLine = reader.ReadLine();
                    if (aLine == null)
                    {
                        break;
                    }
                    aLine = aLine.Trim();
                    if (string.IsNullOrWhiteSpace(aLine))
                    {
                        continue;                                                              // skip blank lines
                    }
                    if (aLine.StartsWith("// END", StringComparison.CurrentCultureIgnoreCase)) // this signals end of file at the moment.
                    {
                        continueReading = false;
                        continue;
                    }
                    else if (aLine.Contains("//"))
                    {
                        int n = aLine.IndexOf("//");
                        if (n == 0)
                        {
                            continue;
                        }
                        else if (n > 0)
                        {
                            aLine = aLine.Substring(0, n);
                        }
                    }

                    //
                    // Extract table entries
                    //
                    string[] elements = aLine.Split(',');
                    if (elements.Length >= 2)
                    {   // Need two elements
                        InstrumentName instr1;
                        InstrumentName instr2;
                        if (InstrumentName.TryDeserialize(elements[0].Trim(), out instr1) && InstrumentName.TryDeserialize(elements[1].Trim(), out instr2))
                        {
                            m_KeyList.Add(instr1);
                            m_ValueList.Add(instr2);
                        }
                    }
                }//wend
                reader.Close();
                m_SavedInstrumentCount = m_KeyList.Count;           // update the instrument Count.
            }
        }// ReadTable()