Example #1
0
        protected static void AppendText(string text, TemplateClassBuilder builder, TemplateOptions options)
        {
            var encodeHtml = options.EncodeHtml;
            if (text.StartsWith("!"))
            {
                text = text.Substring(1, text.Length - 1);
                text.TrimStart(' ');
                encodeHtml = false;
            }
            if (text.StartsWith("&"))
            {
                text = text.Substring(1, text.Length - 1);
                text.TrimStart(' ');
                encodeHtml = true;
            }

            var parser = new ExpressionStringParser(text);
            parser.Parse();
            foreach (var expressionStringToken in parser.ExpressionStringTokens)
            {
                if (expressionStringToken.IsExpression)
                {
                    builder.AppendCode(expressionStringToken.Value, encodeHtml);
                }
                else
                {
                    builder.AppendOutput(expressionStringToken.Value);
                }
            }
        }
Example #2
0
        public override BlockClosingAction Render(ViewSourceReader viewSourceReader, TemplateOptions options, TemplateClassBuilder builder)
        {
            var currentInputLine = viewSourceReader.CurrentInputLine;
            var content = currentInputLine.NormalizedText.Trim().ToLowerInvariant();

            if (string.IsNullOrEmpty(content))
            {
                builder.AppendOutput(@"<!DOCTYPE html PUBLIC ""-//W3C//DTD XHTML 1.0 Transitional//EN"" ""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"">");
            }
            else if (string.Equals(content, "1.1"))
            {
                builder.AppendOutput(@"<!DOCTYPE html PUBLIC ""-//W3C//DTD XHTML 1.1//EN"" ""http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"">");
            }
            else if (string.Equals(content, "strict"))
            {
                builder.AppendOutput(@"<!DOCTYPE html PUBLIC ""-//W3C//DTD XHTML 1.0 Strict//EN"" ""http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"">");
            }
            else if (string.Equals(content, "frameset"))
            {
                builder.AppendOutput(@"<!DOCTYPE html PUBLIC ""-//W3C//DTD XHTML 1.0 Frameset//EN"" ""http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"">");
            }
            else if (string.Equals(content, "html"))
            {
                builder.AppendOutput(@"<!DOCTYPE HTML PUBLIC ""-//W3C//DTD HTML 4.01 Transitional//EN"" ""http://www.w3.org/TR/html4/loose.dtd"">");
            }
            else if (string.Equals(content, "html strict"))
            {
                builder.AppendOutput(@"<!DOCTYPE HTML PUBLIC ""-//W3C//DTD HTML 4.01//EN"" ""http://www.w3.org/TR/html4/strict.dtd"">");
            }
            else if (string.Equals(content, "html frameset"))
            {
                builder.AppendOutput(@"<!DOCTYPE HTML PUBLIC ""-//W3C//DTD HTML 4.01 Frameset//EN"" ""http://www.w3.org/TR/html4/frameset.dtd"">");
            }
            else
            {
                var parts = content.Split(' ');

                if (string.Equals(parts[0], "xml"))
                {
                    var encoding = "utf-8";

                    if (parts.Length == 2)
                    {
                        encoding = parts[1];
                    }

                    var invariant = Utility.FormatInvariant(@"<?xml version=""1.0"" encoding=""{0}"" ?>", encoding);
                    builder.AppendOutput(invariant);
                }
                else
                {
                    SyntaxException.Throw(currentInputLine, ErrorParsingTag,currentInputLine);
                }
            }

            builder.AppendOutputLine();

            return EmptyClosingAction;
        }
Example #3
0
        public override BlockClosingAction Render(ViewSourceReader viewSourceReader, TemplateOptions options, TemplateClassBuilder builder)
        {
            builder.AppendOutput(viewSourceReader.CurrentInputLine.Indent);
            builder.AppendOutput(viewSourceReader.CurrentInputLine.NormalizedText);
            builder.AppendOutputLine();

            return EmptyClosingAction;
        }
Example #4
0
        public RTTemplate(string templateExpr, TemplateOptions options)
        {
            Contract.Requires(templateExpr != null);
            Contract.Requires(options != null);

            _templateExpr = templateExpr;
            _options = options;
        }
        public override BlockClosingAction Render(HamlNode node, TemplateOptions options, TemplateClassBuilder builder)
        {
            //var inputLine = viewSourceReader.CurrentInputLine;
            //builder.AppendOutput( inputLine.Indent );

            //builder.AppendCode( inputLine.NormalizedText.Trim(), false );
            //builder.AppendOutputLine();
            return EmptyClosingAction;
        }
Example #6
0
        public override BlockClosingAction Render(ViewSourceReader viewSourceReader, TemplateOptions options, TemplateClassBuilder builder)
        {
            var currentInputLine = viewSourceReader.CurrentInputLine;
            var match = _commentRegex.Match( currentInputLine.NormalizedText );

            if( !match.Success )
            {
                SyntaxException.Throw( currentInputLine, ErrorParsingTag, currentInputLine);
            }

            var ieBlock = match.Groups[1].Value;
            var content = match.Groups[2].Value;

            var openingTag = new StringBuilder(currentInputLine.Indent);
            openingTag.Append("<!--");
            var closingTag = new StringBuilder("-->");

            if( !string.IsNullOrEmpty( ieBlock ) )
            {
                openingTag.AppendFormat("{0}>",ieBlock);
                closingTag.Insert(0,"<![endif]");
            }

            if( string.IsNullOrEmpty( content ) )
            {
                builder.AppendOutput(openingTag.ToString());
                builder.AppendOutputLine();
                closingTag.Insert(0, currentInputLine.Indent);
            }
            else
            {
                if( content.Length > 50 )
                {
                    builder.AppendOutput(openingTag.ToString());
                    builder.AppendOutputLine();

                    builder.AppendOutput( viewSourceReader.NextIndent );

                    builder.AppendOutput(content);

                    builder.AppendOutputLine();
                }
                else
                {
                    builder.AppendOutput( openingTag.ToString() );
                    builder.AppendOutput( content );
                    closingTag.Insert(0, ' ');
                }
            }

            return () =>
                   {
                       builder.AppendOutput(closingTag.ToString());
                       builder.AppendOutputLine();
                   };
        }
 public override BlockClosingAction Render(HamlNode node, TemplateOptions options, TemplateClassBuilder builder)
 {
     //int currentLineIndentCount = viewSourceReader.CurrentInputLine.IndentCount;
     //while ((viewSourceReader.NextInputLine != null)
     //    && (viewSourceReader.NextInputLine.IndentCount > currentLineIndentCount))
     //{
     //    viewSourceReader.MoveNext();
     //}
     return null;
 }
        public BooTemplateTypeBuilder(TemplateOptions options)
        {
            _booCompiler = new BooCompiler();
            CompilerResults = new CompilerResults( new TempFileCollection() );
            this.options = options;

            _booCompiler.Parameters.GenerateInMemory = true;
            _booCompiler.Parameters.Debug = true;
            _booCompiler.Parameters.OutputType = CompilerOutputType.Library;
        }
