當前位置: 首頁>>代碼示例>>C#>>正文


C# SteamBot.Bot類代碼示例

本文整理匯總了C#中SteamBot.Bot的典型用法代碼示例。如果您正苦於以下問題:C# Bot類的具體用法?C# Bot怎麽用?C# Bot使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Bot類屬於SteamBot命名空間,在下文中一共展示了Bot類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: ReceivingUserHandler

 // Todo: move the item-check after a failed trade to a separate method to clean up handler.
 public ReceivingUserHandler(Bot bot, SteamID sid, Configuration config)
     : base(bot, sid, config)
 {
     Success = false;
     mySteamID = Bot.SteamUser.SteamID;
     ReceivingSID = mySteamID;
 }
開發者ID:narugo,項目名稱:SteamBot-Idle,代碼行數:8,代碼來源:ReceivingUserHandler.cs

示例2: ChatTab

        public ChatTab(Chat chat, Bot bot, ulong sid)
        {
            InitializeComponent();
            this.Chat = chat;
            this.sid = sid;
            this.bot = bot;
            this.steam_name.Text = bot.SteamFriends.GetFriendPersonaName(sid);
            this.steam_status.Text = bot.SteamFriends.GetFriendPersonaState(sid).ToString();
            this.chat_status.Text = "";
            SteamKit2.SteamID SteamID = sid;
            byte[] avatarHash = bot.SteamFriends.GetFriendAvatar(SteamID);
            bool validHash = avatarHash != null && !IsZeros(avatarHash);

            if ((AvatarHash == null && !validHash && avatarBox.Image != null) || (AvatarHash != null && AvatarHash.SequenceEqual(avatarHash)))
            {
                // avatar is already up to date, no operations necessary
            }
            else if (validHash)
            {
                AvatarHash = avatarHash;
                CDNCache.DownloadAvatar(SteamID, avatarHash, AvatarDownloaded);
            }
            else
            {
                AvatarHash = null;
                avatarBox.Image = ComposeAvatar(null);
            }
        }
開發者ID:Jamyn,項目名稱:Mist,代碼行數:28,代碼來源:ChatTab.cs

示例3: ShowBackpack

 public ShowBackpack(Bot bot, SteamID SID)
 {
     InitializeComponent();
     this.bot = bot;
     this.SID = SID;
     this.Text = bot.SteamFriends.GetFriendPersonaName(SID) + "'s Backpack";
 }
開發者ID:Jamyn,項目名稱:Mist,代碼行數:7,代碼來源:ShowBackpack.cs

示例4: Trade

        public Trade(SteamID me, SteamID other, string sessionId, string token, string apiKey, Bot bot)
        {
            MeSID = me;
            OtherSID = other;

            this.sessionId = sessionId;
            steamLogin = token;
            this.apiKey = apiKey;
            this.bot = bot;

            // Moved here because when Poll is called below, these are
            // set to zero, which closes the trade immediately.
            MaximumTradeTime = bot.MaximumTradeTime;
            MaximumActionGap = bot.MaximiumActionGap;

            baseTradeURL = String.Format (SteamTradeUrl, OtherSID.ConvertToUInt64 ());

            // try to poll for the first time
            try
            {
                Poll ();
            }
            catch (Exception)
            {
                bot.log.Error ("[TRADE] Failed To Connect to Steam!");

                if (OnError != null)
                    OnError("There was a problem connecting to Steam Trading.");
            }

            FetchInventories ();
        }
開發者ID:remco138,項目名稱:SteamBot,代碼行數:32,代碼來源:Trade.cs

示例5: BotMode

        // This mode is to run a single Bot until it's terminated.
        private static void BotMode(int botIndex)
        {
            if (!File.Exists("settings.json"))
            {
                Console.WriteLine("No settings.json file found.");
                return;
            }

            Configuration configObject;
            try
            {
                configObject = Configuration.LoadConfiguration("settings.json");
            }
            catch (Newtonsoft.Json.JsonReaderException)
            {
                // handle basic json formatting screwups
                Console.WriteLine("settings.json file is corrupt or improperly formatted.");
                return;
            }

            if (botIndex >= configObject.Bots.Length)
            {
                Console.WriteLine("Invalid bot index.");
                return;
            }

            Bot b = new Bot(configObject.Bots[botIndex], configObject.ApiKey, BotManager.UserHandlerCreator, true, true);
            Console.Title = "Bot Manager";
            b.StartBot();

            string AuthSet = "auth";
            string ExecCommand = "exec";

            // this loop is needed to keep the botmode console alive.
            // instead of just sleeping, this loop will handle console input
            while (true)
            {
                string inputText = Console.ReadLine();

                if (String.IsNullOrEmpty(inputText))
                    continue;

                // Small parse for console input
                var c = inputText.Trim();

                var cs = c.Split(' ');

                if (cs.Length > 1)
                {
                    if (cs[0].Equals(AuthSet, StringComparison.CurrentCultureIgnoreCase))
                    {
                        b.AuthCode = cs[1].Trim();
                    }
                    else if (cs[0].Equals(ExecCommand, StringComparison.CurrentCultureIgnoreCase))
                    {
                        b.HandleBotCommand(c.Remove(0, cs[0].Length + 1));
                    }
                }
            }
        }
