Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Purge 6 MB of bloat from registry.json #2179

Merged
merged 1 commit into from
Nov 10, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions Core/Registry/InstalledModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ public class InstalledModuleFile
// TODO: This class should also record file paths as well.
// It's just sha1 now for registry compatibility.

[JsonProperty] private string sha1_sum;
[JsonProperty("sha1_sum", NullValueHandling = NullValueHandling.Ignore)]
private string sha1_sum;

public string Sha1
{
Expand Down Expand Up @@ -64,7 +65,7 @@ private static string Sha1Sum(string path)
/// <summary>
/// A simple class that represents an installed module. Includes the time of installation,
/// the module itself, and a list of files installed with it.
///
///
/// Primarily used by the Registry class.
/// </summary>

Expand All @@ -89,7 +90,7 @@ public class InstalledModule
// registry format compatibility.
[JsonProperty] private Dictionary<string, InstalledModuleFile> installed_files;

public IEnumerable<string> Files
public IEnumerable<string> Files
{
get { return installed_files.Keys; }
}
Expand Down Expand Up @@ -162,4 +163,4 @@ public void Renormalise(KSP ksp)

#endregion
}
}
}
39 changes: 22 additions & 17 deletions Core/Types/CkanModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,18 +72,23 @@ public string RequiredVersion

public class ResourcesDescriptor
{
[JsonProperty("repository", NullValueHandling = NullValueHandling.Ignore)]
[JsonConverter(typeof(JsonIgnoreBadUrlConverter))]
public Uri repository;

[JsonProperty("homepage", NullValueHandling = NullValueHandling.Ignore)]
[JsonConverter(typeof(JsonIgnoreBadUrlConverter))]
public Uri homepage;

[JsonProperty("bugtracker", NullValueHandling = NullValueHandling.Ignore)]
[JsonConverter(typeof(JsonIgnoreBadUrlConverter))]
public Uri bugtracker;

[JsonProperty("spacedock", NullValueHandling = NullValueHandling.Ignore)]
[JsonConverter(typeof(JsonOldResourceUrlConverter))]
public Uri spacedock;

[JsonProperty("curse", NullValueHandling = NullValueHandling.Ignore)]
[JsonConverter(typeof(JsonOldResourceUrlConverter))]
public Uri curse;
}
Expand Down Expand Up @@ -141,24 +146,24 @@ public class CkanModule : IEquatable<CkanModule>
[JsonProperty("abstract")]
public string @abstract;

[JsonProperty("description")]
[JsonProperty("description", NullValueHandling = NullValueHandling.Ignore)]
public string description;

// Package type: in spec v1.6 can be either "package" or "metapackage"
[JsonProperty("kind")]
[JsonProperty("kind", NullValueHandling = NullValueHandling.Ignore)]
public string kind;

[JsonProperty("author")]
[JsonProperty("author", NullValueHandling = NullValueHandling.Ignore)]
[JsonConverter(typeof(JsonSingleOrArrayConverter<string>))]
public List<string> author;

[JsonProperty("comment")]
[JsonProperty("comment", NullValueHandling = NullValueHandling.Ignore)]
public string comment;

[JsonProperty("conflicts")]
[JsonProperty("conflicts", NullValueHandling = NullValueHandling.Ignore)]
public List<RelationshipDescriptor> conflicts;

[JsonProperty("depends")]
[JsonProperty("depends", NullValueHandling = NullValueHandling.Ignore)]
public List<RelationshipDescriptor> depends;

[JsonProperty("download")]
Expand All @@ -167,19 +172,19 @@ public class CkanModule : IEquatable<CkanModule>
[JsonProperty("download_size")]
public long download_size;

[JsonProperty("download_hash")]
[JsonProperty("download_hash", NullValueHandling = NullValueHandling.Ignore)]
public DownloadHashesDescriptor download_hash;

[JsonProperty("identifier", Required = Required.Always)]
public string identifier;

