Exemplo n.º 1
0
        public JObject ToJson()
        {
            var o = new JObject();

            AddProperty(o, "name", Name);
            AddProperty(o, "publisher", Publisher);
            AddProperty(o, "displayName", DisplayName);
            AddProperty(o, "description", Description);
            AddProperty(o, "icon", Icon);
            AddProperty(o, "version", Version);
            AddProperty(o, "author", Author);
            AddProperty(o, "license", License);
            AddProperty(o, "homepage", Homepage);

            AddProperty(o, Repository?.ToJProperty());
            AddProperty(o, Bugs?.ToJProperty());

            AddList(o, "categories", Categories);
            AddList(o, "keywords", Keywords);

            if (!string.IsNullOrEmpty(EngineVersion))
            {
                o["engines"] = new JObject(new JProperty("vscode", EngineVersion));
            }

            if (Snippets.Count > 0)
            {
                var snippets = new JArray();

                foreach (SnippetInfo snippetInfo in Snippets)
                {
                    snippets.Add(
                        new JObject(
                            new JProperty("language", snippetInfo.Language),
                            new JProperty("path", snippetInfo.Path)));
                }

                o["contributes"] = new JObject()
                {
                    ["snippets"] = snippets
                };
            }

            return(o);
        }