開發者ID:angrychisel,項目名稱:SteamBot,代碼行數:61,代碼來源:Program.cs

示例6: ShowBackpack

 public ShowBackpack(Bot bot, SteamID SID)
 {
     InitializeComponent();
     this.bot = bot;
     this.SID = SID;
     this.Text = bot.SteamFriends.GetFriendPersonaName(SID) + "'s Backpack";
     Util.LoadTheme(metroStyleManager1);
 }
開發者ID:notafraid90,項目名稱:Mist,代碼行數:8,代碼來源:ShowBackpack.cs

示例7: Log

 public Log(string logFile, Bot bot=null, LogLevel output=LogLevel.Success)
 {
     _FileStream = File.AppendText (logFile);
     _FileStream.AutoFlush = true;
     _Bot = bot;
     OutputToConsole = output;
     Console.ForegroundColor = DefaultConsoleColor;
 }
開發者ID:iamnilay3,項目名稱:SteamBot,代碼行數:8,代碼來源:Log.cs

示例8: GivingUserHandler

        public GivingUserHandler(Bot bot, SteamID sid, Configuration config)
            : base(bot, sid, config)
        {
            Success = false;

            //Just makes referencing the bot's own SID easier.
            mySteamID = Bot.SteamUser.SteamID;
        }
開發者ID:narugo,項目名稱:SteamBot-Idle,代碼行數:8,代碼來源:GivingUserHandler.cs

示例9: SteamEPHandler

 public SteamEPHandler(Bot bot, SteamID sid)
     : base(bot, sid)
 {
     messageResponses.Add ("hey", "Hello!|Howdy!|Oi!|Hey!|Hai!");
     messageResponses.Add ("hello", "Hello!|Howdy!|Oi!|Hey!|Hai!");
     messageResponses.Add ("help", "To use me, just send me a trade request and insert the items you want to give me!");
     messageResponses.Add ("!help", "To use me, just send me a trade request and insert the items you want to give me!");
     messageResponses.Add ("/help", "To use me, just send me a trade request and insert the items you want to give me!");
 }
開發者ID:Elinea,項目名稱:SteamBot,代碼行數:9,代碼來源:SteamEPHandler.cs

示例10: ShowBackpack

 public ShowBackpack(Bot bot, SteamID SID)
 {
     InitializeComponent();
     this.bot = bot;
     this.SID = SID;
     this.Text = bot.SteamFriends.GetFriendPersonaName(SID) + "'s Backpack";
     Util.LoadTheme(this, this.Controls);
     this.Width = 1012;
 }
開發者ID:The-Mad-Pirate,項目名稱:Mist,代碼行數:9,代碼來源:ShowBackpack.cs

示例11: UserHandlerCreator

        /// <summary>
        /// A method to return an instance of the <c>bot.BotControlClass</c>.
        /// </summary>
        /// <param name="bot">The bot.</param>
        /// <param name="sid">The steamId.</param>
        /// <returns>A <see cref="UserHandler"/> instance.</returns>
        /// <exception cref="ArgumentException">Thrown if the control class type does not exist.</exception>
        public static UserHandler UserHandlerCreator(Bot bot, SteamID sid)
        {
            Type controlClass = Type.GetType(bot.BotControlClass);

            if (controlClass == null)
                throw new ArgumentException("Configured control class type was null. You probably named it wrong in your configuration file.", "bot");

            return (UserHandler)Activator.CreateInstance(
                controlClass, new object[] { bot, sid });
        }
開發者ID:aleksasavic3,項目名稱:KeyBot,代碼行數:17,代碼來源:BotManager.cs

示例12: UserHandler

 public UserHandler (Bot bot, SteamID sid)
 {
     Bot = bot;
     OtherSID = sid;
     MySID = bot.SteamUser.SteamID;
     if (MySID != OtherSID)
     {
         MyInventory = new GenericInventory(MySID, MySID);
         OtherInventory = new GenericInventory(OtherSID, MySID);
     }            
 }
