• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# SteamKit2.SteamUser类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中SteamKit2.SteamUser的典型用法代码示例。如果您正苦于以下问题:C# SteamUser类的具体用法?C# SteamUser怎么用?C# SteamUser使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



SteamUser类属于SteamKit2命名空间,在下文中一共展示了SteamUser类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Bot

		public Bot(Configuration.BotInfo config, string apiKey, bool debug = false) {
			sql = new Sql();

			Username = config.Username;
			Password = config.Password;
			DisplayName = config.DisplayName;
			Admins = config.Admins;
			id = config.Id;
			this.apiKey = apiKey;

			TradeListener = new ScrapTrade(this);
			TradeListenerInternal = new ExchangeTrade(this);
			TradeListenerAdmin = new AdminTrade(this);

			List<object[]> result = sql.query("SELECT text, response FROM responses");
			foreach (object[] row in result) {
				responses.Add(((string) row[0]).ToLower(), (string) row[1]);
			}

			// Hacking around https
			ServicePointManager.ServerCertificateValidationCallback += SteamWeb.ValidateRemoteCertificate;

			SteamClient = new SteamClient();
			SteamTrade = SteamClient.GetHandler<SteamTrading>();
			SteamUser = SteamClient.GetHandler<SteamUser>();
			SteamFriends = SteamClient.GetHandler<SteamFriends>();
			queueHandler = new QueueHandler(this);

			SteamClient.Connect();

			while (true) {
				Update();
			}
		}
开发者ID:Top-Cat,项目名称:SteamBot,代码行数:34,代码来源:Bot.cs


示例2: LogIn

        static void LogIn()
        {
            steamClient = new SteamClient();
            callbackManager = new CallbackManager(steamClient);
            steamUser = steamClient.GetHandler<SteamUser>();
            steamFriends = steamClient.GetHandler<SteamFriends>();
            steamTrading = steamClient.GetHandler<SteamTrading>();
            new Callback<SteamClient.ConnectedCallback>(OnConnect,callbackManager);
            new Callback<SteamUser.LoggedOnCallback>(OnLoggedOn, callbackManager);
            new Callback<SteamUser.UpdateMachineAuthCallback>(OnMachineAuth, callbackManager);
            new Callback<SteamClient.DisconnectedCallback>(OnDisconnected, callbackManager);
            new Callback<SteamUser.AccountInfoCallback>(OnAccountInfo, callbackManager);
            new Callback<SteamFriends.FriendMsgCallback>(OnChatMessage, callbackManager);
            new Callback<SteamFriends.FriendsListCallback>(OnFriendInvite, callbackManager);
            new Callback<SteamTrading.TradeProposedCallback>(OnTradeOffer, callbackManager);
            new Callback<SteamTrading.SessionStartCallback>(OnTradeWindow, callbackManager);
            new Callback<SteamTrading.TradeResultCallback>(OnTradeResult, callbackManager);

            isRunning = true;

            Console.WriteLine("Attempting to connect to steam...");

            steamClient.Connect();

            while(isRunning)
            {
                callbackManager.RunWaitCallbacks(TimeSpan.FromSeconds(1));
            }
            Console.ReadKey();
        }
开发者ID:Hydromaniaccat,项目名称:SteamBot,代码行数:30,代码来源:Program.cs


示例3: SteamBot

        public SteamBot(string newUser, string newPass)
        {
            // Bot user and password
            user = newUser;
            pass = newPass;

            // create our steamclient instance
            steamClient = new SteamClient( System.Net.Sockets.ProtocolType.Tcp );
            // create the callback manager which will route callbacks to function calls
            manager = new CallbackManager( steamClient );

            // get the steamuser handler, which is used for logging on after successfully connecting
            steamUser = steamClient.GetHandler<SteamUser>();
            // get the steam friends handler, which is used for interacting with friends on the network after logging on
            steamFriends = steamClient.GetHandler<SteamFriends>();

            // register a few callbacks we're interested in
            // these are registered upon creation to a callback manager, which will then route the callbacks
            // to the functions specified
            new Callback<SteamClient.ConnectedCallback>( OnConnected, manager );
            new Callback<SteamClient.DisconnectedCallback>( OnDisconnected, manager );

            new Callback<SteamUser.LoggedOnCallback>( OnLoggedOn, manager );

            // we use the following callbacks for friends related activities
            new Callback<SteamUser.AccountInfoCallback>( OnAccountInfo, manager );
            new Callback<SteamFriends.FriendsListCallback>( OnFriendsList, manager );
            new Callback<SteamFriends.FriendMsgCallback> (OnFriendMessage, manager);

            // initiate the connection
            steamClient.Connect();

            // Make sure the main loop runs
            isRunning = true;
        }
