Ejemplo n.º 1
0
        private bool parseForIdentity(string data)
        {
            if (data.Contains(token))
            {
                int i = data.IndexOf(token);
                if (i > 2)
                {
                    string tmp = data.Replace(token, "<");
                    string key = data.Substring(0, i - 2);
                    tmp = tmp.Replace(key, " ");
                    tmp = tmp.Substring(1, tmp.Length - 1);
                    int start = tmp.IndexOf("<");
                    int stop  = tmp.IndexOf(">");
                    tmp = tmp.Remove(stop);
                    start++;
                    tmp = tmp.Substring(start, tmp.Length - start);
                    if (_session == null)
                    {
                        _session = new AllJoynSession(_allJoyn);
                    }
                    if (!_session.HasKey(key))
                    {
                        _session.NewParticipant(key, tmp);
                        _transcriptText.AppendLine("*** ADD " + key + " **** ");
                        sendIdentityMessage();
                    }
                    else
                    {
                        _session.AddIdentity(key, tmp);
                    }

                    _buffer.AddDeferred("IDENTIFIED " + tmp + " AS " + key, tmp, TextType.Error);
                    return(true);
                }
            }
            return(false);
        }