/// <summary> /// Démarrage de la surveillance /// </summary> private void StartSurveillance () { //Lancement d'une surveillance pour chaque dossier repris dans l'option FoldersToWatch watchers = new SurveillanceDossiers[Program.options.FoldersToWatch.Length]; for (int i = 0 ; i < Program.options.FoldersToWatch.Length ; i++) { watchers[i] = new SurveillanceDossiers(Program.options.FoldersToWatch[i], Program.databaseUpdate, Program.options.DeleteTunesIfOrphan, Program.options.IndexSubdirectories); watchers[i].Error += new EventHandler<ExceptionEventArgs>(surveillanceDossiers_Error); } enabled = true; }
/// <summary> /// Démarrage de la surveillance /// </summary> private void StartSurveillance() { //Lancement d'une surveillance pour chaque dossier repris dans l'option FoldersToWatch watchers = new SurveillanceDossiers[options.FoldersToWatch.Length]; for (int i = 0; i < options.FoldersToWatch.Length; i++) { watchers[i] = new SurveillanceDossiers(options.FoldersToWatch[i], databaseUpdate, options.DeleteTunesIfOrphan, options.IndexSubdirectories); watchers[i].Error += new EventHandler <ExceptionEventArgs>(surveillanceDossiers_Error); } }
/// <summary> /// Thread principal /// </summary> static public void Do() { try { //Lecture des préférences Console.WriteLine("[*] Loading options ..."); options = MainOptions.Load(); //Initialisation de la base de données et de sa classe de mise à jour Console.WriteLine("[*] Initializing database connection and update facilities ..."); databaseUpdate = new DatabaseUpdate(options.ConnectionString); //Lancement d'une surveillance pour chaque dossier repris dans l'option FoldersToWatch Console.WriteLine("[*] Initializing folders watch ..."); //Let's check if we've folders to watch // CLI is very useful to test if DatabaseUpdate initialization is OK, // it's why we don't test options.FoldersToWatch.Length before ! if (options.FoldersToWatch.Length == 0) { //Nothing to do Console.WriteLine(" ( no folder to watch, exiting )"); databaseUpdate.Dispose(); return; } watchers = new SurveillanceDossiers[options.FoldersToWatch.Length]; for (int i = 0; i < options.FoldersToWatch.Length; i++) { watchers[i] = new SurveillanceDossiers(options.FoldersToWatch[i], databaseUpdate, options.DeleteTunesIfOrphan, options.IndexSubdirectories); watchers[i].Error += new EventHandler <ExceptionEventArgs>(Program_Error); Console.WriteLine(" ° " + options.FoldersToWatch[i]); } Console.WriteLine("______________________________________________________________________"); Console.WriteLine(); //Oki, manage events databaseUpdate.LogEntry += new EventHandler <TimestampMessageEventArgs>(databaseUpdate_LogEntry); } catch (Exception e) { //Options XML deserialize InnerException if (e.InnerException != null) { e = e.InnerException; } Console.WriteLine(e.Message); if (options != null && options.DebugMode) { Console.WriteLine(e.StackTrace); } } }
/// <summary> /// Thread principal /// </summary> static public void Do () { try { //Lecture des préférences Console.WriteLine("[*] Loading options ..."); options = MainOptions.Load(); //Initialisation de la base de données et de sa classe de mise à jour Console.WriteLine("[*] Initializing database connection and update facilities ..."); databaseUpdate = new DatabaseUpdate(options.ConnectionString); //Lancement d'une surveillance pour chaque dossier repris dans l'option FoldersToWatch Console.WriteLine("[*] Initializing folders watch ..."); //Let's check if we've folders to watch // CLI is very useful to test if DatabaseUpdate initialization is OK, // it's why we don't test options.FoldersToWatch.Length before ! if (options.FoldersToWatch.Length == 0) { //Nothing to do Console.WriteLine(" ( no folder to watch, exiting )"); databaseUpdate.Dispose(); return; } watchers = new SurveillanceDossiers[options.FoldersToWatch.Length]; for (int i = 0 ; i < options.FoldersToWatch.Length ; i++) { watchers[i] = new SurveillanceDossiers(options.FoldersToWatch[i], databaseUpdate, options.DeleteTunesIfOrphan, options.IndexSubdirectories); watchers[i].Error += new EventHandler<ExceptionEventArgs>(Program_Error); Console.WriteLine(" ° " + options.FoldersToWatch[i]); } Console.WriteLine("______________________________________________________________________"); Console.WriteLine(); //Oki, manage events databaseUpdate.LogEntry += new EventHandler<TimestampMessageEventArgs>(databaseUpdate_LogEntry); } catch (Exception e) { //Options XML deserialize InnerException if (e.InnerException != null) { e = e.InnerException; } Console.WriteLine(e.Message); if (options != null && options.DebugMode) { Console.WriteLine(e.StackTrace); } } }