1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-10-30 23:42:33 +01:00
Sonarr/NzbDrone/Config.cs

46 lines
1.2 KiB
C#
Raw Normal View History

2010-10-15 09:10:44 +02:00
using System;
using System.Configuration;
using System.IO;
using System.Reflection;
using NLog;
using NLog.Config;
namespace NzbDrone
{
2011-04-10 04:44:01 +02:00
internal class Config
2010-10-15 09:10:44 +02:00
{
private static string _projectRoot = string.Empty;
2011-04-10 04:44:01 +02:00
2010-10-15 09:10:44 +02:00
internal static string ProjectRoot
{
get
{
if (string.IsNullOrEmpty(_projectRoot))
{
var appDir = new FileInfo(Assembly.GetExecutingAssembly().Location).Directory;
while (appDir.GetDirectories("iisexpress").Length == 0)
{
if (appDir.Parent == null) throw new ApplicationException("Can't fine IISExpress folder.");
appDir = appDir.Parent;
}
_projectRoot = appDir.FullName;
}
return _projectRoot;
}
}
internal static int Port
{
get { return Convert.ToInt32(ConfigurationManager.AppSettings.Get("port")); }
}
2011-04-10 04:44:01 +02:00
internal static void ConfigureNlog()
{
LogManager.Configuration = new XmlLoggingConfiguration(
Path.Combine(ProjectRoot, "NZBDrone.Web\\log.config"), false);
}
2010-10-15 09:10:44 +02:00
}
2011-04-10 04:44:01 +02:00
}