示例#1
0
 public void AddTask(Enums.TaskAction action)
 {
     using (var model = new FileQueueEntities(ConnectionString))
     {
         var newTask = new IndexerTask
         {
             Id = Guid.NewGuid(),
             Action = action.ToString(),
             DateTime = DateTime.Now,
             InstanceId = InstanceId
         };
         model.AddToIndexerTasks(newTask);
         model.SaveChanges();
     }
 }
示例#2
0
        public static void AddIndexer(Application app)
        {
            IndexerTask indexer = new IndexerTask(app);

            if (indexer.TryLoad("Cubus") == TryLoadResult.NotFound)
            {
                indexer.AddNew();
                indexer.Name          = "Cubus";
                indexer.ScanEngine    = "FileSystemWatcherScan";
                indexer.ProcessEngine = "CubusProcessEngine";

                indexer.Path        = "D:\\ADAMWorkingTraining\\Files";
                indexer.CatalogMode = CatalogMode.Capture;
                //indexer.ClassifyFolders = true;
                indexer.ClassifyFolders = false;
                //indexer.ClassifyFoldersDepth = 0;

                indexer.FileExtensionRestriction = Adam.Core.Records.FileExtensionRestriction.ExtensionRequired;
                indexer.FileTypeRestriction      = Adam.Core.Records.FileTypeRestriction.None; //Будем регистрировать расширения поддерживаемых форматов?
                indexer.ActionOnSuccess          = ActionOnSuccess.PermanentlyDeleteFile;

                //task.FileSelectionPatterns.Add(FileSelectionPatternMode.Exclusive, @"\.cm");
                //task.FileSelectionPatterns.Add(FileSelectionPatternMode.Inclusive, @"\.mp4");
                //task.FileSelectionPatterns.Add(FileSelectionPatternMode.Inclusive, @"\.mp3");

                indexer.EmailNotificationSettings = "<triggers> </triggers>";

                Classification classification = new Classification(app);
                if (classification.TryLoad("/Cubus") == TryLoadResult.NotFound)
                {
                    throw new ItemNotFoundException("root catalog was not found");
                }

                indexer.ClassifyFoldersRoot = classification.Id;
                indexer.Enabled             = true;

                indexer.JobThresholdTimeout = new TimeSpan(0, 0, 10);
            }
        }
示例#3
0
        public static void AddIndexer(Application app)
        {
            IndexerTask indexer = new IndexerTask(app);
            if (indexer.TryLoad("Cubus") == TryLoadResult.NotFound)
            {
                indexer.AddNew();
                indexer.Name = "Cubus";
                indexer.ScanEngine = "FileSystemWatcherScan";
                indexer.ProcessEngine = "CubusProcessEngine";

                indexer.Path = "D:\\ADAMWorkingTraining\\Files";
                indexer.CatalogMode = CatalogMode.Capture;
                //indexer.ClassifyFolders = true;
                indexer.ClassifyFolders = false;
                //indexer.ClassifyFoldersDepth = 0;

                indexer.FileExtensionRestriction = Adam.Core.Records.FileExtensionRestriction.ExtensionRequired;
                indexer.FileTypeRestriction = Adam.Core.Records.FileTypeRestriction.None; //Будем регистрировать расширения поддерживаемых форматов?
                indexer.ActionOnSuccess = ActionOnSuccess.PermanentlyDeleteFile;

                //task.FileSelectionPatterns.Add(FileSelectionPatternMode.Exclusive, @"\.cm");
                //task.FileSelectionPatterns.Add(FileSelectionPatternMode.Inclusive, @"\.mp4");
                //task.FileSelectionPatterns.Add(FileSelectionPatternMode.Inclusive, @"\.mp3");

                indexer.EmailNotificationSettings = "<triggers> </triggers>";

                Classification classification = new Classification(app);
                if(classification.TryLoad("/Cubus") == TryLoadResult.NotFound)
                    throw new ItemNotFoundException("root catalog was not found");

                indexer.ClassifyFoldersRoot = classification.Id;
                indexer.Enabled = true;

                indexer.JobThresholdTimeout = new TimeSpan(0,0,10);

            }
        }