コード例 #1
0
ファイル: MainClasses.cs プロジェクト: famtosha/HackerList
        public static List <PlayerInfo> GetOnline()
        {
            var PlayerInfos = new List <PlayerInfo>();

            var PlayerList = new List <string>();

            var HackerListSteam = new StreamReader(InfoPath.GetHackerListPath());

            while (!HackerListSteam.EndOfStream)
            {
                PlayerList.Add(HackerListSteam.ReadLine());
            }

            HackerListSteam.Close();

            Parallel.ForEach(PlayerList, (current) =>
            {
                try
                {
                    var currentPlayer = GetPlayerInfo(FindIdInString(current));

                    if (currentPlayer.GameStatus != "Offline")
                    {
                        PlayerInfos.Add(currentPlayer);
                    }
                }
                catch (Exception ex)
                {
                    //Debug.WriteLine("faild to get player info: " + current);
                }
            });

            return(PlayerInfos);
        }
コード例 #2
0
ファイル: MainClasses.cs プロジェクト: famtosha/HackerList
        public static async void AddToList(string SteamID)
        {
            var TrueSteamID = await GetTrueSteamIDAsync(SteamID);

            string URL = "https://steamcommunity.com/profiles/" + TrueSteamID + "/";

            StreamReader  HackerListR = new StreamReader(InfoPath.GetHackerListPath());
            List <string> List        = new List <string>();

            while (!HackerListR.EndOfStream)
            {
                List.Add(HackerListR.ReadLine());
            }
            HackerListR.Close();

            StreamWriter HackerListW = new StreamWriter(InfoPath.GetHackerListPath());

            foreach (string line in List)
            {
                HackerListW.WriteLine(line);
            }
            HackerListW.WriteLine(URL);
            HackerListW.Close();
        }
コード例 #3
0
ファイル: MainClasses.cs プロジェクト: famtosha/HackerList
        public static void RemoveFromList(string SteamID)
        {
            string URL = "https://steamcommunity.com/profiles/" + SteamID + "/";

            StreamReader  HackerListR = new StreamReader(InfoPath.GetHackerListPath());
            List <string> List        = new List <string>();

            while (!HackerListR.EndOfStream)
            {
                List.Add(HackerListR.ReadLine());
            }
            HackerListR.Close();

            StreamWriter HackerListW = new StreamWriter(InfoPath.GetHackerListPath());

            foreach (string line in List)
            {
                if (!new Regex(URL).IsMatch(line))
                {
                    HackerListW.WriteLine(line);
                }
            }
            HackerListW.Close();
        }