public override Result Execute(InputDataProvider data, MergerApplicationOptions options) { try { var configuration = GetConfiguration(options); var files = data.GetData() .Where(x => x.IsValid()) .Select(x => CreateWorkItem(x, configuration)) .Cast <UrlWorkUnit>() .Select(x => x.Data) .ToArray(); var outputFilePath = Path.Combine( HTMLOperationContextScope.Context.OutputFolder, HTMLOperationContextScope.Context.Service.FileNameProvider .GetNextFileName(Application.DEFAULT_NAME_FOR_MERGED_SET_OF_FILES, options.OutputFormat.ToFileExtension())); SvgMergeHelper.GetHelper(options) .Merge(files, outputFilePath); return(Result.FromFiles(outputFilePath)); } catch (Exception e) { return(Result.Error(e)); } }
public static SvgMergeHelper GetHelper(MergerApplicationOptions options) { return(options.MergeSVGAsVertically ? (SvgMergeHelper) new SvgMergeVerticalHelper() : (SvgMergeHelper) new SvgMergeHorizontalHelper()); }