Example #9
0
        public override BlockClosingAction Render(ViewSourceReader viewSourceReader, TemplateOptions options, TemplateClassBuilder builder)
        {
            var inputLine = viewSourceReader.CurrentInputLine;

            builder.AppendOutput( inputLine.Indent );
            builder.AppendCode(inputLine.NormalizedText.Trim(), options.EncodeHtml);

            builder.AppendOutputLine();
            return EmptyClosingAction;
        }
Example #10
0
        public override BlockClosingAction Render(ViewSourceReader viewSourceReader, TemplateOptions options, TemplateClassBuilder builder)
        {
            var code = viewSourceReader.CurrentInputLine.NormalizedText.Trim();

            if( !string.IsNullOrEmpty( code ) )
            {
                builder.AppendPreambleCode( code );
            }

            return EmptyClosingAction;
        }
Example #11
0
 public static void ResetGlobals()
 {
     IsProjectOpen = false;
     CurrentTemplate = TemplateOptions.Template_3X3;
     CurrentFileLocation = String.Empty;
     PreviouslySelectedBox = -1;
     OptionSelected = -1;
     CurrentlySelectedBox = -1;
     currentAppState = RippleSystemStates.Start;
     CurrentlySelectedParent = 0;
 }
Example #12
0
        public override BlockClosingAction Render(ViewSourceReader viewSourceReader, TemplateOptions options, TemplateClassBuilder builder)
        {
            var content = viewSourceReader.CurrentInputLine.NormalizedText.Trim().Replace( "\"", "\"\"" );

            var indexOfEquals = content.IndexOf('=');
            var key = content.Substring(0, indexOfEquals).Trim();
            var value = content.Substring(indexOfEquals+1, content.Length - indexOfEquals - 1).Trim();

            builder.Meta[key] = value;

            return EmptyClosingAction;
        }
Example #13
0
        public TemplateFactory Compile(ViewSourceReader viewSourceReader, TemplateOptions options, TemplateClassBuilder builder)
        {
            var templateSource = builder.Build(options.Usings);

            var typeBuilder = new BooTemplateTypeBuilder(options);

            var templateType = typeBuilder.Build(templateSource, builder.ClassName);

            if( templateType == null )
            {
                var path = ListExtensions.Last(viewSourceReader.ViewSources).Path;
                TemplateCompilationException.Throw( typeBuilder.CompilerResults,typeBuilder.Source, path );
            }

            return new TemplateFactory( templateType );
        }
        public override BlockClosingAction Render(ViewSourceReader viewSourceReader, TemplateOptions options, TemplateClassBuilder builder)
        {
            var text = viewSourceReader.CurrentInputLine.NormalizedText.TrimStart();
		    var indexOfSpace = text.IndexOf(' ');
            var sectionName = text.Substring(indexOfSpace + 1, text.Length - indexOfSpace - 1);
            var code = string.Format("{0}).AddSection(\"{1}\", x =>", viewSourceReader.CurrentInputLine.Indent, sectionName);

            builder.EndCodeBlock();
            builder.Indent();

            builder.AppendSilentCode(code, false);
            builder.BeginCodeBlock();


            return builder.Unindent;
        }
        public TemplateFactory Compile(ViewSourceReader viewSourceReader, TemplateOptions options, TemplateClassBuilder builder)
        {
            var ruby = new StringBuilder();

            foreach (var reference in options.References)
            {
                ruby.AppendLine( string.Format("require '{0}'", reference) );
            }

            ruby.Append(builder.Build(options.Usings));

            var templateSource = ruby.ToString();
            _scriptEngine.Execute( templateSource );

            return CreateTemplateFactory( _scriptEngine, builder.ClassName );
        }
Example #16
0
        private void Init()
        {
            if (_options != null)
            {
                RTParsingContext context = new RTParsingContext(_factory);
                var exprList = new RTExpressionList();
                exprList.Parse(_templateExpr, 0, context); //parse should not throw an exception
                _interpreter = exprList;

                _options = null;
                _templateExpr = null;

                if (!_interpreter.CanExecute)
                {
                    _parsingException = new RTParsingException(context.Errors, ErrorMessages.Template_Parsing_Error);
                }
            }
            if (_parsingException != null) throw _parsingException;
        }
Example #17
0
 /// <summary>
 /// Returns the XML path for the current selected template
 /// </summary>
 /// <param name="currentTemplate"></param>
 /// <returns></returns>
 public static String GetXMLFileForTemplate(TemplateOptions currentTemplate)
 {
     switch (currentTemplate)
     {
         case TemplateOptions.Template_2X2:
             return Environment.CurrentDirectory + "\\SampleTemplates\\Template2X2.xml";
         case TemplateOptions.Template_2X3:
             return Environment.CurrentDirectory + "\\SampleTemplates\\Template2X3.xml";
         case TemplateOptions.Template_3X2:
             return Environment.CurrentDirectory + "\\SampleTemplates\\Template3X2.xml";
         case TemplateOptions.Template_3X3:
             return Environment.CurrentDirectory + "\\SampleTemplates\\Template3X3.xml";
         case TemplateOptions.Template_Random_1:
             return Environment.CurrentDirectory + "\\SampleTemplates\\TemplateMerge1.xml";
         default:
             return String.Empty;
           
     }
 }
Example #18
0
 public DefaultTemplate(StackData data, StackFlairOptions flairOptions)
     : base(data, flairOptions)
 {
     TemplateOptions = new TemplateOptions() {
         GravatarSize = 48,
         Spacing = 5,
         NameColor = Color.FromArgb(119, 119, 204),
         BackgroundColor = Color.FromArgb(221, 221, 221),
         GoldColor = Color.FromArgb(221, 153, 34),
         SilverColor = Color.FromArgb(119, 119, 119),
         BronzeColor = Color.FromArgb(205, 127, 50),
         BorderWidth = 1,
         BorderColor = Color.FromArgb(136, 136, 136),
         ModColor = Color.FromArgb(51, 51, 51),
         TopLineSize = 10,
         MiddleLineSize = 9,
         RepColor = Color.FromArgb(51, 51, 51),
         FontFamily = "Helvetica"
     };
 }
        public TemplateFactory Compile(ViewSourceReader viewSourceReader, TemplateOptions options, TemplateClassBuilder builder)
        {
            var typeBuilder = CreateTemplateTypeBuilder(options);
            //TODO: leaky abstraction
            var classBuilder = (CodeDomClassBuilder) builder;
            var provider = GetCodeDomProvider(typeBuilder.ProviderOptions);
            classBuilder.CodeDomProvider = provider;
            typeBuilder.CodeDomProvider = provider;
            var templateSource = classBuilder.Build(options.Usings);

            var templateType = typeBuilder.Build( templateSource, classBuilder.ClassName );

            if( templateType == null )
            {
                var viewSources = viewSourceReader.ViewSources;
                TemplateCompilationException.Throw(typeBuilder.CompilerResults, typeBuilder.Source, ListExtensions.Last(viewSources).Path);
            }

            return new TemplateFactory( templateType );
        }
