当前位置: 首页>>代码示例>>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;未经允许,请勿转载。