diff --git a/tns2tool/Program.cs b/tns2tool/Program.cs index d0cf049..02ca3d5 100644 --- a/tns2tool/Program.cs +++ b/tns2tool/Program.cs @@ -12,38 +12,26 @@ public class Program { public static byte VersionMajor { get; private set; } = 0; public static byte VersionMinor { get; private set; } = 0; + public static byte VersionBuild { get; private set; } = 0; public static byte VersionRevision { get; private set; } = 0; public static string InformationalVersion { get; private set; } = ""; public static string GetFileVersion() { - return $"{VersionMajor}.{VersionMinor}"; + return $"{VersionMajor}.{VersionMinor}.{VersionBuild}.{VersionRevision}"; } static void PopulateVersionInfo() { - Version version = Assembly.GetEntryAssembly()!.GetName().Version!; + Assembly entryAssembly = Assembly.GetEntryAssembly()!; + Version version = entryAssembly.GetName().Version!; + VersionMajor = (byte)version.Major; VersionMinor = (byte)version.Minor; + VersionBuild = (byte)version.Build; VersionRevision = (byte)version.Revision; - try - { - InformationalVersion = - FileVersionInfo.GetVersionInfo(Environment.ProcessPath!).ProductVersion!; - } -#if DEBUG - catch (Exception ex) - { - - Console.WriteLine("Error getting InformationalVersion: " + ex.Message); -#else - catch - { -#endif - // fallback informational version, hopefully we never need this - InformationalVersion = $"{VersionMajor}.{VersionMinor}.{VersionRevision}"; - } + InformationalVersion = entryAssembly.GetCustomAttribute()!.InformationalVersion; } static void Main(string[] args) @@ -78,7 +66,7 @@ static void Main(string[] args) return; } - ProcessFile(option, inputFile, isGzip, outputPath: null); + ProcessFile(option, inputFile, isGzip, null); } else if (args[1] == "-inPath") { @@ -102,7 +90,7 @@ static void Main(string[] args) } } - static void ProcessFile(string option, string inputFile, bool isGzip, string outputPath) + static void ProcessFile(string option, string inputFile, bool isGzip, string? outputPath) { try { @@ -155,12 +143,12 @@ static void ProcessDirectory(string option, string inputPath, bool isGzip) } // Function to generate the output file name based on the input file and the output path - static string GetOutputFileName(string inputFile, string outputPath, string newExtension) + static string GetOutputFileName(string inputFile, string? outputPath, string newExtension) { string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(inputFile); - string directory = outputPath ?? Path.GetDirectoryName(inputFile); + string? directory = outputPath ?? Path.GetDirectoryName(inputFile); - return Path.Combine(directory, $"{fileNameWithoutExtension}{newExtension}"); + return Path.Combine(directory!, $"{fileNameWithoutExtension}{newExtension}"); } // Function to determine the output file extension based on the content diff --git a/tns2tool/tns2tool.csproj b/tns2tool/tns2tool.csproj index 1253568..17cea02 100644 --- a/tns2tool/tns2tool.csproj +++ b/tns2tool/tns2tool.csproj @@ -7,7 +7,7 @@ net8.0 enable enable - 0.2.1 + 0.2.1.1 false Debug;Release;FullRelease win-x64;osx-x64;linux-x64