Пример #1
0
 public void Shutdown()
 {
     if (this._shutdown)
     {
         return;
     }
     this._shutdown = true;
     CommunityExpress.SteamUnityAPI_Shutdown();
 }
Пример #2
0
 public bool Initialize()
 {
     this._challengeResponse = new CommunityExpress.OnChallengeResponseFromSteam(this.OnChallengeResponseCallback);
     if (!CommunityExpress.SteamUnityAPI_Init(Marshal.GetFunctionPointerForDelegate((Delegate)this._challengeResponse)))
     {
         return(false);
     }
     this._steamAPIDebugTextHook = new CommunityExpress.OnSteamAPIDebugTextHook(this.OnSteamAPIDebugTextHookCallback);
     CommunityExpress.SteamUnityAPI_SetWarningMessageHook(Marshal.GetFunctionPointerForDelegate((Delegate)this._steamAPIDebugTextHook));
     this.ValidateLicense();
     return(true);
 }
Пример #3
0
        private void ValidateLicense()
        {
            string filename            = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "CESDKLicense.xml");
            uint   appId               = CommunityExpress.SteamUnityAPI_SteamUtils_GetAppID();
            string communityExpressSdk = Resources.CommunityExpressSDK;

            using (RSACryptoServiceProvider cryptoServiceProvider = new RSACryptoServiceProvider())
            {
                cryptoServiceProvider.FromXmlString(communityExpressSdk);
                XmlDocument document = new XmlDocument();
                document.Load(filename);
                SignedXml signedXml = new SignedXml(document);
                try
                {
                    XmlNode xmlNode = document.GetElementsByTagName("Signature", "http://www.w3.org/2000/09/xmldsig#")[0];
                    signedXml.LoadXml((XmlElement)xmlNode);
                }
                catch (Exception ex)
                {
                    throw new Exception("Error: no signature found.", ex);
                }
                if (!signedXml.CheckSignature((AsymmetricAlgorithm)cryptoServiceProvider))
                {
                    throw new Exception(string.Format("Error: License '{0}' invalid.", (object)filename));
                }
                try
                {
                    XmlNodeList elementsByTagName = document.GetElementsByTagName("AppId");
                    if (elementsByTagName == null || elementsByTagName.Count == 0 || string.IsNullOrEmpty(elementsByTagName[0].InnerText))
                    {
                        throw new Exception("AppId missing from license");
                    }
                    if (elementsByTagName[0].InnerText != appId.ToString())
                    {
                        throw new Exception(string.Format("AppId mismatch: {0} vs {1}", (object)elementsByTagName[0].InnerText, (object)appId));
                    }
                }
                catch (Exception ex)
                {
                    throw new Exception(string.Format("Error: License '{0}' invalid.", (object)filename), ex);
                }
            }
        }
Пример #4
0
        public void RunCallbacks()
        {
            CommunityExpress.SteamUnityAPI_RunCallbacks();
            if (this._gameserver != null && this._gameserver.IsInitialized)
            {
                CommunityExpress.SteamUnityAPI_SteamGameServer_RunCallbacks();
                for (int index = 0; index < this._gameserverUserStatsReceivedCallHandles.Count; ++index)
                {
                    ulong callHandle = this._gameserverUserStatsReceivedCallHandles[index];
                    byte  failed;
                    if (CommunityExpress.SteamUnityAPI_SteamUtils_IsAPICallCompleted(callHandle, out failed))
                    {
                        GSStatsReceived_t   result       = new GSStatsReceived_t();
                        UserStatsReceived_t CallbackData = new UserStatsReceived_t();
                        CommunityExpress.SteamUnityAPI_SteamUtils_GetGameServerUserStatsReceivedResult(callHandle, out result, out failed);
                        CallbackData.m_nGameID     = (ulong)CommunityExpress.SteamUnityAPI_SteamUtils_GetAppID();
                        CallbackData.m_steamIDUser = result.m_steamIDUser;
                        CallbackData.m_eResult     = result.m_eResult;
                        this._gameserverUserStatsReceivedCallbacks[index](ref CallbackData);
                        this._gameserverUserStatsReceivedCallHandles.RemoveAt(index);
                        this._gameserverUserStatsReceivedCallbacks.RemoveAt(index);
                        --index;
                    }
                }
            }
            if (this._networking != null && this._networking.IsInitialized)
            {
                this._networking.CheckForNewP2PPackets();
            }
            byte failed1;

            if ((long)this._userGetEncryptedAppTicketCallHandle != 0L && CommunityExpress.SteamUnityAPI_SteamUtils_IsAPICallCompleted(this._userGetEncryptedAppTicketCallHandle, out failed1))
            {
                this._userGetEncryptedAppTicketCallback();
                this._userGetEncryptedAppTicketCallHandle = 0UL;
            }
            byte failed2;

            if ((long)this._lobbyCreatedCallHandle != 0L && CommunityExpress.SteamUnityAPI_SteamUtils_IsAPICallCompleted(this._lobbyCreatedCallHandle, out failed2))
            {
                LobbyCreated_t result = new LobbyCreated_t();
                CommunityExpress.SteamUnityAPI_SteamUtils_GetLobbyCreatedResult(this._lobbyCreatedCallHandle, out result, out failed2);
                this._lobbyCreatedCallback(ref result);
                this._lobbyCreatedCallHandle = 0UL;
            }
            byte failed3;

            if ((long)this._lobbyListReceivedCallHandle != 0L && CommunityExpress.SteamUnityAPI_SteamUtils_IsAPICallCompleted(this._lobbyListReceivedCallHandle, out failed3))
            {
                LobbyMatchList_t result = new LobbyMatchList_t();
                CommunityExpress.SteamUnityAPI_SteamUtils_GetLobbyListReceivedResult(this._lobbyListReceivedCallHandle, out result, out failed3);
                this._lobbyListReceivedCallback(ref result);
                this._lobbyListReceivedCallHandle = 0UL;
            }
            byte failed4;

            if ((long)this._lobbyJoinedCallHandle == 0L || !CommunityExpress.SteamUnityAPI_SteamUtils_IsAPICallCompleted(this._lobbyJoinedCallHandle, out failed4))
            {
                return;
            }
            LobbyEnter_t result1 = new LobbyEnter_t();

            CommunityExpress.SteamUnityAPI_SteamUtils_GetLobbyEnteredResult(this._lobbyJoinedCallHandle, out result1, out failed4);
            this._lobbyJoinedCallback(ref result1);
            this._lobbyJoinedCallHandle = 0UL;
        }
Пример #5
0
 public void SetMiniDumpComment(string comment)
 {
     CommunityExpress.SteamUnityAPI_SetMiniDumpComment(comment);
 }
Пример #6
0
 public void WriteMiniDump(uint exceptionCode, IntPtr exceptionInfo, uint buildID)
 {
     CommunityExpress.SteamUnityAPI_WriteMiniDump(exceptionCode, exceptionInfo, buildID);
 }
Пример #7
0
 public bool RestartAppIfNecessary(uint unOwnAppID)
 {
     return(CommunityExpress.SteamUnityAPI_RestartAppIfNecessary(unOwnAppID));
 }