码迷,mamicode.com
首页 > 其他好文 > 详细

Microsoft.Xna.Framework.TitleContainer.OpenStream()

时间:2014-09-25 00:22:37      阅读:215      评论:0      收藏:0      [点我收藏+]

标签: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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!