diff --git a/VaribleThroughString.sln b/ReplaceVariableByValue.sln
similarity index 78%
rename from VaribleThroughString.sln
rename to ReplaceVariableByValue.sln
index 45fcaef..9d9e0b0 100644
--- a/VaribleThroughString.sln
+++ b/ReplaceVariableByValue.sln
@@ -3,9 +3,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28307.572
MinimumVisualStudioVersion = 10.0.40219.1
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VaribleThroughString", "VaribleThroughString\VaribleThroughString.csproj", "{8D5C22C1-DD1A-4A28-B636-445F02ADB815}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReplaceVariableByValue", "ReplaceVariableByValue\ReplaceVariableByValue.csproj", "{8D5C22C1-DD1A-4A28-B636-445F02ADB815}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test_VaribleThroughString", "Test_VaribleThroughString\Test_VaribleThroughString.csproj", "{196A7F39-5BDA-4E02-84E8-B30973309C8B}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test_ReplaceVariableByValue", "Test_ReplaceVariableByValue\Test_ReplaceVariableByValue.csproj", "{196A7F39-5BDA-4E02-84E8-B30973309C8B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
diff --git a/VaribleThroughString/Language.Designer.cs b/ReplaceVariableByValue/Language.Designer.cs
similarity index 100%
rename from VaribleThroughString/Language.Designer.cs
rename to ReplaceVariableByValue/Language.Designer.cs
diff --git a/VaribleThroughString/Language.de.resx b/ReplaceVariableByValue/Language.de.resx
similarity index 100%
rename from VaribleThroughString/Language.de.resx
rename to ReplaceVariableByValue/Language.de.resx
diff --git a/VaribleThroughString/Language.en.resx b/ReplaceVariableByValue/Language.en.resx
similarity index 100%
rename from VaribleThroughString/Language.en.resx
rename to ReplaceVariableByValue/Language.en.resx
diff --git a/VaribleThroughString/Language.resx b/ReplaceVariableByValue/Language.resx
similarity index 100%
rename from VaribleThroughString/Language.resx
rename to ReplaceVariableByValue/Language.resx
diff --git a/VaribleThroughString/Properties/AssemblyInfo.cs b/ReplaceVariableByValue/Properties/AssemblyInfo.cs
similarity index 93%
rename from VaribleThroughString/Properties/AssemblyInfo.cs
rename to ReplaceVariableByValue/Properties/AssemblyInfo.cs
index 288c9cd..9cfca99 100644
--- a/VaribleThroughString/Properties/AssemblyInfo.cs
+++ b/ReplaceVariableByValue/Properties/AssemblyInfo.cs
@@ -5,11 +5,11 @@ using System.Runtime.InteropServices;
// Allgemeine Informationen über eine Assembly werden über die folgenden
// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
// die einer Assembly zugeordnet sind.
-[assembly: AssemblyTitle("VaribleThroughString")]
+[assembly: AssemblyTitle("ReplaceVariableByValue")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("VaribleThroughString")]
+[assembly: AssemblyProduct("ReplaceVariableByValue")]
[assembly: AssemblyCopyright("Copyright © 2019 by Eugen Höglinger")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
diff --git a/VaribleThroughString/VaribleThroughString.cs b/ReplaceVariableByValue/ReplaceVariableByValue.cs
similarity index 76%
rename from VaribleThroughString/VaribleThroughString.cs
rename to ReplaceVariableByValue/ReplaceVariableByValue.cs
index e75c485..5492aac 100644
--- a/VaribleThroughString/VaribleThroughString.cs
+++ b/ReplaceVariableByValue/ReplaceVariableByValue.cs
@@ -6,17 +6,19 @@ using System.Reflection;
using System.Resources;
using System.Text;
using System.Threading.Tasks;
+using System.Windows.Forms;
namespace Eugen.ESystem
{
- public class VaribleThroughString
+ public class ReplaceVariableByValue
{
#region Version und Copyright
// Version und Copyright
- string dllName = Path.GetFileNameWithoutExtension(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase); //Den Programmnamen auslesen
- string dllVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();
+ static string dllName = Path.GetFileNameWithoutExtension(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase); //Den Programmnamen auslesen
+ static string dllVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();
static object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false);
- string copyright = ((AssemblyCopyrightAttribute)attributes[0]).Copyright;
+ static string copyright = GenerateCopyright();
+ string icon = Application.StartupPath + "\\Info.bmp";
//Assembly Datum und Zeit
static DateTime value = AssemblyDateTime();
string date = value.ToShortDateString();
@@ -28,48 +30,78 @@ namespace Eugen.ESystem
//Tage seit dem 1. Januar 2000 und Sekunden seit Mitternacht, (multiplizier mit 2 ergibt das Original)
return buildDateTime;
}
+
+ private static string CurrentYear()
+ {
+ DateTime dtn = DateTime.Now;
+ return dtn.Year.ToString();
+ }
+
+ private static string StartYear()
+ {
+ string startYear = "";
+ if (((AssemblyCopyrightAttribute)attributes[0]).Copyright.Contains("Copyright © "))
+ {
+ startYear = ((AssemblyCopyrightAttribute)attributes[0]).Copyright.Replace("Copyright © ", "");
+ while (startYear.StartsWith(" "))
+ {
+ startYear = startYear.Remove(0, 1);
+ }
+ startYear = startYear.Remove(startYear.IndexOf(" "));
+ return startYear;
+ }
+ else
+ {
+ DateTime dtn = DateTime.Now;
+ return dtn.Year.ToString();
+ }
+ }
+
+ private static string GenerateCopyright()
+ {
+ string startYear = StartYear();
+ string currentYear = CurrentYear();
+
+ if (startYear == currentYear)
+ {
+ return ((AssemblyCopyrightAttribute)attributes[0]).Copyright;
+ }
+ else
+ {
+ return ((AssemblyCopyrightAttribute)attributes[0]).Copyright.Replace(startYear, String.Concat(startYear, "-", currentYear));
+ }
+ }
#endregion
#region DLL-Info
///
- /// Contains the name of the dll file.
+ /// Contains the name of the program file
///
- public static string DllName { private set; get; }
+ public static string DllName { set; get; }
///
- /// Contains the version of the dll file.
+ /// Contains the version of the program file
///
- public static string DllVersion { private set; get; }
+ public static string DllVersion { set; get; }
///
- /// Contains the copyright notice.
+ /// Contains the copyright notice
///
- public static string Copyright { private set; get; }
+ public static string Copyright { set; get; }
- ///
- /// Contains the name-, version- and copyright-information of the dll file.
- ///
- public static string[] DllInfo { private set; get; }
-
- private void SetDllInfo()
+ private static void SetDllInfo()
{
//Name, Version und Copyright setzen
DllName = dllName;
DllVersion = dllVersion;
- Copyright = this.copyright;
-
- string[] dllInfo = new string[3];
- dllInfo[0] = dllName;
- dllInfo[1] = dllVersion;
- dllInfo[2] = this.copyright;
- DllInfo = dllInfo;
+ Copyright = copyright;
}
#endregion
///
/// Replaces a Environment variable through the variable value.
///
- public VaribleThroughString()
+ static ReplaceVariableByValue()
{
SetDllInfo(); //Name, Version und Copyright der DLL setzen
}
@@ -124,7 +156,7 @@ namespace Eugen.ESystem
/// The edited text
public static string Replace(string text, bool messageWhenError)
{
- if (!(text.Contains("${") || !text.Contains("%")) || String.IsNullOrEmpty(text))
+ if ((!text.Contains("${") && !text.Contains("%")) || String.IsNullOrEmpty(text))
{
return text;
}
diff --git a/VaribleThroughString/VaribleThroughString.csproj b/ReplaceVariableByValue/ReplaceVariableByValue.csproj
similarity index 92%
rename from VaribleThroughString/VaribleThroughString.csproj
rename to ReplaceVariableByValue/ReplaceVariableByValue.csproj
index 6c34b9f..ecccc4e 100644
--- a/VaribleThroughString/VaribleThroughString.csproj
+++ b/ReplaceVariableByValue/ReplaceVariableByValue.csproj
@@ -7,8 +7,8 @@
{8D5C22C1-DD1A-4A28-B636-445F02ADB815}
Library
Properties
- VaribleThroughString
- VaribleThroughString
+ ReplaceVariableByValue
+ ReplaceVariableByValue
v4.6.1
512
false
@@ -33,6 +33,7 @@
+
@@ -46,7 +47,7 @@
True
Language.resx
-
+
diff --git a/Test_VaribleThroughString/App.config b/Test_ReplaceVariableByValue/App.config
similarity index 100%
rename from Test_VaribleThroughString/App.config
rename to Test_ReplaceVariableByValue/App.config
diff --git a/Test_ReplaceVariableByValue/Form1.Designer.cs b/Test_ReplaceVariableByValue/Form1.Designer.cs
new file mode 100644
index 0000000..8f3c848
--- /dev/null
+++ b/Test_ReplaceVariableByValue/Form1.Designer.cs
@@ -0,0 +1,157 @@
+namespace Eugen.ESystem
+{
+ partial class Form1
+ {
+ ///
+ /// Erforderliche Designervariable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Verwendete Ressourcen bereinigen.
+ ///
+ /// True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Vom Windows Form-Designer generierter Code
+
+ ///
+ /// Erforderliche Methode für die Designerunterstützung.
+ /// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden.
+ ///
+ private void InitializeComponent()
+ {
+ this.labelResult = new System.Windows.Forms.Label();
+ this.buttonStart = new System.Windows.Forms.Button();
+ this.labelSourceString = new System.Windows.Forms.Label();
+ this.groupBoxProgramInfo = new System.Windows.Forms.GroupBox();
+ this.labelProgramInfo = new System.Windows.Forms.Label();
+ this.groupBoxDLLInfo = new System.Windows.Forms.GroupBox();
+ this.labelDLLInfo = new System.Windows.Forms.Label();
+ this.buttonStartWithMessage = new System.Windows.Forms.Button();
+ this.groupBoxProgramInfo.SuspendLayout();
+ this.groupBoxDLLInfo.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // labelResult
+ //
+ this.labelResult.AutoSize = true;
+ this.labelResult.Location = new System.Drawing.Point(9, 117);
+ this.labelResult.Name = "labelResult";
+ this.labelResult.Size = new System.Drawing.Size(16, 13);
+ this.labelResult.TabIndex = 0;
+ this.labelResult.Text = "...";
+ //
+ // buttonStart
+ //
+ this.buttonStart.Location = new System.Drawing.Point(12, 343);
+ this.buttonStart.Name = "buttonStart";
+ this.buttonStart.Size = new System.Drawing.Size(385, 23);
+ this.buttonStart.TabIndex = 1;
+ this.buttonStart.Text = "Tausche Variable geben Wert (Ohne Meldung bei Fehler)";
+ this.buttonStart.UseVisualStyleBackColor = true;
+ this.buttonStart.Click += new System.EventHandler(this.buttonStart_Click);
+ //
+ // labelSourceString
+ //
+ this.labelSourceString.AutoSize = true;
+ this.labelSourceString.Location = new System.Drawing.Point(12, 9);
+ this.labelSourceString.Name = "labelSourceString";
+ this.labelSourceString.Size = new System.Drawing.Size(16, 13);
+ this.labelSourceString.TabIndex = 2;
+ this.labelSourceString.Text = "...";
+ //
+ // groupBoxProgramInfo
+ //
+ this.groupBoxProgramInfo.Controls.Add(this.labelProgramInfo);
+ this.groupBoxProgramInfo.Location = new System.Drawing.Point(12, 372);
+ this.groupBoxProgramInfo.Name = "groupBoxProgramInfo";
+ this.groupBoxProgramInfo.Size = new System.Drawing.Size(385, 66);
+ this.groupBoxProgramInfo.TabIndex = 9;
+ this.groupBoxProgramInfo.TabStop = false;
+ this.groupBoxProgramInfo.Text = "Programm Information";
+ //
+ // labelProgramInfo
+ //
+ this.labelProgramInfo.AutoSize = true;
+ this.labelProgramInfo.ImeMode = System.Windows.Forms.ImeMode.NoControl;
+ this.labelProgramInfo.Location = new System.Drawing.Point(7, 20);
+ this.labelProgramInfo.Name = "labelProgramInfo";
+ this.labelProgramInfo.Size = new System.Drawing.Size(16, 13);
+ this.labelProgramInfo.TabIndex = 0;
+ this.labelProgramInfo.Text = "...";
+ //
+ // groupBoxDLLInfo
+ //
+ this.groupBoxDLLInfo.Controls.Add(this.labelDLLInfo);
+ this.groupBoxDLLInfo.Location = new System.Drawing.Point(403, 372);
+ this.groupBoxDLLInfo.Name = "groupBoxDLLInfo";
+ this.groupBoxDLLInfo.Size = new System.Drawing.Size(385, 66);
+ this.groupBoxDLLInfo.TabIndex = 10;
+ this.groupBoxDLLInfo.TabStop = false;
+ this.groupBoxDLLInfo.Text = "DLL Information";
+ //
+ // labelDLLInfo
+ //
+ this.labelDLLInfo.AutoSize = true;
+ this.labelDLLInfo.ImeMode = System.Windows.Forms.ImeMode.NoControl;
+ this.labelDLLInfo.Location = new System.Drawing.Point(7, 20);
+ this.labelDLLInfo.Name = "labelDLLInfo";
+ this.labelDLLInfo.Size = new System.Drawing.Size(16, 13);
+ this.labelDLLInfo.TabIndex = 0;
+ this.labelDLLInfo.Text = "...";
+ //
+ // buttonStartWithMessage
+ //
+ this.buttonStartWithMessage.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
+ this.buttonStartWithMessage.Location = new System.Drawing.Point(403, 343);
+ this.buttonStartWithMessage.Name = "buttonStartWithMessage";
+ this.buttonStartWithMessage.Size = new System.Drawing.Size(385, 23);
+ this.buttonStartWithMessage.TabIndex = 11;
+ this.buttonStartWithMessage.Text = "Tausche Variable geben Wert (Meldung bei Fehler)";
+ this.buttonStartWithMessage.UseVisualStyleBackColor = true;
+ this.buttonStartWithMessage.Click += new System.EventHandler(this.buttonStartWithMessage_Click_1);
+ //
+ // Form1
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(800, 450);
+ this.Controls.Add(this.buttonStartWithMessage);
+ this.Controls.Add(this.groupBoxProgramInfo);
+ this.Controls.Add(this.groupBoxDLLInfo);
+ this.Controls.Add(this.labelSourceString);
+ this.Controls.Add(this.buttonStart);
+ this.Controls.Add(this.labelResult);
+ this.Name = "Form1";
+ this.Text = "Test_ReplaceVariableByValue";
+ this.Load += new System.EventHandler(this.Form1_Load);
+ this.groupBoxProgramInfo.ResumeLayout(false);
+ this.groupBoxProgramInfo.PerformLayout();
+ this.groupBoxDLLInfo.ResumeLayout(false);
+ this.groupBoxDLLInfo.PerformLayout();
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.Label labelResult;
+ private System.Windows.Forms.Button buttonStart;
+ private System.Windows.Forms.Label labelSourceString;
+ private System.Windows.Forms.GroupBox groupBoxProgramInfo;
+ private System.Windows.Forms.Label labelProgramInfo;
+ private System.Windows.Forms.GroupBox groupBoxDLLInfo;
+ private System.Windows.Forms.Label labelDLLInfo;
+ private System.Windows.Forms.Button buttonStartWithMessage;
+ }
+}
+
diff --git a/Test_ReplaceVariableByValue/Form1.cs b/Test_ReplaceVariableByValue/Form1.cs
new file mode 100644
index 0000000..4f146f8
--- /dev/null
+++ b/Test_ReplaceVariableByValue/Form1.cs
@@ -0,0 +1,179 @@
+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 = GenerateCopyright();
+ 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;
+ }
+
+ private static string CurrentYear()
+ {
+ DateTime dtn = DateTime.Now;
+ return dtn.Year.ToString();
+ }
+
+ private static string StartYear()
+ {
+ //string startYear = ((AssemblyCopyrightAttribute)attributes[0]).Copyright;
+ //return startYear.Remove(0, startYear.LastIndexOf(" ") + 1);
+ string startYear = "";
+ if (((AssemblyCopyrightAttribute)attributes[0]).Copyright.Contains("Copyright © "))
+ {
+ startYear = ((AssemblyCopyrightAttribute)attributes[0]).Copyright.Replace("Copyright © ", "");
+ while (startYear.StartsWith(" "))
+ {
+ startYear = startYear.Remove(0, 1);
+ }
+ startYear = startYear.Remove(startYear.IndexOf(" "));
+ return startYear;
+ }
+ else
+ {
+ DateTime dtn = DateTime.Now;
+ return dtn.Year.ToString();
+ }
+ }
+
+ private static string GenerateCopyright()
+ {
+ string startYear = StartYear();
+ string currentYear = CurrentYear();
+
+ if (startYear == currentYear)
+ {
+ return ((AssemblyCopyrightAttribute)attributes[0]).Copyright;
+ }
+ else
+ {
+ //return String.Concat(((AssemblyCopyrightAttribute)attributes[0]).Copyright, "-", currentYear);
+ return ((AssemblyCopyrightAttribute)attributes[0]).Copyright.Replace(startYear, String.Concat(startYear, "-", currentYear));
+ }
+ }
+ #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()
+ {
+ InitializeComponent();
+ SetProgramInfo(); //Name, Version und Copyright setzen
+ }
+
+ private void Form1_Load(object sender, EventArgs e)
+ {
+ ShowInformation(); //Programm- und DLL-Information anzeigen
+
+ labelSourceString.Text = String.Concat("Ursprünglicher Text mit Umgebungsvariablen:\n", text);
+ }
+
+ 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.";
+
+ private void ShowInformation()
+ {
+ labelProgramInfo.Text = String.Concat(ProgramName, "\n", ProgramVersion, "\n", Copyright); //Programm-Information anzeigen
+
+ // DLL-Information anzeigen
+ labelDLLInfo.Text = String.Concat(ReplaceVariableByValue.DllName, "\n", ReplaceVariableByValue.DllVersion, "\n", ReplaceVariableByValue.Copyright);
+ }
+
+ private void buttonStart_Click(object sender, EventArgs e)
+ {
+ //
+ //Diese Zeile in das Programm kopieren
+ //
+ //Tauscht bekannte Umgebungsvariblen gegen ihren Wert aus. Unbekannte Umgebungsvariablen werden nicht getauscht.
+ string textNeu = ReplaceVariableByValue.Replace(text);
+
+ labelResult.Text = String.Concat("Text in dem bekannte Umgebungsvariablen gegen Werte getauscht wurden:\n\n", textNeu); //Hier wird der Text beispielhaft ausgegeben
+ //
+ }
+
+ private void buttonStartWithMessage_Click(object sender, EventArgs e)
+ {
+ //
+ //Diese Zeilen in das Programm kopieren
+ //
+ //Tauscht bekannte Umgebungsvariblen gegen ihren Wert aus. Unbekannte Umgebungsvariablen lösen eine Exception aus.
+ try
+ {
+ labelResult.Text = "Text in dem bekannte Umgebungsvariablen gegen Werte getauscht wurden:"; //Text zurück setzen, falls schon etwas drinnen steht
+ string textNeu = ReplaceVariableByValue.Replace(text, true);
+ labelResult.Text = String.Concat("Text in dem bekannte Umgebungsvariablen gegen Werte getauscht wurden:\n\n", textNeu); //Hier wird der Text beispielhaft ausgegeben
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message);
+ }
+ //
+ }
+
+ private void buttonStartWithMessage_Click_1(object sender, EventArgs e)
+ {
+
+ //Diese Zeilen in das Programm kopieren
+ //
+ //Tauscht bekannte Umgebungsvariblen gegen ihren Wert aus. Unbekannte Umgebungsvariablen lösen eine Exception aus.
+ try
+ {
+ labelResult.Text = "Text in dem bekannte Umgebungsvariablen gegen Werte getauscht wurden:"; //Text zurück setzen, falls schon etwas drinnen steht
+ string textNeu = ReplaceVariableByValue.Replace(text, true);
+ labelResult.Text = String.Concat("Text in dem bekannte Umgebungsvariablen gegen Werte getauscht wurden:\n\n", textNeu); //Hier wird der Text beispielhaft ausgegeben
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message);
+ }
+ //
+ }
+ }
+}
diff --git a/Test_VaribleThroughString/Form1.de.resx b/Test_ReplaceVariableByValue/Form1.de.resx
similarity index 92%
rename from Test_VaribleThroughString/Form1.de.resx
rename to Test_ReplaceVariableByValue/Form1.de.resx
index a5c621a..b7b2b94 100644
--- a/Test_VaribleThroughString/Form1.de.resx
+++ b/Test_ReplaceVariableByValue/Form1.de.resx
@@ -124,4 +124,16 @@
648, 292
+
+ Tausche Variable geben Wert (Ohne Meldung bei Fehler)
+
+
+ Tausche Variable geben Wert (Meldung bei Fehler)
+
+
+ DLL Information
+
+
+ Programm Information
+
\ No newline at end of file
diff --git a/Test_VaribleThroughString/Form1.en.resx b/Test_ReplaceVariableByValue/Form1.en.resx
similarity index 97%
rename from Test_VaribleThroughString/Form1.en.resx
rename to Test_ReplaceVariableByValue/Form1.en.resx
index 6b601ff..c3745d1 100644
--- a/Test_VaribleThroughString/Form1.en.resx
+++ b/Test_ReplaceVariableByValue/Form1.en.resx
@@ -117,18 +117,18 @@
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- 304, 23
-
Replace variable through value (without message when error)
+
+ Program Information
+
+
- 339, 257
+ 413, 343
- 297, 23
+ 375, 23
Replace variable through value (with message when error)
diff --git a/Test_ReplaceVariableByValue/Form1.resx b/Test_ReplaceVariableByValue/Form1.resx
new file mode 100644
index 0000000..1af7de1
--- /dev/null
+++ b/Test_ReplaceVariableByValue/Form1.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/Test_VaribleThroughString/Program.cs b/Test_ReplaceVariableByValue/Program.cs
similarity index 100%
rename from Test_VaribleThroughString/Program.cs
rename to Test_ReplaceVariableByValue/Program.cs
diff --git a/Test_VaribleThroughString/Properties/AssemblyInfo.cs b/Test_ReplaceVariableByValue/Properties/AssemblyInfo.cs
similarity index 92%
rename from Test_VaribleThroughString/Properties/AssemblyInfo.cs
rename to Test_ReplaceVariableByValue/Properties/AssemblyInfo.cs
index d52c5a7..2c30a05 100644
--- a/Test_VaribleThroughString/Properties/AssemblyInfo.cs
+++ b/Test_ReplaceVariableByValue/Properties/AssemblyInfo.cs
@@ -5,11 +5,11 @@ using System.Runtime.InteropServices;
// Allgemeine Informationen über eine Assembly werden über die folgenden
// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
// die einer Assembly zugeordnet sind.
-[assembly: AssemblyTitle("Test_VaribleThroughString")]
+[assembly: AssemblyTitle("Test_ReplaceVariableByValue")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("Test_VaribleThroughString")]
+[assembly: AssemblyProduct("Test_ReplaceVariableByValue")]
[assembly: AssemblyCopyright("Copyright © 2019 by Eugen Höglinger")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
diff --git a/Test_VaribleThroughString/Properties/Resources.Designer.cs b/Test_ReplaceVariableByValue/Properties/Resources.Designer.cs
similarity index 98%
rename from Test_VaribleThroughString/Properties/Resources.Designer.cs
rename to Test_ReplaceVariableByValue/Properties/Resources.Designer.cs
index 3dfeed8..0dd567a 100644
--- a/Test_VaribleThroughString/Properties/Resources.Designer.cs
+++ b/Test_ReplaceVariableByValue/Properties/Resources.Designer.cs
@@ -8,7 +8,7 @@
//
//------------------------------------------------------------------------------
-namespace Test_VaribleThroughString.Properties
+namespace Test_ReplaceVariableByValue.Properties
{
diff --git a/Test_VaribleThroughString/Properties/Resources.resx b/Test_ReplaceVariableByValue/Properties/Resources.resx
similarity index 100%
rename from Test_VaribleThroughString/Properties/Resources.resx
rename to Test_ReplaceVariableByValue/Properties/Resources.resx
diff --git a/Test_VaribleThroughString/Properties/Settings.Designer.cs b/Test_ReplaceVariableByValue/Properties/Settings.Designer.cs
similarity index 95%
rename from Test_VaribleThroughString/Properties/Settings.Designer.cs
rename to Test_ReplaceVariableByValue/Properties/Settings.Designer.cs
index 3b60519..35964c7 100644
--- a/Test_VaribleThroughString/Properties/Settings.Designer.cs
+++ b/Test_ReplaceVariableByValue/Properties/Settings.Designer.cs
@@ -8,7 +8,7 @@
//
//------------------------------------------------------------------------------
-namespace Test_VaribleThroughString.Properties
+namespace Test_ReplaceVariableByValue.Properties
{
diff --git a/Test_VaribleThroughString/Properties/Settings.settings b/Test_ReplaceVariableByValue/Properties/Settings.settings
similarity index 100%
rename from Test_VaribleThroughString/Properties/Settings.settings
rename to Test_ReplaceVariableByValue/Properties/Settings.settings
diff --git a/Test_VaribleThroughString/Test_VaribleThroughString.csproj b/Test_ReplaceVariableByValue/Test_ReplaceVariableByValue.csproj
similarity index 94%
rename from Test_VaribleThroughString/Test_VaribleThroughString.csproj
rename to Test_ReplaceVariableByValue/Test_ReplaceVariableByValue.csproj
index d58d8d0..f884646 100644
--- a/Test_VaribleThroughString/Test_VaribleThroughString.csproj
+++ b/Test_ReplaceVariableByValue/Test_ReplaceVariableByValue.csproj
@@ -6,8 +6,8 @@
AnyCPU
{196A7F39-5BDA-4E02-84E8-B30973309C8B}
WinExe
- Test_VaribleThroughString
- Test_VaribleThroughString
+ Test_ReplaceVariableByValue
+ Test_ReplaceVariableByValue
v4.6.1
512
true
@@ -86,7 +86,7 @@
-
+
{8d5c22c1-dd1a-4a28-b636-445f02adb815}
VaribleThroughString
diff --git a/Test_VaribleThroughString/Form1.Designer.cs b/Test_VaribleThroughString/Form1.Designer.cs
deleted file mode 100644
index 2fa0bb9..0000000
--- a/Test_VaribleThroughString/Form1.Designer.cs
+++ /dev/null
@@ -1,92 +0,0 @@
-namespace Eugen.ESystem
-{
- partial class Form1
- {
- ///
- /// Erforderliche Designervariable.
- ///
- private System.ComponentModel.IContainer components = null;
-
- ///
- /// Verwendete Ressourcen bereinigen.
- ///
- /// True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False.
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
- #region Vom Windows Form-Designer generierter Code
-
- ///
- /// Erforderliche Methode für die Designerunterstützung.
- /// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden.
- ///
- private void InitializeComponent()
- {
- System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
- this.labelResult = new System.Windows.Forms.Label();
- this.buttonStart = new System.Windows.Forms.Button();
- this.labelSourceString = new System.Windows.Forms.Label();
- this.labelDllInfo = new System.Windows.Forms.Label();
- this.buttonStartWithMessage = new System.Windows.Forms.Button();
- this.SuspendLayout();
- //
- // labelResult
- //
- resources.ApplyResources(this.labelResult, "labelResult");
- this.labelResult.Name = "labelResult";
- //
- // buttonStart
- //
- resources.ApplyResources(this.buttonStart, "buttonStart");
- this.buttonStart.Name = "buttonStart";
- this.buttonStart.UseVisualStyleBackColor = true;
- this.buttonStart.Click += new System.EventHandler(this.buttonStart_Click);
- //
- // labelSourceString
- //
- resources.ApplyResources(this.labelSourceString, "labelSourceString");
- this.labelSourceString.Name = "labelSourceString";
- //
- // labelDllInfo
- //
- resources.ApplyResources(this.labelDllInfo, "labelDllInfo");
- this.labelDllInfo.Name = "labelDllInfo";
- //
- // buttonStartWithMessage
- //
- resources.ApplyResources(this.buttonStartWithMessage, "buttonStartWithMessage");
- this.buttonStartWithMessage.Name = "buttonStartWithMessage";
- this.buttonStartWithMessage.UseVisualStyleBackColor = true;
- this.buttonStartWithMessage.Click += new System.EventHandler(this.buttonStartWithMessage_Click);
- //
- // Form1
- //
- resources.ApplyResources(this, "$this");
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.Controls.Add(this.buttonStartWithMessage);
- this.Controls.Add(this.labelDllInfo);
- this.Controls.Add(this.labelSourceString);
- this.Controls.Add(this.buttonStart);
- this.Controls.Add(this.labelResult);
- this.Name = "Form1";
- this.ResumeLayout(false);
- this.PerformLayout();
-
- }
-
- #endregion
-
- private System.Windows.Forms.Label labelResult;
- private System.Windows.Forms.Button buttonStart;
- private System.Windows.Forms.Label labelSourceString;
- private System.Windows.Forms.Label labelDllInfo;
- private System.Windows.Forms.Button buttonStartWithMessage;
- }
-}
-
diff --git a/Test_VaribleThroughString/Form1.cs b/Test_VaribleThroughString/Form1.cs
deleted file mode 100644
index ec2a00c..0000000
--- a/Test_VaribleThroughString/Form1.cs
+++ /dev/null
@@ -1,115 +0,0 @@
-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;
- }
- }
-}
diff --git a/Test_VaribleThroughString/Form1.resx b/Test_VaribleThroughString/Form1.resx
deleted file mode 100644
index f031b66..0000000
--- a/Test_VaribleThroughString/Form1.resx
+++ /dev/null
@@ -1,276 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
-
- 12, 9
-
-
- $this
-
-
- System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- 6, 13
-
-
-
- Bottom, Right
-
-
- 4
-
-
- 12, 83
-
-
-
- 2
-
-
- System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- buttonStart
-
-
- 16, 13
-
-
- 0
-
-
- System.Windows.Forms.Form, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- True
-
-
- 0
-
-
- Form1
-
-
- ...
-
-
- $this
-
-
- 290, 23
-
-
- $this
-
-
- labelResult
-
-
- 12, 257
-
-
- True
-
-
- True
-
-
- 648, 292
-
-
- System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- $this
-
-
- Bottom, Left
-
-
- System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- 2
-
-
- 4
-
-
- 3
-
-
- 3
-
-
- 1
-
-
- 1
-
-
- $this
-
-
- 379, 257
-
-
- 257, 23
-
-
- labelSourceString
-
-
- buttonStartWithMessage
-
-
- 16, 13
-
-
- labelDllInfo
-
-
- Tausche Varable geben Wert (Meldung bei Fehler)
-
-
- 15, 171
-
-
- ...
-
-
- 16, 13
-
-
- Form1
-
-
- ...
-
-
- Tausche Varable geben Wert (Ohne Meldung bei Fehler)
-
-
- True
-
-
\ No newline at end of file