This commit is contained in:
Meik
2025-11-11 11:03:42 +01:00
commit dc3e8a2e4c
582 changed files with 191465 additions and 0 deletions

View File

@@ -0,0 +1,126 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{21E9B41E-28F4-421B-B69B-0CD2D347744B}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>FasdCockpitCommunication</RootNamespace>
<AssemblyName>F4SD-Cockpit-Client-Communication</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>false</Deterministic>
<SccProjectName>SAK</SccProjectName>
<SccLocalPath>SAK</SccLocalPath>
<SccAuxPath>SAK</SccAuxPath>
<SccProvider>SAK</SccProvider>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Demo%28Debug%29|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\Demo%28Debug%29\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<LangVersion>7.3</LangVersion>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'NewFeatures%28Debug%29|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\NewFeatures%28Debug%29\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<LangVersion>7.3</LangVersion>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Web" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\..\C4IT FASD\_Common\C4IT.FASD.Communication.Agent.cs">
<Link>Common\C4IT.FASD.Communication.Agent.cs</Link>
</Compile>
<Compile Include="..\..\C4IT FASD\_Common\C4IT.FASD.Security.cs">
<Link>Common\C4IT.FASD.Security.cs</Link>
</Compile>
<Compile Include="..\..\Common Code\Http\C4IT.HttpHelper.cs">
<Link>Common\C4IT.HttpHelper.cs</Link>
</Compile>
<Compile Include="..\..\Common Code\Logging\C4IT.Logging.LogNetwork.cs">
<Link>Common\C4IT.Logging.LogNetwork.cs</Link>
</Compile>
<Compile Include="..\..\Common Code\Security\C4IT.Security.Base32.cs">
<Link>Common\C4IT.Security.Base32.cs</Link>
</Compile>
<Compile Include="..\..\Common Code\Security\C4IT.Security.OneTimePw.cs">
<Link>Common\C4IT.Security.OneTimePw.cs</Link>
</Compile>
<Compile Include="..\..\Matrix42\M42CommonCode\M42WebClient\C4IT.Matrix42.WebClient.cs">
<Link>Common\C4IT.Matrix42.WebClient.cs</Link>
</Compile>
<Compile Include="..\Shared\SharedAssemblyInfo.cs">
<Link>Properties\SharedAssemblyInfo.cs</Link>
</Compile>
<Compile Include="F4sdCockpitCommunicationM42Web.cs" />
<Compile Include="FasdCockpitCommunicationWeb.cs" />
<Compile Include="FasdCockpitMachineConfiguration.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\F4SD-Logging\F4SD-Logging.csproj">
<Project>{7793f281-b226-4e20-b6f6-5d53d70f1dc1}</Project>
<Name>F4SD-Logging</Name>
</ProjectReference>
<ProjectReference Include="..\FasdCockpitBase\F4SD-Cockpit-Client-Base.csproj">
<Project>{6dced162-2229-4483-ba70-4471bcdd29cf}</Project>
<Name>F4SD-Cockpit-Client-Base</Name>
</ProjectReference>
<ProjectReference Include="..\FasdCockpitCommunicationDemo\F4SD-Cockpit-Client-Demo.csproj">
<Project>{6efd86ac-d73e-47ac-aafc-d8ea3f8ade93}</Project>
<Name>F4SD-Cockpit-Client-Demo</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
</Target>
</Project>

View File

@@ -0,0 +1,10 @@
""
{
"FILE_VERSION" = "9237"
"ENLISTMENT_CHOICE" = "NEVER"
"PROJECT_FILE_RELATIVE_PATH" = ""
"NUMBER_OF_EXCLUDED_FILES" = "0"
"ORIGINAL_PROJECT_FILE_PATH" = ""
"NUMBER_OF_NESTED_PROJECTS" = "0"
"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER"
}

View File