Example #20
0
 public BlackTemplate(StackData data, StackFlairOptions flairOptions)
     : base(data, flairOptions)
 {
     TemplateOptions = new TemplateOptions() {
         GravatarSize = 48,
         Spacing = 5,
         BorderColor = Color.Black,
         BackgroundColor = Color.FromArgb(34, 34, 34),
         BorderWidth = 1,
         GoldColor = Color.FromArgb(255, 204, 0),
         SilverColor = Color.FromArgb(119, 119, 119),
         BronzeColor = Color.FromArgb(205, 127, 50),
         FontFamily = "Helvetica",
         TopLineSize = 10,
         MiddleLineSize = 9,
         ModColor = Color.White,
         NameColor = Color.White,
         RepColor = Color.White
     };
 }
        public override BlockClosingAction Render(ViewSourceReader viewSourceReader, TemplateOptions options, TemplateClassBuilder builder)
        {

            var dictionary = string.Empty;

            var text = viewSourceReader.CurrentInputLine.NormalizedText.Trim();
            var indexOfSpace = text.IndexOf(' ');
            string componentName ;
            if (indexOfSpace == -1)
            {
                componentName = text.Trim();
            }
            else
            {
                dictionary = text.Substring(indexOfSpace, text.Length - indexOfSpace);
                dictionary = dictionary.Trim();
                Debug.Assert(dictionary.StartsWith("{"), "dictionary must start with '{'");
                Debug.Assert(dictionary.EndsWith("}"), "dictionary must start with '}'");
                dictionary = dictionary.Substring(1, dictionary.Length - 2);
                componentName = text.Substring(0, indexOfSpace);
            }


            var codeDomClassBuilder = (CodeDomClassBuilder)builder;

            var dictionaryLocalVariable = AppendCreateDictionaryLocalVariable(dictionary, codeDomClassBuilder);

        	codeDomClassBuilder.CurrentTextWriterVariableName = "x";
            var code = string.Format("{0}Component(\"{1}\", {2}, (x) =>",
                                     viewSourceReader.CurrentInputLine.Indent, componentName, dictionaryLocalVariable);

            codeDomClassBuilder.AppendSilentCode(code, false);
            codeDomClassBuilder.BeginCodeBlock();
			return () =>
			       	{
			       		codeDomClassBuilder.EndCodeBlock();
			       		codeDomClassBuilder.AppendSilentCode(").Render();", false);
			       		codeDomClassBuilder.CurrentTextWriterVariableName = TemplateClassBuilder.DefaultTextWriterVariableName;
			       	};
        }
Example #22
0
        public override BlockClosingAction Render(HamlNode node, TemplateOptions options, TemplateClassBuilder builder)
        {
            //var partialName = viewSourceReader.CurrentInputLine.NormalizedText.Trim();

            //if (string.IsNullOrEmpty(partialName))
            //{
            //    if (viewSourceReader.ViewSourceQueue.Count == 0)
            //    {
            //        throw new InvalidOperationException(NoPartialName);
            //    }
            //    var templatePath = viewSourceReader.ViewSourceQueue.Dequeue();
            //    viewSourceReader.MergeTemplate(templatePath, true);
            //}
            //else
            //{
            //    partialName = partialName.Insert(partialName.LastIndexOf(@"\", StringComparison.OrdinalIgnoreCase) + 1, "_");
            //    var viewSource = options.TemplateContentProvider.GetViewSource(partialName, viewSourceReader.ViewSources);
            //    viewSourceReader.ViewSourceModifiedChecks.Add(() => viewSource.IsModified);
            //    viewSourceReader.MergeTemplate(viewSource, true);
            //}

            return EmptyClosingAction;
        }
Example #23
0
 public HotDogTemplate(StackData data, StackFlairOptions flairOptions)
     : base(data, flairOptions)
 {
     TemplateOptions = new TemplateOptions() {
         GravatarSize = 48,
         Spacing = 5,
         BorderColor = Color.Black,
         BackgroundColor = Color.Red,
         BorderWidth = 1,
         BronzeColor = Color.FromArgb(77, 68, 0),
         FontFamily = "Helvetica",
         GoldColor = Color.FromArgb(255, 204, 0),
         MiddleLineSize = 9,
         ModColor = Color.Yellow,
         NameColor = Color.Yellow,
         RepColor = Color.Yellow,
         SilverColor = Color.FromArgb(198, 198, 198),
         TopLineSize = 10
     };
 }
Example #24
0
 private void okButton_Click(object sender, RoutedEventArgs e)
 {
     this.SelectedItem = (TemplateOptions)this.TemplateOptionsBox.SelectedIndex;
     this.DialogResult = true;
 }
Example #25
0
 public VisualBasicTemplateTypeBuilder(TemplateOptions options)
     : base(options)
 {
     ProviderOptions.Add("CompilerVersion", "v3.5");
 }
 public DictionaryDictionaryFluidIndexable(IDictionary dictionary, TemplateOptions options)
 {
     _dictionary = dictionary;
     _options    = options;
 }
 public void FixtureSetUp()
 {
     viewModel = new TestViewModel();
     options = TemplateOptions.ReadOnly;
 }
Example #28
0
 public HoLyTemplate(StackData data, StackFlairOptions flairOptions)
     : base(data, flairOptions)
 {
     TemplateOptions = new TemplateOptions() {
         GravatarSize = 48,
         Spacing = 5,
         BorderColor = Color.Black,
         BackgroundColor = Color.FromArgb(222, 150, 16),
         BorderWidth = 1,
         BronzeColor = Color.FromArgb(77, 68, 0),
         FontFamily = "Helvetica",
         GoldColor = Color.FromArgb(255, 204, 0),
         MiddleLineSize = 9,
         ModColor = Color.FromArgb(222, 81, 0),
         NameColor = Color.FromArgb(82, 81, 181),
         RepColor = Color.FromArgb(222, 81, 0),
         SilverColor = Color.FromArgb(119, 119, 119),
         TopLineSize = 10
     };
 }
Example #29
0
 public LiquidShapeTemplateOptionsSetup(IOptions <TemplateOptions> templateOptions)
 {
     _templateOptions = templateOptions.Value;
 }
Example #30
0
 public abstract BlockClosingAction Render(ViewSourceReader viewSourceReader, TemplateOptions options, TemplateClassBuilder builder);