开发者ID:natehak,项目名称:SteamGroupChatBot,代码行数:35,代码来源:SteamBot.cs


示例4: OnMarketingMessage

        public static void OnMarketingMessage(SteamUser.MarketingMessageCallback callback)
        {
            foreach (var message in callback.Messages)
            {
                // TODO: Move this query outside this loop
                using (MySqlDataReader Reader = DbWorker.ExecuteReader("SELECT `ID` FROM `MarketingMessages` WHERE `ID` = @ID", new MySqlParameter("ID", message.ID)))
                {
                    if (Reader.Read())
                    {
                        continue;
                    }
                }

                if (message.Flags == EMarketingMessageFlags.None)
                {
                    IRC.SendMain("New marketing message:{0} {1}", Colors.DARK_BLUE, message.URL);
                }
                else
                {
                    IRC.SendMain("New marketing message:{0} {1} {2}({3})", Colors.DARK_BLUE, message.URL, Colors.DARK_GRAY, message.Flags.ToString().Replace("Platform", string.Empty));
                }

                DbWorker.ExecuteNonQuery("INSERT INTO `MarketingMessages` (`ID`, `Flags`) VALUES (@ID, @Flags)",
                                         new MySqlParameter("@ID", message.ID),
                                         new MySqlParameter("@Flags", message.Flags)
                );
            }
        }
开发者ID:ZR2,项目名称:SteamDatabaseBackend,代码行数:28,代码来源:MarketingHandler.cs


示例5: Login

        private static void Login()
        {
            steamClient = new SteamClient();
            callBackManager = new CallbackManager(steamClient);
            steamFriends = steamClient.GetHandler<SteamFriends>();
            steamUser = steamClient.GetHandler<SteamUser>();

            callBackManager.Subscribe<SteamClient.ConnectedCallback>(OnConnected);
            callBackManager.Subscribe<SteamUser.LoggedOnCallback>(OnLoggedIn);
            callBackManager.Subscribe<SteamUser.UpdateMachineAuthCallback>(OnMachineAuth);
            callBackManager.Subscribe<SteamClient.DisconnectedCallback>(OnDisconnected);
            callBackManager.Subscribe<SteamFriends.FriendMsgCallback>(OnMsgRecieved);
            callBackManager.Subscribe<SteamUser.AccountInfoCallback>(OnAccountInfo);
            callBackManager.Subscribe<SteamFriends.FriendsListCallback>(OnFriendsList);
            callBackManager.Subscribe<SteamFriends.FriendAddedCallback>(OnFriendAdded);
            callBackManager.Subscribe<SteamFriends.PersonaStateCallback>(OnFriendPersonaChange);

            SteamDirectory.Initialize().Wait();
            steamClient.Connect();

            isRunning = true;

            while (isRunning)
            {
                callBackManager.RunWaitCallbacks(TimeSpan.FromSeconds(0.5));
            }

            Console.ReadKey();
        }
开发者ID:anthony-y,项目名称:bot-anthony,代码行数:29,代码来源:BOT.cs


