# Conflicts: # BeWo/BeWo.csproj # BeWo/BeWoApp.xaml.cs # BeWo/ServiceProxy/GeneratedAiEnhancedService.cs # BeWo/Services/BeWoControlFactory.cs # BeWo/Services/BeWoWindowFactory.cs # BeWo/Services/BeWoWindowService.cs # BeWo/Services/IControlFactory.cs # BeWo/Services/IWindowFactory.cs # BeWo/Services/IWindowService.cs # BeWo/View/BeWoFileView.xaml # BeWo/View/Detail/Report/AbwesenheitsView.xaml # BeWo/View/Windows/AnimatedBeWoWindow.xaml.cs # BeWo/app.config # BeWoAllReports.sln # BeWoPlanerMobil.sln # BeWoPlanerMobil/.vs/BeWoPlanerMobil.csproj.dtbcache.json # BeWoTests.sln # Dakota/DakotaUtils.cs # Dakota/Logic/DakotaInfoCreator.cs # Dakota/Models/DakotaFile.cs # Data/Access/GenericDAO.cs # Data/Access/SearchDAO.cs # Data/Data.csproj # Host/Web.config # Server/Components/ServerUtils/ApiFacade/WebClientFacade.cs # Service/BeWoServiceEnums.cs # Service/Core/ServiceHelper.cs # Service/Core/ServiceValidator.cs # Service/Extensions/ServiceEnumExtension.cs # Service/Service.csproj # Service/ServiceContracts/Enhanced/IAiEnhancedService.cs # Service/ServiceContracts/Enhanced/IOperationsEnhancedService.cs # Service/ServiceImplementations/EmployeeServiceImp.cs # Service/ServiceImplementations/Enhanced/AiEnhancedServiceImp.cs # Service/ServiceImplementations/Enhanced/OperationsEnhancedServiceImp.cs # Service/ServiceProxy/OpenWebUIFacade.cs # Service/ServiceProxy/ServiceFacade.cs # Service/ServiceUtils/DistanceCalculator/GoogleDistanceMatrixAPI.cs # Shared/BeWoEntityEnums.cs # Shared/Core/AppError.cs # Shared/Core/Facade/WebClientFacade.cs # Shared/Core/WebClientFacade.cs # Shared/Shared.csproj
77 lines
1.6 KiB
C#
77 lines
1.6 KiB
C#
using BS.Shared.Exceptions;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace BeWo.Service.Core
|
|
{
|
|
public static class ConfigReader
|
|
{
|
|
public static List<string> GetIPAddressList(IPAddressList iPAddressList)
|
|
{
|
|
if(iPAddressList == IPAddressList.None)
|
|
throw new ArgumentException(nameof(iPAddressList));
|
|
|
|
var lSubPath = getIPAddressListName(iPAddressList);
|
|
|
|
var lConfigPath = getConfigPath(lSubPath);
|
|
|
|
var lines = File.ReadAllLines(lConfigPath);
|
|
|
|
return lines.ToList();
|
|
}
|
|
|
|
public static string GetConfigPath(SpecialConfig specialConfig)
|
|
{
|
|
if (specialConfig == SpecialConfig.None)
|
|
throw new ArgumentException(nameof(specialConfig));
|
|
|
|
var lSubPath = getSpecialConfigName(specialConfig);
|
|
|
|
var lConfigPath = getConfigPath(lSubPath);
|
|
|
|
return lConfigPath;
|
|
}
|
|
|
|
private static string getConfigPath(string subpath)
|
|
{
|
|
var root = AppDomain.CurrentDomain.BaseDirectory;
|
|
|
|
var path = Path.Combine(root, "Config", subpath);
|
|
|
|
return path;
|
|
}
|
|
|
|
private static string getSpecialConfigName(SpecialConfig config)
|
|
{
|
|
switch (config)
|
|
{
|
|
case SpecialConfig.None:
|
|
break;
|
|
case SpecialConfig.AiConfig:
|
|
return "ai.config.json";
|
|
default:
|
|
break;
|
|
}
|
|
|
|
throw BeWoNotImplementedException.CreateFromEnum(config);
|
|
}
|
|
|
|
private static string getIPAddressListName(IPAddressList list)
|
|
{
|
|
switch (list)
|
|
{
|
|
case IPAddressList.None:
|
|
break;
|
|
case IPAddressList.AdminApi:
|
|
return "allowed_ips_admin_api.txt";
|
|
}
|
|
|
|
throw BeWoNotImplementedException.CreateFromEnum(list);
|
|
}
|
|
}
|
|
}
|