Hauptfeatures laufen, Sicherheit eingebaut, Dynamische Programm Location

(Christian Gespräch 02.03.2022, OneNote Notizen 1)
This commit is contained in:
rene
2022-03-02 14:45:33 +01:00
parent a2945ffdb4
commit bae1380d45
21 changed files with 179 additions and 39 deletions

View File

@@ -40,11 +40,10 @@ namespace BeWo
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class BeWoApp : INotifyPropertyChanged
public partial class BeWoApp : Application, INotifyPropertyChanged
{
private static DebugMessageLogView _DebugMessageLogView;
private static FrameworkElement _lockedContent;
public static LoginControl LoginControl;
@@ -787,7 +786,7 @@ namespace BeWo
}
temp = sr.ReadLine();
Loader.Load(temp);
}
}

View File

@@ -23,7 +23,6 @@ namespace BeWo
BeWoApp.UserPassword = password;
BeWoApp.ServerName = servername;
BeWoApp.Tenant = tenant;
////if (coreserveraddress is object)
BeWoApp.ServerAddress = coreserveraddress;
BeWoApp.LoggedOnUser = ServiceFacade.DoUserServiceSync(s => s.LoadUserByNameAndPassword(BeWoApp.UserName, BeWoApp.UserPassword));

View File

@@ -54,7 +54,7 @@ namespace BeWo
CustomerTeam
}
public partial class MainControl
public partial class MainControl : UserControl
{
private const string _PINInfoText = "Um Zugriff auf Ihre Daten zu bekommen, benötigen wir eine PIN.";
private readonly Stack<Control> _ModalPopupControls = new Stack<Control>();

View File

@@ -1,6 +1,5 @@
<UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" x:Class="BeWo.View.ExceptionMessageBox" x:Name="UserControl" Width="400" Height="300">
<Grid x:Name="LayoutRoot">
<Grid x:Name="LayoutRoot">
<Border BorderBrush="Black" BorderThickness="1" CornerRadius="10">
<Border.Background>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">

View File

@@ -1,10 +1,10 @@
using System;
using System.Windows;
using System.Windows.Controls;
namespace BeWo.View
{
public partial class ExceptionMessageBox
public partial class ExceptionMessageBox : UserControl
{
public ExceptionMessageBox(string message, Exception ex, bool showDetails)
{

View File

@@ -1,15 +1,15 @@
using System;
using System.Windows;
using System.Windows.Controls;
namespace BeWoLauncher.Components
{
public partial class ExceptionMessageBox
public partial class ExceptionMessageBox : UserControl
{
public ExceptionMessageBox(string message, Exception ex, bool showDetails) : this(message, ex?.ToString(), showDetails) { }
public ExceptionMessageBox(string message, string submessage, bool showDetails)
{
{
InitializeComponent();
if (!String.IsNullOrEmpty(message) && !showDetails)

View File

@@ -118,6 +118,7 @@ namespace BeWoLauncher
PlanerProcess.StartInfo.FileName = UpdatePathManager.GetPlanerPath();
PlanerProcess.EnableRaisingEvents = true;
PlanerProcess.Exited += PlanerProcess_Exit;
using (AnonymousPipeServerStream pipeServer = new AnonymousPipeServerStream(PipeDirection.Out, HandleInheritability.Inheritable))
{
@@ -154,7 +155,7 @@ namespace BeWoLauncher
Current.Shutdown();
}
private void PlanerProcess_Exit(object sender, EventArgs e)
private static void PlanerProcess_Exit(object sender, EventArgs e)
{
// ExitCode Übersicht:
// 100 - Nutzer hat Logout in Core gedrückt

View File

@@ -1 +1 @@
svcutil.exe /noConfig /edb /n:*,BeWoLauncher.ServiceProxy /out:ServiceProxy\LauncherGenerated.cs /ct:System.Collections.Generic.List`1 /r:..\SharedLauncher\bin\Debug\BS.SharedLauncher.dll http://localhost:3778/LauncherService.svc?wsdl http://localhost:3778/EnumTranslationService.svc?wsdl
svcutil.exe /noConfig /edb /n:*,BeWoLauncher.ServiceProxy /out:ServiceProxy\LauncherGenerated.cs /ct:System.Collections.Generic.List`1 /r:..\SharedLauncher\bin\Debug\BS.SharedLauncher.dll http://localhost:3778/LauncherService.svc?wsdl http://localhost:3778/EnumTranslationService.svc?wsdl http://localhost:3778/DownloadBeWoService.svc?wsdl

View File

@@ -100,6 +100,7 @@ namespace BeWoLauncher.PageImp
SubMessage = "Starte BeWoPlaner...";
await showDelay(1000);
UpdateFileManager.UpdateData = null;
UpdateSuccessful(this, new EventArgs());
UpdatePathManager.GetDownloadDirInfo().ClearFolder();

View File

@@ -332,4 +332,54 @@ namespace BeWoLauncher.ServiceProxy
return base.Channel.GetTranslation(e, value);
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
[System.ServiceModel.ServiceContractAttribute(ConfigurationName="BeWoLauncher.ServiceProxy.IDownloadBeWoService")]
public interface IDownloadBeWoService
{
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IDownloadBeWoService/Download", ReplyAction="http://tempuri.org/IDownloadBeWoService/DownloadResponse")]
[System.ServiceModel.FaultContractAttribute(typeof(BeWoLauncher.ServiceProxy.BeWoFault), Action="http://tempuri.org/IDownloadBeWoService/DownloadBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")]
BS.SharedLauncher.DataContract.BeWoProgramPackageDC Download(BS.SharedLauncher.DataContract.BeWoProgramFilterDC filter);
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
public interface IDownloadBeWoServiceChannel : BeWoLauncher.ServiceProxy.IDownloadBeWoService, System.ServiceModel.IClientChannel
{
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
public partial class DownloadBeWoServiceClient : System.ServiceModel.ClientBase<BeWoLauncher.ServiceProxy.IDownloadBeWoService>, BeWoLauncher.ServiceProxy.IDownloadBeWoService
{
public DownloadBeWoServiceClient()
{
}
public DownloadBeWoServiceClient(string endpointConfigurationName) :
base(endpointConfigurationName)
{
}
public DownloadBeWoServiceClient(string endpointConfigurationName, string remoteAddress) :
base(endpointConfigurationName, remoteAddress)
{
}
public DownloadBeWoServiceClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) :
base(endpointConfigurationName, remoteAddress)
{
}
public DownloadBeWoServiceClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) :
base(binding, remoteAddress)
{
}
public BS.SharedLauncher.DataContract.BeWoProgramPackageDC Download(BS.SharedLauncher.DataContract.BeWoProgramFilterDC filter)
{
return base.Channel.Download(filter);
}
}
}

View File

@@ -31,7 +31,8 @@ namespace BeWoLauncher.ServiceProxy
_EndpointAddresses = new Dictionary<Type, EndpointAddress>
{
{ typeof(ILauncherService), new EndpointAddress(serverName + "LauncherService.svc") },
{ typeof(IEnumTranslationService), new EndpointAddress(serverName + "EnumTranslationService.svc") }
{ typeof(IEnumTranslationService), new EndpointAddress(serverName + "EnumTranslationService.svc") },
{ typeof(IDownloadBeWoService), new EndpointAddress(serverName + "DownloadBeWoService.svc") }
};
}
@@ -91,7 +92,6 @@ namespace BeWoLauncher.ServiceProxy
DoMulitpleSync<LauncherServiceClient, ILauncherService>(pActions, true);
}
#endregion
#region EnumTranslation
public static void DoEnumTranslationServiceSync(Action<IEnumTranslationService> pAction)
@@ -144,6 +144,49 @@ namespace BeWoLauncher.ServiceProxy
DoMulitpleSync<EnumTranslationServiceClient, IEnumTranslationService>(pActions, true);
}
#endregion
#region DownloadBeWo
public static void DoDownloadBeWoServiceSync(Action<IDownloadBeWoService> pAction)
{
try
{
pAction.Invoke(GetInstance<DownloadBeWoServiceClient, IDownloadBeWoService>());
}
catch (Exception e)
{
// if (HandleServiceProxyException(e))
// throw e;
ShowErrorMessage(e);
}
}
public static T DoDownloadBeWoServiceSync<T>(Func<IDownloadBeWoService, T> pFunc)
{
try
{
return pFunc.Invoke(GetInstance<DownloadBeWoServiceClient, IDownloadBeWoService>());
}
catch (Exception e)
{
ShowErrorMessage(e);
}
return default(T);
}
public static void DoDownloadBeWoServiceAsync<T>(Func<IDownloadBeWoService, T> pFunc, Action<T> pCallBack)
{
DoAsync<DownloadBeWoServiceClient, IDownloadBeWoService, T>(pFunc, pCallBack, true);
}
public static void DoDownloadBeWoServiceAsync<T>(Func<IDownloadBeWoService, T> pFunc, Action<T> pCallBack, bool showWaitDialog)
{
DoAsync<DownloadBeWoServiceClient, IDownloadBeWoService, T>(pFunc, pCallBack, showWaitDialog);
}
public static void DoDownloadBeWoServiceAsync(Action<IDownloadBeWoService> pAction)
{
DoAsync<DownloadBeWoServiceClient, IDownloadBeWoService>(pAction, true);
}
public static void DoDownloadBeWoServiceAsync(Action<IDownloadBeWoService> pAction, Action pCallBack)
{
DoAsync<DownloadBeWoServiceClient, IDownloadBeWoService>(pAction, pCallBack, true);
}
#endregion
private static void DoAsync<TClient, TInterface, T>(Func<TInterface, T> pFunc, Action<T> pCallback, bool showWaitDialog)

View File

@@ -26,7 +26,7 @@ namespace BeWoLauncher
if (string.IsNullOrWhiteSpace(installLocation))
{
installLocation = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, GetMainExeName());
installLocation = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "data");
}
return installLocation;

View File

@@ -105,7 +105,7 @@
</security>
<readerQuotas maxStringContentLength="2147483647" />
</binding>
<binding name="TransportSecurityStreaming" maxBufferSize="65536" maxReceivedMessageSize="2147483647" messageEncoding="Text" transferMode="StreamedRequest">
<binding name="TransportSecurityStreaming" maxBufferSize="65536" maxReceivedMessageSize="2147483647" messageEncoding="Mtom" transferMode="StreamedResponse">
<security mode="None">
<transport clientCredentialType="None" />
</security>

View File

@@ -0,0 +1 @@
<%@ ServiceHost Language="C#" Debug="true" Service="BeWo.Service.ServiceImplementations.DownloadBeWoServiceImp" %>

View File

@@ -54,6 +54,9 @@
<HintPath>..\Lib\NHibernate.ByteCode.Castle.dll</HintPath>
</Reference>
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.ServiceModel" />
<Reference Include="System.ServiceModel.Web" />
<Reference Include="System.Web.DynamicData" />
<Reference Include="System.Web.Entity" />
<Reference Include="System.Web.ApplicationServices" />
@@ -76,6 +79,7 @@
</ItemGroup>
<ItemGroup>
<Content Include="EnumTranslationService.svc" />
<Content Include="DownloadBeWoService.svc" />
<Content Include="LauncherService.svc" />
<Content Include="Multitenancy\Symbol Edit.png" />
<Content Include="Web.config">

View File

@@ -49,6 +49,12 @@
</security>
<readerQuotas maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxDepth="32" maxNameTableCharCount="2147483647" maxStringContentLength="2147483647" />
</binding>
<binding name="BasicStreamedRequest" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" transferMode="StreamedRequest">
<security mode="None">
<transport clientCredentialType="None" />
</security>
<readerQuotas maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxDepth="32" maxNameTableCharCount="2147483647" maxStringContentLength="2147483647" />
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
@@ -76,6 +82,9 @@
</behaviorExtensions>
</extensions>
<services>
<service behaviorConfiguration="returnFaults" name="BeWo.Service.ServiceImplementations.DownloadBeWoServiceImp">
<endpoint behaviorConfiguration="SecurityAndSessionBehavior" binding="basicHttpBinding" bindingConfiguration="BasicStreamedRequest" name="DownloadBeWoServiceEndpoint" contract="BeWo.Service.ServiceContracts.IDownloadBeWoService" />
</service>
<service behaviorConfiguration="returnFaults" name="BeWo.Service.ServiceImplementations.LauncherServiceImp">
<endpoint behaviorConfiguration="SecurityAndSessionBehavior" binding="basicHttpBinding" bindingConfiguration="TransportSecurityDownloadLarge" name="LauncherServiceEndpoint" contract="BeWo.Service.ServiceContracts.ILauncherService" />
</service>
@@ -86,9 +95,7 @@
</system.serviceModel>
<appSettings>
<!--<add key="UpdateRootPath" value="d:\Test\Try01"/>-->
<add key="UpdateRootPath" value="d:\Projects\BeWoPlaner\BeWo\BeWo\bin\Debug" />
<!-- <add key="UpdateRootPath" value="d:\Projects\BeWoPlaner\BeWo\BeWo\bin\Debug"/> -->
</appSettings>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">

View File

@@ -106,24 +106,6 @@
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.5.0.0\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CodeAnalysis, Version=3.11.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.CodeAnalysis.Common.3.11.0\lib\netstandard2.0\Microsoft.CodeAnalysis.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CodeAnalysis.CSharp, Version=3.11.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.CodeAnalysis.CSharp.3.11.0\lib\netstandard2.0\Microsoft.CodeAnalysis.CSharp.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CodeAnalysis.CSharp.Workspaces, Version=3.11.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.CodeAnalysis.CSharp.Workspaces.3.11.0\lib\netstandard2.0\Microsoft.CodeAnalysis.CSharp.Workspaces.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CodeAnalysis.VisualBasic, Version=3.11.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.CodeAnalysis.VisualBasic.3.11.0\lib\netstandard2.0\Microsoft.CodeAnalysis.VisualBasic.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CodeAnalysis.VisualBasic.Workspaces, Version=3.11.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.CodeAnalysis.VisualBasic.Workspaces.3.11.0\lib\netstandard2.0\Microsoft.CodeAnalysis.VisualBasic.Workspaces.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CodeAnalysis.Workspaces, Version=3.11.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.CodeAnalysis.Workspaces.Common.3.11.0\lib\netstandard2.0\Microsoft.CodeAnalysis.Workspaces.dll</HintPath>
</Reference>
<Reference Include="MySql.Data, Version=8.0.21.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Lib\MySql.Data.dll</HintPath>
@@ -463,6 +445,7 @@
<Compile Include="ServiceContracts\BeWoFault.cs" />
<Compile Include="ServiceContracts\IAccountingService.cs" />
<Compile Include="ServiceContracts\IAnalysisService.cs" />
<Compile Include="ServiceContracts\IDownloadBeWoService.cs" />
<Compile Include="ServiceContracts\IEnumTranslationService.cs" />
<Compile Include="ServiceContracts\ILauncherService.cs" />
<Compile Include="ServiceContracts\IMailService.cs" />
@@ -476,6 +459,7 @@
<Compile Include="ServiceContracts\IResourceService.cs" />
<Compile Include="ServiceImplementations\AccountingServiceImp.cs" />
<Compile Include="ServiceImplementations\AnalysisServiceImp.cs" />
<Compile Include="ServiceImplementations\DownloadBeWoServiceImp.cs" />
<Compile Include="ServiceImplementations\EnumTranslationServiceImp.cs" />
<Compile Include="ServiceImplementations\LauncherServiceImp.cs" />
<Compile Include="ServiceImplementations\MailServiceImp.cs" />

View File

@@ -0,0 +1,17 @@
using System;
using System.IO;
using System.ServiceModel;
using BS.Shared.DataContracts;
using BS.SharedLauncher.DataContract;
namespace BeWo.Service.ServiceContracts
{
[ServiceContract]
public interface IDownloadBeWoService
{
[FaultContract(typeof(BeWoFault))]
[OperationContract]
BeWoProgramPackageDC Download(BeWoProgramFilterDC filter);
}
}

View File

@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.ServiceModel;
using BeWo.Service.ServiceContracts;
using BS.SharedLauncher.DataContract;
namespace BeWo.Service.ServiceImplementations
{
[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall, ConcurrencyMode = ConcurrencyMode.Single)]
public class DownloadBeWoServiceImp : IDownloadBeWoService
{
public BeWoProgramPackageDC Download(BeWoProgramFilterDC filter)
{
return null;
}
}
}

View File

@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
namespace BS.SharedLauncher.DataContract
{
[DataContract]
public class BeWoProgramFilterDC
{
}
}

View File

@@ -47,6 +47,7 @@
<Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup>
<Compile Include="DataContract\BeWoProgramFilterDC.cs" />
<Compile Include="LauncherEnums.cs" />
<Compile Include="DataContract\BeWoProgramFileDC.cs" />
<Compile Include="Information\ConnectionInformation.cs" />