Пример #1
0
        private void ReadLines(SymbolCollectionSegment aSegment)
        {
            long count = 0;

            // Make a new collection to which we'll add symbols
            SymbolCollection collection = aSegment.Collection;

            collection.TransactionBegin();

            // We'll use this to filter out bad symbols
            try
            {
                using (SymbolCollectionHarmoniser harmoniser = new SymbolCollectionHarmoniser(collection, SymbolCollectionHarmoniser.TCollectionType.EPossiblyXIP))
                {
                    // Then create symbols
                    SymbolCreator creator = new SymbolCreator();
                    foreach (string line in aSegment)
                    {
                        Symbol symbol = creator.Parse(line, collection);
                        if (symbol != null)
                        {
                            harmoniser.Add(symbol);
                        }
                        //
                        ++count;
                    }
                }
            }
            finally
            {
                collection.TransactionEnd();

                // Collection is now complete - run final validation in
                // background thread
                ValidateAndSaveCollection(collection);
            }

            ReportProgress(count);

#if INSPECT_SYMBOL_DATA
            using (StreamWriter writer = new StreamWriter(@"C:\Temp\NewSymbols\" + Path.GetFileName(collection.FileName.FileNameInHost) + ".symbol"))
            {
                WriteToStream(collection, writer);
            }
#endif
        }
Пример #2
0
        private void InitiateRead()
        {
            if (OperationStarted != null)
            {
                OperationStarted(this);
            }
            //
            int count = iSegment.Count;

            for (int i = count - 1; i >= 0; i--)
            {
                SymbolCollectionSegment segment = iSegment[i];
                //
                ReadLines(segment);
            }
            //
            if (OperationCompleted != null)
            {
                OperationCompleted(this);
            }
        }