Exemplo n.º 1
0
        public exeAppendTemplateBundleItem Add(exeAppendTemplateOptions __options, string __filePath, PropertyCollectionExtended __data)
        {
            var tmp = new exeAppendTemplateBundleItem(__options, __filePath, __data);

            items.Add(tmp);
            return(tmp);
        }
        /// <summary>
        /// Gets the search pattern.
        /// </summary>
        /// <param name="flags">The flags.</param>
        /// <returns></returns>
        public static string getSearchPattern(this exeAppendTemplateOptions flags)
        {
            string output = "";
            List <exeAppendTemplateOptions> flgs = flags.getEnumListFromFlags <exeAppendTemplateOptions>();

            foreach (exeAppendTemplateOptions tl in flgs)
            {
                if (tl.ToString().EndsWith("Template"))
                {
                    string include = tl.ToString().removeEndsWith("Template").add("*", ".");
                    output = output.add(include, "|");
                }
            }

            return(output);
        }
        /// <summary>
        /// Gets the search pattern.
        /// </summary>
        /// <param name="flags">The flags.</param>
        /// <returns></returns>
        public static List <string> getExtensionList(this exeAppendTemplateOptions flags)
        {
            List <string> output = new List <string>();
            List <exeAppendTemplateOptions> flgs = flags.getEnumListFromFlags <exeAppendTemplateOptions>();

            foreach (exeAppendTemplateOptions tl in flgs)
            {
                if (tl.ToString().EndsWith("Template"))
                {
                    string include = tl.ToString().removeEndsWith("Template");
                    output.Add(include);
                }
            }

            return(output);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="exeAppendTemplateBundleItem"/> class.
        /// </summary>
        /// <param name="__options">The options.</param>
        /// <param name="__filePath">The source file/directory path</param>
        /// <param name="__data">Static data set used for template and filepath transformations.</param>
        public exeAppendTemplateBundleItem(exeAppendTemplateOptions __options, string __filePath, PropertyCollectionExtended __data)
        {
            options  = __options;
            filePath = __filePath;

            if (filePath.Contains("{{{"))
            {
                filePath = filePath.applyToContent(__data);
            }

            if (Path.GetFileName(filePath).isNullOrEmpty())
            {
                // it is directory
                target    = Directory.CreateDirectory(filePath);
                operation = itemOperaton.deployFromFolder;
            }
            else
            {
                targetExtension = Path.GetExtension(filePath).Trim('.');
                switch (targetExtension)
                {
                case "zip":
                    operation = itemOperaton.deployFromArchive;
                    break;

                case "odt":
                    operation = itemOperaton.deployFromDocument;
                    break;
                }
                target = Directory.CreateDirectory(Path.GetDirectoryName(filePath));
                FileInfo fi = filePath.getWritableFile(getWritableFileMode.overwrite);

                targetFilename = fi.FullName.removeStartsWith(target.FullName);
            }

            dedicatedData = __data;
        }