private TaskConfiguration ParseConfigString(string configString, string applicationName, string taskName)
        {
            var databaseConnString = GetConnStringElement(configString, "DB", true);

            var taskConfiguration = new TaskConfiguration();

            taskConfiguration.SetDefaultValues(applicationName,
                                               taskName,
                                               databaseConnString.Value);

            var concurrencyLimit = GetIntElement(configString, "CON", false);

            if (concurrencyLimit.Exists)
            {
                taskConfiguration.ConcurrencyLimit = concurrencyLimit.Value;
            }

            var databaseTimeoutSeconds = GetIntElement(configString, "TO", false);

            if (databaseTimeoutSeconds.Exists)
            {
                taskConfiguration.DatabaseTimeoutSeconds = databaseTimeoutSeconds.Value;
            }

            var enabled = GetBoolElement(configString, "E", false);

            if (enabled.Exists)
            {
                taskConfiguration.Enabled = enabled.Value;
            }

            var keepAliveDeathThresholdMinutes = GetDoubleElement(configString, "KADT", false);

            if (keepAliveDeathThresholdMinutes.Exists)
            {
                taskConfiguration.KeepAliveDeathThresholdMinutes = keepAliveDeathThresholdMinutes.Value;
            }

            var keepAliveIntervalMinutes = GetDoubleElement(configString, "KAINT", false);

            if (keepAliveIntervalMinutes.Exists)
            {
                taskConfiguration.KeepAliveIntervalMinutes = keepAliveIntervalMinutes.Value;
            }

            var keepGeneralDataForDays = GetIntElement(configString, "KPDT", false);

            if (keepGeneralDataForDays.Exists)
            {
                taskConfiguration.KeepGeneralDataForDays = keepGeneralDataForDays.Value;
            }

            var keepListItemsForDays = GetIntElement(configString, "KPLT", false);

            if (keepListItemsForDays.Exists)
            {
                taskConfiguration.KeepListItemsForDays = keepListItemsForDays.Value;
            }

            var minimumCleanUpIntervalHours = GetIntElement(configString, "MCI", false);

            if (minimumCleanUpIntervalHours.Exists)
            {
                taskConfiguration.MinimumCleanUpIntervalHours = minimumCleanUpIntervalHours.Value;
            }

            var timePeriodDeathThresholdMinutes = GetDoubleElement(configString, "TPDT", false);

            if (timePeriodDeathThresholdMinutes.Exists)
            {
                taskConfiguration.TimePeriodDeathThresholdMinutes = timePeriodDeathThresholdMinutes.Value;
            }

            var usesKeepAliveMode = GetBoolElement(configString, "KA", false);

            if (usesKeepAliveMode.Exists)
            {
                taskConfiguration.UsesKeepAliveMode = usesKeepAliveMode.Value;
            }

            var reprocessFailedTasks = GetBoolElement(configString, "RPC_FAIL", false);

            if (reprocessFailedTasks.Exists)
            {
                taskConfiguration.ReprocessFailedTasks = reprocessFailedTasks.Exists;
            }

            var reprocessFailedTasksDetectionRange = GetIntElement(configString, "RPC_FAIL_MTS", false);

            if (reprocessFailedTasksDetectionRange.Exists)
            {
                taskConfiguration.ReprocessFailedTasksDetectionRange = new TimeSpan(0, reprocessFailedTasksDetectionRange.Value, 0);
            }

            var failedTaskRetryLimit = GetIntElement(configString, "RPC_FAIL_RTYL", false);

            if (failedTaskRetryLimit.Exists)
            {
                taskConfiguration.FailedTaskRetryLimit = (short)failedTaskRetryLimit.Value;
            }

            var reprocessDeadTasks = GetBoolElement(configString, "RPC_DEAD", false);

            if (reprocessDeadTasks.Exists)
            {
                taskConfiguration.ReprocessDeadTasks = reprocessDeadTasks.Value;
            }

            var reprocessDeadTasksDetectionRange = GetIntElement(configString, "RPC_DEAD_MTS", false);

            if (reprocessDeadTasksDetectionRange.Exists)
            {
                taskConfiguration.ReprocessDeadTasksDetectionRange = new TimeSpan(0, reprocessDeadTasksDetectionRange.Value, 0);
            }

            var deadTaskRetryLimit = GetIntElement(configString, "RPC_DEAD_RTYL", false);

            if (deadTaskRetryLimit.Exists)
            {
                taskConfiguration.DeadTaskRetryLimit = (short)deadTaskRetryLimit.Value;
            }

            var maxBlocksToGenerate = GetIntElement(configString, "MXBL", false);

            if (maxBlocksToGenerate.Exists)
            {
                taskConfiguration.MaxBlocksToGenerate = maxBlocksToGenerate.Value;
            }

            var maxNonCompressedLength = GetIntElement(configString, "MXCOMP", false);

            if (maxNonCompressedLength.Exists)
            {
                taskConfiguration.MaxLengthForNonCompressedData = maxNonCompressedLength.Value;
            }

            var maxStatusReason = GetIntElement(configString, "MXRSN", false);

            if (maxStatusReason.Exists)
            {
                taskConfiguration.MaxStatusReason = maxStatusReason.Value;
            }

            return(taskConfiguration);
        }
        private TaskConfiguration ParseConfigString(string configString, string applicationName, string taskName)
        {
            var databaseConnString = GetConnStringElement(configString, "DB", true);

            var taskConfiguration = new TaskConfiguration();
            taskConfiguration.SetDefaultValues(applicationName,
                taskName,
                databaseConnString.Value);

            var concurrencyLimit = GetIntElement(configString, "CON", false);
            if (concurrencyLimit.Exists)
                taskConfiguration.ConcurrencyLimit = concurrencyLimit.Value;

            var databaseTimeoutSeconds = GetIntElement(configString, "TO", false);
            if (databaseTimeoutSeconds.Exists)
                taskConfiguration.DatabaseTimeoutSeconds = databaseTimeoutSeconds.Value;

            var enabled = GetBoolElement(configString, "E", false);
            if (enabled.Exists)
                taskConfiguration.Enabled = enabled.Value;

            var keepAliveDeathThresholdMinutes = GetDoubleElement(configString, "KADT", false);
            if (keepAliveDeathThresholdMinutes.Exists)
                taskConfiguration.KeepAliveDeathThresholdMinutes = keepAliveDeathThresholdMinutes.Value;

            var keepAliveIntervalMinutes = GetDoubleElement(configString, "KAINT", false);
            if (keepAliveIntervalMinutes.Exists)
                taskConfiguration.KeepAliveIntervalMinutes = keepAliveIntervalMinutes.Value;

            var keepGeneralDataForDays = GetIntElement(configString, "KPDT", false);
            if (keepGeneralDataForDays.Exists)
                taskConfiguration.KeepGeneralDataForDays = keepGeneralDataForDays.Value;

            var keepListItemsForDays = GetIntElement(configString, "KPLT", false);
            if (keepListItemsForDays.Exists)
                taskConfiguration.KeepListItemsForDays = keepListItemsForDays.Value;

            var minimumCleanUpIntervalHours = GetIntElement(configString, "MCI", false);
            if (minimumCleanUpIntervalHours.Exists)
                taskConfiguration.MinimumCleanUpIntervalHours = minimumCleanUpIntervalHours.Value;

            var timePeriodDeathThresholdMinutes = GetDoubleElement(configString, "TPDT", false);
            if (timePeriodDeathThresholdMinutes.Exists)
                taskConfiguration.TimePeriodDeathThresholdMinutes = timePeriodDeathThresholdMinutes.Value;

            var usesKeepAliveMode = GetBoolElement(configString, "KA", false);
            if (usesKeepAliveMode.Exists)
                taskConfiguration.UsesKeepAliveMode = usesKeepAliveMode.Value;

            var reprocessFailedTasks = GetBoolElement(configString, "RPC_FAIL", false);
            if (reprocessFailedTasks.Exists)
                taskConfiguration.ReprocessFailedTasks = reprocessFailedTasks.Exists;

            var reprocessFailedTasksDetectionRange = GetIntElement(configString, "RPC_FAIL_MTS", false);
            if (reprocessFailedTasksDetectionRange.Exists)
                taskConfiguration.ReprocessFailedTasksDetectionRange = new TimeSpan(0, reprocessFailedTasksDetectionRange.Value, 0);

            var failedTaskRetryLimit = GetIntElement(configString, "RPC_FAIL_RTYL", false);
            if (failedTaskRetryLimit.Exists)
                taskConfiguration.FailedTaskRetryLimit = (short)failedTaskRetryLimit.Value;

            var reprocessDeadTasks = GetBoolElement(configString, "RPC_DEAD", false);
            if (reprocessDeadTasks.Exists)
                taskConfiguration.ReprocessDeadTasks = reprocessDeadTasks.Value;

            var reprocessDeadTasksDetectionRange = GetIntElement(configString, "RPC_DEAD_MTS", false);
            if (reprocessDeadTasksDetectionRange.Exists)
                taskConfiguration.ReprocessDeadTasksDetectionRange = new TimeSpan(0, reprocessDeadTasksDetectionRange.Value, 0);

            var deadTaskRetryLimit = GetIntElement(configString, "RPC_DEAD_RTYL", false);
            if (deadTaskRetryLimit.Exists)
                taskConfiguration.DeadTaskRetryLimit = (short)deadTaskRetryLimit.Value;

            var maxBlocksToGenerate = GetIntElement(configString, "MXBL", false);
            if (maxBlocksToGenerate.Exists)
                taskConfiguration.MaxBlocksToGenerate = maxBlocksToGenerate.Value;

            var maxNonCompressedLength = GetIntElement(configString, "MXCOMP", false);
            if (maxNonCompressedLength.Exists)
                taskConfiguration.MaxLengthForNonCompressedData = maxNonCompressedLength.Value;

            var maxStatusReason = GetIntElement(configString, "MXRSN", false);
            if (maxStatusReason.Exists)
                taskConfiguration.MaxStatusReason = maxStatusReason.Value;

            return taskConfiguration;
        }