Projektdateien hinzufügen.

This commit is contained in:
mr_sc
2026-09-03 21:32:00 +02:00
parent 092c5fa09c
commit f6d0eaecaa
500 changed files with 115722 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net48</TargetFramework>
<LangVersion>latest</LangVersion>
<AssemblyName>IMSApiDotNet.LegacyBinarySmoke</AssemblyName>
<PlatformTarget>AnyCPU</PlatformTarget>
</PropertyGroup>
<ItemGroup>
<!-- IMPORTANT: this executable is compiled against the untouched legacy DLL. -->
<Reference Include="IMSApiDotNet">
<HintPath>..\..\reference\IMSApiDotNet_10.0.0-3_original.dll</HintPath>
<Private>false</Private>
</Reference>
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies.net48" Version="1.0.3" PrivateAssets="all" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,80 @@
using System;
using System.Reflection;
using com.itac.mes.imsapi.client.dotnet;
internal static class Program
{
private static int Fail(string text)
{
Console.Error.WriteLine("ABI FAIL: " + text);
return 2;
}
private static int Main()
{
try
{
// This call is intentionally compiled against 10.0.0-3. The resulting EXE
// must run unchanged after IMSApiDotNet.dll is replaced by either new target.
IMSApiDotNet.setProperty("itac.appid", "LegacyBinarySmoke");
IMSApiDotNet a = IMSApiDotNet.loadLibrary();
IMSApiDotNet b = IMSApiDotNet.loadLibrary();
if (a == null || b == null) return Fail("loadLibrary returned null");
if (!object.ReferenceEquals(a, b)) return Fail("legacy singleton behavior changed");
string version = null;
int rc = a.imsapiGetLibraryVersion(ref version);
if (rc != IMSApiDotNetConstants.RES_OK) return Fail("imsapiGetLibraryVersion return code " + rc);
if (string.IsNullOrEmpty(version)) return Fail("empty library version");
// Reflection checks the declaring type and static/instance metadata that caused
// MissingMethodException in existing applications.
MethodInfo setProperty = typeof(IMSApiDotNetBase).GetMethod(
"setProperty",
BindingFlags.Public | BindingFlags.Static,
null,
new[] { typeof(string), typeof(string) },
null);
if (setProperty == null) return Fail("IMSApiDotNetBase.setProperty(string,string) static missing");
if (setProperty.ReturnType != typeof(void)) return Fail("setProperty return type changed");
if (setProperty.DeclaringType != typeof(IMSApiDotNetBase)) return Fail("setProperty declaring type changed");
MethodInfo loadLibrary = typeof(IMSApiDotNet).GetMethod(
"loadLibrary",
BindingFlags.Public | BindingFlags.Static,
null,
Type.EmptyTypes,
null);
if (loadLibrary == null || loadLibrary.ReturnType != typeof(IMSApiDotNet))
return Fail("IMSApiDotNet.loadLibrary() signature changed");
if (!typeof(IMSApiDotNetConstants).IsAssignableFrom(typeof(IMSApiDotNetBase)))
return Fail("IMSApiDotNetBase no longer derives from IMSApiDotNetConstants");
MethodInfo getError = typeof(IMSApiDotNetConstants).GetMethod(
"getIMSApiDotNetErrorText",
new[] { typeof(int) });
if (getError == null || getError.ReturnType != typeof(string))
return Fail("IMSApiDotNetConstants.getIMSApiDotNetErrorText(int) missing");
Console.WriteLine("ABI OK");
Console.WriteLine("Loaded: " + typeof(IMSApiDotNet).Assembly.FullName);
Console.WriteLine("Path: " + typeof(IMSApiDotNet).Assembly.Location);
Console.WriteLine("API: " + version);
return 0;
}
catch (MissingMethodException ex)
{
return Fail(ex.ToString());
}
catch (TypeLoadException ex)
{
return Fail(ex.ToString());
}
catch (Exception ex)
{
return Fail(ex.ToString());
}
}
}

View File

