示例#1
0
        public static ArrayList createWords(string file)
        {
            ArrayList words = new ArrayList();

            try{
                string[] s = read(file);
                for (int i = 0; i < s.Length; i++)
                {
                    while (s[i].Length > 0)
                    {
                        InitComponent init = new InitComponent();
                        string        word = Separate.separate(s[i], Separator.separator, init.selectedSeparatorIndex);
                        if (word.Length > 0)
                        {
                            words.Add(word);
                        }
                        if (s[i].Length > word.Length)
                        {
                            s[i] = s[i].Remove(0, word.Length + 1);
                        }
                        else
                        {
                            s[i] = s[i].Remove(0, word.Length);
                        }
                    }
                }
            } catch (NullReferenceException) {
            } catch (IndexOutOfRangeException) {
                MessageBox.Show("Please choose a separator!");
            }
            return(words);
        }
示例#2
0
        public void buttonListener(object sender, EventArgs e)
        {
            InitComponent init = new InitComponent();

            CreateFile.createFile(CreateWords.createWords(init.file));
        }