Example #1
0
        private void btoper_Click(object sender, EventArgs e)
        {
            Encoding      en    = Encoding.Default;
            StringBuilder strb  = new StringBuilder();
            string        path  = tBdir.Text;
            string        spath = tBsave.Text;
            List <string> paths = new List <string>();
            List <string> files = new List <string>();

            FileSys.GetAllDirFiles(path, ref files, ref paths, "*.txt");
            for (int i = 0; i < files.Count; i++)
            {
                string fpath = files[i];
                en = GetFileEncoding(fpath);
                StreamReader rd      = new StreamReader(fpath, en);
                string       StrRead = rd.ReadToEnd().ToString();
                StrRead = Filtrate(StrRead);
                strb.Append(StrRead);
            }
            FileStream fs = File.Create(spath);

            byte[] bContent = en.GetBytes(strb.ToString());
            fs.Write(bContent, 0, bContent.Length);
            fs.Close();
        }