@@ -0,0 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net48;net8.0</TargetFrameworks>
<LangVersion>latest</LangVersion>
<Nullable>disable</Nullable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\IMSApiDotNet\IMSApiDotNet.csproj" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net48'">
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies.net48" Version="1.0.3" PrivateAssets="all" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,93 @@
using System;
using System.IO;
using com.itac.mes.imsapi.client.dotnet;
internal sealed class Probe : IMSApiDotNetBase
{
public string Get(string key, string fallback = null) => Prop(key, fallback);
public override int imsapiGetLibraryVersion(ref string libraryVersion)
{
libraryVersion = "probe";
return 0;
}
}
internal static class Program
{
private static int Main(string[] args)
{
string assemblyLocation = typeof(IMSApiDotNetBase).Assembly.Location;
string assemblyDirectory = Path.GetDirectoryName(Path.GetFullPath(assemblyLocation));
if (string.IsNullOrWhiteSpace(assemblyDirectory))
{
Console.Error.WriteLine("Unable to resolve IMSApiDotNet.dll directory.");
return 2;
}
string file = Path.Combine(assemblyDirectory, "ihas.properties");
string oldCwd = Directory.GetCurrentDirectory();
string wrongDirectory = Path.Combine(Path.GetTempPath(), "IMSApiDotNet-ihas-wrong-" + Guid.NewGuid().ToString("N"));
Directory.CreateDirectory(wrongDirectory);
try
{
// Correct file: it MUST be located next to the loaded IMSApiDotNet.dll.
File.WriteAllText(file,
"# FIX6 DLL-directory property smoke test\r\n" +
"file.only=from-dll-directory\r\n" +
"precedence=from-file\r\n" +
"itac.appid=FromDllProperties\r\n" +
"itac.artes.clusternodes=https://partner.itacsoftware.com:8181/mes\r\n");
// Deliberately place conflicting files elsewhere. Neither the current
// working directory nor itac.propdir may control the physical file
// lookup anymore.
File.WriteAllText(Path.Combine(wrongDirectory, "ihas.properties"),
"file.only=WRONG-DIRECTORY\r\n" +
"itac.appid=WrongDirectory\r\n");
Directory.SetCurrentDirectory(wrongDirectory);
IMSApiDotNet.setProperty("itac.propdir", wrongDirectory);
// Programmatic values still override the same key from ihas.properties.
IMSApiDotNet.setProperty("precedence", "from-setProperty");
var p = new Probe();
if (p.Get("file.only") != "from-dll-directory") return Fail("file.only", p.Get("file.only"), "from-dll-directory");
if (p.Get("precedence") != "from-setProperty") return Fail("precedence", p.Get("precedence"), "from-setProperty");
if (p.Get("missing", "fallback") != "fallback") return Fail("missing", p.Get("missing", "fallback"), "fallback");
if (p.Get("itac.appid") != "FromDllProperties") return Fail("itac.appid", p.Get("itac.appid"), "FromDllProperties");
if (p.Get("itac.artes.clusternodes") != "https://partner.itacsoftware.com:8181/mes")
return Fail("itac.artes.clusternodes", p.Get("itac.artes.clusternodes"), "https://partner.itacsoftware.com:8181/mes");
// Verify the real public API reports the raw file value. Programmatic
// setProperty must not replace this diagnostic line.
IMSApiDotNet.setProperty("itac.artes.clusternodes", "https://override.invalid/mes");
string libraryVersion = null;
var api = IMSApiDotNet.loadLibrary();
int versionRc = api.imsapiGetLibraryVersion(ref libraryVersion);
if (versionRc != 0) return Fail("imsapiGetLibraryVersion rc", versionRc.ToString(), "0");
if (libraryVersion == null || libraryVersion.IndexOf("itac.artes.clusternodes=https://partner.itacsoftware.com:8181/mes", StringComparison.Ordinal) < 0)
return Fail("libraryVersion cluster node", libraryVersion, "raw ihas.properties cluster node");
if (libraryVersion.IndexOf(file, StringComparison.OrdinalIgnoreCase) < 0)
return Fail("libraryVersion ihas.properties path", libraryVersion, file);
Console.WriteLine("PASS dll-directory");
Console.WriteLine(libraryVersion);
Console.WriteLine("IMSApiDotNet.dll: " + assemblyLocation);
Console.WriteLine("ihas.properties: " + file);
return 0;
}
finally
{
Directory.SetCurrentDirectory(oldCwd);
try { if (File.Exists(file)) File.Delete(file); } catch { }
try { if (Directory.Exists(wrongDirectory)) Directory.Delete(wrongDirectory, true); } catch { }
}
}
private static int Fail(string key, string actual, string expected)
{
Console.Error.WriteLine("FAIL " + key + ": actual=<" + actual + "> expected=<" + expected + ">");
return 1;
}
}

View File

@@ -0,0 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup><OutputType>Exe</OutputType><TargetFramework>net7.0</TargetFramework><LangVersion>latest</LangVersion></PropertyGroup>
<ItemGroup><ProjectReference Include="..\..\src\IMSApiDotNet\IMSApiDotNet.csproj" /></ItemGroup>
</Project>

View File

