Exemple #1
0
        private void ConvertirAWiki()
        {
            //Obtener el input
            string[] topicFiles = null;
            try {
                topicFiles = CommonTasks.GetFiles(txtTopicFolder.Text, "*.txt");
            } catch (Exception ex) {
                MessageBox.Show(ex.Message);
                return;
            }

            //Obtener el output
            string folder = txtWikiFolder.Text;

            if (folder == "")
            {
                MessageBox.Show("Selecciona la carpeta de salida");
                return;
            }

            //Leer ficheros LaTeX
            TopicIndex topicIndex = new TopicIndex(topicFiles);

            topicIndex.ProgressBar = progressBar1;
            topicIndex.LogTextBox  = txtResultLog;
            topicIndex.Read();

            //Convertir a ficheros wiki
            topicIndex.WriteAsWiki(folder);
        }
Exemple #2
0
        private void btnBuscar_Click(object sender, EventArgs e)
        {
            lblNumResult.Text = "0";

            //Obtener el input
            string[] latexFiles = null;
            try {
                latexFiles = CommonTasks.GetFiles(txtLatexFolder.Text, "*.tex");
            } catch (Exception ex) {
                MessageBox.Show(ex.Message);
                return;
            }

            string searchText = txtSearchText.Text;

            if (searchText.Length == 0)
            {
                MessageBox.Show("Introduce texto de búsqueda.");
                return;
            }
            bool hayexclusion = (txtExcluded.Text != string.Empty);

            string[] exclusiones = new string[] { };
            if (hayexclusion)
            {
                exclusiones = txtExcluded.Text.Split(new char[] { ',' });
                for (int i = 0; i < exclusiones.Length; i++)
                {
                    exclusiones[i] = exclusiones[i].Trim();
                    if (exclusiones[i].IndexOf(searchText) == -1)
                    {
                        MessageBox.Show("La cadena de exclusión " + exclusiones[i] +
                                        " no contiene la cadena " + searchText + ".");
                        return;
                    }
                }
            }

            //Leer ficheros LaTeX
            Book           book     = new Book(latexFiles, progressBar1);
            List <Excerpt> excerpts = book.Search(searchText, exclusiones);

            //Presentar resultados
            StringBuilder sb  = new StringBuilder();
            StringBuilder sb2 = new StringBuilder();

            for (int n = 0; n < excerpts.Count; n++)
            {
                sb.Append(excerpts[n].Reference + (n == excerpts.Count - 1 ? "" : ", "));
                sb2.Append(excerpts[n].Reference + "   " + excerpts[n].Extract + "\r\n");
            }

            this.lblNumResult.Text  = excerpts.Count.ToString();
            this.txtResultados.Text = CommonTasks.ReduceRefs(sb.ToString());
            this.txtLog.Text        = sb2.ToString();
        }
Exemple #3
0
        private void btnSelTopicFolder_Click(object sender, EventArgs e)
        {
            FolderBrowserDialog fbd = new FolderBrowserDialog();

            fbd.Description = "Selecciona carpeta con ficheros TXT";
            if (fbd.ShowDialog() == DialogResult.OK)
            {
                txtTopicFolder.Text = fbd.SelectedPath;
                //Comprobamos si hay ficheros
                try {
                    CommonTasks.GetFiles(txtTopicFolder.Text, "*.txt");
                } catch (Exception ex) {
                    MessageBox.Show(ex.Message);
                }
            }
        }
Exemple #4
0
        private void BuscarCitasIncorrectas()
        {
            //Buscar todos los párrafos con footnotes donde las abreviaturas biblicas se repiten

            //Obtener el input
            string[] latexFiles = null;
            try {
                latexFiles = CommonTasks.GetFiles(txtLatexFolder.Text, "*.tex");
            } catch (Exception ex) {
                MessageBox.Show(ex.Message);
                return;
            }

            //Leer fichero LateX
            List <string> resultados = new List <string>();

            for (int f = 0; f < latexFiles.Length; f++)
            {
                resultados.Add(latexFiles[f]);
                Book book = new Book(latexFiles, this.progressBar1);
                if (book.GetParLength() > 0)
                {
                    for (int p = 0; p < book.GetParLength(); p++)
                    {
                        Par    par   = book.GetPar(p);
                        string refer = par.GetID();
                        bool   isOK  = true;
                        if (par.GetFootnotesLength() > 0)
                        {
                            for (int n = 0; n < par.GetFootnotesLength(); n++)
                            {
                                Footnote footnote = par.GetFootnote(n);
                                for (int m = 0; m < footnote.GetFootnotePartsLength(); m++)
                                {
                                    if (footnote.GetFootnotePart(m).HasReferenceRepeated())
                                    {
                                        isOK = false;
                                        break;
                                    }
                                }
                                if (!isOK)
                                {
                                    break;
                                }
                            }
                        }
                        if (!isOK)
                        {
                            resultados.Add(refer);
                        }
                    }
                }
            }

            //Presentar resultados
            StringBuilder sb = new StringBuilder();

            for (int n = 0; n < resultados.Count; n++)
            {
                sb.Append(resultados[n] + "\r\n");
            }
            this.txtResultLog.Text = sb.ToString();
        }