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


C# Reader.Skip方法代码示例

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


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

示例1: ParseRules

        public static Dictionary<string, string> ParseRules(byte[] rules) {
            var r = new Reader(rules);
            r.Skip(5);
            var ruleCount = r.ReadShort();
            var dict = new Dictionary<string, string>();
            r.Skip(2);
            r.WhileNotOutOfBounds(ruleCount, () => {
                var rule = r.ReadStringUntil();
                var value = r.ReadStringUntil();
                dict[rule] = value;
            });

            return dict;
        }
开发者ID:SIXNetworks,项目名称:withSIX.Desktop,代码行数:14,代码来源:SourceQueryParser.cs

示例2: ParseSettings

        static SourceParseResult ParseSettings(byte[] info) {
            var r = new Reader(info);
            r.Skip(5);
            var settings = new SourceParseResult();
            settings.Protocol = r.ReadAsInt();
            settings.Name = r.ReadStringUntil();
            settings.Map = r.ReadStringUntil();
            settings.Folder = r.ReadStringUntil();
            settings.Game = r.ReadStringUntil();
            settings.AppId = r.ReadShort();
            settings.CurrentPlayers = r.ReadAsInt();
            settings.MaxPlayers = r.ReadAsInt();
            settings.BotCount = r.ReadAsInt();
            settings.ServerType = r.ReadAsInt();
            settings.Environment = r.ReadAsInt();
            settings.Visibility = r.ReadAsInt();
            settings.Vac = r.ReadAsInt();
            //if The Ship, additional fields:
            //_results.mode = reply[pos++];
            //_results.witnesses = reply[pos++];
            //_results.duration = reply[pos++];
            settings.Version = r.ReadStringUntil();
            var edf = r.ReadByte();
            //settings.edf = edf.ToString(CultureInfo.InvariantCulture);
            if ((edf & 0x80) != 0)
                settings.Port = r.ReadShort();
            if ((edf & 0x10) != 0)
                settings.SteamId = r.ReadLong();
            if ((edf & 0x40) != 0) {
                settings.TvPort = r.ReadShort();
                settings.TvName = r.ReadStringUntil();
            }
            if ((edf & 0x20) != 0) {
                settings.Keywords = r.ReadStringUntil();
            }
            //gameID = full appID if was truncated in previous field (not always the case)
            if ((edf & 0x01) != 0)
                settings.AppId = r.ReadLong();

            return settings;
        }
开发者ID:SIXNetworks,项目名称:withSIX.Desktop,代码行数:41,代码来源:SourceQueryParser.cs


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