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