/// <summary> /// Gets the configuration full path. /// </summary> /// <returns>System.String.</returns> internal string GetConfigurationFullPath() { try { if (!string.IsNullOrWhiteSpace(ConfigurationName)) { var isWildcard = ConfigurationName.Contains(StringConstants.AsteriskChar); var directory = EnvironmentCore.GetDirectory(ConfigurationDirectory, "Configurations"); if (directory.Exists && isWildcard) { return(directory.GetFiles(ConfigurationName).FirstOrDefault()?.FullName); } else { return(Path.Combine(directory.FullName.TrimEnd(StringConstants.BackSlash), ConfigurationName)); } } return(string.Empty); } catch (Exception ex) { throw ex.Handle(); } }
/// <summary> /// Fills the resources. /// </summary> /// <param name="container">The container.</param> internal void FillResources(Dictionary <CultureInfo, GlobalCultureResourceCollection> container) { if (container == null) { return; } try { DirectoryInfo directory = EnvironmentCore.GetDirectory(Directory); if (directory.Exists) { foreach (var file in directory.GetFiles("*" + FileExtension)) { string cultureCode = null; if (string.IsNullOrWhiteSpace(ResourceBaseName)) { cultureCode = file.Name.Substring(0, file.Name.Length - FileExtension.Length); } else if (file.Name.StartsWith(ResourceBaseName, StringComparison.OrdinalIgnoreCase)) { cultureCode = file.Name.Substring(ResourceBaseName.Length, file.Name.Length - ResourceBaseName.Length - FileExtension.Length); } var cultureInfo = (cultureCode?.Trim('.')).AsCultureInfo(); if (cultureInfo != null) { var resources = TryReadResourceFile(file.FullName); if (resources != null) { foreach (var item in resources) { var destinationContainer = container.GetOrCreate(cultureInfo, new GlobalCultureResourceCollection(file.Name)); foreach (var one in item.Value) { one.Value.Category = item.Key; destinationContainer._resources.Merge(one.Key, one.Value, true); } } } } } } } catch (Exception ex) { throw ex.Handle(new { ResourceBaseName, DefaultCultureCode, TryLanguageCompatibility, Directory }); } }
/// <summary> /// Abouts the service. /// </summary> /// <returns>ServiceVersion.</returns> public static EnvironmentInfo AboutService() { try { var result = new EnvironmentInfo { AssemblyVersion = _assemblyVersion }; result.GCMemory = SystemManagementExtension.GetGCMemory(); result.MachineName = EnvironmentCore.MachineName; result.IpAddress = EnvironmentCore.LocalMachineIpAddress; result.HostName = EnvironmentCore.LocalMachineHostName; result.AssemblyHash = EnvironmentCore.GetAssemblyHash(); return(result); } catch (Exception ex) { throw ex.Handle(); } }