Ejemplo n.º 1
0
        public static Auth IsSteamAuth()
        {
            if (currentState == Auth.Good)
            {
                return(currentState);
            }
            try
            {
                PlatformServices.Initialize();
                var providerName = PlatformServices.ProviderName;
                if (providerName == "Epic")
                {
                    onAuthEvent?.Invoke(Auth.Good);
                    currentState = Auth.Good;
                    return(Auth.Good);
                }
                if (providerName == "Steam")
                {
                    var userid = PlatformServices.UserId;
                    //first web req
                    WebRequest request = WebRequest.Create($"https://steamcommunity.com/profiles/{userid}");

                    WebResponse response = request.GetResponse();
                    using (Stream dataStream = response.GetResponseStream())
                    {
                        // Open the stream using a StreamReader for easy access.
                        StreamReader reader             = new StreamReader(dataStream);
                        string       responseFromServer = reader.ReadToEnd();
                        if (responseFromServer.Contains("The specified profile could not be found."))
                        {
                            onAuthEvent?.Invoke(Auth.FailedByFoundPage);
                            return(Auth.FailedByFoundPage);
                        }
                    }
                    if (userid == "76561201195729065") //짱깨 id
                    {
                        onAuthEvent?.Invoke(Auth.FailedByKnownCrackID);
                        return(Auth.FailedByKnownCrackID);
                    }
                    else if (userid == "0")
                    {
                        onAuthEvent?.Invoke(Auth.FailedByOwnerShip);
                        return(Auth.FailedByOwnerShip);
                    }
                }
                currentState = Auth.Good;
                onAuthEvent?.Invoke(Auth.Good);

                return(Auth.Good);
            }
            catch (Exception e)
            {
                onAuthEvent?.Invoke(Auth.Unknown);
                return(Auth.Unknown);
            }
        }
Ejemplo n.º 2
0
        static void Initialize()
        {
            if (initialized)
            {
                return;
            }
            PlatformServices.Initialize();

            initialized = true;
        }
Ejemplo n.º 3
0
 Context(ContextType type)
 {
     PlatformServices.Initialize();
     this.type = type;
     if (screen_create_context(out handle, type) != 0)
     {
         // TODO: read errno to describe problem
         throw new Exception("Unable to create screen context");
     }
     screen_request_events(handle);
     eventDomain = screen_get_domain();
     PlatformServices.AddEventHandler(eventDomain, HandleEvent);
 }