Geändert

- Jetzt auch für NX-Versionen neuer als NX12 geeignet.
- Bool Wert 'PostNX12' neu dazu.
   true=NX neuer als NX12
   false=NX vor bis einschliesslich NX12
- Versionsvergleich vereinfacht.
This commit is contained in:
Eugen Höglinger 2021-05-19 15:27:44 +02:00
parent b3009f02f6
commit 25f6282be3
27 changed files with 28 additions and 47 deletions

Binary file not shown.

View File

@ -122,7 +122,7 @@ namespace Eugen.NX
string nxVersionNo = ReadNxEnvValues(UgiiRootDir, "-n").Replace("\r\n", "");
if (IsPostNX12(UgiiRootDir))
if (Convert.ToInt32(ugiiBaseDir.ToLower().Remove(0, ugiiBaseDir.LastIndexOf("\\") + 3)) <= 12)
{
//Nach NX12
AlignCode(nxVersionNo);
@ -246,35 +246,6 @@ namespace Eugen.NX
#endregion
#region Common Private Methodes
private bool IsPostNX12(string ugiiRootDir)
{
if (NxVersionNumber(ugiiRootDir) <= 12)
{
//Bis einschliesslich NX12
PostNX12 = false;
}
else
{
//Nach NX12
PostNX12 = true;
}
return PostNX12;
}
private bool IsPostNX12(NxVersion version)
{
if (version.UgiiMajorVersion <= 12)
{
//Bis einschliesslich NX12
PostNX12 = false;
}
else
{
//Nach NX12
PostNX12 = true;
}
return PostNX12;
}
private int NxVersionNumber(string ugiiRootDir)
{
@ -312,7 +283,7 @@ namespace Eugen.NX
//Wenn eine der drei Dateien nicht existiert, dann eine Exception werfen
if (!File.Exists(String.Concat(ugii_base_dir, "\\UGII\\env_print.exe"))) throw new NoEnvPrintExeException("Unable to find EnvPrint.exe");
//Nur vor 'NX 1847' ausführen, weil es nur vorher diese Biblithek gibt
if (!ugii_base_dir.ToLower().Contains("nx18") & !ugii_base_dir.ToLower().Contains("beta") & ugii_base_dir.Remove(0, ugii_base_dir.LastIndexOf("\\") + 1).Length != 2)
if (Convert.ToInt32(ugii_base_dir.ToLower().Remove(0, ugii_base_dir.LastIndexOf("\\") + 3)) <= 12 & !ugii_base_dir.ToLower().Contains("beta") & ugii_base_dir.Remove(0, ugii_base_dir.LastIndexOf("\\") + 1).Length != 2)
{
if (!File.Exists(String.Concat(ugii_base_dir, "\\UGII\\libpatch.dll")) & !File.Exists(String.Concat(ugii_base_dir, "\\NXBIN\\libpatch.dll"))) throw new NoLibPatchDllException("Unable to find LibPatch.dll");
}
@ -395,6 +366,7 @@ namespace Eugen.NX
NxPhaseString = versionSegments[4].ToString(); //NX Phase String
UgiiFullVersion = String.Concat("v", versionSegments[1], ".", versionSegments[2], ".", versionSegments[3], ".", versionSegments[4]); //NX Full Version
UgiiVersion = String.Concat("v", versionSegments[1]);
PostNX12 = !(UgiiMajorVersion <= 12);
}
private void AlignCode(string ugiiProductName, int majorVersion, int minorVersion, int subminorVersion, int phase, int mp)
@ -417,6 +389,7 @@ namespace Eugen.NX
NxPhaseString = phase.ToString(); //NX Phase String
UgiiFullVersion = String.Concat("v", majorVersion, ".", minorVersion, ".", subminorVersion, ".", phase); //NX Full Version
UgiiVersion = String.Concat("v", majorVersion);
PostNX12 = !(UgiiMajorVersion <= 12);
}
private string[] SeperateVersionCode(string versionNumber)
@ -537,6 +510,7 @@ namespace Eugen.NX
nxVersion.NxPhaseString = NxPhaseString; //NX_PHASE_STRING. E.g.: 5 of V28.0.3.5
nxVersion.UgiiFullVersion = UgiiFullVersion; //UGII_FULL_VERSION. E.g.: v10.0.3.5 instead of NX 10.0.3.5
nxVersion.UgiiVersion = UgiiVersion; //UGII_VERSION. E.g.: v10 of v10.0.3.5
nxVersion.PostNX12 = PostNX12;
return nxVersion;
}
@ -616,6 +590,9 @@ namespace Eugen.NX
nxVersion.MaintenancePackNumber = Convert.ToInt16(nxVersion.MaintenancePack.Remove(0, nxVersion.MaintenancePack.IndexOf("MP") + 2));
MaintenancePackNumber = nxVersion.MaintenancePackNumber;
// Post NX12. E.g.: true
nxVersion.PostNX12 = PostNX12;
return nxVersion;
}
#endregion
@ -724,7 +701,6 @@ namespace Eugen.NX
/// <returns>0 = equal, 1 = first version newer, 2 = second version newer, -1 = An error is happened.</returns>
public int Compare(NxVersion version)
{
//version.PostNX12 = IsPostNX12(version);
return Compare(this, version);
}
@ -736,15 +712,15 @@ namespace Eugen.NX
/// <returns>0 = equal, 1 = first version newer, 2 = second version newer, -1 = An error is happened.</returns>
public int Compare(NxVersion version1, NxVersion version2)
{
if (IsPostNX12(version1) & IsPostNX12(version2))
if (version1.PostNX12 & version2.PostNX12)
{
return ComparePostNX12(version1, version2);
}
if (!IsPostNX12(version1) & !IsPostNX12(version2))
if (!version1.PostNX12 & !version2.PostNX12)
{
return CompareUpToNX12(version1, version2);
}
if ((IsPostNX12(version1) & !IsPostNX12(version2)) || (!IsPostNX12(version1) & IsPostNX12(version2)))
if ((version1.PostNX12 & !version2.PostNX12) || (!version1.PostNX12 & version2.PostNX12))
{
return CompareDiffVersions(version1, version2);
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1 @@
16aaa6b329891a69cbad3d5b12489a34279c0ce9

View File

@ -4,3 +4,8 @@ H:\Programmieren\Git-Repository\VisualStudio\2017\_DLL\NxVersion.git\NxVersion\b
H:\Programmieren\Git-Repository\VisualStudio\2017\_DLL\NxVersion.git\NxVersion\bin\Debug\NxVersion.pdb
H:\Programmieren\Git-Repository\VisualStudio\2017\_DLL\NxVersion.git\NxVersion\obj\Debug\NxVersion.dll
H:\Programmieren\Git-Repository\VisualStudio\2017\_DLL\NxVersion.git\NxVersion\obj\Debug\NxVersion.pdb
H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\NxVersion.git\NxVersion\bin\Debug\henxver.dll
H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\NxVersion.git\NxVersion\bin\Debug\henxver.pdb
H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\NxVersion.git\NxVersion\obj\Debug\NxVersion.csproj.CoreCompileInputs.cache
H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\NxVersion.git\NxVersion\obj\Debug\henxver.dll
H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\NxVersion.git\NxVersion\obj\Debug\henxver.pdb

Binary file not shown.

Binary file not shown.

View File

@ -58,7 +58,7 @@
// labelProgramInfo
//
this.labelProgramInfo.AutoSize = true;
this.labelProgramInfo.Location = new System.Drawing.Point(453, 362);
this.labelProgramInfo.Location = new System.Drawing.Point(243, 362);
this.labelProgramInfo.Name = "labelProgramInfo";
this.labelProgramInfo.Size = new System.Drawing.Size(16, 13);
this.labelProgramInfo.TabIndex = 2;
@ -67,7 +67,7 @@
// labelDLLInfo
//
this.labelDLLInfo.AutoSize = true;
this.labelDLLInfo.Location = new System.Drawing.Point(453, 195);
this.labelDLLInfo.Location = new System.Drawing.Point(473, 362);
this.labelDLLInfo.Name = "labelDLLInfo";
this.labelDLLInfo.Size = new System.Drawing.Size(16, 13);
this.labelDLLInfo.TabIndex = 3;
@ -76,7 +76,7 @@
// labelNxVersion1
//
this.labelNxVersion1.AutoSize = true;
this.labelNxVersion1.Location = new System.Drawing.Point(233, 13);
this.labelNxVersion1.Location = new System.Drawing.Point(243, 13);
this.labelNxVersion1.Name = "labelNxVersion1";
this.labelNxVersion1.Size = new System.Drawing.Size(16, 13);
this.labelNxVersion1.TabIndex = 4;
@ -85,7 +85,7 @@
// labelCompare
//
this.labelCompare.AutoSize = true;
this.labelCompare.Location = new System.Drawing.Point(453, 13);
this.labelCompare.Location = new System.Drawing.Point(473, 13);
this.labelCompare.Name = "labelCompare";
this.labelCompare.Size = new System.Drawing.Size(16, 13);
this.labelCompare.TabIndex = 5;

View File

@ -108,7 +108,7 @@ namespace Test_NxVersion
{
SetProgramInfo();
InitializeComponent();
labelProgramInfo.Text = String.Concat("Programm-Info:\n\n",ProgramName, "\n", ProgramVersion, "\n", Copyright); //Programm-Info
var nxv = new NxVersion(); //Initialisieren damit die DLL-Info abgefragt werden kann

View File

@ -33,9 +33,8 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="NxVersion, Version=1.0.7619.25324, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\NxVersion\bin\Debug\NxVersion.dll</HintPath>
<Reference Include="henxver">
<HintPath>..\NxVersion\bin\Debug\henxver.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />

Binary file not shown.

Binary file not shown.

View File

@ -1 +1 @@
4cc85cfbbd99d80050b587ef246050866ba70d69
9795f9b0e1a1f35fa41576dd4174ad416e27b351

View File

@ -14,9 +14,6 @@ H:\Programmieren\Git-Repository\VisualStudio\2017\_DLL\NxVersion.git\Test_NxVers
H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\NxVersion.git\Test_NxVersion\bin\Debug\Test_NxVersion.exe.config
H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\NxVersion.git\Test_NxVersion\bin\Debug\Test_NxVersion.exe
H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\NxVersion.git\Test_NxVersion\bin\Debug\Test_NxVersion.pdb
H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\NxVersion.git\Test_NxVersion\bin\Debug\NxVersion.dll
H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\NxVersion.git\Test_NxVersion\bin\Debug\NxVersion.pdb
H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\NxVersion.git\Test_NxVersion\obj\Debug\Test_NxVersion.csprojAssemblyReference.cache
H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\NxVersion.git\Test_NxVersion\obj\Debug\Test_NxVersion.Form1.resources
H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\NxVersion.git\Test_NxVersion\obj\Debug\Test_NxVersion.Properties.Resources.resources
H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\NxVersion.git\Test_NxVersion\obj\Debug\Test_NxVersion.csproj.GenerateResource.cache
@ -24,3 +21,6 @@ H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\NxVersion.git\Test_NxVersi
H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\NxVersion.git\Test_NxVersion\obj\Debug\Test_NxVersion.csproj.CopyComplete
H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\NxVersion.git\Test_NxVersion\obj\Debug\Test_NxVersion.exe
H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\NxVersion.git\Test_NxVersion\obj\Debug\Test_NxVersion.pdb
H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\NxVersion.git\Test_NxVersion\obj\Debug\Test_NxVersion.csprojAssemblyReference.cache
H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\NxVersion.git\Test_NxVersion\bin\Debug\henxver.dll
H:\Programmieren\Git-WorkRepository\VisualStudio\_DLL\NxVersion.git\Test_NxVersion\bin\Debug\henxver.pdb