/* * private void OnSourceAdded (SourceAddedArgs args) * { * var library = args.Source as LibrarySource; * if (library != null) { * AddLibrary (library); * } * } * * private void OnSourceRemoved (SourceEventArgs args) * { * var library = args.Source as LibrarySource; * if (library != null) { * RemoveLibrary (library); * } * } */ private void AddLibrary(LibrarySource library) { if (!Banshee.IO.Directory.Exists(library.BaseDirectoryWithSeparator)) { Hyena.Log.DebugFormat("Will not watch library {0} because its folder doesn't exist: {1}", library.Name, library.BaseDirectoryWithSeparator); return; } lock (watchers) { if (!watchers.ContainsKey(library)) { try { var dir = library.BaseDirectoryWithSeparator; if (!Banshee.IO.Directory.Exists(dir)) { Hyena.Log.DebugFormat("Skipped LibraryWatcher for {0} ({1})", library.Name, dir); } else { watchers[library] = new SourceWatcher(library); Hyena.Log.DebugFormat("Started LibraryWatcher for {0} ({1})", library.Name, dir); } } catch (Exception e) { Log.Error(e); } } } }
/* private void OnSourceAdded (SourceAddedArgs args) { var library = args.Source as LibrarySource; if (library != null) { AddLibrary (library); } } private void OnSourceRemoved (SourceEventArgs args) { var library = args.Source as LibrarySource; if (library != null) { RemoveLibrary (library); } } */ private void AddLibrary (LibrarySource library) { if (!Banshee.IO.Directory.Exists(library.BaseDirectoryWithSeparator)) { Hyena.Log.DebugFormat ("Will not watch library {0} because its folder doesn't exist: {1}", library.Name, library.BaseDirectoryWithSeparator); return; } lock (watchers) { if (!watchers.ContainsKey (library)) { try { var dir = library.BaseDirectoryWithSeparator; if (!Banshee.IO.Directory.Exists (dir)) { Hyena.Log.DebugFormat ("Skipped LibraryWatcher for {0} ({1})", library.Name, dir); } else { watchers[library] = new SourceWatcher (library); Hyena.Log.DebugFormat ("Started LibraryWatcher for {0} ({1})", library.Name, dir); } } catch (Exception e) { Hyena.Log.Exception (e); } } } }