예제 #1
0
        public static void ExcelDnaPack(this ICakeContext context, FilePath dnaFilePath, Action <ExcelDnaPackSettings> configurator)
        {
            if (context is null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            if (dnaFilePath is null)
            {
                throw new ArgumentNullException(nameof(dnaFilePath));
            }

            if (configurator is null)
            {
                throw new ArgumentNullException(nameof(configurator));
            }

            var settings = new ExcelDnaPackSettings
            {
                DnaFilePath = dnaFilePath,
            };

            configurator(settings);

            context.ExcelDnaPack(settings);
        }
예제 #2
0
        /// <summary>
        /// Disable multi-threading to ensure deterministic order of packing
        /// </summary>
        /// <param name="settings">The settings.</param>
        /// <returns>The <paramref name="settings" /> instance with <see cref="ExcelDnaPackSettings.NoMultiThreading" /> set to <see langword="true" />.</returns>
        public static ExcelDnaPackSettings NoMultiThreading(this ExcelDnaPackSettings settings)
        {
            if (settings is null)
            {
                throw new ArgumentNullException(nameof(settings));
            }

            settings.NoMultiThreading = true;

            return(settings);
        }
예제 #3
0
        /// <summary>
        /// Disable compression (LZMA) of resources
        /// </summary>
        /// <param name="settings">The settings.</param>
        /// <returns>The <paramref name="settings" /> instance with <see cref="ExcelDnaPackSettings.NoCompression" /> set to <see langword="true" />.</returns>
        public static ExcelDnaPackSettings NoCompression(this ExcelDnaPackSettings settings)
        {
            if (settings is null)
            {
                throw new ArgumentNullException(nameof(settings));
            }

            settings.NoCompression = true;

            return(settings);
        }
예제 #4
0
        /// <summary>
        /// Enable interactive prompt to overwrite the output .xll file, if it already exists.
        /// </summary>
        /// <param name="settings">The settings.</param>
        /// <returns>The <paramref name="settings" /> instance with <see cref="ExcelDnaPackSettings.PromptBeforeOverwrite" /> set to <see langword="true" />.</returns>
        public static ExcelDnaPackSettings PromptBeforeOverwrite(this ExcelDnaPackSettings settings)
        {
            if (settings is null)
            {
                throw new ArgumentNullException(nameof(settings));
            }

            settings.PromptBeforeOverwrite = true;

            return(settings);
        }
예제 #5
0
        /// <summary>
        /// Set the path to the primary .dna file for the Excel-DNA add-in
        /// </summary>
        /// <param name="settings">The settings.</param>
        /// <param name="dnaFilePath">The path to the primary .dna file for the Excel-DNA add-in</param>
        /// <returns>The <paramref name="settings" /> instance with <see cref="ExcelDnaPackSettings.DnaFilePath" /> set to <paramref name="dnaFilePath" />.</returns>
        public static ExcelDnaPackSettings SetDnaFilePath(this ExcelDnaPackSettings settings, FilePath dnaFilePath)
        {
            if (settings is null)
            {
                throw new ArgumentNullException(nameof(settings));
            }

            settings.DnaFilePath = dnaFilePath;

            return(settings);
        }
예제 #6
0
        public static void ExcelDnaPack(this ICakeContext context, ExcelDnaPackSettings settings)
        {
            if (context is null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            if (settings is null)
            {
                throw new ArgumentNullException(nameof(settings));
            }

            AddInInformation.LogVersionInformation(context.Log);

            var excelDnaPack = new ExcelDnaPackTool(context.FileSystem, context.Environment, context.ProcessRunner,
                                                    context.Tools, context.Log);

            excelDnaPack.Run(settings);
        }