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

View File

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

View File

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

View File

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

View File

@ -37,8 +37,15 @@ namespace NzbDrone
Attach(); Attach();
#endif #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) while (true)
{ {
Console.ReadLine(); Console.ReadLine();