SendMachineAuthResponse() public method

Sends a machine auth response. This should normally be used in response to a UpdateMachineAuthCallback.
public SendMachineAuthResponse ( MachineAuthDetails details ) : void
details MachineAuthDetails The details pertaining to the response.
return void
Exemplo n.º 1
0
        public void OnMachineAuth(SteamUser.UpdateMachineAuthCallback obj)
        {
            Console.WriteLine("[Steam] Writing sentry-file...");
            int sentrySize;

            byte[] sentryHash;


            using (var fs = File.Open("sentry.bin", FileMode.OpenOrCreate, FileAccess.ReadWrite))
            {
                fs.Seek(obj.Offset, SeekOrigin.Begin);
                fs.Write(obj.Data, 0, obj.BytesToWrite);
                sentrySize = (int)fs.Length;
                fs.Seek(0, SeekOrigin.Begin);
                using (var sha = SHA1.Create())
                    sentryHash = sha.ComputeHash(fs);
            }

            _user.SendMachineAuthResponse(new SteamUser.MachineAuthDetails()
            {
                JobID           = obj.JobID,
                FileName        = obj.FileName,
                BytesWritten    = obj.BytesToWrite,
                FileSize        = sentrySize,
                Offset          = obj.Offset,
                Result          = EResult.OK,
                LastError       = 0,
                OneTimePassword = obj.OneTimePassword,
                SentryFileHash  = sentryHash
            });

            Console.WriteLine("[Steam] Finished writing sentry-file!");
        }
Exemplo n.º 2
0
        void OnMachineAuth(SK.SteamUser.UpdateMachineAuthCallback callback)
        {
            Console.WriteLine("Updating sentryfile...");

            int fileSize;

            byte[] sentryHash;

            using (var fs = File.Open("sentry.bin", FileMode.OpenOrCreate, FileAccess.ReadWrite))
            {
                fs.Seek(callback.Offset, SeekOrigin.Begin);
                fs.Write(callback.Data, 0, callback.BytesToWrite);
                fileSize = (int)fs.Length;

                fs.Seek(0, SeekOrigin.Begin);
                using (var sha = SHA1.Create())
                {
                    sentryHash = sha.ComputeHash(fs);
                }
            }

            // inform the steam servers that we're accepting this sentry file
            steamUser.SendMachineAuthResponse(new SK.SteamUser.MachineAuthDetails
            {
                JobID           = callback.JobID,
                FileName        = callback.FileName,
                BytesWritten    = callback.BytesToWrite,
                FileSize        = fileSize,
                Offset          = callback.Offset,
                Result          = SK.EResult.OK,
                LastError       = 0,
                OneTimePassword = callback.OneTimePassword,
                SentryFileHash  = sentryHash,
            });
        }