Working now
- more logs - download controller + manager überarbeitet - Retry wird besser angezeigt - Formatierungen
This commit is contained in:
@@ -103,7 +103,7 @@ namespace BeWoLauncher
|
||||
}
|
||||
public void StartWaiting()
|
||||
{
|
||||
Dispatcher.BeginInvoke(DispatcherPriority.Normal,
|
||||
Dispatcher.BeginInvoke(DispatcherPriority.Render,
|
||||
(Action)delegate
|
||||
{
|
||||
if (_WaitLayer == null)
|
||||
@@ -120,7 +120,7 @@ namespace BeWoLauncher
|
||||
public void EndWaiting()
|
||||
{
|
||||
Dispatcher.BeginInvoke(
|
||||
DispatcherPriority.Normal,
|
||||
DispatcherPriority.Render,
|
||||
(Action)delegate
|
||||
{
|
||||
if (_WaitLayer != null)
|
||||
|
||||
@@ -57,7 +57,9 @@ namespace BeWoLauncher.Logic.Behavior
|
||||
|
||||
public void ShowView(ViewType vt)
|
||||
{
|
||||
CurrentView = ViewController.ViewBuilder.GetNewView(vt);
|
||||
var view = ViewController.ViewBuilder.GetNewView(vt);
|
||||
|
||||
CurrentView = view;
|
||||
}
|
||||
public void ShowFrame(FrameType ft)
|
||||
{
|
||||
@@ -129,6 +131,8 @@ namespace BeWoLauncher.Logic.Behavior
|
||||
|
||||
public void BackToLogin(object sender, EventArgs e)
|
||||
{
|
||||
StartWaiting();
|
||||
|
||||
ShowView(ViewType.LoginView);
|
||||
}
|
||||
public void LoginSuccessful(object sender, EventArgs e)
|
||||
@@ -174,6 +178,7 @@ namespace BeWoLauncher.Logic.Behavior
|
||||
}
|
||||
public void UpdateSuccess(object sender, EventArgs e)
|
||||
{
|
||||
LauncherAppdataConfig.SetFirstInstallationSuccess(true);
|
||||
ShowFrame(FrameType.LoadingScreen);
|
||||
}
|
||||
|
||||
@@ -183,6 +188,7 @@ namespace BeWoLauncher.Logic.Behavior
|
||||
}
|
||||
public void UninstallSuccess(object sender, EventArgs e)
|
||||
{
|
||||
LauncherAppdataConfig.Reset();
|
||||
ShowFrame(FrameType.UninstallSuccessful);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ namespace BeWoLauncher.Logic.Controller
|
||||
|
||||
GenericTextLogger.Post($"Anfrage wurde erfolgreich verarbeitet. Server gibt Version {client_version} vor.");
|
||||
|
||||
if (!response.HasToDo())
|
||||
if (!response.HasToDo)
|
||||
can_quick_start = true;
|
||||
|
||||
return null;
|
||||
@@ -118,6 +118,8 @@ namespace BeWoLauncher.Logic.Controller
|
||||
|
||||
public static string TryLoadUninstallPlan()
|
||||
{
|
||||
GenericTextLogger.PostImportantInfo("Starting Uninstall Process");
|
||||
|
||||
try
|
||||
{
|
||||
Manager.GetDeletePlan();
|
||||
|
||||
@@ -56,6 +56,8 @@ namespace BeWoLauncher.Logic.Controller
|
||||
ViewBuilder = new ViewBuilder();
|
||||
}
|
||||
|
||||
public static string GetErrorString() => ErrorString ?? Error?.ToString() ?? "unbekannt";
|
||||
|
||||
public static void InitWindow(LauncherWindow window)
|
||||
{
|
||||
if (CurrentWindow is null)
|
||||
|
||||
@@ -119,24 +119,28 @@ namespace BeWoLauncher.Logic.Utils.Download
|
||||
|
||||
private void Download()
|
||||
{
|
||||
var tries_per_file = UpdatePlanResponse.TriesPerFile;
|
||||
|
||||
DownloadFolder.CreateFolder();
|
||||
|
||||
DownloadFolder.Lock(SkipLock);
|
||||
|
||||
DownloadFolder.SaveCurrentInfo("current");
|
||||
|
||||
UpdateFileRequest req = new UpdateFileRequest(UpdatePlanResponse.CurrentPackage.Version);
|
||||
UpdateFileRequest req = new UpdateFileRequest(UpdatePlanResponse);
|
||||
|
||||
req.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,
|
||||
};
|
||||
req.SessionId = UpdatePlanResponse.SessionId;
|
||||
|
||||
//req.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,
|
||||
//};
|
||||
|
||||
foreach (var file2request in UpdatePlanResponse.FilesToRequest)
|
||||
{
|
||||
@@ -144,12 +148,16 @@ namespace BeWoLauncher.Logic.Utils.Download
|
||||
|
||||
UpdateFileResponse response = null;
|
||||
|
||||
for (int i = 0; i < 5; i++)
|
||||
for (int i = 1; i <= tries_per_file; i++)
|
||||
{
|
||||
response = AskForFile(req);
|
||||
|
||||
if (response is object)
|
||||
break;
|
||||
|
||||
Feedback((int)LauncherProgress.DownloadRetry, new DownloadRetryEventArgs(i + 1, tries_per_file, file2request));
|
||||
|
||||
Thread.Sleep(500);
|
||||
}
|
||||
|
||||
if (response is null)
|
||||
@@ -157,14 +165,21 @@ namespace BeWoLauncher.Logic.Utils.Download
|
||||
throw new UpdateException($"file: {file2request.RelativePath} - response null");
|
||||
}
|
||||
|
||||
var download_path = DownloadFolder.Combine(file2request.RelativePath);
|
||||
if (response.Successful)
|
||||
{
|
||||
var download_path = DownloadFolder.Combine(file2request.RelativePath);
|
||||
|
||||
Path.GetDirectoryName(download_path).CreateFolder();
|
||||
download_path.SaveFile(response.FileData);
|
||||
Path.GetDirectoryName(download_path).CreateFolder();
|
||||
download_path.SaveFile(response.FileData);
|
||||
|
||||
var size = NonspecificTools.SizeSuffix((ulong)response.FileData.Length);
|
||||
var size = NonspecificTools.SizeSuffix((ulong)response.FileData.Length);
|
||||
|
||||
Feedback((int)LauncherProgress.DownloadUpdate, new DownloadProgressEventArgs(size, file2request));
|
||||
Feedback((int)LauncherProgress.DownloadUpdate, new DownloadProgressEventArgs(size, file2request));
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new HideClientUpdateException(response.Error);
|
||||
}
|
||||
}
|
||||
|
||||
DownloadFolder.Unlock(SkipLock);
|
||||
@@ -246,7 +261,11 @@ namespace BeWoLauncher.Logic.Utils.Download
|
||||
|
||||
private UpdateFileResponse AskForFile(UpdateFileRequest request)
|
||||
{
|
||||
return LauncherServiceFacade.DoDownloadBeWoServiceSyncWithException(x => x.GetUpdateFile(request));
|
||||
UpdateFileResponse response;
|
||||
|
||||
response = LauncherServiceFacade.DoDownloadBeWoServiceSyncWithException(x => x.GetUpdateFile(request));
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
private void GetUpdatePlanResponse()
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
@@ -10,6 +11,7 @@ namespace BeWoLauncher.Logic.Utils
|
||||
public static class LauncherAppdataConfig
|
||||
{
|
||||
private static string _Location;
|
||||
private static string _Folder;
|
||||
|
||||
public static string Location
|
||||
{
|
||||
@@ -17,6 +19,12 @@ namespace BeWoLauncher.Logic.Utils
|
||||
set { _Location = value; }
|
||||
}
|
||||
|
||||
public static string Folder
|
||||
{
|
||||
get => _Folder ?? (_Folder = Directory.GetParent(Location).FullName);
|
||||
set { _Folder = value; }
|
||||
}
|
||||
|
||||
|
||||
public static string GetPlanerLocation()
|
||||
{
|
||||
@@ -65,5 +73,12 @@ namespace BeWoLauncher.Logic.Utils
|
||||
return e.Filename;
|
||||
}
|
||||
}
|
||||
|
||||
public static void Reset()
|
||||
{
|
||||
SetFirstInstallationSuccess(false);
|
||||
SetInstallLocationSetSuccess(false);
|
||||
SetPlanerLocation(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ namespace BeWoLauncher.Logic.Utils
|
||||
}
|
||||
public static string GetLoggerPath()
|
||||
{
|
||||
return Path.Combine(new string[] { LauncherAppdataConfig.Location, "log", "update" });
|
||||
return Path.Combine(new string[] { LauncherAppdataConfig.Folder, "log", "update" });
|
||||
}
|
||||
public static string GetDownloadPath()
|
||||
{
|
||||
|
||||
@@ -63,7 +63,7 @@ namespace BeWoLauncher.Logic
|
||||
throw new NotImplementedException("ViewBuilder: Frame nicht implementiert");
|
||||
}
|
||||
|
||||
private UserControl getLoginView()
|
||||
private LoginView getLoginView()
|
||||
{
|
||||
var login = new LoginView();
|
||||
|
||||
@@ -113,7 +113,7 @@ namespace BeWoLauncher.Logic
|
||||
var uninstallFailed = new InfoFrame();
|
||||
|
||||
uninstallFailed.Title = "Deinstallation fehlgeschlagen!";
|
||||
uninstallFailed.Text = Error.ToString();
|
||||
uninstallFailed.Text = GetErrorString();
|
||||
|
||||
uninstallFailed.Button1Click += ViewBehavior.BackToLogin;
|
||||
|
||||
@@ -145,7 +145,7 @@ namespace BeWoLauncher.Logic
|
||||
var updateError = new InfoFrame();
|
||||
|
||||
updateError.Title = "Update fehlgeschlagen!";
|
||||
updateError.Text = Error.ToString();
|
||||
updateError.Text = GetErrorString();
|
||||
|
||||
updateError.Button1Click += ViewBehavior.BackToLogin;
|
||||
|
||||
@@ -177,7 +177,7 @@ namespace BeWoLauncher.Logic
|
||||
var installError = new InfoFrame();
|
||||
|
||||
installError.Title = "Installation fehlgeschlagen!";
|
||||
installError.Text = Error.ToString();
|
||||
installError.Text = GetErrorString();
|
||||
|
||||
installError.Button1Click += ViewBehavior.BackToLogin;
|
||||
|
||||
@@ -189,7 +189,7 @@ namespace BeWoLauncher.Logic
|
||||
var genError = new InfoFrame();
|
||||
|
||||
genError.Title = "Loader fehlgeschlagen!";
|
||||
genError.Text = ErrorString ?? Error.ToString();
|
||||
genError.Text = GetErrorString();
|
||||
|
||||
genError.Button1Click += ViewBehavior.BackToLogin;
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Image Grid.Row="0" Grid.ColumnSpan="4" HorizontalAlignment="Left" VerticalAlignment="Top" Source="pack://application:,,,/View/Icons/bewoplaner_logo_big.png" Height="45" Margin="7,7,0,0"/>
|
||||
<Image Grid.Row="0" Grid.ColumnSpan="4" HorizontalAlignment="Left" VerticalAlignment="Top" Source="pack://application:,,,/View/Icons/bewoplaner_logo_small.png" Height="46" Margin="7,7,0,0"/>
|
||||
<Label VerticalAlignment="Top" HorizontalAlignment="Right" Content="Version x.x.x" Foreground="#FF818181" Margin="5,7,3,0" Grid.Row="0" Grid.ColumnSpan="4"
|
||||
Grid.Column="0" FontSize="10" x:Name="lblVersion" />
|
||||
<Button Grid.Row="7" Grid.Column="2" Visibility="Hidden">Debug</Button>
|
||||
@@ -44,10 +44,10 @@
|
||||
|
||||
</Grid>
|
||||
|
||||
<TextBlock x:Name="txtCopyright" Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="3" HorizontalAlignment="Left" VerticalAlignment="Bottom" FontSize="10" Margin="10,5,0,5" Text="Copyright 2017 | beyondSoft GmbH" Foreground="#FF818181"/>
|
||||
<TextBlock x:Name="txtCopyright" Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="3" HorizontalAlignment="Left" VerticalAlignment="Bottom" FontSize="10" Margin="10,5,0,3" Text="Copyright 2022 | ownSoft GmbH" Foreground="#FF818181"/>
|
||||
|
||||
<TextBlock Grid.Row="2" Grid.Column="3" HorizontalAlignment="Right" VerticalAlignment="Bottom" FontSize="10" Margin="0,5,12,5">
|
||||
<Hyperlink x:Name="hyperlink" TargetName="newWindow" Foreground="#FF818181" NavigateUri="http://www.beyondsoft.de" RequestNavigate="Hyperlink_OnRequestNavigate">www.beyondsoft.de</Hyperlink>
|
||||
<TextBlock Grid.Row="2" Grid.Column="3" HorizontalAlignment="Right" VerticalAlignment="Bottom" FontSize="10" Margin="0,5,12,3">
|
||||
<Hyperlink x:Name="hyperlink" TargetName="newWindow" Foreground="#FF818181" NavigateUri="https://www.ownsoft.de" RequestNavigate="Hyperlink_OnRequestNavigate">www.ownsoft.de</Hyperlink>
|
||||
</TextBlock>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace BeWoLauncher.View
|
||||
if (DateTime.Now > dt)
|
||||
dt = DateTime.Now;
|
||||
|
||||
txtCopyright.Text = String.Format("Copyright {0:yyyy} | beyondSoft GmbH", dt);
|
||||
txtCopyright.Text = String.Format("Copyright {0:yyyy} | ownSoft GmbH", dt);
|
||||
|
||||
lblVersion.Content = LauncherApp.Version;
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<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" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto">
|
||||
<TextBlock x:Name="txtField2">
|
||||
<TextBlock x:Name="txtField2" Margin="10">
|
||||
Hier könnte ihre Fehlermeldung stehen!
|
||||
</TextBlock>
|
||||
</ScrollViewer>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using BeWoLauncher.Logic.Controller;
|
||||
using BS.SharedLauncher.Enums;
|
||||
using BS.SharedLauncher.Exceptions;
|
||||
using BS.SharedLauncher.Update;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -23,9 +24,9 @@ namespace BeWoLauncher.View.Frames
|
||||
|
||||
private string[][] keywords = new string[][]
|
||||
{
|
||||
new string[]{"Installation", "Ungebrauchte Datei(en) gefunden." },
|
||||
new string[]{"Update", "Ungebrauchte Datei(en) gefunden."},
|
||||
new string[]{"Deinstallation", "Deinstallation startet..."},
|
||||
new string[]{"Installation", "Ungebrauchte Datei(en) gefunden.", "Ungebrauchte Datei(en) entfernt!" },
|
||||
new string[]{"Update", "Ungebrauchte Datei(en) gefunden.", "Ungebrauchte Datei(en) entfernt!"},
|
||||
new string[]{"Deinstallation", "Deinstallation startet...", "Deinstallation erfolgreich!"},
|
||||
};
|
||||
private int keyword_mode;
|
||||
|
||||
@@ -106,7 +107,14 @@ namespace BeWoLauncher.View.Frames
|
||||
{
|
||||
if (e.Error != null)
|
||||
{
|
||||
ViewController.Error = e.Error;
|
||||
if(e.Error is HideClientUpdateException)
|
||||
{
|
||||
ViewController.ErrorString = e.Error.Message;
|
||||
}
|
||||
else
|
||||
{
|
||||
ViewController.Error = e.Error;
|
||||
}
|
||||
|
||||
Exception.Invoke(this, new EventArgs());
|
||||
}
|
||||
@@ -141,11 +149,17 @@ namespace BeWoLauncher.View.Frames
|
||||
case LauncherProgress.DownloadUpdate:
|
||||
var args = obj as DownloadProgressEventArgs;
|
||||
Message = "Download wird ausgeführt...";
|
||||
SubMessage = $"{args.File.RelativePath} ({args.Size})\n wurde heruntergeladen...";
|
||||
SubMessage = $"{args.File.RelativePath} ({args.Size}) wurde heruntergeladen...";
|
||||
Bar1MakeStep();
|
||||
Bar2MakeStep();
|
||||
break;
|
||||
|
||||
case LauncherProgress.DownloadRetry:
|
||||
var args7 = obj as DownloadRetryEventArgs;
|
||||
Message = "Download wird wiederholt...";
|
||||
SubMessage = $"{args7.File.RelativePath} wird erneut heruntergeladen... (Versuch: {args7.Try_Num}/{args7.Max_Tries})";
|
||||
break;
|
||||
|
||||
case LauncherProgress.DownloadFinish:
|
||||
Message = "Download abgeschlossen!";
|
||||
SubMessage = "";
|
||||
@@ -190,13 +204,13 @@ namespace BeWoLauncher.View.Frames
|
||||
break;
|
||||
|
||||
case LauncherProgress.DeleteFinished:
|
||||
Message = "Säuberung abgeschlossen!";
|
||||
Message = getKeyword(2);
|
||||
SubMessage = "";
|
||||
Bar1Hide();
|
||||
break;
|
||||
|
||||
case LauncherProgress.CleanupStart:
|
||||
Message = "Räume hier noch eben auf...";
|
||||
Message = "Räume Ordner auf...";
|
||||
SubMessage = "";
|
||||
Bar1Show();
|
||||
Bar1Deactivate();
|
||||
@@ -206,7 +220,7 @@ namespace BeWoLauncher.View.Frames
|
||||
break;
|
||||
|
||||
case LauncherProgress.CleanupFinished:
|
||||
Message = "Blitze blank...";
|
||||
Message = "Ordner aufgeräumt!";
|
||||
SubMessage = "";
|
||||
break;
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
<TranslateTransform X="0" Y="0" />
|
||||
</TransformGroup>
|
||||
</Grid.RenderTransform>
|
||||
<Border CornerRadius="7,7,7,7" BorderThickness="2,2,2,2" Padding="5,5,5,5" BorderBrush="#FF606060" Background="{DynamicResource LoginBackgroundColor}" KeyDown="UIElement_OnKeyDown">
|
||||
<Border CornerRadius="7,7,7,7" BorderThickness="2,2,2,2" Padding="5" BorderBrush="#FF606060" Background="{DynamicResource LoginBackgroundColor}" KeyDown="UIElement_OnKeyDown">
|
||||
<Grid Opacity="1">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="100" />
|
||||
@@ -40,7 +40,7 @@
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Image Grid.Row="0" Grid.ColumnSpan="4" HorizontalAlignment="Left" VerticalAlignment="Top" Source="pack://application:,,,/View/Icons/bewoplaner_logo_small.png" Height="44" Margin="7,7,0,0"/>
|
||||
<Image Grid.Row="0" Grid.ColumnSpan="4" HorizontalAlignment="Left" VerticalAlignment="Top" Source="pack://application:,,,/View/Icons/bewoplaner_logo_small.png" Height="46" Margin="7,7,0,0"/>
|
||||
<Label VerticalAlignment="Top" HorizontalAlignment="Right" Content="Version x.x.x" Foreground="#FF818181" Margin="5,7,3,0" Grid.Row="0" Grid.ColumnSpan="4"
|
||||
Grid.Column="0" FontSize="10" x:Name="lblVersion" />
|
||||
<StackPanel Grid.Column="1" Grid.Row="0" Grid.ColumnSpan="2" Margin="0,80,0,0">
|
||||
@@ -173,9 +173,9 @@
|
||||
</Hyperlink>
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
<TextBlock x:Name="txtCopyright" Grid.Row="9" Grid.Column="0" Grid.ColumnSpan="3" HorizontalAlignment="Left" VerticalAlignment="Bottom" FontSize="10" Margin="10,5,0,5" Text="Copyright 2022 | ownSoft GmbH" Foreground="#FF818181"/>
|
||||
<TextBlock x:Name="txtCopyright" Grid.Row="9" Grid.Column="0" Grid.ColumnSpan="3" HorizontalAlignment="Left" VerticalAlignment="Bottom" FontSize="10" Margin="10,0,12,3" Text="Copyright 2022 | ownSoft GmbH" Foreground="#FF818181"/>
|
||||
|
||||
<TextBlock Grid.Row="9" Grid.Column="3" HorizontalAlignment="Right" VerticalAlignment="Bottom" FontSize="10" Margin="0,5,12,5">
|
||||
<TextBlock Grid.Row="9" Grid.Column="3" HorizontalAlignment="Right" VerticalAlignment="Bottom" FontSize="10" Margin="0,5,12,3">
|
||||
<Hyperlink x:Name="hyperlink" TargetName="newWindow" Foreground="#FF818181" NavigateUri="https://www.ownsoft.de" RequestNavigate="Hyperlink_OnRequestNavigate">www.ownsoft.de</Hyperlink>
|
||||
</TextBlock>
|
||||
</Grid>
|
||||
|
||||
@@ -23,6 +23,8 @@ namespace BeWo.Service.ServiceImplementations
|
||||
[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall, ConcurrencyMode = ConcurrencyMode.Single)]
|
||||
public class DownloadBeWoServiceImp : IDownloadBeWoService
|
||||
{
|
||||
private const int FILE_REQUEST_COUNT = 5;
|
||||
|
||||
public string Tenant => MultitenancyOperationContextExt.Current.Tenant;
|
||||
|
||||
public UpdatePlanResponse GetUpdatePlan(UpdatePlanRequest request)
|
||||
@@ -33,6 +35,8 @@ namespace BeWo.Service.ServiceImplementations
|
||||
|
||||
var response = new UpdatePlanResponse(false);
|
||||
|
||||
response.TriesPerFile = FILE_REQUEST_COUNT;
|
||||
|
||||
try
|
||||
{
|
||||
GenericTextLogger.Post("Validiere Plan Request.");
|
||||
@@ -43,6 +47,9 @@ namespace BeWo.Service.ServiceImplementations
|
||||
|
||||
UpdatePlanResponseBuilder.BuildResponse(request, Tenant, response);
|
||||
|
||||
if(response.HasToDo)
|
||||
UpdateServerSessionManager.CreateSession(response, Tenant);
|
||||
|
||||
response.Successful = true;
|
||||
response.Error = null;
|
||||
|
||||
@@ -99,6 +106,8 @@ namespace BeWo.Service.ServiceImplementations
|
||||
|
||||
GenericTextLogger.Post("Baue Antwort.");
|
||||
|
||||
UpdateServerSessionManager.LoadAbsolutePath(request);
|
||||
|
||||
UpdateFileResponseBuilder.BuildResponse(request, Tenant, response);
|
||||
|
||||
response.Successful = true;
|
||||
@@ -132,6 +141,8 @@ namespace BeWo.Service.ServiceImplementations
|
||||
|
||||
if(response.Error is object)
|
||||
{
|
||||
UpdateServerSessionManager.CloseSession(request.SessionId);
|
||||
|
||||
Thread.Sleep(3000);
|
||||
}
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace BeWo.Service.ServiceImplementations
|
||||
{ BS.Shared.UserValidationResult.UnkownError, BS.SharedLauncher.Enums.UserValidationResult.UnknownError},
|
||||
{ BS.Shared.UserValidationResult.UserValid, BS.SharedLauncher.Enums.UserValidationResult.UserValid},
|
||||
{ BS.Shared.UserValidationResult.UserValidTwoFactorAuthenticationNeeded, BS.SharedLauncher.Enums.UserValidationResult.UnknownError},
|
||||
{ BS.Shared.UserValidationResult.EmployeeDeleted, BS.SharedLauncher.Enums.UserValidationResult.EmployeeDeleted},
|
||||
{ BS.Shared.UserValidationResult.BeWoPasswordNotAllowed, BS.SharedLauncher.Enums.UserValidationResult.EmployeeDeleted},
|
||||
};
|
||||
|
||||
public PasswordValidationResult CheckPassword(long userOid, string pOldPassword, string pNewPassword)
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace BeWo.Service.ServiceUtils.Update
|
||||
{
|
||||
try
|
||||
{
|
||||
return Document.SelectSingleNode($"/config/versions/tenant[@id='{Tenant}']/version").InnerXml;
|
||||
return Document.SelectSingleNode($"/config/versions/tenant[@id='{Tenant}']/version")?.InnerXml;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace BeWo.Service.ServiceUtils.Update
|
||||
_Response.CurrentPackage = new UpdatePlanDC
|
||||
{
|
||||
DefaultVersion = default_version,
|
||||
TenantVersion = tenant_version
|
||||
TenantVersion = tenant_version,
|
||||
};
|
||||
|
||||
// Lädt komplettes Paket ohne Hash
|
||||
|
||||
@@ -100,7 +100,7 @@ namespace BeWo.Service.ServiceUtils.Update
|
||||
|
||||
private static bool TryValidateFileRequestProperties(UpdateFileRequest request)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(request.UpdateSessionId))
|
||||
if (string.IsNullOrWhiteSpace(request.SessionId))
|
||||
return false;
|
||||
|
||||
if (string.IsNullOrWhiteSpace(request.Version))
|
||||
@@ -152,10 +152,10 @@ namespace BeWo.Service.ServiceUtils.Update
|
||||
}
|
||||
private static string TryValidateSession(UpdateFileRequest request, string tenant)
|
||||
{
|
||||
var session = UpdateServerSessionManager.CurrentSession(request.UpdateSessionId);
|
||||
var session = UpdateServerSessionManager.CurrentSession(request.SessionId);
|
||||
|
||||
if (session is null)
|
||||
return $"Session \"{request.UpdateSessionId}\" nicht verfügbar";
|
||||
return $"Session \"{request.SessionId}\" nicht verfügbar";
|
||||
|
||||
if (session.Tenant != tenant)
|
||||
return $"Tenant konnte nicht bestätigt werden. {session.Tenant} != {tenant}";
|
||||
@@ -165,7 +165,7 @@ namespace BeWo.Service.ServiceUtils.Update
|
||||
return $"Angefragte Datei nicht verfügbar. Anfrage an \"{request.UpdateFile.RelativePath}\"";
|
||||
|
||||
if (session.IsTimeouted)
|
||||
return $"Session \"{request.UpdateSessionId}\" nicht mehr verfügbar - Timeout";
|
||||
return $"Session \"{request.SessionId}\" nicht mehr verfügbar - Timeout";
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace BeWo.Service.ServiceUtils.Update
|
||||
}
|
||||
}
|
||||
|
||||
public static string GenerateUniqueSessionId()
|
||||
private static string GenerateUniqueSessionId()
|
||||
{
|
||||
var session_id = Guid.NewGuid().ToString();
|
||||
|
||||
@@ -69,7 +69,7 @@ namespace BeWo.Service.ServiceUtils.Update
|
||||
|
||||
_UpdateServerSessions.Add(session_id, session);
|
||||
|
||||
res.Session_Id = session_id;
|
||||
res.SessionId = session_id;
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -122,7 +122,7 @@ namespace BeWo.Service.ServiceUtils.Update
|
||||
|
||||
var file_id = request.UpdateFile.RelativePath;
|
||||
|
||||
var session_id = request.UpdateSessionId;
|
||||
var session_id = request.SessionId;
|
||||
var session = _UpdateServerSessions[session_id];
|
||||
var limiter = session.FileLimiterDict[file_id];
|
||||
|
||||
|
||||
@@ -18,17 +18,22 @@ namespace BS.SharedLauncher.DataContract
|
||||
|
||||
}
|
||||
|
||||
public UpdateFileRequest(string version, string session_id) : base()
|
||||
public UpdateFileRequest(string version, string session_id) : this()
|
||||
{
|
||||
Version = version;
|
||||
UpdateSessionId = session_id;
|
||||
SessionId = session_id;
|
||||
}
|
||||
|
||||
public UpdateFileRequest(UpdatePlanResponse response) : this(response.CurrentPackage.Version, response.SessionId)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
[DataMember]
|
||||
public string Version { get; set; }
|
||||
|
||||
[DataMember]
|
||||
public string UpdateSessionId { get; set; }
|
||||
public string SessionId { get; set; }
|
||||
|
||||
[DataMember]
|
||||
public UpdateFileDC UpdateFile { get; set; }
|
||||
|
||||
@@ -22,6 +22,9 @@ namespace BS.SharedLauncher.DataContract
|
||||
|
||||
}
|
||||
|
||||
[DataMember]
|
||||
public bool RetryIfFailed { get; set; }
|
||||
|
||||
[DataMember]
|
||||
public byte[] FileData { get; set; }
|
||||
}
|
||||
|
||||
@@ -22,11 +22,14 @@ namespace BS.SharedLauncher.DataContract
|
||||
}
|
||||
|
||||
[DataMember]
|
||||
public string Session_Id { get; set; }
|
||||
public string SessionId { get; set; }
|
||||
|
||||
[DataMember]
|
||||
public UpdatePlanDC CurrentPackage { get; set; }
|
||||
|
||||
[DataMember]
|
||||
public int TriesPerFile { get; set; }
|
||||
|
||||
[DataMember]
|
||||
public bool HasToDo { get; set; }
|
||||
|
||||
|
||||
@@ -46,6 +46,7 @@ namespace BS.SharedLauncher.Enums
|
||||
ProgressStart = 0,
|
||||
DownloadStart = 1,
|
||||
DownloadUpdate = 2,
|
||||
DownloadRetry = 21,
|
||||
DownloadFinish = 3,
|
||||
ApplyStart = 4,
|
||||
ApplyUpdate = 5,
|
||||
|
||||
@@ -82,6 +82,7 @@
|
||||
<Compile Include="Update\DownloadProgressEventArgs.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="StringCompressor.cs" />
|
||||
<Compile Include="Update\DownloadRetryEventArgs.cs" />
|
||||
<Compile Include="Utils\NonspecificTools.cs" />
|
||||
<Compile Include="Utils\PathUtils.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
29
SharedLauncher/Update/DownloadRetryEventArgs.cs
Normal file
29
SharedLauncher/Update/DownloadRetryEventArgs.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using BS.SharedLauncher.DataContract;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BS.SharedLauncher.Update
|
||||
{
|
||||
public class DownloadRetryEventArgs : EventArgs
|
||||
{
|
||||
public int Try_Num { get; set; }
|
||||
public int Max_Tries { get; set; }
|
||||
|
||||
public UpdateFileDC File { get; set; }
|
||||
|
||||
public DownloadRetryEventArgs()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public DownloadRetryEventArgs(int try_num, int max_tries, UpdateFileDC file) : this()
|
||||
{
|
||||
Try_Num = try_num;
|
||||
Max_Tries = max_tries;
|
||||
File = file;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user