Exemple #1
0
        public static GameTags Parse(string value) {
            var tags = new GameTags();
            foreach (var tuple in (from part in value.Split(',')
                where part.Length > 0
                select Tuple.Create(part[0], part.Substring(1))).ToHashSet()) {
                switch (tuple.Item1) {
                case 'b':
                    tags.BattlEye = ReadBool(tuple.Item2);
                    break;

                case 'd':
                    tags.Dedicated = ReadBool(tuple.Item2);
                    break;

                case 'e':
                    tags.TimeRemaining = ReadInt(tuple.Item2);
                    break;

                case 'f':
                    tags.AllowedFilePatching = ReadInt(tuple.Item2);
                    break;

                case 'g':
                    tags.Language = ReadInt(tuple.Item2);
                    break;

                case 'h':
                    tags.GlobalHash = ReadInt(tuple.Item2);
                    break;

                case 'l':
                    tags.Lock = ReadBool(tuple.Item2);
                    break;

                case 'm':
                    tags.EqualModRequired = ReadBool(tuple.Item2);
                    break;

                case 'n':
                    tags.Build = ReadInt(tuple.Item2);
                    break;

                case 'o':
                    tags.Country = tuple.Item2;
                    break;

                case 'p':
                    tags.Platform = ReadChar(tuple.Item2);
                    break;

                case 'r':
                    tags.Version = ReadInt(tuple.Item2);
                    break;

                case 's':
                    tags.ServerState = (SessionState) ReadInt(tuple.Item2).GetValueOrDefault(0);
                    break;

                case 't':
                    tags.GameType = tuple.Item2;
                    break;

                case 'v':
                    tags.VerifySignatures = ReadBool(tuple.Item2);
                    break;
                }
            }
            return tags;
        }
Exemple #2
0
        public static GameTags Parse(string value)
        {
            var tags = new GameTags();

            foreach (var tuple in (from part in value.Split(',')
                                   where part.Length > 0
                                   select Tuple.Create(part[0], part.Substring(1))).ToHashSet())
            {
                switch (tuple.Item1)
                {
                case 'b':
                    tags.BattlEye = ReadBool(tuple.Item2);
                    break;

                case 'd':
                    tags.Dedicated = ReadBool(tuple.Item2);
                    break;

                case 'e':
                    tags.TimeRemaining = ReadInt(tuple.Item2);
                    break;

                case 'f':
                    tags.AllowedFilePatching = ReadInt(tuple.Item2);
                    break;

                case 'g':
                    tags.Language = ReadInt(tuple.Item2);
                    break;

                case 'h':
                    tags.GlobalHash = ReadInt(tuple.Item2);
                    break;

                case 'l':
                    tags.Lock = ReadBool(tuple.Item2);
                    break;

                case 'm':
                    tags.EqualModRequired = ReadBool(tuple.Item2);
                    break;

                case 'n':
                    tags.Build = ReadInt(tuple.Item2);
                    break;

                case 'o':
                    tags.Country = tuple.Item2;
                    break;

                case 'p':
                    tags.Platform = ReadChar(tuple.Item2);
                    break;

                case 'r':
                    tags.Version = ReadInt(tuple.Item2);
                    break;

                case 's':
                    tags.ServerState = (SessionState)ReadInt(tuple.Item2).GetValueOrDefault(0);
                    break;

                case 't':
                    tags.GameType = tuple.Item2;
                    break;

                case 'v':
                    tags.VerifySignatures = ReadBool(tuple.Item2);
                    break;
                }
            }
            return(tags);
        }