コード例 #1
0
ファイル: XmlConfigLoader.cs プロジェクト: apkbox/spit_out
        private static FileTemplate ParseTemplateElement(XmlElement e)
        {
            var fileTemplate = new FileTemplate();

            WithAttributeDo(e, "name", n => fileTemplate.Name = n);
            WithAttributeDo(e, "filename", n => fileTemplate.FileNameTemplate       = n);
            WithAttributeDo(e, "active", n => fileTemplate.IsActiveExpr             = n);
            WithAttributeDo(e, "createdir", n => fileTemplate.CreateDir             = bool.Parse(n));
            WithAttributeDo(e, "runnable", n => fileTemplate.IsRunnable             = bool.Parse(n));
            WithAttributeDo(e, "runexecutable", n => fileTemplate.RunExecutable     = n);
            WithAttributeDo(e, "runcommandline", n => fileTemplate.RunCommandLine   = n);
            WithAttributeDo(e, "runbuttontext", n => fileTemplate.RunCommandCaption = n);
            fileTemplate.ContentTemplate = e.InnerText;
            return(fileTemplate);
        }
コード例 #2
0
ファイル: FileTemplate.cs プロジェクト: apkbox/spit_out
        internal FileTemplate ExpandAsNew(Dictionary <string, string> variables)
        {
            var newTemplate = new FileTemplate();

            newTemplate.name              = this.name;
            newTemplate.ContentTemplate   = this.ContentTemplate;
            newTemplate.FileNameTemplate  = this.FileNameTemplate;
            newTemplate.CreateDir         = this.CreateDir;
            newTemplate.IsRunnable        = this.IsRunnable;
            newTemplate.RunCommandLine    = this.RunCommandLine;
            newTemplate.RunExecutable     = this.RunExecutable;
            newTemplate.RunCommandCaption = this.RunCommandCaption;
            newTemplate.Expand(variables);
            newTemplate.ContentTemplate  = newTemplate.content;
            newTemplate.FileNameTemplate = newTemplate.fileName;
            return(newTemplate);
        }