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


C# CallbackManager.Subscribe方法代码示例

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


在下文中一共展示了CallbackManager.Subscribe方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: PICSChanges

        public PICSChanges(CallbackManager manager)
            : base(manager)
        {
            if (Settings.IsFullRun)
            {
                PreviousChangeNumber = 1; // Request everything

                manager.Subscribe<SteamApps.PICSChangesCallback>(OnPICSChangesFullRun);

                return;
            }
                
            manager.Subscribe<SteamApps.PICSChangesCallback>(OnPICSChanges);

            using (var db = Database.GetConnection())
            {
                BillingTypeKey = db.ExecuteScalar<uint>("SELECT `ID` FROM `KeyNamesSubs` WHERE `Name` = 'root_billingtype'");

                PreviousChangeNumber = db.ExecuteScalar<uint>("SELECT `ChangeID` FROM `Changelists` ORDER BY `ChangeID` DESC LIMIT 1");

                Log.WriteInfo("PICSChanges", "Previous changelist was {0}", PreviousChangeNumber);
            }

            if (PreviousChangeNumber == 0)
            {
                Log.WriteWarn("PICSChanges", "Looks like there are no changelists in the database.");
                Log.WriteWarn("PICSChanges", "If you want to fill up your database first, restart with \"FullRun\" setting set to 1.");
            }
        }
开发者ID:qyh214,项目名称:SteamDatabaseBackend,代码行数:29,代码来源:PICSChanges.cs

示例2: GameCoordinator

        public GameCoordinator(SteamClient steamClient, CallbackManager manager)
        {
            SessionMap = new Dictionary<uint, SessionInfo>();

            // Map gc messages to our callback functions
            MessageMap = new Dictionary<uint, Action<uint, IPacketGCMsg>>
            {
                { (uint)EGCBaseClientMsg.k_EMsgGCClientConnectionStatus, OnConnectionStatus },
                { (uint)EGCBaseClientMsg.k_EMsgGCClientWelcome, OnWelcome },
                { (uint)EGCItemMsg.k_EMsgGCUpdateItemSchema, OnItemSchemaUpdate },
                { (uint)EGCItemMsg.k_EMsgGCClientVersionUpdated, OnVersionUpdate },
                { (uint)EGCBaseMsg.k_EMsgGCSystemMessage, OnSystemMessage },

                // TF2 specific messages
                { k_EMsgGCClientGoodbye, OnConnectionStatus },
                { (uint)EGCItemMsg.k_EMsgGCGoldenWrenchBroadcast, OnWrenchBroadcast },
                { k_EMsgGCTFSpecificItemBroadcast, OnItemBroadcast },
            };

            SteamGameCoordinator = steamClient.GetHandler<SteamGameCoordinator>();

            SessionTimer = new Timer();
            SessionTimer.Interval = TimeSpan.FromSeconds(30).TotalMilliseconds;
            SessionTimer.Elapsed += OnSessionTick;
            SessionTimer.Start();

            manager.Subscribe<SteamGameCoordinator.MessageCallback>(OnGameCoordinatorMessage);
            manager.Subscribe<SteamUser.LoggedOffCallback>(OnLoggedOff);
            manager.Subscribe<SteamClient.DisconnectedCallback>(OnDisconnected);
        }
开发者ID:GoeGaming,项目名称:SteamDatabaseBackend,代码行数:30,代码来源:GameCoordinator.cs

示例3: Login

        public Login(SteamNerd steamNerd, CallbackManager manager)
        {
            _steamNerd = steamNerd;

            manager.Subscribe<SteamClient.ConnectedCallback>(OnConnect);
            manager.Subscribe<SteamClient.DisconnectedCallback>(OnDisconnect);
            manager.Subscribe<SteamUser.UpdateMachineAuthCallback>(OnMachineAuth);
            manager.Subscribe<SteamUser.LoggedOnCallback>(OnLoggedOn);
            manager.Subscribe<SteamUser.LoginKeyCallback>(OnLoginKey);
        }
开发者ID:bakerj76,项目名称:SteamNerd,代码行数:10,代码来源:Login.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: 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

示例6: Connection

        public Connection(CallbackManager manager)
            : base(manager)
        {
            ReconnectionTimer = new Timer();
            ReconnectionTimer.AutoReset = false;
            ReconnectionTimer.Elapsed += Reconnect;
            ReconnectionTimer.Interval = TimeSpan.FromSeconds(RETRY_DELAY).TotalMilliseconds;

            manager.Subscribe<SteamClient.ConnectedCallback>(OnConnected);
            manager.Subscribe<SteamClient.DisconnectedCallback>(OnDisconnected);
            manager.Subscribe<SteamUser.LoggedOnCallback>(OnLoggedOn);
            manager.Subscribe<SteamUser.LoggedOffCallback>(OnLoggedOff);
            manager.Subscribe<SteamUser.UpdateMachineAuthCallback>(OnMachineAuth);
        }
开发者ID:qyh214,项目名称:SteamDatabaseBackend,代码行数:14,代码来源:Connection.cs

示例7: PICSTokens

        public PICSTokens(CallbackManager manager)
            : base(manager)
        {
            manager.Subscribe<SteamApps.PICSTokensCallback>(OnPICSTokens);

            Reload();
        }
开发者ID:qyh214,项目名称:SteamDatabaseBackend,代码行数:7,代码来源:PICSTokens.cs

