Lots of changes here... - Removed code using RecursivExtractor due to bad usage of /tmp Note: the code that used RecursiveExtractor may not have been in the previous commit - Created _functioning_ implementation of DebUnpacker - Restructured Project layout. TODO: - Possibly rewrite how the DebUnpacker works to have the file contents part of an entry. - Further restructuring and refactoring to make the code a little neater. - Add code for the final unpack steps Un-XZ -> untar -> write to disk - Add code to install - Add code for modified post-install pre-remove etc.. This is kinda needed to ensure proper system integration of new packages.
42 lines
1.4 KiB
C#
42 lines
1.4 KiB
C#
using Serilog;
|
|
// Make a version since it is so much easier to compare when the class handles it.
|
|
|
|
namespace EdgeInstaller;
|
|
|
|
sealed partial class Version : IEquatable<Version>
|
|
{
|
|
public int Major { get; private set; }
|
|
public int Minor { get; private set; }
|
|
public int Build { get; private set; }
|
|
public int Patch { get; private set; }
|
|
public int Subpatch { get; private set; }
|
|
|
|
|
|
public Version(string versionString)
|
|
{
|
|
Log.Information("Creating version from string {versionString}", versionString);
|
|
if (versionString == "")
|
|
{
|
|
throw new ArgumentException("The passed version string was empty", "versionString");
|
|
}
|
|
|
|
var splitVersion = versionString.Split('.');
|
|
Log.Debug("SplitVersion = {@splitversion}", splitVersion);
|
|
Major = int.Parse(splitVersion[0]);
|
|
Minor = int.Parse(splitVersion[1]);
|
|
Build = int.Parse(splitVersion[2]);
|
|
|
|
var splitPatch = splitVersion[3].Split('-');
|
|
Log.Debug("SplitPatch = {@splitPatch}", splitPatch);
|
|
Log.Debug("SplitPatch values : [0] = {0}, [1] = {1}", splitPatch[0], splitPatch[1]);
|
|
Patch = int.Parse(splitPatch[0]);
|
|
Subpatch = int.Parse(splitPatch[1]);
|
|
Log.Debug("Version Created: {@version}", this);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
return $"{Major}.{Minor}.{Build}.{Patch}-{Subpatch}";
|
|
}
|
|
}
|