Example #1
0
        public TemplateMap GetTemplates()
        {
            TemplateMap templates = null;

            if (_templates == null)
            {
                lock (_templateLock)
                    if (_templates == null)
                    {
                        string path = Path.Combine(
                            Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
                            "VisualStudio.FastNewFile",
                            "Patterns.json");
                        if ((templates = this.LoadFromFile(path)) == null)
                        {
                            templates = new TemplateMap();
                            templates.LoadDefaultMappings();
                            this.WriteToFile(templates, path);
                        }
                        _templates = templates;
                    }
            }
            return(_templates);
        }
 private static TemplateMap GetTemplateMap()
 {
     TemplateMap templates = null;
     if (_templates == null)
         lock (_templateLock)
             if (_templates == null)
             {
                 string path = Path.Combine(
                                 Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
                                 "VisualStudio.AddAnyFile",
                                 "Patterns.json");
                 if ((templates = TemplateMap.LoadFromFile(path)) == null)
                 {
                     templates = new TemplateMap();
                     templates.LoadDefaultMappings();
                     TemplateMap.WriteToFile(templates, path);
                 }
                 _templates = templates;
             }
     return _templates;
 }