Example #1
0
        public Stats()
        {
            p_CommandsUsed = 0;
            p_LastOnline = 0;
            p_Loads = 1;
            p_Online = false;
            p_PlayTime = 0;
            p_RunTime = 0;
            p_Skin = string.Empty;
            p_SongsCompleted = 0;
            p_SongsPlayed = 0;
            p_UserSince = 0;

            p_ChattyCathy = 0;
            p_JukeboxHero = 0;
            p_LeetHaxor = 0;
            p_MP3Playah = 0;
            p_RadioStar = 0;
            p_Repetition = 0;
            p_ShamelessPlug = 0;
            p_ShortStop = 0;
            p_SkinnyDipper = 0;

            retry:
            if (!Global.MediaPlayer.IsOnline)
            {
                UI.InfoDialog id = new UI.InfoDialog("You must be connected to the internet for STEAMp3 to run properly." + Environment.NewLine + Environment.NewLine + "Click Abort to exit, or Retry to try again.", UI.InfoDialog.InfoButtons.AbortRetry);
                if (id.ShowDialog() == DialogResult.Retry) goto retry;
                else
                {
                    Process.GetCurrentProcess().Kill(); //?
                    //Exit();
                    return;
                }
            }

            try
            {
                p_WebClient = new WebClient();
                p_WebClient.Headers.Add("Content-Type", "application/x-www-form-urlencoded");
                p_WebClient.Headers.Add("User-Agent", "STEAMp3/" + Application.ProductVersion);

                string data = "login="******"&bd=" + Application.ProductVersion;
                string result = p_WebClient.UploadString("http://steamp3.ta0soft.com/stats.php", "POST", data);
                p_WebClient.Dispose();

                if (result.Equals("Failure")) return;

                XmlDocument xml = new XmlDocument();
                xml.LoadXml(result);
                XmlNodeList users = xml.SelectNodes("Steamp3.Stats/Users/User");

                foreach (XmlNode user in users)
                {
                    if (Global.GetXmlValue(user, "ID", "0") == Global.Steam.Client.GetSteamID().ToUInt64().ToString())
                    {
                        p_CommandsUsed = Global.StringToInt(Global.GetXmlValue(user, "CommandsUsed", "0"));
                        p_LastOnline = Global.StringToInt(Global.GetXmlValue(user, "LastOnline", "0"));
                        p_Loads = Global.StringToInt(Global.GetXmlValue(user, "Loads", "1"));
                        p_Online = Global.StringToBool(Global.GetXmlValue(user, "Online", "0"), "1");
                        p_PlayTime = Global.StringToInt(Global.GetXmlValue(user, "PlayTime", "0"));
                        p_RunTime = Global.StringToInt(Global.GetXmlValue(user, "RunTime", "0"));
                        p_Skin = Global.GetXmlValue(user, "Skin", string.Empty);
                        p_SongsCompleted = Global.StringToInt(Global.GetXmlValue(user, "SongsCompleted", "0"));
                        p_SongsPlayed = Global.StringToInt(Global.GetXmlValue(user, "SongsPlayed", "0"));
                        p_UserSince = Global.StringToInt(Global.GetXmlValue(user, "UserSince", "0"));

                        XmlNode achievements = user.SelectSingleNode("Achievements");

                        p_ChattyCathy = Global.StringToInt(Global.GetXmlValue(achievements, "ChattyCathy", "0"));
                        p_JukeboxHero = Global.StringToInt(Global.GetXmlValue(achievements, "JukeboxHero", "0"));
                        p_LeetHaxor = Global.StringToInt(Global.GetXmlValue(achievements, "LeetHaxor", "0"));
                        p_MP3Playah = Global.StringToInt(Global.GetXmlValue(achievements, "MP3Playah", "0"));
                        p_RadioStar = Global.StringToInt(Global.GetXmlValue(achievements, "RadioStar", "0"));
                        p_Repetition = Global.StringToInt(Global.GetXmlValue(achievements, "Repetition", "0"));
                        p_ShamelessPlug = Global.StringToInt(Global.GetXmlValue(achievements, "ShamelessPlug", "0"));
                        p_ShortStop = Global.StringToInt(Global.GetXmlValue(achievements, "ShortStop", "0"));
                        p_SkinnyDipper = Global.StringToInt(Global.GetXmlValue(achievements, "SkinnyDipper", "0"));
                        return;
                    }
                }
            }
            catch { }
        }
Example #2
0
        public Steam()
        {
            retry:
            p_Client = new SteamAPI.SteamClient();
            if (!p_Client.Connected)
            {
                UI.InfoDialog id = new UI.InfoDialog("Steam must be loaded for STEAMp3 to run properly, it was not found." + Environment.NewLine + Environment.NewLine + "Click Abort to exit, or Retry to try again.", UI.InfoDialog.InfoButtons.AbortRetry);
                if (id.ShowDialog() == DialogResult.Retry) goto retry;
                else
                {
                    Process.GetCurrentProcess().Kill(); //?
                    //Exit();
                    return;
                }
            }

            p_Chat = new SteamAPI.ChatRoom(p_Client);
            //p_Chat.ChatIDChanged += new SteamAPI.ChatRoom.ChatIDChangedEventHandler(p_Chat_ChatIDChanged);
            p_Chat.MessageReceived += new SteamAPI.ChatRoom.MessageReceivedEventHandler(p_Chat_MessageReceived);

            p_Lobby = new SteamAPI.Lobby(p_Client);
            //p_Lobby.LobbyIDChanged += new SteamAPI.Lobby.LobbyIDChangedEventHandler(p_Lobby_LobbyIDChanged);
            p_Lobby.MessageReceived += new SteamAPI.Lobby.MessageReceivedEventHandler(p_Lobby_MessageReceived);

            p_PM = new SteamAPI.PrivateMessage(p_Client);
            //p_PM.FriendIDChanged += new SteamAPI.PrivateMessage.FriendIDChangedEventHandler(p_PM_FriendIDChanged);
            p_PM.MessageReceived += new SteamAPI.PrivateMessage.MessageReceivedEventHandler(p_PM_MessageReceived);
        }
Example #3
0
        public void CheckForUpdates(bool info)
        {
            if (!Global.MediaPlayer.IsOnline) return;

            try
            {
                XmlDocument xml = new XmlDocument();
                xml.Load("http://steamp3.ta0soft.com/liveupdate/liveupdate.xml");
                XmlNode node = xml.SelectSingleNode("Steamp3.LiveUpdate/Update");

                string[] currentVersion = Application.ProductVersion.Split(new char[] { '.' });
                string[] newVersion = node.Attributes["Version"].Value.Split(new char[] { '.' });

                if (currentVersion.GetUpperBound(0) != newVersion.GetUpperBound(0)) return;

                for (int i = 0; i < 3; i++)
                {
                    if (Global.StringToInt(newVersion[i]) > Global.StringToInt(currentVersion[i]))
                    {
                        UI.UpdateDialog ud = new UI.UpdateDialog(node);
                        if (ud.ShowDialog(this) == DialogResult.OK)
                        {
                            string args = string.Empty;
                            FileStream fs = new FileStream(Application.StartupPath + "\\LiveUpdate.exe", FileMode.Create);

                            fs.Write(Properties.Resources.LiveUpdate, 0, Properties.Resources.LiveUpdate.Length);
                            fs.Close();

                            foreach (UI.UpdateListItem item in ud.UpdateList.FilteredItems)
                            {
                                if (item.Backup) args += "\"" + Application.StartupPath + "\\" + item.URL + ".bak\" ";
                            }
                            args = args.Substring(0, args.Length - 1);

                            Process.Start(Application.StartupPath + "\\LiveUpdate.exe", args);

                            Process.GetCurrentProcess().Kill(); //?
                            //Exit();
                        }

                        ud.Dispose();
                        return;
                    }
                }

                if (info)
                {
                    UI.InfoDialog id = new UI.InfoDialog("This version of STEAMp3 (" + Application.ProductVersion + ") is up to date, no new updates available.");
                    id.ShowDialog(this);
                    id.Dispose();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }