Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/cecil.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'Mono.Cecil/AssemblyNameReference.cs')
-rw-r--r--Mono.Cecil/AssemblyNameReference.cs18
1 files changed, 16 insertions, 2 deletions
diff --git a/Mono.Cecil/AssemblyNameReference.cs b/Mono.Cecil/AssemblyNameReference.cs
index a202e91..6521dc6 100644
--- a/Mono.Cecil/AssemblyNameReference.cs
+++ b/Mono.Cecil/AssemblyNameReference.cs
@@ -49,7 +49,7 @@ namespace Mono.Cecil {
public Version Version {
get { return version; }
set {
- version = value ?? Mixin.ZeroVersion;
+ version = Mixin.CheckVersion (value);
full_name = null;
}
}
@@ -239,7 +239,7 @@ namespace Mono.Cecil {
throw new ArgumentNullException ("name");
this.name = name;
- this.version = version ?? Mixin.ZeroVersion;
+ this.version = Mixin.CheckVersion (version);
this.hash_algorithm = AssemblyHashAlgorithm.None;
this.token = new MetadataToken (TokenType.AssemblyRef);
}
@@ -253,5 +253,19 @@ namespace Mono.Cecil {
partial class Mixin {
public static Version ZeroVersion = new Version (0, 0, 0 ,0);
+
+ public static Version CheckVersion (Version version)
+ {
+ if (version == null)
+ return ZeroVersion;
+
+ if (version.Build == -1)
+ return new Version (version.Major, version.Minor, 0, 0);
+
+ if (version.Revision == -1)
+ return new Version (version.Major, version.Minor, version.Build, 0);
+
+ return version;
+ }
}
}