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


C# SteamKit2.SteamID類代碼示例

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


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

示例1: Trade

        public Trade(SteamID me, SteamID other, string sessionId, string token, string apiKey, Bot bot)
        {
            MeSID = me;
            OtherSID = other;

            this.sessionId = sessionId;
            steamLogin = token;
            this.apiKey = apiKey;
            this.bot = bot;

            // Moved here because when Poll is called below, these are
            // set to zero, which closes the trade immediately.
            MaximumTradeTime = bot.MaximumTradeTime;
            MaximumActionGap = bot.MaximiumActionGap;

            baseTradeURL = String.Format (SteamTradeUrl, OtherSID.ConvertToUInt64 ());

            // try to poll for the first time
            try
            {
                Poll ();
            }
            catch (Exception)
            {
                bot.log.Error ("[TRADE] Failed To Connect to Steam!");

                if (OnError != null)
                    OnError("There was a problem connecting to Steam Trading.");
            }

            FetchInventories ();
        }
開發者ID:remco138,項目名稱:SteamBot,代碼行數:32,代碼來源:Trade.cs

示例2: Remove

        public void Remove( SteamID steamId )
        {
            if ( !chatMap.ContainsKey( steamId ) )
                return;

            chatMap.Remove( steamId );
        }
開發者ID:scottkf,項目名稱:sendmessage,代碼行數:7,代碼來源:ChatManager.cs

示例3: Run

        private async Task Run(SteamID toID, string[] query, bool room)
        {
            YouTubeService ys = new YouTubeService(new BaseClientService.Initializer()
            {
                ApiKey = Options.ChatCommandApi.ApiKey,
                ApplicationName = "Steam Chat Bot"
            });

            SearchResource.ListRequest search = ys.Search.List("snippet");
            string q = "";
            for (int i = 1; i < query.Length; i++)
            {
                q += query[i] + " ";
            }
            q = q.Trim();
            search.Q = q;
            search.MaxResults = 1;
            
            SearchListResponse response = await search.ExecuteAsync();
            
            foreach (SearchResult result in response.Items)
            {
                if (result.Id.Kind == "youtube#video")
                {
                    SendMessageAfterDelay(toID, "https://youtube.com/watch?v=" + result.Id.VideoId, room);
                }
                else if(result.Id.Kind == "youtube#channel")
                {
                    SendMessageAfterDelay(toID, "https://youtube.com/channel/" + result.Id.ChannelId, room);
                }
            }
        }
開發者ID:Steam-Chat-Bot,項目名稱:SteamChatBot,代碼行數:32,代碼來源:YoutubeTrigger.cs

示例4: ShowTrade_Web

        public ShowTrade_Web(SteamID OtherSID)
        {
            InitializeComponent();

            extendedWebBrowser1.UserAgent = "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/536.11 (KHTML, like Gecko) Chrome/20.0.1132.47 Safari/536.11";
            extendedWebBrowser1.Navigate(trade_url, null, null, "Cookies: " + Trade.cookies.GetCookieHeader(new Uri(trade_url)) + Environment.NewLine);
        }
開發者ID:Jamyn,項目名稱:Mist,代碼行數:7,代碼來源:ShowTrade_Web.cs

示例5: UI

        public UI()
        {
            InitializeComponent();
            this.FormClosed += new FormClosedEventHandler(stopGSListen);

            settings = grabSid();

            if (settings.Length.Equals(0))
            {
                MessageBox.Show("Please paste your SteamID into the steamid.txt file created in the folder this program is in and restart the program.");
                Environment.Exit(0);
            }
            else
            {
                sid = settings[0];

                //Set custom colors
                if (settings.Length > 1)
                {
                    if (settings.Length.Equals(7))
                    {
                        string u, v, w, x, y, z;

                        u = settings[1];
                        v = settings[2];
                        w = settings[3];
                        x = settings[4];
                        y = settings[5];
                        z = settings[6];

                        setColors(u, v, w, x, y, z);
                    }
                    else
                    {
                        MessageBox.Show("In order to use custom colors, you muse serparate two sets of RGB values in the config.txt file like so:\n\n" +
                            "<steamid> <R> <G> <B> <R> <G> <B>\n\n" +
                            "All values must be within 0-255 and must be separated by spaces. The first set of values are for background color and the second set are for stat counter color. En example configuration would look like the following:\n\n" +
                            "STEAM_0:0:1234 64 64 64 0 192 0");
                    }
                }

                s = new SteamID(sid.Trim());

                if (s.IsValid)
                {
                    gsl = new GameStateListener(3000);
                    gsl.NewGameState += new NewGameStateHandler(OnNewGameState);
                    if (!gsl.Start())
                    {
                        Environment.Exit(0);
                    }
                    Console.WriteLine("Listening...");
                }
                else
                {
                    MessageBox.Show("INVALID STEAMID PROVIDED\n\nSteamID must be in regular SteamID format. EX: STEAM_0:0:39990");
                    Environment.Exit(0);
                }
            }
        }
開發者ID:RaZiiandStuff,項目名稱:csgo-stream-scoreboard,代碼行數:60,代碼來源:UI.cs

示例6: Use

        public override void Use(SteamID room, SteamID sender, string[] args)
        {
            Steam.Shutdown();

            string fileName = AppDomain.CurrentDomain.FriendlyName.Replace(".vshost", ""); //Turns bot.vshost.exe into bot.exe
            Process.Start(fileName);
        }
開發者ID:EIREXE,項目名稱:discord,代碼行數:7,代碼來源:CmdRestart.cs

