当前位置: 首页>>代码示例>>C#>>正文


C# System.IO.FileStream.WriteString方法代码示例

本文整理汇总了C#中System.IO.FileStream.WriteString方法的典型用法代码示例。如果您正苦于以下问题:C# System.IO.FileStream.WriteString方法的具体用法?C# System.IO.FileStream.WriteString怎么用?C# System.IO.FileStream.WriteString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.IO.FileStream的用法示例。


在下文中一共展示了System.IO.FileStream.WriteString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Main

        static void Main()
        {
            d3mpqs.MPQStorage.MpqRoot = "S:/D3/egris/src/Mooege/bin/Debug/Assets/MPQ/MPQs";
            d3mpqs.MPQStorage.Initialize(9359);
            var scene = d3mpqs.MPQStorage.Data.Assets[d3mpqs.SNOGroup.Scene][0x00008245];
            var file = (scene as d3mpqs.MPQAsset).MpqFile.Open();
            var _scene = new gslibrary.packets.Scene();
            _scene.FileRead(file, 16);

            foreach (var lworld in d3mpqs.MPQStorage.Data.Assets[d3mpqs.SNOGroup.Worlds])
            {
                Console.WriteLine("{0} {1}", lworld.Value.SNOId, lworld.Value.Name);
            }
            var quest = d3mpqs.MPQStorage.Data.Assets[d3mpqs.SNOGroup.Quest];
            foreach (var lquest in quest)
            {
                Console.WriteLine("{0} {1} ", lquest.Value.SNOId, lquest.Value.Name);
            }
            var yquest = d3mpqs.MPQStorage.Data.Assets[d3mpqs.SNOGroup.Quest][87700];
            var qfile = (yquest as d3mpqs.MPQAsset).MpqFile.Open();
            var _quest = new gslibrary.packets.Quest();
            _quest.FileRead(qfile, 16);
            var afile = new System.IO.FileStream("file.txt", System.IO.FileMode.Create);
            afile.WriteString(_quest.AsText());
            afile.Close();
            Console.WriteLine("-------------");
            foreach (var lquest in d3mpqs.MPQStorage.Data.Assets[d3mpqs.SNOGroup.GameBalance])
            {
                Console.WriteLine("{0} {1} ", lquest.Value.SNOId, lquest.Value.Name);
                try
                {
                    var gbfile = (lquest.Value as d3mpqs.MPQAsset).MpqFile.Open();
                    var _gb = new gslibrary.packets.GameBalance();
                    _gb.FileRead(gbfile, 16);
                    var bfile = new System.IO.FileStream(lquest.Value.Name + ".gam.txt", System.IO.FileMode.Create);
                    bfile.WriteString(_gb.AsText());
                    bfile.Close();
                }
                catch
                {
                    Console.WriteLine("failed");
                }
            }

            /*var file = (scene as d3mpqs.MPQAsset).MpqFile.Open();
            var _scene = new gslibrary.packets.Scene();
            _scene.FileRead(file, 16);
            */
            Form1.map = new System.Drawing.Bitmap(96, 96);
            for (int y = 0; y < 96; y++)
            {
                for (int x = 0; x < 96; x++)
                {
                    var color = System.Drawing.Color.Black;
                    if ((_scene.Field5.Squares[x + y * 96].Flags & 1) == 1)
                        color = System.Drawing.Color.Red;
                    Form1.map.SetPixel(x, y, color);
                }
            }

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form1());
        }
开发者ID:starcasters,项目名称:gslibrary,代码行数:64,代码来源:Program.cs


注:本文中的System.IO.FileStream.WriteString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。