Example #31
0
        private Item CreateItem(int uid, int parent, int order, string content, string title, string path, TemplateOptions TemplateOptions)
        {
#if DEBUG
            if (_usedids.Contains(uid))
            {
                //UID mismatch. Some kind of generator error
                Debugger.Break();
            }
            _usedids.Add(uid);
#endif

            var result = new Item
            {
                Content        = content,
                Title          = title,
                PubDate        = DateTime.Now.ToWpTimeFormat(),
                Post_date      = DateTime.Now.ToWpPostDate(),
                Post_date_gmt  = DateTime.UtcNow.ToWpPostDate(),
                Menu_order     = order,
                Ping_status    = "closed",
                Comment_status = TemplateOptions[TemplateOptions.WordpressCommentStatus],
                Is_sticky      = "0",
                Postmeta       = new List <Postmeta>
                {
                    new Postmeta {
                        Meta_key = "", Meta_value = ""
                    }
                },
                Post_password = "",
                Status        = "publish",
                Post_name     = Encode(title),
                Post_id       = uid,
                Post_parent   = parent,
                Post_type     = TemplateOptions[TemplateOptions.WordpressItemType],
                Link          = path,
                Creator       = TemplateOptions[TemplateOptions.WordpressAuthorLogin],
                Description   = "",
                Guid          = new Domain.Wordpress.Guid
                {
                    IsPermaLink = false,
                    Text        = $"{TemplateOptions[TemplateOptions.WordpressTargetHost]}?page_id={uid}",
                }
            };
            return(result);
        }
 public ModelScriptTemplate(ILoggerFactory loggerFactory, GeneratorOptions generatorOptions, TemplateOptions templateOptions)
     : base(loggerFactory, generatorOptions, templateOptions)
 {
 }
Example #33
0
 public override CodeDomTemplateTypeBuilder CreateTemplateTypeBuilder(TemplateOptions options)
 {
     return(new CSharp4TemplateTypeBuilder(options));
 }
Example #34
0
 public ContextScriptVariables(EntityContext entityContext, GeneratorOptions generatorOptions, TemplateOptions templateOptions)
     : base(generatorOptions, templateOptions)
 {
     EntityContext = entityContext;
 }
Example #35
0
        public async Task ShouldRenderSampleWithTrimTagRight()
        {
            var sample = @"
<ul id=""products"">
  {% for product in products %}
  <li>
    <h2>{{ product.name }}</h2>
    Only {{ product.price | price }}

    {{ product.name | prettyprint | paragraph }}
  </li>
  {% endfor %}
</ul>
";

            var expected = @"
<ul id=""products"">
  <li>
    <h2>product 1</h2>
    Only 1

    product 1
  </li>
  <li>
    <h2>product 2</h2>
    Only 2

    product 2
  </li>
  <li>
    <h2>product 3</h2>
    Only 3

    product 3
  </li>
  </ul>
";

            var _products = new[]
            {
                new { name = "product 1", price = 1 },
                new { name = "product 2", price = 2 },
                new { name = "product 3", price = 3 },
            };

            _parser.TryParse(sample, out var template, out var messages);

            var options = new TemplateOptions {
                Trimming = TrimmingFlags.TagRight
            };
            var context = new TemplateContext(options);

            context.SetValue("products", _products);
            options.Filters.AddFilter("prettyprint", (input, args, ctx) => input);
            options.Filters.AddFilter("paragraph", (input, args, ctx) => input);
            options.Filters.AddFilter("price", (input, args, ctx) => input);
            options.MemberAccessStrategy.Register(new { name = "", price = 0 }.GetType());

            var result = await template.RenderAsync(context);

            Assert.Equal(expected, result);
        }
Example #36
0
        public static void UpdateTemplateOptions(TemplateOptions options)
        {
            if (options == null)
            {
                throw new ArgumentNullException("options");
            }

            var section = GetSection();

            if (section == null)
            {
                return;
            }

            if (section.IndentSize.HasValue)
            {
                options.IndentSize = section.IndentSize.Value;
            }

            if (section.AutoRecompile.HasValue)
            {
                options.AutoRecompile = section.AutoRecompile.Value;
            }
            else
            {
                options.AutoRecompile = true;
            }

            if (section.UseTabs.HasValue)
            {
                options.UseTabs = section.UseTabs.Value;
            }

            if (!string.IsNullOrEmpty(section.TemplateBaseType))
            {
                options.TemplateBaseType = Type.GetType(section.TemplateBaseType, true, false);
            }

            if (section.EncodeHtml.HasValue)
            {
                options.EncodeHtml = section.EncodeHtml.Value;
            }

            if (section.OutputDebugFiles.HasValue)
            {
                options.OutputDebugFiles = section.OutputDebugFiles.Value;
            }



            if (!string.IsNullOrEmpty(section.TemplateCompiler))
            {
                options.TemplateCompiler = section.CreateTemplateCompiler();
            }

            foreach (var assemblyConfigurationElement in section.Assemblies)
            {
                Assembly assembly;
                var      assemblyName = assemblyConfigurationElement.Name;
                try
                {
                    assembly = Assembly.Load(assemblyName);
                }
                catch (Exception exception)
                {
                    var message = string.Format("Coule not load Assembly '{0}'.Did you forget to fully qualify it? For example 'System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'", assemblyName);
                    throw new Exception(message, exception);
                }
                options.AddReference(assembly.Location);
            }

            foreach (var namespaceConfigurationElement in section.Namespaces)
            {
                options.AddUsing(namespaceConfigurationElement.Name);
            }
        }
Example #37
0
        public override BlockClosingAction Render(ViewSourceReader viewSourceReader, TemplateOptions options, TemplateClassBuilder builder)
        {
            var currentInputLine = viewSourceReader.CurrentInputLine;
            var input            = PreprocessLine(currentInputLine);
            var match            = _tagRegex.Match(input);

            if (!match.Success)
            {
                SyntaxException.Throw(currentInputLine, ErrorParsingTag, currentInputLine);
            }

            var groups  = match.Groups;
            var tagName = groups[1].Value.Replace("\\", string.Empty);

            var isWhitespaceSensitive = _whitespaceSensitiveTags.Contains(tagName);
            var openingTag            = string.Format("{0}<{1}", currentInputLine.Indent, tagName);
            var closingTag            = string.Format("</{0}>", tagName);

            builder.AppendOutput(openingTag);

            ParseAndRenderAttributes(builder, match);

            var action = groups[6].Value.Trim();

            if (string.Equals("/", action) || options.IsAutoClosingTag(tagName))
            {
                builder.AppendOutput(" />");
                builder.AppendOutputLine();
                return(EmptyClosingAction);
            }

            var content = groups[7].Value.Trim();

            if (string.IsNullOrEmpty(content))
            {
                builder.AppendOutput(">");
                builder.AppendOutputLine();
                closingTag = currentInputLine.Indent + closingTag;
            }
            else
            {
                if ((content.Length > 50) || ("=" == action) || ("&=" == action) || ("!=" == action))
                {
                    builder.AppendOutput(">");

                    if (!isWhitespaceSensitive)
                    {
                        builder.AppendOutputLine();
                        builder.AppendOutput(viewSourceReader.NextIndent);
                    }

                    if (string.Equals("=", action))
                    {
                        builder.AppendCode(content, options.EncodeHtml);
                    }
                    else if (string.Equals("&=", action))
                    {
                        builder.AppendCode(content, true);
                    }
                    else if (string.Equals("!=", action))
                    {
                        builder.AppendCode(content, false);
                    }
                    else
                    {
                        AppendText(content, builder, options);
                    }

                    if (!isWhitespaceSensitive)
                    {
                        builder.AppendOutputLine();
                        closingTag = currentInputLine.Indent + closingTag;
                    }
                }
                else
                {
                    builder.AppendOutput(">");
                    AppendText(content, builder, options);
                    if ((currentInputLine.IndentCount + 1) == viewSourceReader.NextInputLine.IndentCount)
                    {
                        builder.AppendOutputLine();
                        closingTag = currentInputLine.Indent + closingTag;
                    }
                }
            }

            return(() =>
            {
                builder.AppendOutput(closingTag);
                builder.AppendOutputLine();
            });
        }
