public TemplatePersistor(ITemplateContainer container, string path) { LOGGER.Debug($"Creating template persistor for path '{path}'"); Path = path; Container = container; }
/// <summary> /// Initializes a new instance of the <see cref="ParserOptions" /> class. /// </summary> /// <param name="template">The template.</param> /// <param name="sourceStream">The source stream.</param> /// <param name="encoding">The encoding.</param> /// <param name="disableContentEscaping">if set to <c>true</c> [disable content escaping].</param> public ParserOptions(ITemplateContainer template, Func <Stream> sourceStream, Encoding encoding, bool disableContentEscaping = false) : this(template, sourceStream, encoding, 0, disableContentEscaping) { }
public static void AssertDocumentItemIsSameAsTemplate(ITemplateContainer textContainer, IDocumentItem documentItem, ParserOptions options) { var text = ((textContainer as StringTemplateContainer).Template as StringTemplateResource).ToString(); AssertDocumentItemIsSameAsTemplate(text, documentItem, options); }
/// <summary> /// Runs the Tokenizer and returns all errors in the template if present /// </summary> /// <param name="template"></param> /// <returns></returns> public static async Task <IEnumerable <IMorestachioError> > Validate(ITemplateContainer template) { var options = new ParserOptions(template); var tokenzierContext = new TokenzierContext(new List <int>(), null); await Tokenizer.Tokenize(options, tokenzierContext); return(tokenzierContext.Errors); }
/// <summary> /// Initializes a new instance of the <see cref="ParserOptions" /> class. /// </summary> /// <param name="template">The template.</param> /// <param name="sourceStream">The source stream.</param> /// <param name="encoding">The encoding.</param> /// <param name="maxSize">The maximum size.</param> /// <param name="disableContentEscaping">if set to <c>true</c> [disable content escaping].</param> public ParserOptions(ITemplateContainer template, Func <Stream> sourceStream, Encoding encoding, long maxSize, bool disableContentEscaping = false) : this(template, sourceStream, encoding) { MaxSize = maxSize; DisableContentEscaping = disableContentEscaping; }
public PathForm(IPathContainer pathContainer, ITemplateContainer templateContainer, IYoutubeJobContainer queueContainer, IYoutubeJobContainer archiveContainer, IYoutubeAccountContainer accountContainer) { LOGGER.Info($"Initializing new instance of PathForm"); InitializeComponent(); this.pathContainer = pathContainer; this.templateContainer = templateContainer; this.queueContainer = queueContainer; this.archiveContainer = archiveContainer; this.accountContainer = accountContainer; }
public async Task <T> MatchAsync(Uri @namespace, IRequest request, CancellationToken token) { ITemplateContainer <T> templateContainer = await _templateStore.GetTemplateContainerAsync(@namespace, token); if (templateContainer?.Templates?.Any() ?? false) { var result = GetClosestMatchingTemplate(templateContainer.Templates, request); if (result == null) { return(default(T)); } return(result.Template); } return(default(T)); }
/// <summary> /// Initializes a new instance of the <see cref="ParserOptions" /> class. /// </summary> /// <param name="template">The template.</param> /// <param name="sourceStream">The source stream.</param> /// <param name="encoding">The encoding.</param> public ParserOptions(ITemplateContainer template, Func <ParserOptions, IByteCounterStream> sourceStream, Encoding encoding) { Template = template ?? new StringTemplateContainer(""); StreamFactory = new ByteCounterFactory(sourceStream); Encoding = encoding ?? Encoding.UTF8; _formatters = new MorestachioFormatterService(); Null = string.Empty; MaxSize = 0; DisableContentEscaping = false; Timeout = TimeSpan.Zero; PartialStackSize = 255; _customDocumentItemProviders = new CustomDocumentList(); CultureInfo = CultureInfo.CurrentCulture; UnmatchedTagBehavior = UnmatchedTagBehavior.ThrowError | UnmatchedTagBehavior.LogWarning; }
private void RecreateSaved() { LOGGER.Debug($"Recreating cache of saved tempaltes"); Saved = new TemplateContainer(); foreach (var template in Container.RegisteredTemplates) { LOGGER.Debug($"Recreating cache for template '{template.Name}'"); var newTemplate = new Template(template.Id, template.Name, template.DefaultLanguage, template.Category, template.PublishTimes, template.PlannedVideos) { AutoLevels = template.AutoLevels, Description = template.Description, IsEmbeddable = template.IsEmbeddable, License = template.License, NotifySubscribers = template.NotifySubscribers, PlannedVideos = template.PlannedVideos, Privacy = template.Privacy, PublicStatsViewable = template.PublicStatsViewable, PublishTimes = template.PublishTimes, ShouldPublishAt = template.ShouldPublishAt, Stabilize = template.Stabilize, Tags = template.Tags, ThumbnailPath = template.ThumbnailPath, Title = template.Title, CSharpCleanUpScript = template.CSharpCleanUpScript, CSharpPreparationScript = template.CSharpPreparationScript, EnableExpertMode = template.EnableExpertMode, MailTo = template.MailTo, NewVideoDesktopNotification = template.NewVideoDesktopNotification, NewVideoMailNotification = template.NewVideoMailNotification, NextUploadSuggestion = template.NextUploadSuggestion, ReferencedAssembliesText = template.ReferencedAssembliesText, UploadFailedDesktopNotification = template.UploadFailedDesktopNotification, UploadFailedMailNotification = template.UploadFailedMailNotification, UploadFinishedDesktopNotification = template.UploadFinishedDesktopNotification, UploadFinishedMailNotification = template.UploadFinishedMailNotification, UploadStartedDesktopNotification = template.UploadStartedDesktopNotification, UploadStartedMailNotification = template.UploadStartedMailNotification }; Saved.RegisterTemplate(newTemplate); } }
public ChooseStartTimesForm(IPathContainer pathContainer, ITemplateContainer templateContainer) { LOGGER.Info($"Initializing new instance of ChooseStartTimesForm"); InitializeComponent(); this.pathContainer = pathContainer; this.templateContainer = templateContainer; foreach (var path in pathContainer.ActivePaths) { LOGGER.Info($"Adding active path '{path}'"); publishSettings.Add(new ObservationConfiguration(path, templateContainer.RegisteredTemplates.FirstOrDefault(t => t.Id == path.SelectedTemplateId))); } chooseCustomTimesControl.AddRange(publishSettings); LOGGER.Debug($"Should publish controls be visible: {publishSettings.Any(i => i.Template.ShouldPublishAt)}"); globalSettingsControl.SetPublishControlsVisibility(publishSettings.Any(i => i.Template.ShouldPublishAt), false); }
public void Setup() { TemplateDalContainer = TemplateFactory.CreateTemplateDalContainer(); TemplateDalLogic = TemplateFactory.CreateTemplateDALLogic(); TemplateLogic = new TemplateLogic(); }
/// <summary> /// Initializes a new instance of the <see cref="ParserOptions" /> class. /// </summary> /// <param name="template">The template.</param> /// <param name="sourceStream">The source stream.</param> /// <param name="encoding">The encoding.</param> public ParserOptions(ITemplateContainer template, Func <Stream> sourceStream, Encoding encoding) : this(template, ByteCounterFactory.GetDefaultByteCounter(sourceStream), encoding) { }
/// <summary> /// ctor /// </summary> /// <param name="template"></param> /// <param name="sourceStream">The factory that is used for each template generation</param> public ParserOptions(ITemplateContainer template, Func <Stream> sourceStream) : this(template, sourceStream, null) { }
/// <summary> /// ctor /// </summary> /// <param name="template"></param> public ParserOptions(ITemplateContainer template) : this(template, (Func <Stream>)null) { }