示例6: LobbyBot

        /// <summary>
        ///     Setup a new bot with some details.
        /// </summary>
        /// <param name="details"></param>
        /// <param name="extensions">any extensions you want on the state machine.</param>
        public LobbyBot(SteamUser.LogOnDetails details, params IExtension<States, Events>[] extensions)
        {
            reconnect = true;
            this.details = details;

            log = LogManager.GetLogger("LobbyBot " + details.Username);
            log.Debug("Initializing a new LobbyBot, username: " + details.Username);
            reconnectTimer.Elapsed += (sender, args) =>
            {
                reconnectTimer.Stop();
                fsm.Fire(Events.AttemptReconnect);
            };
            fsm = new ActiveStateMachine<States, Events>();
            foreach (var ext in extensions) fsm.AddExtension(ext);
            fsm.DefineHierarchyOn(States.Connecting)
                .WithHistoryType(HistoryType.None);
            fsm.DefineHierarchyOn(States.Connected)
                .WithHistoryType(HistoryType.None)
                .WithInitialSubState(States.Dota);
            fsm.DefineHierarchyOn(States.Dota)
                .WithHistoryType(HistoryType.None)
                .WithInitialSubState(States.DotaConnect)
                .WithSubState(States.DotaMenu)
                .WithSubState(States.DotaLobby);
            fsm.DefineHierarchyOn(States.Disconnected)
                .WithHistoryType(HistoryType.None)
                .WithInitialSubState(States.DisconnectNoRetry)
                .WithSubState(States.DisconnectRetry);
            fsm.DefineHierarchyOn(States.DotaLobby)
                .WithHistoryType(HistoryType.None);
            fsm.In(States.Connecting)
                .ExecuteOnEntry(InitAndConnect)
                .On(Events.Connected).Goto(States.Connected)
                .On(Events.Disconnected).Goto(States.DisconnectRetry)
                .On(Events.LogonFailSteamDown).Execute(SteamIsDown)
                .On(Events.LogonFailSteamGuard).Goto(States.DisconnectNoRetry) //.Execute(() => reconnect = false)
                .On(Events.LogonFailBadCreds).Goto(States.DisconnectNoRetry);
            fsm.In(States.Connected)
                .ExecuteOnExit(DisconnectAndCleanup)
                .On(Events.Disconnected).If(ShouldReconnect).Goto(States.Connecting)
                .Otherwise().Goto(States.Disconnected);
            fsm.In(States.Disconnected)
                .ExecuteOnEntry(DisconnectAndCleanup)
                .ExecuteOnExit(ClearReconnectTimer)
                .On(Events.AttemptReconnect).Goto(States.Connecting);
            fsm.In(States.DisconnectRetry)
                .ExecuteOnEntry(StartReconnectTimer);
            fsm.In(States.Dota)
                .ExecuteOnExit(DisconnectDota);
            fsm.In(States.DotaConnect)
                .ExecuteOnEntry(ConnectDota)
                .On(Events.DotaGCReady).Goto(States.DotaMenu);
            fsm.In(States.DotaMenu)
                .ExecuteOnEntry(SetOnlinePresence);
            fsm.In(States.DotaLobby)
                .ExecuteOnEntry(EnterLobbyChat)
                .ExecuteOnEntry(EnterBroadcastChannel)
                .On(Events.DotaLeftLobby).Goto(States.DotaMenu).Execute(LeaveChatChannel);
            fsm.Initialize(States.Connecting);
        }
开发者ID:mar5,项目名称:Dota2LobbyDump,代码行数:65,代码来源:Bot.cs


示例7: SteamConnection

        public SteamConnection(IntPtr ic)
        {
            this.ic = ic;

            client = new SteamClient();

            friends = client.GetHandler<SteamFriends>();
            user = client.GetHandler<SteamUser>();
        }
开发者ID:chpatrick,项目名称:BitlSteam,代码行数:9,代码来源:SteamConnection.cs


示例8: Initialize

        public static void Initialize( bool useUdp )
        {
            Console.WriteLine ("Server now running on: ");

            SteamClient = new SteamClient( useUdp ? ProtocolType.Udp : ProtocolType.Tcp );

            SteamFriends = SteamClient.GetHandler<SteamFriends>();
            SteamUser = SteamClient.GetHandler<SteamUser>();
        }
开发者ID:scottkf,项目名称:sendmessage,代码行数:9,代码来源:SteamContext.cs