Example #38
0
 public CSharp3TemplateTypeBuilder(TemplateOptions options)
     : base(options)
 {
     ProviderOptions.Add("CompilerVersion", "v3.5");
 }
Example #39
0
        public static FluidValue Create(object value, TemplateOptions options)
        {
            if (value == null)
            {
                return(NilValue.Instance);
            }

            if (value is FluidValue fluidValue)
            {
                return(fluidValue);
            }

            var converters = options.ValueConverters;

            for (var i = 0; i < converters.Count; i++)
            {
                var valueConverter = converters[i];
                var result         = valueConverter(value);

                if (result != null)
                {
                    // If a converter returned a FluidValue instance use it directly
                    if (result is FluidValue resultFluidValue)
                    {
                        return(resultFluidValue);
                    }

                    // Otherwise stop custom conversions

                    value = result;
                    break;
                }
            }

            var typeOfValue = value.GetType();

            switch (System.Type.GetTypeCode(typeOfValue))
            {
            case TypeCode.Boolean:
                return(BooleanValue.Create(Convert.ToBoolean(value)));

            case TypeCode.Byte:
            case TypeCode.UInt16:
            case TypeCode.UInt32:
                return(NumberValue.Create(Convert.ToUInt32(value)));

            case TypeCode.SByte:
            case TypeCode.Int16:
            case TypeCode.Int32:
                return(NumberValue.Create(Convert.ToInt32(value)));

            case TypeCode.UInt64:
            case TypeCode.Int64:
            case TypeCode.Decimal:
            case TypeCode.Double:
            case TypeCode.Single:
                return(NumberValue.Create(Convert.ToDecimal(value)));

            case TypeCode.Empty:
                return(NilValue.Instance);

            case TypeCode.Object:

                switch (value)
                {
                case DateTimeOffset dateTimeOffset:
                    return(new DateTimeValue(dateTimeOffset));

                case IDictionary <string, object> dictionary:
                    return(new DictionaryValue(new ObjectDictionaryFluidIndexable(dictionary, options)));

                case IDictionary <string, FluidValue> fluidDictionary:
                    return(new DictionaryValue(new FluidValueDictionaryFluidIndexable(fluidDictionary)));

                case IDictionary otherDictionary:
                    return(new DictionaryValue(new DictionaryDictionaryFluidIndexable(otherDictionary, options)));

                case FluidValue[] array:
                    return(new ArrayValue(array));

                case IList <FluidValue> list:
                    return(new ArrayValue(list));

                case IEnumerable <FluidValue> enumerable:
                    return(new ArrayValue(enumerable));

                case IList list:
                    var values = new List <FluidValue>(list.Count);
                    foreach (var item in list)
                    {
                        values.Add(Create(item, options));
                    }
                    return(new ArrayValue(values));

                case IEnumerable enumerable:
                    var fluidValues = new List <FluidValue>();
                    foreach (var item in enumerable)
                    {
                        fluidValues.Add(Create(item, options));
                    }
                    return(new ArrayValue(fluidValues));
                }

                return(new ObjectValue(value));

            case TypeCode.DateTime:
                return(new DateTimeValue((DateTime)value));

            case TypeCode.Char:
            case TypeCode.String:
                return(new StringValue(Convert.ToString(value, CultureInfo.InvariantCulture)));

            default:
                throw new InvalidOperationException();
            }
        }
Example #40
0
 public abstract BlockClosingAction Render(HamlNode node, TemplateOptions options, TemplateClassBuilder builder);
Example #41
0
 public ModelScriptVariables(Model model, GeneratorOptions generatorOptions, TemplateOptions templateOptions)
     : base(generatorOptions, templateOptions)
 {
     Model = model;
 }
 public LiquidTemplateContext(IServiceProvider services, TemplateOptions options) : base(options)
 {
     Services = services;
 }
