From 15199b1c63d4c668609ab51db16b1a7efcb55e9e Mon Sep 17 00:00:00 2001 From: Paul Hebble Date: Fri, 2 Nov 2018 19:18:05 +0000 Subject: [PATCH 1/2] Set defaults for common registry properties --- Core/Types/CkanModule.cs | 7 +++++-- Core/Types/ModuleInstallDescriptor.cs | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/Core/Types/CkanModule.cs b/Core/Types/CkanModule.cs index dab4d4352f..44d0331b28 100644 --- a/Core/Types/CkanModule.cs +++ b/Core/Types/CkanModule.cs @@ -1,4 +1,5 @@ using System; +using System.ComponentModel; using System.Collections.Generic; using System.IO; using System.Linq; @@ -259,7 +260,8 @@ public class CkanModule : IEquatable [JsonProperty("download_hash", NullValueHandling = NullValueHandling.Ignore)] public DownloadHashesDescriptor download_hash; - [JsonProperty("download_content_type", NullValueHandling = NullValueHandling.Ignore)] + [JsonProperty("download_content_type", DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate)] + [DefaultValue("application/zip")] public string download_content_type; [JsonProperty("identifier", Required = Required.Always)] @@ -274,7 +276,8 @@ public class CkanModule : IEquatable [JsonProperty("ksp_version_min", NullValueHandling = NullValueHandling.Ignore)] public KspVersion ksp_version_min; - [JsonProperty("ksp_version_strict")] + [JsonProperty("ksp_version_strict", DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate)] + [DefaultValue(false)] public bool ksp_version_strict = false; [JsonProperty("license")] diff --git a/Core/Types/ModuleInstallDescriptor.cs b/Core/Types/ModuleInstallDescriptor.cs index 2d834d8d0a..7791b06975 100644 --- a/Core/Types/ModuleInstallDescriptor.cs +++ b/Core/Types/ModuleInstallDescriptor.cs @@ -1,4 +1,5 @@ using System; +using System.ComponentModel; using System.Collections.Generic; using System.Linq; using System.Runtime.Serialization; @@ -26,10 +27,12 @@ public class ModuleInstallDescriptor : ICloneable [JsonProperty("find_regexp", NullValueHandling = NullValueHandling.Ignore)] public string find_regexp; - [JsonProperty("find_matches_files")] + [JsonProperty("find_matches_files", DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate)] + [DefaultValue(false)] public bool find_matches_files; - [JsonProperty("install_to", Required = Required.Always)] + [JsonProperty("install_to", DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate)] + [DefaultValue("GameData")] public string install_to; [JsonProperty("as", NullValueHandling = NullValueHandling.Ignore)] From eed7b6bb8d47bb4f06df613211ecbf4980e62388 Mon Sep 17 00:00:00 2001 From: Paul Hebble Date: Sat, 3 Nov 2018 17:19:17 +0000 Subject: [PATCH 2/2] De-indent registry.json --- Core/Registry/RegistryManager.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Core/Registry/RegistryManager.cs b/Core/Registry/RegistryManager.cs index 6e70b867aa..32ddf6bbec 100644 --- a/Core/Registry/RegistryManager.cs +++ b/Core/Registry/RegistryManager.cs @@ -359,8 +359,7 @@ private string Serialize() using (JsonTextWriter writer = new JsonTextWriter(sw)) { writer.Formatting = Formatting.Indented; - writer.Indentation = 1; - writer.IndentChar = '\t'; + writer.Indentation = 0; JsonSerializer serializer = new JsonSerializer(); serializer.Serialize(writer, registry);