private void ExecuteDevModel(ExtendedRegistry res, DevSettings dv) { if (!string.IsNullOrEmpty(dv.DeveloperConfig.NLogConfigFile)) { var pathToNLog = Path.Combine(res.ConfigDir, dv.DeveloperConfig.NLogConfigFile); LogManager.Configuration = new XmlLoggingConfiguration(pathToNLog, true); LogManager.Configuration.Variables["logDirectory"] = res.LogDir; LogManager.Configuration.Variables["appName"] = res.AssemblyName.Replace('.', '-').GenerateSlug(); // LogManager.Configuration.Reload(); } }
public ExtendedRegistry GetExtendedRegistry(Assembly asm) { if (_extendedRegistryValue == null) { lock (_padlock) { if (_extendedRegistryValue != null) { return(_extendedRegistryValue); } _extendedRegistryValue = GetTemporaryRegistryImpl(asm); } } return(_extendedRegistryValue); }
private ExtendedRegistry GetTemporaryRegistryImpl(Assembly asm) { var res = new ExtendedRegistry(); res.AssemblyName = asm.GetName().Name; res.AppVersion = VersionGenerator.Init(asm); res.MachineName = Environment.MachineName; res.AssemblyFilePath = new Uri(asm.CodeBase).LocalPath; res.Is64BitProcess = Environment.Is64BitProcess; res.ExeFileDir = Path.GetDirectoryName(res.AssemblyFilePath); res.SyrupDir = FindDir(res.ExeFileDir, _SYRUP_DIR); res.IsSyrup = !string.IsNullOrEmpty(res.SyrupDir); res.GitDir = FindDir(res.ExeFileDir, _GIT_DIR); res.DevDir = FindDevDir(res.ExeFileDir, _DEV_DIR, res.SyrupDir); res.RootDir = GetRoot(res.ExeFileDir, res.SyrupDir, res.DevDir); res.RepositoryRootDir = GetRepositoryRoot(res.GitDir); res.IsDeveloperMode = IsDeveloperMode(res.DevDir); var dv = GetDevSettings(res.DevDir); res.WorkDir = GetWorkDir(res.RootDir); res.LogDir = GetSimpleDir(res.RootDir, _LOG_DIR, res.IsDeveloperMode); res.ConfigDir = GetSimpleDir(res.RootDir, _CONFIG_DIR, res.IsDeveloperMode); res.GlobalDir = Path.Combine(res.RootDir, _GLOBAL_DIR); res.IsDeveloperMode = dv.IsDeveloperMode && !dv.DeveloperConfig.IgnoreMe; if (res.IsDeveloperMode) { ExecuteDevModel(res, dv); } #if DEBUG res.IsDebug = true; #else res.IsDebug = false; #endif Misc.CreateDirIfNotExist(res.ConfigDir); Misc.CreateDirIfNotExist(res.LogDir); return(res); }