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


C# SteamID.SetFromUInt64方法代码示例

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


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

示例1: checkPeriodically

        public void checkPeriodically(object sender, DoWorkEventArgs e)
        {
            Thread.Sleep(1000);//Wait 10s for Steambot to fully initialize
            while (true)
            {
                double newConversionRate = getConversionRate();
                if (newConversionRate != -1)
                    conversionRate = newConversionRate;

                DataSet verified_adds = returnQuery("SELECT * FROM add_verification a,users u WHERE verified=1 AND a.userID=u.userID");
                if (verified_adds != null)
                {
                    for (int r = 0; r < verified_adds.Tables[0].Rows.Count; r++)
                    {
                        BotManager.mainLog.Success("Add verified: " + verified_adds.Tables[0].Rows[r][2].ToString() + " DOGE to user " + verified_adds.Tables[0].Rows[r][1].ToString());
                        returnQuery("UPDATE users SET balance = balance + " + verified_adds.Tables[0].Rows[r][2].ToString() + " WHERE userID = " + verified_adds.Tables[0].Rows[r][1].ToString());
                        returnQuery("DELETE FROM add_verification WHERE addID = " + verified_adds.Tables[0].Rows[r][0].ToString());

                        SteamID userID = new SteamID();
                        userID.SetFromUInt64(ulong.Parse(verified_adds.Tables[0].Rows[r][6].ToString()));
                        Bot.SteamFriends.SendChatMessage(userID, EChatEntryType.ChatMsg, verified_adds.Tables[0].Rows[r][2].ToString() + " DOGE was successfully added to your tipping balance.");
                        BotManager.mainLog.Success("Registered user successfully added " + verified_adds.Tables[0].Rows[r][2].ToString() + " DOGE to their balance.");
                    }
                }
                Thread.Sleep(30000);
            }
        }
开发者ID:natoshi,项目名称:steamdogebot,代码行数:27,代码来源:DogeTipBotHandler.cs

示例2: LongConstructorAndSetterGetterValid

        public void LongConstructorAndSetterGetterValid()
        {
            SteamID sid = new SteamID( 103582791432294076 );

            Assert.Equal( 2772668u, sid.AccountID );
            Assert.Equal( SteamID.AllInstances, sid.AccountInstance );
            Assert.Equal( EUniverse.Public, sid.AccountUniverse );
            Assert.Equal( EAccountType.Clan, sid.AccountType );

            sid.SetFromUInt64( 157626004137848889 );

            Assert.Equal( 12345u, sid.AccountID );
            Assert.Equal( SteamID.WebInstance, sid.AccountInstance );
            Assert.Equal( EUniverse.Beta, sid.AccountUniverse );
            Assert.Equal( EAccountType.GameServer, sid.AccountType );

            Assert.Equal( 157626004137848889ul, sid.ConvertToUInt64() );
        }
开发者ID:ChronosWS,项目名称:SteamKit,代码行数:18,代码来源:SteamIDFacts.cs

示例3: ResolveVanityURL

        private static EResult ResolveVanityURL(string input, EVanityURLType urlType, out SteamID steamID)
        {
            steamID = new SteamID();

            using (dynamic steamUser = WebAPI.GetInterface("ISteamUser", Settings.Current.Steam.WebAPIKey))
            {
                steamUser.Timeout = (int)TimeSpan.FromSeconds(5).TotalMilliseconds;

                KeyValue response;

                try
                {
                    response = steamUser.ResolveVanityURL( vanityurl: input, url_type: (int)urlType );
                }
                catch (WebException)
                {
                    return EResult.Timeout;
                }

                var eResult = (EResult)response["success"].AsInteger();

                if (eResult == EResult.OK)
                {
                    steamID.SetFromUInt64((ulong)response["steamid"].AsLong());
                }

                return eResult;
            }
        }
开发者ID:RJacksonm1,项目名称:SteamDatabaseBackend,代码行数:29,代码来源:SteamID.cs

示例4: TrySetSteamID

        private static bool TrySetSteamID(string input, out SteamID steamID)
        {
            steamID = new SteamID();

            if (steamID.SetFromString(input, EUniverse.Public)
            ||  steamID.SetFromSteam3String(input))
            {
                return true;
            }

            ulong numericInput;

            if (ulong.TryParse(input, out numericInput))
            {
                steamID.SetFromUInt64(numericInput);

                return true;
            }

            return false;
        }
开发者ID:RJacksonm1,项目名称:SteamDatabaseBackend,代码行数:21,代码来源:SteamID.cs

