fixed some settings value convert issues. would cause crash on clean installs.

This commit is contained in:
unknown 2011-05-16 00:32:01 -07:00
parent 9caacc4809
commit 8c372e938c
5 changed files with 41 additions and 36 deletions

View File

@ -21,11 +21,11 @@ namespace NzbDrone.Core.Test
{
//Setup
string sabHost = "192.168.5.55";
string sabPort = "2222";
int sabPort = 2222;
string apikey = "5c770e3197e4fe763423ee7c392c25d1";
string username = "admin";
string password = "pass";
string priority = "Normal";
var priority = SabnzbdPriorityType.Normal;
string category = "tv";
@ -67,11 +67,11 @@ namespace NzbDrone.Core.Test
{
//Setup
string sabHost = "192.168.5.55";
string sabPort = "2222";
int sabPort = 2222;
string apikey = "5c770e3197e4fe763423ee7c392c25d1";
string username = "admin";
string password = "pass";
string priority = "Normal";
var priority = SabnzbdPriorityType.Normal;
string category = "tv";
var mocker = new AutoMoqer();
@ -108,7 +108,7 @@ namespace NzbDrone.Core.Test
{
//Setup
string sabHost = "192.168.5.55";
string sabPort = "2222";
int sabPort = 2222;
string apikey = "5c770e3197e4fe763423ee7c392c25d1";
string username = "admin";
string password = "pass";
@ -143,7 +143,7 @@ namespace NzbDrone.Core.Test
{
//Setup
string sabHost = "192.168.5.55";
string sabPort = "2222";
int sabPort = 2222;
string apikey = "5c770e3197e4fe763423ee7c392c25d1";
string username = "admin";
string password = "pass";
@ -179,7 +179,7 @@ namespace NzbDrone.Core.Test
{
//Setup
string sabHost = "192.168.5.55";
string sabPort = "2222";
int sabPort = 2222;
string apikey = "5c770e3197e4fe763423ee7c392c25d1";
string username = "admin";
string password = "pass";

View File

@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using NLog;
using NzbDrone.Core.Model;
using NzbDrone.Core.Repository;
using SubSonic.Repository;
@ -103,23 +104,23 @@ namespace NzbDrone.Core.Providers.Core
set { SetValue("NewzbinPassword", value); }
}
public virtual String SyncFrequency
public virtual int SyncFrequency
{
get { return GetValue("SyncFrequency"); }
get { return GetValueInt("SyncFrequency"); }
set { SetValue("SyncFrequency", value); }
}
public virtual String DownloadPropers
public virtual Boolean DownloadPropers
{
get { return GetValue("DownloadPropers"); }
get { return GetValueBoolean("DownloadPropers"); }
set { SetValue("DownloadPropers", value); }
}
public virtual String Retention
public virtual Int32 Retention
{
get { return GetValue("Retention"); }
get { return GetValueInt("Retention"); }
set { SetValue("Retention", value); }
}
@ -131,9 +132,9 @@ namespace NzbDrone.Core.Providers.Core
set { SetValue("SabHost", value); }
}
public virtual String SabPort
public virtual int SabPort
{
get { return GetValue("SabPort"); }
get { return GetValueInt("SabPort"); }
set { SetValue("SabPort", value); }
}
@ -166,11 +167,11 @@ namespace NzbDrone.Core.Providers.Core
set { SetValue("SabTvCategory", value); }
}
public virtual String SabTvPriority
public virtual SabnzbdPriorityType SabTvPriority
{
get { return GetValue("SabTvPriority"); }
get { return (SabnzbdPriorityType)GetValueInt("SabTvPriority"); }
set { SetValue("SabTvPriority", value); }
set { SetValue("SabTvPriority", (int)value); }
}
public virtual Boolean UseBlackhole

View File

@ -29,7 +29,7 @@ namespace NzbDrone.Core.Providers
public virtual bool AddByUrl(string url, string title)
{
string cat = _configProvider.SabTvCategory;
int priority = (int)Enum.Parse(typeof(SabnzbdPriorityType), _configProvider.SabTvPriority);
int priority = (int)_configProvider.SabTvPriority;
string name = url.Replace("&", "%26");
string nzbName = HttpUtility.UrlEncode(title);

View File

@ -106,20 +106,17 @@ namespace NzbDrone.Web.Controllers
var model = new DownloadSettingsModel
{
SyncFrequency = Convert.ToInt32(_configProvider.SyncFrequency),
DownloadPropers = Convert.ToBoolean(_configProvider.DownloadPropers),
Retention = Convert.ToInt32(_configProvider.Retention),
SyncFrequency = _configProvider.SyncFrequency,
DownloadPropers = _configProvider.DownloadPropers,
Retention = _configProvider.Retention,
SabHost = _configProvider.SabHost,
SabPort = Convert.ToInt32(_configProvider.SabPort),
SabPort =_configProvider.SabPort,
SabApiKey = _configProvider.SabApiKey,
SabUsername = _configProvider.SabUsername,
SabPassword = _configProvider.SabPassword,
SabTvCategory = _configProvider.SabTvCategory,
SabTvPriority =
(SabnzbdPriorityType)
Enum.Parse(typeof(SabnzbdPriorityType),
_configProvider.SabTvPriority),
UseBlackHole = Convert.ToBoolean(_configProvider.UseBlackhole),
SabTvPriority = _configProvider.SabTvPriority,
UseBlackHole = _configProvider.UseBlackhole,
BlackholeDirectory = _configProvider.BlackholeDirectory
};
@ -374,7 +371,7 @@ namespace NzbDrone.Web.Controllers
return Content(SETTINGS_FAILED);
}
basicNotification.Title = SETTINGS_SAVED;
_notificationProvider.Register(basicNotification);
@ -437,16 +434,16 @@ namespace NzbDrone.Web.Controllers
if (ModelState.IsValid)
{
_configProvider.SyncFrequency = data.SyncFrequency.ToString();
_configProvider.DownloadPropers = data.DownloadPropers.ToString();
_configProvider.Retention = data.Retention.ToString();
_configProvider.SyncFrequency = data.SyncFrequency;
_configProvider.DownloadPropers = data.DownloadPropers;
_configProvider.Retention = data.Retention;
_configProvider.SabHost = data.SabHost;
_configProvider.SabPort = data.SabPort.ToString();
_configProvider.SabPort = data.SabPort;
_configProvider.SabApiKey = data.SabApiKey;
_configProvider.SabPassword = data.SabPassword;
_configProvider.SabTvCategory = data.SabTvCategory;
_configProvider.SabUsername = data.SabUsername;
_configProvider.SabTvPriority = data.SabTvPriority.ToString();
_configProvider.SabTvPriority = data.SabTvPriority;
_configProvider.UseBlackhole = data.UseBlackHole;
_configProvider.BlackholeDirectory = data.BlackholeDirectory;

View File

@ -37,8 +37,15 @@ namespace NzbDrone
Attach();
#endif
Process.Start(IISController.AppUrl);
try
{
Logger.Info("Starting default browser. {0}",IISController.AppUrl);
Process.Start(IISController.AppUrl);
}
catch(Exception e)
{
Logger.ErrorException("Failed to open URL in default browser.", e);
}
while (true)
{
Console.ReadLine();