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


C# SteamID.SetFromString方法代碼示例

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


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

示例1: SetFromStringHandlesInvalid

        public void SetFromStringHandlesInvalid()
        {
            SteamID sid = new SteamID();

            bool setFromNullString = sid.SetFromString( null, EUniverse.Public );
            Assert.False( setFromNullString );

            bool setFromEmptyString = sid.SetFromString( "", EUniverse.Public );
            Assert.False( setFromEmptyString );

            bool setFromInvalidString = sid.SetFromString( "NOT A STEAMID!", EUniverse.Public );
            Assert.False( setFromInvalidString );

            bool setFromInvalidAccountId = sid.SetFromString( "STEAM_0:1:999999999999999999999999999999", EUniverse.Public );
            Assert.False( setFromInvalidAccountId );
        }
開發者ID:Klumb3r,項目名稱:SteamKit,代碼行數:16,代碼來源:SteamIDFacts.cs

示例2: btnOK_Click

        private void btnOK_Click( object sender, EventArgs e )
        {
            SteamID steamId = new SteamID();
            steamId.SetFromString( txtFriend.Text, Steam3.SteamClient.ConnectedUniverse );

            if ( steamId.IsValid )
            {
                Steam3.SteamFriends.AddFriend( steamId );
            }
            else
            {
                Steam3.SteamFriends.AddFriend( txtFriend.Text );
            }

            this.Close();
        }
開發者ID:samphippen,項目名稱:steamre,代碼行數:16,代碼來源:AddFriendDialog.cs

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


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