Beispiel #1
0
        public CCTimerSearch(ITisClientServicesModule oCSM, String configPath, String profileName)
        {
            try
            {
                CSM = oCSM;
                CollectionsCreator = new CCreator();
                if (CSM != null)
                {
                    CSM.Session.OnMessage += StationMessage;
                    workDir = CSM.PathLocator.get_Path(CCEnums.CCFilesExt.TIF.ToString());
                }

                //-- Initialize profile --\\
                if (File.Exists(configPath ?? String.Empty))
                {
                    config = CCConfiguration.FromXml(configPath);
                }
                else
                {
                    config = CCConfiguration.FromCSM(CSM);
                }

                //-- Initialize profile --\\
                if (String.IsNullOrEmpty(profileName))
                {
                    profileName = CSM.Application.AppName;
                }
                currentProfile = config != null?config.GetConfiguration(profileName) : null;

                if (currentProfile == null)
                {
                    currentProfile = new CCConfiguration.CCConfigurationData();                        //-- create a default profile --\\
                }
                //-- Define collections creator settings --\\
                CollectionsCreator.CurrentProfile = currentProfile;

                //collectionsCreator.OnPostFileLock += PostFileLock;
                CollectionsCreator.OnCollectionCreated += CollectionCreated;

                if (SearchHandler == null)
                {
                    SearchHandler = new CCSearchFiles(currentProfile);
                }
                SearchHandler.OnPostFileLock += PostFileLock;
                SearchHandler.OnPreFileLock  += PreFileLock;

                PollingTimer.Enabled = currentProfile.SearchPaths != null && currentProfile.SearchPaths.Length > 0 && currentProfile.SearchExtensions != null && currentProfile.SearchExtensions.Length > 0;
                CreateEvent();//-- fire OnCreate  event --\
            }
            catch (Exception ex)
            {
                ILog.LogError(ex);
            }
        }
Beispiel #2
0
 /// <summary>
 /// Search for files using the configuration specified as settings.
 /// </summary>
 /// <param name="cfgProfile">The application\profile to use it's settings for the search</param>
 /// <returns>A list of 'CCFileList'  objects when successfull and the search was successfull.</returns>
 public static CCFileList[] SearchFiles(CCConfiguration.CCConfigurationData cfgProfile)
 {
     try
     {
         if (cfgProfile != null)
         {
             using (CCSearchFiles ccs = new CCSearchFiles(cfgProfile))
             {
                 CCFileList[] result = ccs.SearchFiles();
                 return(result);
             }
         }
     }
     catch (Exception ex)
     {
         ILog.LogError(ex);
     }
     return(null);
 }
Beispiel #3
0
        public CCTimerSearch(ITisClientServicesModule oCSM, CCConfiguration.CCConfigurationData dataCfg)
        {
            try
            {
                CSM = oCSM;
                CollectionsCreator = new CCreator();
                if (CSM != null)
                {
                    CSM.Session.OnMessage += StationMessage;
                    workDir = CSM.PathLocator.get_Path(CCEnums.CCFilesExt.TIF.ToString());
                }

                //-- Initialize profile --\\
                config = dataCfg.ParentConfiguration;

                //-- Initialize profile --\\
                currentProfile = dataCfg;

                //-- Define collections creator settings --\\
                CollectionsCreator.CurrentProfile       = currentProfile;
                CollectionsCreator.OnCollectionCreated += CollectionCreated;

                if (SearchHandler == null)
                {
                    SearchHandler = new CCSearchFiles(currentProfile);
                }
                SearchHandler.OnPostFileLock += PostFileLock;
                SearchHandler.OnPreFileLock  += PreFileLock;

                PollingTimer.Enabled = currentProfile.SearchPaths != null && currentProfile.SearchPaths.Length > 0 && currentProfile.SearchExtensions != null && currentProfile.SearchExtensions.Length > 0;
                CreateEvent();//-- fire OnCreate  event --\
            }
            catch (Exception ex)
            {
                ILog.LogError(ex);
            }
        }