当前位置: 首页>>代码示例>>C#>>正文


C# SteamClient.Connect方法代码示例

本文整理汇总了C#中SteamClient.Connect方法的典型用法代码示例。如果您正苦于以下问题:C# SteamClient.Connect方法的具体用法?C# SteamClient.Connect怎么用?C# SteamClient.Connect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SteamClient的用法示例。


在下文中一共展示了SteamClient.Connect方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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

示例3: 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

示例4: 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

示例5: Connect

        public static void Connect()
        {
            Client = new SteamClient(ProtocolType.Udp);
            Friends = Client.GetHandler<SteamFriends>();
            User = Client.GetHandler<SteamUser>();
            Chat = new Chat();

            Client.Connect();
        }
开发者ID:EIREXE,项目名称:discord,代码行数:9,代码来源:Steam.cs

示例6: 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

示例7: 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

示例8: 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

示例9: 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

示例10: 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

示例11: 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

示例12: Enter_

        // static string toptlb;
        // public static string steamgg(string code)
        // {
        //     return code;
        // }
        public static void Enter_(string us, string pa, ToolStripLabel tlb_)
        {
            user = us;
            pass = pa;
            tlb = tlb_;
            if ((user.Length < 2) || (pass.Length < 2))
            {
                tlb.Text = "No username and password specified!";
                return;
            }

            // 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
            manager.Subscribe<SteamClient.ConnectedCallback>(OnConnected);
            manager.Subscribe<SteamClient.DisconnectedCallback>(OnDisconnected);

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

            // this callback is triggered when the steam servers wish for the client to store the sentry file
            //manager.Subscribe<SteamUser.UpdateMachineAuthCallback>(OnMachineAuth);

            isRunning = true;

            tlb.Text = "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:Key-F,项目名称:dz_3sem,代码行数:50,代码来源:Login.cs

示例13: StartSteam

        public ECheckResult StartSteam()
        {
            _steamClient = new SteamClient();
            _manager = new CallbackManager(_steamClient);
            _steamUser = _steamClient.GetHandler<SteamUser>();

            _manager.Subscribe<SteamClient.ConnectedCallback>(OnConnected);
            _manager.Subscribe<SteamClient.DisconnectedCallback>(OnDisconnected);
            _manager.Subscribe<SteamUser.LoggedOnCallback>(OnLoggedOn);
            _manager.Subscribe<SteamUser.UpdateMachineAuthCallback>(OnMachineAuth);

            _isRunning = true;
            _steamClient.Connect();

            while (_isRunning)
                _manager.RunWaitCallbacks(TimeSpan.FromSeconds(1));

            if (_operation == EOperationType.CreateSentry)
                Thread.Sleep(500);

            _steamClient.Disconnect();
            return _checkResult;
        }
开发者ID:Shravan2x,项目名称:SteamSentryTool,代码行数:23,代码来源:SentryOperator.cs

示例14: Main

        static void Main(string[] args)
        {
            Console.Title = "Noah-Bawt";
            user = "";
            pass = "";

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

            manager = new CallbackManager(steamClient);

            steamUser = steamClient.GetHandler<SteamUser>();

            steamFriends = steamClient.GetHandler<SteamFriends>();

            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);
            new Callback<SteamFriends.FriendsListCallback>(OnFriendsList, manager);
            new Callback<SteamFriends.PersonaStateCallback>(OnPersonaState, manager);
            new Callback<SteamFriends.FriendAddedCallback>(OnFriendAdded, manager);
            new Callback<SteamFriends.ChatEnterCallback>(OnChatEnter, manager);
            new Callback<SteamFriends.ChatMsgCallback>(OnChatMsgRecieved, manager);
            lastcmd = DateTime.Now;
            isRunning = true;

            Console.WriteLine("Connecting...");
            steamClient.Connect();

            while (isRunning)
            {
                manager.RunWaitCallbacks(TimeSpan.FromSeconds(1));
            }
        }
开发者ID:KyleMcL,项目名称:Noah-Bawt,代码行数:37,代码来源:Program.cs

示例15: Main

        static void Main(string[] args)
        {
            // TODO: Add check for instance already running

            //login info
            string userID = ConfigurationManager.AppSettings["userID"];
            string userPW = ConfigurationManager.AppSettings["userPW"];
            string botName = ConfigurationManager.AppSettings["botName"];

            List<SteamID> chatRooms = new List<SteamID>();

            ulong chatSteamID;
            if (ulong.TryParse(ConfigurationManager.AppSettings["chatSteamID"], out chatSteamID))
            {
                //List of Chats to join
                // TODO: multiple chatrooms
                chatRooms.Add(chatSteamID);
            }
            else
            {
                Console.WriteLine("Exit Code 10: Failed to Load SteamID");
                Environment.Exit(10);
            }

            //Initiliaze Steam Client
            SteamClient steamClient = new SteamClient();
            SteamUser steamUsr = steamClient.GetHandler<SteamUser>();
            SteamFriends steamFrds = steamClient.GetHandler<SteamFriends>();

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

            while (true)
            {
                // start listening
                CallbackMsg msg = steamClient.WaitForCallback(true);

                msg.Handle<SteamClient.ConnectedCallback>(callback =>
                    {
                        if (callback.Result != EResult.OK)
                        {
                            Console.WriteLine("Exit Code 1: Failed to Connect to Steam Network - " + callback.Result.ToString());
                            Environment.Exit(1);
                            // connect fail
                        }
                        else
                        {
                            Console.WriteLine("Connected to Steam Network");

                            steamUsr.LogOn(new SteamUser.LogOnDetails
                            {
                                Username = userID,
                                Password = userPW,
                            });
                        }
                    });

                msg.Handle<SteamUser.LoggedOnCallback>(callback =>
                    {
                        if (callback.Result != EResult.OK)
                        {
                            Console.WriteLine("Exit Code 2: Logon Failure - " + callback.Result.ToString());
                            //Environment.Exit(2);
                            // logon fail
                        }
                        else
                        {
                            Console.WriteLine("Logged into Steam Network");

                            // Join Chat
                            // if you set PersonaState without setting PersonaName it goes to [unknown] and GetPersonaName doesn't work?
                            //steamFrds.SetPersonaName(steamFrds.GetPersonaName());
                            steamFrds.SetPersonaName(botName);
                            steamFrds.SetPersonaState(EPersonaState.Online);

                            foreach (SteamID steamID in chatRooms)
                            {
                                steamFrds.JoinChat(steamID);
                            }
                        }
                    });

                msg.Handle<SteamFriends.ChatEnterCallback>(callback =>
                    {
                        if (callback.EnterResponse != EChatRoomEnterResponse.Success)
                        {
                            Console.WriteLine("Exit Code 3: Failure to Enter Chat" + callback.EnterResponse.ToString());
                            //Environment.Exit(3);
                            // join chat fail
                        }
                        else
                        {
                            Console.WriteLine("Joined Chat");
                            foreach (SteamID steamID in chatRooms)
                            {
                                steamFrds.SendChatRoomMessage(steamID, EChatEntryType.ChatMsg, "Now listening");
                            }
                        }
                    });

//.........这里部分代码省略.........
开发者ID:Hadlock,项目名称:ChewieBot,代码行数:101,代码来源:Program.cs


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