- more logs - download controller + manager überarbeitet - Retry wird besser angezeigt - Formatierungen
67 lines
1.9 KiB
C#
67 lines
1.9 KiB
C#
using BeWo.Service.ServiceUtils.Paths;
|
|
using BS.SharedLauncher.Enums;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Xml;
|
|
|
|
namespace BeWo.Service.ServiceUtils.Update
|
|
{
|
|
public static class UpdateConfigReader
|
|
{
|
|
public static Tuple<string, string> GetDefaultTenantVersion(string tenant)
|
|
{
|
|
var reader = new UpdateConfigReaderClient(ServerFilePaths.UpdateConfigPath, tenant);
|
|
|
|
return new Tuple<string, string>(reader.GetDefaultVersion(), reader.GetSpecificVersion());
|
|
}
|
|
|
|
public static string GetValidVersion(string tenant)
|
|
{
|
|
var tuple = GetDefaultTenantVersion(tenant);
|
|
|
|
return GetValidVersion(tuple.Item1, tuple.Item2);
|
|
}
|
|
|
|
public static string GetValidVersion(string default_version, string tenant_version)
|
|
{
|
|
return tenant_version ?? default_version;
|
|
}
|
|
}
|
|
|
|
internal class UpdateConfigReaderClient
|
|
{
|
|
private XmlDocument Document { get; set; }
|
|
private string Tenant { get; set; }
|
|
|
|
internal UpdateConfigReaderClient(string configFilePath, string tenant)
|
|
{
|
|
Document = new XmlDocument();
|
|
Document.Load(configFilePath);
|
|
|
|
Tenant = tenant;
|
|
}
|
|
|
|
//public PlanerUpdateSource Source => GotSpecialVersion ? PlanerUpdateSource.SpecialVersion : PlanerUpdateSource.NewestVersion;
|
|
|
|
public string GetSpecificVersion()
|
|
{
|
|
try
|
|
{
|
|
return Document.SelectSingleNode($"/config/versions/tenant[@id='{Tenant}']/version")?.InnerXml;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
return null;
|
|
}
|
|
}
|
|
|
|
public string GetDefaultVersion()
|
|
{
|
|
return Document.SelectSingleNode("/config/default/version").InnerXml;
|
|
}
|
|
}
|
|
}
|