我正在尝试在文本文件中找到某个字符串,然后根据该字符串所说的内容创建一个文件夹,在某个地方,我刚刚停止的内容,它没有异常,它不会吐出错误,它只是停止。
我试图找到的字符串是这样设置的:
50.1 : Oxygas ------> = 1
50.2 : laser -------> = 0 
etc. 
foreach (string file in files)
        {
            string thepathoflife = Path.GetFullPath(file);
            //CreatetheFolder(file)
            string filetocopy = file;
            object bob = file.Clone();
            string bobby = bob.ToString();
            string location = file;
            bool b = false;
            string extension = Path.GetExtension(file);
            string thenameofdoom = Path.GetFileNameWithoutExtension(file);
            string filename = Path.GetFileName(file);
            ////bobby.Move(@"\\TEST12CVG\Public\Posts\Temporaryjunk" + filename);
            // string oldlocation = filename+extension;
            if (extension == ".pst" ||
              extension == ".tec" ||
              extension == ".pas" ||
              extension == ".snc" ||
              extension == ".cst" ||
              extension == ".xml")
            {
                b = true;
            }
            if (thenameofdoom == "Plasma" ||
              thenameofdoom == "Oxygas" ||
              thenameofdoom == "plasma" ||
              thenameofdoom == "oxygas" ||
              thenameofdoom == "Oxyfuel" ||
              thenameofdoom == "oxyfuel")
            {
                b = false;
            }
            if (b == true)
            // System.IO.File.WriteAllText(newlocation, bobby);
            {
                bool plasma = false;
                bool oxygas = false;
                bool punch = false;
                bool laser = false;
                var findLevel = 6;
                var path = @thepathoflife;
                var levels = path.Split(Path.DirectorySeparatorChar);
                var second = levels.Length > findLevel ? levels[findLevel] : null; 
     //this is where the problem starts.
 StreamReader s = new StreamReader(@thepathoflife);
                StreamReader st = new StreamReader(@thepathoflife);
                string currentLine;
                string searchString = "50.2 :";
                bool foundText = false;
                string searchStringab = "= 1";
                bool foundTextab = false;
                do
                {
                    currentLine = st.ReadLine();
                    if (currentLine != null)
                    {
                        foundText = currentLine.Contains(searchString);
                        foundTextab = currentLine.Contains(searchStringab);
                    }
                }
                while (currentLine != null && !foundText || currentLine != null && !foundTextab);
                if (foundText||foundTextab)
                {
                    plasma = true; //do something
                }