開發者ID:ElPresidentePro,項目名稱:CSGOShop-Steambot,代碼行數:11,代碼來源:UserHandler.cs

示例13: ShowTrade

        public ShowTrade(Bot bot, string name)
        {
            InitializeComponent();
            Util.LoadTheme(metroStyleManager1);
            this.Text = "Trading with " + name;
            this.bot = bot;
            this.sid = bot.CurrentTrade.OtherSID;
            this.username = name;
            this.label_yourvalue.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
            this.label_othervalue.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
            column_otherofferings.Text = name + "'s Offerings:";
            ListInventory.ShowTrade = this;
            Thread checkExpired = new Thread(() =>
            {
                while (true)
                {
                    if (bot.CurrentTrade == null)
                    {
                        bot.main.Invoke((Action)(this.Close));
                        bot.log.Warn("Trade expired.");
                        if (Friends.chat_opened)
                        {
                            bot.main.Invoke((Action)(() =>
                            {
                                foreach (TabPage tab in Friends.chat.ChatTabControl.TabPages)
                                {
                                    if (tab.Text == bot.SteamFriends.GetFriendPersonaName(sid))
                                    {
                                        tab.Invoke((Action)(() =>
                                        {
                                            foreach (var item in tab.Controls)
                                            {
                                                Friends.chat.chatTab = (ChatTab)item;
                                            }
                                            string result = "The trade session has closed.";
                                            bot.log.Warn(result);
                                            string date = "[" + DateTime.Now + "] ";
                                            Friends.chat.chatTab.UpdateChat("[" + DateTime.Now + "] " + result + "\r\n", false);
                                            ChatTab.AppendLog(sid, "===========[TRADE ENDED]===========\r\n");
                                        }));
                                        break; ;
                                    }
                                }

                            }));
                        }
                        break;
                    }
                }
            });
            checkExpired.Start();
        }
開發者ID:notafraid90,項目名稱:Mist,代碼行數:52,代碼來源:ShowTrade.cs

示例14: ChatTab

        public ChatTab(Chat chat, Bot bot, ulong sid)
        {
            InitializeComponent();
            this.Chat = chat;
            this.userSteamId = sid;
            this.bot = bot;
            this.StyleManager.OnThemeChanged += metroStyleManager1_OnThemeChanged;
            this.StyleManager.Theme = Friends.GlobalStyleManager.Theme;
            this.StyleManager.Style = Friends.GlobalStyleManager.Style;
            Util.LoadTheme(null, this.Controls, this);
            this.Theme = Friends.GlobalStyleManager.Theme;
            this.StyleManager.Style = Friends.GlobalStyleManager.Style;
            metroStyleManager1_OnThemeChanged(null, EventArgs.Empty);
            try
            {
                this.steam_name.Text = prevName = bot.SteamFriends.GetFriendPersonaName(sid);
                this.steam_status.Text = prevStatus = bot.SteamFriends.GetFriendPersonaState(sid).ToString();
            }
            catch
            {

            }
            this.chat_status.Text = "";
            SteamKit2.SteamID SteamID = sid;
            try
            {
                byte[] avatarHash = bot.SteamFriends.GetFriendAvatar(SteamID);
                bool validHash = avatarHash != null && !IsZeros(avatarHash);

                if ((AvatarHash == null && !validHash && avatarBox.Image != null) || (AvatarHash != null && AvatarHash.SequenceEqual(avatarHash)))
                {
                    // avatar is already up to date, no operations necessary
                }
                else if (validHash)
                {
                    AvatarHash = avatarHash;
                    CDNCache.DownloadAvatar(SteamID, avatarHash, AvatarDownloaded);
                }
                else
                {
                    AvatarHash = null;
                    avatarBox.Image = ComposeAvatar(null);
                }
            }
            catch
            {

            }
            new System.Threading.Thread(GetChatLog).Start();
            status_update.RunWorkerAsync();
            text_input.Focus();
        }
開發者ID:The-Mad-Pirate,項目名稱:Mist,代碼行數:52,代碼來源:ChatTab.cs

示例15: assignRequest

 public static void assignRequest(Bot bot)
 {
     new Thread(() =>
         {
             while (true)
             {
                 if (getItem().User!=null)
                 {
                     bot.DoRequest(getItem());
                     break;
                 }
                 Thread.Sleep(5000);
             }
         }).Start();
 }
開發者ID:norgalyn,項目名稱:SteamBot,代碼行數:15,代碼來源:MySQL.cs


注:本文中的SteamBot.Bot類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。