예제 #1
0
        public void AddNewTemplateEditor(string filename, bool current = true)
        {
            if (string.IsNullOrWhiteSpace(filename))
            {
                Log.Info("Attempted to add new editor without specifying a filename -- returning");
                return;
            }

            RazorTemplateViewModel loadedTemplate =
                Templates
                .Where(x => !string.IsNullOrWhiteSpace(x.Filename))
                .SingleOrDefault(x => x.Filename.Equals(filename, StringComparison.OrdinalIgnoreCase));

            if (loadedTemplate != null)
            {
                if (current)
                {
                    CurrentTemplate = loadedTemplate;
                }

                return;
            }

            var document = _documentManager.Load(filename);

            document.Filename = filename;

            AddNewTemplateEditor(document, current);
        }
예제 #2
0
 private RazorDocument LoadDocument(string name)
 {
     using (var reader = GetResourceStream(name))
         return(_loader.Load(reader));
 }