示例5: OnBefriend

        public void OnBefriend(SteamID id)
        {
            string msg = "Hey " + getSteamName(id) + "!";

            DataSet valid_user = returnQuery("SELECT * FROM users WHERE SteamID64=" + id.ConvertToUInt64().ToString());
            bool registered = (valid_user.Tables[0].Rows.Count > 0);

            if (registered)
            {
                DataSet pending_tips = returnQuery("SELECT * FROM tips t WHERE notified=0 AND receiverID64=" + id.ConvertToUInt64().ToString());
                for (int t = 0; t < pending_tips.Tables[0].Rows.Count; t++)
                {
                    SteamID sender = new SteamID();
                    sender.SetFromUInt64(ulong.Parse(pending_tips.Tables[0].Rows[t][1].ToString()));

                    msg += "\n" + getTipNotification(sender, (double)pending_tips.Tables[0].Rows[t][3], (string)pending_tips.Tables[0].Rows[t][4], (string)pending_tips.Tables[0].Rows[t][8], (bool)pending_tips.Tables[0].Rows[t][7]);

                    BotManager.mainLog.Info("Notified user " + getSteamName(id) + " of " + pending_tips.Tables[0].Rows[t][3] +" DOGE tip.");
                }
                returnQuery("UPDATE tips SET notified = 1 WHERE receiverID64 = " + id.ConvertToUInt64().ToString());
            }

            if (registered)
            {
                if (!(bool)valid_user.Tables[0].Rows[0][3])
                    returnQuery("UPDATE users SET responded = 1 WHERE SteamID64 = " + id.ConvertToUInt64().ToString());
            }
            else
            {
                msg += "\n" + "It appears you have not registered yet. Type +register to get started.";
            }

            msg += "\nI have sent you an invite to my group 'DogeTipGroup'. Please accept it!.";
            msg += "\n(this is because I can only have a limited amount of people in my friend list)";
            sendMessage(id, null, false, msg);

            Bot.InviteUserToGroup(id, clanID);

            Bot.SteamFriends.RemoveFriend(id);

            BotManager.mainLog.Info("Player " + getSteamName(id) + " added me.");
        }
开发者ID:natoshi,项目名称:steamdogebot,代码行数:42,代码来源:DogeTipBotHandler.cs

示例6: command_tip


//.........这里部分代码省略.........
            }
            string message_receiver = message_words[1];
            string message_amount = message_words[2];
            string fulllabel = "";
            double amount;
            if (user_message.Split('\"').Length > 3)
            {
                sendMessage(sender, chatID, isChatroom, "Sorry, invalid query! Type '+help' for info.");
                return false;
            }
            if (!double.TryParse(message_amount.Replace('.', ','), out amount))
            {
                // Amount if not a number. Is it one of the tip amount commands?
                for (int l = 0; l < labels.Length; l++)
                {
                    if (message_amount.Equals(labels[l].label))
                    {
                        if(labels[l].currency==DogeLabel.Currency.USD)
                            amount = Math.Round(labels[l].amount/conversionRate);
                        else
                            amount = labels[l].amount;
                        fulllabel = labels[l].fulllabel;
                        break;
                    }
                }
                if (amount == 0)
                {
                    sendMessage(sender, chatID, isChatroom, "Sorry, invalid amount! Type '+help' for info.");
                    return false;
                }
            }
            if (amount < 5)
            {
                sendMessage(sender, chatID, isChatroom, "Sorry, minimal tip is 5 DOGE. This is in order to prevent spam.");
                return false;
            }
            if (amount > user_balance)
            {
                sendMessage(sender, chatID, isChatroom, "You don't have enough dogecoin for this tip.");
                return false;
            }

            string receiverID64 = "";
            if (message_receiver.Contains("steamcommunity"))
            {
                receiverID64 = getSteamID64(message_receiver);
            }
            else
            {
                message_receiver = message_receiver.Replace("\"", "").Replace("'", "");
                DataSet existing = returnQuery("SELECT * FROM aliases where userID64=" + sender.ConvertToUInt64().ToString() + " AND alias ='" + message_receiver + "'");
                if (existing.Tables[0].Rows.Count > 0)
                    receiverID64 = existing.Tables[0].Rows[0][2].ToString();
            }

            ulong receiverID64ulong;
            if (!ulong.TryParse(receiverID64, out receiverID64ulong))
            {
                sendMessage(sender, chatID, isChatroom, "Sorry, player not found and/or invalid URL! Type '+help' for info.");
                return false;
            }
            if (receiverID64ulong == sender.ConvertToUInt64())
            {
                sendMessage(sender, chatID, isChatroom, "You can't tip yourself silly!");
                return false;
            }

            SteamID receiverID = new SteamID();
            receiverID.SetFromUInt64(receiverID64ulong);

            Tip new_tip = new Tip();
            new_tip.sender = sender;
            new_tip.receiver = receiverID;
            new_tip.amount = amount;
            new_tip.donation = false;
            new_tip.anonymous = false;
            new_tip.message = message_msg;
            new_tip.label = fulllabel;

            if (user_message.Contains(" anon") || user_message.Contains(" anonymous"))
                new_tip.anonymous = true;

            string msg = "Are you sure you want to tip " + getSteamName(new_tip.receiver);
            if (fulllabel.Equals(""))
                msg += " " + new_tip.amount.ToString() + " DOGE";
            else
                msg += " " + new_tip.label + " (" + new_tip.amount.ToString() + " DOGE)";
            if (new_tip.anonymous)
                msg += " anonymously";
            if (!new_tip.message.Equals(""))
                msg += " with the message '"+new_tip.message+"'";
            msg += "?\nPlease type +yes or +no.";
            sendMessage(sender, chatID, isChatroom, msg);

            tip_confirmation.Add(sender);
            tip_pending.Add(new_tip);

            BotManager.mainLog.Info("Player " + getSteamName(sender) + " wants to send a tip (" + amount.ToString() + " DOGE)");
            return true;
        }
