Ejemplo n.º 1
0
        //private ArrayList SplitGiorniODT(string s)
        //{
        //    string[] Lines = s.Split(new string[] { "\n", "\r\n" }, StringSplitOptions.None);
        //    string tempGiorno = "";
        //    string l;
        //    ArrayList SplitG = new ArrayList();

        //    foreach (string CurLine in Lines)
        //    {
        //        l = CurLine.Trim();
        //        if (èInizioGiornoSettimana(l) || èInizioDomenica(l))
        //        {
        //            if (tempGiorno.Length > 0)
        //            {
        //                SplitG.Add(tempGiorno);

        //            }
        //            NumGiorni++;
        //            tempGiorno = l + Environment.NewLine;
        //        }
        //        else tempGiorno += l + Environment.NewLine;
        //    }
        //    SplitG.Add(tempGiorno);
        //    NumGiorni++;
        //    return SplitG;
        //}

        private string PutTagOnDay(Story s)
        {
            //MessageBox.Show("linee:" + Convert.ToString(Lines.GetLength(0)));
            try
            {
                string l;

                foreach (StoryLine CurLine in s.Lines)
                {
                    lineNum++;
                    l = CurLine.getText().Trim();
                    switch (sec)
                    {
                    //sezione GIORNO
                    case (int)Section.giorno:
                    {
                        switch (prog)
                        {
                        //inizio
                        case 0:
                        {
                            //riga vuota salto
                            if (l.Length == 0)
                            {
                                break;
                            }

                            //GIORNO da lun a sab
                            if (èInizioGiornoSettimana(l))
                            {
                                addInizioGiornoSettimana(new Story(CurLine));
                            }
                            //GIORNO domenica
                            else if (èInizioDomenica(l))
                            {
                                addInizioDomenica(new Story(CurLine));
                            }
                            else
                            {
                                addProblem("manca giorno");
                            }
                            sTemp = new Story();
                            break;
                        }

                        //GIORNO
                        case 1:
                        {
                            //riga vuota salto
                            if (l.Length == 0)
                            {
                                break;
                            }
                            //aggiungo santi --> tutti sulla stessa riga
                            addOutPQ("#02", new Story(CurLine));
                            prog  = 2;
                            sTemp = new Story();
                            break;
                        }

                        //NOME SANTI
                        case 2:
                        {
                            //riga vuota salto
                            if (l.Length == 0)
                            {
                                break;
                            }
                            if (èInizioLettura(l))
                            {
                                addInizioLetturaOVangelo(new Story(CurLine), Section.primaLettura); break;
                            }
                            //controllo se la stringa è lunga --> allora è la storia dei santi
                            if (l.Length > 90 && (!ODTorIDML || CheckFontSize(new Story(CurLine), "#03")))
                            {
                                //l = AggiungiTagNomeSanti(l, dicPQTag[giornoCorrente]["#02"]);
                                addOutPQ("#03", new Story(CurLine));
                                prog = 3;
                            }
                            else
                            {
                                if (èGiornataMondiale(new Story(CurLine)))
                                {
                                    addGiornataMondiale(new Story(CurLine));
                                }
                                else
                                {
                                    //suppongo sia festività
                                    addOutPQ("#04", new Story(CurLine));
                                    prog = 4;
                                }
                            }

                            break;
                        }

                        //VITA SANTI
                        case 3:
                        {
                            //riga vuota salto
                            if (l.Length == 0)
                            {
                                break;
                            }
                            if (èInizioLettura(l))
                            {
                                addInizioLetturaOVangelo(new Story(CurLine), Section.primaLettura); break;
                            }

                            if (èGiornataMondiale(new Story(CurLine)))
                            {
                                addGiornataMondiale(new Story(CurLine));
                            }
                            else
                            {
                                //suppongo sia festività
                                addOutPQ("#04", new Story(CurLine));
                                prog = 4;
                            }
                            break;
                        }

                        // FESTA RELIGIOSA IMPORTANTE
                        case 4:
                        {
                            //riga vuota salto
                            if (l.Length == 0)
                            {
                                break;
                            }
                            if (èInizioLettura(l))
                            {
                                addInizioLetturaOVangelo(new Story(CurLine), Section.primaLettura); break;
                            }

                            if (èGiornataMondiale(new Story(CurLine)))
                            {
                                addGiornataMondiale(new Story(CurLine));
                            }
                            else
                            {
                                addProblem("parte non riconosciuta");
                            }
                            break;
                        }

                        // GIORNATA MONDIALE
                        case 5:
                        {
                            //riga vuota salto
                            if (l.Length == 0)
                            {
                                break;
                            }
                            if (èInizioLettura(l))
                            {
                                addInizioLetturaOVangelo(new Story(CurLine), Section.primaLettura); break;
                            }

                            //suppongo sia testo altra festa
                            addOutPQ("#06", new Story(CurLine));
                            //vado comunque avanti
                            prog = 6;
                            break;
                        }

                        // TESTO ALTRA FESTA
                        case 6:
                        {
                            //riga vuota salto
                            if (l.Length == 0)
                            {
                                break;
                            }
                            if (èInizioLettura(l))
                            {
                                addInizioLetturaOVangelo(new Story(CurLine), Section.primaLettura); break;
                            }

                            //se arrivo qui è un problema ... non ho trovato la prma lettura
                            addProblem("manca prima lettura");
                            sec  = Section.primaLettura;
                            prog = 1;
                            break;
                        }

                        default:
                        {
                            addProblem("default .. non gestito!");
                            break;
                        }
                        }
                        break;
                    }

                    //PRIMA O seconda LETTURA o vangelo
                    case Section.vangelo:
                    case Section.primaLettura:
                    case Section.secondalettura:
                    case Section.vangeloOppure:
                    case Section.primaLetturaOppure:
                    case Section.secondaLetturaOppure:
                    {
                        switch (prog)
                        {
                        case -1:
                        {
                            // quando so che deve iniziare una lettura o vangelo ma non ho ancora trovato niente
                            if (l.Length == 0 && sTemp.Length == 0)
                            {
                                break;
                            }
                            if (èInizioLettura(l) || èInizioVangelo(l))
                            {
                                addInizioLetturaOVangelo(new Story(CurLine), sec);
                                break;
                            }
                            else if (èAntifonaVangelo(l))
                            {
                                addInizioLetturaOVangelo(new Story(CurLine), sec);
                                break;
                            }
                            else
                            {
                                sTemp.Addstory(new Story(CurLine));
                                addProblem("manca titolo e rif lettura");
                            }
                            break;
                        }

                        //riferimenti
                        case 0:
                        {
                            //riga vuota salto
                            if (l.Length == 0)
                            {
                                break;
                            }
                            // NO--> COSì DA ERRORE MANCANZA RIFERIMENTO
                            AppendInizioLetturaOVangelo(new Story(CurLine), sec);
                            //AddRiferimento(new Story(CurLine), sec);
                            break;
                        }

                        //titolo e riferimenti
                        case 1:
                        {
                            //riga vuota salto
                            if (l.Length == 0)
                            {
                                break;
                            }
                            AddTestoLettura(new Story(CurLine));
                            break;
                        }

                        case 3:
                        {
                            //riga vuota salto
                            if (l.Length == 0)
                            {
                                break;
                            }
                            AddCommentoLettura(new Story(CurLine));
                            break;
                        }

                        default:
                        {
                            addProblem("default .. non gestito!");
                            break;
                        }
                        }
                        break;
                    }

                    //SALMO
                    case Section.salmo:
                    {
                        switch (prog)
                        {
                        //titolo e riferimenti
                        case 0:
                        {
                            //riga vuota salto
                            if (l.Length == 0 && sTemp.Length == 0)
                            {
                                break;
                            }
                            if (l.Length == 0)
                            {
                                Add1AntifonaSalmo(sTemp);
                                sTemp = new Story();
                                break;
                            }
                            if (èoppure(l))
                            {
                                Add1OppureSalmo(new Story(CurLine));
                            }
                            else
                            {
                                sTemp.Addstory(new Story(CurLine));
                            }
                            break;
                        }

                        case 1:
                        {
                            if (l.Length == 0 && sTemp.Length == 0)
                            {
                                break;
                            }
                            if (l.Length == 0)
                            {
                                AddStrofaSalmo(sTemp, 6);
                                sTemp = new Story();
                                break;
                            }
                            if (èoppure(l))
                            {
                                Add1OppureSalmo(new Story(CurLine));
                            }
                            else
                            {
                                sTemp.Addstory(new Story(CurLine));
                            }
                            break;
                        }

                        case 2:
                        {
                            //riga vuota salto
                            if (l.Length == 0 && sTemp.Length == 0)
                            {
                                break;
                            }
                            if (l.Length == 0)
                            {
                                Add2AntifonaSalmo(sTemp);
                                sTemp = new Story();
                                break;
                            }
                            else
                            {
                                sTemp.Addstory(new Story(CurLine));
                            }
                            break;
                        }

                        case 3:
                        {
                            if (l.Length == 0 && sTemp.Length == 0)
                            {
                                break;
                            }
                            if (l.Length == 0)
                            {
                                AddStrofaSalmo(sTemp, 6);
                                sTemp = new Story();
                                break;
                            }
                            if (èoppure(l))
                            {
                                Add2OppureSalmo(new Story(CurLine));
                            }
                            else
                            {
                                sTemp.Addstory(new Story(CurLine));
                            }
                            break;
                        }

                        case 4:
                        {
                            if (l.Length == 0)
                            {
                                break;
                            }
                            Add3AntifonaSalmo(new Story(CurLine));
                            break;
                        }

                        case 5:
                        case 6:
                        case 7:
                        case 8:
                        case 9:
                        case 10:             //'A' su rtf
                        case 11:             //'B'  su rtf
                        case 12:             //'C'  su rtf
                        case 13:             //'D'  su rtf
                        {
                            if (l.Length == 0 && sTemp.Length == 0)
                            {
                                break;
                            }
                            if (èInizioLettura(l))
                            {
                                if (sTemp.Length > 0)
                                {
                                    AddStrofaSalmo(sTemp, prog + 1);
                                    sTemp = new Story();
                                }
                                addInizioLetturaOVangelo(new Story(CurLine), Section.secondalettura);
                                break;
                            }

                            if (èAntifonaVangelo(l))
                            {
                                if (sTemp.Length > 0)
                                {
                                    AddStrofaSalmo(sTemp, prog + 1);
                                    sTemp = new Story();
                                }
                                AddInizioPrimaAntifonaVangelo(new Story(CurLine));
                                break;
                            }
                            if (l.Length == 0)
                            {
                                AddStrofaSalmo(sTemp, prog + 1);
                                sTemp = new Story();
                                break;
                            }
                            else
                            {
                                sTemp.Addstory(new Story(CurLine));
                            }

                            break;
                        }

                        default:
                        {
                            addProblem("default .. non gestito!");
                            break;
                        }
                        }
                        break;
                    }

                    case Section.antifonaVangelo:
                    {
                        switch (prog)
                        {
                        case 0:
                        {
                            if (l.Length == 0)
                            {
                                break;
                            }
                            if (èAntifonaVangelo(l))
                            {
                                addOutPQ("#41", sTemp);
                                sTemp = new Story();
                                addOutPQ("#42", new Story(CurLine));
                                //sec = Section.vangelo;
                                //prog = -1;
                                prog = 2;
                            }
                            else
                            {
                                sTemp.Addstory(new Story(CurLine));
                            }
                            break;
                        }

                        case 2:
                        {
                            if (l.Length == 0)
                            {
                                break;
                            }
                            if (èoppure(l))
                            {
                                AddOppureAntifonaVangelo(new Story(CurLine));
                            }
                            else if (èInizioVangelo(l))
                            {
                                addInizioLetturaOVangelo(new Story(CurLine), Section.vangelo);
                            }
                            break;
                        }

                        case 3:
                        {
                            if (l.Length == 0)
                            {
                                break;
                            }
                            if (èAntifonaVangelo(l))
                            {
                                AddInizioSecondaAntifonaVangelo(new Story(CurLine));
                            }
                            else
                            {
                                addProblem("manca seconda antifona vangelo");
                            }
                            break;
                        }

                        case 4:
                        {
                            if (l.Length == 0)
                            {
                                break;
                            }
                            if (èAntifonaVangelo(l))
                            {
                                addOutPQ("#45", sTemp);
                                sTemp = new Story();
                                addOutPQ("#46", new Story(CurLine));
                                sec  = Section.vangelo;
                                prog = -1;
                            }
                            else
                            {
                                sTemp.Addstory(new Story(CurLine));
                            }
                            break;
                        }

                        default:
                        {
                            addProblem("default .. non gestito!");
                            break;
                        }
                        }
                        break;
                    }

                    default:
                    {
                        addProblem("default .. non gestito!");
                        break;
                    }
                    }
                }
                //aggiungo commento al vangelo
                if (sTemp.Length > 0)
                {
                    addOutPQ("#" + (int)sec + "4", sTemp);
                    sTemp = new Story();
                }
            }
            catch (System.Exception ex)
            {
                addProblem("eccezione: " + ex.Message);
            }

            return(outPQTag);
        }