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


C# CallbackManager类代码示例

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


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

示例1: PICSTokens

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

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

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

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

示例4: PICSChanges

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

                manager.Register(new Callback<SteamApps.PICSChangesCallback>(OnPICSChangesFullRun));

                return;
            }
                
            manager.Register(new Callback<SteamApps.PICSChangesCallback>(OnPICSChanges));

            using (MySqlDataReader Reader = DbWorker.ExecuteReader("SELECT `ChangeID` FROM `Changelists` ORDER BY `ChangeID` DESC LIMIT 1"))
            {
                if (Reader.Read())
                {
                    PreviousChangeNumber = Reader.GetUInt32("ChangeID");

                    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:RJacksonm1,项目名称:SteamDatabaseBackend,代码行数:30,代码来源:PICSChanges.cs

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

示例6: GameCoordinator

        public GameCoordinator(uint appID, SteamClient steamClient, CallbackManager callbackManager)
        {
            // Map gc messages to our callback functions
            GCMessageMap = new Dictionary<uint, Action<IPacketGCMsg>>
            {
                { (uint)EGCBaseClientMsg.k_EMsgGCClientWelcome, OnClientWelcome },
                { (uint)EGCItemMsg.k_EMsgGCUpdateItemSchema, OnItemSchemaUpdate },
                { (uint)EGCBaseMsg.k_EMsgGCSystemMessage, OnSystemMessage },
                { (uint)EGCBaseClientMsg.k_EMsgGCClientConnectionStatus, OnClientConnectionStatus },
                { (uint)4008 /* TF2's k_EMsgGCClientGoodbye */, OnClientConnectionStatus }
            };

            this.AppID = appID;
            this.SteamClient = steamClient;
            this.SteamGameCoordinator = SteamClient.GetHandler<SteamGameCoordinator>();
            this.Name = string.Format("GC {0}", appID);

            // Make sure Steam knows we're playing the game
            Timer = new System.Timers.Timer();
            Timer.Elapsed += OnTimerPlayGame;
            Timer.Interval = TimeSpan.FromMinutes(5).TotalMilliseconds;
            Timer.Start();

            Timer = new System.Timers.Timer();
            Timer.Elapsed += OnTimer;

            callbackManager.Register(new Callback<SteamGameCoordinator.MessageCallback>(OnGameCoordinatorMessage));
        }
开发者ID:TomasDuda,项目名称:SteamDatabaseBackend,代码行数:28,代码来源:GameCoordinator.cs

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

示例8: PICSTokens

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

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

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

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

示例11: GCClient

        public GCClient()
        {
            SteamClient = new SteamClient();
            SteamClient.AddHandler( new SteamGames() );

            CallbackManager = new CallbackManager( SteamClient );

            SteamUser = SteamClient.GetHandler<SteamUser>();
            SteamGameCoordinator = SteamClient.GetHandler<SteamGameCoordinator>();
            SteamApps = SteamClient.GetHandler<SteamApps>();
            SteamGames = SteamClient.GetHandler<SteamGames>();
            SteamFriends = SteamClient.GetHandler<SteamFriends>();

            new Callback<SteamClient.ConnectedCallback>( OnConnected, CallbackManager );
            new Callback<SteamClient.DisconnectedCallback>( OnDisconnected, CallbackManager );

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

            new Callback<SteamApps.LicenseListCallback>( OnLicenseList, CallbackManager );

            new Callback<SteamGameCoordinator.MessageCallback>( OnGCMessage, CallbackManager );

            new JobCallback<SteamApps.AppOwnershipTicketCallback>( OnAppTicket, CallbackManager );
        }
开发者ID:KimimaroTsukimiya,项目名称:DotaBot,代码行数:25,代码来源:GCClient.cs

示例12: Steam

        public Steam()
        {
            Client = new SteamClient();

            User = Client.GetHandler<SteamUser>();
            Apps = Client.GetHandler<SteamApps>();
            Friends = Client.GetHandler<SteamFriends>();
            UserStats = Client.GetHandler<SteamUserStats>();

            CallbackManager = new CallbackManager(Client);

            Client.AddHandler(new ReadMachineAuth());

            new Connection(CallbackManager);
            new PICSProductInfo(CallbackManager);
            new PICSTokens(CallbackManager);
            new LicenseList(CallbackManager);
            new WebAuth(CallbackManager);
            new FreeLicense(CallbackManager);

            if (!Settings.IsFullRun)
            {
                new AccountInfo(CallbackManager);
                new ClanState(CallbackManager);
                new ChatMemberInfo(CallbackManager);
                new GameCoordinator(Client, CallbackManager);

                new Watchdog();
            }

            PICSChanges = new PICSChanges(CallbackManager);
            DepotProcessor = new DepotProcessor(Client, CallbackManager);

            IsRunning = true;
        }
开发者ID:TheFighter,项目名称:SteamDatabaseBackend,代码行数:35,代码来源:Steam.cs

示例13: Main

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

            // exit gracefully if possible
            Console.CancelKeyPress += delegate(object sender, ConsoleCancelEventArgs e) {
                e.Cancel = true;
                isRunning = false;
            };

            var url = "http://localhost:3131";
            var host = new NancyHost(new Uri(url));
            host.Start();
            Console.WriteLine ("Server now running on: " + url);

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

            manager = new CallbackManager( Steam3.SteamClient );

            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 );
            new Callback<SteamFriends.FriendMsgCallback>( OnMsgReceived, manager );

            isRunning = true;

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

            // initiate the connection
            Steam3.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 ) );
            }

            Console.WriteLine( "Disconnecting from Steam..." );

            Steam3.SteamUser.LogOff();
            Steam3.SteamClient.Disconnect();
            host.Stop();
            host.Stop();
        }
开发者ID:scottkf,项目名称:sendmessage,代码行数:59,代码来源:Program.cs

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

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


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