-
Notifications
You must be signed in to change notification settings - Fork 74
Expand file tree
/
Copy pathExtensionDescriptor.cs
More file actions
124 lines (108 loc) · 4.92 KB
/
Copy pathExtensionDescriptor.cs
File metadata and controls
124 lines (108 loc) · 4.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
using System;
using System.Collections.Generic;
using System.Text.Json.Serialization;
namespace GeneralUpdate.Extension.Metadata
{
/// <summary>
/// Represents the comprehensive metadata descriptor for an extension package.
/// Follows VS Code extension manifest structure (package.json) standards.
/// Provides all necessary information for discovery, compatibility checking, and installation.
/// </summary>
public class ExtensionDescriptor
{
/// <summary>
/// Gets or sets the unique extension identifier (lowercase, no spaces).
/// This is the unique identifier used in the marketplace and follows VS Code naming convention.
/// Example: "my-extension" or "publisher.extension-name"
/// </summary>
[JsonPropertyName("name")]
public string Name { get; set; } = string.Empty;
/// <summary>
/// Gets or sets the human-readable display name of the extension.
/// This is shown in the UI and can contain spaces and mixed case.
/// Example: "My Extension" or "Awesome Extension Pack"
/// </summary>
[JsonPropertyName("displayName")]
public string DisplayName { get; set; } = string.Empty;
/// <summary>
/// Gets or sets the semantic version string of the extension.
/// </summary>
[JsonPropertyName("version")]
public string Version { get; set; } = string.Empty;
/// <summary>
/// Gets or sets a brief description of the extension's functionality.
/// </summary>
[JsonPropertyName("description")]
public string? Description { get; set; }
/// <summary>
/// Gets or sets the publisher identifier (follows VS Code convention).
/// The publisher is the organization or individual that published the extension.
/// </summary>
[JsonPropertyName("publisher")]
public string? Publisher { get; set; }
/// <summary>
/// Gets or sets the license identifier (e.g., "MIT", "Apache-2.0").
/// </summary>
[JsonPropertyName("license")]
public string? License { get; set; }
/// <summary>
/// Gets or sets the extension categories (follows VS Code convention).
/// Examples: "Programming Languages", "Debuggers", "Formatters", "Linters", etc.
/// </summary>
[JsonPropertyName("categories")]
public List<string>? Categories { get; set; }
/// <summary>
/// Gets or sets the platforms supported by this extension.
/// Uses flags to allow multiple platform targets.
/// </summary>
[JsonPropertyName("supportedPlatforms")]
public TargetPlatform SupportedPlatforms { get; set; } = TargetPlatform.All;
/// <summary>
/// Gets or sets the version compatibility constraints for the host application.
/// Similar to VS Code's "engines" field, specifies which host versions are supported.
/// </summary>
[JsonPropertyName("engines")]
public VersionCompatibility Compatibility { get; set; } = new VersionCompatibility();
/// <summary>
/// Gets or sets the download URL for the extension package.
/// NOTE: This field is optional and primarily for backward compatibility.
/// The system constructs download URLs dynamically from the ServerUrl configured in ExtensionHostConfig.
/// Format: {ServerUrl}/Download/{ExtensionName}
/// </summary>
[JsonPropertyName("downloadUrl")]
public string? DownloadUrl { get; set; }
/// <summary>
/// Gets or sets the cryptographic hash for package integrity verification.
/// </summary>
[JsonPropertyName("hash")]
public string? PackageHash { get; set; }
/// <summary>
/// Gets or sets the package size in bytes.
/// </summary>
[JsonPropertyName("size")]
public long PackageSize { get; set; }
/// <summary>
/// Gets or sets the release date and time for this version.
/// </summary>
[JsonPropertyName("releaseDate")]
public DateTime? ReleaseDate { get; set; }
/// <summary>
/// Gets or sets the list of extension IDs that this extension depends on.
/// </summary>
[JsonPropertyName("dependencies")]
public List<string>? Dependencies { get; set; }
/// <summary>
/// Gets or sets custom properties for extension-specific metadata.
/// </summary>
[JsonPropertyName("properties")]
public Dictionary<string, string>? CustomProperties { get; set; }
/// <summary>
/// Parses the version string and returns a Version object.
/// </summary>
/// <returns>A Version object if parsing succeeds; otherwise, null.</returns>
public Version? GetVersionObject()
{
return System.Version.TryParse(Version, out var version) ? version : null;
}
}
}