public void Load() { if (isSettings()) { StreamReader file = new System.IO.StreamReader(pathModule + @"\" + fileName); ConfigurationEmail deserializedProduct = JsonConvert.DeserializeObject <ConfigurationEmail>(file.ReadToEnd()); this.configurationEmail = deserializedProduct; file.Close(); } }
static void Main(string[] args) { const int SW_SHOWMINIMIZED = 2; var handle = GetConsoleWindow(); ShowWindow(handle, SW_SHOWMINIMIZED); // Hide or not the screen Database.Database db = new Database.Database(); db.initTables(); Database.Model.Settings _settings_ = db.settingsManager.get(db.connectionString, 1); int SW_HIDE_SHOW = _settings_.showWindow; // SW_HIDE = 0 // SW_SHOW = 5 if (SW_HIDE_SHOW == 5) { // Show ShowWindow(handle, 9); ShowWindow(handle, SW_HIDE_SHOW); int Height = Console.LargestWindowHeight - 20; int Width = Console.LargestWindowWidth - 20; Console.SetWindowSize(Width, Height); Console.SetWindowPosition(0, 0); } else if (SW_HIDE_SHOW == 0) { // Hide Console.SetWindowSize(1, 1); Console.SetWindowPosition(0, 0); ShowWindow(handle, SW_HIDE_SHOW); } db.alertMailLogManager.createTable(db.connectionString); db.alertMailLogManager.insert(db.connectionString, ""); /////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// Gestion des notifications email /// Alert_Mail.Classes.ConfigurationSaveLoad file = new Alert_Mail.Classes.ConfigurationSaveLoad(); if (file.isSettings()) { db.alertMailLogManager.insert(db.connectionString, DateTime.Now + " : AlertMail :: Fichier SettingMail.json existe."); file.Load(); db.alertMailLogManager.insert(db.connectionString, DateTime.Now + " : AlertMail :: Fichier SettingMail.json chargé."); Alert_Mail.Classes.ConfigurationEmail settings = file.configurationEmail; //////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// Email types /// if (args.Length == 0) { pendingFilesMail(settings, db); //Send a Mail every x time } else if (args.Length > 0 && args[0] == "All_Errors") //Send a Mail after the connecteur execution { errorMail(settings, db); } else if (args.Length > 0 && args[0] == "Error_Summary") //Send a Mail every x time { summaryMail(file, settings, db); } else { Console.WriteLine("Argument inconnue!!!"); db.alertMailLogManager.insert(db.connectionString, DateTime.Now + " : AlertMail :: Argument inconnue!!!"); } } else { Console.WriteLine("Aucune configuration e-mail trouvé!"); db.alertMailLogManager.insert(db.connectionString, DateTime.Now + " : AlertMail :: Aucune configuration e-mail trouvé!"); } db.alertMailLogManager.insert(db.connectionString, ""); //Console.ReadLine(); }
public ConfigurationSaveLoad(ConfigurationEmail mConfigurationEmail) { this.configurationEmail = mConfigurationEmail; }