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