Exemple #1
0
        static public void codeReplaceWellHead()
        {
            cProjectData.sErrLineInfor = "";
            string       fileNameTempWellhead = cProjectManager.dirPathTemp + "wellHead.txt";
            StreamWriter swWellHead           = new StreamWriter(fileNameTempWellhead, false, Encoding.UTF8);

            using (StreamReader sr = new StreamReader(cProjectManager.filePathInputWellhead, System.Text.Encoding.UTF8))
            {
                String line;
                while ((line = sr.ReadLine()) != null) //delete the line whose legth is 0
                {
                    string[] split = line.Trim().Split(new char[] { ' ', '\t', ',', ';' }, StringSplitOptions.RemoveEmptyEntries);
                    split[4] = ItemWellHead.codeReplace(split[4]);
                    swWellHead.WriteLine(string.Join("\t", split));
                }
            }
            swWellHead.Close();

            File.Copy(fileNameTempWellhead, cProjectManager.filePathInputWellhead, true);
            File.Delete(fileNameTempWellhead);
        }