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


C# SteamID.ConvertToUInt64方法代碼示例

本文整理匯總了C#中SteamKit2.SteamID.ConvertToUInt64方法的典型用法代碼示例。如果您正苦於以下問題:C# SteamID.ConvertToUInt64方法的具體用法?C# SteamID.ConvertToUInt64怎麽用?C# SteamID.ConvertToUInt64使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在SteamKit2.SteamID的用法示例。


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

示例1: LogOn

        /// <summary>
        /// Logs onto the Steam network as a persistent game server.
        /// The client should already have been connected at this point.
        /// Results are return in a <see cref="SteamUser.LoggedOnCallback"/>.
        /// </summary>
        /// <param name="details">The details to use for logging on.</param>
        /// <exception cref="System.ArgumentNullException">No logon details were provided.</exception>
        /// <exception cref="System.ArgumentException">Username or password are not set within <paramref name="details"/>.</exception>
        public void LogOn( LogOnDetails details )
        {
            if ( details == null )
            {
                throw new ArgumentNullException( "details" );
            }

            if ( string.IsNullOrEmpty( details.Username ) || string.IsNullOrEmpty( details.Password ) )
            {
                throw new ArgumentException( "LogOn requires a username and password to be set in 'details'." );
            }

            var logon = new ClientMsgProtobuf<CMsgClientLogon>( EMsg.ClientLogon );

            SteamID gsId = new SteamID( 0, 0, Client.ConnectedUniverse, EAccountType.GameServer );

            logon.ProtoHeader.client_sessionid = 0;
            logon.ProtoHeader.steamid = gsId.ConvertToUInt64();

            uint localIp = NetHelpers.GetIPAddress( this.Client.LocalIP );
            logon.Body.obfustucated_private_ip = localIp ^ MsgClientLogon.ObfuscationMask;

            logon.Body.protocol_version = MsgClientLogon.CurrentProtocol;

            logon.Body.client_os_type = ( uint )Utils.GetOSType();
            logon.Body.game_server_app_id = ( int )details.AppID;
            logon.Body.machine_id = Utils.GenerateMachineID();

            logon.Body.account_name = details.Username;
            logon.Body.password = details.Password;

            this.Client.Send( logon );
        }
開發者ID:Klumb3r,項目名稱:SteamKit,代碼行數:41,代碼來源:SteamGameServer.cs

示例2: GenericInventory

 public GenericInventory(SteamID steamId, SteamID botId, bool inTrade = false)
 {
     ConstructTask = Task.Factory.StartNew(() =>
     {
         this.UserId = steamId;
         this.BotId = botId;
         string baseInventoryUrl = "http://steamcommunity.com/profiles/" + steamId.ConvertToUInt64() + "/inventory/";
         string response = RetryWebRequest(baseInventoryUrl, botId);
         Regex reg = new Regex("var g_rgAppContextData = (.*?);");
         Match m = reg.Match(response);
         if (m.Success)
         {
             try
             {
                 string json = m.Groups[1].Value;
                 var schemaResult = JsonConvert.DeserializeObject<Dictionary<int, InventoryApps>>(json);
                 foreach (var app in schemaResult)
                 {
                     int appId = app.Key;
                     InventoryTasks[appId] = new Dictionary<long, Task>();
                     foreach (var contextId in app.Value.RgContexts.Keys)
                     {
                         InventoryTasks[appId][contextId] = Task.Factory.StartNew(() =>
                         {
                             string inventoryUrl = string.Format("http://steamcommunity.com/profiles/{0}/inventory/json/{1}/{2}/", steamId.ConvertToUInt64(), appId, contextId);
                             var inventory = FetchInventory(inventoryUrl, steamId, botId, appId, contextId);
                             if (!inventories.ContainsKey(appId))
                                 inventories[appId] = new Dictionary<long, Inventory>();
                             if (inventory != null && !inventories[appId].ContainsKey(contextId))
                                 inventories[appId].Add(contextId, inventory);
                         });
                     }
                 }
             }
             catch (Exception ex)
             {
                 Success = false;
                 Console.WriteLine(ex);
             }
         }
         else
         {
             Success = false;
             IsPrivate = true;
         }
     });
 }
開發者ID:The-Mad-Pirate,項目名稱:Mist,代碼行數:47,代碼來源:GenericInventory.cs

示例3: ClanFromChat

        public static SteamID ClanFromChat(SteamID chatId)
        {
            if (!chatId.IsChatAccount)
                throw new ArgumentException("chatId is not a chat account");

            SteamID clanId = chatId.ConvertToUInt64();

            clanId.AccountInstance = 0;
            clanId.AccountType = EAccountType.Clan;

            return clanId;
        }
開發者ID:Rohansi,項目名稱:EzSteam,代碼行數:12,代碼來源:Util.cs

示例4: ChatFromClan

        public static SteamID ChatFromClan(SteamID clanId)
        {
            if (!clanId.IsClanAccount)
                throw new ArgumentException("clanId is not a clan account");

            SteamID chatId = clanId.ConvertToUInt64();

            chatId.AccountInstance = (uint)SteamID.ChatInstanceFlags.Clan;
            chatId.AccountType = EAccountType.Chat;

            return chatId;
        }
