Пример #1
0
        static void Main(string[] args)
        {
            variables.errors = 0;

            bool ini_setup = false;

            Console.Title = "autoATF - PES 2015 - Autumn 2015 Edition - v2.1";

            // INI setup
            ini_setup = Parser.setup_switches();

            // Only continue if the ini setup was successful, otherwise there will be no input file and the csv parser will fall over
            if (ini_setup)
            {
                // Are we checking, or comparing?
                // The compare_file should be blank if we're checking, and have a file if we're comparing
                if (switches.compare_file == "")
                {
                    // *** Checking ***

                    Console.WriteLine("Entering Checker Mode...\n");

                    // Is it an edit.bin, or a texport.bin?
                    if (Importer.is_edit_bin(switches.input_file))
                    {
                        List <player> player_table = new List <player>();

                        // Parse the edit.bin
                        player_table = Importer.save_importer(switches.input_file);

                        while (true)
                        {
                            team squad = new team();

                            // What team to check?
                            checker.team_input(squad);

                            // Construct that team
                            checker.teambuilding(player_table, squad);

                            // Check that team
                            checker.check_em(squad);

                            // Reset the error count for the next team
                            variables.errors = 0;
                        }
                    }
                    else // Its a texport.bin
                    {
                        team squad = new team();

                        // Parse the texport.bin
                        squad = Importer.export_importer(switches.input_file);

                        Console.WriteLine("Team Export:\t" + squad.team_name);
                        Console.WriteLine();

                        // Check that the players are meant to be on that team
                        checker.check_squad_consistency(squad);

                        // Check that team
                        checker.check_em(squad);
                    }
                }
                else
                {
                    // *** Comparing ***

                    Console.WriteLine("Entering Compare Mode...\n");

                    // What team are we comparing?
                    // If one of the files is an export, we can assume that one

                    int type = -1; // 0 - Save/Save, 1 - Save/Export, 2 - Export/Save, 3 - Export/Export, -1 - ERROR

                    type = comparer.get_compare_type();

                    // So now we know what setup we have, lets start parsing the files
                    switch (type)
                    {
                    case 0:     // Save/Save

                        // This is the only type that can loop infinitely, as you can check a different team every time
                        while (true)
                        {
                            team t0_squad_save_1 = new team();
                            team t0_squad_save_2 = new team();

                            // Parse the saves
                            List <player> t0_player_table_1 = new List <player>();
                            List <player> t0_player_table_2 = new List <player>();

                            t0_player_table_1 = Importer.save_importer(switches.input_file);
                            t0_player_table_2 = Importer.save_importer(switches.compare_file);

                            // What team to check?
                            checker.team_input(t0_squad_save_1);

                            t0_squad_save_2.teamID    = t0_squad_save_1.teamID;
                            t0_squad_save_2.team_name = t0_squad_save_1.team_name;

                            // Construct the two teams
                            checker.teambuilding(t0_player_table_1, t0_squad_save_1);
                            checker.teambuilding(t0_player_table_2, t0_squad_save_2);

                            // Compare the teams
                            comparer.compare_teams(t0_squad_save_1, t0_squad_save_2);

                            Console.WriteLine();
                            Console.WriteLine("Differences: " + variables.errors);
                            Console.WriteLine("Compare completed!");
                            Console.WriteLine();
                        }
                        break;

                    case 1:     // Save/Export

                        team t1_squad_save   = new team();
                        team t1_squad_export = new team();

                        // Parse the texport.bin
                        t1_squad_export = Importer.export_importer(switches.compare_file);

                        Console.WriteLine();
                        Console.WriteLine("Comparing " + t1_squad_export.team_name);
                        Console.WriteLine();

                        // Now we know what team we're using, parse the edit.bin
                        List <player> t1_player_table = new List <player>();

                        t1_player_table = Importer.save_importer(switches.input_file);

                        t1_squad_save.teamID    = t1_squad_export.teamID;
                        t1_squad_save.team_name = t1_squad_export.team_name;

                        // Construct that team
                        checker.teambuilding(t1_player_table, t1_squad_save);

                        // Compare the teams
                        comparer.compare_teams(t1_squad_save, t1_squad_export);

                        break;

                    case 2:     // Export/Save

                        team t2_squad_save   = new team();
                        team t2_squad_export = new team();

                        // Parse the texport.bin
                        t2_squad_export = Importer.export_importer(switches.input_file);

                        Console.WriteLine();
                        Console.WriteLine("Comparing " + t2_squad_export.team_name);
                        Console.WriteLine();

                        // Now we know what team we're using, parse the edit.bin
                        List <player> t2_player_table = new List <player>();

                        t2_player_table = Importer.save_importer(switches.compare_file);

                        t2_squad_save.teamID    = t2_squad_export.teamID;
                        t2_squad_save.team_name = t2_squad_export.team_name;

                        // Construct that team
                        checker.teambuilding(t2_player_table, t2_squad_save);

                        // Compare the teams
                        comparer.compare_teams(t2_squad_save, t2_squad_export);

                        break;

                    case 3:     // Export/Export

                        team t3_squad_export_1 = new team();
                        team t3_squad_export_2 = new team();

                        // Parse the texport.bins
                        t3_squad_export_1 = Importer.export_importer(switches.input_file);
                        t3_squad_export_2 = Importer.export_importer(switches.compare_file);

                        // Are they exports for the same team?
                        if (t3_squad_export_1.teamID != t3_squad_export_2.teamID)
                        {
                            Console.WriteLine("\nThe two exports have different teams! Cancelling comparison");
                            Console.WriteLine("\t\t(" + t3_squad_export_1.team_name + " and " + t3_squad_export_2.team_name + ")");
                        }
                        else
                        {
                            Console.WriteLine();
                            Console.WriteLine("Comparing " + t3_squad_export_1.team_name);
                            Console.WriteLine();

                            // Compare the teams
                            comparer.compare_teams(t3_squad_export_1, t3_squad_export_2);
                        }

                        break;

                    default:
                        // Oh shit n***a what are you doing
                        Console.WriteLine();
                        Console.WriteLine("Invalid input files");
                        Console.WriteLine("You really shouldn't be seeing this error. If you are, you dun goof'd somehow");
                        Console.WriteLine("Check the ini is pointing at the correct files");
                        Console.WriteLine();
                        break;
                    }

                    Console.WriteLine();
                    Console.WriteLine("Differences: " + variables.errors);
                    Console.WriteLine("Compare completed!");
                    Console.WriteLine();
                }
            }

            Console.WriteLine("Press Enter to Exit...");
            Console.ReadLine();
        }