@@ -0,0 +1,131 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Runtime.CompilerServices;
using C4IT.FASD.Base;
using C4IT.FASD.Cockpit.Communication;
using C4IT.Logging;
using static C4IT.Logging.cLogManager;
using C4IT.Matrix42.WebClient;
using System.Collections;
using System.Net;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace C4IT.FASD.Cockpit.Communication
{
internal class cF4sdCockpitCommunicationM42Web : cF4sdCockpitCommunicationM42Base
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private static string getServer()
{
return cCockpitConfiguration.Instance?.m42ServerConfiguration?.Server;
}
public override async Task<cF4sdCockpitM42BearerTokenInfo> ValidateLogonPassthrough()
{
var CM = MethodBase.GetCurrentMethod();
LogMethodBegin(CM);
try
{
var _m42Server = getServer();
if (string.IsNullOrEmpty(_m42Server))
return null;
var _userInfo = await cM42WebClient.LogonWin(_m42Server);
if (_userInfo != null && _userInfo.Reason == cM42WebClient.eReason.ok)
{
return new cF4sdCockpitM42BearerTokenInfo()
{
Token = _userInfo.BearerToken,
ValidUntil = _userInfo.BearerValidUntil
};
}
}
catch (Exception E)
{
LogException(E);
}
finally
{
LogMethodEnd(CM);
}
return null;
}
public override async Task<cF4sdCockpitM42BearerTokenInfo> ValidateLogonBasic(string User, string Password)
{
var CM = MethodBase.GetCurrentMethod();
LogMethodBegin(CM);
try
{
var _m42Server = getServer();
if (string.IsNullOrEmpty(_m42Server))
return null;
NetworkCredential networkCredential = new NetworkCredential(User, Password);
var _userInfo = await cM42WebClient.LogonWin(_m42Server, Credentials: networkCredential);
if (_userInfo != null && _userInfo.Reason == cM42WebClient.eReason.ok)
{
return new cF4sdCockpitM42BearerTokenInfo()
{
Token = _userInfo.BearerToken,
ValidUntil = _userInfo.BearerValidUntil
};
}
}
catch (Exception E)
{
LogException(E);
}
finally
{
LogMethodEnd(CM);
}
return null;
}
public override async Task<cF4sdCockpitM42BearerTokenInfo> ValidateLogonToken(string Token)
{
var CM = MethodBase.GetCurrentMethod();
LogMethodBegin(CM);
try
{
var _m42Server = getServer();
if (string.IsNullOrEmpty(_m42Server))
return null;
var _userInfo = await cM42WebClient.LogonToken(_m42Server, Token);
if (_userInfo != null && _userInfo.Reason == cM42WebClient.eReason.ok)
{
return new cF4sdCockpitM42BearerTokenInfo()
{
Token = _userInfo.BearerToken,
ValidUntil = _userInfo.BearerValidUntil
};
}
}
catch (Exception E)
{
LogException(E);
}
finally
{
LogMethodEnd(CM);
}
return null;
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,36 @@
using C4IT.Configuration;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FasdCockpitCommunication
{
public class cFasdCockpitMachineConfiguration
{
public const string constRegPathConfig = @"Software\Consulting4IT GmbH\First Aid Service Desk\Cockpit";
[RegConfig]
public string ServerUrl = "";
public static cFasdCockpitMachineConfiguration Instance;
static cFasdCockpitMachineConfiguration()
{
Instance = new cFasdCockpitMachineConfiguration();
Instance.Load();
}
public void Load()
{
cConfigRegistryHelper.Load(constRegPathConfig, this, false);
if (ServerUrl.ToLowerInvariant().EndsWith("/api"))
ServerUrl = ServerUrl.Remove(ServerUrl.Length - 3, 3);
else if (!ServerUrl.EndsWith("/"))
ServerUrl += "/";
}
}
}

View File

@@ -0,0 +1,11 @@
using System.Reflection;
using System.Runtime.InteropServices;
using System.Windows;
[assembly: AssemblyTitle("F4SD Cockpit Client communication libary")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("21e9b41e-28f4-421b-b69b-0cd2d347744b")]

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="13.0.3" targetFramework="net472" />
</packages>