示例7: ShowBackpack

 public ShowBackpack(Bot bot, SteamID SID)
 {
     InitializeComponent();
     this.bot = bot;
     this.SID = SID;
     this.Text = bot.SteamFriends.GetFriendPersonaName(SID) + "'s Backpack";
 }
開發者ID:Jamyn,項目名稱:Mist,代碼行數:7,代碼來源:ShowBackpack.cs

示例8: ReceivingUserHandler

 // Todo: move the item-check after a failed trade to a separate method to clean up handler.
 public ReceivingUserHandler(Bot bot, SteamID sid, Configuration config)
     : base(bot, sid, config)
 {
     Success = false;
     mySteamID = Bot.SteamUser.SteamID;
     ReceivingSID = mySteamID;
 }
開發者ID:narugo,項目名稱:SteamBot-Idle,代碼行數:8,代碼來源:ReceivingUserHandler.cs

示例9: Respond

 private bool Respond(SteamID toID, SteamID userID, string message, bool room)
 {
     string[] query = StripCommand(message, Options.ChatCommand.Command);
     if (query != null)
     {
         HttpWebResponse response;
         try
         {
             HttpWebRequest request = (HttpWebRequest)WebRequest.Create(query[1]);
             response = (HttpWebResponse)request.GetResponse();
         }
         catch (UriFormatException e)
         {
             Log.Instance.Error(Bot.username + "/" + Name + ": " + e.StackTrace);
             SendMessageAfterDelay(toID, "Uri was not in the correct format (missing http:// probably).", true);
             response = null;
             return false;
         }
         catch (WebException e)
         {
             response = ((HttpWebResponse)e.Response);
         }
         SendMessageAfterDelay(toID, response.StatusCode.ToString() + " (" + (int)response.StatusCode + ")", room);
         return true;
     }
     return false;
 }
開發者ID:truongphamx,項目名稱:SteamChatBot,代碼行數:27,代碼來源:IsUpTrigger.cs

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

示例11: Respond

 private bool Respond(SteamID toID, string message, bool room)
 {
     string pattern = @"\<title\b[^>]*\>\s*(?<Title>[\s\S]*?)\</title\>";
     Uri uriResult;
     string[] splitmes = message.Split(' ');
     for (int i = 0; i < splitmes.Length; i++)
     {
         try
         {
             bool result = Uri.TryCreate(splitmes[i], UriKind.Absolute, out uriResult) && (uriResult.Scheme == Uri.UriSchemeHttp || uriResult.Scheme == Uri.UriSchemeHttps);
             if (result)
             {
                 using (WebClient client = new WebClient())
                 {
                     string body = client.DownloadString(splitmes[i]);
                     string title = Regex.Match(body, pattern, RegexOptions.IgnoreCase).Groups["Title"].Value;
                     if (title != null)
                     {
                         SendMessageAfterDelay(toID, title.ToString(), room);
                         return true;
                     }
                 }
             }
             else
             {
                 return false;
             }
         }
         catch (WebException e)
         {
             Log.Instance.Error(e.StackTrace);
         }
     }
     return false;
 }
開發者ID:truongphamx,項目名稱:SteamChatBot,代碼行數:35,代碼來源:LinkNameTrigger.cs

示例12: AddChatRoom

        /// <summary>
        /// Adds a chat room to the list of currently joined chat rooms.
        /// </summary>
        /// <param name="steamID">The SteamID of the chat room.</param>
        /// <param name="name">The name of the chat room.</param>
        /// <returns>The created chat room.</returns>
        public ChatRoom AddChatRoom(SteamID steamID, string name)
        {
            var chatRoom = new ChatRoom(_steamNerd, steamID, name);
            _chatrooms[steamID] = chatRoom;

            return chatRoom;
        }
開發者ID:bakerj76,項目名稱:SteamNerd,代碼行數:13,代碼來源:ChatRoomManager.cs

示例13: LogChat

 public static void LogChat(SteamID sender, string msg)
 {
     //Console.ForegroundColor = ConsoleColor.Cyan;
     //Console.Write(Friends.GetFriendPersonaName(sender) + ": ");
     //Console.ForegroundColor = ConsoleColor.White;
     //Console.WriteLine(msg);
 }
開發者ID:Strinkor,項目名稱:SteamBotPlugin,代碼行數:7,代碼來源:steambot.cs

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

示例15: Respond

        private bool Respond(SteamID toID, string message, bool room)
        {
            string[] query = StripCommand(message, Options.ChatCommandApi.ChatCommand.Command);
            if (query != null && query[1] != null)
            {
                if (Options.ChatCommandApi.ApiKey == null)
                {
                    SendMessageAfterDelay(toID, "API Key from Wunderground is required.", room);
                    return false;
                }
                else
                {
                    HttpWebRequest request = (HttpWebRequest)WebRequest.Create(string.Format("http://api.wunderground.com/api/{0}/{1}/q/{2}.json", Options.ChatCommandApi.ApiKey, "conditions", query[1]));
                    string body = "";
                    Weather weather = null;

                    using (var wundergroud = (HttpWebResponse)request.GetResponse())
                    {
                        using (var sr = new StreamReader(wundergroud.GetResponseStream()))
                        {
                            JavaScriptSerializer js = new JavaScriptSerializer();
                            body = sr.ReadToEnd();
                            weather = (Weather)js.Deserialize(body, typeof(Weather));
                            SendMessageAfterDelay(toID, ParseResult(weather), room);
                            return true;
                        }
                    }

                }
            }
            return false;
        }
開發者ID:truongphamx,項目名稱:SteamChatBot,代碼行數:32,代碼來源:WeatherTrigger.cs


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