/// <summary> /// Добавление типов для экпорта. /// </summary> public void AddExportType(ExportType et) { if (et == null) { throw new ArgumentNullException("et"); } // TODO: Make set if (_exportTypes.Any(t => t != null && t.GetKey().Equals(et.GetKey()))) { return; } _exportTypes.Add(et); }
/// <summary> /// Конструктор задачи. /// </summary> public EpsTask(OutputTask task, decimal jobId, string workingFolder, bool zip, bool reserve) { _task = task; _jobId = jobId; _workingFolder = workingFolder; _zip = zip; _reserve = reserve; _taskType = _task.OutputTaskCode.To(EpsTaskType.None); if (_taskType == EpsTaskType.None) { throw new ArgumentException(string.Format("Undefined OutputTaskCode '{0}' in OutputTask.", _task.OutputTaskCode)); } if (task.TaskParams == null) { return; } var exportFormat = task.TaskParams.Where( p => p != null && p.OutputParamCode.To(EpsTaskParams.None) == EpsTaskParams.FileFormat) .Select(p => p.OutputParamValue) .FirstOrDefault(); //больше не должно быть форматов var encodingName = task.TaskParams.Where( p => p != null && p.OutputParamCode.To(EpsTaskParams.None) == EpsTaskParams.Conversion) .Select(p => p.OutputParamValue) .FirstOrDefault(); var encoding = string.IsNullOrEmpty(encodingName) ? Encoding.UTF8 : Encoding.GetEncoding(encodingName); var spacelife = task.TaskParams.Any( p => p != null && p.OutputParamCode.To(EpsTaskParams.None) == EpsTaskParams.Spacelife && p.OutputParamValue.To(0) != 0); _exportType = !string.IsNullOrEmpty(exportFormat) ? new ExportType { Encoding = encoding, Format = exportFormat, Spacelife = spacelife } : null; }