Set() public méthode

Sets the various components of this SteamID instance.
public Set ( UInt32 unAccountID, EUniverse eUniverse, EAccountType eAccountType ) : void
unAccountID System.UInt32 The account ID.
eUniverse EUniverse The universe.
eAccountType EAccountType The account type.
Résultat void
        public override bool OnLoginCompleted()
        {
            XmlDocument xmlDocument = new XmlDocument();
            try
            {
                BotManager.mainLog.Success("Loading config.xml file...");
                xmlDocument.Load("config.xml");
            }
            catch (System.Exception ex)
            {
                BotManager.mainLog.Error(ex.ToString());
                Bot.StopBot();
                return false;
            }

            clanID = new SteamID();
            clanID.Set(uint.Parse(readElement(xmlDocument, "Steam/groupID")), EUniverse.Public, EAccountType.Clan);

            CSWebClient = new WebClient();
            CSWebClient.Headers["User-Agent"] = "Mozilla/4.0 (Compatible; Windows NT 5.1; MSIE 6.0) " + "(compatible; MSIE 6.0; Windows NT 5.1; " + ".NET CLR 1.1.4322; .NET CLR 2.0.50727)";

            CSWebClientPeriodic = new WebClient();
            CSWebClientPeriodic.Headers["User-Agent"] = "Mozilla/4.0 (Compatible; Windows NT 5.1; MSIE 6.0) " + "(compatible; MSIE 6.0; Windows NT 5.1; " + ".NET CLR 1.1.4322; .NET CLR 2.0.50727)";

            random = new System.Random((int)System.DateTime.Now.Ticks);

            conversionRate = 1.0; //will update correctly every now and then

            Moolah_guid = readElement(xmlDocument, "Moolah/guid");
            Moolah_api_key = readElement(xmlDocument, "Moolah/api_key");

            string sql_server = readElement(xmlDocument, "SQL/server");
            string sql_id = readElement(xmlDocument, "SQL/id");
            string sql_password = readElement(xmlDocument, "SQL/password");
            string sql_database = readElement(xmlDocument, "SQL/database");
            mysql_connection = new MySqlConnection("SERVER=" + sql_server +
                                                "; DATABASE=" + sql_database +
                                                "; UID=" + sql_id +
                                                "; PASSWORD="******";");
            try
            {
                BotManager.mainLog.Success("Trying to connect to MySQL server...");
                mysql_connection.Open();
            }
            catch (MySqlException ex)
            {
                BotManager.mainLog.Error(ex.ToString());
                Bot.StopBot();
                return false;
            }

            returnQuery("CREATE TABLE IF NOT EXISTS users ( userID int NOT NULL AUTO_INCREMENT PRIMARY KEY, " +
                                                                        "SteamID64 BIGINT NOT NULL, " +
                                                                        "balance DOUBLE(30,15) NOT NULL, " +
                                                                        "responded TINYINT(1) NOT NULL," +
                                                                        "username TEXT )");

            returnQuery("CREATE TABLE IF NOT EXISTS tips ( tipID int NOT NULL AUTO_INCREMENT PRIMARY KEY, " +
                                                                        "senderID64 BIGINT NOT NULL, " +
                                                                        "receiverID64 BIGINT NOT NULL, " +
                                                                        "amount DOUBLE(30,15) NOT NULL, " +
                                                                        "label TEXT, " +
                                                                        "notified TINYINT(1) NOT NULL, " +
                                                                        "donation TINYINT(1) NOT NULL, " +
                                                                        "anonymous TINYINT(1) NOT NULL, " +
                                                                        "message TEXT, " +
                                                                        "timestamp TIMESTAMP )");

            returnQuery("CREATE TABLE IF NOT EXISTS add_verification ( addID int NOT NULL AUTO_INCREMENT PRIMARY KEY, " +
                                                                        "userID int(11) NOT NULL, " +
                                                                        "amount DOUBLE(30,15) NOT NULL, " +
                                                                        "add_code TEXT NOT NULL, " +
                                                                        "verified TINYINT(1) NOT NULL )");

            returnQuery("CREATE TABLE IF NOT EXISTS aliases ( aliasID int NOT NULL AUTO_INCREMENT PRIMARY KEY, " +
                                                                        "userID64 BIGINT NOT NULL, " +
                                                                        "aliasID64 BIGINT NOT NULL, " +
                                                                        "alias TEXT NOT NULL )");

            try
            {
                System.ComponentModel.BackgroundWorker addValidityWorker = new System.ComponentModel.BackgroundWorker();
                addValidityWorker.DoWork += checkPeriodically;
                addValidityWorker.RunWorkerAsync();
            }
            catch (System.Exception e)
            {
                BotManager.mainLog.Error(e.ToString());
                Bot.StopBot();
                return false;
            }

            //prices in Dollars
            labels = new DogeLabel[]{   new DogeLabel(1, "beer","a beer",DogeLabel.Currency.USD),
                                        new DogeLabel(2.4, "key","a Dota 2 treasure key",DogeLabel.Currency.USD),
                                        new DogeLabel(25, "dominions4","Dominions 4",DogeLabel.Currency.USD),
                                        new DogeLabel(420, "fedora","one fedora",DogeLabel.Currency.DOGE)};

            //remove all friends on every
            int friendCount = Bot.SteamFriends.GetFriendCount();
            for (int f = 0; f < friendCount; f++)
            {
                if (Bot.SteamFriends.GetFriendRelationship(Bot.SteamFriends.GetFriendByIndex(friendCount - f - 1)) == EFriendRelationship.Friend)
                    Bot.SteamFriends.RemoveFriend(Bot.SteamFriends.GetFriendByIndex(friendCount - f - 1));
            }

            System.Threading.Thread.Sleep(1000); //To prevent incorrect chronological order in chat messages

            if (Bot.IsRunning)
                BotManager.mainLog.Success("Bot is ready and online.");
            return true;
        }
Exemple #2
0
        public void SetValidAndHandlesClan()
        {
            SteamID sid = new SteamID();

            sid.Set( 1234u, EUniverse.Internal, EAccountType.ContentServer );

            Assert.Equal( 1234u, sid.AccountID );
            Assert.Equal( EUniverse.Internal, sid.AccountUniverse );
            Assert.Equal( EAccountType.ContentServer, sid.AccountType );
            Assert.Equal( SteamID.DesktopInstance, sid.AccountInstance );


            sid.Set( 4321u, EUniverse.Public, EAccountType.Clan );

            Assert.Equal( 4321u, sid.AccountID );
            Assert.Equal( EUniverse.Public, sid.AccountUniverse );
            Assert.Equal( EAccountType.Clan, sid.AccountType );
            Assert.Equal( 0u, sid.AccountInstance );
        }