開發者ID:Rohansi,項目名稱:EzSteam,代碼行數:12,代碼來源:Util.cs

示例5: OpenProfile

        public static void OpenProfile( SteamID steamId )
        {
            string friendUrl = string.Format( "http://www.steamcommunity.com/profiles/{0}", steamId.ConvertToUInt64() );

            if ( Util.IsMono() )
            {
                Process.Start( string.Format( "xdg-open {0:s}", friendUrl ) );
            }
            else
            {
                Process.Start( friendUrl );
            }
        }
開發者ID:samphippen,項目名稱:steamre,代碼行數:13,代碼來源:Util.cs

示例6: GetInventory

        /// <summary>
        /// Gets the inventory for the given Steam ID using the Steam Community website.
        /// </summary>
        /// <returns>The inventory for the given user. </returns>
        /// <param name='steamid'>The Steam identifier. </param>
        public static dynamic GetInventory(SteamID steamid)
        {
            string url = String.Format (
                "http://steamcommunity.com/profiles/{0}/inventory/json/440/2/?trading=1",
                steamid.ConvertToUInt64 ()
            );

            try
            {
                string response = SteamWeb.Fetch (url, "GET", null, null, true);
                return JsonConvert.DeserializeObject (response);
            }
            catch (Exception)
            {
                return JsonConvert.DeserializeObject ("{\"success\":\"false\"}");
            }
        }
開發者ID:newhupo,項目名稱:SteamBot-1,代碼行數:22,代碼來源:Inventory.cs

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

示例8: isBotAdmin

        public static bool isBotAdmin(SteamID steamid)
        {
            try
            {
                if(steamid.ConvertToUInt64() == Convert.ToUInt64(File.ReadAllText("admin.txt")))
                {
                    return true;
                }

                steamFriends.SendChatMessage(steamid, EChatEntryType.ChatMsg, "You Are Not A Bot Admin...");
                Console.WriteLine(steamFriends.GetFriendPersonaName(steamid) + " are attempted to use as admin while not an admin!");

                return false;
            }
            catch(Exception e)
            {
                Console.WriteLine(e.Message);
                return false;
            }
        }
開發者ID:aiman-nafiz,項目名稱:SteamBot,代碼行數:20,代碼來源:Program.cs

示例9: BanChatMember

        /// <summary>
        /// Bans the specified chat member from the given chat room.
        /// </summary>
        /// <param name="steamIdChat">The SteamID of chat room to ban the member from.</param>
        /// <param name="steamIdMember">The SteamID of the member to ban from the chat.</param>
        public void BanChatMember( SteamID steamIdChat, SteamID steamIdMember )
        {
            SteamID chatId = steamIdChat.ConvertToUInt64(); // copy the steamid so we don't modify it

            var banMember = new ClientMsg<MsgClientChatAction>();

            if ( chatId.IsClanAccount )
            {
                // this steamid is incorrect, so we'll fix it up
                chatId.AccountInstance = ( uint )SteamID.ChatInstanceFlags.Clan;
                chatId.AccountType = EAccountType.Chat;
            }

            banMember.Body.SteamIdChat = chatId;
            banMember.Body.SteamIdUserToActOn = steamIdMember;

            banMember.Body.ChatAction = EChatAction.Ban;

            this.Client.Send( banMember );
        }
開發者ID:nuds7,項目名稱:text2steam,代碼行數:25,代碼來源:steamfriends+reference.cs

示例10: CreateServerTicket

        public static ImmutableArray<byte> CreateServerTicket(
                SteamID id, ImmutableArray<byte> auth, byte[] ownershipTicket) {
            long size = 8 + // steam ID
                        auth.Length +
                        4 + // length of ticket
                        ownershipTicket.Length;

            MemoryStream stream = new MemoryStream();
            using (var writer = new BinaryWriter(stream)) {
                writer.Write((ushort) size);
                writer.Write(id.ConvertToUInt64());

                writer.Write(auth.ToArray());

                writer.Write(ownershipTicket.Length);
                writer.Write(ownershipTicket);

                writer.Write(0);
            }

            return stream.ToArray().ToImmutableArray();
        }
開發者ID:hot1989hot,項目名稱:nora,代碼行數:22,代碼來源:AuthTicket.cs

示例11: LeaveChat

        /// <summary>
        /// Attempts to leave a chat room.
        /// </summary>
        /// <param name="steamId">The SteamID of the chat room.</param>
        public void LeaveChat( SteamID steamId )
        {
            SteamID chatId = steamId.ConvertToUInt64(); // copy the steamid so we don't modify it

            var leaveChat = new ClientMsg<MsgClientChatMemberInfo>();

            if ( chatId.IsClanAccount )
            {
                // this steamid is incorrect, so we'll fix it up
                chatId.AccountInstance = ( uint )SteamID.ChatInstanceFlags.Clan;
                chatId.AccountType = EAccountType.Chat;
            }

            leaveChat.Body.SteamIdChat = chatId;
            leaveChat.Body.Type = EChatInfoType.StateChange;

            leaveChat.Write( Client.SteamID.ConvertToUInt64() ); // ChatterActedOn
            leaveChat.Write( ( uint )EChatMemberStateChange.Left ); // StateChange
            leaveChat.Write( Client.SteamID.ConvertToUInt64() ); // ChatterActedBy

            Client.Send( leaveChat );
        }