示例9: OnAccountInfo

        private static void OnAccountInfo(SteamUser.AccountInfoCallback callback)
        {
            Steam.Instance.Friends.SetPersonaState(EPersonaState.Busy);

            foreach (var chatRoom in Settings.Current.ChatRooms)
            {
                Steam.Instance.Friends.JoinChat(chatRoom);
            }
        }
开发者ID:RJacksonm1,项目名称:SteamDatabaseBackend,代码行数:9,代码来源:AccountInfo.cs


示例10: Main

        static void Main( string[] args )
        {
            // install our debug listeners for this example

            // install an instance of our custom listener
            DebugLog.AddListener( new MyListener() );

            // install a listener as an anonymous method
            // this call is commented as it would be redundant to install a second listener that also displays messages to the console
            // DebugLog.AddListener( ( category, msg ) => Console.WriteLine( "AnonymousMethod - {0}: {1}", category, msg ) );
            
            // Enable DebugLog in release builds
            DebugLog.Enabled = true;

            if ( args.Length < 2 )
            {
                Console.WriteLine( "Sample4: No username and password specified!" );
                return;
            }

            // save our logon details
            user = args[ 0 ];
            pass = args[ 1 ];

            // create our steamclient instance
            steamClient = new SteamClient();
            // create the callback manager which will route callbacks to function calls
            manager = new CallbackManager( steamClient );

            // get the steamuser handler, which is used for logging on after successfully connecting
            steamUser = steamClient.GetHandler<SteamUser>();

            // register a few callbacks we're interested in
            // these are registered upon creation to a callback manager, which will then route the callbacks
            // to the functions specified
            new Callback<SteamClient.ConnectedCallback>( OnConnected, manager );
            new Callback<SteamClient.DisconnectedCallback>( OnDisconnected, manager );

            new Callback<SteamUser.LoggedOnCallback>( OnLoggedOn, manager );
            new Callback<SteamUser.LoggedOffCallback>( OnLoggedOff, manager );

            isRunning = true;

            Console.WriteLine( "Connecting to Steam..." );

            // initiate the connection
            steamClient.Connect();

            // create our callback handling loop
            while ( isRunning )
            {
                // in order for the callbacks to get routed, they need to be handled by the manager
                manager.RunWaitCallbacks( TimeSpan.FromSeconds( 1 ) );
            }
        }
开发者ID:Badca52,项目名称:SteamKit,代码行数:55,代码来源:Program.cs


示例11: Main

		static void Main(string[] args) {
			// Print program information.
			Console.WriteLine("SteamIdler, 'run' games without steam.\n(C) No STEAMGUARD Support");

			// Check for username and password arguments from stdin.
			if (args.Length < 3) {
				// Print usage and quit.
				Console.WriteLine("usage: <username> <password> <appID> [...]");
				return;
			}

			// Set username and password from stdin.
			Username = args[0];
			Password = args[1];

			// Add all game application IDs to list.
			foreach (string GameAppID in args) {
				int AppID;

				if (int.TryParse(GameAppID, out AppID)) {
					AppIDs.Add(Convert.ToInt32(GameAppID));
				}
			}

			// Create SteamClient interface and CallbackManager.
			steamClient = new SteamClient(System.Net.Sockets.ProtocolType.Tcp);
			manager = new CallbackManager(steamClient);

			// Get the steamuser handler, which is used for logging on after successfully connecting.
			steamUser = steamClient.GetHandler<SteamUser>();

			// Get the steam friends handler, which is used for interacting with friends on the network after logging on.
			steamFriends = steamClient.GetHandler<SteamFriends>();

			// Register Steam callbacks.
			new Callback<SteamClient.ConnectedCallback>(OnConnected, manager);
			new Callback<SteamClient.DisconnectedCallback>(OnDisconnected, manager);
			new Callback<SteamUser.LoggedOnCallback>(OnLoggedOn, manager);
			new Callback<SteamUser.LoggedOffCallback>(OnLoggedOff, manager);
			new Callback<SteamUser.AccountInfoCallback>(OnAccountInfo, manager);

			// Set the program as running.
			Console.WriteLine(":: Connecting to Steam..");
			isRunning = true;

			// Connect to Steam.
			steamClient.Connect();

			// Create our callback handling loop.
			while (isRunning) {
				// In order for the callbacks to get routed, they need to be handled by the manager.
				manager.RunWaitCallbacks(TimeSpan.FromSeconds(1));
			}
		}
