Unit Tests erstellt

Informationen ausgelagert
Kleines Spy/Test Programm erstellt
Mehr Exceptions/InvalidUpdateFileRequestException.cs
Launcher Host in Download Server geändert
Download Server macht zusätzlich Abfrage an den Hauptserver
Download geht jetzt stückweise von statten
This commit is contained in:
rene
2022-12-28 16:36:59 +01:00
parent c8adcff8cc
commit 4fbfdbaf2c
115 changed files with 3364 additions and 1972 deletions

6
.gitignore vendored
View File

@@ -571,3 +571,9 @@ obj
/SharedLauncher/obj
/BeWoLauncher/bin
/BeWoLauncher/obj
/UnitTests/bin
/UnitTests/obj
/DownloadServer/bin
/DownloadServer/obj
/BeWoTest/bin
/BeWoTest/obj

View File

@@ -10,6 +10,7 @@ using BS.Shared.Core;
using BS.Shared.DataContracts;
using BS.Shared.DataContracts.Compact;
using BS.Shared.Extensions;
using BS.SharedLauncher.Information;
using ChatController.HauptKlassen;
using DevExpress.Xpf.Core;
using DevExpress.Xpf.Grid;
@@ -537,39 +538,7 @@ namespace BeWo
{
get
{
String url = ServerAddress?.ToLower();
#if DEBUG
//url = String.Format("http://localhost:3777/Host");
//return new Uri("https://app4.bewoplaner.de/service");
//url = String.Format("app1.bewoplaner.de/service");
#endif
if (url.IndexOf("localhost") < 0)
{
int i;
if (Int32.TryParse(url, out i))
url = "app" + url;
if (url.IndexOf('.') < 0)
{
url += ".bewoplaner.de";
}
//if (url.IndexOf("/service45") < 0)
//{
// url += "/service45";
//}
if (url.IndexOf("/service") < 0)
{
url += "/service";
}
return new Uri(String.Format("https://{0}", url));
}
return new Uri(url);
return new Uri(SessionInformation.Connection.CoreServerAddressExact);
}
}
@@ -765,51 +734,10 @@ namespace BeWo
var args = e.Args;
//args = new string[] { "tedemo?undemo?pwdemo?ip?sn1?cs" };
try
{
if (args.Length > 0)
{
using (PipeStream pipeClient = new AnonymousPipeClientStream(PipeDirection.In, args[0]))
{
using (StreamReader sr = new StreamReader(pipeClient))
{
string temp;
List<string> result = new List<string>();
var signal = new string[] { "C-137", "C-131"};
// Warte auf Start
do
{
temp = sr.ReadLine();
}
while (!temp.StartsWith(signal[0]));
result.Add(sr.ReadLine());
result.Add(sr.ReadLine());
result.Add(sr.ReadLine());
result.Add(sr.ReadLine());
result.Add(sr.ReadLine());
result.Add(sr.ReadLine());
result.Add(sr.ReadLine());
do
{
temp = sr.ReadLine();
}
while (!temp.StartsWith(signal[1]));
Loader.Load(result.ToArray());
//if (System.Windows.Forms.MessageBox.Show(temp, "(OK to copy)", System.Windows.Forms.MessageBoxButtons.OKCancel) == System.Windows.Forms.DialogResult.OK)
//{ Clipboard.SetText(temp); }
}
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
SessionInformation.LoadPipe(args[0]);
Loader.Load();
}
}
@@ -1109,7 +1037,7 @@ namespace BeWo
tenant = "5473568546";
#endif
var login = new Login(tenant, serverUrl =>
var login = new ChatController.HauptKlassen.Login(tenant, serverUrl =>
{
if (!string.IsNullOrWhiteSpace(serverUrl))
{

View File

@@ -2,9 +2,9 @@
using BS.SharedLauncher.Information;
using System;
using System.Collections.Generic;
using System.IO;
using System.IO.Pipes;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
namespace BeWo
@@ -18,29 +18,20 @@ namespace BeWo
Loaded = false;
}
public static void Load(string username, string password, string servername, string tenant, string coreserveraddress, string version)
public static void Load()
{
BeWoApp.UserName = username;
BeWoApp.UserPassword = password;
BeWoApp.ServerName = servername;
BeWoApp.Tenant = tenant;
BeWoApp.ServerAddress = coreserveraddress;
BeWoApp.ShortVersion = version;
BeWoApp.Version = "Version " + version;
// var t = MessageBox.Show(BeWoApp.ServerAddress);
// var t1 = MessageBox.Show(BeWoApp.SiteOfOrigin.ToString());
BeWoApp.UserName = SessionInformation.Login.Username;
BeWoApp.UserPassword = SessionInformation.Login.Password;
BeWoApp.ServerName = SessionInformation.Connection.Servername;
BeWoApp.Tenant = SessionInformation.Login.Tenant;
BeWoApp.ServerAddress = SessionInformation.Connection.CoreServerAddress;
BeWoApp.ShortVersion = SessionInformation.Session.Version;
BeWoApp.Version = "Version " + SessionInformation.Session.Version;
BeWoApp.LoggedOnUser = ServiceFacade.DoUserServiceSync(s => s.LoadUserByNameAndPassword(BeWoApp.UserName, BeWoApp.UserPassword));
BeWoApp.Mandator = ServiceFacade.DoOperationsServiceSync(s => s.GetMandator());
Loaded = true;
}
public static void Load(Connection connection)
=> Load(connection.Username, connection.Password, connection.Servername, connection.Tenant, connection.CoreServerAddress, connection.Version);
public static void Load(string[] rawInput)
=> Load(Connection.Parse(rawInput));
}
}

View File

@@ -25,7 +25,8 @@ namespace BeWo
if (Loader.Loaded)
ShowNewWay();
else
ShowOldWay(false);
// ShowOldWay(false);
throw new Exception("Loader failed");
}
private void ShowNewWay()

View File

@@ -13,7 +13,7 @@
<basicHttpBinding>
<binding name="BeWoBasicEndpoint" closeTimeout="00:05:00" openTimeout="00:05:00" receiveTimeout="00:10:00" sendTimeout="00:05:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true" messageEncoding="Text">
<readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="Transport" />
<security mode="None" />
<!-- mode="Transport" für echten Server und "None" sonst-->
</binding>
</basicHttpBinding>

View File

@@ -145,11 +145,8 @@
<Compile Include="View\Frames\LoadingFrame.xaml.cs">
<DependentUpon>LoadingFrame.xaml</DependentUpon>
</Compile>
<Compile Include="View\Frames\UninstallProgressInfoFrame.cs" />
<Compile Include="View\Frames\UpdateProgressInfoFrame.cs" />
<Compile Include="View\Frames\InstallProgressInfoFrame.cs" />
<Compile Include="View\Frames\GenericProgressFrame.xaml.cs">
<DependentUpon>GenericProgressFrame.xaml</DependentUpon>
<Compile Include="View\Frames\ProgressFrame.xaml.cs">
<DependentUpon>ProgressFrame.xaml</DependentUpon>
</Compile>
<Compile Include="View\FrameView.xaml.cs">
<DependentUpon>FrameView.xaml</DependentUpon>
@@ -217,7 +214,7 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="View\Frames\GenericProgressFrame.xaml">
<Page Include="View\Frames\ProgressFrame.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
@@ -311,7 +308,6 @@
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Include="BeWoLauncher_TemporaryKey.pfx" />
<None Include="LauncherServiceReferences.bat" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>

View File

@@ -48,11 +48,7 @@ namespace BeWoLauncher
base.OnStartup(e);
ProcessController.CheckForOtherInstance();
// Update Server Adresses
ConnectionInformation.LauncherServerAddress = ConnectionInformation.LauncherServerAddressOrigin.ToString();
LauncherServiceFacade.UpdateServerAddresses(ConnectionInformation.LauncherServerAddress);
ProcessController.StartLauncher();
Dispatcher.UnhandledException += (s, ex)
=>

View File

@@ -1,6 +1,7 @@
using BeWoLauncher.Components;
using BeWoLauncher.Logic.Controller;
using BeWoLauncher.Logic.Utils;
using BS.SharedLauncher.Extensions;
using BS.SharedLauncher.Information;
using System;
using System.Threading.Tasks;
@@ -52,9 +53,9 @@ namespace BeWoLauncher.Logic.Behavior
try
{
DownloadController.Start();
DownloadController.Manager.StartDownloadInfo();
DownloadController.Manager.GetUpdatePlan();
if (DownloadController.Manager.ResponseInfo.HasSomethingToDo)
if (DownloadController.Manager.UpdatePlanResponse.HasToDo())
{
ViewBehavior.ShowInfo();
}

View File

@@ -2,6 +2,7 @@
using BeWoLauncher.Logic.Utils;
using BeWoLauncher.View;
using BeWoLauncher.View.Frames;
using BS.SharedLauncher.Enums;
using System;
using System.IO;
using System.Threading.Tasks;
@@ -15,6 +16,7 @@ namespace BeWoLauncher.Logic.Behavior
{
private UserControl _currentView;
private FrameBase _currentFrame;
private LauncherMode _currentLauncherMode;
private UserControl CurrentView
{
@@ -32,7 +34,8 @@ namespace BeWoLauncher.Logic.Behavior
}
private FrameBase CurrentFrame
{
get => _currentFrame; set
get => _currentFrame;
set
{
_currentFrame = value;
@@ -131,11 +134,18 @@ namespace BeWoLauncher.Logic.Behavior
LauncherAppdataConfig.SetFirstInstallationSuccess(true);
ShowFrame(FrameType.LoadingScreen);
}
public void InstallationFailed(Exception exception)
public void InstallFailed(object sender, EventArgs e)
{
Error = exception;
ShowFrame(FrameType.InstallFailed);
}
public void UpdateFailed(object sender, EventArgs e)
{
ShowFrame(FrameType.UpdateFailed);
}
public void UninstallFailed(object sender, EventArgs e)
{
ShowFrame(FrameType.UninstallFailed);
}
public void UpdateStarting(object sender, EventArgs e)
{
@@ -145,11 +155,6 @@ namespace BeWoLauncher.Logic.Behavior
{
ShowFrame(FrameType.LoadingScreen);
}
public void UpdateFailed(Exception exception)
{
Error = exception;
ShowFrame(FrameType.UpdateFailed);
}
public void UninstallStarting(object sender, EventArgs e)
{
@@ -159,10 +164,5 @@ namespace BeWoLauncher.Logic.Behavior
{
ShowFrame(FrameType.UninstallSuccessful);
}
public void UninstallFailed(Exception exception)
{
Error = exception;
ShowFrame(FrameType.UninstallFailed);
}
}
}

View File

@@ -1,4 +1,6 @@
using BeWoLauncher.Logic.Utils.Download;
using BeWoLauncher.Logic.Utils;
using BeWoLauncher.Logic.Utils.Download;
using BS.SharedLauncher.Information;
using BS.SharedLauncher.Utils;
using System.IO;
@@ -9,11 +11,13 @@ namespace BeWoLauncher.Logic.Controller
public static DownloadManager Manager { get; set; }
public static long FreeSpace { get; set; }
public static long NeededSpace => Manager.ResponseInfo.DownloadSize;
public static long NeededSpace => Manager.UpdatePlanResponse.DownloadSize;
public static void Start()
{
Manager = new DownloadManager();
DownloadLogger.Init(LauncherPaths.GetLoggerPath());
}
public static string UpdateDiskSpace(string path)

View File

@@ -1,4 +1,5 @@
using BeWoLauncher.Logic.Utils;
using BeWoLauncher.ServiceProxy;
using BS.SharedLauncher.Information;
using System;
using System.Diagnostics;
@@ -49,6 +50,17 @@ namespace BeWoLauncher.Logic.Controller
}
}
internal static void StartLauncher()
{
CheckForOtherInstance();
// Update Server Adresses
//ConnectionInformation.DownloadServerAddress = ConnectionInformation.DownloadServerAddressExact.ToString();
//ConnectionInformation.CoreServerAddress = ConnectionInformation.CoreServerAddress.ToString();
LauncherServiceFacade.UpdateServerAddresses(SessionInformation.Connection.DownloadServerAddressExact, SessionInformation.Connection.CoreServerAddressExact);
}
internal static void StartLauncherShutdown()
{
Current.Shutdown();
@@ -72,6 +84,7 @@ namespace BeWoLauncher.Logic.Controller
PlanerProcess.OutputDataReceived += MessageFromPlanerClient;
PlanerProcess.Start();
DownloadLogger.Post2($"Launcher Start: {PlanerProcess.StartInfo.FileName}");
PlanerProcess.BeginOutputReadLine();
@@ -81,19 +94,17 @@ namespace BeWoLauncher.Logic.Controller
{
using (StreamWriter sw = new StreamWriter(pipeServer))
{
var signal = new string[] { "C-137", "C-131" };
sw.AutoFlush = true;
sw.WriteLine("C-137");
pipeServer.WaitForPipeDrain();
SendInfo(sw, signal[0], pipeServer);
foreach (var info in ConnectionInformation.Connection.ToArray())
{
sw.WriteLine(info);
pipeServer.WaitForPipeDrain();
}
SessionInformation.Connection.ToList().ForEach(info => SendInfo(sw, info, pipeServer));
SessionInformation.Login.ToList().ForEach(info => SendInfo(sw, info, pipeServer));
SessionInformation.Session.ToList().ForEach(info => SendInfo(sw, info, pipeServer));
sw.WriteLine("C-131");
pipeServer.WaitForPipeDrain();
SendInfo(sw, signal[1], pipeServer);
}
}
catch (IOException ex)
@@ -102,6 +113,11 @@ namespace BeWoLauncher.Logic.Controller
}
}
}
internal static void SendInfo(StreamWriter sw, string info, AnonymousPipeServerStream pipe)
{
sw.WriteLine(info);
pipe.WaitForPipeDrain();
}
internal static void KillPlanerProcess()
{
foreach (var process in Process.GetProcesses())

View File

@@ -14,7 +14,7 @@ namespace BeWoLauncher.Multitenancy
public object BeforeSendRequest(ref Message request, IClientChannel channel)
{
request.Headers.Add(new MultitenancyHeader { Tenant = ConnectionInformation.Tenant });
request.Headers.Add(new MultitenancyHeader { Tenant = SessionInformation.Login.Tenant });
return null;
}
}

View File

@@ -15,7 +15,7 @@ namespace BeWoLauncher.Security
public object BeforeSendRequest(ref Message request, IClientChannel channel)
{
request.Headers.Add(new LauncherSecurityHeader { Username = ConnectionInformation.Username, Password = ConnectionInformation.Password });
request.Headers.Add(new LauncherSecurityHeader { Username = SessionInformation.Login.Username, Password = SessionInformation.Login.Password });
return null;
}
}

View File

