예제 #1
0
        private static QueryResponseDictionary[] ParseResponse(string rawResponse)
        {
            var records = rawResponse.Split('|');
            var response = records.Select(s =>
            {
                var args = s.Split(' ');
                var r = new QueryResponseDictionary();
                foreach (var arg in args)
                {
                    if (arg.Contains('='))
                    {
                        var eqIndex = arg.IndexOf('=');

                        var key = arg.Substring(0, eqIndex).TeamSpeakUnescape();
                        var value = arg.Remove(0, eqIndex + 1);

                        int intVal;
                        if (int.TryParse(value, out intVal))
                            r[key] = intVal;
                        else
                            r[key] = value;
                    }
                    else
                    {
                        r[arg] = null;
                    }
                }
                return r;
            });

            return response.ToArray();
        }
 internal NotificationData(QueryResponseDictionary[] queryResponseDictionary)
 {
     Debug.Assert(queryResponseDictionary != null);
     Payload = new ReadOnlyCollection<QueryResponseDictionary>(queryResponseDictionary);
 }