Ejemplo n.º 1
0
        public UnprotectedAccount(JsonAccounts.JsonAccount json) : base(json)
        {
            _log = LogCreator.Create("GC - " + json.Username + (!Titan.Instance.Options.Secure ? " (Unprotected)" : ""));

            _steamConfig = SteamConfiguration.Create(builder =>
            {
                builder.WithConnectionTimeout(TimeSpan.FromMinutes(1));
                //builder.WithWebAPIKey(Titan.Instance.WebHandle.GetKey()); Is null at time of this creation - needs fix
            });

            _steamClient     = new SteamClient(_steamConfig);
            _callbacks       = new CallbackManager(_steamClient);
            _steamUser       = _steamClient.GetHandler <SteamUser>();
            _steamFriends    = _steamClient.GetHandler <SteamFriends>();
            _gameCoordinator = _steamClient.GetHandler <SteamGameCoordinator>();

            _titanHandle = new TitanHandler();
            _steamClient.AddHandler(_titanHandle);

            // Initialize debug network sniffer when debug mode is enabled
            if (Titan.Instance.Options.Debug)
            {
                var dir = new DirectoryInfo(Path.Combine(Titan.Instance.DebugDirectory.ToString(), json.Username));
                if (!dir.Exists)
                {
                    dir.Create();
                }

                _steamClient.DebugNetworkListener = new NetHookNetworkListener(
                    dir.ToString()
                    );
            }

            _log.Debug("Successfully initialized account object for {Username}.", json.Username);
        }
Ejemplo n.º 2
0
        public ProtectedAccount(JsonAccounts.JsonAccount json) : base(json)
        {
            _log = LogCreator.Create("GC - " + json.Username + (!Titan.Instance.Options.Secure ? " (Protected)" : ""));

            _steamConfig = SteamConfiguration.Create(builder =>
            {
                builder.WithConnectionTimeout(TimeSpan.FromMinutes(1));

                var key = Titan.Instance.WebHandle.GetKey();

                if (!string.IsNullOrEmpty(key))
                {
                    builder.WithWebAPIKey(key);
                    _log.Debug("Initializing with preloaded API key.");
                }
                else
                {
                    _log.Debug("Initializing without API key.");
                }
            });

            _sentry   = new Sentry.Sentry(this);
            _loginKey = new LoginKey(this);

            _steamClient     = new SteamClient(_steamConfig);
            _callbacks       = new CallbackManager(_steamClient);
            _steamUser       = _steamClient.GetHandler <SteamUser>();
            _steamFriends    = _steamClient.GetHandler <SteamFriends>();
            _gameCoordinator = _steamClient.GetHandler <SteamGameCoordinator>();

            // This clause excludes SteamKit debug mode as that mode is handeled seperately.
            // Normal debug mode doesn't equal SteamKit debug mode.
            if (Titan.Instance.Options.Debug)
            {
                _titanHandle = new TitanHandler();
                _steamClient.AddHandler(_titanHandle);

                // Initialize debug network sniffer when debug mode is enabled
                var dir = new DirectoryInfo(Path.Combine(Titan.Instance.DebugDirectory.ToString(), json.Username));
                if (!dir.Exists)
                {
                    dir.Create();
                }

                _steamClient.DebugNetworkListener = new NetHookNetworkListener(
                    dir.ToString()
                    );
            }

            if (!string.IsNullOrWhiteSpace(JsonAccount.SharedSecret))
            {
                _sharedSecretGenerator = new SharedSecret(this);
            }

            _log.Debug("Successfully initialized account object for " + json.Username + ".");
        }
Ejemplo n.º 3
0
        public ProtectedAccount(JsonAccounts.JsonAccount json) : base(json)
        {
            _log = LogCreator.Create("GC - " + json.Username + (!Titan.Instance.Options.Secure ? " (Protected)" : ""));

            _steamConfig = new SteamConfiguration
            {
                ConnectionTimeout = TimeSpan.FromMinutes(3),
                WebAPIKey         = Titan.Instance.WebHandle.GetKey() // May be null at this time, but we can accept that for now
            };

            _sentry = new Sentry.Sentry(this);

            _steamClient     = new SteamClient(_steamConfig);
            _callbacks       = new CallbackManager(_steamClient);
            _steamUser       = _steamClient.GetHandler <SteamUser>();
            _steamFriends    = _steamClient.GetHandler <SteamFriends>();
            _gameCoordinator = _steamClient.GetHandler <SteamGameCoordinator>();

            _titanHandle = new TitanHandler();
            _steamClient.AddHandler(_titanHandle);

            // Initialize debug network sniffer when debug mode is enabled
            if (Titan.Instance.Options.Debug)
            {
                var dir = new DirectoryInfo(Path.Combine(Titan.Instance.DebugDirectory.ToString(), json.Username));
                if (!dir.Exists)
                {
                    dir.Create();
                }

                _steamClient.DebugNetworkListener = new NetHookNetworkListener(
                    dir.ToString()
                    );
            }

            if (json.SharedSecret != null)
            {
                _sgAccount = new SteamGuardAccount
                {
                    SharedSecret = json.SharedSecret
                };
            }

            _log.Debug("Successfully initialized account object for " + json.Username + ".");
        }
Ejemplo n.º 4
0
        public UnprotectedAccount(JsonAccounts.JsonAccount json) : base(json)
        {
            _log = LogCreator.Create("GC - " + json.Username + (!Titan.Instance.Options.Secure ? " (Unprotected)" : ""));

            _steamConfig = new SteamConfiguration
            {
                ConnectionTimeout = TimeSpan.FromMinutes(1),
                WebAPIKey         = Titan.Instance.WebHandle.GetKey() // May be null at this time, but we can accept that for now
            };

            _steamClient     = new SteamClient(_steamConfig);
            _callbacks       = new CallbackManager(_steamClient);
            _steamUser       = _steamClient.GetHandler <SteamUser>();
            _steamFriends    = _steamClient.GetHandler <SteamFriends>();
            _gameCoordinator = _steamClient.GetHandler <SteamGameCoordinator>();

            _titanHandle = new TitanHandler();
            _steamClient.AddHandler(_titanHandle);

            // Initialize debug network sniffer when debug mode is enabled
            if (Titan.Instance.Options.Debug)
            {
                var dir = new DirectoryInfo(Path.Combine(Titan.Instance.DebugDirectory.ToString(), json.Username));
                if (!dir.Exists)
                {
                    dir.Create();
                }

                _steamClient.DebugNetworkListener = new NetHookNetworkListener(
                    dir.ToString()
                    );
            }

            Job = JobBuilder.Create <UnprotectedAccount>()
                  .WithIdentity("Idle Job - " + json.Username + " (Unprotected)", "Titan")
                  .Build();

            _log.Debug("Successfully initialized account object for {Username}.", json.Username);
        }