}// TryGetNewEntries() // // // // **** Save Table() **** // // Product table format: breProductName, RcgProductName public void SaveTable(string newFilePath = "") { string filePath; if (string.IsNullOrEmpty(newFilePath)) { filePath = this.FilePath; } else { filePath = newFilePath; } // Lets alphabetize this table List <InstrumentName> sortingList = new List <InstrumentName>(m_KeyList); sortingList.Sort(new InstrumentNameComparer()); int searchFromIndex = 0; InstrumentName lastInstrName = new InstrumentName(); using (System.IO.StreamWriter stream = new System.IO.StreamWriter(filePath, false)) { foreach (InstrumentName instrName in sortingList) { if (!instrName.Equals(lastInstrName)) { searchFromIndex = 0; // instrName is different from last one, so start search from beginning index. } lastInstrName = instrName; // Remember this instrName. // Search for entry. int n1 = m_KeyList.IndexOf(instrName, searchFromIndex); // location of this instrName entry. searchFromIndex = n1 + 1; // Write the entries now. InstrumentName instr1 = m_KeyList[n1]; InstrumentName instr2 = m_ValueList[n1]; stream.WriteLine("{0,32},{1,32}", InstrumentName.Serialize(instr1).Trim(), InstrumentName.Serialize(instr2).Trim()); }// next instrName stream.Write("// END"); stream.Close(); m_SavedInstrumentCount = sortingList.Count; // update instrument count } }// SaveTable