Beispiel #1
0
 private void LoadButton_Click(object sender, EventArgs e)
 {
     if (inputOpenFileDialog.ShowDialog() == DialogResult.OK)
     {
         try
         {
             ReadFromFile n = new ReadFromFile(inputOpenFileDialog.FileName);
             spis         = n.FileToCharacter(inputOpenFileDialog.FileName);
             OuText.Lines = spis.Printer();
             inputOpenFileDialog.Dispose();
         }
         finally { }
     }
 }
Beispiel #2
0
        public WorkWSpis FileToCharacter(string FileName)
        {
            WorkWSpis list = new WorkWSpis();

            string[] temp = File.ReadAllLines(FileName, Encoding.Default);
            int      sep = 0;
            string   fio, prof;

            for (int i = 0; i < temp.Length; i++)
            {
                for (int j = temp[i].Length - 1; temp[i][j] != ' '; j--)
                {
                    sep = j;
                }
                fio  = temp[i].Substring(0, sep - 1);
                prof = temp[i].Substring(sep, temp[i].Length - sep);
                list.AddToFIO(fio, prof);
            }
            return(list);
        }