mirror of
https://github.com/modernw/App-Installer-For-Windows-8.x-Reset.git
synced 2026-06-19 05:40:12 +10:00
Coding for Package Manager.
This commit is contained in:
+13
-2
@@ -8,7 +8,7 @@ namespace DataUtils
|
||||
/// bits 48..63 = major, 32..47 = minor, 16..31 = build, 0..15 = revision.
|
||||
/// </summary>
|
||||
[ComVisible (true)]
|
||||
public class Version: IComparable<Version>, IEquatable<Version>
|
||||
public class Version: IComparable<Version>, IEquatable<Version>, Utilities.IJsonBuild
|
||||
{
|
||||
// Backing fields
|
||||
private ushort major;
|
||||
@@ -70,12 +70,13 @@ namespace DataUtils
|
||||
// cast to ulong before shifting
|
||||
return (((ulong)major) << 48) | (((ulong)minor) << 32) | (((ulong)build) << 16) | ((ulong)revision);
|
||||
}
|
||||
public void FromUInt64 (ulong value)
|
||||
public Version FromUInt64 (ulong value)
|
||||
{
|
||||
major = (ushort)((value >> 48) & 0xFFFFUL);
|
||||
minor = (ushort)((value >> 32) & 0xFFFFUL);
|
||||
build = (ushort)((value >> 16) & 0xFFFFUL);
|
||||
revision = (ushort)(value & 0xFFFFUL);
|
||||
return this;
|
||||
}
|
||||
public ulong Data { get { return ToUInt64 (); } set { FromUInt64 (value); } }
|
||||
public override string ToString ()
|
||||
@@ -242,6 +243,16 @@ namespace DataUtils
|
||||
if (v == null) return 0UL;
|
||||
return v.ToUInt64 ();
|
||||
}
|
||||
public object BuildJSON ()
|
||||
{
|
||||
return new
|
||||
{
|
||||
major = Major,
|
||||
minor = Minor,
|
||||
build = Build,
|
||||
revision = Revision
|
||||
};
|
||||
}
|
||||
}
|
||||
[ComVisible (true)]
|
||||
[ClassInterface (ClassInterfaceType.AutoDual)]
|
||||
|
||||
Reference in New Issue
Block a user