示例8: FreeLicense

        public FreeLicense(CallbackManager manager)
            : base(manager)
        {
            PackageRegex = new Regex("RemoveFreeLicense\\( ?(?<subid>[0-9]+), ?'(?<name>.+)' ?\\)", RegexOptions.Compiled | RegexOptions.CultureInvariant | RegexOptions.ExplicitCapture);

            manager.Subscribe<SteamApps.FreeLicenseCallback>(OnFreeLicenseCallback);
        }
开发者ID:qyh214,项目名称:SteamDatabaseBackend,代码行数:7,代码来源:FreeLicense.cs

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

示例10: DepotProcessor

        public DepotProcessor(SteamClient client, CallbackManager manager)
        {
            DepotLocks = new ConcurrentDictionary<uint, byte>();

            CDNClient = new CDNClient(client);

            FileDownloader.SetCDNClient(CDNClient);

            CDNServers = new List<string>
            {
                "cdn.level3.cs.steampowered.com",
                "cdn.akamai.cs.steampowered.com",
                "cdn.highwinds.cs.steampowered.com"
            };

            manager.Subscribe<SteamApps.CDNAuthTokenCallback>(OnCDNAuthTokenCallback);
            manager.Subscribe<SteamApps.DepotKeyCallback>(OnDepotKeyCallback);
        }
开发者ID:TheFighter,项目名称:SteamDatabaseBackend,代码行数:18,代码来源:DepotProcessor.cs

示例11: SteamWrappedClient

        public SteamWrappedClient()
        {
            Client = new SteamClient();
            CallbackManager = new CallbackManager(Client);

            User = Client.GetHandler<SteamUser>();
            TradingHandler = Client.GetHandler<SteamTrading>();

            CallbackManager.Subscribe<SteamClient.ConnectedCallback>(OnConnect);
            CallbackManager.Subscribe<SteamClient.DisconnectedCallback>(OnDisconnect);

            CallbackManager.Subscribe<SteamUser.LoggedOnCallback>(OnLogon);
            CallbackManager.Subscribe<SteamUser.LoggedOffCallback>(OnLogoff);

            CallbackManager.Subscribe<SteamUser.UpdateMachineAuthCallback>(OnMachineAuth);

            RegisterOtherCallbacks();
        }
开发者ID:einsteinsci,项目名称:custom-steam-tools,代码行数:18,代码来源:SteamWrappedClient.cs

示例12: DotaClient

        public DotaClient( string userName, string password, uint matchId )
        {
            this.userName = userName;
            this.password = password;

            this.matchId = matchId;

            client = new SteamClient();

            // get our handlers
            user = client.GetHandler<SteamUser>();
            gameCoordinator = client.GetHandler<SteamGameCoordinator>();

            // setup callbacks
            callbackMgr = new CallbackManager( client );

            callbackMgr.Subscribe<SteamClient.ConnectedCallback>( OnConnected );
            callbackMgr.Subscribe<SteamUser.LoggedOnCallback>( OnLoggedOn );
            callbackMgr.Subscribe<SteamGameCoordinator.MessageCallback>( OnGCMessage );
        }
开发者ID:Zaharkov,项目名称:SteamKit,代码行数:20,代码来源:DotaClient.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: UGCHandler

        public UGCHandler( CallbackManager manager )
            : base(manager)
        {
            try
            {
                Directory.CreateDirectory( Path.Combine( "cache", "ugc" ) );
            }
            catch ( IOException ex )
            {
                Log.WriteError( "UGCHandler", "Unable to create ugc cache directory: {0}", ex.Message );
            }

            manager.Subscribe<SteamUnifiedMessages.ServiceMethodResponse>( OnServiceMethod );

            Steam.Instance.CallbackManager.Subscribe<SteamUser.LoggedOnCallback>( OnLoggedOn );
        }
开发者ID:Markusyatina,项目名称:steam-irc-bot,代码行数:16,代码来源:UGCHandler.cs

示例15: Main

        static void Main(string[] args)
        {
            if (!File.Exists("chat.txt"))
            {
                File.Create("chat.txt").Close();
                File.WriteAllText("chat.txt", "abc | 123");
            }

            if (!File.Exists("admin.txt"))
            {
                File.Create("admin.txt").Close();
                File.WriteAllText("admin.txt", "Please Insert Your steamID64");
            }

            Console.Title = "Steam Bot Beta V0.1";
            Console.WriteLine("CTRL+C To Quit.....");

            Console.Write("Username: ");
            user = Console.ReadLine();

            Console.Write("Password: ");
            pass = Console.ReadLine();

            steamClient = new SteamClient();
            manager = new CallbackManager(steamClient);
            steamUser = steamClient.GetHandler<SteamUser>();
            steamFriends = steamClient.GetHandler<SteamFriends>();

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

            manager.Subscribe<SteamUser.LoggedOnCallback>(OnLoggedOn);
            manager.Subscribe<SteamUser.LoggedOffCallback>(OnloggedOff);
            manager.Subscribe<SteamUser.AccountInfoCallback>(OnAccountInfo);
            manager.Subscribe<SteamFriends.FriendMsgCallback>(OnChatMessage);

            manager.Subscribe<SteamFriends.FriendsListCallback>(OnFriendsList);

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

            isRunning = true;

            Console.WriteLine("\nConnecting To Steam....\n");

            steamClient.Connect();

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


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