FileInfo fi1 = new FileInfo("data\\公汽线路信息.txt"); FileInfo fi2 = new FileInfo("data\\地铁线路信息.txt"); FileInfo fi3 = new FileInfo("data\\地铁T1线换乘公汽信息.txt"); FileInfo fi4 = new FileInfo("data\\地铁T2线换乘公汽信息.txt"); if (!fi1.Exists) { throw new Exception("《公汽线路信息.txt》文件不在当前目录下"); } if (!fi2.Exists) { throw new Exception("《地铁线路信息.txt》文件不在当前目录下"); } if (!fi1.Exists) { throw new Exception("《地铁T1线换乘公汽信息.txt》文件不在当前目录下"); } if (!fi2.Exists) { throw new Exception("《地铁T2线换乘公汽信息.txt》文件不在当前目录下"); } sr1 = new StreamReader(fi1.FullName, Encoding.Default); sr2 = new StreamReader(fi2.FullName, Encoding.Default); sr3 = new StreamReader(fi3.FullName, Encoding.Default); sr4 = new StreamReader(fi4.FullName, Encoding.Default); }
2021-08-25 20:20:57 466KB 2007届数学建模B题, 乘公交 看奥运
1