标签:io os ar sp on c ad line new
/// <summary>
/// This method opens a file using System.IO classes and the
/// TitleLocation property. It presumes that a file named
/// ship.dds has been deployed alongside the game.
/// </summary>
private static void DoOpenFile()
{
try
{
System.IO.Stream stream = TitleContainer.OpenStream("aa.txt");
System.IO.StreamReader sreader = new System.IO.StreamReader(stream);
// use StreamReader.ReadLine or other methods to read the file data
Console.WriteLine("File Size: " + stream.Length);
stream.Close();
}
catch (System.IO.FileNotFoundException)
{
// this will be thrown by OpenStream if gamedata.txt
// doesn‘t exist in the title storage location
}
}
Microsoft.Xna.Framework.TitleContainer.OpenStream()
标签:io os ar sp on c ad line new
原文地址:http://www.cnblogs.com/qiuyueguangxuan/p/3991634.html