开发者ID:AdamWebb1,项目名称:IdlerTesting,代码行数:54,代码来源:Program.cs


示例12: Bot

        public Bot(Configuration.BotInfo config, string apiKey, bool debug = false)
        {
            Username     = config.Username;
            Password     = config.Password;
            DisplayName  = config.DisplayName;
            ChatResponse = config.ChatResponse;
            Admins       = config.Admins;
            this.apiKey  = apiKey;
            AuthCode     = null;

            TradeListener = new TradeEnterTradeListener(this);

            // Hacking around https
            ServicePointManager.ServerCertificateValidationCallback += SteamWeb.ValidateRemoteCertificate;

            SteamClient = new SteamClient();
            SteamTrade = SteamClient.GetHandler<SteamTrading>();
            SteamUser = SteamClient.GetHandler<SteamUser>();
            SteamFriends = SteamClient.GetHandler<SteamFriends>();

            SteamClient.Connect();

            Thread CallbackThread = new Thread(() => // Callback Handling
                       {
                while (true)
                {
                    CallbackMsg msg = SteamClient.WaitForCallback (true);
                    HandleSteamMessage (msg);
                }
            });

            new Thread(() => // Trade Polling if needed
                       {
                while (true)
                {
                    Thread.Sleep (800);
                    if (CurrentTrade != null)
                    {
                        try
                        {
                            CurrentTrade.Poll ();
                        }
                        catch (Exception e)
                        {
                            Console.Write ("Error polling the trade: ");
                            Console.WriteLine (e);
                        }
                    }
                }
            }).Start ();

            CallbackThread.Start();
            CallbackThread.Join();
        }
开发者ID:borewik,项目名称:SteamBot,代码行数:54,代码来源:Bot.cs


示例13: OnLoggedOn

        private void OnLoggedOn(SteamUser.LoggedOnCallback callback)
        {
            if (callback.Result != EResult.OK)
            {
                return;
            }

            WebAPIUserNonce = callback.WebAPIUserNonce;

            TaskManager.Run(() => AuthenticateUser());
        }
开发者ID:qyh214,项目名称:SteamDatabaseBackend,代码行数:11,代码来源:WebAuth.cs


示例14: Main

        static void Main( string[] args )
        {
            if ( args.Length < 2 )
            {
                Console.WriteLine( "Sample8: No username and password specified!" );
                return;
            }

            // save our logon details
            user = args[0];
            pass = args[1];

            // create our steamclient instance
            steamClient = new SteamClient();
            // create the callback manager which will route callbacks to function calls
            manager = new CallbackManager( steamClient );

            // get the steamuser handler, which is used for logging on after successfully connecting
            steamUser = steamClient.GetHandler<SteamUser>();

            // get the steam unified messages handler, which is used for sending and receiving responses from the unified service api
            steamUnifiedMessages = steamClient.GetHandler<SteamUnifiedMessages>();

            // we also want to create our local service interface, which will help us build requests to the unified api
            playerService = steamUnifiedMessages.CreateService<IPlayer>();


            // register a few callbacks we're interested in
            // these are registered upon creation to a callback manager, which will then route the callbacks
            // to the functions specified
            manager.Subscribe<SteamClient.ConnectedCallback>( OnConnected );
            manager.Subscribe<SteamClient.DisconnectedCallback>( OnDisconnected );

            manager.Subscribe<SteamUser.LoggedOnCallback>( OnLoggedOn );
            manager.Subscribe<SteamUser.LoggedOffCallback>( OnLoggedOff );

            // we use the following callbacks for unified service responses
            manager.Subscribe<SteamUnifiedMessages.ServiceMethodResponse>( OnMethodResponse );

            isRunning = true;

            Console.WriteLine( "Connecting to Steam..." );

            // initiate the connection
            steamClient.Connect();

            // create our callback handling loop
            while ( isRunning )
            {
                // in order for the callbacks to get routed, they need to be handled by the manager
                manager.RunWaitCallbacks( TimeSpan.FromSeconds( 1 ) );
            }
        }
