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; namespace Eugen.ESystem { 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 programVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(); 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(); 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 #region Programm-Info /// /// Contains the name of the program file /// public static string ProgramName { set; get; } /// /// Contains the version of the program file /// public static string ProgramVersion { set; get; } /// /// Contains the copyright notice /// public static string Copyright { set; get; } private void SetProgramInfo() { //Name, Version und Copyright setzen ProgramName = programName; ProgramVersion = programVersion; Copyright = copyright; } #endregion public Form1() { SetProgramInfo(); //Name, Version und Copyright setzen InitializeComponent(); } private void buttonStart_Click(object sender, EventArgs e) { string text = "NX ist im Verzeichns ${UGII_BASE_DIR} installiert. Im Verzeichnis ${UGII_ROOT_DIR} sind die Befehle.\nAls Systemsprache ist %UGII_LANG% eingestellt. Als temporäres NX Verzeichnis ist %UGII_TMP_DIR% definiert."; labelSourceString.Text = text; // //Diese Zeile in das Programm kopieren // //Tauscht bekannte Umgebungsvariblen gegen ihren Wert aus. Unbekannte Umgebungsvariablen werden nicht getauscht. string textNeu = VaribleThroughString.Replace(text); // labelResult.Text = textNeu; //Hier wird der Text beispielhaft ausgegeben //DLL Information abrufen var vts = new VaribleThroughString(); string dllInfo = String.Concat(VaribleThroughString.DllName, "\n", VaribleThroughString.DllVersion, "\n", VaribleThroughString.Copyright); labelDllInfo.Text = dllInfo; } private void buttonStartWithMessage_Click(object sender, EventArgs e) { string text = "NX ist im Verzeichns ${UGII_BASE_DIR} installiert. Im Verzeichnis ${UGII_ROOT_DIR} sind die Befehle.\nAls Systemsprache ist %UGII_LANG% eingestellt. Als temporäres NX Verzeichnis ist %UGII_TMP_DIR% definiert."; labelSourceString.Text = text; // //Diese Zeilen in das Programm kopieren // //Tauscht bekannte Umgebungsvariblen gegen ihren Wert aus. Unbekannte Umgebungsvariablen lösen eine Exception aus. try { string textNeu = VaribleThroughString.Replace(text, true); labelResult.Text = textNeu; //Hier wird der Text beispielhaft ausgegeben } catch (Exception ex) { MessageBox.Show(ex.Message); } // //DLL Information abrufen var vts = new VaribleThroughString(); string dllInfo = String.Concat(VaribleThroughString.DllName, "\n", VaribleThroughString.DllVersion, "\n", VaribleThroughString.Copyright); labelDllInfo.Text = dllInfo; } } }