首页 > 其他 > 详细

Microsoft.Xna.Framework.TitleContainer.OpenStream()

时间:2014-09-24 22:57:08      阅读:331      评论:0      收藏:0      [点我收藏+]

/// <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()

原文:http://www.cnblogs.com/qiuyueguangxuan/p/3991634.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!