开发者ID:Zaharkov,项目名称:SteamKit,代码行数:53,代码来源:Program.cs


示例15: Main

        static void Main(string[] args)
        {
            Logger.filename = "RelayBot.log";
            log = Logger.GetLogger();

            steamClient = new SteamClient(System.Net.Sockets.ProtocolType.Tcp);
            manager = new CallbackManager(steamClient);

            steamUser = steamClient.GetHandler<SteamUser>();
            steamFriends = steamClient.GetHandler<SteamFriends>();

            bot = new Bot(steamUser, steamFriends, steamClient);

            manager.Subscribe<SteamClient.ConnectedCallback>(bot.OnConnected);
            manager.Subscribe<SteamClient.DisconnectedCallback>(bot.OnDisconnected);

            manager.Subscribe<SteamUser.LoggedOnCallback>(bot.OnLoggedOn);
            manager.Subscribe<SteamUser.LoggedOffCallback>(bot.OnLoggedOff);

            manager.Subscribe<SteamUser.AccountInfoCallback>(bot.OnAccountInfo);
            manager.Subscribe<SteamFriends.FriendsListCallback>(bot.OnFriendsList);
            manager.Subscribe<SteamFriends.FriendAddedCallback>(bot.OnFriendAdded);

            manager.Subscribe<SteamFriends.ChatInviteCallback>(bot.OnChatInvite);
            manager.Subscribe<SteamFriends.ChatEnterCallback>(bot.OnChatEnter);
            manager.Subscribe<SteamFriends.FriendMsgCallback>(bot.OnFriendMessage);

            manager.Subscribe<SteamFriends.ChatMsgCallback>(bot.OnChatroomMessage);
            manager.Subscribe<SteamFriends.ChatMemberInfoCallback>(bot.OnMemberInfo);

            manager.Subscribe<SteamUser.UpdateMachineAuthCallback>(bot.OnMachineAuth);

            bot.isRunning = true;

            log.Info("Connecting to Steam...");

            steamClient.Connect();

            //callback loop

            while (bot.isRunning)
            {
                try
                {
                    manager.RunWaitCallbacks(TimeSpan.FromSeconds(1));
                }
                catch (Exception e)
                {
                    Logger.filename = "RelayBot.log";
                    log.Error(String.Format("Caught exception: {0}\nMessage: {1}\nStack trace: {2}", e.GetType().ToString(), e.Message, e.StackTrace));
                }
            }
        }
开发者ID:nukeop,项目名称:SteamRelayBot,代码行数:53,代码来源:Program.cs


