protected override void InitializeWorkerMain()
        {
            base.InitializeWorkerMain();

            // Custom
            if (WorkerSettings.TryGetValue("MinConfidence", out string minConfidenceString))
            {
                if (!int.TryParse(minConfidenceString, out MinConfidence))
                {
                    throw new ArgumentException($"Invalid argument 'MinConfidence'. Value: '{minConfidenceString}'.");
                }
            }

            if (WorkerSettings.TryGetValue("ConfidencePropertyName", out ConfidencePropertyName))
            {
            }

            if (WorkerSettings.TryGetValue("ConfidenceEnabled", out string confidenceEnabledString))
            {
                if (!bool.TryParse(confidenceEnabledString, out ConfidenceEnabled))
                {
                    throw new ArgumentException($"Invalid argument 'ConfidenceEnabled'. Value: '{confidenceEnabledString}'.");
                }
            }
        }
        protected override void InitializeWorkerMain()
        {
            if (!WorkerSettings.TryGetValue("OutputFolder", out OutputFolder))
            {
                throw new ArgumentException("Missing argument 'OutputFolder'");
            }

            if (!WorkerSettings.TryGetValue("ConfigFileName", out string configFileName))
            {
                throw new ArgumentException("Missing argument 'ConfigFileName'");
            }

            if (!WorkerSettings.TryGetValue("PluginId", out string pluginId))
            {
                throw new ArgumentException("Missing argument 'PluginId'");
            }

            this.Fields = FieldUtils.GetFieldsFromXml(configFileName, pluginId).ToList();

            if (!Directory.Exists(OutputFolder))
            {
                Directory.CreateDirectory(OutputFolder);
            }

            this.GlobalStorage = this.Runtime.GetWorkspaceDocsStorage(this.Runtime.CurrentWorkspace.ID);
        }
Exemplo n.º 3
0
        protected override void InitializeWorkerMain()
        {
            if (!WorkerSettings.TryGetValue("OutputFolder", out OutputFolder))
            {
                throw new ArgumentException("Missing argument 'OutputFolder'");
            }

            if (!WorkerSettings.TryGetValue("OutputFileName", out OutputFileName))
            {
                throw new ArgumentException("Missing argument 'OutputFileName'");
            }

            if (!WorkerSettings.TryGetValue("GeneratePdf", out string GeneratePdf))
            {
                throw new ArgumentException("Missing argument 'GeneratePdf'");
            }

            this.GeneratePdf = bool.TrueString.Equals(GeneratePdf, StringComparison.InvariantCultureIgnoreCase);

            if (!WorkerSettings.TryGetValue("ConfigFileName", out string configFileName))
            {
                throw new ArgumentException("Missing argument 'ConfigFileName'");
            }

            if (!WorkerSettings.TryGetValue("PluginId", out string pluginId))
            {
                throw new ArgumentException("Missing argument 'PluginId'");
            }

            this.Fields = FieldUtils.GetFieldsFromXml(configFileName, pluginId).ToList();

            if (!Directory.Exists(OutputFolder))
            {
                Directory.CreateDirectory(OutputFolder);
            }

            this.GlobalStorage = this.Runtime.GetWorkspaceDocsStorage(this.Runtime.CurrentWorkspace.ID);
        }