AbstractCompare.Form1.button9_Click C# (CSharp) 메소드

button9_Click() 개인적인 메소드

private button9_Click ( object sender, EventArgs e ) : void
sender object
e System.EventArgs
리턴 void
        private void button9_Click(object sender, EventArgs e) //vytvor zjednoduseny subor pre dbpediu
        {
            cestaSuborDBPedia = textBox2.Text;

            string riadok;

            System.IO.StreamReader citajSubor = new System.IO.StreamReader(cestaSuborDBPedia);

            using (System.IO.StreamWriter zapisSubor = new System.IO.StreamWriter(@"d:\Vyhladavanie info\dbpedia-abstract-vycuc.txt"))
            {
                while ((riadok = citajSubor.ReadLine()) != null)
                {
                    string[] poleAbstrakt = riadok.Split(new string[] { "<http://db" }, StringSplitOptions.None);

                    if (poleAbstrakt.Length > 2)
                    {
                        //Unit test pre testovanie struktury dokumentu
                        string unitTest = poleAbstrakt[1].Substring(0, 19);

                        if (!unitTest.Equals("pedia.org/resource/"))
                        {
                            MessageBox.Show("Štruktúra nie je rovnaká! Oprav zdrojový kód!");
                            break;
                        }
                        //----------------------------------------------
                        string nadpis = poleAbstrakt[1].Remove(0, 19);
                        nadpis = nadpis.Remove(nadpis.Length - 2);
                        nadpis = nadpis.Replace("_", " ").ToLower();

                        poleAbstrakt[2] = poleAbstrakt[2].Remove(poleAbstrakt[2].Length - 6);
                        poleAbstrakt[2] = poleAbstrakt[2].Remove(0, 30);

                        //ideme zapisovat vytvorene prvky do noveho suboru
                        zapisSubor.WriteLine(nadpis + ";|?" + poleAbstrakt[2]);
                    }
                }
                zapisSubor.Close();
            }
            citajSubor.Close();
        }