Added check on network axc files (if exists, take that), added resources for static strings

This commit is contained in:
Davide Conforti
2022-05-04 10:58:47 +02:00
parent 9efae80126
commit 4980d300d7
5 changed files with 317 additions and 12 deletions
+21 -8
View File
@@ -28,27 +28,40 @@ namespace wpf_ax_utility
{ {
Utility.AucCleaner(); Utility.AucCleaner();
string AxArgs = string.Empty; string AxcFilePath = "";
switch (((Button)sender).Name) switch (((Button)sender).Name)
{ {
case "LIVE": case "LIVE":
AxArgs = @"-regConfig=axc\PAL_LIVE_USR.axc"; AxcFilePath = Properties.Resources.network_axc_path + Properties.Resources.LIVE_axc_filename;
if(!File.Exists(AxcFilePath))
AxcFilePath = Properties.Resources.local_axc_path + Properties.Resources.LIVE_axc_filename;
break; break;
case "LIVE02": case "LIVE02":
AxArgs = @"-regConfig=axc\PAL_LIVE_02_USR.axc"; AxcFilePath = Properties.Resources.network_axc_path + Properties.Resources.LIVE02_axc_filename;
if (!File.Exists(AxcFilePath))
AxcFilePath = Properties.Resources.local_axc_path + Properties.Resources.LIVE02_axc_filename;
break; break;
case "DEV": case "DEV":
AxArgs = @"-regConfig=axc\PAL_DEVELOP_USR.axc"; AxcFilePath = Properties.Resources.network_axc_path + Properties.Resources.DEV_axc_filename;
if (!File.Exists(AxcFilePath))
AxcFilePath = Properties.Resources.local_axc_path + Properties.Resources.DEV_axc_filename;
break; break;
case "TEST": case "TEST":
AxArgs = @"-regConfig=axc\PAL_TEST_USR.axc"; AxcFilePath = Properties.Resources.network_axc_path + Properties.Resources.TEST_axc_filename;
if (!File.Exists(AxcFilePath))
AxcFilePath = Properties.Resources.local_axc_path + Properties.Resources.TEST_axc_filename;
break; break;
case "STAGING": case "STAGING":
AxArgs = @"-regConfig=axc\PAL_STAGING_USR.axc"; AxcFilePath = Properties.Resources.network_axc_path + Properties.Resources.STAGING_axc_filename;
break; ; if (!File.Exists(AxcFilePath))
AxcFilePath = Properties.Resources.local_axc_path + Properties.Resources.STAGING_axc_filename;
break;
} }
var AxArgs = @"-regConfig=" + AxcFilePath;
Utility.AxExecution(AxArgs); Utility.AxExecution(AxArgs);
Log.Logger.Information("Running AX client with this parameter: " + AxArgs); Log.Logger.Information("Running AX client with this parameter: " + AxArgs);
+135
View File
@@ -0,0 +1,135 @@
//------------------------------------------------------------------------------
// <auto-generated>
// Il codice è stato generato da uno strumento.
// Versione runtime:4.0.30319.42000
//
// Le modifiche apportate a questo file possono provocare un comportamento non corretto e andranno perse se
// il codice viene rigenerato.
// </auto-generated>
//------------------------------------------------------------------------------
namespace wpf_ax_utility.Properties {
using System;
/// <summary>
/// Classe di risorse fortemente tipizzata per la ricerca di stringhe localizzate e così via.
/// </summary>
// Questa classe è stata generata automaticamente dalla classe StronglyTypedResourceBuilder.
// tramite uno strumento quale ResGen o Visual Studio.
// Per aggiungere o rimuovere un membro, modificare il file con estensione ResX ed eseguire nuovamente ResGen
// con l'opzione /str oppure ricompilare il progetto VS.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Restituisce l'istanza di ResourceManager nella cache utilizzata da questa classe.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("wpf_ax_utility.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Esegue l'override della proprietà CurrentUICulture del thread corrente per tutte le
/// ricerche di risorse eseguite utilizzando questa classe di risorse fortemente tipizzata.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Cerca una stringa localizzata simile a C:\Program Files (x86)\Microsoft Dynamics AX\60\Client\Bin\Ax32.exe.
/// </summary>
internal static string Ax32_exe_filepath {
get {
return ResourceManager.GetString("Ax32_exe_filepath", resourceCulture);
}
}
/// <summary>
/// Cerca una stringa localizzata simile a PAL_DEVELOP_USR.axc.
/// </summary>
internal static string DEV_axc_filename {
get {
return ResourceManager.GetString("DEV_axc_filename", resourceCulture);
}
}
/// <summary>
/// Cerca una stringa localizzata simile a PAL_LIVE_USR.axc.
/// </summary>
internal static string LIVE_axc_filename {
get {
return ResourceManager.GetString("LIVE_axc_filename", resourceCulture);
}
}
/// <summary>
/// Cerca una stringa localizzata simile a PAL_LIVE_02_USR.axc.
/// </summary>
internal static string LIVE02_axc_filename {
get {
return ResourceManager.GetString("LIVE02_axc_filename", resourceCulture);
}
}
/// <summary>
/// Cerca una stringa localizzata simile a axc\.
/// </summary>
internal static string local_axc_path {
get {
return ResourceManager.GetString("local_axc_path", resourceCulture);
}
}
/// <summary>
/// Cerca una stringa localizzata simile a \\palaxaos01\XVOL11\Link\.
/// </summary>
internal static string network_axc_path {
get {
return ResourceManager.GetString("network_axc_path", resourceCulture);
}
}
/// <summary>
/// Cerca una stringa localizzata simile a PAL_STAGING_USR.axc.
/// </summary>
internal static string STAGING_axc_filename {
get {
return ResourceManager.GetString("STAGING_axc_filename", resourceCulture);
}
}
/// <summary>
/// Cerca una stringa localizzata simile a PAL_TEST_USR.axc.
/// </summary>
internal static string TEST_axc_filename {
get {
return ResourceManager.GetString("TEST_axc_filename", resourceCulture);
}
}
}
}
+144
View File
@@ -0,0 +1,144 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="Ax32_exe_filepath" xml:space="preserve">
<value>C:\Program Files (x86)\Microsoft Dynamics AX\60\Client\Bin\Ax32.exe</value>
</data>
<data name="DEV_axc_filename" xml:space="preserve">
<value>PAL_DEVELOP_USR.axc</value>
</data>
<data name="LIVE02_axc_filename" xml:space="preserve">
<value>PAL_LIVE_02_USR.axc</value>
</data>
<data name="LIVE_axc_filename" xml:space="preserve">
<value>PAL_LIVE_USR.axc</value>
</data>
<data name="local_axc_path" xml:space="preserve">
<value>axc\</value>
</data>
<data name="network_axc_path" xml:space="preserve">
<value>\\palaxaos01\XVOL11\Link\</value>
</data>
<data name="STAGING_axc_filename" xml:space="preserve">
<value>PAL_STAGING_USR.axc</value>
</data>
<data name="TEST_axc_filename" xml:space="preserve">
<value>PAL_TEST_USR.axc</value>
</data>
</root>
+2 -4
View File
@@ -20,12 +20,10 @@ namespace wpf_ax_utility
{ {
try try
{ {
string AxClient = @"C:\Program Files (x86)\Microsoft Dynamics AX\60\Client\Bin\Ax32.exe"; if (System.IO.File.Exists(Properties.Resources.Ax32_exe_filepath))
if (System.IO.File.Exists(AxClient))
{ {
var p = new System.Diagnostics.Process(); var p = new System.Diagnostics.Process();
p.StartInfo.FileName = AxClient; p.StartInfo.FileName = Properties.Resources.Ax32_exe_filepath;
p.StartInfo.Arguments = AxArgs; p.StartInfo.Arguments = AxArgs;
p.StartInfo.RedirectStandardOutput = true; p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.UseShellExecute = false; p.StartInfo.UseShellExecute = false;
+15
View File
@@ -35,6 +35,21 @@
<Folder Include="axc\" /> <Folder Include="axc\" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Compile Update="Properties\Resources.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
<ItemGroup> <ItemGroup>
<None Update="axc\PAL_DEVELOP_USR.axc"> <None Update="axc\PAL_DEVELOP_USR.axc">
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>