public void LoadRegionMaps()
{
for (int x = 9; x < 10; x++)
{
for (int y = 9; y < 10; y++)
{
string path = RegionData[x, y, 1];
System.Console.Write("Opening File...");
if(path != "0")
{
System.Console.Write(path);
string[] fileText = File.ReadAllLines(path);.txt文件中的路径如下所示:
"..\\Bin\\Assets\\WorldMap\\Regions\\Forest.txt"我试过把它改成
@"..\\Bin\\Assets\\WorldMap\\Regions\\Forest.txt"两样都不管用。
在我展示的最后一行代码中,两者都会导致标题中的错误。
path = "..\\Bin\\Assets\\WorldMap\\Regions\\Forest.txt"很管用。
RegionData是一个字符串数组,包含上述文件。
发布于 2013-11-03 14:59:52
删除文件上的双\\和"。\\是一个转义序列,它可以转换为\ on C#,但它不适用于从文件中读取的数据,除非您为此编写代码。
..\Bin\Assets\WorldMap\Regions\Forest.txthttps://stackoverflow.com/questions/19754257
复制相似问题