开发者ID:natoshi,项目名称:steamdogebot,代码行数:101,代码来源:DogeTipBot_commands.cs

示例7: ProcessEvent

        void ProcessEvent(int key, ExpandoObject obj)
        {
            //Console.WriteLine("Key " + key + " NextLogPos: " + (NextLogPos-1));

            if (key < Interlocked.Read(ref NextLogPos) - 1)
            {
                //Console.WriteLine("Ignoring...");
                return;
            }

            var evt = obj as IDictionary<string, object>;

            if (!evt.ContainsKey("action"))
                return;

            int action;
            if (!Int32.TryParse(evt["action"] as string, out action))
                return;

            string steamid = String.Empty;
            if (evt.ContainsKey("steamid"))
                steamid = evt["steamid"] as string;

            var steamId = new SteamID();
            steamId.SetFromUInt64(UInt64.Parse(steamid));

            if (steamId == OwnSteamId)
                return;

            var appid = evt["appid"] as int?;

            var tradeEvent = new TradeEvent();
            tradeEvent.sender = steamId;

            bool enqueue = false;
            bool loadForeign = false;

            switch (action)
            {
            case 0: // Item added/remove
            case 1:
            {
                var item = new TradeItem();
                tradeEvent.type = (action == 0) ?
                    ETradeEventType.ItemAdded : ETradeEventType.ItemRemoved;
                item.appid = appid.Value;
                int.TryParse(evt["assetid"] as string, out item.assetid);
                int.TryParse(evt["contextid"] as string, out item.contextid);
                tradeEvent.item = item;
                if (ForeignInventory == null)
                {
                    LoadForeignInventory(steamId, item.appid, item.contextid);
                    loadForeign = true;
                }
                enqueue = true;
                break;
            }
            case 2: // Ready/unready
            case 3:
            {
                tradeEvent.type = (action == 2) ?
                    ETradeEventType.Ready : ETradeEventType.Unready;
                var timestamp = evt["timestamp"] as int?;
                tradeEvent.timestamp = (uint)timestamp.Value;
                enqueue = true;
                break;
            }
            case 4: // Confirmed
            {
                tradeEvent.type = ETradeEventType.Confirmed;
                var timestamp = evt["timestamp"] as int?;
                tradeEvent.timestamp = (uint)timestamp.Value;
                enqueue = true;
                break;
            }
            case 7: // Chat message
            {
                string text = String.Empty;
                if (evt.ContainsKey("text"))
                    text = evt["text"] as string;
                tradeEvent.type = ETradeEventType.Message;
                tradeEvent.message = text;
                enqueue = true;
                break;
            }
            default:
                Console.WriteLine("Invalid action: " + action);
                break;
            }

            if (loadForeign)
                PendingEvents.Enqueue(tradeEvent);
            else if (enqueue)
                Events.Enqueue(tradeEvent);

            ResetTimer();
        }
开发者ID:KimimaroTsukimiya,项目名称:SteamBot-1,代码行数:97,代码来源:Trade.cs


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