104 lines
4.9 KiB
C#
104 lines
4.9 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Reflection;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Forms;
|
|
using Eugen.NX.Version;
|
|
|
|
namespace Test_NxVersion
|
|
{
|
|
public partial class Form1 : Form
|
|
{
|
|
#region Version und Copyright
|
|
// Version und Copyright
|
|
string programName = Path.GetFileNameWithoutExtension(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase); // Den Programmnamen auslesen
|
|
string version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(); // Die Programmversion auslesen
|
|
static object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false);
|
|
string copyright = ((AssemblyCopyrightAttribute)attributes[0]).Copyright;
|
|
string icon = Application.StartupPath + "\\Info.bmp";
|
|
// Assembly Datum und Zeit
|
|
static DateTime value = AssemblyDateTime();
|
|
string date = value.ToShortDateString();
|
|
string time = value.ToLongTimeString();
|
|
// Programmversion berechnen
|
|
private static DateTime AssemblyDateTime()
|
|
{
|
|
var version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
|
|
var buildDateTime = new DateTime(2000, 1, 1).Add(new TimeSpan(TimeSpan.TicksPerDay * version.Build + TimeSpan.TicksPerSecond * 2 * version.Revision));
|
|
// Tage seit dem 1. Januar 2000 und Sekunden seit Mitternacht, (multiplizier mit 2 ergibt das Original)
|
|
return buildDateTime;
|
|
}
|
|
#endregion
|
|
|
|
public Form1()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void Form1_Load(object sender, EventArgs e)
|
|
{
|
|
this.Text = programName; //Programnamen ins Fenster schreiben
|
|
}
|
|
|
|
private void buttonStart_Click(object sender, EventArgs e)
|
|
{
|
|
NxVersion nxVersion = new NxVersion();
|
|
NxVersion nxVer = nxVersion.GetNxVersion("C:\\CAD\\NX10");
|
|
NxVersion nxVer1 = nxVersion.GetNxVersion("C:\\CAD\\NX12_Beta\\NX 12.0");
|
|
|
|
//Werte zuordnen
|
|
string text = "";
|
|
text = "NX Patch: " + nxVer.NXpatch;
|
|
text += "\nNX Version: " + nxVer.NXversion;
|
|
text += "\nMaintenance Release: " + nxVer.MaintenanceRelease;
|
|
text += "\nUGII_PRODUCT_NAME: " + nxVer.UgiiProductName;
|
|
text += "\nUGII_MAJOR_VERSION: " + nxVer.UgiiMajorVersion;
|
|
text += "\nUGII_MINOR_VERSION: " + nxVer.UgiiMinorVersion;
|
|
text += "\nUGII_SUBMINOR_VERSION: " + nxVer.UgiiSubminorVersion;
|
|
text += "\nNX Phase: " + nxVer.NXphase;
|
|
text += "\nMaintenance Pack: " + nxVer.MaintenancePack;
|
|
text += "\nMaintenance Pack Number: " + nxVer.MaintenancePackNumber;
|
|
text += "\nNX_VERSION_STRING: " + nxVer.NxVersionString;
|
|
text += "\nNX_MAJOR_STRING: " + nxVer.NxMajorVersionString;
|
|
text += "\nNX_MINOR_STRING: " + nxVer.NxMinorVersionString;
|
|
text += "\nNX_SUBMINOR_STRING: " + nxVer.NxSubminorVersionString;
|
|
text += "\nNX_PHASE_STRING: " + nxVer.NxPhaseString;
|
|
text += "\nUGII_FULL_VERSION: " + nxVer.UgiiFullVersion;
|
|
text += "\nUGII_VERSION: " + nxVer.UgiiVersion;
|
|
labelNxVersion.Text = text;
|
|
|
|
nxVer = nxVersion.GetNxVersion("NX", 10, 0, 3, 5, 11);
|
|
text = "";
|
|
text = "NX Patch: " + nxVer.NXpatch;
|
|
text += "\nNX Version: " + nxVer.NXversion;
|
|
text += "\nMaintenance Release: " + nxVer.MaintenanceRelease;
|
|
text += "\nUGII_PRODUCT_NAME: " + nxVer.UgiiProductName;
|
|
text += "\nUGII_MAJOR_VERSION: " + nxVer.UgiiMajorVersion;
|
|
text += "\nUGII_MINOR_VERSION: " + nxVer.UgiiMinorVersion;
|
|
text += "\nUGII_SUBMINOR_VERSION: " + nxVer.UgiiSubminorVersion;
|
|
text += "\nNX Phase: " + nxVer.NXphase;
|
|
text += "\nMaintenance Pack: " + nxVer.MaintenancePack;
|
|
text += "\nMaintenance Pack Number: " + nxVer.MaintenancePackNumber;
|
|
text += "\nNX_VERSION_STRING: " + nxVer.NxVersionString;
|
|
text += "\nNX_MAJOR_STRING: " + nxVer.NxMajorVersionString;
|
|
text += "\nNX_MINOR_STRING: " + nxVer.NxMinorVersionString;
|
|
text += "\nNX_SUBMINOR_STRING: " + nxVer.NxSubminorVersionString;
|
|
text += "\nNX_PHASE_STRING: " + nxVer.NxPhaseString;
|
|
text += "\nUGII_FULL_VERSION: " + nxVer.UgiiFullVersion;
|
|
text += "\nUGII_VERSION: " + nxVer.UgiiVersion;
|
|
labelNxVersion1.Text = text;
|
|
|
|
//Werte vergleichen
|
|
text = "Der Vergleich von C:\\CAD\\NX10 mit C:\\CAD\\NX12_Beta\\NX 12.0 ergibt: ";
|
|
text += nxVer.Compare(nxVer1);
|
|
labelCompare.Text = text;
|
|
}
|
|
}
|
|
}
|