Наследование: MovingPicturesDBTable
Пример #1
0
        /// <summary>
        /// Returns all user defined import paths
        /// </summary>
        public static List <DBImportPath> GetAllUserDefined()
        {
            List <DBImportPath> paths = new List <DBImportPath>();

            foreach (DBImportPath path in DBImportPath.GetAll())
            {
                if (!path.InternallyManaged)
                {
                    paths.Add(path);
                }
            }
            return(paths);
        }
Пример #2
0
        // Gets the corresponding DBImportPath object using it's FullPath property
        public static DBImportPath Get(string fullPath)
        {
            DBField             pathField = DBField.GetField(typeof(DBImportPath), "FullPath");
            ICriteria           criteria  = new BaseCriteria(pathField, "like", fullPath);
            List <DBImportPath> resultSet = MovingPicturesCore.DatabaseManager.Get <DBImportPath>(criteria);

            if (resultSet.Count > 0)
            {
                return(resultSet[0]);
            }

            DBImportPath newImportPath = new DBImportPath();

            newImportPath.FullPath = fullPath;

            return(newImportPath);
        }
Пример #3
0
        // Gets the corresponding DBImportPath object using it's FullPath property
        public static DBImportPath Get(string fullPath)
        {
            DBField pathField = DBField.GetField(typeof(DBImportPath), "FullPath");
            ICriteria criteria = new BaseCriteria(pathField, "like", fullPath);
            List<DBImportPath> resultSet = MovingPicturesCore.DatabaseManager.Get<DBImportPath>(criteria);
            if (resultSet.Count > 0)
                return resultSet[0];

            DBImportPath newImportPath = new DBImportPath();
            newImportPath.FullPath = fullPath;

            return newImportPath;
        }
        private void WatchImportPath(FileSystemWatcher watcher, DBImportPath importPath)
        {
            watcher.Path = importPath.FullPath;
            watcher.IncludeSubdirectories = true;
            watcher.Error += OnWatcherError;
            watcher.Created += OnFileAdded;
            watcher.Deleted += OnFileDeleted;
            watcher.Renamed += OnFileRenamed;
            watcher.EnableRaisingEvents = true;

            fileSystemWatchers.Add(watcher);
            pathLookup[watcher] = importPath;
            logger.Info("Started watching '{0}' ({1}) - Path is now being monitored for changes.", importPath.FullPath, importPath.GetDriveType().ToString());
        }
 // Grabs the files from the DBImportPath and add them to the queue for use
 // by the ScanMedia thread.
 private void ScanPath(DBImportPath importPath)
 {
     List<DBLocalMedia> importPathFiles = importPath.GetNewLocalMedia();
     if (importPathFiles != null) {
         lock (filesAdded.SyncRoot)
             filesAdded.AddRange(importPathFiles);
     }
 }