Inheritance: 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;
        }
コード例 #4
0
        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());
        }
コード例 #5
0
 // 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);
     }
 }