Esempio n. 1
0
        static void Main(string[] args)
        {
            SteamApi.Initialize();
            var steamMessenger = new SteamMessenger();
            var matchFetcher = new MatchFetcher(steamMessenger);

            String line;
            if (args.Length == 0)
            {
                Console.WriteLine("Enter up to 20 match ids to retrieve results...");
                line = Console.ReadLine();
            }
            else
            {
                line = args[0];
            }

            var matchIds = Program.ReadInput(line);
            if (matchIds.Length == 0)
            {
                Console.WriteLine("No valid match ids entered.");
                return;
            }

            Console.WriteLine("Fetching match data for the following match ids: {0}", String.Join(", ", matchIds));
            Console.WriteLine();

            try
            {
                var results = matchFetcher.FetchGames(matchIds, true);

                foreach (var r in results)
                {
                    switch (r.Result)
                    {
                        case ResultType.Success:
                            Program.PrintMatchResult(r.Match);
                            break;
                        case ResultType.Exception:
                            Console.WriteLine("Unable to parse the likely valid match results for match {0}", r.MatchId);
                            break;
                        case ResultType.NotFound:
                            Console.WriteLine("Unable to find results for match {0}, are you sure it exists?", r.MatchId);
                            break;
                        default:
                            break;
                    }

                    Console.WriteLine("\n");
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
            }

            SteamApi.Shutdown();
            Console.WriteLine("Press any key to exit...");
            Console.ReadKey();
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            SteamApi.Initialize();
            var steamMessenger = new SteamMessenger();
            var matchFetcher   = new MatchFetcher(steamMessenger);

            String line;

            if (args.Length == 0)
            {
                Console.WriteLine("Enter up to 20 match ids to retrieve results...");
                line = Console.ReadLine();
            }
            else
            {
                line = args[0];
            }

            var matchIds = Program.ReadInput(line);

            if (matchIds.Length == 0)
            {
                Console.WriteLine("No valid match ids entered.");
                return;
            }

            Console.WriteLine("Fetching match data for the following match ids: {0}", String.Join(", ", matchIds));
            Console.WriteLine();

            try
            {
                var results = matchFetcher.FetchGames(matchIds, true);

                foreach (var r in results)
                {
                    switch (r.Result)
                    {
                    case ResultType.Success:
                        Program.PrintMatchResult(r.Match);
                        break;

                    case ResultType.Exception:
                        Console.WriteLine("Unable to parse the likely valid match results for match {0}", r.MatchId);
                        break;

                    case ResultType.NotFound:
                        Console.WriteLine("Unable to find results for match {0}, are you sure it exists?", r.MatchId);
                        break;

                    default:
                        break;
                    }

                    Console.WriteLine("\n");
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
            }

            SteamApi.Shutdown();
            Console.WriteLine("Press any key to exit...");
            Console.ReadKey();
        }