示例16: Steam3Session

        public Steam3Session( SteamUser.LogOnDetails details )
        {
            this.logonDetails = details;

            this.authenticatedUser = details.Username != null;
            this.credentials = new Credentials();
            this.bConnected = false;
            this.bConnecting = false;
            this.bAborted = false;
            this.seq = 0;

            this.AppTickets = new Dictionary<uint, byte[]>();
            this.AppTokens = new Dictionary<uint, ulong>();
            this.DepotKeys = new Dictionary<uint, byte[]>();
            this.CDNAuthTokens = new Dictionary<Tuple<uint, string>, SteamApps.CDNAuthTokenCallback>();
            this.AppInfo = new Dictionary<uint, SteamApps.PICSProductInfoCallback.PICSProductInfo>();
            this.PackageInfo = new Dictionary<uint, SteamApps.PICSProductInfoCallback.PICSProductInfo>();

            this.steamClient = new SteamClient();

            this.steamUser = this.steamClient.GetHandler<SteamUser>();
            this.steamApps = this.steamClient.GetHandler<SteamApps>();

            this.callbacks = new CallbackManager(this.steamClient);

            this.callbacks.Subscribe<SteamClient.ConnectedCallback>(ConnectedCallback);
            this.callbacks.Subscribe<SteamClient.DisconnectedCallback>(DisconnectedCallback);
            this.callbacks.Subscribe<SteamUser.LoggedOnCallback>(LogOnCallback);
            this.callbacks.Subscribe<SteamUser.SessionTokenCallback>(SessionTokenCallback);
            this.callbacks.Subscribe<SteamApps.LicenseListCallback>(LicenseListCallback);
            this.callbacks.Subscribe<SteamUser.UpdateMachineAuthCallback>(UpdateMachineAuthCallback);

            Console.Write( "Connecting to Steam3..." );

            if ( authenticatedUser )
            {
                FileInfo fi = new FileInfo(String.Format("{0}.sentryFile", logonDetails.Username));
                if (ConfigStore.TheConfig.SentryData != null && ConfigStore.TheConfig.SentryData.ContainsKey(logonDetails.Username))
                {
                    logonDetails.SentryFileHash = Util.SHAHash(ConfigStore.TheConfig.SentryData[logonDetails.Username]);
                }
                else if (fi.Exists && fi.Length > 0)
                {
                    var sentryData = File.ReadAllBytes(fi.FullName);
                    logonDetails.SentryFileHash = Util.SHAHash(sentryData);
                    ConfigStore.TheConfig.SentryData[logonDetails.Username] = sentryData;
                    ConfigStore.Save();
                }
            }

            Connect();
        }
开发者ID:blide,项目名称:DepotDownloader,代码行数:52,代码来源:Steam3Session.cs


示例17: Main

        static void Main( string[] args )
        {
            if ( args.Length < 2 )
            {
                Console.WriteLine( "Sample3: No username and password specified!" );
                return;
            }

            // save our logon details
            user = args[ 0 ];
            pass = args[ 1 ];

            // create our steamclient instance
            steamClient = new SteamClient();

            // add our custom handler to our steamclient
            steamClient.AddHandler( new MyHandler() );

            // create the callback manager which will route callbacks to function calls
            manager = new CallbackManager( steamClient );

            // get the steamuser handler, which is used for logging on after successfully connecting
            steamUser = steamClient.GetHandler<SteamUser>();
            // now get an instance of our custom handler
            myHandler = steamClient.GetHandler<MyHandler>();

            // register a few callbacks we're interested in
            // these are registered upon creation to a callback manager, which will then route the callbacks
            // to the functions specified
            new Callback<SteamClient.ConnectedCallback>( OnConnected, manager );
            new Callback<SteamClient.DisconnectedCallback>( OnDisconnected, manager );

            new Callback<SteamUser.LoggedOnCallback>( OnLoggedOn, manager );
            new Callback<SteamUser.LoggedOffCallback>( OnLoggedOff, manager );

            // handle our own custom callback
            new Callback<MyHandler.MyCallback>( OnMyCallback, manager );

            isRunning = true;

            Console.WriteLine( "Connecting to Steam..." );

            // initiate the connection
            steamClient.Connect();

            // create our callback handling loop
            while ( isRunning )
            {
                // in order for the callbacks to get routed, they need to be handled by the manager
                manager.RunWaitCallbacks( TimeSpan.FromSeconds( 1 ) );
            }
        }
开发者ID:trader514,项目名称:SteamKit,代码行数:52,代码来源:Program.cs


示例18: OnWebAPIUserNonce

        private void OnWebAPIUserNonce(SteamUser.WebAPIUserNonceCallback callback)
        {
            if (callback.Result != EResult.OK)
            {
                Log.WriteWarn("WebAuth", "Unable to get user nonce: {0}", callback.Result);

                // TODO: Should keep trying?

                return;
            }

            WebAPIUserNonce = callback.Nonce;
        }
开发者ID:qyh214,项目名称:SteamDatabaseBackend,代码行数:13,代码来源:WebAuth.cs