Example #43
0
        public ViewResult CreateEdit(Guid?Id, string type, string game = null)
        {
            switch (type)
            {
            case "Product":
                Product prod = EntityRepository.Products.Where(p => p.ProductId == Id).FirstOrDefault();
                if (prod != null)
                {
                    return(View("Save" + type, new ProductDetails
                    {
                        Product = prod,
                        ProductId = prod.ProductId,
                        GamesList = new SelectList(EntityRepository.Games.Select(g => g.GameName), prod?.ProductGame.GameName ?? "Select Game"),
                        SelectedGame = prod?.ProductGame.GameName,
                        CategoriesList = new SelectList(EntityRepository.Games.Where(g => game == null || g.GameName == game).SelectMany(g => g.ProductCategory).Select(p => p.ProductCategoryName), prod?.ProductCategory.ProductCategoryName ?? "Select Category"),
                        SelectedCategory = prod?.ProductCategory.ProductCategoryName,
                        MetaTagTitleList = new SelectList(EntityRepository.SEOs.Select(s => s.MetaTagTitle), prod?.SEO.MetaTagTitle ?? "Select Meta tag title from List"),
                        SelectedMetaTagTitle = prod?.SEO.MetaTagTitle,
                        ProductOptions = prod.ProductOptions,
                        ProductName = prod.ProductName,
                        InStock = prod.InStock,
                        PreOrder = prod.PreOrder,
                        ProductEnabled = prod.ProductEnabled,
                        ProductQuantity = prod.ProductQuantity,
                        ProductImageThumb = prod.ProductImageThumb,
                        ProductImage = prod.ProductImage,
                        ProductPriority = prod.ProductPriority,
                        ProductPriceEU = prod.ProductPrice.Where(p => p.Region == "Europe").Select(p => p.Price).FirstOrDefault(),
                        ProductPriceUS = prod.ProductPrice.Where(p => p.Region == "US&Oceania").Select(p => p.Price).FirstOrDefault(),
                        ProductSaleEU = prod.ProductPrice.Where(p => p.Region == "Europe").Select(p => p.ProductSale).FirstOrDefault(),
                        ProductSaleUS = prod.ProductPrice.Where(p => p.Region == "US&Oceania").Select(p => p.ProductSale).FirstOrDefault(),
                        Description = prod.ProductDescription.Description,
                        SubDescriptionTitle1 = prod.ProductDescription.SubDescriptionTitle1,
                        SubDescription1 = prod.ProductDescription.SubDescription1,
                        SubDescriptionTitle2 = prod.ProductDescription.SubDescriptionTitle2,
                        SubDescription2 = prod.ProductDescription.SubDescription2,
                        SubDescriptionTitle3 = prod.ProductDescription.SubDescriptionTitle3,
                        SubDescription3 = prod.ProductDescription.SubDescription3,
                        SubDescriptionTitle4 = prod.ProductDescription.SubDescriptionTitle4,
                        SubDescription4 = prod.ProductDescription.SubDescription4,
                        SubDescriptionTitle5 = prod.ProductDescription.SubDescriptionTitle5,
                        SubDescription5 = prod.ProductDescription.SubDescription5,
                    }));
                }
                else
                {
                    return(View("Save" + type, new ProductDetails
                    {
                        GamesList = new SelectList(EntityRepository.Games.Select(g => g.GameName), "Select Game"),
                        CategoriesList = new SelectList(EntityRepository.Games.Where(g => game == null || g.GameName == game).SelectMany(g => g.ProductCategory).Select(p => p.ProductCategoryName), "Select Category"),
                        MetaTagTitleList = new SelectList(EntityRepository.SEOs.Select(s => s.MetaTagTitle), "Select Meta tag title from List"),
                    }));
                }

            case "TemplateOptions":
                TemplateOptions templateOptions = EntityRepository.TemplateOptions.Where(p => p.OptionId == Id).FirstOrDefault();
                if (templateOptions != null)
                {
                    return(View("Save" + type, new TemplateOptionDetails
                    {
                        TempOptionId = templateOptions.OptionId,
                        TempOptionName = templateOptions.OptionName,
                        TempOptionType = templateOptions.OptionType,
                        TempOptionParamsDetailsCollection = TemplateOptionDetails.PopulateTempOptionParamsDetailsCollection(templateOptions)
                    }));
                }
                else
                {
                    return(View("Save" + type, new TemplateOptionDetails {
                    }));
                }

            case "ProductGame":
                ProductGame productGame = EntityRepository.Games.Where(p => p.ProductGameId == Id).FirstOrDefault();
                if (productGame != null)
                {
                    return(View("Save" + type, new ProductGameDetails
                    {
                        MetaTagTitleList = new SelectList(EntityRepository.SEOs.Select(s => s.MetaTagTitle), productGame.SEO?.MetaTagTitle ?? "Select Meta tag title from List"),
                        ProductGameId = productGame.ProductGameId,
                        GameName = productGame.GameName,
                        GameDescription = productGame.GameDescription,
                        GameShortUrl = productGame.GameShortUrl,
                        GameSeoId = productGame.GameSeoId
                    }));
                }
                else
                {
                    return(View("Save" + type, new ProductGameDetails
                    {
                        MetaTagTitleList = new SelectList(EntityRepository.SEOs.Select(s => s.MetaTagTitle), "Select Meta tag title from List"),
                    }));
                }

            case "HtmlBlocks":
                HtmlBlocks siteBlock = EntityRepository.HtmlBlocks.Where(p => p.SiteBlockId == Id).FirstOrDefault();
                if (siteBlock != null)
                {
                    return(View("Save" + type, new HtmlBlockDetails
                    {
                        SiteBlockId = siteBlock.SiteBlockId,
                        ParentTitle = siteBlock.ParentTitle,
                        ParentCSSClass = siteBlock.ParentCSSClass,
                        ChildCSSClass = siteBlock.ChildCSSClass,
                        SitePage = siteBlock.SitePage,
                        Order = siteBlock.Order,
                        HtmlBlockChildDetailsCollection = HtmlBlockDetails.PopulateHtmlBlockCollection(siteBlock)
                    }));
                }
                else
                {
                    var result = new HtmlBlockDetails {
                        SiteBlockId = Guid.NewGuid(), HtmlBlockChildDetailsCollection = new List <HtmlBlockDetails.HtmlBlockChildrenDetails>()
                    };
                    return(View("Save" + type, result));
                }

            case "SEO":
                SEO seo = EntityRepository.SEOs.Where(p => p.SEOId == Id).FirstOrDefault();
                if (seo != null)
                {
                    return(View("Save" + type, new SeoDetails
                    {
                        SEOId = seo.SEOId,
                        MetaTagTitle = seo.MetaTagTitle,
                        MetaTagDescription = seo.MetaTagDescription,
                        MetaTagKeyWords = seo.MetaTagKeyWords,
                        SEOTags = seo.SEOTags,
                        CustomTitle1 = seo.CustomTitle1,
                        CustomTitle2 = seo.CustomTitle2,
                        CustomImageTitle = seo.CustomImageTitle,
                        CustomImageAlt = seo.CustomImageAlt,
                        MetaRobots = seo.MetaRobots,
                        UrlKeyWord = seo.UrlKeyWord,
                        SEOImage = seo.SEOImage
                    }));
                }
                else
                {
                    return(View("Save" + type, new SeoDetails {
                    }));
                }

            case "Users":
                Users user = EntityRepository.Users.Where(p => p.UserId == Id).FirstOrDefault();
                if (user != null)
                {
                    return(View("Save" + type, new UsersDetails
                    {
                        UserId = user.UserId,
                        UserName = user.UserName,
                        UserPassword = user.UserPassword,
                        Email = user.Email,
                        RoleId = user.RoleId
                    }));
                }
                else
                {
                    return(View("Save" + type, new UsersDetails {
                    }));
                }

            case "Ranks":
                Ranks ranks = EntityRepository.Ranks.Where(p => p.RankId == Id).FirstOrDefault();
                if (ranks != null)
                {
                    return(View("Save" + type, new RankDetails
                    {
                        RankId = ranks.RankId,
                        Name = ranks.Name,
                        Sale = ranks.Sale
                    }));
                }
                else
                {
                    return(View("Save" + type, new RankDetails {
                    }));
                }

            case "Customers":
                Customers customers = EntityRepository.Customers.Where(p => p.CustomerId == Id).FirstOrDefault();
                if (customers != null)
                {
                    return(View("Save" + type, new CustomersDetails
                    {
                        CustomerId = customers.CustomerId,
                        Name = customers.Name,
                        Password = customers.Password,
                        Email = customers.Email,
                        CarryCoinsValue = customers.CarryCoinsValue
                    }));
                }
                else
                {
                    return(View("Save" + type, new CustomersDetails {
                    }));
                }

            case "Roles":
                Roles roles = EntityRepository.Roles.Where(p => p.RoleId == Id).FirstOrDefault();
                if (roles != null)
                {
                    return(View("Save" + type, new RolesDetails
                    {
                        RoleId = roles.RoleId,
                        RoleName = roles.RoleName
                    }));
                }
                else
                {
                    return(View("Save" + type, new RolesDetails {
                    }));
                }

            case "Article":
                Article article = EntityRepository.Articles.Where(p => p.ArticleId == Id).FirstOrDefault();
                if (article != null)
                {
                    return(View("Save" + type, new ArticleDetails
                    {
                        MetaTagTitleList = new SelectList(EntityRepository.SEOs.Select(s => s.MetaTagTitle), article.SEO?.MetaTagTitle ?? "Select Meta tag title from List"),
                        GamesList = new SelectList(EntityRepository.Games.Select(g => g.GameName), article?.ProductGame.GameName ?? "Select Game"),
                        ArticleId = article.ArticleId,
                        Title = article.Title,
                        ShortDescription = article.ShortDescription,
                        Description = article.Description,
                        ReadTime = article.ReadTime,
                        Tags = article.Tags,
                        ImagePath = article.ImagePath,
                        Enabled = article.Enabled,
                        Rating = article.Rating,
                        ArticleCreateTime = article.ArticleCreateTime,
                        ArticleUpdateTime = article.ArticleUpdateTime,
                        ArticlePostTime = article.ArticlePostTime
                    }));
                }
                else
                {
                    return(View("Save" + type, new ArticleDetails
                    {
                        MetaTagTitleList = new SelectList(EntityRepository.SEOs.Select(s => s.MetaTagTitle), "Select Meta tag title from List"),
                        GamesList = new SelectList(EntityRepository.Games.Select(g => g.GameName), "Select Game")
                    }));
                }

            case "Orders":
                Orders orders = EntityRepository.Orders.Where(p => p.OrderId == Id).FirstOrDefault();
                if (orders != null)
                {
                    return(View("Save" + type, new OrderDetails
                    {
                        OrderId = orders.OrderId,
                        Discord = orders.Discord,
                        Comments = orders.Comment,
                        Email = orders.Email,
                        PaymentMethod = orders.PaymentMethod,
                        PaymentCode = orders.PaymentCode,
                        Total = orders.Total,
                        OrderStatus = orders.OrderStatus,
                        Currency = orders.Currency,
                        CustomerIP = orders.CustomerIP,
                        UserAgent = orders.UserAgent,
                        OrderCreateTime = orders.OrderCreateTime,
                        OrderUpdateTime = orders.OrderUpdateTime,
                        EmailSended = orders.EmailSended,
                        EmailSendTime = orders.EmailSendTime,
                        CarryCoinsSpent = orders.CarryCoinsSpent,
                        CarryCoinsCollected = orders.CarryCoinsCollected,
                        ShlCharacterName = orders.OrderCustomFields.ShlCharacterName,
                        ShlRealmName = orders.OrderCustomFields.ShlRealmName,
                        ShlFaction = orders.OrderCustomFields.ShlFaction,
                        ShlRegion = orders.OrderCustomFields.ShlRegion,
                        ShlBattleTag = orders.OrderCustomFields.ShlBattleTag,
                        Poe_CharacterName = orders.OrderCustomFields.PoeCharacterName,
                        Poe_AccountName = orders.OrderCustomFields.PoeAccountName,
                        Classic_CharacterName = orders.OrderCustomFields.ClassicCharacterName,
                        Classic_RealmName = orders.OrderCustomFields.ClassicRealmName,
                        Classic_Faction = orders.OrderCustomFields.ClassicFaction,
                        Classic_Region = orders.OrderCustomFields.ClassicRegion,
                        Classic_BattleTag = orders.OrderCustomFields.ClassicBattleTag
                    }));
                }
                else
                {
                    return(View("Save" + type, new OrderDetails {
                    }));
                }

            case "ProductCategory":
                ProductCategory productCategory = EntityRepository.ProductCategory.Where(p => p.ProductCategoryId == Id).FirstOrDefault();
                if (productCategory != null)
                {
                    return(View("Save" + type, new ProductCategoryDetails
                    {
                        ProductCategoryId = productCategory.ProductCategoryId,
                        MetaTagTitleList = new SelectList(EntityRepository.SEOs.Select(s => s.MetaTagTitle), productCategory.SEO?.MetaTagTitle ?? "Select Meta tag title from List"),
                        GamesList = new SelectList(EntityRepository.Games.Select(g => g.GameName), productCategory?.ProductGame.GameName ?? "Select Game"),
                        ProductCategoryName = productCategory.ProductCategoryName,
                        CategoryDescription = productCategory.CategoryDescription
                    }));
                }
                else
                {
                    return(View("Save" + type, new ProductCategoryDetails {
                        MetaTagTitleList = new SelectList(EntityRepository.SEOs.Select(s => s.MetaTagTitle), "Select Meta tag title from List"),
                        GamesList = new SelectList(EntityRepository.Games.Select(g => g.GameName), "Select Game")
                    }));
                }

            case "ProductSubCategory":
                ProductSubCategory productSubCategory = EntityRepository.ProductSubCategories.Where(p => p.ProductSubCategoryId == Id).FirstOrDefault();
                if (productSubCategory != null)
                {
                    return(View("Save" + type, new ProductSubCategoryDetails
                    {
                        ProductSubCategoryId = productSubCategory.ProductSubCategoryId,
                        ProductCategoryName = productSubCategory.ProductCategoryName,
                        CategoryDescription = productSubCategory.CategoryDescription,
                        MetaTagTitleList = new SelectList(EntityRepository.SEOs.Select(s => s.MetaTagTitle), productSubCategory.SEO?.MetaTagTitle ?? "Select Meta tag title from List"),
                        CategoryList = new SelectList(EntityRepository.ProductCategory.Select(s => s.ProductCategoryName), productSubCategory.ProductCategory?.ProductCategoryName ?? "Select Product Category from List")
                    }));
                }
                else
                {
                    return(View("Save" + type, new ProductSubCategoryDetails
                    {
                        MetaTagTitleList = new SelectList(EntityRepository.SEOs.Select(s => s.MetaTagTitle), "Select Meta tag title from List"),
                        CategoryList = new SelectList(EntityRepository.ProductCategory.Select(s => s.ProductCategoryName), "Select Product Category from List")
                    }));
                }

            default: return(View("Admin"));
            }
        }
 public SettingsFileReference()
 {
     IncludeInTestHarness = true;
     TemplateOptions = new TemplateOptions();
 }
