2010-10-15 10:10:44 +03:00
|
|
|
using System;
|
|
|
|
using System.Configuration;
|
|
|
|
using System.IO;
|
|
|
|
using System.Reflection;
|
|
|
|
using NLog;
|
|
|
|
using NLog.Config;
|
|
|
|
|
|
|
|
namespace NzbDrone
|
|
|
|
{
|
|
|
|
class Config
|
|
|
|
{
|
|
|
|
private static string _projectRoot = string.Empty;
|
|
|
|
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 void ConfigureNlog()
|
|
|
|
{
|
2010-10-17 20:22:48 +03:00
|
|
|
LogManager.Configuration = new XmlLoggingConfiguration(Path.Combine(ProjectRoot, "NZBDrone.Web\\log.config"), false);
|
2010-10-15 10:10:44 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
internal static int Port
|
|
|
|
{
|
|
|
|
get { return Convert.ToInt32(ConfigurationManager.AppSettings.Get("port")); }
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|