using System; using System.Collections.Generic; using System.Configuration; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; namespace BeWo.Service.ServiceUtils.Paths { public static class ServerFilePaths { // UpdateFiles // L files // L versions // L 1.0.0.0 // L _default // L exampleData#2 // L tenant#1 // L exampleData#3 // L 1.0.0.1 // L _default // L exampleData#4 // L tenant#1 // L exampleData#5 // L special_tenant_files // L tenant#1 // L exampleData#1 // L log // L config // L update_plan.config private static string _RootPath; public static string RootPath => _RootPath ?? (_RootPath = ConfigurationManager.AppSettings.Get("RootPath")); private static string _ConfigPath; public static string ConfigPath => _ConfigPath ?? (_ConfigPath = Path.Combine(RootPath, "config")); private static string _UpdateConfigPath; public static string UpdateConfigPath => _UpdateConfigPath ?? (_UpdateConfigPath = Path.Combine(ConfigPath, "update_plan.config")); private static string _LogPath; public static string LogPath => _LogPath ?? (_LogPath = Path.Combine(RootPath, "log")); private static string _FilesPath; public static string FilesPath => _FilesPath ?? (_FilesPath = Path.Combine(RootPath, "files")); private static string _SpecialTenantFilesPath; public static string SpecialTenantFilesPath => _SpecialTenantFilesPath ?? (_SpecialTenantFilesPath = Path.Combine(FilesPath, "special_tenant_files")); private static string _VersionsFilePath; public static string VersionsFilePath => _VersionsFilePath ?? (_VersionsFilePath = Path.Combine(FilesPath, "versions")); static ServerFilePaths() { } private static string GetVersionFolderPath(string version) => Path.Combine(VersionsFilePath, version); public static string GetSpecialTenantFolderPath(string tenant) => Path.Combine(SpecialTenantFilesPath, tenant); public static string GetVersionTenantFolderPath(string version, string tenant) => Path.Combine(GetVersionFolderPath(version), tenant); public static string GetVersionDefaultFolderPath(string version) => GetVersionTenantFolderPath(version, "default"); public static string GetLogFolderPath(string tenant) => Path.Combine(LogPath, tenant); } }