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


C# System.IO.StringReader.Read方法代码示例

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


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

示例1: GetTokens

        public static IEnumerable<Token> GetTokens(string cssFilter)
        {
            var reader = new System.IO.StringReader(cssFilter);
            while (true)
            {
                int v = reader.Read();

                if (v < 0)
                    yield break;

                char c = (char)v;

                if (c == '>')
                {
                    yield return new Token(">");
                    continue;
                }

                if (c == ' ' || c == '\t')
                    continue;

                string word = c + ReadWord(reader);
                yield return new Token(word);
            }
        }
开发者ID:ccwalkerjm,项目名称:HtmlAgilityPack.CssSelector,代码行数:25,代码来源:Tokenizer.cs

示例2: Load

 public void Load(System.IO.StreamReader file)
 {
     for (int i = 0; i < BgTileMap.worldSize; i++)
     {
         System.IO.StringReader stringReader = new System.IO.StringReader(file.ReadLine());
         for (int j = 0; j < BgTileMap.worldSize; j++)
         {
             BgTileMap.bgtiles[i, j].texID = stringReader.Read() - (int)'0';
             BgTileMap.bgtiles[i, j].UpdatePassability();
         }
     }
 }
开发者ID:Jemeyr,项目名称:lizard,代码行数:12,代码来源:BgTileMap.cs

示例3: ReadIn

        public void ReadIn()
        {
            System.IO.StreamReader fileReader = new System.IO.StreamReader("level.txt");
            if (fileReader.ReadLine() != "64")
            {
                Console.Out.WriteLine("FAILURE");
                return;
            }
            for (int i = 0; i < TileMap.worldSize; i++)
            {
                System.IO.StringReader stringReader = new System.IO.StringReader(fileReader.ReadLine());
                for (int j = 0; j < TileMap.worldSize; j++)
                {
                    TileMap.tiles[i, j].texID = stringReader.Read() - (int)'0';
                    TileMap.tiles[i, j].UpdatePassability();

                }
            }

            fileReader.Close();
        }
开发者ID:Jemeyr,项目名称:lizard,代码行数:21,代码来源:World.cs

示例4: LoadFromString

        public void LoadFromString(string s)
        {
            System.IO.StringReader str = new System.IO.StringReader(s);
            List<byte> byteList = new List<byte>();

            while (str.Peek() >= 0)
                byteList.Add((byte)str.Read());

            LoadFromByteList(byteList);
        }
开发者ID:NikMifsud,项目名称:GreatSiege,代码行数:10,代码来源:Data.cs

示例5: HexStringToByteArray

 // for the record, I feel that this MachineKey class should be public.  Why not have us
 // think about security only a little bit, and say, "Here... here's some nice helper
 // methods for you to encrypt data only in a tamper-proof way"
 // anyways, whatever.
 /// <summary>
 /// Converts a hex string into a byte array.  Original credit to: http://stackoverflow.com/a/311179/323456
 /// </summary>
 /// <param name="str">string to convert</param>
 /// <returns>byte array</returns>
 public static byte[] HexStringToByteArray(string hex)
 {
     int NumberChars = hex.Length / 2;
     byte[] bytes = new byte[NumberChars];
     using (var sr = new System.IO.StringReader(hex))
     {
         for (int i = 0; i < NumberChars; i++)
             bytes[i] =
               Convert.ToByte(new string(new char[2] { (char)sr.Read(), (char)sr.Read() }), 16);
     }
     return bytes;
 }
开发者ID:ericnewton76,项目名称:httpsecurecookie,代码行数:21,代码来源:MachineKey.cs


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