Added another command line parser. Has a nice parameter verification framework
This commit is contained in:
@@ -15,17 +15,17 @@ namespace KattekerCreator
|
||||
private readonly string _description;
|
||||
private readonly string _productName;
|
||||
|
||||
public AssemblyFileInfo(ApplicationArguments appArguments, string tempDir)
|
||||
public AssemblyFileInfo(string programFile, string version, string tempDir)
|
||||
{
|
||||
FileInfo = new FileInfo(appArguments.ProgramFile);
|
||||
FileInfo = new FileInfo(programFile);
|
||||
using (var resourceInfo = new ResourceInfo())
|
||||
{
|
||||
resourceInfo.Load(appArguments.ProgramFile);
|
||||
resourceInfo.Load(programFile);
|
||||
if (resourceInfo.ResourceTypes.All(x => x.ResourceType != Kernel32.ResourceTypes.RT_VERSION)) return;
|
||||
var versionResource = (VersionResource) resourceInfo[Kernel32.ResourceTypes.RT_VERSION].First();
|
||||
var stringFileInfo = ((StringFileInfo) versionResource[nameof(StringFileInfo)]).Strings
|
||||
.FirstOrDefault().Value;
|
||||
AssemblyIconPath = GetAssemblyIcon(appArguments.ProgramFile, tempDir);
|
||||
AssemblyIconPath = GetAssemblyIcon(programFile, tempDir);
|
||||
if (stringFileInfo.Strings.ContainsKey("CompanyName"))
|
||||
_company = stringFileInfo.Strings["CompanyName"].StringValue.TrimEnd('\0');
|
||||
if (stringFileInfo.Strings.ContainsKey("FileDescription"))
|
||||
@@ -35,7 +35,7 @@ namespace KattekerCreator
|
||||
if (stringFileInfo.Strings.ContainsKey("ProductName"))
|
||||
_productName = stringFileInfo.Strings["ProductName"].StringValue.TrimEnd('\0');
|
||||
if (!stringFileInfo.Strings.ContainsKey("ProductVersion")) return;
|
||||
AssemblyVersion = appArguments.Version != null ? GetSemanticVersion(appArguments.Version) : GetSemanticVersion(stringFileInfo.Strings["ProductVersion"].StringValue.TrimEnd('\0'));
|
||||
AssemblyVersion = version != null ? GetSemanticVersion(version) : GetSemanticVersion(stringFileInfo.Strings["ProductVersion"].StringValue.TrimEnd('\0'));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user