開發者ID:katsalap,項目名稱:SteamKit,代碼行數:26,代碼來源:SteamFriends.cs

示例12: initTrade

		public void initTrade (SteamID me, SteamID other, CookieCollection cookies)
		{
			//Cleanup again
			cleanTrade();

			//Setup
			meSID = me;
			otherSID = other;
			version = 1;
			logpos = 0;
			WebCookies = cookies;
			sessionid = cookies[0].Value;
			
			baseTradeURL = String.Format (STEAM_TRADE_URL, otherSID.ConvertToUInt64 ());
			
			this.WebCookies = cookies;


			
			printConsole ("[TradeSystem] Init Trade with " + otherSID, ConsoleColor.DarkGreen);
			

			try {

				//poll? poll.
				poll ();

			} catch (Exception) {
				printConsole ("[TradeSystem][ERROR] Failed to connect to Steam!", ConsoleColor.Red);
				//Send a message on steam
				MainClass.steamFriends.SendChatMessage(otherSID,EChatEntryType.ChatMsg,"Sorry, There was a problem connecting to Steam Trading.  Try again in a few minutes.");
				cleanTrade();
			}



			

			printConsole ("[TradeSystem] Getting Player Inventories...", ConsoleColor.Yellow);

			int good = 0;

			OtherItems = getInventory (otherSID);
			if (OtherItems.success=="true") {
				printConsole ("[TradeSystem] Got Other player's inventory!", ConsoleColor.Green); 
				good++;
			} else {

			}
				

			MyItems = getInventory (meSID);
			if (MyItems.success=="true") {
				printConsole ("[TradeSystem] Got the bot's inventory!", ConsoleColor.Green); 
				good++;
			}

			if (good == 2) {
				printConsole ("[TradeSystem] All is a go! Starting to Poll!", ConsoleColor.Green);

				//Timer
				pollTimer = new System.Threading.Timer (TimerCallback, null, 0, 1000);

				//Send MOTD
				sendChat ("Welcome to SteamBot!");
			} else {
				printConsole ("[TradeSystem][ERROR] status was not good! ABORT ABORT ABORT!", ConsoleColor.Red);

				//Poll once to send an error message
				poll ();

				//send error
				sendChat("SteamBot has an error!  Please try trading the bot again in a few minutes.  This is Steam's fault NOT mine.");

				//Poll again so they can read it
				poll ();
			}


			/*
			 * How to Loop through the inventory:
			foreach(var child in OtherItems.rgInventory.Children())
			{
			    Console.WriteLine("Item ID: {0}", child.First.id);
			}
			*/
		}
開發者ID:geel9,項目名稱:SteamBot,代碼行數:87,代碼來源:TradeSystem.cs

示例13: JoinChat

        /// <summary>
        /// Attempts to join a chat room.
        /// </summary>
        /// <param name="steamId">The SteamID of the chat room.</param>
        public void JoinChat( SteamID steamId )
        {
            SteamID chatId = steamId.ConvertToUInt64(); // copy the steamid so we don't modify it

            var joinChat = new ClientMsg<MsgClientJoinChat>();

            if ( chatId.IsClanAccount )
            {
                // this steamid is incorrect, so we'll fix it up
                chatId.AccountInstance = ( uint )SteamID.ChatInstanceFlags.Clan;
                chatId.AccountType = EAccountType.Chat;
            }

            joinChat.Body.SteamIdChat = chatId;

            Client.Send( joinChat );

        }
開發者ID:katsalap,項目名稱:SteamKit,代碼行數:22,代碼來源:SteamFriends.cs

示例14: GetCalculatorURL

 public static string GetCalculatorURL(SteamID steamID)
 {
     return new Uri(Settings.Current.BaseURL, string.Format("/calculator/?player={0}", steamID.ConvertToUInt64())).AbsoluteUri;
 }
開發者ID:ZR2,項目名稱:SteamDatabaseBackend,代碼行數:4,代碼來源:SteamDB.cs

示例15: getInventory

		private dynamic getInventory (SteamID steamid)
		{

			var request = CreateSteamRequest(String.Format("http://steamcommunity.com/profiles/{0}/inventory/json/440/2/?trading=1",steamid.ConvertToUInt64()),"GET");
			
			HttpWebResponse resp = request.GetResponse() as HttpWebResponse;
			Stream str = resp.GetResponseStream();
			StreamReader reader = new StreamReader(str);
			string res = reader.ReadToEnd();

			dynamic json = JsonConvert.DeserializeObject(res);

			return json;

		}
開發者ID:geel9,項目名稱:SteamBot,代碼行數:15,代碼來源:TradeSystem.cs


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