public void SimpleCommandLine()
        {
            IndexerParameters indexperParamters = new IndexerParameters();

            indexperParamters.DataSource   = "test1";
            indexperParamters.IndexPath    = "test2";
            indexperParamters.PreviewWidth = 10;
            indexperParamters.ThumbWidth   = 11;

            string            cmd    = IndexerParameters.CreateCommandLine(indexperParamters);
            IndexerParameters parsed = IndexerParameters.ParseCommandLine(cmd.Split(' '));

            Assert.AreEqual(indexperParamters.DataSource, parsed.DataSource);
            Assert.AreEqual(indexperParamters.IndexPath, parsed.IndexPath);
            Assert.AreEqual(indexperParamters.PreviewWidth, parsed.PreviewWidth);
            Assert.AreEqual(indexperParamters.ThumbWidth, parsed.ThumbWidth);
        }
예제 #2
0
        protected void CreateIndexerProcess(string pathToProcess)
        {
            Process process = new Process();

            process.StartInfo.FileName = "PhotoAssistant.Indexer.exe";
            IndexerParameters indexperParamters = new IndexerParameters();

            indexperParamters.IndexPath    = pathToProcess;
            indexperParamters.DataSource   = SettingsStore.Default.CurrentDataSource;
            indexperParamters.ThumbWidth   = SettingsStore.Default.ThumbSize.Width;
            indexperParamters.PreviewWidth = SettingsStore.Default.PreviewSize.Width;
            string cmd = IndexerParameters.CreateCommandLine(indexperParamters);

            process.StartInfo.Arguments   = cmd;
            process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
            process.Start();
        }
예제 #3
0
        public static void Main(string[] args)
        {
#if DEBUG
            if (args.Length < 2)
            {
                args = CreateFakeParams();
            }
#endif
            try {
                log4net.GlobalContext.Properties["pid"] = Process.GetCurrentProcess().Id;
                Log.Info("indexer started");
                IndexerParameters parameters = IndexerParameters.ParseCommandLine(args);
                Log.Info("Arguments list");
                foreach (var argument in args)
                {
                    Log.Info(string.Format("{0}", argument));
                }
                if (parameters != null)
                {
                    Log.Info("arguments parsed succesfully");
                    SettingsStore.Default.CurrentDataSource = parameters.DataSource;
                    Indexer indexer = new Indexer();
                    indexer.Model = new DmModel();
                    indexer.Model.OpenDataSource(parameters.DataSource);
                    Log.Info("data source ready");
                    indexer.Process(parameters);
                }
                else
                {
                    Log.Info("parameters incorrect");
                }
                Log.Info("indexer stopped");
            } catch (Exception e) {
                Log.Error(e.Message, e);
            }
        }
예제 #4
0
파일: TypeParser.cs 프로젝트: Eragra3/Dogu
        protected virtual IndexerParameters GetIndexerIRConstructorParameters(PropertyInfo propertyInfo)
        {
            (AccessModifier? setterAccessModifier, Method setter) = propertyInfo.SetMethod switch
            {
                { } method => (ReflectionUtility.GetAccessModifier(method), ParseMethod(method)),
                null => ((AccessModifier?)null, (Method)null)
            };

            (AccessModifier? getterAccessModifier, Method getter) = propertyInfo.GetMethod switch
            {
                { } method => (ReflectionUtility.GetAccessModifier(method), ParseMethod(method)),
                null => ((AccessModifier?)null, (Method)null)
            };

            AccessModifier propertyAccessModifier =
                (getterAccessModifier ?? 0) > (setterAccessModifier ?? 0) ? getterAccessModifier ?? 0 : setterAccessModifier ?? 0;

            var parameters = new IndexerParameters
            {
                RawType                = propertyInfo.PropertyType,
                RawPropertyInfo        = propertyInfo,
                Name                   = propertyInfo.Name,
                Type                   = ReflectionUtility.GetGeneralizedTypeName(propertyInfo.PropertyType),
                PropertyAccessModifier = propertyAccessModifier,
                HasSetter              = propertyInfo.CanWrite,
                SetterAccessModifier   = setterAccessModifier,
                RawSetMethod           = propertyInfo.SetMethod,
                SetMethod              = setter,
                HasGetter              = propertyInfo.CanRead,
                GetterAccessModifier   = getterAccessModifier,
                RawGetMethod           = propertyInfo.GetMethod,
                GetMethod              = getter,
            };

            return(parameters);
        }
예제 #5
0
 public void Process(IndexerParameters parameters)
 {
     ThumbSize   = new Size(parameters.ThumbWidth, parameters.ThumbWidth);
     PreviewSize = new Size(parameters.PreviewWidth, parameters.PreviewWidth);//TODO
     ProcessDirectory(parameters.IndexPath);
 }
예제 #6
0
파일: Indexer.cs 프로젝트: Eragra3/Dogu
 public Indexer(IndexerParameters parameters) : base(parameters)
 {
 }
        public Indexer CreateIndexerSchema(
            CustomTextSchema schema,
            string indexerName,
            string dataSourceName,
            string skillSetName,
            string indexName,
            SelectedProjects selectedProjects)
        {
            // field mappings
            var fieldMappings = new List <IndexerFieldMapping>
            {
                new IndexerFieldMapping
                {
                    SourceFieldName = "metadata_storage_name",
                    TargetFieldName = "id",
                    MappingFunction = new MappingFunction
                    {
                        Name = "base64Encode"
                    }
                },
                new IndexerFieldMapping
                {
                    SourceFieldName = "metadata_storage_name",
                    TargetFieldName = "document_name",
                },
                new IndexerFieldMapping
                {
                    SourceFieldName = "metadata_storage_path",
                    TargetFieldName = "document_uri",
                }
            };

            // output fields mapping
            var outputFieldMappings = new List <IndexerFieldMapping>();

            if (selectedProjects.IsSelected_EntityRecognitionProject)
            {
                foreach (string entityName in schema.EntityNames)
                {
                    outputFieldMappings.Add(new IndexerFieldMapping
                    {
                        SourceFieldName = $"/document/content/{Constants.SkillsetResponseEntitiesKey}/{entityName}",
                        TargetFieldName = entityName
                    });
                }
            }
            if (selectedProjects.IsSelected_SingleClassificationProject)
            {
                outputFieldMappings.Add(new IndexerFieldMapping
                {
                    SourceFieldName = $"/document/content/{Constants.SkillsetResponseSingleClassKey}",
                    TargetFieldName = Constants.SearchIndexSingleClassColumnName
                });
            }
            if (selectedProjects.IsSelected_MultiClassificationProject)
            {
                outputFieldMappings.Add(new IndexerFieldMapping
                {
                    SourceFieldName = $"/document/content/{Constants.SkillsetResponseMultiClassKey}",
                    TargetFieldName = Constants.SearchIndexMultiClassColumnName
                });
            }

            // configs
            var indexerParameters = new IndexerParameters
            {
                Configuration = new IndexerConfiguration
                {
                    IndexedFileNameExtensions = ".txt"
                }
            };

            return(new Indexer
            {
                Name = indexerName,
                DataSourceName = dataSourceName,
                TargetIndexName = indexName,
                SkillsetName = skillSetName,
                FieldMappings = fieldMappings,
                OutputFieldMappings = outputFieldMappings,
                Parameters = indexerParameters
            });
        }