Example #45
0
 /// <summary>Modifies a working XMP object according to a template object.</summary>
 /// <remarks>
 /// The XMP template can be used to add, replace or delete properties from
 /// the working XMP object. The actions that you specify determine how the
 /// template is applied.Each action can be applied individually or combined;
 /// if you do not specify any actions, the properties and values in the
 /// working XMP object do not change.
 /// <para />
 /// These actions are available:
 /// <list type="bullet">
 /// <item>Clear <c>CLEAR_UNNAMED_PROPERTIES</c> : Deletes top-level
 /// properties.Any top-level property that is present in the template(even
 /// with empty value) is retained.All other top-level properties in the
 /// working object are deleted</item>
 /// <item>Add <c>ADD_NEW_PROPERTIES</c>: Adds new properties to the
 /// working object if the template properties have values.See additional
 /// detail below.</item>
 /// <item>Replace <c>REPLACE_EXISTING_PROPERTIES</c>: Replaces the
 /// values of existing top-level properties in the working XMP if the value
 /// forms match those in the template. Properties with empty values in the
 /// template are ignored. If combined with Clear or Add actions, those take
 /// precedence; values are cleared or added, rather than replaced.</item>
 /// <item>Replace/Delete empty <c>REPLACE_WITH_DELETE_EMPTY</c>:
 /// Replaces values in the same way as the simple Replace action, and also
 /// deletes properties if the value in the template is empty.If combined
 /// with Clear or Add actions, those take precedence; values are cleared or
 /// added, rather than replaced.</item>
 /// <item>Include internal <c>INCLUDE_INTERNAL_PROPERTIES</c>: Performs
 /// specified action on internal properties as well as external properties.
 /// By default, internal properties are ignored for all actions.</item>
 /// </list>
 /// <para />
 /// The Add behavior depends on the type of property:
 /// <list type="bullet">
 /// <item>If a top-level property is not in the working XMP, and has a value in
 /// the template, the property and value are added.Empty properties are not
 /// added.</item>
 /// <item>If a property is in both the working XMP and template, the value
 /// forms must match, otherwise the template is ignored for that property.</item>
 /// <item>If a struct is present in both the working XMP and template, the
 /// individual fields of the template struct are added as appropriate; that
 /// is, the logic is recursively applied to the fields.Struct values are
 /// equivalent if they have the same fields with equivalent values.</item>
 /// <item>If an array is present in both the working XMP and template, items
 /// from the template are added if the value forms match. Array values match
 /// if they have sets of equivalent items, regardless of order.</item>
 /// <item>Alt-text arrays use the \c xml:lang qualifier as a key, adding languages that are missing.</item>
 /// </list>
 /// <para />
 /// Array item checking is n-squared; this can be time-intensive if the
 /// Replace option is not specified.Each source item is checked to see if it
 /// already exists in the destination, without regard to order or duplicates.
 /// Simple items are compared by value and<code> xml:lang</code> qualifier;
 /// other qualifiers are ignored.Structs are recursively compared by field
 /// names, without regard to field order.Arrays are compared by recursively
 /// comparing all items.
 /// </remarks>
 /// <param name="workingXMP">The destination XMP object.</param>
 /// <param name="templateXMP">The template to apply to the destination XMP object.</param>
 /// <param name="options">Option flags to control the copying. If none are specified,
 /// the properties and values in the working XMP do not change. A logical OR of these bit-flag constants:
 /// <list type="bullet">
 /// <item><c>CLEAR_UNNAMED_PROPERTIES</c> Delete anything that is not in the template</item>
 /// <item><c>ADD_NEW_PROPERTIES</c> Add properties; see detailed description.</item>
 /// <item><c>REPLACE_EXISTING_PROPERTIES</c> Replace the values of existing properties.</item>
 /// <item><c>REPLACE_WITH_DELETE_EMPTY</c> Replace the values of existing properties and delete properties if the new value is empty.</item>
 /// <item><c>INCLUDE_INTERNAL_PROPERTIES</c> Operate on internal properties as well as external properties.</item>
 /// </list>
 /// </param>
 /// <exception cref="XmpException">Forwards the Exceptions from the metadata processing</exception>
 static public void ApplyTemplate(IXmpMeta workingXMP, IXmpMeta templateXMP, TemplateOptions options)
 {
     Impl.XmpUtils.ApplyTemplate(workingXMP, templateXMP, options);
 }
