示例#1
0
        public static void Main()
        {
            if (DataCollection.apiKey == null)
            {
                string currentDirectory = Directory.GetCurrentDirectory();
                StreamReader reader = new StreamReader(@Path.Combine(currentDirectory, DataCollection.apiKeyPath));
                DataCollection.apiKey = reader.ReadLine();
                reader.Close();
            }

            System.Diagnostics.Debug.WriteLine("============================");
            System.Diagnostics.Debug.WriteLine("Data Collection Starts");

            for (int i = 0; i < DataCollection.serverList.Length; i++ )
            {
                // TODO: Query servers asynchronously
                ServerManager serverManager = new ServerManager(serverList[0], DataCollection.apiKey,
                    String.Format(DataCollection.inFilePrefixTemplate, serverList[0]),
                    String.Format(DataCollection.outFilePrefixTemplate, serverList[0]),
                    DataCollection.gameType);
                try
                {
                    // Suite 1: Scan a server from scratch
                    // DataCollection.SeedScanSuite(serverManager);

                    // Suite 2: Scan a type of games given existing players from a file
                    // DataCollection.ScanGamesFromPlayersSuite(serverManager);

                    // Suite 3: Collecting detailed game data from existing list of gameIds
                    DataCollection.ScanGamesFromGameIdsSuite(serverManager);
                }
                finally
                {
                    serverManager.CloseAllFiles();
                    System.Diagnostics.Debug.WriteLine("****************");
                    System.Diagnostics.Debug.WriteLine(String.Format("Error in collecting {0} server.", serverList[0]));
                }
            }

            System.Diagnostics.Debug.WriteLine("============================");
        }