Beispiel #1
0
        public Importer(IBaseWindow baseWin, ILangMan langMan, System.Windows.Forms.ListBox.ObjectCollection aLog)
        {
            fBase    = baseWin;
            fTree    = baseWin.Context.Tree;
            fLog     = aLog;
            fLangMan = langMan;

            NumbersType         = PersonNumbersType.pnKonovalov;
            CanNumbersType      = PersonNumbersType.pnUndefined;
            PersonLineSeparator = (char)0;
            SurnamesNormalize   = false;

            fPersonsList = new Dictionary <string, GEDCOMIndividualRecord>();
            fRawContents = new StringList();
        }
Beispiel #2
0
        private bool AnalyseRaw()
        {
            if (SourceType == SourceType.stTable)
            {
                return(false);
            }

            try
            {
                IProgressController progress = AppHost.Progress;

                try
                {
                    int[] numberStats = new int[3];

                    int num = fRawContents.Count;
                    progress.ProgressInit(fLangMan.LS(ILS.LSID_Analysis), num);

                    for (int i = 0; i < num; i++)
                    {
                        string  txt     = fRawContents[i].Trim();
                        RawLine rawLine = (RawLine)fRawContents.GetObject(i);

                        if (!string.IsNullOrEmpty(txt))
                        {
                            if (IsGenerationLine(txt))
                            {
                                rawLine.Type = RawLineType.rltRomeGeneration;
                            }
                            else
                            {
                                PersonNumbersType numbType = PersonNumbersType.pnUndefined;

                                if (!string.IsNullOrEmpty(ImportUtils.IsPersonLine_DAboville(txt)))
                                {
                                    rawLine.Type = RawLineType.rltPerson;
                                    numbType     = PersonNumbersType.pnDAboville;
                                    numberStats[1]++;
                                }
                                else if (!string.IsNullOrEmpty(ImportUtils.IsPersonLine_Konovalov(txt)))
                                {
                                    rawLine.Type = RawLineType.rltPerson;
                                    numbType     = PersonNumbersType.pnKonovalov;
                                    numberStats[2]++;
                                }

                                rawLine.NumbersType = numbType;
                            }
                        }
                        else
                        {
                            rawLine.Type = RawLineType.rltEOF;
                        }

                        progress.ProgressStep(i + 1);
                    }

                    if (numberStats[1] > numberStats[2])
                    {
                        CanNumbersType = PersonNumbersType.pnDAboville;
                    }
                    else
                    {
                        CanNumbersType = PersonNumbersType.pnKonovalov;
                    }

                    return(true);
                }
                finally
                {
                    progress.ProgressDone();
                }
            }
            catch (Exception ex)
            {
                Logger.LogWrite("Importer.AnalyseRaw(): " + ex.Message);
                return(false);
            }
        }