Progress Info Fehler behoben, spezielle Exceptions aufm Server hinzugefügt
This commit is contained in:
@@ -8,17 +8,17 @@
|
||||
<basicHttpBinding>
|
||||
<binding name="BeWoBasicEndpoint" closeTimeout="00:05:00" openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10: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>
|
||||
<binding name="BeWoStreamingEndpoint" receiveTimeout="10:10:00" sendTimeout="10:01:00" maxBufferSize="65536" maxReceivedMessageSize="67108864" transferMode="StreamedRequest" useDefaultWebProxy="true" messageEncoding="Text">
|
||||
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384"/>
|
||||
<security mode="Transport"/>
|
||||
<security mode="None"/>
|
||||
<!-- mode="Transport" für echten Server -->
|
||||
</binding>
|
||||
<binding name="QueryServiceEndpoint" closeTimeout="00:10:00" openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10: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="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384"/>
|
||||
<security mode="Transport">
|
||||
<security mode="None">
|
||||
<transport clientCredentialType="None" proxyCredentialType="None" realm=""/>
|
||||
<message clientCredentialType="UserName" algorithmSuite="Default"/>
|
||||
</security>
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
using BeWoLauncher.Logic.Controller;
|
||||
using BeWoLauncher.Components;
|
||||
using BeWoLauncher.Logic.Controller;
|
||||
using BeWoLauncher.Logic.Utils;
|
||||
using BS.SharedLauncher.Information;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using static BeWoLauncher.Logic.Controller.ViewController;
|
||||
|
||||
@@ -46,18 +49,24 @@ namespace BeWoLauncher.Logic.Behavior
|
||||
else
|
||||
Task.Run(() =>
|
||||
{
|
||||
DownloadController.Start();
|
||||
DownloadController.Manager.StartDownloadInfo();
|
||||
|
||||
if (DownloadController.Manager.ResponseInfo.HasSomethingToDo)
|
||||
try
|
||||
{
|
||||
ViewBehavior.ShowInfo();
|
||||
}
|
||||
else
|
||||
{
|
||||
ViewBehavior.ShowLoading();
|
||||
}
|
||||
DownloadController.Start();
|
||||
DownloadController.Manager.StartDownloadInfo();
|
||||
|
||||
if (DownloadController.Manager.ResponseInfo.HasSomethingToDo)
|
||||
{
|
||||
ViewBehavior.ShowInfo();
|
||||
}
|
||||
else
|
||||
{
|
||||
ViewBehavior.ShowLoading();
|
||||
}
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
ViewBehavior.ShowError(ex);
|
||||
}
|
||||
EndWaiting();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -77,6 +77,15 @@ namespace BeWoLauncher.Logic.Behavior
|
||||
}));
|
||||
}
|
||||
|
||||
public void ShowError(Exception exception)
|
||||
{
|
||||
ViewController.Dispatcher.BeginInvoke(DispatcherPriority.Normal, new Action(() =>
|
||||
{
|
||||
Error = exception;
|
||||
ShowFrame(FrameType.GenericFail);
|
||||
}));
|
||||
}
|
||||
|
||||
public void ShowUninstallInfo()
|
||||
{
|
||||
ViewController.Dispatcher.BeginInvoke(DispatcherPriority.Normal, new Action(() =>
|
||||
|
||||
@@ -31,7 +31,8 @@ namespace BeWoLauncher.Logic.Controller
|
||||
UninstallFailed,
|
||||
UninstallSuccessful,
|
||||
LoadingScreen,
|
||||
NoPermissionInfo
|
||||
NoPermissionInfo,
|
||||
GenericFail
|
||||
}
|
||||
|
||||
public static class ViewController
|
||||
|
||||
@@ -159,6 +159,18 @@ namespace BeWoLauncher.ServiceProxy
|
||||
ShowErrorMessage(e);
|
||||
}
|
||||
}
|
||||
public static T DoDownloadBeWoServiceSyncWithException<T>(Func<IDownloadBeWoService, T> pFunc)
|
||||
{
|
||||
try
|
||||
{
|
||||
return pFunc.Invoke(GetInstance<DownloadBeWoServiceClient, IDownloadBeWoService>());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw e;
|
||||
}
|
||||
return default(T);
|
||||
}
|
||||
public static T DoDownloadBeWoServiceSync<T>(Func<IDownloadBeWoService, T> pFunc)
|
||||
{
|
||||
try
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using BeWoLauncher.ServiceProxy;
|
||||
using BS.SharedLauncher;
|
||||
using BS.SharedLauncher.DataContract;
|
||||
using BS.SharedLauncher.Enums;
|
||||
using BS.SharedLauncher.Exceptions;
|
||||
using BS.SharedLauncher.Extensions;
|
||||
using BS.SharedLauncher.Information;
|
||||
@@ -44,7 +45,7 @@ namespace BeWoLauncher.Logic.Utils.Download
|
||||
|
||||
ConnectionInformation.Version = ResponseInfo.Version;
|
||||
}
|
||||
public void StartDownload(bool skipLock)
|
||||
public void StartDownload(bool skipLock, Action<int, object> download)
|
||||
{
|
||||
GetDownloadResponse();
|
||||
|
||||
@@ -52,6 +53,8 @@ namespace BeWoLauncher.Logic.Utils.Download
|
||||
{
|
||||
// Macht das Sinn?
|
||||
// Ne, wahrsch. Fehler
|
||||
throw new NotImplementedException("#45419873274");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -63,6 +66,7 @@ namespace BeWoLauncher.Logic.Utils.Download
|
||||
|
||||
LauncherPaths.CurrentDownloadZipLocation = FileController.GetNewZipPath(LauncherPaths.GetDownloadPath());
|
||||
|
||||
//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);
|
||||
@@ -87,36 +91,37 @@ namespace BeWoLauncher.Logic.Utils.Download
|
||||
{
|
||||
FileController.ApplyDZip(LauncherPaths.CurrentDownloadZipLocation, ApplyFolder, apply);
|
||||
}
|
||||
|
||||
}
|
||||
public void StartCleanup(Action<int, object> feedback)
|
||||
{
|
||||
if (Response.HasToRemoveFiles)
|
||||
{
|
||||
apply(3, null);
|
||||
|
||||
Thread.Sleep(500);
|
||||
|
||||
FileController.RemoveUnsuedFiles(Response.LatestApplicationInfo, ApplyFolder, apply);
|
||||
StartRemoveFiles(feedback, Response.LatestApplicationInfo);
|
||||
}
|
||||
|
||||
DownloadFolder.ClearFolder();
|
||||
|
||||
ApplyFolder.Unlock();
|
||||
|
||||
apply(5, null);
|
||||
|
||||
Thread.Sleep(1000);
|
||||
}
|
||||
public void StartUninstall(Action<int, object> apply)
|
||||
public void StartUninstall(Action<int, object> feedback)
|
||||
{
|
||||
apply(3, null);
|
||||
|
||||
Thread.Sleep(500);
|
||||
|
||||
var t = new PlanerPackageInfoDC()
|
||||
{
|
||||
Files = new List<PlanerFileInfoDC>()
|
||||
};
|
||||
|
||||
FileController.RemoveUnsuedFiles(t, LauncherPaths.ActualPlanerLocation, apply);
|
||||
|
||||
StartRemoveFiles(feedback, t);
|
||||
}
|
||||
|
||||
private void StartRemoveFiles(Action<int, object> feedback, PlanerPackageInfoDC newPackage)
|
||||
{
|
||||
feedback((int)LauncherProgress.DeleteStart, null);
|
||||
|
||||
Thread.Sleep(500);
|
||||
|
||||
FileController.RemoveUnsuedFiles(newPackage, ApplyFolder, feedback);
|
||||
}
|
||||
|
||||
private void CreateDownloadRequest()
|
||||
@@ -155,7 +160,7 @@ namespace BeWoLauncher.Logic.Utils.Download
|
||||
private void GetDownloadResponseInfo()
|
||||
{
|
||||
var t = ConnectionInformation.Tenant;
|
||||
ResponseInfo = LauncherServiceFacade.DoDownloadBeWoServiceSync(x => x.DownloadInfo(Request));
|
||||
ResponseInfo = LauncherServiceFacade.DoDownloadBeWoServiceSyncWithException(x => x.DownloadInfo(Request));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,6 +31,8 @@ namespace BeWoLauncher.Logic
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case FrameType.GenericFail:
|
||||
return getGenericFailedFrame();
|
||||
case FrameType.InstallInfo:
|
||||
return getInstallInfoFrame();
|
||||
case FrameType.InstallProgress:
|
||||
@@ -178,6 +180,18 @@ namespace BeWoLauncher.Logic
|
||||
return installError;
|
||||
}
|
||||
|
||||
private FrameBase getGenericFailedFrame()
|
||||
{
|
||||
var genError = new InfoFrame();
|
||||
|
||||
genError.Title = "Loader fehlgeschlagen!";
|
||||
genError.Text = Error.ToString();
|
||||
|
||||
genError.Button1Click += ViewBehavior.BackToLogin;
|
||||
|
||||
return genError;
|
||||
}
|
||||
|
||||
private FrameBase getInstallProgressFrame()
|
||||
{
|
||||
var installprogress = new InstallProgressInfoFrame();
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using BeWoLauncher.Logic.Controller;
|
||||
using BeWoLauncher.Logic.Utils.Download;
|
||||
using BS.SharedLauncher.Enums;
|
||||
using BS.SharedLauncher.Update;
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
@@ -17,8 +18,9 @@ namespace BeWoLauncher.View.Frames
|
||||
public InstallProgressInfoFrame() : base()
|
||||
{
|
||||
Bar1SetLimit(Manager.ResponseInfo.FileCount);
|
||||
|
||||
Bar1Deactivate();
|
||||
Bar1Hide();
|
||||
|
||||
Bar2SetLimit(100);
|
||||
}
|
||||
|
||||
public override void Start()
|
||||
@@ -40,21 +42,53 @@ namespace BeWoLauncher.View.Frames
|
||||
|
||||
BackgroundWorker worker = sender as BackgroundWorker;
|
||||
|
||||
worker.ReportProgress(0);
|
||||
// UI: 0
|
||||
worker.ReportProgress((int)LauncherProgress.ProgressStart);
|
||||
|
||||
// Wait
|
||||
Thread.Sleep(1000);
|
||||
|
||||
DownloadController.Manager.StartDownload(skipLock);
|
||||
|
||||
worker.ReportProgress(10);
|
||||
|
||||
Thread.Sleep(1000);
|
||||
|
||||
worker.ReportProgress(1);
|
||||
// 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)
|
||||
@@ -71,64 +105,78 @@ namespace BeWoLauncher.View.Frames
|
||||
|
||||
private void worker_ProgressChanged(object sender, ProgressChangedEventArgs e)
|
||||
{
|
||||
Bar2SetLimit(100);
|
||||
var progress = (LauncherProgress)e.ProgressPercentage;
|
||||
var obj = e.UserState;
|
||||
|
||||
if (e.ProgressPercentage == 0)
|
||||
switch (progress)
|
||||
{
|
||||
// Download begonnen
|
||||
case LauncherProgress.ProgressStart:
|
||||
Message = "Installation wird vorbereitet...";
|
||||
SubMessage = "Lade benötigte Pakete herunter...";
|
||||
break;
|
||||
|
||||
Message = "Installation wird vorbereitet...";
|
||||
SubMessage = "Lade benötigte Pakete herunter...";
|
||||
}
|
||||
else if (e.ProgressPercentage == 10)
|
||||
{
|
||||
// Download fertig
|
||||
case LauncherProgress.DownloadStart:
|
||||
Message = "Download startet...";
|
||||
SubMessage = "";
|
||||
Bar1Show();
|
||||
Bar1Deactivate();
|
||||
Bar2SetPercent(10);
|
||||
break;
|
||||
|
||||
Message = "Download abgeschlossen!";
|
||||
SubMessage = "";
|
||||
case LauncherProgress.DownloadUpdate:
|
||||
throw new NotImplementedException("#fd42398");
|
||||
var args = obj as DownloadProgressEventArgs;
|
||||
SubMessage = $"{args.Progress.ToString("0.##")}% fertig";
|
||||
break;
|
||||
|
||||
Bar2SetPercent(30);
|
||||
}
|
||||
else if (e.ProgressPercentage == 1)
|
||||
{
|
||||
// Installation beginnen
|
||||
case LauncherProgress.DownloadFinish:
|
||||
Message = "Download abgeschlossen!";
|
||||
SubMessage = "";
|
||||
Bar2SetPercent(40);
|
||||
break;
|
||||
|
||||
Message = "Installiere Pakete...";
|
||||
SubMessage = "";
|
||||
case LauncherProgress.ApplyStart:
|
||||
Message = "Füge Pakete hinzu...";
|
||||
SubMessage = "";
|
||||
Bar1Activate();
|
||||
break;
|
||||
|
||||
Bar1Activate();
|
||||
}
|
||||
else if (e.ProgressPercentage == 2)
|
||||
{
|
||||
// Installation Fortschritt
|
||||
case LauncherProgress.ApplyUpdate:
|
||||
var args2 = obj as ApplyFileEventArgs;
|
||||
SubMessage = $"{args2.Name} wurde erfolgreich von \n{args2.AbsolutePath} hinzugefügt!";
|
||||
Bar1MakeStep();
|
||||
break;
|
||||
|
||||
var args = e.UserState as FileEventArgs;
|
||||
SubMessage = $"{args.Name} wurde erfolgreich von {args.AbsolutePath} installiert!";
|
||||
case LauncherProgress.ApplyFinished:
|
||||
Message = "Hinzufügen abgeschlossen!";
|
||||
SubMessage = "";
|
||||
Bar2SetPercent(80);
|
||||
Bar1Deactivate();
|
||||
break;
|
||||
|
||||
Bar1MakeStep();
|
||||
}
|
||||
else if (e.ProgressPercentage == 3)
|
||||
{
|
||||
// Löschen begonnen
|
||||
case LauncherProgress.DeleteStart:
|
||||
Message = "Ungebrauchte Datei(en) gefunden.";
|
||||
SubMessage = "";
|
||||
break;
|
||||
case LauncherProgress.DeleteUpdate:
|
||||
var args3 = obj as string;
|
||||
SubMessage = $"{args3} wurde entfernt!";
|
||||
break;
|
||||
|
||||
Bar1Deactivate();
|
||||
case LauncherProgress.DeleteFinished:
|
||||
Message = "Säuberung abgeschlossen!";
|
||||
SubMessage = "";
|
||||
Bar2SetPercent(95);
|
||||
Bar1Deactivate();
|
||||
break;
|
||||
|
||||
Message = "Alte Dateien werden entfernt.";
|
||||
SubMessage = "";
|
||||
|
||||
Bar2SetPercent(75);
|
||||
}
|
||||
else if (e.ProgressPercentage == 4)
|
||||
{
|
||||
// Löschen Fortschrittt
|
||||
|
||||
var args = e.UserState as string;
|
||||
SubMessage = $"{args} wurde entfernt!";
|
||||
}
|
||||
else if (e.ProgressPercentage == 5)
|
||||
{
|
||||
// Fertig mitm Löschen
|
||||
Bar2Fill();
|
||||
case LauncherProgress.ProgressEnd:
|
||||
Message = "Installation abgeschlossen!";
|
||||
SubMessage = "";
|
||||
Bar2Fill();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using BeWoLauncher.Logic.Controller;
|
||||
using BeWoLauncher.Logic.Utils.Download;
|
||||
using BS.SharedLauncher.Enums;
|
||||
using BS.SharedLauncher.Update;
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
@@ -17,8 +18,9 @@ namespace BeWoLauncher.View.Frames
|
||||
public UpdateProgressInfoFrame()
|
||||
{
|
||||
Bar1SetLimit(Manager.ResponseInfo.FileCount);
|
||||
|
||||
Bar1Deactivate();
|
||||
Bar1Hide();
|
||||
|
||||
Bar2SetLimit(100);
|
||||
}
|
||||
|
||||
public override void Start()
|
||||
@@ -40,21 +42,53 @@ namespace BeWoLauncher.View.Frames
|
||||
|
||||
BackgroundWorker worker = sender as BackgroundWorker;
|
||||
|
||||
worker.ReportProgress(0);
|
||||
// UI: 0
|
||||
worker.ReportProgress((int)LauncherProgress.ProgressStart);
|
||||
|
||||
// Wait
|
||||
Thread.Sleep(1000);
|
||||
|
||||
DownloadController.Manager.StartDownload(skipLock);
|
||||
|
||||
worker.ReportProgress(10);
|
||||
|
||||
Thread.Sleep(1000);
|
||||
|
||||
worker.ReportProgress(1);
|
||||
// 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)
|
||||
@@ -71,65 +105,78 @@ namespace BeWoLauncher.View.Frames
|
||||
|
||||
private void worker_ProgressChanged(object sender, ProgressChangedEventArgs e)
|
||||
{
|
||||
Bar2SetLimit(100);
|
||||
var progress = (LauncherProgress)e.ProgressPercentage;
|
||||
var obj = e.UserState;
|
||||
|
||||
if (e.ProgressPercentage == 0)
|
||||
switch (progress)
|
||||
{
|
||||
// Download begonnen
|
||||
case LauncherProgress.ProgressStart:
|
||||
Message = "Update wird vorbereitet...";
|
||||
SubMessage = "Lade benötigte Pakete herunter...";
|
||||
break;
|
||||
|
||||
Message = "Update wird vorbereitet...";
|
||||
SubMessage = "Lade benötigte Pakete herunter...";
|
||||
}
|
||||
else if (e.ProgressPercentage == 10)
|
||||
{
|
||||
// Download fertig
|
||||
case LauncherProgress.DownloadStart:
|
||||
Message = "Download startet...";
|
||||
SubMessage = "";
|
||||
Bar1Show();
|
||||
Bar1Deactivate();
|
||||
Bar2SetPercent(5);
|
||||
break;
|
||||
|
||||
Message = "Download abgeschlossen!";
|
||||
SubMessage = "";
|
||||
case LauncherProgress.DownloadUpdate:
|
||||
throw new NotImplementedException("#fd42398");
|
||||
var args = obj as DownloadProgressEventArgs;
|
||||
SubMessage = $"{args.Progress.ToString("0.##")}% fertig";
|
||||
break;
|
||||
|
||||
Bar2SetPercent(30);
|
||||
}
|
||||
else if (e.ProgressPercentage == 1)
|
||||
{
|
||||
// Installation beginnen
|
||||
case LauncherProgress.DownloadFinish:
|
||||
Message = "Download abgeschlossen!";
|
||||
SubMessage = "";
|
||||
Bar2SetPercent(40);
|
||||
break;
|
||||
|
||||
Message = "Aktualisiere Pakete...";
|
||||
SubMessage = "";
|
||||
case LauncherProgress.ApplyStart:
|
||||
Message = "Füge Pakete hinzu...";
|
||||
SubMessage = "";
|
||||
Bar1Activate();
|
||||
break;
|
||||
|
||||
Bar1Activate();
|
||||
}
|
||||
else if (e.ProgressPercentage == 2)
|
||||
{
|
||||
// Installation Fortschritt
|
||||
case LauncherProgress.ApplyUpdate:
|
||||
var args2 = obj as ApplyFileEventArgs;
|
||||
SubMessage = $"{args2.Name} wurde erfolgreich von \n{args2.AbsolutePath} hinzugefügt!";
|
||||
Bar1MakeStep();
|
||||
break;
|
||||
|
||||
var args = e.UserState as FileEventArgs;
|
||||
SubMessage = $"{args.Name} wurde erfolgreich von {args.AbsolutePath} installiert!";
|
||||
case LauncherProgress.ApplyFinished:
|
||||
Message = "Hinzufügen abgeschlossen!";
|
||||
SubMessage = "";
|
||||
Bar2SetPercent(80);
|
||||
Bar1Deactivate();
|
||||
break;
|
||||
|
||||
Bar1MakeStep();
|
||||
}
|
||||
else if (e.ProgressPercentage == 3)
|
||||
{
|
||||
// Löschen begonnen
|
||||
case LauncherProgress.DeleteStart:
|
||||
Message = "Ungebrauchte Datei(en) gefunden.";
|
||||
SubMessage = "";
|
||||
break;
|
||||
case LauncherProgress.DeleteUpdate:
|
||||
var args3 = obj as string;
|
||||
SubMessage = $"{args3} wurde entfernt!";
|
||||
break;
|
||||
|
||||
Bar1Deactivate();
|
||||
case LauncherProgress.DeleteFinished:
|
||||
Message = "Säuberung abgeschlossen!";
|
||||
SubMessage = "";
|
||||
Bar2SetPercent(95);
|
||||
Bar1Deactivate();
|
||||
break;
|
||||
|
||||
Message = "Alte Dateien werden entfernt.";
|
||||
SubMessage = "";
|
||||
|
||||
Bar2SetPercent(75);
|
||||
}
|
||||
else if (e.ProgressPercentage == 4)
|
||||
{
|
||||
// Löschen Fortschrittt
|
||||
|
||||
var args = e.UserState as string;
|
||||
SubMessage = $"{args} wurde entfernt!";
|
||||
}
|
||||
else if (e.ProgressPercentage == 5)
|
||||
{
|
||||
// Fertig mitm Löschen
|
||||
|
||||
Bar2Fill();
|
||||
case LauncherProgress.ProgressEnd:
|
||||
Message = "Installation abgeschlossen!";
|
||||
SubMessage = "";
|
||||
Bar2Fill();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ 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;
|
||||
@@ -351,7 +352,7 @@ namespace BeWoLauncher.View
|
||||
ReadProfileList();
|
||||
|
||||
#if DEBUG
|
||||
var uri = new Uri("https://localhost/Host/?k=demo&s=localhost/service");
|
||||
var uri = new Uri("http://localhost/Host/?k=demo&s=localhost/service");
|
||||
|
||||
var paramDic = LauncherUtils.ParseQuery(uri.Query);
|
||||
string v1, v2;
|
||||
|
||||
@@ -83,13 +83,16 @@
|
||||
</extensions>
|
||||
<services>
|
||||
<service behaviorConfiguration="returnFaults" name="BeWo.Service.ServiceImplementations.DownloadBeWoServiceImp">
|
||||
<endpoint behaviorConfiguration="SecurityAndSessionBehavior" binding="basicHttpBinding" bindingConfiguration="BasicStreamedRequest" name="DownloadBeWoServiceEndpoint" contract="BeWo.Service.ServiceContracts.IDownloadBeWoService" />
|
||||
<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" />
|
||||
<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" />
|
||||
<endpoint behaviorConfiguration="SecurityAndSessionBehavior" binding="basicHttpBinding" bindingConfiguration="TransportSecurityDownloadLarge"
|
||||
name="EnumTranslationServiceEndpoint" contract="BeWo.Service.ServiceContracts.IEnumTranslationService" />
|
||||
</service>
|
||||
</services>
|
||||
</system.serviceModel>
|
||||
|
||||
@@ -12,6 +12,7 @@ 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.Logic;
|
||||
using BS.SharedLauncher.Update;
|
||||
@@ -25,19 +26,30 @@ namespace BeWo.Service.ServiceImplementations
|
||||
|
||||
public DownloadPlanerResponseDC Download2(DownloadPlanerRequestDC request)
|
||||
{
|
||||
DownloadPlanerResponseBuilder builder = new DownloadPlanerResponseBuilder(request);
|
||||
try
|
||||
{
|
||||
DownloadPlanerResponseBuilder builder = new DownloadPlanerResponseBuilder(request);
|
||||
|
||||
builder.Calculate(Tenant);
|
||||
builder.Calculate(Tenant);
|
||||
|
||||
if (!request.ApplyFolderIsEmpty)
|
||||
if (request.ApplyPackage is object)
|
||||
builder.Substract(request.ApplyPackage.ToPlanerPackageInfo());
|
||||
if (!request.ApplyFolderIsEmpty)
|
||||
if (request.ApplyPackage is object)
|
||||
builder.Substract(request.ApplyPackage.ToPlanerPackageInfo());
|
||||
|
||||
if (!request.DownloadFolderIsEmpty)
|
||||
if (request.DownloadedPackages is object)
|
||||
builder.AnalyseDownload(request.DownloadedPackages.ToDictionary(pair => pair.Key, pair => pair.Value.ToPlanerPackageInfo()));
|
||||
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 builder.CreateResponse(request);
|
||||
}
|
||||
catch (UpdateException update)
|
||||
{
|
||||
throw update;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new UpdateException("Update - Download - Exception", ex);
|
||||
}
|
||||
}
|
||||
|
||||
public DownloadPlanerResponseInfoDC DownloadInfo(DownloadPlanerRequestDC request)
|
||||
@@ -66,9 +78,13 @@ namespace BeWo.Service.ServiceImplementations
|
||||
|
||||
return responseInfo;
|
||||
}
|
||||
catch (Exception e)
|
||||
catch (UpdateException update)
|
||||
{
|
||||
throw Core.Utils.CreateBeWoFaultException(e);
|
||||
throw update;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new UpdateException("Update - DownloadInfo - Exception", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace BeWo.Service.ServiceUtils.Paths
|
||||
private static string _LogFolderPath;
|
||||
|
||||
public static string DownloadVersionFilePath => GetAppSettings(_DownloadVersionFilePath, "DownloadVersionFilePath");
|
||||
public static string DownloadFolderPath => GetAppSettings(_DownloadVersionFilePath, "DownloadVersionFilePath");
|
||||
public static string DownloadFolderPath => GetAppSettings(_DownloadFolderPath, "DownloadFolderPath");
|
||||
public static string LogFolderPath => GetAppSettings(_LogFolderPath, "LogFolderPath");
|
||||
|
||||
static ServerFilePaths()
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
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;
|
||||
@@ -112,6 +113,9 @@ namespace BeWo.Service.ServiceUtils.Update
|
||||
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;
|
||||
@@ -121,15 +125,18 @@ namespace BeWo.Service.ServiceUtils.Update
|
||||
return res;
|
||||
}
|
||||
|
||||
private List<PlanerFileInfo> getVersionDefaultFiles(string version) => getPlanerFiles(ServerFilePaths.GetVersionDefaultFolderPath(version));
|
||||
private List<PlanerFileInfo> getVersionTenantFiles(string version, string tenant) => getPlanerFiles(ServerFilePaths.GetVersionTenantFolderPath(version, tenant));
|
||||
private List<PlanerFileInfo> getSpecialTenantFiles(string tenant) => getPlanerFiles(ServerFilePaths.GetOverrideTenantFolderPath(tenant));
|
||||
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)
|
||||
private List<PlanerFileInfo> getPlanerFiles(string path, bool ignore)
|
||||
{
|
||||
if (!Directory.Exists(path))
|
||||
return new List<PlanerFileInfo>();
|
||||
|
||||
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);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using BS.SharedLauncher.Update;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
@@ -24,6 +25,12 @@ namespace BS.SharedLauncher.DataContract
|
||||
[DataMember]
|
||||
public byte[] NewZipData { get; set; }
|
||||
|
||||
[DataMember]
|
||||
public Stream NewZipStream { get; set; }
|
||||
|
||||
[DataMember]
|
||||
public long NewZipStreamLength { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Nur neue Dateien
|
||||
/// </summary>
|
||||
|
||||
23
SharedLauncher/Exceptions/ServerConfigException.cs
Normal file
23
SharedLauncher/Exceptions/ServerConfigException.cs
Normal 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 ServerConfigException : UpdateException
|
||||
{
|
||||
public ServerConfigException()
|
||||
{
|
||||
}
|
||||
|
||||
public ServerConfigException(string message) : base(message)
|
||||
{
|
||||
}
|
||||
|
||||
public ServerConfigException(string message, Exception innerException) : base(message, innerException)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -41,6 +41,10 @@ namespace BS.SharedLauncher.Extensions
|
||||
{
|
||||
return planerFileInfo.Files.Find(x => x.RelativePath == relative);
|
||||
}
|
||||
public static PlanerFileInfo FirstOrDefaultPlanerFile(this PlanerPackageInfo planerFileInfo, string relative)
|
||||
{
|
||||
return planerFileInfo.Files.FirstOrDefault(x => x.RelativePath == relative);
|
||||
}
|
||||
public static PlanerFileInfo FirstOrDefaultPlanerFile(this PlanerPackageInfo planerFileInfo, PlanerFileInfo file)
|
||||
{
|
||||
return planerFileInfo.Files.FirstOrDefault(x => x.EqualsFile(file));
|
||||
@@ -53,9 +57,12 @@ namespace BS.SharedLauncher.Extensions
|
||||
}
|
||||
private static void OverrideFile(this PlanerPackageInfo planerFileInfo, PlanerFileInfo newFile)
|
||||
{
|
||||
var oldFile = planerFileInfo.FindPlanerFile(newFile.RelativePath);
|
||||
var oldFile = planerFileInfo.FirstOrDefaultPlanerFile(newFile.RelativePath);
|
||||
|
||||
oldFile.AbsolutePath = newFile.AbsolutePath;
|
||||
if (oldFile is object)
|
||||
oldFile.AbsolutePath = newFile.AbsolutePath;
|
||||
else
|
||||
planerFileInfo.Files.Add(newFile);
|
||||
//oldFile.Source = newFile.Source;
|
||||
}
|
||||
public static void OverrideFiles(this PlanerPackageInfo planerFileInfo, List<PlanerFileInfo> files)
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace BS.SharedLauncher.Information
|
||||
|
||||
public string[] ToArray()
|
||||
{
|
||||
return new string[] { Tenant, Username, Password, IpAddress, "5", ChatServerAddress, Version };
|
||||
return new string[] { "demo", "demo", "demo", IpAddress, ConnectionInformation.CoreServerAddressOrigin.ToString(), ChatServerAddress, Version };
|
||||
}
|
||||
|
||||
//public static bool TryParse(string input, out Connection connection)
|
||||
|
||||
@@ -39,6 +39,21 @@ namespace BS.SharedLauncher.Enums
|
||||
AreTheSame
|
||||
}
|
||||
|
||||
public enum LauncherProgress
|
||||
{
|
||||
ProgressStart = 0,
|
||||
DownloadStart = 1,
|
||||
DownloadUpdate = 2,
|
||||
DownloadFinish = 3,
|
||||
ApplyStart = 4,
|
||||
ApplyUpdate = 5,
|
||||
ApplyFinished = 6,
|
||||
DeleteStart = 7,
|
||||
DeleteUpdate = 8,
|
||||
DeleteFinished = 9,
|
||||
ProgressEnd = 10,
|
||||
}
|
||||
|
||||
//public enum PlanerUpdateSource
|
||||
//{
|
||||
// Invalid = 0,
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using BS.SharedLauncher.DataContract;
|
||||
using BS.SharedLauncher.Enums;
|
||||
using BS.SharedLauncher.Extensions;
|
||||
using BS.SharedLauncher.Information;
|
||||
using BS.SharedLauncher.Update;
|
||||
@@ -20,7 +21,7 @@ namespace BS.SharedLauncher.Logic
|
||||
|
||||
public static string GetDZipPath(string root, int number) => Path.Combine(root, string.Format(ZipFormatName, getFileNumberCountString(number)));
|
||||
public static string GetDZipInfoPath(string root, int number) => GetDZipPath(root, number) + DotBeWoInfo;
|
||||
|
||||
|
||||
public static void ApplyDZip(Dictionary<string, List<string>> zip2keepfiles, string destinationfolder, Action<int, object> apply)
|
||||
{
|
||||
foreach (var pair in zip2keepfiles)
|
||||
@@ -41,7 +42,7 @@ namespace BS.SharedLauncher.Logic
|
||||
var path = destinationfolder.Combine(entry.FullName);
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(path));
|
||||
entry.ExtractToFile(path, true);
|
||||
apply(2, new FileEventArgs(entry.FullName, path));
|
||||
apply((int)LauncherProgress.ApplyUpdate, new ApplyFileEventArgs(entry.FullName, path));
|
||||
Thread.Sleep(100);
|
||||
}
|
||||
}
|
||||
@@ -60,15 +61,10 @@ namespace BS.SharedLauncher.Logic
|
||||
continue;
|
||||
|
||||
File.Delete(file.AbsolutePath);
|
||||
status(4, file);
|
||||
status((int)LauncherProgress.DeleteUpdate, file);
|
||||
}
|
||||
}
|
||||
|
||||
public static void RemoveFiles(string folder)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public static List<string> GetValidDZipPaths(string path)
|
||||
{
|
||||
var res = new List<string>();
|
||||
@@ -97,6 +93,36 @@ namespace BS.SharedLauncher.Logic
|
||||
|
||||
return temp;
|
||||
}
|
||||
|
||||
public static void SaveDZipStream(string path, Stream filebytestream, long length, Action<int, DownloadProgressEventArgs> download)
|
||||
{
|
||||
long startlength = 0;
|
||||
FileInfo finfo = new FileInfo(path);
|
||||
if (finfo.Exists)
|
||||
startlength = finfo.Length; // If File exists,
|
||||
// we need to send the Start length to the server
|
||||
|
||||
using (FileStream writeStream =
|
||||
new System.IO.FileStream(path, FileMode.OpenOrCreate, FileAccess.Write))
|
||||
{
|
||||
int chunkSize = 2048;
|
||||
byte[] buffer = new byte[chunkSize];
|
||||
|
||||
do
|
||||
{
|
||||
int bytesRead = filebytestream.Read(buffer, 0, chunkSize);
|
||||
if (bytesRead == 0) break;
|
||||
|
||||
writeStream.Write(buffer, 0, bytesRead);
|
||||
|
||||
download(11, new DownloadProgressEventArgs(writeStream.Position * 100 / length));
|
||||
}
|
||||
while (true);
|
||||
|
||||
writeStream.Close();
|
||||
}
|
||||
filebytestream.Dispose();
|
||||
}
|
||||
public static void SaveDZip(string path, byte[] data)
|
||||
{
|
||||
File.WriteAllBytes(path, data);
|
||||
|
||||
@@ -54,6 +54,7 @@
|
||||
<Compile Include="DataContract\DownloadPlanerRequestDC.cs" />
|
||||
<Compile Include="DataContract\PlanerFileInfoDC.cs" />
|
||||
<Compile Include="DataContract\PlanerPackageInfoDC.cs" />
|
||||
<Compile Include="Exceptions\ServerConfigException.cs" />
|
||||
<Compile Include="Exceptions\UpdateException.cs" />
|
||||
<Compile Include="Extensions\DownloadPlanerResponseExtension.cs" />
|
||||
<Compile Include="Extensions\PathExtensions.cs" />
|
||||
@@ -65,7 +66,8 @@
|
||||
<Compile Include="Logic\FileController.cs" />
|
||||
<Compile Include="Logic\XmlConverter.cs" />
|
||||
<Compile Include="Logic\ZipArchiveBuilder.cs" />
|
||||
<Compile Include="Update\FileEventArgs.cs" />
|
||||
<Compile Include="Update\ApplyFileEventArgs.cs" />
|
||||
<Compile Include="Update\DownloadProgressEventArgs.cs" />
|
||||
<Compile Include="Update\PlanerFileInfo.cs" />
|
||||
<Compile Include="Update\PlanerPackageInfo.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
|
||||
@@ -6,12 +6,12 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace BS.SharedLauncher.Update
|
||||
{
|
||||
public class FileEventArgs : EventArgs
|
||||
public class ApplyFileEventArgs : EventArgs
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string AbsolutePath { get; set; }
|
||||
|
||||
public FileEventArgs(string name, string path)
|
||||
public ApplyFileEventArgs(string name, string path)
|
||||
{
|
||||
Name = name;
|
||||
AbsolutePath = path;
|
||||
18
SharedLauncher/Update/DownloadProgressEventArgs.cs
Normal file
18
SharedLauncher/Update/DownloadProgressEventArgs.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BS.SharedLauncher.Update
|
||||
{
|
||||
public class DownloadProgressEventArgs : EventArgs
|
||||
{
|
||||
public double Progress { get; set; }
|
||||
|
||||
public DownloadProgressEventArgs(double progress)
|
||||
{
|
||||
Progress = progress;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user