@@ -331,11 +331,19 @@ namespace BeWoLauncher.ServiceProxy
[System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IDownloadBeWoService/Download2", ReplyAction = "http://tempuri.org/IDownloadBeWoService/Download2Response")]
[System.ServiceModel.FaultContractAttribute(typeof(BeWoLauncher.ServiceProxy.BeWoFault), Action = "http://tempuri.org/IDownloadBeWoService/Download2BeWoFaultFault", Name = "BeWoFault", Namespace = "http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")]
BS.SharedLauncher.DataContract.DownloadPlanerResponseDC Download2(BS.SharedLauncher.DataContract.DownloadPlanerRequestDC request);
BS.SharedLauncher.DataContract.UpdateFileResponse Download2(BS.SharedLauncher.DataContract.UpdatePlanRequest request);
[System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IDownloadBeWoService/DownloadInfo", ReplyAction = "http://tempuri.org/IDownloadBeWoService/DownloadInfoResponse")]
[System.ServiceModel.FaultContractAttribute(typeof(BeWoLauncher.ServiceProxy.BeWoFault), Action = "http://tempuri.org/IDownloadBeWoService/DownloadInfoBeWoFaultFault", Name = "BeWoFault", Namespace = "http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")]
BS.SharedLauncher.DataContract.DownloadPlanerResponseInfoDC DownloadInfo(BS.SharedLauncher.DataContract.DownloadPlanerRequestDC request);
BS.SharedLauncher.DataContract.UpdatePlanResponse DownloadInfo(BS.SharedLauncher.DataContract.UpdatePlanRequest request);
[System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IDownloadBeWoService/GetUpdatePlan", ReplyAction = "http://tempuri.org/IDownloadBeWoService/GetUpdatePlanResponse")]
[System.ServiceModel.FaultContractAttribute(typeof(BeWoLauncher.ServiceProxy.BeWoFault), Action = "http://tempuri.org/IDownloadBeWoService/GetUpdatePlanBeWoFaultFault", Name = "BeWoFault", Namespace = "http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")]
BS.SharedLauncher.DataContract.UpdatePlanResponse GetUpdatePlan(BS.SharedLauncher.DataContract.UpdatePlanRequest request);
[System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IDownloadBeWoService/GetUpdateFile", ReplyAction = "http://tempuri.org/IDownloadBeWoService/GetUpdateFileResponse")]
[System.ServiceModel.FaultContractAttribute(typeof(BeWoLauncher.ServiceProxy.BeWoFault), Action = "http://tempuri.org/IDownloadBeWoService/GetUpdateFileBeWoFaultFault", Name = "BeWoFault", Namespace = "http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")]
BS.SharedLauncher.DataContract.UpdateFileResponse GetUpdateFile(BS.SharedLauncher.DataContract.UpdateFileRequest request);
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
@@ -372,14 +380,24 @@ namespace BeWoLauncher.ServiceProxy
{
}
public BS.SharedLauncher.DataContract.DownloadPlanerResponseDC Download2(BS.SharedLauncher.DataContract.DownloadPlanerRequestDC request)
public BS.SharedLauncher.DataContract.UpdateFileResponse Download2(BS.SharedLauncher.DataContract.UpdatePlanRequest request)
{
return base.Channel.Download2(request);
}
public BS.SharedLauncher.DataContract.DownloadPlanerResponseInfoDC DownloadInfo(BS.SharedLauncher.DataContract.DownloadPlanerRequestDC request)
public BS.SharedLauncher.DataContract.UpdatePlanResponse DownloadInfo(BS.SharedLauncher.DataContract.UpdatePlanRequest request)
{
return base.Channel.DownloadInfo(request);
}
public BS.SharedLauncher.DataContract.UpdatePlanResponse GetUpdatePlan(BS.SharedLauncher.DataContract.UpdatePlanRequest request)
{
return base.Channel.GetUpdatePlan(request);
}
public BS.SharedLauncher.DataContract.UpdateFileResponse GetUpdateFile(BS.SharedLauncher.DataContract.UpdateFileRequest request)
{
return base.Channel.GetUpdateFile(request);
}
}
}

View File

@@ -1,15 +1,10 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using BeWoLauncher.Multitenancy;
using BeWoLauncher.Multitenancy;
using BeWoLauncher.Security;
using BS.SharedLauncher.Information;
using System;
using System.Collections.Generic;
using System.ServiceModel;
using System.Threading;
using System.Windows;
namespace BeWoLauncher.ServiceProxy
{
@@ -20,18 +15,21 @@ namespace BeWoLauncher.ServiceProxy
private static Dictionary<Type, EndpointAddress> _EndpointAddresses;
private static readonly Dictionary<Type, object> _ProxyCache;
private static int _RunningAsyncs;
private static readonly int _RunningAsyncs;
public static void UpdateServerAddresses(string siteOfOrigin)
public static void UpdateServerAddresses(string launcher, string main)
{
var serverName = siteOfOrigin;
var serverName = launcher;
var serverName2 = main;
if (serverName.Substring(serverName.Length - 1, 1) != "/")
serverName += "/";
if (serverName2.Substring(serverName2.Length - 1, 1) != "/")
serverName2 += "/";
_EndpointAddresses = new Dictionary<Type, EndpointAddress>
{
{ typeof(ILauncherService), new EndpointAddress(serverName + "LauncherService.svc") },
{ typeof(IEnumTranslationService), new EndpointAddress(serverName + "EnumTranslationService.svc") },
{ typeof(ILauncherService), new EndpointAddress(serverName2 + "LauncherService.svc") },
{ typeof(IEnumTranslationService), new EndpointAddress(serverName2 + "EnumTranslationService.svc") },
{ typeof(IDownloadBeWoService), new EndpointAddress(serverName + "DownloadBeWoService.svc") }
};
}

View File

@@ -10,6 +10,7 @@ using BS.SharedLauncher.Update;
using BS.SharedLauncher.Utils;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.IO.Compression;
using System.Linq;
@@ -23,144 +24,189 @@ namespace BeWoLauncher.Logic.Utils.Download
{
public class DownloadManager
{
public DownloadPlanerRequestDC Request { get; set; }
public DownloadPlanerResponseInfoDC ResponseInfo { get; set; }
public DownloadPlanerResponseDC Response { get; set; }
public UpdatePlanRequest UpdatePlanRequest { get; set; }
public UpdatePlanResponse UpdatePlanResponse { get; set; }
public string RootFolder => LauncherPaths.GetRootPath();
public string DownloadFolder => LauncherPaths.GetDownloadPath();
public string ApplyFolder => LauncherPaths.GetApplyPath();
public bool SkipLock { get; set; }
public Action<int, object> Feedback { get; set; }
public int FilesToDownloadCount => UpdatePlanResponse.FilesToRequest?.Count ?? 0;
public int FilesToApplyCount => FilesToDownloadCount + (UpdatePlanResponse.FilesToApply?.Count ?? 0);
public int FilesToDeleteInApplyCount => UpdatePlanResponse.FilesToDeleteInApply?.Count ?? 0;
public int FilesToProcessTotal => FilesToDownloadCount + FilesToApplyCount + FilesToDeleteInApplyCount;
public DownloadManager()
{
Request = null;
ResponseInfo = null;
Response = null;
}
public void StartDownloadInfo()
public void GetUpdatePlan()
{
CreateDownloadRequest();
CreateUpdatePlanRequest();
GetDownloadResponseInfo();
GetUpdatePlanResponse();
ConnectionInformation.Version = ResponseInfo.Version;
}
public void StartDownload(bool skipLock, Action<int, object> download)
{
GetDownloadResponse();
if (!Response.HasToDo())
{
// Macht das Sinn?
// Ne, wahrsch. Fehler
throw new NotImplementedException("#45419873274");
return;
SessionInformation.Session.Version = UpdatePlanResponse.CurrentPackage.Version;
}
if (Response.HasToDoNewZip())
public void StartProcess(BackgroundWorker worker)
{
var report = new Action<LauncherProgress, int>((progress, waitms) =>
{
worker.ReportProgress((int)progress);
Thread.Sleep(waitms);
});
report(LauncherProgress.ProgressStart, 1000);
if (FilesToDownloadCount > 0)
{
report(LauncherProgress.DownloadStart, 500);
Download();
report(LauncherProgress.DownloadFinish, 1000);
}
if (FilesToApplyCount > 0)
{
report(LauncherProgress.ApplyStart, 500);
Apply();
report(LauncherProgress.ApplyFinished, 1000);
}
if (FilesToDeleteInApplyCount > 0)
{
report(LauncherProgress.DeleteStart, 500);
Delete();
report(LauncherProgress.DeleteFinished, 1000);
}
report(LauncherProgress.CleanupStart, 500);
Cleanup();
report(LauncherProgress.CleanupFinished, 1000);
// report(LauncherProgress.ProgressEnd, 500);
}
public void Download()
{
DownloadFolder.CreateFolder();
DownloadFolder.Lock(skipLock);
DownloadFolder.Lock(SkipLock);
LauncherPaths.CurrentDownloadZipLocation = FileController.GetNewZipPath(LauncherPaths.GetDownloadPath());
DownloadFolder.SaveCurrentInfo("current");
//FileController.SaveDZipStream(LauncherPaths.CurrentDownloadZipLocation, Response.NewZipStream, Response.NewZipData.LongLength, download);
FileController.SaveDZip(LauncherPaths.CurrentDownloadZipLocation, Response.NewZipData);
FileController.SaveInfo(LauncherPaths.CurrentDownloadZipLocation, Response.NewZipInfo);
FileController.SaveInfo(LauncherPaths.GetRootPath().Combine("latest"), Response.LatestApplicationInfo);
UpdateFileRequest req = new UpdateFileRequest(UpdatePlanResponse.CurrentPackage.Version);
foreach (var file2request in UpdatePlanResponse.FilesToRequest)
{
req.UpdateFile = file2request;
Response.NewZipData = null;
var res = AskForFile(req);
var download_path = DownloadFolder.Combine(file2request.RelativePath);
Path.GetDirectoryName(download_path).CreateFolder();
download_path.SaveFile(res.FileData);
var size = NonspecificTools.SizeSuffix((ulong)res.FileData.Length);
Feedback((int)LauncherProgress.DownloadUpdate, new DownloadProgressEventArgs(size, file2request));
}
DownloadFolder.Unlock();
}
}
public void StartApply(bool skiplock, Action<int, object> apply)
public void Apply()
{
ApplyFolder.CreateFolder();
ApplyFolder.Lock(skiplock);
ApplyFolder.Lock(SkipLock);
if (Response.HasToDoDownload2Keep())
{
FileController.ApplyDZip(Response.DownloadFilesToKeep, ApplyFolder, apply);
}
if (UpdatePlanResponse.FilesToApply is object)
UpdatePlanResponse.FilesToApply.ForEach(ApplyFile);
if (Response.HasToDoNewZip())
if (UpdatePlanResponse.FilesToRequest is object)
UpdatePlanResponse.FilesToRequest.ForEach(ApplyFile);
ApplyFolder.SaveCurrentInfo("current");
}
public void ApplyFile(UpdateFileDC file2apply)
{
FileController.ApplyDZip(LauncherPaths.CurrentDownloadZipLocation, ApplyFolder, apply);
var apply_path = ApplyFolder.Combine(file2apply.RelativePath);
var download_path = DownloadFolder.Combine(file2apply.RelativePath);
Path.GetDirectoryName(apply_path).CreateFolder();
download_path.CopyFileTo(apply_path);
Feedback((int)LauncherProgress.ApplyUpdate, new ApplyFileEventArgs(file2apply.RelativePath));
}
public void Delete()
{
foreach (var file2delete in UpdatePlanResponse.FilesToDeleteInApply)
{
var delete_path = ApplyFolder.Combine(file2delete.RelativePath);
delete_path.DeleteFile();
Feedback((int)LauncherProgress.DeleteUpdate, file2delete.RelativePath);
}
}
public void StartCleanup(Action<int, object> feedback)
public void Cleanup()
{
if (Response.HasToRemoveFiles)
{
StartRemoveFiles(feedback, Response.LatestApplicationInfo);
}
ApplyFolder.DeleteEmptyDirectories();
DownloadFolder.ClearFolder();
ApplyFolder.Unlock();
Thread.Sleep(1000);
}
public void StartUninstall(Action<int, object> feedback)
private void CreateUpdatePlanRequest()
{
var t = new PlanerPackageInfoDC()
UpdatePlanRequest = new UpdatePlanRequest();
if (UpdatePlanRequest.PlanerRootFolderExists = LauncherPaths.ActualPlanerLocation.Exists())
{
Files = new List<PlanerFileInfoDC>()
if (UpdatePlanRequest.DownloadFolderExists = DownloadFolder.Exists())
if (!(UpdatePlanRequest.DownloadFolderIsEmpty = DownloadFolder.IsFolderEmpty()))
UpdatePlanRequest.DownloadedFiles = FileController.GetDownloadedFiles(DownloadFolder);
if (UpdatePlanRequest.ApplyFolderExists = ApplyFolder.Exists())
if (!(UpdatePlanRequest.ApplyFolderIsEmpty = ApplyFolder.IsFolderEmpty()))
UpdatePlanRequest.ApplyPackage = FileController.GetApplyPackage(ApplyFolder);
}
UpdatePlanRequest.Login = new LoginDC()
{
Username = SessionInformation.Login.Username,
Password = SessionInformation.Login.Password,
CoreServerAddress = SessionInformation.Connection.CoreServerAddress,
Pin = SessionInformation.Login.Pin,
ClientID = SessionInformation.Login.ClientId,
CheckTenant = true,
TempUsername = SessionInformation.Login.TempUsername,
};
StartRemoveFiles(feedback, t);
}
private void StartRemoveFiles(Action<int, object> feedback, PlanerPackageInfoDC newPackage)
private UpdateFileResponse AskForFile(UpdateFileRequest request)
{
feedback((int)LauncherProgress.DeleteStart, null);
Thread.Sleep(500);
FileController.RemoveUnsuedFiles(newPackage, ApplyFolder, feedback);
return LauncherServiceFacade.DoDownloadBeWoServiceSyncWithException(x => x.GetUpdateFile(request));
}
private void CreateDownloadRequest()
private void GetUpdatePlanResponse()
{
Request = new DownloadPlanerRequestDC();
UpdatePlanResponse = LauncherServiceFacade.DoDownloadBeWoServiceSyncWithException(x => x.GetUpdatePlan(UpdatePlanRequest));
if (Request.PlanerRootFolderExists = LauncherPaths.ActualPlanerLocation.Exists())
{
if (Request.DownloadFolderExists = DownloadFolder.Exists())
if (!(Request.DownloadFolderIsEmpty = DownloadFolder.IsFolderEmpty()))
Request.DownloadedPackages = FileController.LoadInfos(DownloadFolder);
if (Request.ApplyFolderExists = ApplyFolder.Exists())
if (!(Request.ApplyFolderIsEmpty = ApplyFolder.IsFolderEmpty()))
{
var files = FileController.GetPlanerFiles(ApplyFolder);
if (files is object)
files.ForEach(file => file.LoadHash());
FileController.TryGetPackageInfo(ApplyFolder, out var package);
if (package == null)
package = new PlanerPackageInfoDC();
package.Files = files.ToPlanerFileInfoDCList();
Request.ApplyPackage = package;
}
}
}
private void GetDownloadResponse()
{
Response = LauncherServiceFacade.DoDownloadBeWoServiceSync(x => x.Download2(Request));
}
private void GetDownloadResponseInfo()
{
var t = ConnectionInformation.Tenant;
ResponseInfo = LauncherServiceFacade.DoDownloadBeWoServiceSyncWithException(x => x.DownloadInfo(Request));
// UpdatePlanResponse.FilesToApply.AddRange(UpdatePlanResponse.FilesToRequest);
}
}
}

View File

@@ -1,5 +1,7 @@
using BS.SharedLauncher.Extensions;
using BeWoLauncher.Logic.Controller;
using BS.SharedLauncher.Extensions;
using BS.SharedLauncher.Information;
using BS.SharedLauncher.Logic;
using System;
using System.Collections.Generic;
using System.IO;
@@ -19,8 +21,6 @@ namespace BeWoLauncher.Logic.Utils
public static string LoginSelectionPlanerLocation { get; set; }
public static string ActualPlanerLocation { get; set; }
public static string CurrentDownloadZipLocation { get; set; }
/// <summary>
/// Holt den Install Ort aus den Properties Settings.
/// Sollte dieser nicht verfügbar sein, wird als default - "CurrentBaseDir"/BeWoPlaner - verwendet
@@ -81,6 +81,10 @@ namespace BeWoLauncher.Logic.Utils
{
return ActualPlanerLocation;
}
public static string GetLoggerPath()
{
return Path.Combine(new string[] { GetRootPath(), "log" });
}
public static string GetDownloadPath()
{
return Path.Combine(new string[] { GetRootPath(), "download" });
@@ -94,13 +98,30 @@ namespace BeWoLauncher.Logic.Utils
{
return Path.Combine(GetApplyPath(), GetPlanerExeName());
}
public static string GetApplyPackagePath()
public static void SaveCurrentInfo(this string path, string file)
{
return Path.Combine(GetApplyPath(), BeWoPathFileConfig.LatestBeWoInfo);
FileController.SaveInfo(path.Combine(file), DownloadController.Manager.UpdatePlanResponse.CurrentPackage);
}
public static string GetDownloadPackagePath()
public static void SaveFile(this string path, byte[] data)
{
return Path.Combine(GetDownloadPath(), BeWoPathFileConfig.LatestBeWoInfo);
FileController.SaveFile(path, data);
}
public static void CopyFileTo(this string source, string destination)
{
FileController.CopyFile(source, destination);
}
public static void DeleteFile(this string file)
{
FileController.DeleteFile(file);
}
public static void DeleteEmptyDirectories(this string dir)
{
FileController.DeleteEmptyDirectories(dir);
}
}
}

View File

@@ -2,6 +2,7 @@
using BeWoLauncher.Logic.Controller;
using BeWoLauncher.View;
using BeWoLauncher.View.Frames;
using BS.SharedLauncher.Enums;
using System;
using System.Threading.Tasks;
using System.Windows.Controls;
@@ -120,11 +121,12 @@ namespace BeWoLauncher.Logic
private FrameBase getUninstallProgressFrame()
{
var uninstallProgress = new UninstallProgressInfoFrame();
var progress = new ProgressFrame(LauncherMode.Update);
uninstallProgress.UninstallSuccessful += ViewBehavior.UninstallSuccess;
progress.Successful += ViewBehavior.UninstallSuccess;
progress.Exception += ViewBehavior.UninstallFailed;
return uninstallProgress;
return progress;
}
private FrameBase getUninstallInfoFrame()
@@ -151,11 +153,12 @@ namespace BeWoLauncher.Logic
private FrameBase getUpdateProgressFrame()
{
var updateProgress = new UpdateProgressInfoFrame();
var progress = new ProgressFrame(LauncherMode.Update);
updateProgress.UpdateSuccessful += ViewBehavior.UpdateSuccess;
progress.Successful += ViewBehavior.UpdateSuccess;
progress.Exception += ViewBehavior.UpdateFailed;
return updateProgress;
return progress;
}
private FrameBase getUpdateInfoFrame()
@@ -194,11 +197,12 @@ namespace BeWoLauncher.Logic
private FrameBase getInstallProgressFrame()
{
var installprogress = new InstallProgressInfoFrame();
var progress = new ProgressFrame(LauncherMode.Install);
installprogress.InstallSuccessful += ViewBehavior.InstallSuccesss;
progress.Successful += ViewBehavior.InstallSuccesss;
progress.Exception += ViewBehavior.InstallFailed;
return installprogress;
return progress;
}
private FrameBase getInstallInfoFrame()

View File

@@ -0,0 +1,403 @@
//------------------------------------------------------------------------------
// <auto-generated>
// Dieser Code wurde von einem Tool generiert.
// Laufzeitversion:4.0.30319.42000
//
// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
// der Code erneut generiert wird.
// </auto-generated>
//------------------------------------------------------------------------------
namespace BeWoLauncher.ServiceProxy
{
using System.Runtime.Serialization;
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")]
[System.Runtime.Serialization.DataContractAttribute(Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")]
public partial class BeWoFault : object, System.Runtime.Serialization.IExtensibleDataObject, System.ComponentModel.INotifyPropertyChanged
{
private System.Runtime.Serialization.ExtensionDataObject extensionDataField;
private BeWoLauncher.ServiceProxy.BeWoFaultType FaultTypeField;
private string InnerExceptionMessageField;
private string InnerExceptionStackTraceField;
private string MessageField;
private string StackTraceField;
public System.Runtime.Serialization.ExtensionDataObject ExtensionData
{
get
{
return this.extensionDataField;
}
set
{
this.extensionDataField = value;
}
}
[System.Runtime.Serialization.DataMemberAttribute()]
public BeWoLauncher.ServiceProxy.BeWoFaultType FaultType
{
get
{
return this.FaultTypeField;
}
set
{
if ((this.FaultTypeField.Equals(value) != true))
{
this.FaultTypeField = value;
this.RaisePropertyChanged("FaultType");
}
}
}
[System.Runtime.Serialization.DataMemberAttribute()]
public string InnerExceptionMessage
{
get
{
return this.InnerExceptionMessageField;
}
set
{
if ((object.ReferenceEquals(this.InnerExceptionMessageField, value) != true))
{
this.InnerExceptionMessageField = value;
this.RaisePropertyChanged("InnerExceptionMessage");
}
}
}
[System.Runtime.Serialization.DataMemberAttribute()]
public string InnerExceptionStackTrace
{
get
{
return this.InnerExceptionStackTraceField;
}
set
{
if ((object.ReferenceEquals(this.InnerExceptionStackTraceField, value) != true))
{
this.InnerExceptionStackTraceField = value;
this.RaisePropertyChanged("InnerExceptionStackTrace");
}
}
}
[System.Runtime.Serialization.DataMemberAttribute()]
public string Message
{
get
{
return this.MessageField;
}
set
{
if ((object.ReferenceEquals(this.MessageField, value) != true))
{
this.MessageField = value;
this.RaisePropertyChanged("Message");
}
}
}
[System.Runtime.Serialization.DataMemberAttribute()]
public string StackTrace
{
get
{
return this.StackTraceField;
}
set
{
if ((object.ReferenceEquals(this.StackTraceField, value) != true))
{
this.StackTraceField = value;
this.RaisePropertyChanged("StackTrace");
}
}
}
public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
protected void RaisePropertyChanged(string propertyName)
{
System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged;
if ((propertyChanged != null))
{
propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
}
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")]
[System.Runtime.Serialization.DataContractAttribute(Name="BeWoFaultType", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")]
public enum BeWoFaultType : int
{
[System.Runtime.Serialization.EnumMemberAttribute()]
Unknown = 0,
[System.Runtime.Serialization.EnumMemberAttribute()]
Concurrency = 1,
[System.Runtime.Serialization.EnumMemberAttribute()]
DeleteNotPossible = 2,
[System.Runtime.Serialization.EnumMemberAttribute()]
LoginNameTaken = 3,
[System.Runtime.Serialization.EnumMemberAttribute()]
CustomWithoutDetails = 4,
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
[System.ServiceModel.ServiceContractAttribute(ConfigurationName="BeWoLauncher.ServiceProxy.ILauncherService")]
public interface ILauncherService
{
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/ILauncherService/IsUserValid", ReplyAction="http://tempuri.org/ILauncherService/IsUserValidResponse")]
[System.ServiceModel.FaultContractAttribute(typeof(BeWoLauncher.ServiceProxy.BeWoFault), Action="http://tempuri.org/ILauncherService/IsUserValidBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")]
BS.SharedLauncher.Enums.UserValidationResult IsUserValid(string pUserName, string pPassword, string pPIN, string clientId, bool checkTenant);
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/ILauncherService/ResetTenant", ReplyAction="http://tempuri.org/ILauncherService/ResetTenantResponse")]
[System.ServiceModel.FaultContractAttribute(typeof(BeWoLauncher.ServiceProxy.BeWoFault), Action="http://tempuri.org/ILauncherService/ResetTenantBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")]
void ResetTenant(string tenant);
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/ILauncherService/ResetAllTenant", ReplyAction="http://tempuri.org/ILauncherService/ResetAllTenantResponse")]
[System.ServiceModel.FaultContractAttribute(typeof(BeWoLauncher.ServiceProxy.BeWoFault), Action="http://tempuri.org/ILauncherService/ResetAllTenantBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")]
void ResetAllTenant();
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/ILauncherService/GetEmailForUserName", ReplyAction="http://tempuri.org/ILauncherService/GetEmailForUserNameResponse")]
[System.ServiceModel.FaultContractAttribute(typeof(BeWoLauncher.ServiceProxy.BeWoFault), Action="http://tempuri.org/ILauncherService/GetEmailForUserNameBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")]
bool GetEmailForUserName(out string email, string pUserName, System.Uri serverName);
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/ILauncherService/CheckPassword", ReplyAction="http://tempuri.org/ILauncherService/CheckPasswordResponse")]
[System.ServiceModel.FaultContractAttribute(typeof(BeWoLauncher.ServiceProxy.BeWoFault), Action="http://tempuri.org/ILauncherService/CheckPasswordBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")]
BS.SharedLauncher.Enums.PasswordValidationResult CheckPassword(long userOid, string pOldPassword, string pNewPassword);
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/ILauncherService/CheckPassword2", ReplyAction="http://tempuri.org/ILauncherService/CheckPassword2Response")]
[System.ServiceModel.FaultContractAttribute(typeof(BeWoLauncher.ServiceProxy.BeWoFault), Action="http://tempuri.org/ILauncherService/CheckPassword2BeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")]
BS.SharedLauncher.Enums.PasswordValidationResult CheckPassword2(string username, string pOldPassword, string pNewPassword);
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/ILauncherService/ChangePassword", ReplyAction="http://tempuri.org/ILauncherService/ChangePasswordResponse")]
[System.ServiceModel.FaultContractAttribute(typeof(BeWoLauncher.ServiceProxy.BeWoFault), Action="http://tempuri.org/ILauncherService/ChangePasswordBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")]
long ChangePassword(string pUserName, string pOldPassword, string pNewPassword);
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/ILauncherService/ResetPasswordInfo", ReplyAction="http://tempuri.org/ILauncherService/ResetPasswordInfoResponse")]
[System.ServiceModel.FaultContractAttribute(typeof(BeWoLauncher.ServiceProxy.BeWoFault), Action="http://tempuri.org/ILauncherService/ResetPasswordInfoBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")]
void ResetPasswordInfo(string pUserName, string pPassword);
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
public interface ILauncherServiceChannel : BeWoLauncher.ServiceProxy.ILauncherService, System.ServiceModel.IClientChannel
{
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
public partial class LauncherServiceClient : System.ServiceModel.ClientBase<BeWoLauncher.ServiceProxy.ILauncherService>, BeWoLauncher.ServiceProxy.ILauncherService
{
public LauncherServiceClient()
{
}
public LauncherServiceClient(string endpointConfigurationName) :
base(endpointConfigurationName)
{
}
public LauncherServiceClient(string endpointConfigurationName, string remoteAddress) :
base(endpointConfigurationName, remoteAddress)
{
}
public LauncherServiceClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) :
base(endpointConfigurationName, remoteAddress)
{
}
public LauncherServiceClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) :
base(binding, remoteAddress)
{
}
public BS.SharedLauncher.Enums.UserValidationResult IsUserValid(string pUserName, string pPassword, string pPIN, string clientId, bool checkTenant)
{
return base.Channel.IsUserValid(pUserName, pPassword, pPIN, clientId, checkTenant);
}
public void ResetTenant(string tenant)
{
base.Channel.ResetTenant(tenant);
}
public void ResetAllTenant()
{
base.Channel.ResetAllTenant();
}
public bool GetEmailForUserName(out string email, string pUserName, System.Uri serverName)
{
return base.Channel.GetEmailForUserName(out email, pUserName, serverName);
}
public BS.SharedLauncher.Enums.PasswordValidationResult CheckPassword(long userOid, string pOldPassword, string pNewPassword)
{
return base.Channel.CheckPassword(userOid, pOldPassword, pNewPassword);
}
public BS.SharedLauncher.Enums.PasswordValidationResult CheckPassword2(string username, string pOldPassword, string pNewPassword)
{
return base.Channel.CheckPassword2(username, pOldPassword, pNewPassword);
}
public long ChangePassword(string pUserName, string pOldPassword, string pNewPassword)
{
return base.Channel.ChangePassword(pUserName, pOldPassword, pNewPassword);
}
public void ResetPasswordInfo(string pUserName, string pPassword)
{
base.Channel.ResetPasswordInfo(pUserName, pPassword);
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
[System.ServiceModel.ServiceContractAttribute(ConfigurationName="BeWoLauncher.ServiceProxy.IEnumTranslationService")]
public interface IEnumTranslationService
{
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IEnumTranslationService/GetTranslation", ReplyAction="http://tempuri.org/IEnumTranslationService/GetTranslationResponse")]
[System.ServiceModel.FaultContractAttribute(typeof(BeWoLauncher.ServiceProxy.BeWoFault), Action="http://tempuri.org/IEnumTranslationService/GetTranslationBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")]
string GetTranslation(string e, short value);
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
public interface IEnumTranslationServiceChannel : BeWoLauncher.ServiceProxy.IEnumTranslationService, System.ServiceModel.IClientChannel
{
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
public partial class EnumTranslationServiceClient : System.ServiceModel.ClientBase<BeWoLauncher.ServiceProxy.IEnumTranslationService>, BeWoLauncher.ServiceProxy.IEnumTranslationService
{
public EnumTranslationServiceClient()
{
}
public EnumTranslationServiceClient(string endpointConfigurationName) :
base(endpointConfigurationName)
{
}
public EnumTranslationServiceClient(string endpointConfigurationName, string remoteAddress) :
base(endpointConfigurationName, remoteAddress)
{
}
public EnumTranslationServiceClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) :
base(endpointConfigurationName, remoteAddress)
{
}
public EnumTranslationServiceClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) :
base(binding, remoteAddress)
{
}
public string GetTranslation(string e, short value)
{
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/Download2", ReplyAction="http://tempuri.org/IDownloadBeWoService/Download2Response")]
[System.ServiceModel.FaultContractAttribute(typeof(BeWoLauncher.ServiceProxy.BeWoFault), Action="http://tempuri.org/IDownloadBeWoService/Download2BeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")]
BS.SharedLauncher.DataContract.UpdateFileResponse Download2(BS.SharedLauncher.DataContract.UpdateRequest request);
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IDownloadBeWoService/DownloadInfo", ReplyAction="http://tempuri.org/IDownloadBeWoService/DownloadInfoResponse")]
[System.ServiceModel.FaultContractAttribute(typeof(BeWoLauncher.ServiceProxy.BeWoFault), Action="http://tempuri.org/IDownloadBeWoService/DownloadInfoBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")]
BS.SharedLauncher.DataContract.UpdateResponse DownloadInfo(BS.SharedLauncher.DataContract.UpdateRequest request);
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IDownloadBeWoService/GetUpdatePlan", ReplyAction="http://tempuri.org/IDownloadBeWoService/GetUpdatePlanResponse")]
[System.ServiceModel.FaultContractAttribute(typeof(BeWoLauncher.ServiceProxy.BeWoFault), Action="http://tempuri.org/IDownloadBeWoService/GetUpdatePlanBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")]
BS.SharedLauncher.DataContract.UpdateResponse GetUpdatePlan(BS.SharedLauncher.DataContract.UpdateRequest request);
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IDownloadBeWoService/GetUpdateFile", ReplyAction="http://tempuri.org/IDownloadBeWoService/GetUpdateFileResponse")]
[System.ServiceModel.FaultContractAttribute(typeof(BeWoLauncher.ServiceProxy.BeWoFault), Action="http://tempuri.org/IDownloadBeWoService/GetUpdateFileBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")]
BS.SharedLauncher.DataContract.UpdateFileResponse GetUpdateFile(BS.SharedLauncher.DataContract.UpdateFileRequest request);
}
[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.UpdateFileResponse Download2(BS.SharedLauncher.DataContract.UpdateRequest request)
{
return base.Channel.Download2(request);
}
public BS.SharedLauncher.DataContract.UpdateResponse DownloadInfo(BS.SharedLauncher.DataContract.UpdateRequest request)
{
return base.Channel.DownloadInfo(request);
}
public BS.SharedLauncher.DataContract.UpdateResponse GetUpdatePlan(BS.SharedLauncher.DataContract.UpdateRequest request)
{
return base.Channel.GetUpdatePlan(request);
}
public BS.SharedLauncher.DataContract.UpdateFileResponse GetUpdateFile(BS.SharedLauncher.DataContract.UpdateFileRequest request)
{
return base.Channel.GetUpdateFile(request);
}
}
}

View File

@@ -105,7 +105,7 @@ namespace BeWoLauncher.Components
private void OkayButton_OnClick(object sender, RoutedEventArgs e)
{
LauncherServiceFacade.DoLauncherServiceAsync(u => u.IsUserValid(ConnectionInformation.Username, PasswordBox.Password, null, null, false), result =>
LauncherServiceFacade.DoLauncherServiceAsync(u => u.IsUserValid(SessionInformation.Login.Username, PasswordBox.Password, null, null, false), result =>
{
if(result == UserValidationResult.UserValid)
{

View File

@@ -70,7 +70,7 @@ namespace BeWoLauncher.Components
var lOld = AltesPwBox.Password;
var lNew = NeuesPwBox.Password;
LauncherServiceFacade.DoLauncherServiceAsync(x => x.CheckPassword2(ConnectionInformation.Username, lOld, lNew),
LauncherServiceFacade.DoLauncherServiceAsync(x => x.CheckPassword2(SessionInformation.Login.Username, lOld, lNew),
result => CheckPasswordResult(result, lOld, lNew), true);
}
@@ -78,9 +78,9 @@ namespace BeWoLauncher.Components
{
if (result == PasswordValidationResult.Succesful)
{
LauncherServiceFacade.DoLauncherServiceSync(x => x.ChangePassword(ConnectionInformation.Username, oldPassword, newPassword));
LauncherServiceFacade.DoLauncherServiceSync(x => x.ChangePassword(SessionInformation.Login.Username, oldPassword, newPassword));
ConnectionInformation.Password = newPassword;
SessionInformation.Login.Password = newPassword;
Dispatcher.BeginInvoke(DispatcherPriority.Normal, (Action)PopUp.Close);
}

View File

@@ -1,75 +0,0 @@
using System;
using System.ComponentModel;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media.Animation;
namespace BeWoLauncher.View.Frames
{
/// <summary>
/// Interaktionslogik für UpdateView.xaml
/// </summary>
public abstract partial class GenericProgressInfo : FrameBase
{
private static TimeSpan duration = TimeSpan.FromSeconds(1);
public readonly BackgroundWorker Worker = new BackgroundWorker();
private int lastStep = -1;
public GenericProgressInfo()
{
InitializeComponent();
proBar1.IsIndeterminate = false;
proBar1.Minimum = 0;
proBar1.Maximum = 100;
proBar2.IsIndeterminate = false;
proBar2.Minimum = 0;
Loaded += (s, e) => Start();
}
public string Message
{
get { return lblMessage.Content as string; }
set { lblMessage.Content = value; }
}
public string SubMessage
{
get { return lblSubmessage.Content as string; }
set { lblSubmessage.Content = value; }
}
public abstract void Start();
public void Bar1Activate() => proBar1.IsIndeterminate = false;
public void Bar1Deactivate() => proBar1.IsIndeterminate = true;
public void Bar1SetLimit(int max) => proBar1.Maximum = max;
public void Bar1MakeStep() => proBar1.Value++;
public void Bar1Hide() => proBar1.Visibility = Visibility.Collapsed;
public void Bar1Show() => proBar1.Visibility = Visibility.Visible;
public void Bar2Activate() => proBar2.IsIndeterminate = false;
public void Bar2Deactivate() => proBar2.IsIndeterminate = true;
public void Bar2SetLimit(int max) => proBar2.Maximum = max;
public void Bar2MakeStep(int step)
{
if (step > lastStep)
{
lastStep = step;
proBar2.Value++;
}
}
public void Bar2Fill() => proBar2.Value = proBar2.Maximum;
public void Bar2Hide() => proBar2.Visibility = Visibility.Collapsed;
public void Bar2Show() => proBar2.Visibility = Visibility.Visible;
public void Bar2SetPercent(double percentage)
{
DoubleAnimation animation = new DoubleAnimation(percentage, duration);
proBar2.BeginAnimation(ProgressBar.ValueProperty, animation);
}
}
}

View File

@@ -9,12 +9,15 @@
<Grid x:Name="root" >
<DockPanel Margin="5">
<Label DockPanel.Dock="Top" FontWeight="Bold" FontSize="15" x:Name="lblTitle">Fehler in der Installation aufgetreten!</Label>
<Label DockPanel.Dock="Top" FontSize="12" x:Name="txtField" VerticalAlignment="Stretch">Hier könnte ihre Fehlermeldung stehen!!</Label>
<StackPanel DockPanel.Dock="Bottom" VerticalAlignment="Bottom" HorizontalAlignment="Center" Orientation="Horizontal" Margin="0,10,0,0">
<Button x:Name="btnCopy" Width="70" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="0,0,5,0" Click="Button_Click">Kopieren</Button>
<Button Width="200" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="0" Click="Button_Click_1">Zurück zum Login</Button>
</StackPanel>
<ScrollViewer DockPanel.Dock="Top" FontSize="12" VerticalAlignment="Stretch">
<TextBlock x:Name="txtField2">
Hier könnte ihre Fehlermeldung stehen!
</TextBlock>
</ScrollViewer>
</DockPanel>
</Grid>
</local:FrameBase>

View File

@@ -35,8 +35,8 @@ namespace BeWoLauncher.View.Frames
public string Text
{
get => txtField.Content as string;
set => txtField.Content = value;
get => txtField2.Text;
set => txtField2.Text = value;
}
public void CollapseCopyButton() => btnCopy.Visibility = Visibility.Collapsed;

View File

@@ -45,12 +45,6 @@
<Label Grid.Column="0" Grid.Row="3" Margin="0,-5,0,0">Verfügbarer Festplattenspeicher:</Label>
<Label Grid.Column="2" Grid.Row="3" Margin="0,-5,0,0" x:Name="lblVerfuegbar" HorizontalAlignment="Right">20.0t</Label>
<Label Grid.Column="3" Grid.Row="3" Margin="0,-5,0,0" x:Name="lblVerfuegbarSize" HorizontalAlignment="Left">GB</Label>
<Label Grid.Column="0" Grid.Row="5" x:Name="lblcountnewtxt">Nicht vorhandene Datei(en):</Label>
<Label Grid.Column="2" Grid.Row="5" x:Name="lblcountnew" HorizontalAlignment="Right">80</Label>
<Label Grid.Column="0" Grid.Row="6" Margin="0,-5,0,0" x:Name="lblcountalreadytxt" >Bereits vorhandene Datei(en):</Label>
<Label Grid.Column="2" Grid.Row="6" Margin="0,-5,0,0" x:Name="lblcountalready" HorizontalAlignment="Right">80</Label>
</Grid>
<StackPanel DockPanel.Dock="Bottom" VerticalAlignment="Bottom" HorizontalAlignment="Center" Orientation="Horizontal" Margin="0,10,0,0">

View File

@@ -23,20 +23,12 @@ namespace BeWoLauncher.View.Frames
InstallLocation = LauncherPaths.GetInstallLocationFromSettingOrDefault();
var size = NonspecificTools.SizeSuffix((ulong)DownloadController.Manager.ResponseInfo.DownloadSize).Split(' ');
var size = NonspecificTools.SizeSuffix((ulong)DownloadController.Manager.UpdatePlanResponse.DownloadSize).Split(' ');
lblErforderlich.Content = size[0];
lblErforderlichSize.Content = size[1];
lblcountnew.Content = $"{DownloadController.Manager.ResponseInfo.NewFileCount}";
lblcountalready.Content = $"{DownloadController.Manager.ResponseInfo.FileCount - DownloadController.Manager.ResponseInfo.NewFileCount}";
lblversion.Content = DownloadController.Manager.ResponseInfo.Version;
lblcountalready.Visibility = Visibility.Hidden;
lblcountalreadytxt.Visibility = Visibility.Hidden;
lblcountnew.Visibility = Visibility.Hidden;
lblcountnewtxt.Visibility = Visibility.Hidden;
lblversion.Content = DownloadController.Manager.UpdatePlanResponse.CurrentPackage.Version;
}
public string InstallLocation

View File

@@ -1,183 +0,0 @@
using BeWoLauncher.Logic.Controller;
using BeWoLauncher.Logic.Utils.Download;
using BS.SharedLauncher.Enums;
using BS.SharedLauncher.Update;
using System;
using System.ComponentModel;
using System.Configuration;
using System.Threading;
namespace BeWoLauncher.View.Frames
{
public class InstallProgressInfoFrame : GenericProgressInfo
{
public event EventHandler InstallSuccessful;
public DownloadManager Manager => DownloadController.Manager;
public InstallProgressInfoFrame() : base()
{
Bar1SetLimit(Manager.ResponseInfo.FileCount);
Bar1Hide();
Bar2SetLimit(100);
}
public override void Start()
{
var skipLock = bool.TryParse(ConfigurationManager.AppSettings.Get("SkipLock"), out bool c) && c;
Worker.DoWork += worker_DoWork;
Worker.ProgressChanged += worker_ProgressChanged;
Worker.RunWorkerCompleted += worker_completed;
Worker.WorkerReportsProgress = true;
Worker.RunWorkerAsync(skipLock);
}
void worker_DoWork(object sender, DoWorkEventArgs e)
{
bool skipLock = (bool)e.Argument;
BackgroundWorker worker = sender as BackgroundWorker;
// UI: 0
worker.ReportProgress((int)LauncherProgress.ProgressStart);
// Wait
Thread.Sleep(1000);
// UI: 1
worker.ReportProgress((int)LauncherProgress.DownloadStart);
// Wait
Thread.Sleep(500);
// Process: 2
DownloadController.Manager.StartDownload(skipLock, worker.ReportProgress);
// UI: 3
worker.ReportProgress((int)LauncherProgress.DownloadFinish);
// Wait
Thread.Sleep(1000);
// UI: 4
worker.ReportProgress((int)LauncherProgress.ApplyStart);
// Wait
Thread.Sleep(500);
// Process: 5
DownloadController.Manager.StartApply(skipLock, worker.ReportProgress);
// UI: 6
worker.ReportProgress((int)LauncherProgress.ApplyFinished);
// Wait
Thread.Sleep(1000);
// Process: 7, Wait, 8
DownloadController.Manager.StartCleanup(worker.ReportProgress);
// UI: 9
worker.ReportProgress((int)LauncherProgress.DeleteFinished);
// Wait
Thread.Sleep(500);
// UI: 10
worker.ReportProgress((int)LauncherProgress.ProgressEnd);
}
private void worker_completed(object sender, RunWorkerCompletedEventArgs e)
{
if (e.Error != null)
{
ViewController.ViewBehavior.InstallationFailed(e.Error);
}
else
{
InstallSuccessful.Invoke(this, new EventArgs());
}
}
private void worker_ProgressChanged(object sender, ProgressChangedEventArgs e)
{
var progress = (LauncherProgress)e.ProgressPercentage;
var obj = e.UserState;
switch (progress)
{
case LauncherProgress.ProgressStart:
Message = "Installation wird vorbereitet...";
SubMessage = "Lade benötigte Pakete herunter...";
break;
case LauncherProgress.DownloadStart:
Message = "Download startet...";
SubMessage = "";
Bar1Show();
Bar1Deactivate();
Bar2SetPercent(10);
break;
case LauncherProgress.DownloadUpdate:
throw new NotImplementedException("#fd42398");
var args = obj as DownloadProgressEventArgs;
SubMessage = $"{args.Progress.ToString("0.##")}% fertig";
break;
case LauncherProgress.DownloadFinish:
Message = "Download abgeschlossen!";
SubMessage = "";
Bar2SetPercent(40);
break;
case LauncherProgress.ApplyStart:
Message = "Füge Pakete hinzu...";
SubMessage = "";
Bar1Activate();
break;
case LauncherProgress.ApplyUpdate:
var args2 = obj as ApplyFileEventArgs;
SubMessage = $"{args2.Name} wurde erfolgreich von \n{args2.AbsolutePath} hinzugefügt!";
Bar1MakeStep();
break;
case LauncherProgress.ApplyFinished:
Message = "Hinzufügen abgeschlossen!";
SubMessage = "";
Bar2SetPercent(80);
Bar1Deactivate();
break;
case LauncherProgress.DeleteStart:
Message = "Ungebrauchte Datei(en) gefunden.";
SubMessage = "";
break;
case LauncherProgress.DeleteUpdate:
var args3 = obj as string;
SubMessage = $"{args3} wurde entfernt!";
break;
case LauncherProgress.DeleteFinished:
Message = "Säuberung abgeschlossen!";
SubMessage = "";
Bar2SetPercent(95);
Bar1Deactivate();
break;
case LauncherProgress.ProgressEnd:
Message = "Installation abgeschlossen!";
SubMessage = "";
Bar2Fill();
break;
default:
break;
}
}
}
}

View File

@@ -1,5 +1,5 @@
<frames:FrameBase
x:Class="BeWoLauncher.View.Frames.GenericProgressInfo"
x:Class="BeWoLauncher.View.Frames.ProgressFrame"
xmlns:frames="clr-namespace:BeWoLauncher.View.Frames"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
@@ -14,7 +14,7 @@
<Label x:Name="lblSubmessage" Content="t - Update wird installiert" Foreground="#FF000000" FontSize="12" />
</StackPanel>
<StackPanel DockPanel.Dock="Top" Margin="0,0,0,0" Orientation="Vertical" VerticalAlignment="Center">
<ProgressBar DockPanel.Dock="Top" x:Name="proBar1" Width="500" Height="20" Minimum="0" Maximum="100" IsIndeterminate="True" Margin="5"/>
<ProgressBar DockPanel.Dock="Top" x:Name="proBar1" Width="500" Height="15" Minimum="0" Maximum="100" IsIndeterminate="True" Margin="5"/>
<ProgressBar DockPanel.Dock="Top" x:Name="proBar2" Width="500" Height="20" Minimum="0" Maximum="100" IsIndeterminate="True"/>
</StackPanel>
</DockPanel>

View File

@@ -0,0 +1,237 @@
using BeWoLauncher.Logic.Controller;
using BS.SharedLauncher.Enums;
using BS.SharedLauncher.Update;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration;
using System.Threading;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media.Animation;
namespace BeWoLauncher.View.Frames
{
/// <summary>
/// Interaktionslogik für UpdateView.xaml
/// </summary>
public partial class ProgressFrame : FrameBase
{
private static TimeSpan duration = TimeSpan.FromSeconds(1);
private int lastStep = -1;
private string[][] keywords = new string[][]
{
new string[]{"Installation", "Ungebrauchte Datei(en) gefunden." },
new string[]{"Update", "Ungebrauchte Datei(en) gefunden."},
new string[]{"Deinstallation", "Deinstallation startet..."},
};
private int keyword_mode;
public readonly BackgroundWorker Worker = new BackgroundWorker();
public event EventHandler Successful;
public event EventHandler Exception;
public LauncherMode LauncherMode { get; set; }
public ProgressFrame(LauncherMode mode)
{
InitializeComponent();
proBar1.IsIndeterminate = false;
proBar1.Minimum = 0;
proBar1.Maximum = 100;
proBar2.IsIndeterminate = false;
proBar2.Minimum = 0;
proBar2.Maximum = DownloadController.Manager.FilesToProcessTotal;
LauncherMode = mode;
keyword_mode = (int)mode;
Loaded += (s, e) => Start();
}
private string getKeyword(int pos) => keywords[keyword_mode][pos];
public string Message
{
get { return lblMessage.Content as string; }
set { lblMessage.Content = value; }
}
public string SubMessage
{
get { return lblSubmessage.Content as string; }
set { lblSubmessage.Content = value; }
}
public void Start()
{
var skipLock = bool.TryParse(ConfigurationManager.AppSettings.Get("SkipLock"), out bool c) && c;
Worker.DoWork += worker_DoWork;
Worker.ProgressChanged += worker_ProgressChanged;
Worker.RunWorkerCompleted += worker_completed;
Worker.WorkerReportsProgress = true;
Worker.RunWorkerAsync(skipLock);
}
void worker_DoWork(object sender, DoWorkEventArgs e)
{
var skipLock = (bool)e.Argument;
var worker = sender as BackgroundWorker;
DownloadController.Manager.SkipLock = skipLock;
DownloadController.Manager.Feedback = worker.ReportProgress;
DownloadController.Manager.StartProcess(worker);
}
private void worker_completed(object sender, RunWorkerCompletedEventArgs e)
{
if (e.Error != null)
{
ViewController.Error = e.Error;
Exception.Invoke(this, new EventArgs());
}
else
{
Successful.Invoke(this, new EventArgs());
}
}
private void worker_ProgressChanged(object sender, ProgressChangedEventArgs e)
{
var progress = (LauncherProgress)e.ProgressPercentage;
var obj = e.UserState;
switch (progress)
{
case LauncherProgress.ProgressStart:
Message = $"{getKeyword(0)} wird vorbereitet...";
SubMessage = "";
Bar2Activate();
break;
case LauncherProgress.DownloadStart:
Message = "Download startet...";
SubMessage = "";
Bar1Show();
Bar1Activate();
Bar1Reset();
Bar1SetLimit(DownloadController.Manager.FilesToDownloadCount);
break;
case LauncherProgress.DownloadUpdate:
var args = obj as DownloadProgressEventArgs;
Message = "Download wird ausgeführt...";
SubMessage = $"{args.File.RelativePath} ({args.Size})\n wurde heruntergeladen...";
Bar1MakeStep();
Bar2MakeStep();
break;
case LauncherProgress.DownloadFinish:
Message = "Download abgeschlossen!";
SubMessage = "";
Bar1Hide();
break;
case LauncherProgress.ApplyStart:
Message = "Füge Pakete hinzu...";
SubMessage = "";
Bar1Show();
Bar1Activate();
Bar1Reset();
Bar1SetLimit(DownloadController.Manager.FilesToApplyCount);
break;
case LauncherProgress.ApplyUpdate:
var args2 = obj as ApplyFileEventArgs;
SubMessage = $"{args2.RelativePath}\n wurde installiert...";
Bar1MakeStep();
Bar2MakeStep();
break;
case LauncherProgress.ApplyFinished:
Message = "Hinzufügen abgeschlossen!";
SubMessage = "";
Bar1Hide();
break;
case LauncherProgress.DeleteStart:
Message = getKeyword(1);
SubMessage = "";
Bar1Show();
Bar1Activate();
Bar1Reset();
Bar1SetLimit(DownloadController.Manager.FilesToDeleteInApplyCount);
break;
case LauncherProgress.DeleteUpdate:
var args3 = obj as string;
SubMessage = $"{args3}\n wurde entfernt!";
Bar1MakeStep();
Bar2MakeStep();
break;
case LauncherProgress.DeleteFinished:
Message = "Säuberung abgeschlossen!";
SubMessage = "";
Bar1Hide();
break;
case LauncherProgress.CleanupStart:
Message = "Räume hier noch eben auf...";
SubMessage = "";
Bar1Show();
Bar1Deactivate();
break;
case LauncherProgress.CleanupUpdate:
break;
case LauncherProgress.CleanupFinished:
Message = "Blitze blank...";
SubMessage = "";
break;
case LauncherProgress.ProgressEnd:
Message = $"{getKeyword(0)} abgeschlossen!";
SubMessage = "";
Bar2Fill();
break;
default:
break;
}
}
#region a
public void Bar1Activate() => proBar1.IsIndeterminate = false;
public void Bar1Deactivate() => proBar1.IsIndeterminate = true;
public void Bar1SetLimit(int max) => proBar1.Maximum = max;
public void Bar1Reset() => proBar1.Value = 0;
public void Bar1MakeStep() => proBar1.Value++;
public void Bar1Hide() => proBar1.Visibility = Visibility.Hidden;
public void Bar1Show() => proBar1.Visibility = Visibility.Visible;
public void Bar2Activate() => proBar2.IsIndeterminate = false;
public void Bar2Deactivate() => proBar2.IsIndeterminate = true;
public void Bar2SetLimit(int max) => proBar2.Maximum = max;
public void Bar2MakeStep() => proBar2.Value++;
public void Bar2MakeStep(int val) => proBar2.Value += val;
public void Bar2Fill() => proBar2.Value = proBar2.Maximum;
public void Bar2Hide() => proBar2.Visibility = Visibility.Hidden;
public void Bar2Show() => proBar2.Visibility = Visibility.Visible;
public void Bar2SetPercent(double percentage)
{
DoubleAnimation animation = new DoubleAnimation(percentage, duration);
proBar2.BeginAnimation(ProgressBar.ValueProperty, animation);
}
#endregion
}
}

View File

@@ -1,69 +0,0 @@
using BeWoLauncher.Logic.Controller;
using BS.SharedLauncher.Update;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace BeWoLauncher.View.Frames
{
public class UninstallProgressInfoFrame : GenericProgressInfo
{
public event EventHandler UninstallSuccessful;
public UninstallProgressInfoFrame()
{
Bar1Deactivate();
Bar2Hide();
}
public override void Start()
{
Worker.DoWork += worker_DoWork;
Worker.ProgressChanged += worker_ProgressChanged;
Worker.RunWorkerCompleted += worker_completed;
Worker.WorkerReportsProgress = true;
Worker.RunWorkerAsync();
}
void worker_DoWork(object sender, DoWorkEventArgs e)
{
BackgroundWorker worker = sender as BackgroundWorker;
DownloadController.Manager.StartUninstall(worker.ReportProgress);
}
private void worker_completed(object sender, RunWorkerCompletedEventArgs e)
{
if (e.Error != null)
{
ViewController.ViewBehavior.UninstallFailed(e.Error);
}
else
{
UninstallSuccessful.Invoke(this, new EventArgs());
}
}
private void worker_ProgressChanged(object sender, ProgressChangedEventArgs e)
{
if (e.ProgressPercentage == 3)
{
Bar1Deactivate();
Message = "Alte Dateien werden entfernt.";
SubMessage = "";
}
else if (e.ProgressPercentage == 4)
{
var args = e.UserState as string;
SubMessage = $"{args} wurde entfernt!";
}
}
}
}

View File

@@ -47,14 +47,6 @@
<Label Grid.Column="0" Grid.Row="3" Margin="0,-5,0,0">Verfügbarer Festplattenspeicher:</Label>
<Label Grid.Column="2" Grid.Row="3" Margin="0,-5,0,0" x:Name="lblVerfuegbar" HorizontalAlignment="Right">20.0t</Label>
<Label Grid.Column="3" Grid.Row="3" Margin="0,-5,0,0" x:Name="lblVerfuegbarSize" HorizontalAlignment="Left">GB</Label>
<Label Grid.Column="0" Grid.Row="7" x:Name="lblcountnewtxt">Nicht vorhandene Datei(en):</Label>
<Label Grid.Column="2" Grid.Row="7" x:Name="lblcountnew" HorizontalAlignment="Right">80</Label>
<Label Grid.Column="0" Grid.Row="8" Margin="0,-5,0,0" x:Name="lblcountalreadytxt">Bereits vorhandene Datei(en):</Label>
<Label Grid.Column="2" Grid.Row="8" Margin="0,-5,0,0" x:Name="lblcountalready" HorizontalAlignment="Right">80</Label>
<Label Grid.Column="0" Grid.ColumnSpan="3" Grid.Row="9" Margin="0,3,0,0" x:Name="lblfound" HorizontalAlignment="Left">Bereits heruntergeladene Dateien gefunden</Label>
</Grid>
<StackPanel DockPanel.Dock="Bottom" VerticalAlignment="Bottom" HorizontalAlignment="Center" Orientation="Horizontal" Margin="0,10,0,0">

View File

@@ -33,7 +33,7 @@ namespace BeWoLauncher.View.Frames
LauncherPaths.ActualPlanerLocation = LauncherPaths.GetInstallLocationFromSetting();
var size = NonspecificTools.SizeSuffix((ulong)DownloadController.Manager.ResponseInfo.DownloadSize).Split(' ');
var size = NonspecificTools.SizeSuffix((ulong)DownloadController.Manager.UpdatePlanResponse.DownloadSize).Split(' ');
lblErforderlich.Content = size[0];
lblErforderlichSize.Content = size[1];
@@ -51,21 +51,7 @@ namespace BeWoLauncher.View.Frames
lblVerfuegbarSize.Content = string.Empty;
}
var total = DownloadController.Manager.ResponseInfo.FileCount;
var download = DownloadController.Manager.ResponseInfo.NewFileCount;
var already = total - download;
lblcountnew.Content = $"{download}";
lblcountalready.Content = $"{already}";
lblversion.Content = DownloadController.Manager.ResponseInfo.Version;
lblcountalready.Visibility = Visibility.Hidden;
lblcountalreadytxt.Visibility = Visibility.Hidden;
lblcountnew.Visibility = Visibility.Hidden;
lblcountnewtxt.Visibility = Visibility.Hidden;
lblfound.Visibility = already == 0 ? Visibility.Hidden : Visibility.Visible;
lblversion.Content = DownloadController.Manager.UpdatePlanResponse.CurrentPackage.Version;
}
private void Button_Click(object sender, RoutedEventArgs e)

View File

@@ -1,183 +0,0 @@
using BeWoLauncher.Logic.Controller;
using BeWoLauncher.Logic.Utils.Download;
using BS.SharedLauncher.Enums;
using BS.SharedLauncher.Update;
using System;
using System.ComponentModel;
using System.Configuration;
using System.Threading;
namespace BeWoLauncher.View.Frames
{
public class UpdateProgressInfoFrame : GenericProgressInfo
{
public event EventHandler UpdateSuccessful;
public DownloadManager Manager => DownloadController.Manager;
public UpdateProgressInfoFrame()
{
Bar1SetLimit(Manager.ResponseInfo.FileCount);
Bar1Hide();
Bar2SetLimit(100);
}
public override void Start()
{
var skipLock = bool.TryParse(ConfigurationManager.AppSettings.Get("SkipLock"), out bool c) && c;
Worker.DoWork += worker_DoWork;
Worker.ProgressChanged += worker_ProgressChanged;
Worker.RunWorkerCompleted += worker_completed;
Worker.WorkerReportsProgress = true;
Worker.RunWorkerAsync(skipLock);
}
void worker_DoWork(object sender, DoWorkEventArgs e)
{
bool skipLock = (bool)e.Argument;
BackgroundWorker worker = sender as BackgroundWorker;
// UI: 0
worker.ReportProgress((int)LauncherProgress.ProgressStart);
// Wait
Thread.Sleep(1000);
// UI: 1
worker.ReportProgress((int)LauncherProgress.DownloadStart);
// Wait
Thread.Sleep(500);
// Process: 2
DownloadController.Manager.StartDownload(skipLock, worker.ReportProgress);
// UI: 3
worker.ReportProgress((int)LauncherProgress.DownloadFinish);
// Wait
Thread.Sleep(1000);
// UI: 4
worker.ReportProgress((int)LauncherProgress.ApplyStart);
// Wait
Thread.Sleep(500);
// Process: 5
DownloadController.Manager.StartApply(skipLock, worker.ReportProgress);
// UI: 6
worker.ReportProgress((int)LauncherProgress.ApplyFinished);
// Wait
Thread.Sleep(1000);
// Process: 7, Wait, 8
DownloadController.Manager.StartCleanup(worker.ReportProgress);
// UI: 9
worker.ReportProgress((int)LauncherProgress.DeleteFinished);
// Wait
Thread.Sleep(500);
// UI: 10
worker.ReportProgress((int)LauncherProgress.ProgressEnd);
}
private void worker_completed(object sender, RunWorkerCompletedEventArgs e)
{
if (e.Error != null)
{
ViewController.ViewBehavior.UpdateFailed(e.Error);
}
else
{
UpdateSuccessful.Invoke(this, new EventArgs());
}
}
private void worker_ProgressChanged(object sender, ProgressChangedEventArgs e)
{
var progress = (LauncherProgress)e.ProgressPercentage;
var obj = e.UserState;
switch (progress)
{
case LauncherProgress.ProgressStart:
Message = "Update wird vorbereitet...";
SubMessage = "Lade benötigte Pakete herunter...";
break;
case LauncherProgress.DownloadStart:
Message = "Download startet...";
SubMessage = "";
Bar1Show();
Bar1Deactivate();
Bar2SetPercent(5);
break;
case LauncherProgress.DownloadUpdate:
throw new NotImplementedException("#fd42398");
var args = obj as DownloadProgressEventArgs;
SubMessage = $"{args.Progress.ToString("0.##")}% fertig";
break;
case LauncherProgress.DownloadFinish:
Message = "Download abgeschlossen!";
SubMessage = "";
Bar2SetPercent(40);
break;
case LauncherProgress.ApplyStart:
Message = "Füge Pakete hinzu...";
SubMessage = "";
Bar1Activate();
break;
case LauncherProgress.ApplyUpdate:
var args2 = obj as ApplyFileEventArgs;
SubMessage = $"{args2.Name} wurde erfolgreich von \n{args2.AbsolutePath} hinzugefügt!";
Bar1MakeStep();
break;
case LauncherProgress.ApplyFinished:
Message = "Hinzufügen abgeschlossen!";
SubMessage = "";
Bar2SetPercent(80);
Bar1Deactivate();
break;
case LauncherProgress.DeleteStart:
Message = "Ungebrauchte Datei(en) gefunden.";
SubMessage = "";
break;
case LauncherProgress.DeleteUpdate:
var args3 = obj as string;
SubMessage = $"{args3} wurde entfernt!";
break;
case LauncherProgress.DeleteFinished:
Message = "Säuberung abgeschlossen!";
SubMessage = "";
Bar2SetPercent(95);
Bar1Deactivate();
break;
case LauncherProgress.ProgressEnd:
Message = "Installation abgeschlossen!";
SubMessage = "";
Bar2Fill();
break;
default:
break;
}
}
}
}

View File

@@ -12,7 +12,6 @@ using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Deployment.Application;
using System.IO;
using System.Linq;
using System.Net;
@@ -113,19 +112,19 @@ namespace BeWoLauncher.View
private void button_login_Click(object sender, RoutedEventArgs e)
{
if (!String.IsNullOrEmpty(ConnectionInformation.ProxyName))
if (!String.IsNullOrEmpty(SessionInformation.Connection.ProxyName))
{
var webProxy = WebProxy.GetDefaultProxy();
webProxy.UseDefaultCredentials = true;
System.Net.WebRequest.DefaultWebProxy = new WebProxy(ConnectionInformation.ProxyName, true);
System.Net.WebRequest.DefaultWebProxy = new WebProxy(SessionInformation.Connection.ProxyName, true);
if (String.IsNullOrEmpty(ConnectionInformation.ProxyUsername))
if (String.IsNullOrEmpty(SessionInformation.Connection.ProxyUsername))
{
WebRequest.DefaultWebProxy.Credentials = CredentialCache.DefaultNetworkCredentials;
}
else
{
WebRequest.DefaultWebProxy.Credentials = new NetworkCredential(ConnectionInformation.ProxyUsername, ConnectionInformation.ProxyPassword);
WebRequest.DefaultWebProxy.Credentials = new NetworkCredential(SessionInformation.Connection.ProxyUsername, SessionInformation.Connection.ProxyPassword);
}
}
@@ -168,18 +167,17 @@ namespace BeWoLauncher.View
ViewController.StartWaiting();
string lUserName = TextBox_Username.Text;
string lPassword = PasswordBox_Password.Password;
string lPIN = PINTextBox.Text;
string lTenant = ConnectionInformation.Tenant;
SessionInformation.Login.Username = TextBox_Username.Text;
SessionInformation.Login.Password = PasswordBox_Password.Password;
SessionInformation.Login.Pin = PINTextBox.Text;
if (!String.IsNullOrEmpty(lPIN))
if (!String.IsNullOrEmpty(SessionInformation.Login.Pin))
{
lPIN += "_" + System.Environment.MachineName;
SessionInformation.Login.Pin += "_" + System.Environment.MachineName;
}
Action<String, String, String, String> action = Login;
action.BeginInvoke(lUserName, lPassword, lTenant, lPIN, cb => { }, null);
Action action = Login;
action.BeginInvoke(cb => { }, null);
}
}
private void Hyperlink_OnRequestNavigate(object sender, RequestNavigateEventArgs e)
@@ -358,12 +356,12 @@ namespace BeWoLauncher.View
string v1, v2;
paramDic.TryGetValue("k", out v1);
paramDic.TryGetValue("s", out v2);
ConnectionInformation.Tenant = v1;
ConnectionInformation.ServerName = v2;
SessionInformation.Login.Tenant = v1;
SessionInformation.Connection.Servername = v2;
if (ProfileList.Count > 0)
ProfileList.Insert(0, new ConnectionProfile(v1, v2, ConnectionInformation.Tenant));
ProfileList.Insert(0, new ConnectionProfile(v1, v2, SessionInformation.Login.Tenant));
else
ProfileList.Add(new ConnectionProfile(v1, v2, ConnectionInformation.Tenant));
ProfileList.Add(new ConnectionProfile(v1, v2, SessionInformation.Login.Tenant));
SaveProfileListToFile();
#else
if (ApplicationDeployment.IsNetworkDeployed && ApplicationDeployment.CurrentDeployment.ActivationUri != null)
@@ -460,19 +458,19 @@ namespace BeWoLauncher.View
ChangeServerAndTenant(profileSelectionComboBox.SelectedItem as ConnectionProfile);
if (!String.IsNullOrEmpty(ConnectionInformation.ProxyName))
if (!String.IsNullOrEmpty(SessionInformation.Connection.ProxyName))
{
var webProxy = WebProxy.GetDefaultProxy();
webProxy.UseDefaultCredentials = true;
System.Net.WebRequest.DefaultWebProxy = new WebProxy(ConnectionInformation.ProxyName, true);
System.Net.WebRequest.DefaultWebProxy = new WebProxy(SessionInformation.Connection.ProxyName, true);
if (String.IsNullOrEmpty(ConnectionInformation.ProxyUsername))
if (String.IsNullOrEmpty(SessionInformation.Connection.ProxyUsername))
{
WebRequest.DefaultWebProxy.Credentials = CredentialCache.DefaultNetworkCredentials;
}
else
{
WebRequest.DefaultWebProxy.Credentials = new NetworkCredential(ConnectionInformation.ProxyUsername, ConnectionInformation.ProxyPassword);
WebRequest.DefaultWebProxy.Credentials = new NetworkCredential(SessionInformation.Connection.ProxyUsername, SessionInformation.Connection.ProxyPassword);
}
}
}
@@ -629,14 +627,14 @@ namespace BeWoLauncher.View
{
Uri path = new Uri(adminUrl);
ConnectionInformation.IpAddress = Encoding.UTF8.GetString(wc.DownloadData(path));
SessionInformation.Connection.IpAddress = Encoding.UTF8.GetString(wc.DownloadData(path));
}
}
}
catch (Exception)
{
ConnectionInformation.IpAddress = String.Empty;
SessionInformation.Connection.IpAddress = String.Empty;
}
}
private string GetAdminUrl()
@@ -706,11 +704,11 @@ namespace BeWoLauncher.View
file.Close();
ConnectionInformation.ProxyName = datai[0];
ConnectionInformation.ProxyUsername = datai[1];
ConnectionInformation.ProxyPassword = datai[2];
SessionInformation.Connection.ProxyName = datai[0];
SessionInformation.Connection.ProxyUsername = datai[1];
SessionInformation.Connection.ProxyPassword = datai[2];
proxyTextBox.Text = ConnectionInformation.ProxyName;
proxyTextBox.Text = SessionInformation.Connection.ProxyName;
}
catch (IOException)
@@ -847,11 +845,16 @@ namespace BeWoLauncher.View
SaveProfileListToFile();
}
ConnectionInformation.Tenant = profile.Tenant;
ConnectionInformation.ServerName = GetNumericServerName(profile.Server);
ConnectionInformation.LauncherServerAddress = profile.Server;
SessionInformation.Login.Tenant = profile.Tenant;
SessionInformation.Connection.Servername = GetNumericServerName(profile.Server);
SessionInformation.Connection.CoreServerAddress = profile.Server;
SessionInformation.Connection.DownloadServerAddress = profile.Server;
#if DEBUG
SessionInformation.Connection.DownloadServerAddress = SessionInformation.GetDebugConnection(1);
SessionInformation.Connection.CoreServerAddress = SessionInformation.GetDebugConnection(2);
//CB ZUM TESTEN
//ConnectionInformation.Tenant = "9876543210";
//ConnectionInformation.ServerName = "4";
@@ -1010,20 +1013,20 @@ namespace BeWoLauncher.View
return true;
#endif
}
private void Login(String lUserName, String lPassword, String lTenant, String lPIN)
private void Login()
{
try
{
//1. Versuch
UserValidationResult result = TryLogin(lUserName, lPassword, lPIN);
UserValidationResult result = TryLogin();
//2. Versuch
if (result == UserValidationResult.UnknownError)
{
LauncherServiceFacade.DoLauncherServiceAsync(op => op.ResetTenant(lTenant),
LauncherServiceFacade.DoLauncherServiceAsync(op => op.ResetTenant(SessionInformation.Login.Tenant),
delegate
{
result = TryLogin(lUserName, lPassword, lPIN);
result = TryLogin();
if (result == UserValidationResult.UnknownError)
{
@@ -1031,7 +1034,7 @@ namespace BeWoLauncher.View
LauncherServiceFacade.DoLauncherServiceAsync(op => op.ResetAllTenant(),
delegate
{
result = TryLogin(lUserName, lPassword, lPIN);
result = TryLogin();
if (result == UserValidationResult.UnknownError)
{
@@ -1059,14 +1062,14 @@ namespace BeWoLauncher.View
this.Dispatcher.BeginInvoke(DispatcherPriority.Normal, (Action)delegate
{
ViewController.EndWaiting();
MessageBox.Show("Die Kundennummer '" + lTenant + "' ist ungültig.", "Fehler bei der Anmeldung", MessageBoxButton.OK, MessageBoxImage.Exclamation);
MessageBox.Show("Die Kundennummer '" + SessionInformation.Login.Tenant + "' ist ungültig.", "Fehler bei der Anmeldung", MessageBoxButton.OK, MessageBoxImage.Exclamation);
});
}
String pin = lPIN;
String pin = SessionInformation.Login.Pin;
if (!String.IsNullOrEmpty(lPIN) && lPIN.IndexOf('_') >= 0)
if (!String.IsNullOrEmpty(SessionInformation.Login.Pin) && SessionInformation.Login.Pin.IndexOf('_') >= 0)
{
pin = lPIN.Substring(0, lPIN.IndexOf('_'));
pin = SessionInformation.Login.Pin.Substring(0, SessionInformation.Login.Pin.IndexOf('_'));
}
if (result == UserValidationResult.IncorrectPin)
@@ -1115,13 +1118,12 @@ namespace BeWoLauncher.View
LauncherApp.ShowError(ex); //MessageBox.Show(ex.Message);
}
}
private UserValidationResult TryLogin(string lUserName, string lPassword, string lPIN = "")
private UserValidationResult TryLogin()
{
UserValidationResult? result = null;
if (!string.IsNullOrEmpty(lUserName) && !string.IsNullOrEmpty(lPassword))
if (!string.IsNullOrEmpty(SessionInformation.Login.Username) && !string.IsNullOrEmpty(SessionInformation.Login.Password))
{
String tempUsername = lUserName;
String version = "unbekannt";
String clr = "unbekannt";
var bewoVersion = LauncherApp.Version;
@@ -1145,14 +1147,17 @@ namespace BeWoLauncher.View
}
tempUsername = String.Format("{0}//Version={1};CLRVersion={2};BeWoVersion={3};IsNet45OrNewer={4}", lUserName, version, clr, bewoVersion, isNet45OrNewer);
SessionInformation.Login.TempUsername =
$"{SessionInformation.Login.Username}" +
$"//Version={version};CLRVersion={clr};BeWoVersion={bewoVersion};IsNet45OrNewer={isNet45OrNewer}";
try
{
LauncherServiceFacade.DoLauncherServiceAsync(s =>
{
try
{
var t = s.IsUserValid(tempUsername, lPassword, lPIN, "BeWoClient", true);
SessionInformation.Login.ClientId = "BeWoClient";
var t = s.IsUserValid(SessionInformation.Login.TempUsername, SessionInformation.Login.Password, SessionInformation.Login.Pin, SessionInformation.Login.ClientId, true);
return t;
}
catch (Exception e)
@@ -1163,7 +1168,7 @@ namespace BeWoLauncher.View
r =>
{
result = r;
Dispatcher.BeginInvoke(DispatcherPriority.Normal, (Action)delegate { LoginResult(r, lUserName, lPassword, lPIN); });
Dispatcher.BeginInvoke(DispatcherPriority.Normal, (Action)delegate { LoginResult(r); });
}, true);
}
catch (Exception e)
@@ -1184,13 +1189,10 @@ namespace BeWoLauncher.View
return result.Value;
}
private void LoginResult(UserValidationResult result, String lUserName, String lPassword, String lPIN = "")
private void LoginResult(UserValidationResult result)
{
if (result == UserValidationResult.UserValid)
{
ConnectionInformation.Username = lUserName;
ConnectionInformation.Password = lPassword;
LoginSuccessful.Invoke(this, new EventArgs());
}
else if (result == UserValidationResult.PasswordExpired)
@@ -1205,9 +1207,6 @@ namespace BeWoLauncher.View
if (!window.Abbruch)
{
ConnectionInformation.Username = lUserName;
ConnectionInformation.Password = lPassword;
LoginSuccessful.Invoke(this, new EventArgs());
}
});

View File

@@ -31,10 +31,16 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ChatController", "..\Chat\C
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BeWoLauncher", "BeWoLauncher\BeWoLauncher.csproj", "{E3BA193A-A64F-4CE6-91BE-F54E551797BE}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LauncherHost", "LauncherHost\LauncherHost.csproj", "{18019E8C-C6DA-4B1B-9C2B-908BC14911AB}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DownloadServer", "DownloadServer\DownloadServer.csproj", "{18019E8C-C6DA-4B1B-9C2B-908BC14911AB}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharedLauncher", "SharedLauncher\SharedLauncher.csproj", "{EFE05C79-E0DD-4311-8B90-A8DA7EBDF36F}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Test", "Test", "{CA77E4CE-37D5-489D-9009-ACC75DFC421E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BeWoTest", "BeWoTest\BeWoTest.csproj", "{767ACFAF-D6ED-4DFD-AC49-0990F23B2239}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTests", "UnitTests\UnitTests.csproj", "{825B9513-40EF-48C1-A354-9D4503A3FA74}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|.NET = Debug|.NET
@@ -173,6 +179,30 @@ Global
{EFE05C79-E0DD-4311-8B90-A8DA7EBDF36F}.Release|Any CPU.Build.0 = Release|Any CPU
{EFE05C79-E0DD-4311-8B90-A8DA7EBDF36F}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{EFE05C79-E0DD-4311-8B90-A8DA7EBDF36F}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{767ACFAF-D6ED-4DFD-AC49-0990F23B2239}.Debug|.NET.ActiveCfg = Debug|Any CPU
{767ACFAF-D6ED-4DFD-AC49-0990F23B2239}.Debug|.NET.Build.0 = Debug|Any CPU
{767ACFAF-D6ED-4DFD-AC49-0990F23B2239}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{767ACFAF-D6ED-4DFD-AC49-0990F23B2239}.Debug|Any CPU.Build.0 = Debug|Any CPU
{767ACFAF-D6ED-4DFD-AC49-0990F23B2239}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{767ACFAF-D6ED-4DFD-AC49-0990F23B2239}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{767ACFAF-D6ED-4DFD-AC49-0990F23B2239}.Release|.NET.ActiveCfg = Release|Any CPU
{767ACFAF-D6ED-4DFD-AC49-0990F23B2239}.Release|.NET.Build.0 = Release|Any CPU
{767ACFAF-D6ED-4DFD-AC49-0990F23B2239}.Release|Any CPU.ActiveCfg = Release|Any CPU
{767ACFAF-D6ED-4DFD-AC49-0990F23B2239}.Release|Any CPU.Build.0 = Release|Any CPU
{767ACFAF-D6ED-4DFD-AC49-0990F23B2239}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{767ACFAF-D6ED-4DFD-AC49-0990F23B2239}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{825B9513-40EF-48C1-A354-9D4503A3FA74}.Debug|.NET.ActiveCfg = Debug|Any CPU
{825B9513-40EF-48C1-A354-9D4503A3FA74}.Debug|.NET.Build.0 = Debug|Any CPU
{825B9513-40EF-48C1-A354-9D4503A3FA74}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{825B9513-40EF-48C1-A354-9D4503A3FA74}.Debug|Any CPU.Build.0 = Debug|Any CPU
{825B9513-40EF-48C1-A354-9D4503A3FA74}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{825B9513-40EF-48C1-A354-9D4503A3FA74}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{825B9513-40EF-48C1-A354-9D4503A3FA74}.Release|.NET.ActiveCfg = Release|Any CPU
{825B9513-40EF-48C1-A354-9D4503A3FA74}.Release|.NET.Build.0 = Release|Any CPU
{825B9513-40EF-48C1-A354-9D4503A3FA74}.Release|Any CPU.ActiveCfg = Release|Any CPU
{825B9513-40EF-48C1-A354-9D4503A3FA74}.Release|Any CPU.Build.0 = Release|Any CPU
{825B9513-40EF-48C1-A354-9D4503A3FA74}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{825B9513-40EF-48C1-A354-9D4503A3FA74}.Release|Mixed Platforms.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -188,6 +218,7 @@ Global
{8A83C4DC-A0B1-4A51-AE1D-366D7A05B298} = {E7543C39-A44C-40C9-82C9-E7FAA2D9A852}
{E3BA193A-A64F-4CE6-91BE-F54E551797BE} = {E7543C39-A44C-40C9-82C9-E7FAA2D9A852}
{18019E8C-C6DA-4B1B-9C2B-908BC14911AB} = {FEB0336B-F053-40B6-92DD-7DE56AB9408A}
{767ACFAF-D6ED-4DFD-AC49-0990F23B2239} = {CA77E4CE-37D5-489D-9009-ACC75DFC421E}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {5352BE53-F2FD-442F-85A8-4157599AA153}

6
BeWoTest/App.config Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
</configuration>

9
BeWoTest/App.xaml Normal file
View File

@@ -0,0 +1,9 @@
<Application x:Class="BeWoTest.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:BeWoTest"
StartupUri="MainWindow.xaml">
<Application.Resources>
</Application.Resources>
</Application>

22
BeWoTest/App.xaml.cs Normal file
View File

@@ -0,0 +1,22 @@
using BS.SharedLauncher.Information;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
namespace BeWoTest
{
/// <summary>
/// Interaktionslogik für "App.xaml"
/// </summary>
public partial class App : Application
{
protected override void OnStartup(StartupEventArgs e)
{
SessionInformation.LoadPipe(e.Args[0]);
}
}
}

103
BeWoTest/BeWoTest.csproj Normal file
View File

@@ -0,0 +1,103 @@
<?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>{767ACFAF-D6ED-4DFD-AC49-0990F23B2239}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>BeWoTest</RootNamespace>
<AssemblyName>BeWoPlaner</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="App.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Page Include="MainWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="MainWindow.xaml.cs">
<DependentUpon>MainWindow.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\SharedLauncher\SharedLauncher.csproj">
<Project>{EFE05C79-E0DD-4311-8B90-A8DA7EBDF36F}</Project>
<Name>SharedLauncher</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

16
BeWoTest/MainWindow.xaml Normal file
View File

@@ -0,0 +1,16 @@
<Window x:Class="BeWoTest.MainWindow"
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"
xmlns:local="clr-namespace:BeWoTest"
mc:Ignorable="d"
Title="Test Window" Height="450" Width="800">
<StackPanel VerticalAlignment="Center">
<ScrollViewer>
<TextBox x:Name="testtxt" FontSize="16" HorizontalAlignment="Center" VerticalAlignment="Center" TextWrapping="Wrap" TextAlignment="Center">
adafsafdssssssssssssssssssssssssssssssssgfddddddddddddddddddddddfkjaghuiareghuirgheaurighbireuahgiuaerhgiuaerghhergaihhgaressssssssssssasdf
</TextBox>
</ScrollViewer>
</StackPanel>
</Window>

View File

@@ -0,0 +1,33 @@
using BS.SharedLauncher.Information;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace BeWoTest
{
/// <summary>
/// Interaktionslogik für MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
testtxt.Text = SessionInformation.ToString();
Console.WriteLine("GUI geladen");
}
}
}

View File

@@ -0,0 +1,55 @@
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
// 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("BeWoTest")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("BeWoTest")]
[assembly: AssemblyCopyright("Copyright © 2022")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Durch Festlegen von ComVisible auf FALSE werden die Typen in dieser Assembly
// für COM-Komponenten unsichtbar. Wenn Sie auf einen Typ in dieser Assembly von
// COM aus zugreifen müssen, sollten Sie das ComVisible-Attribut für diesen Typ auf "True" festlegen.
[assembly: ComVisible(false)]
//Um mit dem Erstellen lokalisierbarer Anwendungen zu beginnen, legen Sie
//<UICulture>ImCodeVerwendeteKultur</UICulture> in der .csproj-Datei
//in einer <PropertyGroup> fest. Wenn Sie in den Quelldateien beispielsweise Deutsch
//(Deutschland) verwenden, legen Sie <UICulture> auf \"de-DE\" fest. Heben Sie dann die Auskommentierung
//des nachstehenden NeutralResourceLanguage-Attributs auf. Aktualisieren Sie "en-US" in der nachstehenden Zeile,
//sodass es mit der UICulture-Einstellung in der Projektdatei übereinstimmt.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //Speicherort der designspezifischen Ressourcenwörterbücher
//(wird verwendet, wenn eine Ressource auf der Seite nicht gefunden wird,
// oder in den Anwendungsressourcen-Wörterbüchern nicht gefunden werden kann.)
ResourceDictionaryLocation.SourceAssembly //Speicherort des generischen Ressourcenwörterbuchs
//(wird verwendet, wenn eine Ressource auf der Seite nicht gefunden wird,
// designspezifischen Ressourcenwörterbuch nicht gefunden werden kann.)
)]
// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
//
// Hauptversion
// Nebenversion
// Buildnummer
// Revision
//
// Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden,
// übernehmen, indem Sie "*" eingeben:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -0,0 +1,71 @@
//------------------------------------------------------------------------------
// <auto-generated>
// Dieser Code wurde von einem Tool generiert.
// Laufzeitversion: 4.0.30319.42000
//
// Änderungen an dieser Datei können fehlerhaftes Verhalten verursachen und gehen verloren, wenn
// der Code neu generiert wird.
// </auto-generated>
//------------------------------------------------------------------------------
namespace BeWoTest.Properties
{
/// <summary>
/// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw.
/// </summary>
// Diese Klasse wurde von der StronglyTypedResourceBuilder-Klasse
// über ein Tool wie ResGen oder Visual Studio automatisch generiert.
// Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen
// mit der Option /str erneut aus, oder erstellen Sie Ihr VS-Projekt neu.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.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>
/// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager
{
get
{
if ((resourceMan == null))
{
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("BeWoTest.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle
/// Ressourcenlookups, die diese stark typisierte Ressourcenklasse verwenden.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
}
}

View File

@@ -0,0 +1,117 @@
<?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.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: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" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</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" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</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=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

30
BeWoTest/Properties/Settings.Designer.cs generated Normal file
View File

@@ -0,0 +1,30 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace BeWoTest.Properties
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default
{
get
{
return defaultInstance;
}
}
}
}

View File

@@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

View File

@@ -12,12 +12,13 @@
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>LauncherHost</RootNamespace>
<AssemblyName>LauncherHost</AssemblyName>
<RootNamespace>DownloadServer</RootNamespace>
<AssemblyName>DownloadServer</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<UseIISExpress>true</UseIISExpress>
<Use64BitIISExpress />
<IISExpressSSLPort />
<IISExpressSSLPort>
</IISExpressSSLPort>
<IISExpressAnonymousAuthentication />
<IISExpressWindowsAuthentication />
<IISExpressUseClassicPipelineMode />
@@ -78,9 +79,7 @@
</Reference>
</ItemGroup>
<ItemGroup>
<Content Include="EnumTranslationService.svc" />
<Content Include="DownloadBeWoService.svc" />
<Content Include="LauncherService.svc" />
<Content Include="Multitenancy\Symbol Edit.png" />
<Content Include="Web.config">
<SubType>Designer</SubType>
@@ -108,6 +107,10 @@
<Project>{094331c3-ecee-4c89-bbfd-4c9ded89f0ef}</Project>
<Name>Service</Name>
</ProjectReference>
<ProjectReference Include="..\SharedLauncher\SharedLauncher.csproj">
<Project>{efe05c79-e0dd-4311-8b90-a8da7ebdf36f}</Project>
<Name>SharedLauncher</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Analyzer Include="..\packages\Microsoft.CodeAnalysis.Analyzers.2.9.6\analyzers\dotnet\cs\Microsoft.CodeAnalysis.Analyzers.dll" />

View File

@@ -3,7 +3,8 @@
<PropertyGroup>
<UseIISExpress>true</UseIISExpress>
<Use64BitIISExpress />
<IISExpressSSLPort />
<IISExpressSSLPort>
</IISExpressSSLPort>
<IISExpressAnonymousAuthentication />
<IISExpressWindowsAuthentication />
<IISExpressUseClassicPipelineMode />

View File

@@ -0,0 +1 @@
svcutil.exe /noConfig /edb /n:*,DownloadServer.ServiceProxy /out:ServiceProxy\DownloadGenerated.cs /ct:System.Collections.Generic.List`1 /r:..\SharedLauncher\bin\Debug\BS.SharedLauncher.dll http://localhost:3777/Host/LauncherService.svc?wsdl

View File

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

@@ -44,17 +44,24 @@
<bindings>
<basicHttpBinding>
<binding name="TransportSecurityDownloadLarge" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" transferMode="StreamedRequest">
<!-- mode="Transport" für echten Server und "None" sonst-->
<security mode="None">
<transport clientCredentialType="None" />
</security>
<readerQuotas maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxDepth="32" maxNameTableCharCount="2147483647" maxStringContentLength="2147483647" />
</binding>
<binding name="BasicStreamedRequest" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" transferMode="StreamedRequest">
<!-- mode="Transport" für echten Server und "None" sonst-->
<security mode="None">
<transport clientCredentialType="None" />
</security>
<readerQuotas maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxDepth="32" maxNameTableCharCount="2147483647" maxStringContentLength="2147483647" />
</binding>
<binding name="BeWoBasicEndpoint" closeTimeout="00:05:00" openTimeout="00:05:00" receiveTimeout="00:10:00" sendTimeout="00:05:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true" messageEncoding="Text">
<readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None" />
<!-- mode="Transport" für echten Server und "None" sonst-->
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
@@ -74,6 +81,9 @@
</behavior>
</serviceBehaviors>
</behaviors>
<client>
<endpoint binding="basicHttpBinding" bindingConfiguration="BeWoBasicEndpoint" contract="BeWo.Service.ServiceProxy.ILauncherService" name="LauncherServiceEndpoint" />
</client>
<extensions>
<behaviorExtensions>
<add name="MultitenancyExtension" type="BeWo.Service.Multitenancy.MultitenancyBehaviorExtension, BeWo.Service, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null" />
@@ -86,14 +96,6 @@
<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>
<service behaviorConfiguration="returnFaults" name="BeWo.Service.ServiceImplementations.EnumTranslationServiceImp">
<endpoint behaviorConfiguration="SecurityAndSessionBehavior" binding="basicHttpBinding" bindingConfiguration="TransportSecurityDownloadLarge"
name="EnumTranslationServiceEndpoint" contract="BeWo.Service.ServiceContracts.IEnumTranslationService" />
</service>
</services>
</system.serviceModel>
<appSettings>

View File

@@ -21,7 +21,8 @@
</UpgradeBackupLocation>
<UseIISExpress>true</UseIISExpress>
<TargetFrameworkProfile />
<IISExpressSSLPort />
<IISExpressSSLPort>
</IISExpressSSLPort>
<IISExpressAnonymousAuthentication />
<IISExpressWindowsAuthentication />
<IISExpressUseClassicPipelineMode />
@@ -196,6 +197,8 @@
<Content Include="DocumentDownload.aspx" />
<Content Include="Download.aspx" />
<Content Include="DownloadService.svc" />
<Content Include="EnumTranslationService.svc" />
<Content Include="LauncherService.svc" />
<Content Include="ReportService.svc" />
<Content Include="EmployeeService.svc" />
<Content Include="Multitenancy\Symbol Edit.png" />

View File

@@ -5,7 +5,8 @@
<UseIISExpress>true</UseIISExpress>
<LastActiveSolutionConfig>Debug|Any CPU</LastActiveSolutionConfig>
<Use64BitIISExpress />
<IISExpressSSLPort />
<IISExpressSSLPort>
</IISExpressSSLPort>
<IISExpressAnonymousAuthentication />
<IISExpressWindowsAuthentication />
<IISExpressUseClassicPipelineMode />

View File

@@ -156,6 +156,12 @@
<service behaviorConfiguration="returnFaults" name="ReportingService.ServiceImplementations.ReportServiceImp">
<endpoint behaviorConfiguration="SecurityAndSessionBehavior" binding="basicHttpBinding" bindingConfiguration="TransportSecurity" name="ReportServiceEndpoint" contract="ReportingService.ServiceContracts.IReportService" />
</service>
<service behaviorConfiguration="returnFaults" name="BeWo.Service.ServiceImplementations.LauncherServiceImp">
<endpoint behaviorConfiguration="SecurityAndSessionBehavior" binding="basicHttpBinding" bindingConfiguration="TransportSecurity" name="LauncherServiceEndpoint" contract="BeWo.Service.ServiceContracts.ILauncherService" />
</service>
<service behaviorConfiguration="returnFaults" name="BeWo.Service.ServiceImplementations.EnumTranslationServiceImp">
<endpoint behaviorConfiguration="SecurityAndSessionBehavior" binding="basicHttpBinding" bindingConfiguration="TransportSecurity" name="EnumTranslationServiceEndpoint" contract="BeWo.Service.ServiceContracts.IEnumTranslationService" />
</service>
</services>
<behaviors>
<endpointBehaviors>

View File

@@ -0,0 +1,28 @@
using System;
using System.ServiceModel.Channels;
using System.ServiceModel.Description;
using System.ServiceModel.Dispatcher;
namespace BeWo.Service.Multitenancy
{
public class DMultitenancyEndpointBehavior : IEndpointBehavior
{
public void AddBindingParameters(ServiceEndpoint endpoint, BindingParameterCollection bindingParameters)
{
}
public void ApplyClientBehavior(ServiceEndpoint endpoint, ClientRuntime clientRuntime)
{
clientRuntime.MessageInspectors.Add(new DMultitenancyInterceptor());
}
public void ApplyDispatchBehavior(ServiceEndpoint endpoint, EndpointDispatcher endpointDispatcher)
{
throw new NotImplementedException("This is a client behavior only");
}
public void Validate(ServiceEndpoint endpoint)
{
}
}
}

View File

@@ -0,0 +1,39 @@
using System.ServiceModel.Channels;
using System.Xml;
namespace BeWo.Service.Multitenancy
{
public class DMultitenancyHeader : MessageHeader
{
public override bool MustUnderstand
{
get
{
return false;
}
}
public override string Name
{
get
{
return "Multitenancy";
}
}
public override string Namespace
{
get
{
return "http://beyondsoft.de/Multitenancy.xsd";
}
}
public string Tenant { get; set; }
protected override void OnWriteHeaderContents(XmlDictionaryWriter writer, MessageVersion messageVersion)
{
writer.WriteElementString("Tenant", this.Tenant);
}
}
}

View File

@@ -0,0 +1,21 @@
using BS.SharedLauncher;
using BS.SharedLauncher.Information;
using System.ServiceModel;
using System.ServiceModel.Channels;
using System.ServiceModel.Dispatcher;
namespace BeWo.Service.Multitenancy
{
public class DMultitenancyInterceptor : IClientMessageInspector
{
public void AfterReceiveReply(ref Message reply, object correlationState)
{
}
public object BeforeSendRequest(ref Message request, IClientChannel channel)
{
request.Headers.Add(new DMultitenancyHeader { Tenant = SessionInformation.Login.Tenant });
return null;
}
}
}

View File

@@ -393,9 +393,12 @@
<Compile Include="MessageContracts\UploadPackage.cs" />
<Compile Include="MessageContracts\UploadImportFileResult.cs" />
<Compile Include="MessageContracts\UploadResult.cs" />
<Compile Include="Multitenancy\DMultitenancyEndpointBehavior.cs" />
<Compile Include="Multitenancy\MultitenancyBehaviorExtension.cs" />
<Compile Include="Multitenancy\MultitenancyContextInitializer.cs" />
<Compile Include="Multitenancy\MultitenancyEndpointBehavior.cs" />
<Compile Include="Multitenancy\DMultitenancyHeader.cs" />
<Compile Include="Multitenancy\DMultitenancyInterceptor.cs" />
<Compile Include="OwnChat\OwnChatHelper.cs" />
<Compile Include="PivotTabelle\FlexibleReportManager.cs" />
<Compile Include="Plugins\AccountingService.cs" />
@@ -476,10 +479,12 @@
<Compile Include="ServiceImplementations\UserServiceImp.cs" />
<Compile Include="ServiceImplementations\ValueListServiceImp.cs" />
<Compile Include="Configuration\AppSettings.cs" />
<Compile Include="ServiceProxy\ServiceFacade.cs" />
<Compile Include="ServiceProxy\ServiceGenerated.cs" />
<Compile Include="ServiceUtils\Paths\ServerFilePaths.cs" />
<Compile Include="ServiceUtils\Update\DownloadLogger.cs" />
<Compile Include="ServiceUtils\Update\UpdateConfigReader.cs" />
<Compile Include="ServiceUtils\Update\DownloadPlanerResponseBuilder.cs" />
<Compile Include="ServiceUtils\Update\UpdateFileResponseBuilder.cs" />
<Compile Include="ServiceUtils\Update\UpdatePlanResponseBuilder.cs" />
<Compile Include="UnitOfWork\HibernateSessionEndpointBehavior.cs" />
<Compile Include="UnitOfWork\HibernateSessionBehaviorExtension.cs" />
<Compile Include="UnitOfWork\HibernateSessionContextInitializer.cs" />

View File

@@ -12,10 +12,18 @@ namespace BeWo.Service.ServiceContracts
{
[FaultContract(typeof(BeWoFault))]
[OperationContract]
DownloadPlanerResponseDC Download2(DownloadPlanerRequestDC request);
UpdateFileResponse Download2(UpdatePlanRequest request);
[FaultContract(typeof(BeWoFault))]
[OperationContract]
DownloadPlanerResponseInfoDC DownloadInfo(DownloadPlanerRequestDC request);
UpdatePlanResponse DownloadInfo(UpdatePlanRequest request);
[FaultContract(typeof(BeWoFault))]
[OperationContract]
UpdatePlanResponse GetUpdatePlan(UpdatePlanRequest request);
[FaultContract(typeof(BeWoFault))]
[OperationContract]
UpdateFileResponse GetUpdateFile(UpdateFileRequest request);
}
}

View File

@@ -8,12 +8,14 @@ using System.ServiceModel;
using System.Xml;
using BeWo.Data;
using BeWo.Service.ServiceContracts;
using BeWo.Service.ServiceProxy;
using BeWo.Service.ServiceUtils.Paths;
using BeWo.Service.ServiceUtils.Update;
using BS.SharedLauncher.DataContract;
using BS.SharedLauncher.Enums;
using BS.SharedLauncher.Exceptions;
using BS.SharedLauncher.Extensions;
using BS.SharedLauncher.Information;
using BS.SharedLauncher.Logic;
using BS.SharedLauncher.Update;
@@ -24,23 +26,29 @@ namespace BeWo.Service.ServiceImplementations
{
public string Tenant => MultitenancyOperationContextExt.Current.Tenant;
public DownloadPlanerResponseDC Download2(DownloadPlanerRequestDC request)
public UpdateFileResponse Download2(UpdatePlanRequest request)
{
return null;
}
public UpdatePlanResponse DownloadInfo(UpdatePlanRequest request)
{
return null;
}
public UpdatePlanResponse GetUpdatePlan(UpdatePlanRequest request)
{
try
{
DownloadPlanerResponseBuilder builder = new DownloadPlanerResponseBuilder(request);
if (!isUpdatePlanRequestValid(request))
throw new InvalidUpdatePlanRequestException();
builder.Calculate(Tenant);
if (!VerifyLogin(request))
throw new InvalidUpdatePlanRequestException("Login konnte nicht aufm Download Server verifiziert werden.");
if (!request.ApplyFolderIsEmpty)
if (request.ApplyPackage is object)
builder.Substract(request.ApplyPackage.ToPlanerPackageInfo());
var response = UpdatePlanResponseBuilder.GetUpdatePlanResponse(request, Tenant);
if (!request.DownloadFolderIsEmpty)
if (request.DownloadedPackages is object)
builder.AnalyseDownload(request.DownloadedPackages.ToDictionary(pair => pair.Key, pair => pair.Value.ToPlanerPackageInfo()));
return builder.CreateResponse(request);
return response;
}
catch (UpdateException update)
{
@@ -48,35 +56,20 @@ namespace BeWo.Service.ServiceImplementations
}
catch (Exception ex)
{
throw new UpdateException("Update - Download - Exception", ex);
throw new UpdateException("Update - GetUpdatePlan - Exception", ex);
}
}
public DownloadPlanerResponseInfoDC DownloadInfo(DownloadPlanerRequestDC request)
public UpdateFileResponse GetUpdateFile(UpdateFileRequest request)
{
try
{
var responseInfo = new DownloadPlanerResponseInfoDC();
if (!isUpdateFileRequestValid(request))
throw new InvalidUpdateFileRequestException();
var response = Download2(request);
var response = UpdateFileResponseBuilder.GetUpdateFileResponse(request, Tenant);
responseInfo.DownloadSize = response.NewZipData?.LongLength ?? 0;
responseInfo.FileCount = 0;
if (response.DownloadFilesToKeep is object)
responseInfo.FileCount += response.DownloadFilesToKeep.Sum(kv => kv.Value.Count);
if (response.NewZipInfo is object)
{
responseInfo.FileCount += response.NewZipInfo.Files.Count;
responseInfo.NewFileCount = response.NewZipInfo.Files.Count;
}
responseInfo.HasSomethingToDo = response.HasToDo();
responseInfo.Version = response.LatestApplicationInfo.Version;
return responseInfo;
return response;
}
catch (UpdateException update)
{
@@ -84,8 +77,38 @@ namespace BeWo.Service.ServiceImplementations
}
catch (Exception ex)
{
throw new UpdateException("Update - DownloadInfo - Exception", ex);
}
throw new UpdateException("Update - GetUpdateFile - Exception", ex);
}
}
private bool VerifyLogin(UpdatePlanRequest request)
{
SessionInformation.Login.Username = request.Login.Username;
SessionInformation.Login.Password = request.Login.Password;
SessionInformation.Login.Tenant = Tenant;
ServiceFacade.UpdateServerAddresses(request.Login.CoreServerAddress);
var result = ServiceFacade.DoLauncherServiceSync(x => x.IsUserValid(request.Login.TempUsername, request.Login.Password, request.Login.Pin, request.Login.ClientID, true));
if (result == UserValidationResult.UserValid)
return true;
return false;
}
private bool isUpdatePlanRequestValid(UpdatePlanRequest request)
{
return true;
}
private bool isUpdateFileRequestValid(UpdateFileRequest request)
{
// Check for Login
// Check for Correct Version
// Check for File Permissions
return true;
}
}
}

View File

@@ -139,7 +139,7 @@ namespace BeWo.Service.ServiceImplementations
{
try
{
var user = DAOFactory.UserDAO.FindUserByLoginName(ConnectionInformation.Username);
var user = DAOFactory.UserDAO.FindUserByLoginName(SessionInformation.Login.Username);
var version = (new UserServiceImp()).ChangePassword(pUserName, user.Version.Value, pOldPassword, pNewPassword);
@@ -156,7 +156,7 @@ namespace BeWo.Service.ServiceImplementations
{
try
{
var user = DAOFactory.UserDAO.FindUserByLoginName(ConnectionInformation.Username);
var user = DAOFactory.UserDAO.FindUserByLoginName(SessionInformation.Login.Username);
user.ResetPasswordInfos.ForEach(f => f.HasToChangePW = false);

View File

@@ -47,8 +47,6 @@ namespace BeWo.Service.ServiceImplementations
{
allowChange = true;
}
}
if (allowChange)

View File

@@ -0,0 +1,116 @@
using BeWo.Service.Multitenancy;
using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel;
using System.Text;
using System.Threading.Tasks;
namespace BeWo.Service.ServiceProxy
{
public class ServiceFacade
{
public static object _Lock = string.Empty;
private static Dictionary<Type, EndpointAddress> _EndpointAddresses;
private static readonly Dictionary<Type, object> _ProxyCache;
private static int _RunningAsyncs;
public static void UpdateServerAddresses(string main)
{
var serverName2 = main;
if (serverName2.Substring(serverName2.Length - 1, 1) != "/")
serverName2 += "/";
_EndpointAddresses = new Dictionary<Type, EndpointAddress>
{
{ typeof(ILauncherService), new EndpointAddress(serverName2 + "LauncherService.svc") }
};
}
static ServiceFacade()
{
_ProxyCache = new Dictionary<Type, object>();
}
public static void DoLauncherServiceSync(Action<ILauncherService> pAction)
{
try
{
pAction.Invoke(GetInstance<LauncherServiceClient, ILauncherService>());
}
catch (Exception e)
{
// if (HandleServiceProxyException(e))
// throw e;
throw e;
}
}
public static T DoLauncherServiceSync<T>(Func<ILauncherService, T> pFunc)
{
try
{
return pFunc.Invoke(GetInstance<LauncherServiceClient, ILauncherService>());
}
catch (Exception e)
{
throw e;
}
return default(T);
}
private static TInterface GetInstance<TClient, TInterface>()
where TClient : ClientBase<TInterface>, TInterface, new()
where TInterface : class
{
TClient lClient = null;
if (_ProxyCache.ContainsKey(typeof(TClient)))
{
lClient = (TClient)_ProxyCache[typeof(TClient)];
if (lClient.State == CommunicationState.Closing || lClient.State == CommunicationState.Closed || lClient.State == CommunicationState.Faulted)
{
if (lClient.State == CommunicationState.Faulted)
{
lClient.Abort();
}
lClient = null;
_ProxyCache.Remove(typeof(TClient));
}
}
if (lClient != null)
{// EndpointAddresses aktualisieren
if (!lClient.Endpoint.Address.Equals(_EndpointAddresses[typeof(TInterface)]))
{
if (lClient.State == CommunicationState.Opened)
lClient.Close();
if (_ProxyCache.ContainsKey(typeof(TClient)))
_ProxyCache.Remove(typeof(TClient));
lClient = null;
}
}
if (lClient == null)
{
lClient = new TClient();
if (!_ProxyCache.ContainsKey(lClient.GetType()))
{
_ProxyCache.Add(typeof(TClient), lClient);
}
// lClient.Endpoint.Behaviors.Add(new DownloadSecurityHeaderEndpointBehavior());
lClient.Endpoint.Behaviors.Add(new DMultitenancyEndpointBehavior());
lClient.Endpoint.Address = _EndpointAddresses[typeof(TInterface)];
}
return lClient;
}
}
}

View File

@@ -0,0 +1,276 @@
//------------------------------------------------------------------------------
// <auto-generated>
// Dieser Code wurde von einem Tool generiert.
// Laufzeitversion:4.0.30319.42000
//
// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
// der Code erneut generiert wird.
// </auto-generated>
//------------------------------------------------------------------------------
namespace BeWo.Service.ServiceProxy
{
using System.Runtime.Serialization;
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")]
[System.Runtime.Serialization.DataContractAttribute(Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")]
public partial class BeWoFault : object, System.Runtime.Serialization.IExtensibleDataObject, System.ComponentModel.INotifyPropertyChanged
{
private System.Runtime.Serialization.ExtensionDataObject extensionDataField;
private BeWo.Service.ServiceProxy.BeWoFaultType FaultTypeField;
private string InnerExceptionMessageField;
private string InnerExceptionStackTraceField;
private string MessageField;
private string StackTraceField;
public System.Runtime.Serialization.ExtensionDataObject ExtensionData
{
get
{
return this.extensionDataField;
}
set
{
this.extensionDataField = value;
}
}
[System.Runtime.Serialization.DataMemberAttribute()]
public BeWo.Service.ServiceProxy.BeWoFaultType FaultType
{
get
{
return this.FaultTypeField;
}
set
{
if ((this.FaultTypeField.Equals(value) != true))
{
this.FaultTypeField = value;
this.RaisePropertyChanged("FaultType");
}
}
}
[System.Runtime.Serialization.DataMemberAttribute()]
public string InnerExceptionMessage
{
get
{
return this.InnerExceptionMessageField;
}
set
{
if ((object.ReferenceEquals(this.InnerExceptionMessageField, value) != true))
{
this.InnerExceptionMessageField = value;
this.RaisePropertyChanged("InnerExceptionMessage");
}
}
}
[System.Runtime.Serialization.DataMemberAttribute()]
public string InnerExceptionStackTrace
{
get
{
return this.InnerExceptionStackTraceField;
}
set
{
if ((object.ReferenceEquals(this.InnerExceptionStackTraceField, value) != true))
{
this.InnerExceptionStackTraceField = value;
this.RaisePropertyChanged("InnerExceptionStackTrace");
}
}
}
[System.Runtime.Serialization.DataMemberAttribute()]
public string Message
{
get
{
return this.MessageField;
}
set
{
if ((object.ReferenceEquals(this.MessageField, value) != true))
{
this.MessageField = value;
this.RaisePropertyChanged("Message");
}
}
}
[System.Runtime.Serialization.DataMemberAttribute()]
public string StackTrace
{
get
{
return this.StackTraceField;
}
set
{
if ((object.ReferenceEquals(this.StackTraceField, value) != true))
{
this.StackTraceField = value;
this.RaisePropertyChanged("StackTrace");
}
}
}
public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
protected void RaisePropertyChanged(string propertyName)
{
System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged;
if ((propertyChanged != null))
{
propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
}
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")]
[System.Runtime.Serialization.DataContractAttribute(Name="BeWoFaultType", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")]
public enum BeWoFaultType : int
{
[System.Runtime.Serialization.EnumMemberAttribute()]
Unknown = 0,
[System.Runtime.Serialization.EnumMemberAttribute()]
Concurrency = 1,
[System.Runtime.Serialization.EnumMemberAttribute()]
DeleteNotPossible = 2,
[System.Runtime.Serialization.EnumMemberAttribute()]
LoginNameTaken = 3,
[System.Runtime.Serialization.EnumMemberAttribute()]
CustomWithoutDetails = 4,
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
[System.ServiceModel.ServiceContractAttribute(ConfigurationName="BeWo.Service.ServiceProxy.ILauncherService")]
public interface ILauncherService
{
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/ILauncherService/IsUserValid", ReplyAction="http://tempuri.org/ILauncherService/IsUserValidResponse")]
[System.ServiceModel.FaultContractAttribute(typeof(BeWo.Service.ServiceProxy.BeWoFault), Action="http://tempuri.org/ILauncherService/IsUserValidBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")]
BS.SharedLauncher.Enums.UserValidationResult IsUserValid(string pUserName, string pPassword, string pPIN, string clientId, bool checkTenant);
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/ILauncherService/ResetTenant", ReplyAction="http://tempuri.org/ILauncherService/ResetTenantResponse")]
[System.ServiceModel.FaultContractAttribute(typeof(BeWo.Service.ServiceProxy.BeWoFault), Action="http://tempuri.org/ILauncherService/ResetTenantBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")]
void ResetTenant(string tenant);
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/ILauncherService/ResetAllTenant", ReplyAction="http://tempuri.org/ILauncherService/ResetAllTenantResponse")]
[System.ServiceModel.FaultContractAttribute(typeof(BeWo.Service.ServiceProxy.BeWoFault), Action="http://tempuri.org/ILauncherService/ResetAllTenantBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")]
void ResetAllTenant();
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/ILauncherService/GetEmailForUserName", ReplyAction="http://tempuri.org/ILauncherService/GetEmailForUserNameResponse")]
[System.ServiceModel.FaultContractAttribute(typeof(BeWo.Service.ServiceProxy.BeWoFault), Action="http://tempuri.org/ILauncherService/GetEmailForUserNameBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")]
bool GetEmailForUserName(out string email, string pUserName, System.Uri serverName);
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/ILauncherService/CheckPassword", ReplyAction="http://tempuri.org/ILauncherService/CheckPasswordResponse")]
[System.ServiceModel.FaultContractAttribute(typeof(BeWo.Service.ServiceProxy.BeWoFault), Action="http://tempuri.org/ILauncherService/CheckPasswordBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")]
BS.SharedLauncher.Enums.PasswordValidationResult CheckPassword(long userOid, string pOldPassword, string pNewPassword);
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/ILauncherService/CheckPassword2", ReplyAction="http://tempuri.org/ILauncherService/CheckPassword2Response")]
[System.ServiceModel.FaultContractAttribute(typeof(BeWo.Service.ServiceProxy.BeWoFault), Action="http://tempuri.org/ILauncherService/CheckPassword2BeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")]
BS.SharedLauncher.Enums.PasswordValidationResult CheckPassword2(string username, string pOldPassword, string pNewPassword);
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/ILauncherService/ChangePassword", ReplyAction="http://tempuri.org/ILauncherService/ChangePasswordResponse")]
[System.ServiceModel.FaultContractAttribute(typeof(BeWo.Service.ServiceProxy.BeWoFault), Action="http://tempuri.org/ILauncherService/ChangePasswordBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")]
long ChangePassword(string pUserName, string pOldPassword, string pNewPassword);
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/ILauncherService/ResetPasswordInfo", ReplyAction="http://tempuri.org/ILauncherService/ResetPasswordInfoResponse")]
[System.ServiceModel.FaultContractAttribute(typeof(BeWo.Service.ServiceProxy.BeWoFault), Action="http://tempuri.org/ILauncherService/ResetPasswordInfoBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")]
void ResetPasswordInfo(string pUserName, string pPassword);
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
public interface ILauncherServiceChannel : BeWo.Service.ServiceProxy.ILauncherService, System.ServiceModel.IClientChannel
{
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
public partial class LauncherServiceClient : System.ServiceModel.ClientBase<BeWo.Service.ServiceProxy.ILauncherService>, BeWo.Service.ServiceProxy.ILauncherService
{
public LauncherServiceClient()
{
}
public LauncherServiceClient(string endpointConfigurationName) :
base(endpointConfigurationName)
{
}
public LauncherServiceClient(string endpointConfigurationName, string remoteAddress) :
base(endpointConfigurationName, remoteAddress)
{
}
public LauncherServiceClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) :
base(endpointConfigurationName, remoteAddress)
{
}
public LauncherServiceClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) :
base(binding, remoteAddress)
{
}
public BS.SharedLauncher.Enums.UserValidationResult IsUserValid(string pUserName, string pPassword, string pPIN, string clientId, bool checkTenant)
{
return base.Channel.IsUserValid(pUserName, pPassword, pPIN, clientId, checkTenant);
}
public void ResetTenant(string tenant)
{
base.Channel.ResetTenant(tenant);
}
public void ResetAllTenant()
{
base.Channel.ResetAllTenant();
}
public bool GetEmailForUserName(out string email, string pUserName, System.Uri serverName)
{
return base.Channel.GetEmailForUserName(out email, pUserName, serverName);
}
public BS.SharedLauncher.Enums.PasswordValidationResult CheckPassword(long userOid, string pOldPassword, string pNewPassword)
{
return base.Channel.CheckPassword(userOid, pOldPassword, pNewPassword);
}
public BS.SharedLauncher.Enums.PasswordValidationResult CheckPassword2(string username, string pOldPassword, string pNewPassword)
{
return base.Channel.CheckPassword2(username, pOldPassword, pNewPassword);
}
public long ChangePassword(string pUserName, string pOldPassword, string pNewPassword)
{
return base.Channel.ChangePassword(pUserName, pOldPassword, pNewPassword);
}
public void ResetPasswordInfo(string pUserName, string pPassword)
{
base.Channel.ResetPasswordInfo(pUserName, pPassword);
}
}
}

View File

@@ -0,0 +1 @@
svcutil.exe /noConfig /edb /n:*,BeWo.Service.ServiceProxy /out:ServiceProxy\ServiceGenerated.cs /ct:System.Collections.Generic.List`1 /r:..\SharedLauncher\bin\Debug\BS.SharedLauncher.dll http://localhost:3777/Host/LauncherService.svc?wsdl

View File

@@ -40,8 +40,8 @@ namespace BeWo.Service.ServiceUtils.Paths
}
public static string GetSpecialTenantFolderPath() => Path.Combine(DownloadFolderPath, "overridetenant");
public static string GetOverrideTenantFolderPath(string tenant) => Path.Combine(GetSpecialTenantFolderPath(), tenant);
public static string GetOverrideTenantFolderPath() => Path.Combine(DownloadFolderPath, "overridetenant");
public static string GetOverrideTenantFolderPath(string tenant) => Path.Combine(GetOverrideTenantFolderPath(), tenant);
public static string GetVersionFolderPath() => Path.Combine(DownloadFolderPath, "version");
public static string GetVersionFolderPath(string version) => Path.Combine(GetVersionFolderPath(), version);

View File

@@ -1,23 +0,0 @@
using BeWo.Data;
using BeWo.Service.ServiceUtils.Paths;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BeWo.Service.ServiceUtils.Update
{
public static class DownloadLogger
{
//public static string Tenant => MultitenancyOperationContextExt.Current.Tenant;
//public static string Folder => ServerFilePaths.GetLogFolderPath(Tenant);
//static DownloadLogger()
//{
// _Started = true;
//}
//public static string
}
}

View File

@@ -1,146 +0,0 @@
using BeWo.Service.ServiceUtils.Paths;
using BS.SharedLauncher.DataContract;
using BS.SharedLauncher.Exceptions;
using BS.SharedLauncher.Extensions;
using BS.SharedLauncher.Logic;
using BS.SharedLauncher.Update;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BeWo.Service.ServiceUtils.Update
{
public class DownloadPlanerResponseBuilder
{
private PlanerPackageInfo currentUpdatePackageInfo;
private PlanerPackageInfo latestUpdatePackageInfo;
private Dictionary<string, List<string>> downloadFilesToKeep;
public DownloadPlanerResponseBuilder(DownloadPlanerRequestDC req)
{
currentUpdatePackageInfo = null;
latestUpdatePackageInfo = null;
downloadFilesToKeep = null;
}
public PlanerPackageInfo CurrentUpdatePackageInfo => currentUpdatePackageInfo;
public PlanerPackageInfo FullUpdatePackageInfo => latestUpdatePackageInfo;
public void Calculate(string tenant)
{
PlanerPackageInfo root = new PlanerPackageInfo();
UpdateConfigReader reader = new UpdateConfigReader(ServerFilePaths.GetVersionConfigFilePath(), tenant);
root.DefaultVersion = reader.GetDefaultVersion();
root.TenantVersion = reader.GetSpecificVersion();
string version = root.Version;
// Setze Basis
root.InitFiles(getVersionDefaultFiles(version));
// Überschreibe mit Version-Tenant Daten
root.OverrideFiles(getVersionTenantFiles(version, tenant));
// Überschreibe mit Special-Tenant Daten
root.OverrideFiles(getSpecialTenantFiles(tenant));
// Lade Hash Werte
root.LoadHash();
latestUpdatePackageInfo = root;
currentUpdatePackageInfo = root.Copy();
}
public void Substract(PlanerPackageInfo applyPackage)
{
currentUpdatePackageInfo.SubstractFiles(applyPackage.Files);
}
public void AnalyseDownload(Dictionary<string, PlanerPackageInfo> zip2info)
{
downloadFilesToKeep = new Dictionary<string, List<string>>();
foreach (var z2i in zip2info)
{
bool found = false;
for (int i = currentUpdatePackageInfo.Files.Count - 1; i >= 0; i--)
//foreach (var file in currentUpdatePackageInfo.Files)
{
var file = currentUpdatePackageInfo.Files[i];
if (z2i.Value.ContainsPlanerFile(file.RelativePath, file.Checksum))
{
if (!found)
{
found = true;
downloadFilesToKeep.Add(z2i.Key, new List<string>());
}
downloadFilesToKeep[z2i.Key].Add(file.RelativePath);
currentUpdatePackageInfo.RemoveFileAt(i);
}
}
}
}
public void Compress()
{
if (downloadFilesToKeep != null && !downloadFilesToKeep.Any())
downloadFilesToKeep = null;
if (currentUpdatePackageInfo != null && !currentUpdatePackageInfo.AnyFile())
currentUpdatePackageInfo = null;
}
public DownloadPlanerResponseDC CreateResponse(DownloadPlanerRequestDC request)
{
var res = new DownloadPlanerResponseDC();
Compress();
res.LatestApplicationInfo = latestUpdatePackageInfo.ToPlanerPackageInfoDC();
if (downloadFilesToKeep is object)
{
res.DownloadFilesToKeep = downloadFilesToKeep;
}
if (currentUpdatePackageInfo is object)
{
res.NewZipData = ZipArchiveBuilder.CreateZipArray(currentUpdatePackageInfo.Files,
(file) => file.AbsolutePath, (file) => file.RelativePath);
res.NewZipInfo = currentUpdatePackageInfo.ToPlanerPackageInfoDC();
//res.NewZipStream = ZipArchiveBuilder.CreateZipStream(currentUpdatePackageInfo.Files,
// (file) => file.AbsolutePath, (file) => file.RelativePath);
//res.NewZipStreamLength = res.NewZipStream.Length;
}
res.HasToRemoveFiles = request.ApplyPackage?.Files?.Any(x => !res.LatestApplicationInfo.Files.Any(y => x.EqualsFile(y))) ?? false;
return res;
}
private List<PlanerFileInfo> getVersionDefaultFiles(string version) => getPlanerFiles(ServerFilePaths.GetVersionDefaultFolderPath(version), false);
private List<PlanerFileInfo> getVersionTenantFiles(string version, string tenant) => getPlanerFiles(ServerFilePaths.GetVersionTenantFolderPath(version, tenant), true);
private List<PlanerFileInfo> getSpecialTenantFiles(string tenant) => getPlanerFiles(ServerFilePaths.GetOverrideTenantFolderPath(tenant), true);
private List<PlanerFileInfo> getPlanerFiles(string path, bool ignore)
{
if (!Directory.Exists(path)) {
if (ignore)
return new List<PlanerFileInfo>();
else
throw new ServerConfigException($"{path} konnte nicht gefunden werden");
}
var res = FileController.GetPlanerFiles(path);
//res.ForEach(x => x.Source = source);
return res;
}
}
}

View File

@@ -0,0 +1,104 @@
using BeWo.Service.ServiceUtils.Paths;
using BS.SharedLauncher.DataContract;
using BS.SharedLauncher.Exceptions;
using BS.SharedLauncher.Extensions;
using BS.SharedLauncher.Logic;
using BS.SharedLauncher.Update;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BeWo.Service.ServiceUtils.Update
{
public static class UpdateFileResponseBuilder
{
private static string _Version;
private static string _Tenant;
private static UpdateFileRequest _Request;
private static UpdateFileResponse _Response;
public static UpdateFileResponse GetUpdateFileResponse(UpdateFileRequest request, string tenant)
{
_Response = new UpdateFileResponse();
_Tenant = tenant;
_Request = request;
_Version = request.Version;
calculate();
return _Response;
}
private static void calculate()
{
var path = Path.Combine(getSourceFolderPath(), _Request.UpdateFile.RelativePath);
_Response.FileData = File.ReadAllBytes(path);
}
private static string getSourceFolderPath()
{
switch (_Request.UpdateFile.Source)
{
case BS.SharedLauncher.Enums.UpdateFileSource.Invalid:
throw new UpdateException("Invalid UpdateFileSource");
case BS.SharedLauncher.Enums.UpdateFileSource.VersionDefault:
return ServerFilePaths.GetVersionDefaultFolderPath(_Version);
case BS.SharedLauncher.Enums.UpdateFileSource.VersionTenant:
return ServerFilePaths.GetVersionTenantFolderPath(_Version, _Tenant);
case BS.SharedLauncher.Enums.UpdateFileSource.VersionUser:
break;
case BS.SharedLauncher.Enums.UpdateFileSource.OverrideTenant:
return ServerFilePaths.GetOverrideTenantFolderPath(_Tenant);
case BS.SharedLauncher.Enums.UpdateFileSource.OverrideUser:
break;
default:
break;
}
// User bekommt eigene Daten Feature
throw new NotImplementedException("#479839129");
}
//public static UpdateResponse GetUpdatePlanResponse(UpdateRequest request, string tenant)
//{
// var reader = new UpdateConfigReader(ServerFilePaths.GetVersionConfigFilePath(), tenant);
// _Tenant = tenant;
// _Request = request;
// _Response = new UpdateResponse
// {
// CurrentPackage = new PlanerPackageInfoDC
// {
// DefaultVersion = reader.GetDefaultVersion(),
// TenantVersion = reader.GetSpecificVersion()
// }
// };
// _Version = _Response.CurrentPackage.Version;
// // Lädt komplettes Paket ohne Hash
// CalcFullPackage();
// // Lade Hash Werte
// _Response.CurrentPackage.LoadHash();
// CalcFilesToRequest();
// CalcFilesToDeleteInApply();
// CalcFilesToIgnoreInDownload();
// return _Response;
//}
}
}

View File

@@ -0,0 +1,166 @@
using BeWo.Service.ServiceUtils.Paths;
using BS.SharedLauncher.DataContract;
using BS.SharedLauncher.Enums;
using BS.SharedLauncher.Exceptions;
using BS.SharedLauncher.Extensions;
using BS.SharedLauncher.Information;
using BS.SharedLauncher.Logic;
using BS.SharedLauncher.Update;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BeWo.Service.ServiceUtils.Update
{
public static class UpdatePlanResponseBuilder
{
private static UpdatePlanRequest _Request;
private static UpdatePlanResponse _Response;
private static string _Version;
private static string _Tenant;
public static UpdatePlanResponse GetUpdatePlanResponse(UpdatePlanRequest request, string tenant)
{
var reader = new UpdateConfigReader(ServerFilePaths.GetVersionConfigFilePath(), tenant);
_Tenant = tenant;
_Request = request;
_Response = new UpdatePlanResponse
{
CurrentPackage = new UpdatePlanDC
{
DefaultVersion = reader.GetDefaultVersion(),
TenantVersion = reader.GetSpecificVersion()
}
};
_Version = _Response.CurrentPackage.Version;
// Lädt komplettes Paket ohne Hash
CalcFullPackage();
// Lade Hash Werte
_Response.CurrentPackage.LoadHash();
CalcFilesToRequest();
if (!_Request.ApplyFolderIsEmpty)
CalcFilesToDeleteInApply();
if (!_Request.DownloadFolderIsEmpty)
CalcFilesToApplyInDownload();
CalcDownloadSize();
return _Response;
}
private static void CalcFullPackage()
{
// Setze Basis
_Response.CurrentPackage.InitFiles(getVersionDefaultFiles(_Version));
// Überschreibe mit Version-Tenant Daten
_Response.CurrentPackage.OverrideOrAddFiles(getVersionTenantFiles(_Version, _Tenant));
// Überschreibe mit Special-Tenant Daten
_Response.CurrentPackage.OverrideOrAddFiles(getSpecialTenantFiles(_Tenant));
}
private static void CalcFilesToRequest()
{
foreach (var file in _Response.CurrentPackage.Files)
{
// Bereits installiert
if (_Request.ApplyPackage?.ContainsPlanerFileWithHash(file) ?? false)
continue;
// Bereits heruntergeladen
if (_Request.DownloadedFiles?.ContainsPlanerFileWithHash(file) ?? false)
continue;
if (_Response.FilesToRequest is null)
_Response.FilesToRequest = new List<UpdateFileDC>();
_Response.FilesToRequest.Add(file);
}
}
private static void CalcFilesToDeleteInApply()
{
foreach (var file in _Request.ApplyPackage.Files)
{
// Datei wird gebraucht
if (_Response.CurrentPackage.ContainsPlanerFile(file))
continue;
if (_Response.FilesToDeleteInApply is null)
_Response.FilesToDeleteInApply = new List<UpdateFileDC>();
_Response.FilesToDeleteInApply.Add(file);
}
}
private static void CalcFilesToApplyInDownload()
{
foreach (var file in _Request.DownloadedFiles)
{
// Datei wird gebraucht
if (!_Response.CurrentPackage.ContainsPlanerFile(file))
continue;
if (_Response.FilesToApply is null)
_Response.FilesToApply = new List<UpdateFileDC>();
_Response.FilesToApply.Add(file);
}
}
private static void CalcDownloadSize()
{
if (_Response.FilesToRequest is null || !_Response.FilesToRequest.Any())
return;
long count = 0;
foreach (var file in _Response.FilesToRequest)
{
var fi = new FileInfo(file.AbsolutePath);
count += fi.Length;
}
_Response.DownloadSize = count;
}
private static List<UpdateFileDC> getVersionDefaultFiles(string version) => getPlanerFiles(ServerFilePaths.GetVersionDefaultFolderPath(version), UpdateFileSource.VersionDefault, false);
private static List<UpdateFileDC> getVersionTenantFiles(string version, string tenant) => getPlanerFiles(ServerFilePaths.GetVersionTenantFolderPath(version, tenant), UpdateFileSource.VersionTenant, true);
private static List<UpdateFileDC> getSpecialTenantFiles(string tenant) => getPlanerFiles(ServerFilePaths.GetOverrideTenantFolderPath(tenant), UpdateFileSource.OverrideTenant, true);
private static List<UpdateFileDC> getPlanerFiles(string path, UpdateFileSource source, bool ignoreOnError)
{
if (!Directory.Exists(path)) {
if (ignoreOnError)
return new List<UpdateFileDC>();
else
throw new ServerConfigException($"{path} konnte nicht gefunden werden");
}
var res = FileController.GetPlanerFiles(path, true, ignorePlanerFile);
res.ForEach(x => x.Source = source);
return res;
}
private static bool ignorePlanerFile(UpdateFileDC update)
{
if (update.GetExtensionType() == ".xml")
return true;
return false;
}
}
}

BIN
Service/SvcUtil.exe Normal file

Binary file not shown.

View File

@@ -1,49 +0,0 @@
using BS.SharedLauncher.Update;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;
namespace BS.SharedLauncher.DataContract
{
[DataContract]
public class DownloadPlanerResponseDC
{
public DownloadPlanerResponseDC()
{
DownloadFilesToKeep = null;
HasToRemoveFiles = false;
}
[DataMember]
public bool HasToRemoveFiles { get; set; }
[DataMember]
public byte[] NewZipData { get; set; }
[DataMember]
public Stream NewZipStream { get; set; }
[DataMember]
public long NewZipStreamLength { get; set; }
/// <summary>
/// Nur neue Dateien
/// </summary>
[DataMember]
public PlanerPackageInfoDC NewZipInfo { get; set; }
/// <summary>
/// Alle Dateien aus der letzten Version
/// </summary>
[DataMember]
public PlanerPackageInfoDC LatestApplicationInfo { get; set; }
[DataMember]
public Dictionary<string, List<string>> DownloadFilesToKeep { get; set; }
}
}

View File

@@ -0,0 +1,34 @@
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 LoginDC
{
[DataMember]
public string Username { get; set; }
[DataMember]
public string TempUsername { get; set; }
[DataMember]
public string Password { get; set; }
[DataMember]
public string CoreServerAddress { get; set; }
[DataMember]
public string Pin { get; set; }
[DataMember]
public string ClientID { get; set; }
[DataMember]
public bool CheckTenant { get; set; }
}
}

View File

@@ -1,26 +0,0 @@
using BS.SharedLauncher.Enums;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;
namespace BS.SharedLauncher.DataContract
{
[DebuggerDisplay("{RelativePath} ({Checksum})")]
[DataContract, Serializable()]
public class PlanerFileInfoDC
{
[DataMember, XmlAttribute]
public string Name { get; set; }
[DataMember, XmlAttribute]
public string RelativePath { get; set; }
[DataMember, XmlAttribute]
public string Checksum { get; set; }
}
}

View File

@@ -0,0 +1,50 @@
using BS.SharedLauncher.Enums;
using BS.SharedLauncher.Utils;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;
namespace BS.SharedLauncher.DataContract
{
[DebuggerDisplay("{RelativePath} ({Checksum})")]
[DataContract, Serializable()]
public class UpdateFileDC
{
public UpdateFileDC()
{
}
public UpdateFileDC(FileInfo fileInfo, string relativeTo) : base()
{
Name = fileInfo.Name;
AbsolutePath = fileInfo.FullName;
RelativePath = PathUtils.MakeRelativePath(relativeTo, fileInfo.FullName);
Size = fileInfo.Length;
}
[DataMember, XmlAttribute]
public string Name { get; set; }
[XmlIgnore]
public string AbsolutePath { get; set; }
[DataMember, XmlAttribute]
public string RelativePath { get; set; }
[DataMember, XmlAttribute]
public UpdateFileSource Source { get; set; }
[DataMember, XmlAttribute]
public string Checksum { get; set; }
[DataMember, XmlAttribute]
public long Size { get; set; }
}
}

View File

@@ -0,0 +1,32 @@
using BS.SharedLauncher.Update;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;
namespace BS.SharedLauncher.DataContract
{
[DataContract]
public class UpdateFileRequest
{
public UpdateFileRequest()
{
}
public UpdateFileRequest(string version) : base()
{
Version = version;
}
[DataMember]
public string Version { get; set; }
[DataMember]
public UpdateFileDC UpdateFile { get; set; }
}
}

View File

@@ -0,0 +1,24 @@
using BS.SharedLauncher.Update;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;
namespace BS.SharedLauncher.DataContract
{
[DataContract]
public class UpdateFileResponse
{
public UpdateFileResponse()
{
}
[DataMember]
public byte[] FileData { get; set; }
}
}

View File

@@ -9,10 +9,10 @@ using System.Xml.Serialization;
namespace BS.SharedLauncher.DataContract
{
[DataContract, XmlRoot("Package"), Serializable()]
public class PlanerPackageInfoDC
public class UpdatePlanDC
{
[DataMember]
public List<PlanerFileInfoDC> Files { get; set; }
[DataMember, XmlIgnore]
public List<UpdateFileDC> Files { get; set; }
[DataMember]
public DateTime Created { get; set; }

View File

@@ -10,9 +10,9 @@ namespace BS.SharedLauncher.DataContract
{
//[DebuggerDisplay("{InternalName} ({FileVersion})")]
[DataContract]
public class DownloadPlanerRequestDC
public class UpdatePlanRequest
{
public DownloadPlanerRequestDC()
public UpdatePlanRequest()
{
PlanerRootFolderExists = false;
DownloadFolderExists = false;
@@ -37,9 +37,12 @@ namespace BS.SharedLauncher.DataContract
public bool ApplyFolderIsEmpty { get; set; }
[DataMember]
public Dictionary<string, PlanerPackageInfoDC> DownloadedPackages { get; set; }
public List<UpdateFileDC> DownloadedFiles { get; set; }
[DataMember]
public PlanerPackageInfoDC ApplyPackage { get; set; }
public UpdatePlanDC ApplyPackage { get; set; }
[DataMember]
public LoginDC Login { get; set; }
}
}

View File

@@ -10,29 +10,26 @@ using System.Xml.Serialization;
namespace BS.SharedLauncher.DataContract
{
[DataContract]
public class DownloadPlanerResponseInfoDC
public class UpdatePlanResponse
{
public DownloadPlanerResponseInfoDC()
public UpdatePlanResponse()
{
}
[DataMember]
public string Version { get; set; }
public UpdatePlanDC CurrentPackage { get; set; }
[DataMember]
public List<UpdateFileDC> FilesToRequest { get; set; }
[DataMember]
public List<UpdateFileDC> FilesToApply { get; set; }
[DataMember]
public List<UpdateFileDC> FilesToDeleteInApply { get; set; }
[DataMember]
public long DownloadSize { get; set; }
[DataMember]
public long TotalSize { get; set; }
[DataMember]
public int FileCount { get; set; }
[DataMember]
public int NewFileCount { get; set; }
[DataMember]
public bool HasSomethingToDo { get; set; }
}
}

View File

@@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BS.SharedLauncher.Exceptions
{
public class InvalidUpdateFileRequestException : UpdateException
{
public InvalidUpdateFileRequestException()
{
}
public InvalidUpdateFileRequestException(string message) : base(message)
{
}
public InvalidUpdateFileRequestException(string message, Exception innerException) : base(message, innerException)
{
}
}
}

View File

@@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BS.SharedLauncher.Exceptions
{
public class InvalidUpdatePlanRequestException : UpdateException
{
public InvalidUpdatePlanRequestException()
{
}
public InvalidUpdatePlanRequestException(string message) : base(message)
{
}
public InvalidUpdatePlanRequestException(string message, Exception innerException) : base(message, innerException)
{
}
}
}

View File

@@ -1,27 +0,0 @@
using BS.SharedLauncher.DataContract;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BS.SharedLauncher.Extensions
{
public static class DownloadPlanerResponseExtension
{
public static bool HasToDo(this DownloadPlanerResponseDC response)
{
return response.HasToDoDownload2Keep() || response.HasToDoNewZip() || response.HasToRemoveFiles;
}
public static bool HasToDoDownload2Keep(this DownloadPlanerResponseDC response)
{
return response.DownloadFilesToKeep is object;
}
public static bool HasToDoNewZip(this DownloadPlanerResponseDC response)
{
return response.NewZipInfo is object;
}
}
}

View File

@@ -5,6 +5,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BS.SharedLauncher.Information;
using BS.SharedLauncher.Logic;
namespace BS.SharedLauncher.Extensions
{

View File

@@ -13,22 +13,16 @@ namespace BS.SharedLauncher.Extensions
{
public static class PlanerFileExtension
{
public static List<PlanerFileInfoDC> ToPlanerFileInfoDCList(this List<PlanerFileInfo> planerFileInfos) => planerFileInfos.Select(x => new PlanerFileInfoDC()
public static bool ContainsPlanerFile(this List<UpdateFileDC> files, UpdateFileDC file2)
{
Checksum = x.Checksum,
Name = x.Name,
RelativePath = x.RelativePath
}).ToList();
public static List<PlanerFileInfo> ToPlanerFileInfoList(this List<PlanerFileInfoDC> planerFileInfos) => planerFileInfos.Select(x => new PlanerFileInfo()
return files.FirstOrDefault(file => file.RelativePath == file2.RelativePath) is object;
}
public static bool ContainsPlanerFileWithHash(this List<UpdateFileDC> files, UpdateFileDC file2)
{
Checksum = x.Checksum,
Name = x.Name,
RelativePath = x.RelativePath
}).ToList();
public static void LoadHash(this PlanerFileInfo planerFileInfo)
return files.FirstOrDefault(file => file.RelativePath == file2.RelativePath && file.Checksum == file2.Checksum) is object;
}
public static void LoadHash(this UpdateFileDC planerFileInfo)
{
//FileData = File.ReadAllBytes(AbsolutePath);
using (var md5 = MD5.Create())
{
using (var stream = File.OpenRead(planerFileInfo.AbsolutePath))
@@ -38,44 +32,52 @@ namespace BS.SharedLauncher.Extensions
}
}
public static void Copy(this PlanerFileInfo info) => new PlanerFileInfo()
public static void Copy(this UpdateFileDC info) => new UpdateFileDC()
{
Name = info.Name,
AbsolutePath = info.AbsolutePath,
Checksum = info.Checksum,
RelativePath = info.RelativePath
};
public static bool EqualsFile(this UpdateFileDC file, UpdateFileDC file2)
{
return (file.Checksum == file2.Checksum) &&
(file.RelativePath == file2.RelativePath) &&
(file.Name == file2.Name);
}
public static string GetExtensionType(this UpdateFileDC file)
{
return Path.GetExtension(file.AbsolutePath);
}
public static bool IsLockFile(this UpdateFileDC file)
{
return file.Name == BeWoPathFileConfig.LockFileName;
}
public static bool IsPackageInfo(this UpdateFileDC file)
{
return file.GetExtensionType() == BeWoPathFileConfig.DotBeWoInfo;
}
public static bool IgnoreFile(this UpdateFileDC file)
{
// Lock File Ignorieren
if (file.IsLockFile())
return true;
public static bool EqualsFile(this PlanerFileInfo file, PlanerFileInfo file2)
{
return (file.Checksum == file2.Checksum) &&
(file.RelativePath == file2.RelativePath) &&
(file.Name == file2.Name);
}
public static bool EqualsFile(this PlanerFileInfoDC file, PlanerFileInfoDC file2)
{
return (file.Checksum == file2.Checksum) &&
(file.RelativePath == file2.RelativePath) &&
(file.Name == file2.Name);
}
public static bool EqualsFile(this PlanerFileInfo file, PlanerFileInfoDC file2)
{
return (file.Checksum == file2.Checksum) &&
(file.RelativePath == file2.RelativePath) &&
(file.Name == file2.Name);
}
public static bool EqualsFile(this PlanerFileInfoDC file, PlanerFileInfo file2)
{
return (file.Checksum == file2.Checksum) &&
(file.RelativePath == file2.RelativePath) &&
(file.Name == file2.Name);
// Package Info Ignorieren
if (file.IsPackageInfo())
return true;
return false;
}
public static bool IgnoreToRemove(this PlanerFileInfo file)
public static bool IgnoreToRemove(this UpdateFileDC file)
{
if (file.Name == BeWoPathFileConfig.LockFileName)
return true;
if (file.GetExtensionType() == BeWoPathFileConfig.DotBeWoInfo)
return true;
return false;
}
}

View File

@@ -10,26 +10,15 @@ namespace BS.SharedLauncher.Extensions
{
public static class PlanerPackageExtension
{
public static PlanerPackageInfoDC ToPlanerPackageInfoDC(this PlanerPackageInfo planerFileInfo) => new PlanerPackageInfoDC()
public static bool ContainsPlanerFile(this UpdatePlanDC planerPackageInfo, UpdateFileDC file2)
{
Created = planerFileInfo.Created,
DefaultVersion = planerFileInfo.DefaultVersion,
Files = planerFileInfo.Files.ToPlanerFileInfoDCList(),
TenantVersion = planerFileInfo.TenantVersion
};
public static PlanerPackageInfo ToPlanerPackageInfo(this PlanerPackageInfoDC planerFileInfo) => new PlanerPackageInfo()
{
Created = planerFileInfo.Created,
DefaultVersion = planerFileInfo.DefaultVersion,
Files = planerFileInfo.Files.ToPlanerFileInfoList(),
TenantVersion = planerFileInfo.TenantVersion
};
public static bool ContainsPlanerFile(this PlanerPackageInfo planerPackageInfo, string rel, string checksum)
{
return planerPackageInfo.Files.FirstOrDefault(file => file.RelativePath == rel && file.Checksum == checksum) is object;
return planerPackageInfo.Files.FirstOrDefault(file => file.RelativePath == file2.RelativePath) is object;
}
public static bool AnyFile(this PlanerPackageInfo planerPackageInfo)
public static bool ContainsPlanerFileWithHash(this UpdatePlanDC planerPackageInfo, UpdateFileDC file2)
{
return planerPackageInfo.Files.FirstOrDefault(file => file.RelativePath == file2.RelativePath && file.Checksum == file2.Checksum) is object;
}
public static bool AnyFile(this UpdatePlanDC planerPackageInfo)
{
if (planerPackageInfo.Files is null)
return false;
@@ -37,25 +26,25 @@ namespace BS.SharedLauncher.Extensions
return planerPackageInfo.Files.Any();
}
public static PlanerFileInfo FindPlanerFile(this PlanerPackageInfo planerFileInfo, string relative)
public static UpdateFileDC FindPlanerFile(this UpdatePlanDC planerFileInfo, string relative)
{
return planerFileInfo.Files.Find(x => x.RelativePath == relative);
}
public static PlanerFileInfo FirstOrDefaultPlanerFile(this PlanerPackageInfo planerFileInfo, string relative)
public static UpdateFileDC FirstOrDefaultPlanerFile(this UpdatePlanDC planerFileInfo, string relative)
{
return planerFileInfo.Files.FirstOrDefault(x => x.RelativePath == relative);
}
public static PlanerFileInfo FirstOrDefaultPlanerFile(this PlanerPackageInfo planerFileInfo, PlanerFileInfo file)
public static UpdateFileDC FirstOrDefaultPlanerFile(this UpdatePlanDC planerFileInfo, UpdateFileDC file)
{
return planerFileInfo.Files.FirstOrDefault(x => x.EqualsFile(file));
}
public static void InitFiles(this PlanerPackageInfo planerFileInfo, List<PlanerFileInfo> files)
public static void InitFiles(this UpdatePlanDC planerFileInfo, List<UpdateFileDC> files)
{
planerFileInfo.Files = new List<PlanerFileInfo>();
planerFileInfo.Files = new List<UpdateFileDC>();
planerFileInfo.Files.AddRange(files);
}
private static void OverrideFile(this PlanerPackageInfo planerFileInfo, PlanerFileInfo newFile)
private static void OverrideOrAddFile(this UpdatePlanDC planerFileInfo, UpdateFileDC newFile)
{
var oldFile = planerFileInfo.FirstOrDefaultPlanerFile(newFile.RelativePath);
@@ -65,44 +54,32 @@ namespace BS.SharedLauncher.Extensions
planerFileInfo.Files.Add(newFile);
//oldFile.Source = newFile.Source;
}
public static void OverrideFiles(this PlanerPackageInfo planerFileInfo, List<PlanerFileInfo> files)
public static void OverrideOrAddFiles(this UpdatePlanDC planerFileInfo, List<UpdateFileDC> files)
{
files.ForEach(x => planerFileInfo.OverrideFile(x));
files.ForEach(x => planerFileInfo.OverrideOrAddFile(x));
}
public static void TryRemoveFile(this PlanerPackageInfo planerFileInfo, PlanerFileInfo file)
public static void TryRemoveFile(this UpdatePlanDC planerFileInfo, UpdateFileDC file)
{
var minuend = planerFileInfo.FirstOrDefaultPlanerFile(file);
if (minuend is PlanerFileInfo)
if (minuend is UpdateFileDC)
{
planerFileInfo.RemoveFile(minuend);
}
}
public static void RemoveFile(this PlanerPackageInfo planerFileInfo, PlanerFileInfo file)
public static void RemoveFile(this UpdatePlanDC planerFileInfo, UpdateFileDC file)
{
planerFileInfo.Files.Remove(file);
}
public static void RemoveFileAt(this PlanerPackageInfo planerFileInfo, int index)
public static void RemoveFileAt(this UpdatePlanDC planerFileInfo, int index)
{
planerFileInfo.Files.RemoveAt(index);
}
public static void SubstractFiles(this PlanerPackageInfo planerPackageInfo, List<PlanerFileInfo> files)
public static void SubstractFiles(this UpdatePlanDC planerPackageInfo, List<UpdateFileDC> files)
{
files.ForEach(f => planerPackageInfo.TryRemoveFile(f));
}
public static void LoadHash(this PlanerPackageInfo planer) => planer.Files.ForEach(file => file.LoadHash());
public static PlanerPackageInfo Copy(this PlanerPackageInfo pp) => new PlanerPackageInfo()
{
Created = pp.Created,
DefaultVersion = pp.DefaultVersion,
TenantVersion = pp.TenantVersion,
Files = pp.Files.Select(file => file.Copy()).ToList()
};
public static void Apply(this PlanerPackageInfo planer)
{
}
public static void LoadHash(this UpdatePlanDC planer) => planer.Files.ForEach(file => file.LoadHash());
}
}

View File

@@ -0,0 +1,32 @@
using BS.SharedLauncher.DataContract;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BS.SharedLauncher.Extensions
{
public static class UpdateResponseExtension
{
public static bool HasToDo(this UpdatePlanResponse response)
{
return response.HasToRequestFiles() || response.HasToApplyFiles() || response.HasToDeleteFilesInApply();
}
public static bool HasToRequestFiles(this UpdatePlanResponse response)
{
return response.FilesToRequest is object;
}
public static bool HasToApplyFiles(this UpdatePlanResponse response)
{
return response.FilesToApply is object;
}
public static bool HasToDeleteFilesInApply(this UpdatePlanResponse response)
{
return response.FilesToDeleteInApply is object;
}
}
}

View File

@@ -11,14 +11,12 @@ namespace BS.SharedLauncher.Information
public static class BeWoPathFileConfig
{
private static readonly string lockFileName = "_lock";
private static readonly string zipName = "bewo{0}.zip";
private static readonly string dotbewoinfo = ".bewoinfo";
private static readonly string dotbewoinfo = ".bewoplan";
private static readonly string latestFileName = "latest";
private static readonly string subdir = "BeWoPlaner";
private static readonly string testForPermission = "bewo.permission.test";
public static string LockFileName => lockFileName;
public static string ZipFormatName => zipName;
public static string DotBeWoInfo => dotbewoinfo;
public static string LatestBeWoInfo => latestFileName + DotBeWoInfo;
public static string SubDirectory => subdir;

Some files were not shown because too many files have changed in this diff Show More