2022-12-28 16:36:59 +01:00
|
|
|
|
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;
|
|
|
|
|
|
|
2024-05-24 14:41:46 +02:00
|
|
|
|
public static void BuildResponse(UpdateFileRequest request, string tenant, UpdateFileResponse response)
|
2022-12-28 16:36:59 +01:00
|
|
|
|
{
|
2024-05-24 14:41:46 +02:00
|
|
|
|
_Response = response;
|
2022-12-28 16:36:59 +01:00
|
|
|
|
_Tenant = tenant;
|
|
|
|
|
|
_Request = request;
|
|
|
|
|
|
_Version = request.Version;
|
|
|
|
|
|
|
|
|
|
|
|
calculate();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
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:
|
2024-05-21 10:28:08 +02:00
|
|
|
|
return ServerFilePaths.GetSpecialTenantFolderPath(_Tenant);
|
2022-12-28 16:36:59 +01:00
|
|
|
|
|
|
|
|
|
|
case BS.SharedLauncher.Enums.UpdateFileSource.OverrideUser:
|
|
|
|
|
|
break;
|
|
|
|
|
|
default:
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// User bekommt eigene Daten Feature
|
|
|
|
|
|
throw new NotImplementedException("#479839129");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|