示例19: Main

        static void Main( string[] args )
        {
            if ( args.Length < 2 )
            {
                Console.WriteLine( "Sample5: No username and password specified!" );
                return;
            }

            // save our logon details
            user = args[ 0 ];
            pass = args[ 1 ];

            // create our steamclient instance
            steamClient = new SteamClient( System.Net.Sockets.ProtocolType.Tcp );
            // create the callback manager which will route callbacks to function calls
            manager = new CallbackManager( steamClient );

            // get the steamuser handler, which is used for logging on after successfully connecting
            steamUser = steamClient.GetHandler<SteamUser>();
            // get the steam friends handler, which is used for interacting with friends on the network after logging on
            steamFriends = steamClient.GetHandler<SteamFriends>();

            // register a few callbacks we're interested in
            // these are registered upon creation to a callback manager, which will then route the callbacks
            // to the functions specified
            new Callback<SteamClient.ConnectedCallback>( OnConnected, manager );
            new Callback<SteamClient.DisconnectedCallback>( OnDisconnected, manager );

            new Callback<SteamUser.LoggedOnCallback>( OnLoggedOn, manager );
            new Callback<SteamUser.LoggedOffCallback>( OnLoggedOff, manager );

            // we use the following callbacks for friends related activities
            new Callback<SteamUser.AccountInfoCallback>( OnAccountInfo, manager );
            new Callback<SteamFriends.FriendsListCallback>( OnFriendsList, manager );
            new Callback<SteamFriends.PersonaStateCallback>( OnPersonaState, manager );
            new Callback<SteamFriends.FriendAddedCallback>( OnFriendAdded, manager );

            isRunning = true;

            Console.WriteLine( "Connecting to Steam..." );

            // initiate the connection
            steamClient.Connect( false );

            // create our callback handling loop
            while ( isRunning )
            {
                // in order for the callbacks to get routed, they need to be handled by the manager
                manager.RunWaitCallbacks( TimeSpan.FromSeconds( 1 ) );
            }
        }
开发者ID:wheybags,项目名称:steamirc,代码行数:51,代码来源:Program.cs


示例20: OnLoginKey

        void OnLoginKey(SteamUser.LoginKeyCallback callback)
        {
            string SessionID = WebHelpers.EncodeBase64(callback.UniqueID.ToString());

            using (dynamic userAuth = WebAPI.GetInterface("ISteamUserAuth"))
            {
                // generate an AES session key
                var sessionKey = CryptoHelper.GenerateRandomBlock(32);

                // rsa encrypt it with the public key for the universe we're on
                byte[] cryptedSessionKey = null;
                using (var rsa = new RSACrypto(KeyDictionary.GetPublicKey(Client.ConnectedUniverse)))
                {
                    cryptedSessionKey = rsa.Encrypt(sessionKey);
                }

                byte[] loginKey = new byte[20];
                Array.Copy(Encoding.ASCII.GetBytes(callback.LoginKey), loginKey, callback.LoginKey.Length);

                // AES encrypt the loginkey with our session key.
                byte[] cryptedLoginKey = CryptoHelper.SymmetricEncrypt(loginKey, sessionKey);

                KeyValue authResult = null;
                EResult result = EResult.OK;

                try
                {
                    authResult = userAuth.AuthenticateUser(
                        steamid: Client.SteamID.ConvertToUInt64(),
                        sessionkey: WebHelpers.UrlEncode(cryptedSessionKey),
                        encrypted_loginkey: WebHelpers.UrlEncode(cryptedLoginKey),
                        method: "POST"
                    );
                }
                catch (Exception)
                {
                    result = EResult.Fail;
                }

                Login.SessionId = SessionID;

                if (authResult != null)
                    Login.Token = authResult["token"].AsString();

                this.Client.PostCallback(new WebLoggedOnCallback()
                {
                    Result = result,
                    Login = Login
                });
            }
        }
开发者ID:KimimaroTsukimiya,项目名称:SteamBot-1,代码行数:51,代码来源:SteamWeb.cs



注:本文中的SteamKit2.SteamUser类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# SteamSDK.Lobby类代码示例发布时间:2022-05-26
下一篇:
C# SteamKit2.SteamID类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap