Ejemplo n.º 1
0
 private void button1_Click(object sender, RoutedEventArgs e)
 {
     if (ButtonLoginLogout.Content == "Logout")
     {
         ProfileSaver_ProfileReader.logoutProfile();
         steamNameBox.Text         = "";
         avatarBox.Source          = null;
         ButtonLoginLogout.Content = "Login";
     }
     else
     {
         steamLogin loginWindow = new steamLogin();
         loginWindow.ShowDialog();
         if (loginWindow.DialogResult == true)
         {
             string userId             = loginWindow.enteredSteamID;
             var    writeToFile        = ProfileSaver_ProfileReader.checkForSteamIDInFile(userId);
             var    activeSteamProfile = ProfileSaver_ProfileReader.checkForProfile();
             if (activeSteamProfile != "NoProfileFound" && activeSteamProfile != "NoProfileFile")
             {
                 var         profileInfo     = functions.JSONReader.ReadJSON(playerDetailUrl + activeSteamProfile, public_properties.SteamProfile.playerStats, public_properties.SteamProfile.playerStatsEnd); // gets all information about profile
                 string      avatarImageLink = profileInfo[13].Insert(6, ":");
                 BitmapImage bitmapImage     = new BitmapImage(new Uri(avatarImageLink));
                 steamNameBox.Text = profileInfo[3];
                 avatarBox.Source  = bitmapImage;
                 LoggedInUser      = activeSteamProfile;
                 getAllCSGOStats();
                 ButtonLoginLogout.Content = "Logout";
             }
         }
     }
 }
        public ProfileCSGOStats()
        {
            InitializeComponent();
            friendlist.Clear();
            UserId = functions.ProfileSaver_ProfileReader.checkForProfile();
            FriendList();
            lb_friendnumber.Content = friendlist.Count().ToString();
            string steamID = ProfileSaver_ProfileReader.checkForProfile();

            if (steamID != "NoProfileFound" && steamID != "NoProfileFile")
            {
                var         profileInfo     = functions.JSONReader.ReadJSON(playerDetailUrl + UserId, public_properties.SteamProfile.playerStats, public_properties.SteamProfile.playerStatsEnd); // gets all information about profile
                string      avatarImageLink = profileInfo[13].Insert(6, ":");
                BitmapImage bitmapImage     = new BitmapImage(new Uri(avatarImageLink));
                steamNameBox2.Text        = profileInfo[3];
                avatarBox2.Source         = bitmapImage;
                ButtonLoginLogout.Content = "Logout";
            }

            foreach (var friend in friendlist)
            {
                Label lb = new Label();
                lb.Height = 28;
                lb.Width  = 100;
                lb.HorizontalAlignment = HorizontalAlignment.Left;
                lb.VerticalAlignment   = VerticalAlignment.Top;
                lb.Content             = friendlist[i][3];
                i++;
                lb.Margin = new Thickness(0, location, 0, 0);
                location += 20;
                friendlistgrid.Children.Add(lb);
            }
        }
        public LoginNewsPage()
        {
            InitializeComponent();
            int    count       = 0;
            string testAccount = "76561197988627193";                          //OLOFMEISTER BOOSTMEISTER
            string profile     = ProfileSaver_ProfileReader.checkForProfile(); //check if there is anybody logged in

            if (File.Exists(userFilePath))
            {
                string steamID = ProfileSaver_ProfileReader.checkForProfile();
                if (steamID != "NoProfileFound" && steamID != "NoProfileFile")
                {
                    var         profileInfo     = functions.JSONReader.ReadJSON(playerDetailUrl + profile, public_properties.SteamProfile.playerStats, public_properties.SteamProfile.playerStatsEnd); // gets all information about profile
                    string      avatarImageLink = profileInfo[13].Insert(6, ":");
                    BitmapImage bitmapImage     = new BitmapImage(new Uri(avatarImageLink));
                    steamNameBox.Text         = profileInfo[3];
                    avatarBox.Source          = bitmapImage;
                    ButtonLoginLogout.Content = "Logout";
                }
            }

            Funtions.NewsReader.newsReader();
            foreach (var item in Funtions.NewsReader.allItems)
            {
                foreach (var stringObject in item)
                {
                    if (count == 0)
                    {
                        newsSpot1.Text = stringObject;
                    }
                    else if (count == 1)
                    {
                        newsSpot2.Text = stringObject;
                    }
                    else if (count == 2)
                    {
                        newsSpot3.Text = stringObject;
                    }
                    else if (count == 3)
                    {
                        newsSpot4.Text = stringObject;
                    }
                    else if (count == 4)
                    {
                        newsSpot5.Text = stringObject;
                    }
                    else if (count == 5)
                    {
                        newsSpot6.Text = stringObject;
                    }
                }
                count++;
            }
        }
Ejemplo n.º 4
0
        public CSGOStats()
        {
            InitializeComponent();
            string profile = ProfileSaver_ProfileReader.checkForProfile(); //check if there is anybody logged in

            if (File.Exists(userFilePath))
            {
                string steamID = ProfileSaver_ProfileReader.checkForProfile();
                if (steamID != "NoProfileFound" && steamID != "NoProfileFile")
                {
                    var         profileInfo     = functions.JSONReader.ReadJSON(playerDetailUrl + profile, public_properties.SteamProfile.playerStats, public_properties.SteamProfile.playerStatsEnd); // gets all information about profile
                    string      avatarImageLink = profileInfo[13].Insert(6, ":");
                    BitmapImage bitmapImage     = new BitmapImage(new Uri(avatarImageLink));
                    steamNameBox.Text         = profileInfo[3];
                    avatarBox.Source          = bitmapImage;
                    ButtonLoginLogout.Content = "Logout";
                    LoggedInUser = steamID; // start getting csgo stats
                    string csgoStatsLink = "http://api.steampowered.com/ISteamUserStats/GetUserStatsForGame/v0002/?appid=730&key=14A21E6B2EC8A4B857AA20CF416B38DE&steamid=" + LoggedInUser + "&format=xml";
                    string test          = "te" + "st";
                    XMLReader.generalXMLReader(csgoStatsLink);
                    Console.WriteLine("");
                }
            }
        }