public void Tests( [MoreOrEqualTo(1), LessThan(5), DefaultValue(1)] [Description("Nombre de chrome à lancer sur autant d'écrans")] int nombre) { // Console.WriteLine("nombre de tests à lancer = {0}", nombre); if (this._debug_mode) { Console.WriteLine(GetVersionAndCopyright()); console_write_title_color("---- DEBUG Screens informations ----"); Console.WriteLine(Environment.NewLine + ""); ScreensInformations screens = new ScreensInformations(); Console.WriteLine(""); Console.Write(screens.ToString()); Console.WriteLine(""); console_write_title_color("---- DEBUG Launch tests ----"); Console.WriteLine(Environment.NewLine + ""); Console.WriteLine(" Nombre de tests à lancer sur autant d'écran : " + nombre); Console.WriteLine(""); } Engine.launch_test(nombre, _debug_mode, _kill_all_chrome, _delay); if (this._debug_mode) { console_write_title_color("---- END ----"); Console.WriteLine(""); } }
public void Screens() { ScreensInformations screens = new ScreensInformations(); Console.WriteLine(""); console_write_title_color("---- Screens informations ----"); Console.WriteLine(""); Console.WriteLine(""); Console.Write(screens.ToString()); Console.WriteLine(""); console_write_title_color("---- END ----" + Environment.NewLine); }
public void Load( [FileExists] [RequiredAttribute] string filepath) { if (this._debug_mode) { ScreensInformations screens = new ScreensInformations(); Console.WriteLine(GetVersionAndCopyright()); console_write_title_color("---- DEBUG Screens informations ----"); Console.WriteLine(""); Console.WriteLine(""); Console.Write(screens.ToString()); Console.WriteLine(""); console_write_title_color("---- DEBUG Load json file ----"); Console.WriteLine(Environment.NewLine + ""); Console.WriteLine(" > Fichier json chargé = " + filepath); Console.WriteLine(""); } string data_load_json = ""; try { data_load_json = System.IO.File.ReadAllText(filepath); if (this._debug_mode) { Console.WriteLine(" | Now the json is stored into a string"); } } catch (Exception e) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("[ERREUR] Unable to read the data into the loaded json, because : " + e.Message); Console.ResetColor(); } try { ChromeActions chrome_actions = JsonConvert.DeserializeObject <ChromeActions>(data_load_json); bool p_kill_all_chromes = chrome_actions.Kill_all_chromes; int p_opt_Delay_milliseconds = chrome_actions.Delay_before_launch; if (this._debug_mode) { Console.WriteLine(" | Now the json is deserialize into object type ChromeActions"); Console.WriteLine(" | Reading the ChromeActions and launch the " + chrome_actions.Actions.Count + " actions."); Console.WriteLine(""); Console.WriteLine(" > Options global for all actions"); if (p_opt_Delay_milliseconds > 0) { Console.WriteLine(" | -> Delay before the launching = " + p_opt_Delay_milliseconds); } else { Console.WriteLine(" | -> Delay before the launching = disabled"); } Console.WriteLine(" | -> Kill all chrome before the launching = " + p_kill_all_chromes); Console.WriteLine(""); } if (p_kill_all_chromes == true) { Engine.kill_all_chromes(); } int idx = 1; foreach (ChromeAction action in chrome_actions.Actions) { if (this._debug_mode) { Console.WriteLine(" > Action " + idx); Console.WriteLine(" | -> Url= " + action.Url); Console.WriteLine(" | -> Arguments = " + action.Arguments); Console.WriteLine(" | -> Fullscreen = " + action.Fullscreen); Console.WriteLine(" | -> Indexscreen = " + action.Indexscreen); Console.WriteLine(" | -> Launch now."); } if (p_opt_Delay_milliseconds > 0) { Thread.Sleep(p_opt_Delay_milliseconds); } Engine chrome_engine = new Engine(action.Url, action.Arguments, action.Fullscreen, action.Indexscreen, this._debug_mode); idx++; } } catch (Exception e) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("[ERREUR] Unable to deserialize the load json " + filepath + ", because: " + e.Message); Console.ResetColor(); } if (this._debug_mode) { console_write_title_color("---- END ----"); Console.WriteLine(""); } }