@@ -0,0 +1,24 @@
using System;
using com.itac.mes.imsapi.domain.container;
using com.itac.mes.imsapi.protocol;
static string Hex(byte[] b)=>BitConverter.ToString(b).Replace("-","").ToLowerInvariant();
static void Eq(string label,string got,string expected){if(got!=expected)throw new Exception(label+" mismatch\n"+got);Console.WriteLine(label+" OK");}
var ctx=new IMSApiSessionContextStruct(123456789L,42L,"de_DE");
foreach(var item in new[] {
(IhapProtocolMode.BinaryHash, "BINARY_HASH"),
(IhapProtocolMode.BinaryField, "BINARY_FIELD")
})
{
Eq(item.Item2+" imsapiGetErrorText",Hex(IhapProtocol.SerializeCall("imsapiGetErrorText_com.itac.mes.imsapi.domain.container.IMSApiSessionContextStruct_int",item.Item1,ctx,-901)),item.Item1==IhapProtocolMode.BinaryHash?"690101130056696d736170694765744572726f72546578745f636f6d2e697461632e6d65732e696d736170692e646f6d61696e2e636f6e7461696e65722e494d5341706953657373696f6e436f6e746578745374727563745f696e74621413003f636f6d2e697461632e6d65732e696d736170692e646f6d61696e2e636f6e7461696e65722e494d5341706953657373696f6e436f6e746578745374727563740f2d4205f8dd64655f4445c82a0f075bcd15947b":"691101130056696d736170694765744572726f72546578745f636f6d2e697461632e6d65732e696d736170692e646f6d61696e2e636f6e7461696e65722e494d5341706953657373696f6e436f6e746578745374727563745f696e74621413003f636f6d2e697461632e6d65732e696d736170692e646f6d61696e2e636f6e7461696e65722e494d5341706953657373696f6e436f6e7465787453747275637463df6c6f63616c6530dd64655f4445df70657273496430c82ae273657373696f6e4964300f075bcd15947b" );
Eq(item.Item2+" regLogout",Hex(IhapProtocol.SerializeCall("regLogout_com.itac.mes.imsapi.domain.container.IMSApiSessionContextStruct",item.Item1,ctx)),item.Item1==IhapProtocolMode.BinaryHash?"6901011300497265674c6f676f75745f636f6d2e697461632e6d65732e696d736170692e646f6d61696e2e636f6e7461696e65722e494d5341706953657373696f6e436f6e74657874537472756374611413003f636f6d2e697461632e6d65732e696d736170692e646f6d61696e2e636f6e7461696e65722e494d5341706953657373696f6e436f6e746578745374727563740f2d4205f8dd64655f4445c82a0f075bcd15":"6911011300497265674c6f676f75745f636f6d2e697461632e6d65732e696d736170692e646f6d61696e2e636f6e7461696e65722e494d5341706953657373696f6e436f6e74657874537472756374611413003f636f6d2e697461632e6d65732e696d736170692e646f6d61696e2e636f6e7461696e65722e494d5341706953657373696f6e436f6e7465787453747275637463df6c6f63616c6530dd64655f4445df70657273496430c82ae273657373696f6e4964300f075bcd15" );
var objects=new object[]{null,true,false,unchecked((byte)-5),'Ä',0.0d,1.0d,-17,47,48,-2049,2047,2048,-262145,262143,262144,-9L,15L,16L,2147483648L,"hello","äöü",new int[]{-17,0,48},new string[]{"A",null,"B"},new KeyValue("ABC","XYZ")};
Eq(item.Item2+" primitive_objects",Hex(IhapProtocol.SerializeObjectsForDiagnostics(item.Item1,objects)),item.Item1==IhapProtocolMode.BinaryHash?"00020103fb0400c4050697ef8f9830a3f7ff9fffa408000efffbffffa7ffff0e00040000c7f7bfc810100000000080000000dd68656c6c6fdbc3a4c3b6c3bc206397ef6098302363d94100d9421413002d636f6d2e697461632e6d65732e696d736170692e646f6d61696e2e636f6e7461696e65722e4b657956616c75650f220e052fdb414243db58595a":"00020103fb0400c4050697ef8f9830a3f7ff9fffa408000efffbffffa7ffff0e00040000c7f7bfc810100000000080000000dd68656c6c6fdbc3a4c3b6c3bc206397ef6098302363d94100d9421413002d636f6d2e697461632e6d65732e696d736170692e646f6d61696e2e636f6e7461696e65722e4b657956616c756562dc6b657930db414243de76616c756530db58595a" );
}
var rh=(Result_imsapiGetErrorText)IhapProtocol.DeserializeReply(Convert.FromHexString("6901021413003e636f6d2e697461632e6d65732e696d736170692e646f6d61696e2e636f6e7461696e65722e526573756c745f696d736170694765744572726f72546578740f139503e3de5465737420c38460"));
if(rh.return_value!=0 || rh.errorString!="Test Ä")throw new Exception("BINARY_HASH reply decode mismatch");
Console.WriteLine("BINARY_HASH reply decode OK");
var rf=(Result_imsapiGetErrorText)IhapProtocol.DeserializeReply(Convert.FromHexString("6911021413003e636f6d2e697461632e6d65732e696d736170692e646f6d61696e2e636f6e7461696e65722e526573756c745f696d736170694765744572726f725465787462e46572726f72537472696e6730de5465737420c384e572657475726e5f76616c75653060"));
if(rf.return_value!=0 || rf.errorString!="Test Ä")throw new Exception("BINARY_FIELD reply decode mismatch");
Console.WriteLine("BINARY_FIELD reply decode OK");