Пример #1
0
 public Chat(string mchannel_url, string mapplication_id, string UserName, string Password)
 {
     IndividualSearchCutout = 30000; //ni inocentes
     channel_url            = mchannel_url;
     application_id         = mapplication_id;
     //RootURL = $"https://api-{application_id}.sendbird.com"; Otro login
     RootURL = $"https://sendbirdproxy.chat.redditmedia.com";
     try
     {
         client = GetLoggedWebClient(UserName, Password);
         var UID   = GetUserID();
         var Token = GetSBToken();
         SessionKey = GetSocketKey($"{RootURL.Replace("https", "wss")}/?p=JS" +
                                   $"&sv=3.0.69" +
                                   $"&ai={application_id}" +
                                   $"&access_token={Token}" +
                                   $"&user_id=t2_{UID}" +
                                   $"&pv=Mozilla%2F5.0%20(Windows%20NT%2010.0%3B%20Win64%3B%20x64)%20AppleWebKit%2F537.36%20(KHTML.%20like%20Gecko)%20Chrome%2F83.0.4103.97%20Safari%2F537.36").Result;
         client.UpdateToken(application_id, SessionKey);
         LoggedIn = true;
     }
     catch
     {
         LoggedIn = false;
     }
 }
Пример #2
0
        public async Task Connect()
        {
            try
            {
                SessionKey = await GetSocketKey($"{RootURL.Replace("https", "wss")}/?p=JS" +
                                                $"&sv=3.0.69" +
                                                $"&ai={application_id}" +
                                                $"&access_token={Token}" +
                                                $"&user_id={UserID}" +
                                                $"&pv=Mozilla%2F5.0%20(Windows%20NT%2010.0%3B%20Win64%3B%20x64)%20AppleWebKit%2F537.36%20(KHTML.%20like%20Gecko)%20Chrome%2F83.0.4103.97%20Safari%2F537.36");

                client = new CookieAwareWebClient();
                client.DownloadString("https://reddit.com");
                client.UpdateToken(application_id, SessionKey);
                SelectedUserId = UserID;
                Channels       = GetChannelInfo();
                LoggedIn       = true;
            }
            catch
            {
                LoggedIn = false;
                throw;
            }
        }
        internal override bool ParseNodeBodyElement(string id, VRMLParser parser)
        {
            int line = parser.Line;

            if (id == "center")
            {
                Center = parser.ParseSFVec3fStringValue();
            }
            else if (id == "child1Url")
            {
                Child1URL.AddRange(parser.ParseSFStringOrMFStringValue());
            }
            else if (id == "child2Url")
            {
                Child2URL.AddRange(parser.ParseSFStringOrMFStringValue());
            }
            else if (id == "child3Url")
            {
                Child3URL.AddRange(parser.ParseSFStringOrMFStringValue());
            }
            else if (id == "child4Url")
            {
                Child4URL.AddRange(parser.ParseSFStringOrMFStringValue());
            }
            else if (id == "geoOrigin")
            {
                X3DNode node = parser.ParseSFNodeValue();
                if (node != null)
                {
                    GeoOrigin = node as IX3DGeoOriginNode;
                    if (GeoOrigin == null)
                    {
                        parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line);
                    }
                }
            }
            else if (id == "geoSystem")
            {
                if (wasGeoSystem)
                {
                    GeoSystem.AddRange(parser.ParseSFStringOrMFStringValue());
                }
                else
                {
                    GeoSystem = parser.ParseSFStringOrMFStringValue();
                }
                wasGeoSystem = true;
            }
            else if (id == "range")
            {
                Range = parser.ParseDoubleValue();
            }
            else if (id == "rootUrl")
            {
                RootURL.AddRange(parser.ParseSFStringOrMFStringValue());
            }
            else if (id == "rootNode")
            {
                List <X3DNode> nodes = parser.ParseSFNodeOrMFNodeValue();
                foreach (X3DNode node in nodes)
                {
                    X3DChildNode rn = node as X3DChildNode;
                    if (rn == null)
                    {
                        parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line);
                    }
                    else
                    {
                        RootNode.Add(rn);
                    }
                }
            }
            else if (id == "bboxCenter")
            {
                BBoxCenter = parser.ParseSFVec3fValue();
            }
            else if (id == "bboxSize")
            {
                BBoxSize = parser.ParseSFVec3fValue();
            }
            else
            {
                return(false);
            }
            return(true);
        }