Skip to content

Commit 74a65c7

Browse files
CopilotJusterZhu
andcommitted
Final polish: improve JSON settings, formatting, and success message UX
Co-authored-by: JusterZhu <11714536+JusterZhu@users.noreply.github.com>
1 parent 2f581af commit 74a65c7

1 file changed

Lines changed: 13 additions & 4 deletions

File tree

src/ViewModels/ExtensionViewModel.cs

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -273,21 +273,30 @@ await ZipUtility.CompressDirectoryAsync(
273273
// Create manifest.json with all ExtensionDTO fields
274274
var platformValue = ConfigModel.Platform?.Value ?? 0;
275275
var targetPlatform = MapPlatformValue(platformValue);
276-
ConfigModel.Platform = new PlatformModel{ DisplayName = targetPlatform.ToString(), Value = platformValue };
276+
ConfigModel.Platform = new PlatformModel { DisplayName = targetPlatform.ToString(), Value = platformValue };
277277

278278
// Get file info for the zip
279279
var fileInfo = new FileInfo(zipFilePath);
280280
ConfigModel.FileSize = fileInfo.Length;
281281

282-
// Serialize manifest to JSON
283-
var manifestJson = JsonConvert.SerializeObject(ConfigModel);
282+
// Serialize manifest to JSON with explicit settings
283+
var jsonSettings = new JsonSerializerSettings
284+
{
285+
NullValueHandling = NullValueHandling.Ignore
286+
};
287+
var manifestJson = JsonConvert.SerializeObject(ConfigModel, jsonSettings);
284288
if (!string.IsNullOrEmpty(manifestJson))
285289
{
286290
// Add manifest.json to the zip file
287291
await ZipUtility.AddFileToZipAsync(zipFilePath, "manifest.json", manifestJson);
288292
}
289293

290-
await MessageBox.ShowAsync($"Extension package created successfully at:\n{zipFilePath}", "Success", Buttons.OK);
294+
var fileName = Path.GetFileName(zipFilePath);
295+
var directory = Path.GetDirectoryName(zipFilePath);
296+
await MessageBox.ShowAsync(
297+
$"Extension package created successfully:\n\nFile: {fileName}\nLocation: {directory}",
298+
"Success",
299+
Buttons.OK);
291300
}
292301
catch (UnauthorizedAccessException ex)
293302
{

0 commit comments

Comments
 (0)