示例#1
0
        // Application methods
        public static bool Initialize()
        {
            System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding();
            byte[] accessKey = encoding.GetBytes("39cf9714e24f421c8ca07b9bcb36c0f5" /*_AccessKey*/);
            byte[] secretKey = encoding.GetBytes("HA6zkS" /*_SecretKey*/);

            // Now initialize the common core
            gamespyCommon.gsCoreInitialize();
            gamespyAuth.wsSetGameCredentials(accessKey, _GameId, secretKey);
            gamespyAuth.WSLoginCallback myLoginCallback = new gamespyAuth.WSLoginCallback(loginCallback);
            gamespyAuth.wsLoginProfile(0, 0, 1, _NickName, _Email, _Password, _CdKey, myLoginCallback, IntPtr.Zero);

            while (respReceived == false)
            {
                gamespyCommon.gsCoreThink(0);
                Thread.Sleep(new TimeSpan(100000));
            }

            // Now Initialize SAKE
            SAKEStartupResult sakeResult = gamespySake.sakeStartup(ref sake);

            Console.WriteLine("Game authenticating with Sake");
            gamespySake.sakeSetGame(sake, "gmtest", 0, _SecretKey);
            gamespySake.sakeSetProfile(sake, (int)gameCertificate.mProfileId, ref gameCertificate, ref gamePrivateData);
            return(true);
        }
示例#2
0
        // Application methods
        public static bool Initialize()
        {
            System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding();
            byte[] accessKey = encoding.GetBytes(_AccessKey);
            byte[] secretKey = encoding.GetBytes(_SecretKey);

            // Now initialize the common core
            gamespyCommon.gsCoreInitialize();
            gamespyAuth.wsSetGameCredentials(accessKey, _GameId, secretKey);
            gamespyAuth.WSLoginCallback myLoginCallback = new gamespyAuth.WSLoginCallback(loginCallback);

            respReceived = false;
            gamespyAuth.wsLoginProfile(_GameId, _PartnerId, _NameSpace, _NickName, _Email, _Password, _CdKey, myLoginCallback, IntPtr.Zero);

            while (respReceived == false)
            {
                gamespyCommon.gsCoreThink(0);
                Thread.Sleep(new TimeSpan(100000));
            }

            if (authenticated)
            {
                //Now Initialize Atlas
                SCResult atlasResult = gamespyAtlas.scInitialize(_GameId, ref atlasInterface);
                if (atlasResult != SCResult.SCResult_NO_ERROR)
                {
                    Console.WriteLine("Atlas initialization failed {0} ", atlasResult);
                    return(false);
                }
                return(true);
            }
            else
            {
                return(false);
            }
        }