Example #46
0
 public NimbusTemplate(StackData data, StackFlairOptions flairOptions)
     : base(data, flairOptions)
 {
     TemplateOptions = new TemplateOptions() {
         GravatarSize = 48,
         Spacing = 5,
         BorderColor = Color.FromArgb(181, 190, 189),
         BackgroundColor = Color.FromArgb(214, 223, 222),
         BorderWidth = 1,
         BronzeColor = Color.FromArgb(214, 113, 16),
         FontFamily = "Helvetica",
         GoldColor = Color.FromArgb(221, 153, 34),
         MiddleLineSize = 9,
         ModColor = Color.FromArgb(74, 56, 66),
         NameColor = Color.FromArgb(74, 56, 66),
         RepColor = Color.FromArgb(74, 56, 66),
         SilverColor = Color.FromArgb(119, 119, 119),
         TopLineSize = 10
     };
 }
Example #47
0
        protected ScriptTemplateBase(ILoggerFactory loggerFactory, GeneratorOptions generatorOptions, TemplateOptions templateOptions)
        {
            Logger = loggerFactory.CreateLogger(this.GetType());

            TemplateOptions  = templateOptions;
            GeneratorOptions = generatorOptions;
        }
 protected ScriptVariablesBase(GeneratorOptions generatorOptions, TemplateOptions templateOptions)
 {
     GeneratorOptions = generatorOptions;
     TemplateOptions  = templateOptions;
     CodeBuilder      = new IndentedStringBuilder();
 }
Example #49
0
 /// <summary>
 /// 构造一个 <see cref="AbstractTemplateKeyFinder"/>。
 /// </summary>
 /// <param name="options">给定的 <see cref="TemplateOptions"/>。</param>
 protected AbstractTemplateKeyFinder(TemplateOptions options)
 {
     Options = options;
     Options.PopulateKeysAction = Populate;
 }
Example #50
0
 public override CodeDomTemplateTypeBuilder CreateTemplateTypeBuilder(TemplateOptions options)
 {
     return new CSharp2TemplateTypeBuilder( options);
 }
 public EntityScriptVariables(Entity entity, GeneratorOptions generatorOptions, TemplateOptions templateOptions)
     : base(generatorOptions, templateOptions)
 {
     Entity = entity;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="DeleteTemplateRequest"/> class.
 /// </summary>
 /// <param name="options">Delete template options.</param>
 public DeleteTemplateRequest(TemplateOptions options)
 {
     this.options = options;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="GetTemplateRequest"/> class.
 /// </summary>
 /// <param name="options">Retrieve template options.</param>
 public GetTemplateRequest(TemplateOptions options)
 {
     this.options = options;
 }
 public FSharpTemplateTypeBuilder(TemplateOptions options)
     : base(options)
 {
     ProviderOptions.Add( "CompilerVersion", "v2.0" );
 }
Example #55
0
 static async ValueTask <FluidValue> Awaited(Task <IShape> task, TemplateOptions options)
 {
     return(FluidValue.Create(await task, options));
 }