private static void LoadLiterals(LiteralElement[] elements, Snippet snippet) { foreach (LiteralElement element in elements) { var literal = new Literal(element.ID ?? string.Empty); literal.DefaultValue = element.Default; literal.IsEditable = element.Editable; literal.Function = element.Function; literal.ToolTip = element.ToolTip; snippet.Literals.Add(literal); } }
private static IEnumerable<LiteralElement> CreateLiteralElements(SerializationContext context) { foreach (Literal literal in context.Snippet.Literals.Where(f => string.IsNullOrEmpty(f.TypeName))) { var element = new LiteralElement(); if (!string.IsNullOrEmpty(literal.DefaultValue)) element.Default = literal.DefaultValue; if (!string.IsNullOrEmpty(literal.Identifier)) element.ID = literal.Identifier; element.Editable = literal.IsEditable; element.Function = literal.Function; element.ToolTip = literal.ToolTip; yield return element; } }