private Template DeserialiseTemplate(Guid guid) { var templateKey = SerialisationMetadata.FormatKey(SerialisationMetadata.FormatGuid(guid)); var templatePath = MakePath(RootPath, templateKey); var template = new Template { Guid = guid }; var index = GetIndexedValues <bool>(templatePath, "Applicability").First().Key; Enum.TryParse(index, out template.Type); if (template.Type != TemplateType.File) { template.Shortcut = GetValue <string>(templatePath, "Shortcut"); } if (!TryGetValue(templatePath, "Description", out string description)) { Console.WriteLine("Warning: Template {0} does not have a description.", template.Shortcut); } template.Description = description; template.Text = GetValue <string>(templatePath, "Text"); template.Image = TryGetValue(templatePath, "Image", (string)null); template.Reformat = TryGetValue(templatePath, "Reformat", true); template.ShortenQualifiedReferences = TryGetValue(templatePath, "ShortenQualifiedReferences", true); template.Scopes = DeserialiseScopes(templatePath); template.CustomProperties = DeserialiseCustomProperties(templatePath); template.Categories = DeserialiseCategories(templatePath); template.Fields = DeserialiseFields(templatePath); return(template); }
private Scope DeserialiseScope(IEnumerable <string> templatePath, Guid guid) { var scopePath = MakePath(templatePath, "Scope", SerialisationMetadata.FormatKey(SerialisationMetadata.FormatGuid(guid))); var scope = new Scope { Guid = guid, Type = GetValue <string>(scopePath, "Type"), Parameters = DeserialiseScopeParameters(scopePath) }; return(scope); }
public SettingsStore AddIndexedSettings(string name, Guid index) { return(AddIndexedSettings(name, SerialisationMetadata.FormatGuid(index))); }