[JsonProperty("ksp_version")]
[JsonProperty("ksp_version", NullValueHandling = NullValueHandling.Ignore)]
public KspVersion ksp_version;

[JsonProperty("ksp_version_max")]
[JsonProperty("ksp_version_max", NullValueHandling = NullValueHandling.Ignore)]
public KspVersion ksp_version_max;

[JsonProperty("ksp_version_min")]
[JsonProperty("ksp_version_min", NullValueHandling = NullValueHandling.Ignore)]
public KspVersion ksp_version_min;

[JsonProperty("ksp_version_strict")]
Expand All @@ -192,28 +197,28 @@ public class CkanModule : IEquatable<CkanModule>
[JsonProperty("name")]
public string name;

[JsonProperty("provides")]
[JsonProperty("provides", NullValueHandling = NullValueHandling.Ignore)]
public List<string> provides;

[JsonProperty("recommends")]
[JsonProperty("recommends", NullValueHandling = NullValueHandling.Ignore)]
public List<RelationshipDescriptor> recommends;

[JsonProperty("release_status")]
[JsonProperty("release_status", NullValueHandling = NullValueHandling.Ignore)]
public ReleaseStatus release_status;

[JsonProperty("resources")]
[JsonProperty("resources", NullValueHandling = NullValueHandling.Ignore)]
public ResourcesDescriptor resources;

[JsonProperty("suggests")]
[JsonProperty("suggests", NullValueHandling = NullValueHandling.Ignore)]
public List<RelationshipDescriptor> suggests;

[JsonProperty("version", Required = Required.Always)]
public Version version;

[JsonProperty("supports")]
[JsonProperty("supports", NullValueHandling = NullValueHandling.Ignore)]
public List<RelationshipDescriptor> supports;

[JsonProperty("install")]
[JsonProperty("install", NullValueHandling = NullValueHandling.Ignore)]
public ModuleInstallDescriptor[] install;

// Used to see if we're compatible with a given game/KSP version or not.
Expand Down
16 changes: 8 additions & 8 deletions Core/Types/ModuleInstallDescriptor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ public class ModuleInstallDescriptor : ICloneable
#region Properties

// Either file, find, or find_regexp is required, we check this manually at deserialise.
[JsonProperty("file")]
[JsonProperty("file", NullValueHandling = NullValueHandling.Ignore)]
public string file;

[JsonProperty("find")]
[JsonProperty("find", NullValueHandling = NullValueHandling.Ignore)]
public string find;

[JsonProperty("find_regexp")]
[JsonProperty("find_regexp", NullValueHandling = NullValueHandling.Ignore)]
public string find_regexp;

[JsonProperty("find_matches_files")]
Expand All @@ -32,22 +32,22 @@ public class ModuleInstallDescriptor : ICloneable
[JsonProperty("install_to", Required = Required.Always)]
public string install_to;

[JsonProperty("as")]
[JsonProperty("as", NullValueHandling = NullValueHandling.Ignore)]
public string @as;

[JsonProperty("filter")]
[JsonProperty("filter", NullValueHandling = NullValueHandling.Ignore)]
[JsonConverter(typeof(JsonSingleOrArrayConverter<string>))]
public List<string> filter;

[JsonProperty("filter_regexp")]
[JsonProperty("filter_regexp", NullValueHandling = NullValueHandling.Ignore)]
[JsonConverter(typeof(JsonSingleOrArrayConverter<string>))]
public List<string> filter_regexp;

[JsonProperty("include_only")]
[JsonProperty("include_only", NullValueHandling = NullValueHandling.Ignore)]
[JsonConverter(typeof(JsonSingleOrArrayConverter<string>))]
public List<string> include_only;

[JsonProperty("include_only_regexp")]
[JsonProperty("include_only_regexp", NullValueHandling = NullValueHandling.Ignore)]
[JsonConverter(typeof(JsonSingleOrArrayConverter<string>))]
public List<string> include_only_regexp;

Expand Down