public void VehicleSelectorConstructorTest()
        {
            IWebDriver      driver = null; // TODO: Initialize to an appropriate value
            VehicleSelector target = new VehicleSelector(driver);

            Assert.Inconclusive("TODO: Implement code to verify target");
        }
        public void SelectModelTest()
        {
            IWebDriver      driver = null;                        // TODO: Initialize to an appropriate value
            VehicleSelector target = new VehicleSelector(driver); // TODO: Initialize to an appropriate value

            target.SelectModel();
            Assert.Inconclusive("A method that does not return a value cannot be verified.");
        }
        public void MainMethod()
        {
            Navigator navigator = new Navigator();

            // Instanciate objects in the navigator
            navigator.Create();
            // navigate to page
            navigator.NavigateToPage();
            // login to page - return the selenium driver into the var.
            var driver = navigator.LoginToPage();
            // Select Make
            IVehicleSelector vehicleSelector = new VehicleSelector(driver);

            vehicleSelector.SelectMake();

            // Select Model
            vehicleSelector.SelectModel();
            // Condition Picker
            var conditionPicker = new ConditionPicker(driver);

            // Click condition list
            conditionPicker.ClickConditions();

            // Check for the number of pages of the vehicles.
            var pageCounter = new PageCounter(driver);
            var pageNum     = pageCounter.pageNumChecker(); // check number of pages and return the number of pages

            // Click next page
            navigator.pageNum = pageNum;  // Set the property for the number of pages first


            for (int i = 1; i <= pageNum.searchResultsPageCount; i++)
            {
                // Call the datascraper and send through an argument for the class to search for.
                var dataScraper = new DataScraper(driver);
                dataScraper.GetHtml(tableHTMLtagToScrape);

                // Click the next page
                navigator.ClickNextPage(i);
            }
        }
예제 #4
0
    public void SetupButton(string vehicleNameLocal, short vehicleIdLocal, VehicleSelector vehicleSelectorLocal)
    {
        vehicleName     = vehicleNameLocal;
        vehicleId       = vehicleIdLocal;
        vehicleSelector = vehicleSelectorLocal;


        // load any information about the characters here:
        car = Resources.Load(prefix + vehicleName) as GameObject;
        if (car.GetComponent <VehicleGuiData>() != null)
        {
            Debug.Log("Get Component");
            VehicleGuiData guiData = car.GetComponent <VehicleGuiData>();
            icon         = guiData.icon;
            image.sprite = icon;
            if (showVehicleNameText)
            {
                vehicleNameText.text = guiData.displayName;
            }


            vehicleGuiData = guiData;
        }
    }
        /// <summary> The entry point. </summary>
        static void Main()
        {
            System.Console.Title = EClientApplicationName.WarThunderPresetRandomizer;
            var defaultColor = ConsoleColor.Gray;

            var requiredSettings = new List <string>
            {
                nameof(Settings.WarThunderLocation),
                nameof(Settings.KlensysWarThunderToolsLocation),
            };

            try
            {
                var loggers = new IConfiguredLogger[]
                {
                    new ConfiguredNLogger(ELoggerName.FileLogger, new ExceptionFormatter(), ESubdirectory.Logs),
                    new ConfiguredNLogger(ELoggerName.ConsoleLogger, new ExceptionFormatter()),
                };
                var fileManager           = new WarThunderFileManager(loggers);
                var fileReader            = new WarThunderFileReader(loggers);
                var settingsManager       = new WarThunderSettingsManager(fileManager, EConsoleClientFile.Settings, requiredSettings, loggers);
                var parser                = new Parser(loggers);
                var unpacker              = new Unpacker(fileManager, loggers);
                var dataRepositoryFactory = new DataRepositoryFactoryWarThunder(loggers);
                var converter             = new Converter(loggers);
                var jsonHelper            = new WarThunderJsonHelper(loggers);
                var csvDeserializer       = new CsvDeserializer(loggers);
                var randomiser            = new CustomRandomiser(loggers);
                var vehicleSelector       = new VehicleSelector(randomiser, loggers);
                var presetGenerator       = new PresetGenerator(randomiser, vehicleSelector, loggers);
                var thunderSkillParser    = new ThunderSkillParser(loggers);

                using (var manager = new Manager(fileManager, fileReader, settingsManager, parser, unpacker, converter, jsonHelper, csvDeserializer, dataRepositoryFactory, randomiser, vehicleSelector, presetGenerator, thunderSkillParser, true, false, false, loggers))
                {
                    manager.RemoveOldLogFiles();
                    manager.InitialiseGameClientVersion();

                    while (!settingsManager.WarThunderLocationIsValid())
                    {
                        System.Console.Write(EConsoleUiLogMessage.SelectValidLocation.Format(EApplicationName.WarThunder));
                        settingsManager.Save(nameof(Settings.WarThunderLocation), System.Console.ReadLine());
                    }
                    while (!settingsManager.KlensysWarThunderToolLocationIsValid())
                    {
                        System.Console.Write(EConsoleUiLogMessage.SelectValidLocation.Format(EApplicationName.KlensysWarThunderTools));
                        settingsManager.Save(nameof(Settings.KlensysWarThunderToolsLocation), System.Console.ReadLine());
                    }
                    System.Console.WriteLine();

                    manager.CacheData();

                    while (true)
                    {
                        var specification = ParseSpecification
                                            (
                            TakeSpecificationInput(),
                            manager
                            .ResearchTrees
                            .SelectMany(nationResearchTreeKeyValuePair => nationResearchTreeKeyValuePair.Value)
                            .SelectMany(branchKeyValuePair => branchKeyValuePair.Value)
                            .SelectMany(rankKeyValuePair => rankKeyValuePair.Value)
                            .Select(rankVehicleKeyValuePair => rankVehicleKeyValuePair.Value.GaijinId)
                                            );

                        foreach (var vehicle in manager.GeneratePrimaryAndFallbackPresets(specification)[EPreset.Primary])
                        {
                            System.Console.ForegroundColor = !vehicle.IsResearchable
                                ? ConsoleColor.Yellow
                                : ConsoleColor.White;

                            System.Console.WriteLine($"\t {vehicle.BattleRatingFormatted[specification.GameMode]} {vehicle.GaijinId}");
                        }

                        System.Console.ForegroundColor = defaultColor;
                    }
                }
            }
            catch
            {
                System.Console.Write($"\n{ECoreLogMessage.AnErrorHasOccurred} {EConsoleUiLogMessage.PressAnyKeyToExit} ");
                System.Console.ReadKey(true);
                Environment.Exit(0);
            }
        }
예제 #6
0
        private void MainNavigationToLoop(Navigator navigator, string vehicleMake, string vehicleModel, bool?filterCondition, IWebDriver driver, int vehicleID, double?vehicleCondition)
        {
            // Set current global search vehicle.

            AppSettings.setCurrentVehicle(vehicleID);


            // Begin foreach for all vehicles

            // Select Make
            IVehicleSelector vehicleSelector = new VehicleSelector(driver);

            vehicleSelector.SelectMake(vehicleMake);

            // Select Model
            returnCode = vehicleSelector.SelectModel(vehicleModel);
            if (returnCode == 1)
            {
                goto ENDTHISLOOP;
            }
            // Check if condition is to be filtered.
            var searchChecker = new SearchChecker();



            if (searchChecker.ConditionFiltered(filterCondition))
            {
                // Condition Picker
                var conditionPicker = new ConditionPicker(driver, vehicleCondition);
                // Click condition list
                conditionPicker.ClickConditions();
            }



            // Click Search button
            navigator.SearchButtonClicker(driver);



            // Check for the number of pages of the vehicles.
            var pageCounter = new PageCounter(driver);
            var pageNum     = pageCounter.pageNumChecker(); // check number of pages and return the number of pages

            // Click next page
            navigator.pageNum = pageNum; // Set the property for the number of pages first



            if (pageNum.searchResultsPageCount > 1)
            {
                for (int i = 2; i <= pageNum.searchResultsPageCount; i++)
                {
                    Console.WriteLine("page number is greater than one so looping...");
                    // Call the datascraper and send through an argument for the class to search for.
                    // var dataScraper = new DataScraper(driver, vehicleID, searchSessionID);
                    // check for error code then exit
                    // returnCode = dataScraper.GetHtml(tableHTMLtagToScrape);
                    //if (returnCode == 1) {
                    // goto ENDTHISLOOP;

                    //}

                    IRowScraper rowScraper = new RowScraper(driver, vehicleID, searchSessionID);
                    // check for error code then exit
                    returnCode = rowScraper.GetSingleRowHtml(tableSingleRowHtmlTagToScrape);
                    if (returnCode == 999999)
                    {
                        goto ENDTHISLOOP;
                    }
                    // NOW GRAB SINGLE ROWS OF DATA


                    // Click the next page
                    navigator.ClickNextPage(i);
                }
            }
            else
            {
                Console.WriteLine("Page number returned is one...");
                var dataScraper = new DataScraper(driver, vehicleID, searchSessionID);
                returnCode = dataScraper.GetHtml(tableHTMLtagToScrape);
                if (returnCode == 1)
                {
                    goto ENDTHISLOOP;
                }
            }



            ENDTHISLOOP :;
        }