1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-10-30 15:32:31 +01:00

Replaced built-in valuetypes with language keywords.

This commit is contained in:
Taloth Saldono 2015-10-03 19:45:26 +02:00
parent d6a135857d
commit ccfa13e383
454 changed files with 2042 additions and 2042 deletions

View File

@ -22,7 +22,7 @@ namespace NzbDrone.Api.Authentication
private readonly IUserService _userService;
private static readonly NzbDroneUser AnonymousUser = new NzbDroneUser { UserName = "Anonymous" };
private static String API_KEY;
private static string API_KEY;
private static AuthenticationType AUTH_METHOD;
public AuthenticationService(IConfigFileProvider configFileProvider, IUserService userService)

View File

@ -5,14 +5,14 @@ namespace NzbDrone.Api.ClientSchema
{
public class Field
{
public Int32 Order { get; set; }
public String Name { get; set; }
public String Label { get; set; }
public String HelpText { get; set; }
public String HelpLink { get; set; }
public Object Value { get; set; }
public String Type { get; set; }
public Boolean Advanced { get; set; }
public int Order { get; set; }
public string Name { get; set; }
public string Label { get; set; }
public string HelpText { get; set; }
public string HelpLink { get; set; }
public object Value { get; set; }
public string Type { get; set; }
public bool Advanced { get; set; }
public List<SelectOption> SelectOptions { get; set; }
}
}

View File

@ -77,13 +77,13 @@ namespace NzbDrone.Api.ClientSchema
{
var field = fields.Find(f => f.Name == propertyInfo.Name);
if (propertyInfo.PropertyType == typeof(Int32))
if (propertyInfo.PropertyType == typeof(int))
{
var value = Convert.ToInt32(field.Value);
propertyInfo.SetValue(target, value, null);
}
else if (propertyInfo.PropertyType == typeof(Int64))
else if (propertyInfo.PropertyType == typeof(long))
{
var value = Convert.ToInt64(field.Value);
propertyInfo.SetValue(target, value, null);
@ -101,13 +101,13 @@ namespace NzbDrone.Api.ClientSchema
propertyInfo.SetValue(target, value, null);
}
else if (propertyInfo.PropertyType == typeof(IEnumerable<Int32>))
else if (propertyInfo.PropertyType == typeof(IEnumerable<int>))
{
IEnumerable<Int32> value;
IEnumerable<int> value;
if (field.Value.GetType() == typeof(JArray))
{
value = ((JArray)field.Value).Select(s => s.Value<Int32>());
value = ((JArray)field.Value).Select(s => s.Value<int>());
}
else

View File

@ -7,8 +7,8 @@ namespace NzbDrone.Api.Commands
{
public class CommandResource : RestResource
{
public String Name { get; set; }
public String Message { get; set; }
public string Name { get; set; }
public string Message { get; set; }
public Command Body { get; set; }
public CommandPriority Priority { get; set; }
public CommandStatus Status { get; set; }
@ -33,7 +33,7 @@ namespace NzbDrone.Api.Commands
set { }
}
public Boolean Manual
public bool Manual
{
get
{
@ -66,7 +66,7 @@ namespace NzbDrone.Api.Commands
set { }
}
public Boolean SendUpdatesToClient
public bool SendUpdatesToClient
{
get
{
@ -78,7 +78,7 @@ namespace NzbDrone.Api.Commands
set { }
}
public Boolean UpdateScheduledTask
public bool UpdateScheduledTask
{
get
{

View File

@ -19,7 +19,7 @@ namespace NzbDrone.Api.Config
.SetValidator(rootFolderValidator)
.SetValidator(mappedNetworkDriveValidator)
.SetValidator(pathExistsValidator)
.When(c => !String.IsNullOrWhiteSpace(c.DownloadedEpisodesFolder));
.When(c => !string.IsNullOrWhiteSpace(c.DownloadedEpisodesFolder));
}
}
}

View File

@ -5,14 +5,14 @@ namespace NzbDrone.Api.Config
{
public class DownloadClientConfigResource : RestResource
{
public String DownloadedEpisodesFolder { get; set; }
public String DownloadClientWorkingFolders { get; set; }
public Int32 DownloadedEpisodesScanInterval { get; set; }
public string DownloadedEpisodesFolder { get; set; }
public string DownloadClientWorkingFolders { get; set; }
public int DownloadedEpisodesScanInterval { get; set; }
public Boolean EnableCompletedDownloadHandling { get; set; }
public Boolean RemoveCompletedDownloads { get; set; }
public bool EnableCompletedDownloadHandling { get; set; }
public bool RemoveCompletedDownloads { get; set; }
public Boolean AutoRedownloadFailed { get; set; }
public Boolean RemoveFailedDownloads { get; set; }
public bool AutoRedownloadFailed { get; set; }
public bool RemoveFailedDownloads { get; set; }
}
}

View File

@ -7,23 +7,23 @@ namespace NzbDrone.Api.Config
{
public class HostConfigResource : RestResource
{
public String BindAddress { get; set; }
public Int32 Port { get; set; }
public Int32 SslPort { get; set; }
public Boolean EnableSsl { get; set; }
public Boolean LaunchBrowser { get; set; }
public string BindAddress { get; set; }
public int Port { get; set; }
public int SslPort { get; set; }
public bool EnableSsl { get; set; }
public bool LaunchBrowser { get; set; }
public AuthenticationType AuthenticationMethod { get; set; }
public Boolean AnalyticsEnabled { get; set; }
public String Username { get; set; }
public String Password { get; set; }
public String LogLevel { get; set; }
public String Branch { get; set; }
public String ApiKey { get; set; }
public Boolean Torrent { get; set; }
public String SslCertHash { get; set; }
public String UrlBase { get; set; }
public Boolean UpdateAutomatically { get; set; }
public bool AnalyticsEnabled { get; set; }
public string Username { get; set; }
public string Password { get; set; }
public string LogLevel { get; set; }
public string Branch { get; set; }
public string ApiKey { get; set; }
public bool Torrent { get; set; }
public string SslCertHash { get; set; }
public string UrlBase { get; set; }
public bool UpdateAutomatically { get; set; }
public UpdateMechanism UpdateMechanism { get; set; }
public String UpdateScriptPath { get; set; }
public string UpdateScriptPath { get; set; }
}
}

View File

@ -5,8 +5,8 @@ namespace NzbDrone.Api.Config
{
public class IndexerConfigResource : RestResource
{
public Int32 MinimumAge { get; set; }
public Int32 Retention { get; set; }
public Int32 RssSyncInterval { get; set; }
public int MinimumAge { get; set; }
public int Retention { get; set; }
public int RssSyncInterval { get; set; }
}
}

View File

@ -12,7 +12,7 @@ namespace NzbDrone.Api.Config
{
SharedValidator.RuleFor(c => c.FileChmod).NotEmpty();
SharedValidator.RuleFor(c => c.FolderChmod).NotEmpty();
SharedValidator.RuleFor(c => c.RecycleBin).IsValidPath().SetValidator(pathExistsValidator).When(c => !String.IsNullOrWhiteSpace(c.RecycleBin));
SharedValidator.RuleFor(c => c.RecycleBin).IsValidPath().SetValidator(pathExistsValidator).When(c => !string.IsNullOrWhiteSpace(c.RecycleBin));
}
}
}

View File

@ -6,20 +6,20 @@ namespace NzbDrone.Api.Config
{
public class MediaManagementConfigResource : RestResource
{
public Boolean AutoUnmonitorPreviouslyDownloadedEpisodes { get; set; }
public String RecycleBin { get; set; }
public Boolean AutoDownloadPropers { get; set; }
public Boolean CreateEmptySeriesFolders { get; set; }
public bool AutoUnmonitorPreviouslyDownloadedEpisodes { get; set; }
public string RecycleBin { get; set; }
public bool AutoDownloadPropers { get; set; }
public bool CreateEmptySeriesFolders { get; set; }
public FileDateType FileDate { get; set; }
public Boolean SetPermissionsLinux { get; set; }
public String FileChmod { get; set; }
public String FolderChmod { get; set; }
public String ChownUser { get; set; }
public String ChownGroup { get; set; }
public bool SetPermissionsLinux { get; set; }
public string FileChmod { get; set; }
public string FolderChmod { get; set; }
public string ChownUser { get; set; }
public string ChownGroup { get; set; }
public Boolean SkipFreeSpaceCheckWhenImporting { get; set; }
public Boolean CopyUsingHardlinks { get; set; }
public Boolean EnableMediaInfo { get; set; }
public bool SkipFreeSpaceCheckWhenImporting { get; set; }
public bool CopyUsingHardlinks { get; set; }
public bool EnableMediaInfo { get; set; }
}
}

View File

@ -57,7 +57,7 @@ namespace NzbDrone.Api.Config
var nameSpec = _namingConfigService.GetConfig();
var resource = nameSpec.InjectTo<NamingConfigResource>();
if (String.IsNullOrWhiteSpace(resource.StandardEpisodeFormat))
if (string.IsNullOrWhiteSpace(resource.StandardEpisodeFormat))
{
return resource;
}

View File

@ -5,8 +5,8 @@ namespace NzbDrone.Api.Config
{
public class NamingConfigResource : RestResource
{
public Boolean RenameEpisodes { get; set; }
public Int32 MultiEpisodeStyle { get; set; }
public bool RenameEpisodes { get; set; }
public int MultiEpisodeStyle { get; set; }
public string StandardEpisodeFormat { get; set; }
public string DailyEpisodeFormat { get; set; }
public string AnimeEpisodeFormat { get; set; }

View File

@ -6,15 +6,15 @@ namespace NzbDrone.Api.Config
public class UiConfigResource : RestResource
{
//Calendar
public Int32 FirstDayOfWeek { get; set; }
public String CalendarWeekColumnHeader { get; set; }
public int FirstDayOfWeek { get; set; }
public string CalendarWeekColumnHeader { get; set; }
//Dates
public String ShortDateFormat { get; set; }
public String LongDateFormat { get; set; }
public String TimeFormat { get; set; }
public Boolean ShowRelativeDates { get; set; }
public string ShortDateFormat { get; set; }
public string LongDateFormat { get; set; }
public string TimeFormat { get; set; }
public bool ShowRelativeDates { get; set; }
public Boolean EnableColorImpairedMode { get; set; }
public bool EnableColorImpairedMode { get; set; }
}
}

View File

@ -7,7 +7,7 @@ namespace NzbDrone.Api.DiskSpace
{
public string Path { get; set; }
public string Label { get; set; }
public Int64 FreeSpace { get; set; }
public Int64 TotalSpace { get; set; }
public long FreeSpace { get; set; }
public long TotalSpace { get; set; }
}
}

View File

@ -5,7 +5,7 @@ namespace NzbDrone.Api.DownloadClient
{
public class DownloadClientResource : ProviderResource
{
public Boolean Enable { get; set; }
public bool Enable { get; set; }
public DownloadProtocol Protocol { get; set; }
}
}

View File

@ -6,15 +6,15 @@ namespace NzbDrone.Api.EpisodeFiles
{
public class EpisodeFileResource : RestResource
{
public Int32 SeriesId { get; set; }
public Int32 SeasonNumber { get; set; }
public String RelativePath { get; set; }
public String Path { get; set; }
public Int64 Size { get; set; }
public int SeriesId { get; set; }
public int SeasonNumber { get; set; }
public string RelativePath { get; set; }
public string Path { get; set; }
public long Size { get; set; }
public DateTime DateAdded { get; set; }
public String SceneName { get; set; }
public string SceneName { get; set; }
public QualityModel Quality { get; set; }
public Boolean QualityCutoffNotMet { get; set; }
public bool QualityCutoffNotMet { get; set; }
}
}

View File

@ -40,7 +40,7 @@ namespace NzbDrone.Api.Episodes
ISeriesService seriesService,
IQualityUpgradableSpecification qualityUpgradableSpecification,
IBroadcastSignalRMessage signalRBroadcaster,
String resource)
string resource)
: base(signalRBroadcaster, resource)
{
_episodeService = episodeService;

View File

@ -8,30 +8,30 @@ namespace NzbDrone.Api.Episodes
{
public class EpisodeResource : RestResource
{
public Int32 SeriesId { get; set; }
public Int32 EpisodeFileId { get; set; }
public Int32 SeasonNumber { get; set; }
public Int32 EpisodeNumber { get; set; }
public String Title { get; set; }
public String AirDate { get; set; }
public int SeriesId { get; set; }
public int EpisodeFileId { get; set; }
public int SeasonNumber { get; set; }
public int EpisodeNumber { get; set; }
public string Title { get; set; }
public string AirDate { get; set; }
public DateTime? AirDateUtc { get; set; }
public String Overview { get; set; }
public string Overview { get; set; }
public EpisodeFileResource EpisodeFile { get; set; }
public Boolean HasFile { get; set; }
public Boolean Monitored { get; set; }
public bool HasFile { get; set; }
public bool Monitored { get; set; }
public Nullable<Int32> AbsoluteEpisodeNumber { get; set; }
public Nullable<Int32> SceneAbsoluteEpisodeNumber { get; set; }
public Nullable<Int32> SceneEpisodeNumber { get; set; }
public Nullable<Int32> SceneSeasonNumber { get; set; }
public Boolean UnverifiedSceneNumbering { get; set; }
public bool UnverifiedSceneNumbering { get; set; }
public DateTime? EndTime { get; set; }
public DateTime? GrabDate { get; set; }
public String SeriesTitle { get; set; }
public string SeriesTitle { get; set; }
public SeriesResource Series { get; set; }
//Hiding this so people don't think its usable (only used to set the initial state)
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
public Boolean Grabbed { get; set; }
public bool Grabbed { get; set; }
}
}

View File

@ -6,11 +6,11 @@ namespace NzbDrone.Api.Episodes
{
public class RenameEpisodeResource : RestResource
{
public Int32 SeriesId { get; set; }
public Int32 SeasonNumber { get; set; }
public List<Int32> EpisodeNumbers { get; set; }
public Int32 EpisodeFileId { get; set; }
public String ExistingPath { get; set; }
public String NewPath { get; set; }
public int SeriesId { get; set; }
public int SeasonNumber { get; set; }
public List<int> EpisodeNumbers { get; set; }
public int EpisodeFileId { get; set; }
public string ExistingPath { get; set; }
public string NewPath { get; set; }
}
}

View File

@ -63,7 +63,7 @@ namespace NzbDrone.Api.ErrorManagement
}.AsResponse(HttpStatusCode.Conflict);
}
var sqlErrorMessage = String.Format("[{0} {1}]", context.Request.Method, context.Request.Path);
var sqlErrorMessage = string.Format("[{0} {1}]", context.Request.Method, context.Request.Path);
_logger.ErrorException(sqlErrorMessage, sqLiteException);
}

View File

@ -13,7 +13,7 @@ namespace NzbDrone.Api.Extensions
{
private static readonly ICached<MethodInfo> SetterCache = new Cached<MethodInfo>();
public static IEnumerable<TParent> LoadSubtype<TParent, TChild, TSourceChild>(this IEnumerable<TParent> parents, Func<TParent, Int32> foreignKeySelector, Func<IEnumerable<Int32>, IEnumerable<TSourceChild>> sourceChildSelector)
public static IEnumerable<TParent> LoadSubtype<TParent, TChild, TSourceChild>(this IEnumerable<TParent> parents, Func<TParent, int> foreignKeySelector, Func<IEnumerable<int>, IEnumerable<TSourceChild>> sourceChildSelector)
where TSourceChild : ModelBase, new()
where TChild : RestResource, new()
where TParent : RestResource

View File

@ -31,7 +31,7 @@ namespace NzbDrone.Api.Extensions.Pipelines
allowedMethods = response.Headers["Allow"];
}
var requestedHeaders = String.Join(", ", request.Headers[AccessControlHeaders.RequestHeaders]);
var requestedHeaders = string.Join(", ", request.Headers[AccessControlHeaders.RequestHeaders]);
response.Headers.Add(AccessControlHeaders.AllowOrigin, "*");
response.Headers.Add(AccessControlHeaders.AllowMethods, allowedMethods);

View File

@ -19,8 +19,8 @@ namespace NzbDrone.Api.Frontend.Mappers
private readonly string _indexPath;
private static readonly Regex ReplaceRegex = new Regex(@"(?:(?<attribute>href|src)=\"")(?<path>.*?(?<extension>css|js|png|ico|ics))(?:\"")(?:\s(?<nohash>data-no-hash))?", RegexOptions.Compiled | RegexOptions.IgnoreCase);
private static String API_KEY;
private static String URL_BASE;
private static string API_KEY;
private static string URL_BASE;
private string _generatedContent
;
@ -97,7 +97,7 @@ namespace NzbDrone.Api.Frontend.Mappers
url = cacheBreakProvider.AddCacheBreakerToPath(match.Groups["path"].Value);
}
return String.Format("{0}=\"{1}{2}\"", match.Groups["attribute"].Value, URL_BASE, url);
return string.Format("{0}=\"{1}{2}\"", match.Groups["attribute"].Value, URL_BASE, url);
});
text = text.Replace("API_ROOT", URL_BASE + "/api");

View File

@ -17,7 +17,7 @@ namespace NzbDrone.Api.Frontend.Mappers
private readonly string _indexPath;
private static readonly Regex ReplaceRegex = new Regex("(?<=(?:href|src|data-main)=\").*?(?=\")", RegexOptions.Compiled | RegexOptions.IgnoreCase);
private static String URL_BASE;
private static string URL_BASE;
private string _generatedContent;
public LoginHtmlMapper(IAppFolderInfo appFolderInfo,

View File

@ -43,7 +43,7 @@ namespace NzbDrone.Api.Frontend
{
var urlBase = _configFileProvider.UrlBase;
if (!String.IsNullOrEmpty(urlBase))
if (!string.IsNullOrEmpty(urlBase))
{
if (Request.Url.BasePath != urlBase)
{

View File

@ -7,7 +7,7 @@ namespace NzbDrone.Api.Health
public class HealthResource : RestResource
{
public HealthCheckResult Type { get; set; }
public String Message { get; set; }
public string Message { get; set; }
public Uri WikiUrl { get; set; }
}
}

View File

@ -71,7 +71,7 @@ namespace NzbDrone.Api.History
{
var id = (int)Request.Form.Id;
_failedDownloadService.MarkAsFailed(id);
return new Object().AsResponse();
return new object().AsResponse();
}
}
}

View File

@ -15,7 +15,7 @@ namespace NzbDrone.Api.History
public int SeriesId { get; set; }
public string SourceTitle { get; set; }
public QualityModel Quality { get; set; }
public Boolean QualityCutoffNotMet { get; set; }
public bool QualityCutoffNotMet { get; set; }
public DateTime Date { get; set; }
public string Indexer { get; set; }
public string ReleaseGroup { get; set; }

View File

@ -5,10 +5,10 @@ namespace NzbDrone.Api.Indexers
{
public class IndexerResource : ProviderResource
{
public Boolean EnableRss { get; set; }
public Boolean EnableSearch { get; set; }
public Boolean SupportsRss { get; set; }
public Boolean SupportsSearch { get; set; }
public bool EnableRss { get; set; }
public bool EnableSearch { get; set; }
public bool SupportsRss { get; set; }
public bool SupportsSearch { get; set; }
public DownloadProtocol Protocol { get; set; }
}
}

View File

@ -9,38 +9,38 @@ namespace NzbDrone.Api.Indexers
{
public class ReleaseResource : RestResource
{
public String Guid { get; set; }
public string Guid { get; set; }
public QualityModel Quality { get; set; }
public Int32 QualityWeight { get; set; }
public Int32 Age { get; set; }
public Double AgeHours { get; set; }
public Double AgeMinutes { get; set; }
public Int64 Size { get; set; }
public Int32 IndexerId { get; set; }
public String Indexer { get; set; }
public String ReleaseGroup { get; set; }
public String SubGroup { get; set; }
public String ReleaseHash { get; set; }
public String Title { get; set; }
public Boolean FullSeason { get; set; }
public Boolean SceneSource { get; set; }
public Int32 SeasonNumber { get; set; }
public int QualityWeight { get; set; }
public int Age { get; set; }
public double AgeHours { get; set; }
public double AgeMinutes { get; set; }
public long Size { get; set; }
public int IndexerId { get; set; }
public string Indexer { get; set; }
public string ReleaseGroup { get; set; }
public string SubGroup { get; set; }
public string ReleaseHash { get; set; }
public string Title { get; set; }
public bool FullSeason { get; set; }
public bool SceneSource { get; set; }
public int SeasonNumber { get; set; }
public Language Language { get; set; }
public String AirDate { get; set; }
public String SeriesTitle { get; set; }
public string AirDate { get; set; }
public string SeriesTitle { get; set; }
public int[] EpisodeNumbers { get; set; }
public int[] AbsoluteEpisodeNumbers { get; set; }
public Boolean Approved { get; set; }
public Boolean TemporarilyRejected { get; set; }
public Boolean Rejected { get; set; }
public Int32 TvRageId { get; set; }
public IEnumerable<String> Rejections { get; set; }
public bool Approved { get; set; }
public bool TemporarilyRejected { get; set; }
public bool Rejected { get; set; }
public int TvRageId { get; set; }
public IEnumerable<string> Rejections { get; set; }
public DateTime PublishDate { get; set; }
public String CommentUrl { get; set; }
public String DownloadUrl { get; set; }
public String InfoUrl { get; set; }
public Boolean DownloadAllowed { get; set; }
public Int32 ReleaseWeight { get; set; }
public string CommentUrl { get; set; }
public string DownloadUrl { get; set; }
public string InfoUrl { get; set; }
public bool DownloadAllowed { get; set; }
public int ReleaseWeight { get; set; }
public int? Seeders { get; set; }
@ -50,9 +50,9 @@ namespace NzbDrone.Api.Indexers
//TODO: besides a test I don't think this is used...
public DownloadProtocol DownloadProtocol { get; set; }
public Boolean IsDaily { get; set; }
public Boolean IsAbsoluteNumbering { get; set; }
public Boolean IsPossibleSpecialEpisode { get; set; }
public Boolean Special { get; set; }
public bool IsDaily { get; set; }
public bool IsAbsoluteNumbering { get; set; }
public bool IsPossibleSpecialEpisode { get; set; }
public bool Special { get; set; }
}
}

View File

@ -18,7 +18,7 @@ namespace NzbDrone.Api.Logs
public LogFileModuleBase(IDiskProvider diskProvider,
IConfigFileProvider configFileProvider,
String route)
string route)
: base("log/file" + route)
{
_diskProvider = diskProvider;
@ -44,15 +44,15 @@ namespace NzbDrone.Api.Logs
Id = i + 1,
Filename = filename,
LastWriteTime = _diskProvider.FileGetLastWrite(file),
ContentsUrl = String.Format("{0}/api/{1}/{2}", _configFileProvider.UrlBase, Resource, filename),
DownloadUrl = String.Format("{0}/{1}/{2}", _configFileProvider.UrlBase, DownloadUrlRoot, filename)
ContentsUrl = string.Format("{0}/api/{1}/{2}", _configFileProvider.UrlBase, Resource, filename),
DownloadUrl = string.Format("{0}/{1}/{2}", _configFileProvider.UrlBase, DownloadUrlRoot, filename)
});
}
return result.OrderByDescending(l => l.LastWriteTime).ToList();
}
private Response GetLogFileResponse(String filename)
private Response GetLogFileResponse(string filename)
{
var filePath = GetLogFilePath(filename);
@ -64,9 +64,9 @@ namespace NzbDrone.Api.Logs
return new TextResponse(data);
}
protected abstract IEnumerable<String> GetLogFiles();
protected abstract String GetLogFilePath(String filename);
protected abstract IEnumerable<string> GetLogFiles();
protected abstract string GetLogFilePath(string filename);
protected abstract String DownloadUrlRoot { get; }
protected abstract string DownloadUrlRoot { get; }
}
}

View File

@ -5,9 +5,9 @@ namespace NzbDrone.Api.Logs
{
public class LogFileResource : RestResource
{
public String Filename { get; set; }
public string Filename { get; set; }
public DateTime LastWriteTime { get; set; }
public String ContentsUrl { get; set; }
public String DownloadUrl { get; set; }
public string ContentsUrl { get; set; }
public string DownloadUrl { get; set; }
}
}

View File

@ -6,11 +6,11 @@ namespace NzbDrone.Api.Logs
public class LogResource : RestResource
{
public DateTime Time { get; set; }
public String Exception { get; set; }
public String ExceptionType { get; set; }
public String Level { get; set; }
public String Logger { get; set; }
public String Message { get; set; }
public String Method { get; set; }
public string Exception { get; set; }
public string ExceptionType { get; set; }
public string Level { get; set; }
public string Logger { get; set; }
public string Message { get; set; }
public string Method { get; set; }
}
}

View File

@ -24,21 +24,21 @@ namespace NzbDrone.Api.Logs
_diskProvider = diskProvider;
}
protected override IEnumerable<String> GetLogFiles()
protected override IEnumerable<string> GetLogFiles()
{
if (!_diskProvider.FolderExists(_appFolderInfo.GetUpdateLogFolder())) return Enumerable.Empty<String>();
if (!_diskProvider.FolderExists(_appFolderInfo.GetUpdateLogFolder())) return Enumerable.Empty<string>();
return _diskProvider.GetFiles(_appFolderInfo.GetUpdateLogFolder(), SearchOption.TopDirectoryOnly)
.Where(f => Regex.IsMatch(Path.GetFileName(f), LOGFILE_ROUTE.TrimStart('/'), RegexOptions.IgnoreCase))
.ToList();
}
protected override String GetLogFilePath(String filename)
protected override string GetLogFilePath(string filename)
{
return Path.Combine(_appFolderInfo.GetUpdateLogFolder(), filename);
}
protected override String DownloadUrlRoot
protected override string DownloadUrlRoot
{
get
{

View File

@ -7,7 +7,7 @@ namespace NzbDrone.Api.Mapping
public class ResourceMappingException : ApplicationException
{
public ResourceMappingException(IEnumerable<string> error)
: base(Environment.NewLine + String.Join(Environment.NewLine, error.OrderBy(c => c)))
: base(Environment.NewLine + string.Join(Environment.NewLine, error.OrderBy(c => c)))
{
}

View File

@ -4,6 +4,6 @@ namespace NzbDrone.Api.Metadata
{
public class MetadataResource : ProviderResource
{
public Boolean Enable { get; set; }
public bool Enable { get; set; }
}
}

View File

@ -7,8 +7,8 @@ namespace NzbDrone.Api.Profiles.Languages
public class LanguageResource : RestResource
{
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Include)]
public Int32 Id { get; set; }
public String Name { get; set; }
public String NameLower { get { return Name.ToLowerInvariant(); } }
public int Id { get; set; }
public string Name { get; set; }
public string NameLower { get { return Name.ToLowerInvariant(); } }
}
}

View File

@ -12,7 +12,7 @@ namespace NzbDrone.Api.Profiles
Get["/"] = x =>
{
string queryString = ConvertQueryParams(Request.Query);
var url = String.Format("/api/profile?{0}", queryString);
var url = string.Format("/api/profile?{0}", queryString);
return Response.AsRedirect(url);
};

View File

@ -8,7 +8,7 @@ namespace NzbDrone.Api.Profiles
{
public class ProfileResource : RestResource
{
public String Name { get; set; }
public string Name { get; set; }
public Quality Cutoff { get; set; }
public List<ProfileQualityItemResource> Items { get; set; }
public Language Language { get; set; }

View File

@ -137,7 +137,7 @@ namespace NzbDrone.Api
var providerResource = new TProviderResource();
providerResource.InjectFrom(providerDefinition);
providerResource.Fields = SchemaBuilder.ToSchema(providerDefinition.Settings);
providerResource.InfoLink = String.Format("https://github.com/NzbDrone/NzbDrone/wiki/Supported-{0}#{1}",
providerResource.InfoLink = string.Format("https://github.com/NzbDrone/NzbDrone/wiki/Supported-{0}#{1}",
typeof(TProviderResource).Name.Replace("Resource", "s"),
providerDefinition.Implementation.ToLower());

View File

@ -14,15 +14,15 @@ namespace NzbDrone.Api.Queue
public SeriesResource Series { get; set; }
public EpisodeResource Episode { get; set; }
public QualityModel Quality { get; set; }
public Decimal Size { get; set; }
public String Title { get; set; }
public Decimal Sizeleft { get; set; }
public decimal Size { get; set; }
public string Title { get; set; }
public decimal Sizeleft { get; set; }
public TimeSpan? Timeleft { get; set; }
public DateTime? EstimatedCompletionTime { get; set; }
public String Status { get; set; }
public String TrackedDownloadStatus { get; set; }
public string Status { get; set; }
public string TrackedDownloadStatus { get; set; }
public List<TrackedDownloadStatusMessage> StatusMessages { get; set; }
public String DownloadId { get; set; }
public string DownloadId { get; set; }
public DownloadProtocol Protocol { get; set; }
}
}

View File

@ -214,11 +214,11 @@ namespace NzbDrone.Api.REST
private PagingResource<TResource> ReadPagingResourceFromRequest()
{
int pageSize;
Int32.TryParse(Request.Query.PageSize.ToString(), out pageSize);
int.TryParse(Request.Query.PageSize.ToString(), out pageSize);
if (pageSize == 0) pageSize = 10;
int page;
Int32.TryParse(Request.Query.Page.ToString(), out page);
int.TryParse(Request.Query.Page.ToString(), out page);
if (page == 0) page = 1;

View File

@ -5,8 +5,8 @@ namespace NzbDrone.Api.RemotePathMappings
{
public class RemotePathMappingResource : RestResource
{
public String Host { get; set; }
public String RemotePath { get; set; }
public String LocalPath { get; set; }
public string Host { get; set; }
public string RemotePath { get; set; }
public string LocalPath { get; set; }
}
}

View File

@ -33,7 +33,7 @@ namespace NzbDrone.Api.Restrictions
});
}
private RestrictionResource Get(Int32 id)
private RestrictionResource Get(int id)
{
return _restrictionService.Get(id).InjectTo<RestrictionResource>();
}
@ -43,7 +43,7 @@ namespace NzbDrone.Api.Restrictions
return ToListResource(_restrictionService.All);
}
private Int32 Create(RestrictionResource resource)
private int Create(RestrictionResource resource)
{
return _restrictionService.Add(resource.InjectTo<Restriction>()).Id;
}
@ -53,7 +53,7 @@ namespace NzbDrone.Api.Restrictions
_restrictionService.Update(resource.InjectTo<Restriction>());
}
private void Delete(Int32 id)
private void Delete(int id)
{
_restrictionService.Delete(id);
}

View File

@ -6,14 +6,14 @@ namespace NzbDrone.Api.Restrictions
{
public class RestrictionResource : RestResource
{
public String Required { get; set; }
public String Preferred { get; set; }
public String Ignored { get; set; }
public HashSet<Int32> Tags { get; set; }
public string Required { get; set; }
public string Preferred { get; set; }
public string Ignored { get; set; }
public HashSet<int> Tags { get; set; }
public RestrictionResource()
{
Tags = new HashSet<Int32>();
Tags = new HashSet<int>();
}
}
}

View File

@ -7,8 +7,8 @@ namespace NzbDrone.Api.RootFolders
{
public class RootFolderResource : RestResource
{
public String Path { get; set; }
public Int64? FreeSpace { get; set; }
public string Path { get; set; }
public long? FreeSpace { get; set; }
public List<UnmappedFolder> UnmappedFolders { get; set; }
}

View File

@ -4,7 +4,7 @@ namespace NzbDrone.Api.Series
{
public class AlternateTitleResource
{
public String Title { get; set; }
public Int32 SeasonNumber { get; set; }
public string Title { get; set; }
public int SeasonNumber { get; set; }
}
}

View File

@ -14,11 +14,11 @@ namespace NzbDrone.Api.Series
//Todo: We should get the entire Profile instead of ID and Name separately
//View Only
public String Title { get; set; }
public string Title { get; set; }
public List<AlternateTitleResource> AlternateTitles { get; set; }
public String SortTitle { get; set; }
public string SortTitle { get; set; }
public Int32 SeasonCount
public int SeasonCount
{
get
{
@ -28,45 +28,45 @@ namespace NzbDrone.Api.Series
}
}
public Int32? TotalEpisodeCount { get; set; }
public Int32? EpisodeCount { get; set; }
public Int32? EpisodeFileCount { get; set; }
public Int64? SizeOnDisk { get; set; }
public int? TotalEpisodeCount { get; set; }
public int? EpisodeCount { get; set; }
public int? EpisodeFileCount { get; set; }
public long? SizeOnDisk { get; set; }
public SeriesStatusType Status { get; set; }
public String ProfileName { get; set; }
public String Overview { get; set; }
public string ProfileName { get; set; }
public string Overview { get; set; }
public DateTime? NextAiring { get; set; }
public DateTime? PreviousAiring { get; set; }
public String Network { get; set; }
public String AirTime { get; set; }
public string Network { get; set; }
public string AirTime { get; set; }
public List<MediaCover> Images { get; set; }
public String RemotePoster { get; set; }
public string RemotePoster { get; set; }
public List<SeasonResource> Seasons { get; set; }
public Int32 Year { get; set; }
public int Year { get; set; }
//View & Edit
public String Path { get; set; }
public Int32 ProfileId { get; set; }
public string Path { get; set; }
public int ProfileId { get; set; }
//Editing Only
public Boolean SeasonFolder { get; set; }
public Boolean Monitored { get; set; }
public bool SeasonFolder { get; set; }
public bool Monitored { get; set; }
public Boolean UseSceneNumbering { get; set; }
public Int32 Runtime { get; set; }
public Int32 TvdbId { get; set; }
public Int32 TvRageId { get; set; }
public bool UseSceneNumbering { get; set; }
public int Runtime { get; set; }
public int TvdbId { get; set; }
public int TvRageId { get; set; }
public DateTime? FirstAired { get; set; }
public DateTime? LastInfoSync { get; set; }
public SeriesTypes SeriesType { get; set; }
public String CleanTitle { get; set; }
public String ImdbId { get; set; }
public String TitleSlug { get; set; }
public String RootFolderPath { get; set; }
public String Certification { get; set; }
public List<String> Genres { get; set; }
public HashSet<Int32> Tags { get; set; }
public string CleanTitle { get; set; }
public string ImdbId { get; set; }
public string TitleSlug { get; set; }
public string RootFolderPath { get; set; }
public string Certification { get; set; }
public List<string> Genres { get; set; }
public HashSet<int> Tags { get; set; }
public DateTime Added { get; set; }
public AddSeriesOptions AddOptions { get; set; }
public Ratings Ratings { get; set; }
@ -74,7 +74,7 @@ namespace NzbDrone.Api.Series
//TODO: Add series statistics as a property of the series (instead of individual properties)
//Used to support legacy consumers
public Int32 QualityProfileId
public int QualityProfileId
{
get
{

View File

@ -6,8 +6,8 @@ namespace NzbDrone.Api.System.Backup
{
public class BackupResource : RestResource
{
public String Name { get; set; }
public String Path { get; set; }
public string Name { get; set; }
public string Path { get; set; }
public BackupType Type { get; set; }
public DateTime Time { get; set; }
}

View File

@ -5,9 +5,9 @@ namespace NzbDrone.Api.System.Tasks
{
public class TaskResource : RestResource
{
public String Name { get; set; }
public String TaskName { get; set; }
public Int32 Interval { get; set; }
public string Name { get; set; }
public string TaskName { get; set; }
public int Interval { get; set; }
public DateTime LastExecution { get; set; }
public DateTime NextExecution { get; set; }
}

View File

@ -25,7 +25,7 @@ namespace NzbDrone.Api.Tags
DeleteResource = Delete;
}
private TagResource Get(Int32 id)
private TagResource Get(int id)
{
return _tagService.GetTag(id).InjectTo<TagResource>();
}
@ -35,7 +35,7 @@ namespace NzbDrone.Api.Tags
return ToListResource(_tagService.All);
}
private Int32 Create(TagResource resource)
private int Create(TagResource resource)
{
return _tagService.Add(resource.InjectTo<Tag>()).Id;
}
@ -45,7 +45,7 @@ namespace NzbDrone.Api.Tags
_tagService.Update(resource.InjectTo<Tag>());
}
private void Delete(Int32 id)
private void Delete(int id)
{
_tagService.Delete(id);
}

View File

@ -5,6 +5,6 @@ namespace NzbDrone.Api.Tags
{
public class TagResource : RestResource
{
public String Label { get; set; }
public string Label { get; set; }
}
}

View File

@ -10,14 +10,14 @@ namespace NzbDrone.Api.Update
[JsonConverter(typeof(Newtonsoft.Json.Converters.VersionConverter))]
public Version Version { get; set; }
public String Branch { get; set; }
public string Branch { get; set; }
public DateTime ReleaseDate { get; set; }
public String FileName { get; set; }
public String Url { get; set; }
public Boolean Installed { get; set; }
public Boolean Installable { get; set; }
public Boolean Latest { get; set; }
public string FileName { get; set; }
public string Url { get; set; }
public bool Installed { get; set; }
public bool Installable { get; set; }
public bool Latest { get; set; }
public UpdateChanges Changes { get; set; }
public String Hash { get; set; }
public string Hash { get; set; }
}
}

View File

@ -11,7 +11,7 @@ namespace NzbDrone.Api.Wanted
Get["/"] = x =>
{
string queryString = ConvertQueryParams(Request.Query);
var url = String.Format("/api/wanted/missing?{0}", queryString);
var url = string.Format("/api/wanted/missing?{0}", queryString);
return Response.AsRedirect(url);
};

View File

@ -33,7 +33,7 @@ namespace NzbDrone.App.Test
public void should_continue_if_only_instance()
{
Mocker.GetMock<IProcessProvider>()
.Setup(c => c.FindProcessByName(It.Is<String>(f => f.Contains("NzbDrone"))))
.Setup(c => c.FindProcessByName(It.Is<string>(f => f.Contains("NzbDrone"))))
.Returns(new List<ProcessInfo>
{
new ProcessInfo {Id = CURRENT_PROCESS_ID}

View File

@ -20,7 +20,7 @@ namespace NzbDrone.Common.Test.DiskTests
private void SetupFolders(string root)
{
var folders = new List<String>
var folders = new List<string>
{
RECYCLING_BIN,
"Chocolatey",
@ -47,7 +47,7 @@ namespace NzbDrone.Common.Test.DiskTests
SetupFolders(root);
Mocker.GetMock<IDiskProvider>()
.Setup(s => s.GetDirectoryInfos(It.IsAny<String>()))
.Setup(s => s.GetDirectoryInfos(It.IsAny<string>()))
.Returns(_folders);
Subject.LookupContents(root, false).Directories.Should().NotContain(Path.Combine(root, RECYCLING_BIN));
@ -60,7 +60,7 @@ namespace NzbDrone.Common.Test.DiskTests
SetupFolders(root);
Mocker.GetMock<IDiskProvider>()
.Setup(s => s.GetDirectoryInfos(It.IsAny<String>()))
.Setup(s => s.GetDirectoryInfos(It.IsAny<string>()))
.Returns(_folders);
Subject.LookupContents(root, false).Directories.Should().NotContain(Path.Combine(root, SYSTEM_VOLUME_INFORMATION));
@ -73,7 +73,7 @@ namespace NzbDrone.Common.Test.DiskTests
SetupFolders(root);
Mocker.GetMock<IDiskProvider>()
.Setup(s => s.GetDirectoryInfos(It.IsAny<String>()))
.Setup(s => s.GetDirectoryInfos(It.IsAny<string>()))
.Returns(_folders);
var result = Subject.LookupContents(root, false);

View File

@ -14,10 +14,10 @@ namespace NzbDrone.Common.Test.DiskTests
[TestFixture]
public class DiskTransferServiceFixture : TestBase<DiskTransferService>
{
private readonly String _sourcePath = @"C:\source\my.video.mkv".AsOsAgnostic();
private readonly String _targetPath = @"C:\target\my.video.mkv".AsOsAgnostic();
private readonly String _backupPath = @"C:\source\my.video.mkv.backup~".AsOsAgnostic();
private readonly String _tempTargetPath = @"C:\target\my.video.mkv.partial~".AsOsAgnostic();
private readonly string _sourcePath = @"C:\source\my.video.mkv".AsOsAgnostic();
private readonly string _targetPath = @"C:\target\my.video.mkv".AsOsAgnostic();
private readonly string _backupPath = @"C:\source\my.video.mkv.backup~".AsOsAgnostic();
private readonly string _tempTargetPath = @"C:\target\my.video.mkv.partial~".AsOsAgnostic();
[SetUp]
public void SetUp()
@ -669,7 +669,7 @@ namespace NzbDrone.Common.Test.DiskTests
private void WithFailedHardlink()
{
Mocker.GetMock<IDiskProvider>()
.Setup(v => v.TryCreateHardLink(It.IsAny<String>(), It.IsAny<String>()))
.Setup(v => v.TryCreateHardLink(It.IsAny<string>(), It.IsAny<string>()))
.Returns(false);
}
@ -771,7 +771,7 @@ namespace NzbDrone.Common.Test.DiskTests
CollectionAssert.AreEquivalent(sourceFiles, destFiles);
}
private void VerifyDeletedFile(String filePath)
private void VerifyDeletedFile(string filePath)
{
var path = filePath;

View File

@ -121,7 +121,7 @@ namespace NzbDrone.Common.Test.Http
}
[TestCase("Accept", "text/xml, text/rss+xml, application/rss+xml")]
public void should_send_headers(String header, String value)
public void should_send_headers(string header, string value)
{
var request = new HttpRequest("http://eu.httpbin.org/get");
request.Headers.Add(header, value);

View File

@ -39,7 +39,7 @@ namespace NzbDrone.Common.Test.InstrumentationTests
// BroadcastheNet
[TestCase(@"method: ""getTorrents"", ""params"": [ ""mySecret"",")]
[TestCase(@"""DownloadURL"":""https:\/\/broadcasthe.net\/torrents.php?action=download&id=123&authkey=mySecret&torrent_pass=mySecret""")]
public void should_clean_message(String message)
public void should_clean_message(string message)
{
var cleansedMessage = CleanseLogMessage.Cleanse(message);

View File

@ -21,7 +21,7 @@ namespace NzbDrone.Common.Test
[TestCase("Agents of cracked", "Agents of shield", 6)]
[TestCase("ABCxxx", "ABC1xx", 1)]
[TestCase("ABC1xx", "ABCxxx", 1)]
public void LevenshteinDistance(String text, String other, Int32 expected)
public void LevenshteinDistance(string text, string other, int expected)
{
text.LevenshteinDistance(other).Should().Be(expected);
}
@ -39,7 +39,7 @@ namespace NzbDrone.Common.Test
[TestCase("Agents of shield", "the shield", 24)]
[TestCase("ABCxxx", "ABC1xx", 3)]
[TestCase("ABC1xx", "ABCxxx", 3)]
public void LevenshteinDistanceClean(String text, String other, Int32 expected)
public void LevenshteinDistanceClean(string text, string other, int expected)
{
text.ToLower().LevenshteinDistanceClean(other.ToLower()).Should().Be(expected);
}

View File

@ -24,7 +24,7 @@ namespace NzbDrone.Common.Test
[TestCase("/rooted/linux/path", OsPathKind.Unix)]
[TestCase("/", OsPathKind.Unix)]
[TestCase("linux/path", OsPathKind.Unix)]
public void should_auto_detect_kind(String path, OsPathKind kind)
public void should_auto_detect_kind(string path, OsPathKind kind)
{
var result = new OsPath(path);
@ -62,7 +62,7 @@ namespace NzbDrone.Common.Test
[TestCase("/rooted/linux/path", "/rooted/linux/")]
[TestCase("/rooted", "/")]
[TestCase("/", null)]
public void should_return_parent_directory(String path, String expectedParent)
public void should_return_parent_directory(string path, string expectedParent)
{
var osPath = new OsPath(path);
@ -83,7 +83,7 @@ namespace NzbDrone.Common.Test
[TestCase(@"\\blaat")]
[TestCase("/rooted/linux/path")]
[TestCase("/")]
public void should_detect_rooted_ospaths(String path)
public void should_detect_rooted_ospaths(string path)
{
var osPath = new OsPath(path);
@ -94,7 +94,7 @@ namespace NzbDrone.Common.Test
[TestCase(@"rooted\windows\path")]
[TestCase(@"path")]
[TestCase("linux/path")]
public void should_detect_unrooted_ospaths(String path)
public void should_detect_unrooted_ospaths(string path)
{
var osPath = new OsPath(path);
@ -110,7 +110,7 @@ namespace NzbDrone.Common.Test
[TestCase(@"rooted\windows\path", "path")]
[TestCase(@"path", "path")]
[TestCase("linux/path", "path")]
public void should_return_filename(String path, String expectedFilePath)
public void should_return_filename(string path, string expectedFilePath)
{
var osPath = new OsPath(path);
@ -154,7 +154,7 @@ namespace NzbDrone.Common.Test
[TestCase(@"/Test/", @"sub/test/", @"/Test/sub/test/")]
[TestCase(@"/Test/", @"/Test2/", @"/Test2/")]
[TestCase(@"C:\Test", "", @"C:\Test")]
public void should_combine_path(String left, String right, String expectedResult)
public void should_combine_path(string left, string right, string expectedResult)
{
var osPathLeft = new OsPath(left);
var osPathRight = new OsPath(right);
@ -197,7 +197,7 @@ namespace NzbDrone.Common.Test
[TestCase(@"C:\Test\Data\", @"C:\Test\Data\Sub\Folder", @"Sub\Folder")]
[TestCase(@"C:\Test\Data\", @"C:\Test\Data2\Sub\Folder", @"..\Data2\Sub\Folder")]
[TestCase(@"/parent/folder", @"/parent/folder/Sub/Folder", @"Sub/Folder")]
public void should_create_relative_path(String parent, String child, String expected)
public void should_create_relative_path(string parent, string child, string expected)
{
var left = new OsPath(child);
var right = new OsPath(parent);
@ -220,7 +220,7 @@ namespace NzbDrone.Common.Test
[TestCase(@"C:\Test\", @"C:\Test", true)]
[TestCase(@"C:\Test\", @"C:\Test\Contains\", true)]
[TestCase(@"C:\Test\", @"C:\Other\", false)]
public void should_evaluate_contains(String parent, String child, Boolean expectedResult)
public void should_evaluate_contains(string parent, string child, bool expectedResult)
{
var left = new OsPath(parent);
var right = new OsPath(child);

View File

@ -75,7 +75,7 @@ namespace NzbDrone.Common
{
continue; // Ignore directories
}
String entryFileName = zipEntry.Name;
string entryFileName = zipEntry.Name;
// to remove the folder from the entry:- entryFileName = Path.GetFileName(entryFileName);
// Optionally match entrynames against a selection list here to skip as desired.
// The unpacked length is available in the zipEntry.Size property.
@ -84,7 +84,7 @@ namespace NzbDrone.Common
Stream zipStream = zipFile.GetInputStream(zipEntry);
// Manipulate the output filename here as desired.
String fullZipToPath = Path.Combine(destination, entryFileName);
string fullZipToPath = Path.Combine(destination, entryFileName);
string directoryName = Path.GetDirectoryName(fullZipToPath);
if (directoryName.Length > 0)
Directory.CreateDirectory(directoryName);

View File

@ -9,7 +9,7 @@ namespace NzbDrone.Common
public static byte[] FromBase32String(string str)
{
int numBytes = str.Length * 5 / 8;
byte[] bytes = new Byte[numBytes];
byte[] bytes = new byte[numBytes];
// all UPPERCASE chars
str = str.ToUpper();

View File

@ -13,8 +13,8 @@ namespace NzbDrone.Common.Disk
{
public interface IDiskTransferService
{
TransferMode TransferFolder(String sourcePath, String targetPath, TransferMode mode, bool verified = true);
TransferMode TransferFile(String sourcePath, String targetPath, TransferMode mode, bool overwrite = false, bool verified = true);
TransferMode TransferFolder(string sourcePath, string targetPath, TransferMode mode, bool verified = true);
TransferMode TransferFile(string sourcePath, string targetPath, TransferMode mode, bool overwrite = false, bool verified = true);
}
public enum DiskTransferVerificationMode
@ -26,7 +26,7 @@ namespace NzbDrone.Common.Disk
public class DiskTransferService : IDiskTransferService
{
private const Int32 RetryCount = 2;
private const int RetryCount = 2;
private readonly IDiskProvider _diskProvider;
private readonly Logger _logger;
@ -43,7 +43,7 @@ namespace NzbDrone.Common.Disk
VerificationMode = OsInfo.IsWindows ? DiskTransferVerificationMode.VerifyOnly : DiskTransferVerificationMode.Transactional;
}
public TransferMode TransferFolder(String sourcePath, String targetPath, TransferMode mode, bool verified = true)
public TransferMode TransferFolder(string sourcePath, string targetPath, TransferMode mode, bool verified = true)
{
Ensure.That(sourcePath, () => sourcePath).IsValidPath();
Ensure.That(targetPath, () => targetPath).IsValidPath();
@ -80,7 +80,7 @@ namespace NzbDrone.Common.Disk
return result;
}
public TransferMode TransferFile(String sourcePath, String targetPath, TransferMode mode, bool overwrite = false, bool verified = true)
public TransferMode TransferFile(string sourcePath, string targetPath, TransferMode mode, bool overwrite = false, bool verified = true)
{
Ensure.That(sourcePath, () => sourcePath).IsValidPath();
Ensure.That(targetPath, () => targetPath).IsValidPath();
@ -165,7 +165,7 @@ namespace NzbDrone.Common.Disk
}
}
throw new IOException(String.Format("Failed to completely transfer [{0}] to [{1}], aborting.", sourcePath, targetPath));
throw new IOException(string.Format("Failed to completely transfer [{0}] to [{1}], aborting.", sourcePath, targetPath));
}
else if (VerificationMode == DiskTransferVerificationMode.VerifyOnly)
{
@ -231,7 +231,7 @@ namespace NzbDrone.Common.Disk
return TransferMode.None;
}
private void ClearTargetPath(String targetPath, bool overwrite)
private void ClearTargetPath(string targetPath, bool overwrite)
{
if (_diskProvider.FileExists(targetPath))
{
@ -310,7 +310,7 @@ namespace NzbDrone.Common.Disk
Thread.Sleep(3000);
}
private Boolean TryCopyFile(String sourcePath, String targetPath)
private bool TryCopyFile(string sourcePath, string targetPath)
{
var originalSize = _diskProvider.GetFileSize(sourcePath);
@ -361,7 +361,7 @@ namespace NzbDrone.Common.Disk
return false;
}
private Boolean TryMoveFile(String sourcePath, String targetPath)
private bool TryMoveFile(string sourcePath, string targetPath)
{
var originalSize = _diskProvider.GetFileSize(sourcePath);
@ -396,7 +396,7 @@ namespace NzbDrone.Common.Disk
_diskProvider.MoveFile(tempTargetPath, targetPath);
if (_diskProvider.FileExists(tempTargetPath))
{
throw new IOException(String.Format("Temporary file '{0}' still exists, aborting.", tempTargetPath));
throw new IOException(string.Format("Temporary file '{0}' still exists, aborting.", tempTargetPath));
}
_logger.Trace("Hardlink move succeeded, deleting source.");
_diskProvider.DeleteFile(sourcePath);

View File

@ -165,7 +165,7 @@ namespace NzbDrone.Common.Disk
return driveInfo.Name;
}
return String.Format("{0} ({1})", driveInfo.Name, driveInfo.VolumeLabel);
return string.Format("{0} ({1})", driveInfo.Name, driveInfo.VolumeLabel);
}
private string GetParent(string path)
@ -186,7 +186,7 @@ namespace NzbDrone.Common.Disk
if (!path.Equals("/"))
{
return String.Empty;
return string.Empty;
}
return null;

View File

@ -5,7 +5,7 @@ namespace NzbDrone.Common.Disk
{
public class FileSystemResult
{
public String Parent { get; set; }
public string Parent { get; set; }
public List<FileSystemModel> Directories { get; set; }
public List<FileSystemModel> Files { get; set; }

View File

@ -7,15 +7,15 @@ namespace NzbDrone.Common.Disk
{
public struct OsPath : IEquatable<OsPath>
{
private readonly String _path;
private readonly string _path;
private readonly OsPathKind _kind;
public OsPath(String path)
public OsPath(string path)
{
if (path == null)
{
_kind = OsPathKind.Unknown;
_path = String.Empty;
_path = string.Empty;
}
else
{
@ -24,12 +24,12 @@ namespace NzbDrone.Common.Disk
}
}
public OsPath(String path, OsPathKind kind)
public OsPath(string path, OsPathKind kind)
{
if (path == null)
{
_kind = kind;
_path = String.Empty;
_path = string.Empty;
}
else
{
@ -38,7 +38,7 @@ namespace NzbDrone.Common.Disk
}
}
private static OsPathKind DetectPathKind(String path)
private static OsPathKind DetectPathKind(string path)
{
if (path.StartsWith("/"))
{
@ -55,7 +55,7 @@ namespace NzbDrone.Common.Disk
return OsPathKind.Unknown;
}
private static String FixSlashes(String path, OsPathKind kind)
private static string FixSlashes(string path, OsPathKind kind)
{
switch (kind)
{
@ -73,17 +73,17 @@ namespace NzbDrone.Common.Disk
get { return _kind; }
}
public Boolean IsWindowsPath
public bool IsWindowsPath
{
get { return _kind == OsPathKind.Windows; }
}
public Boolean IsUnixPath
public bool IsUnixPath
{
get { return _kind == OsPathKind.Unix; }
}
public Boolean IsEmpty
public bool IsEmpty
{
get
{
@ -91,7 +91,7 @@ namespace NzbDrone.Common.Disk
}
}
public Boolean IsRooted
public bool IsRooted
{
get
{
@ -123,7 +123,7 @@ namespace NzbDrone.Common.Disk
}
}
public String FullPath
public string FullPath
{
get
{
@ -131,7 +131,7 @@ namespace NzbDrone.Common.Disk
}
}
public String FileName
public string FileName
{
get
{
@ -153,7 +153,7 @@ namespace NzbDrone.Common.Disk
}
}
private Int32 GetFileNameIndex()
private int GetFileNameIndex()
{
if (_path.Length < 2)
{
@ -180,30 +180,30 @@ namespace NzbDrone.Common.Disk
return index;
}
private String[] GetFragments()
private string[] GetFragments()
{
return _path.Split(new char[] { '\\', '/' }, StringSplitOptions.RemoveEmptyEntries);
}
public override String ToString()
public override string ToString()
{
return _path;
}
public override Int32 GetHashCode()
public override int GetHashCode()
{
return _path.ToLowerInvariant().GetHashCode();
}
public override Boolean Equals(Object obj)
public override bool Equals(object obj)
{
if (obj is OsPath)
{
return Equals((OsPath)obj);
}
if (obj is String)
if (obj is string)
{
return Equals(new OsPath(obj as String));
return Equals(new OsPath(obj as string));
}
return false;
}
@ -225,7 +225,7 @@ namespace NzbDrone.Common.Disk
return this;
}
public Boolean Contains(OsPath other)
public bool Contains(OsPath other)
{
if (!IsRooted || !other.IsRooted)
{
@ -244,7 +244,7 @@ namespace NzbDrone.Common.Disk
for (int i = 0; i < leftFragments.Length; i++)
{
if (!String.Equals(leftFragments[i], rightFragments[i], stringComparison))
if (!string.Equals(leftFragments[i], rightFragments[i], stringComparison))
{
return false;
}
@ -253,7 +253,7 @@ namespace NzbDrone.Common.Disk
return true;
}
public Boolean Equals(OsPath other)
public bool Equals(OsPath other)
{
if (ReferenceEquals(other, null)) return false;
@ -267,19 +267,19 @@ namespace NzbDrone.Common.Disk
if (Kind == OsPathKind.Windows || other.Kind == OsPathKind.Windows)
{
return String.Equals(left, right, StringComparison.InvariantCultureIgnoreCase);
return string.Equals(left, right, StringComparison.InvariantCultureIgnoreCase);
}
return String.Equals(left, right, StringComparison.InvariantCulture);
return string.Equals(left, right, StringComparison.InvariantCulture);
}
public static Boolean operator ==(OsPath left, OsPath right)
public static bool operator ==(OsPath left, OsPath right)
{
if (ReferenceEquals(left, null)) return ReferenceEquals(right, null);
return left.Equals(right);
}
public static Boolean operator !=(OsPath left, OsPath right)
public static bool operator !=(OsPath left, OsPath right)
{
if (ReferenceEquals(left, null)) return !ReferenceEquals(right, null);
@ -290,7 +290,7 @@ namespace NzbDrone.Common.Disk
{
if (left.Kind != right.Kind && right.Kind != OsPathKind.Unknown)
{
throw new Exception(String.Format("Cannot combine OsPaths of different platforms ('{0}' + '{1}')", left, right));
throw new Exception(string.Format("Cannot combine OsPaths of different platforms ('{0}' + '{1}')", left, right));
}
if (right.IsEmpty)
@ -305,16 +305,16 @@ namespace NzbDrone.Common.Disk
if (left.Kind == OsPathKind.Windows || right.Kind == OsPathKind.Windows)
{
return new OsPath(String.Join("\\", left._path.TrimEnd('\\'), right._path.TrimStart('\\')), OsPathKind.Windows);
return new OsPath(string.Join("\\", left._path.TrimEnd('\\'), right._path.TrimStart('\\')), OsPathKind.Windows);
}
if (left.Kind == OsPathKind.Unix || right.Kind == OsPathKind.Unix)
{
return new OsPath(String.Join("/", left._path.TrimEnd('/'), right._path), OsPathKind.Unix);
return new OsPath(string.Join("/", left._path.TrimEnd('/'), right._path), OsPathKind.Unix);
}
return new OsPath(String.Join("/", left._path, right._path), OsPathKind.Unknown);
return new OsPath(string.Join("/", left._path, right._path), OsPathKind.Unknown);
}
public static OsPath operator +(OsPath left, String right)
public static OsPath operator +(OsPath left, string right)
{
return left + new OsPath(right);
}
@ -334,7 +334,7 @@ namespace NzbDrone.Common.Disk
int i;
for (i = 0; i < leftFragments.Length && i < rightFragments.Length; i++)
{
if (!String.Equals(leftFragments[i], rightFragments[i], stringComparison))
if (!string.Equals(leftFragments[i], rightFragments[i], stringComparison))
{
break;
}
@ -345,7 +345,7 @@ namespace NzbDrone.Common.Disk
return right;
}
var newFragments = new List<String>();
var newFragments = new List<string>();
for (int j = i; j < rightFragments.Length; j++)
{
@ -359,14 +359,14 @@ namespace NzbDrone.Common.Disk
if (left.FullPath.EndsWith("\\") || left.FullPath.EndsWith("/"))
{
newFragments.Add(String.Empty);
newFragments.Add(string.Empty);
}
if (left.Kind == OsPathKind.Windows || right.Kind == OsPathKind.Windows)
{
return new OsPath(String.Join("\\", newFragments), OsPathKind.Unknown);
return new OsPath(string.Join("\\", newFragments), OsPathKind.Unknown);
}
return new OsPath(String.Join("/", newFragments), OsPathKind.Unknown);
return new OsPath(string.Join("/", newFragments), OsPathKind.Unknown);
}
}

View File

@ -45,6 +45,6 @@ namespace NzbDrone.Common.EnvironmentInfo
public string StartUpFolder { get; private set; }
public String TempFolder { get; private set; }
public string TempFolder { get; private set; }
}
}

View File

@ -4,13 +4,13 @@ namespace NzbDrone.Common.EnvironmentInfo
{
public interface IRuntimeInfo
{
Boolean IsUserInteractive { get; }
Boolean IsAdmin { get; }
Boolean IsWindowsService { get; }
Boolean IsConsole { get; }
Boolean IsRunning { get; set; }
Boolean RestartPending { get; set; }
String ExecutingApplication { get; }
String RuntimeVersion { get; }
bool IsUserInteractive { get; }
bool IsAdmin { get; }
bool IsWindowsService { get; }
bool IsConsole { get; }
bool IsRunning { get; set; }
bool RestartPending { get; set; }
string ExecutingApplication { get; }
string RuntimeVersion { get; }
}
}

View File

@ -362,7 +362,7 @@ namespace NzbDrone.Common.Exceptron.fastJSON
bool found = d.TryGetValue("$type", out tn);
#if !SILVERLIGHT
if (found == false && type == typeof(Object))
if (found == false && type == typeof(object))
{
return CreateDataset(d, globaltypes);
}

View File

@ -339,7 +339,7 @@ namespace NzbDrone.Common.Exceptron.fastJSON
if (o != null && useExtension)
{
Type tt = o.GetType();
if (tt == typeof(Object))
if (tt == typeof(object))
map.Add(p.Name, tt.ToString());
}
append = true;

View File

@ -57,7 +57,7 @@ namespace NzbDrone.Common.Expansive
foreach (var arg in args)
{
var newArg = arg;
var tokenPattern = new Regex(_patternStyle.TokenFilter(String.Join("|", tokens)));
var tokenPattern = new Regex(_patternStyle.TokenFilter(string.Join("|", tokens)));
while (tokenPattern.IsMatch(newArg))
{
foreach (Match match in tokenPattern.Matches(newArg))
@ -141,7 +141,7 @@ namespace NzbDrone.Common.Expansive
if (thisNode.CallTree.Contains(token))
throw new CircularReferenceException(string.Format("Circular Reference Detected for token '{0}'. Call Tree: {1}->{2}",
token,
String.Join("->", thisNode.CallTree.ToArray().Reverse()), token));
string.Join("->", thisNode.CallTree.ToArray().Reverse()), token));
// expand this match
var expandedValue = expansionFactory(token);

View File

@ -7,7 +7,7 @@ namespace NzbDrone.Common.Extensions
{
private static readonly string[] SizeSuffixes = { "B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB" };
public static string SizeSuffix(this Int64 bytes)
public static string SizeSuffix(this long bytes)
{
const int bytesInKb = 1024;

View File

@ -4,13 +4,13 @@ namespace NzbDrone.Common.Extensions
{
public static class LevenstheinExtensions
{
public static Int32 LevenshteinDistance(this String text, String other, Int32 costInsert = 1, Int32 costDelete = 1, Int32 costSubstitute = 1)
public static int LevenshteinDistance(this string text, string other, int costInsert = 1, int costDelete = 1, int costSubstitute = 1)
{
if (text == other) return 0;
if (text.Length == 0) return other.Length * costInsert;
if (other.Length == 0) return text.Length * costDelete;
Int32[] matrix = new Int32[other.Length + 1];
int[] matrix = new int[other.Length + 1];
for (var i = 1; i < matrix.Length; i++)
{
@ -19,13 +19,13 @@ namespace NzbDrone.Common.Extensions
for (var i = 0; i < text.Length; i++)
{
Int32 topLeft = matrix[0];
int topLeft = matrix[0];
matrix[0] = matrix[0] + costDelete;
for (var j = 0; j < other.Length; j++)
{
Int32 top = matrix[j];
Int32 left = matrix[j + 1];
int top = matrix[j];
int left = matrix[j + 1];
var sumIns = top + costInsert;
var sumDel = left + costDelete;
@ -39,7 +39,7 @@ namespace NzbDrone.Common.Extensions
return matrix[other.Length];
}
public static Int32 LevenshteinDistanceClean(this String expected, String other)
public static int LevenshteinDistanceClean(this string expected, string other)
{
expected = expected.ToLower().Replace(".", "");
other = other.ToLower().Replace(".", "");

View File

@ -45,7 +45,7 @@ namespace NzbDrone.Common.Extensions
}
if (firstPath.Equals(secondPath, comparison.Value)) return true;
return String.Equals(firstPath.CleanFilePath(), secondPath.CleanFilePath(), comparison.Value);
return string.Equals(firstPath.CleanFilePath(), secondPath.CleanFilePath(), comparison.Value);
}
public static string GetRelativePath(this string parentPath, string childPath)

View File

@ -6,11 +6,11 @@ namespace NzbDrone.Common.Extensions
{
public static class ResourceExtensions
{
public static Byte[] GetManifestResourceBytes(this Assembly assembly, String name)
public static byte[] GetManifestResourceBytes(this Assembly assembly, string name)
{
var stream = assembly.GetManifestResourceStream(name);
var result = new Byte[stream.Length];
var result = new byte[stream.Length];
var read = stream.Read(result, 0, result.Length);
if (read != result.Length)

View File

@ -21,7 +21,7 @@ namespace NzbDrone.Common.Extensions
public static string FirstCharToUpper(this string input)
{
return input.First().ToString().ToUpper() + String.Join("", input.Skip(1));
return input.First().ToString().ToUpper() + string.Join("", input.Skip(1));
}
public static string Inject(this string format, params object[] formattingArgs)
@ -70,12 +70,12 @@ namespace NzbDrone.Common.Extensions
public static bool IsNullOrWhiteSpace(this string text)
{
return String.IsNullOrWhiteSpace(text);
return string.IsNullOrWhiteSpace(text);
}
public static bool IsNotNullOrWhiteSpace(this string text)
{
return !String.IsNullOrWhiteSpace(text);
return !string.IsNullOrWhiteSpace(text);
}
public static bool ContainsIgnoreCase(this string text, string contains)

View File

@ -6,9 +6,9 @@ namespace NzbDrone.Common.Extensions
{
public static Nullable<int> ParseInt32(this string source)
{
Int32 result = 0;
int result = 0;
if (Int32.TryParse(source, out result))
if (int.TryParse(source, out result))
{
return result;
}
@ -18,9 +18,9 @@ namespace NzbDrone.Common.Extensions
public static Nullable<long> ParseInt64(this string source)
{
Int64 result = 0;
long result = 0;
if (Int64.TryParse(source, out result))
if (long.TryParse(source, out result))
{
return result;
}

View File

@ -24,7 +24,7 @@ namespace NzbDrone.Common
}
}
}
return String.Format("{0:x8}", mCrc);
return string.Format("{0:x8}", mCrc);
}
}
}

View File

@ -8,9 +8,9 @@ namespace NzbDrone.Common.Http
public static readonly HttpAccept Json = new HttpAccept("application/json");
public static readonly HttpAccept Html = new HttpAccept("text/html");
public String Value { get; private set; }
public string Value { get; private set; }
public HttpAccept(String accept)
public HttpAccept(string accept)
{
Value = accept;
}

View File

@ -239,7 +239,7 @@ namespace NzbDrone.Common.Http
}
}
Byte[] data = null;
byte[] data = null;
using (var responseStream = httpWebResponse.GetResponseStream())
{

View File

@ -24,7 +24,7 @@ namespace NzbDrone.Common.Http
public HttpProvider(Logger logger)
{
_logger = logger;
_userAgent = String.Format("Sonarr {0}", BuildInfo.Version);
_userAgent = string.Format("Sonarr {0}", BuildInfo.Version);
ServicePointManager.Expect100Continue = false;
}

View File

@ -6,7 +6,7 @@ namespace NzbDrone.Common.Http
{
public class HttpResponse
{
public HttpResponse(HttpRequest request, HttpHeader headers, Byte[] binaryData, HttpStatusCode statusCode = HttpStatusCode.OK)
public HttpResponse(HttpRequest request, HttpHeader headers, byte[] binaryData, HttpStatusCode statusCode = HttpStatusCode.OK)
{
Request = request;
Headers = headers;
@ -14,7 +14,7 @@ namespace NzbDrone.Common.Http
StatusCode = statusCode;
}
public HttpResponse(HttpRequest request, HttpHeader headers, String content, HttpStatusCode statusCode = HttpStatusCode.OK)
public HttpResponse(HttpRequest request, HttpHeader headers, string content, HttpStatusCode statusCode = HttpStatusCode.OK)
{
Request = request;
Headers = headers;
@ -26,11 +26,11 @@ namespace NzbDrone.Common.Http
public HttpRequest Request { get; private set; }
public HttpHeader Headers { get; private set; }
public HttpStatusCode StatusCode { get; private set; }
public Byte[] ResponseData { get; private set; }
public byte[] ResponseData { get; private set; }
private String _content;
private string _content;
public String Content
public string Content
{
get
{

View File

@ -7,24 +7,24 @@ namespace NzbDrone.Common.Http
{
public class JsonRpcRequestBuilder : HttpRequestBuilder
{
public String Method { get; private set; }
public List<Object> Parameters { get; private set; }
public string Method { get; private set; }
public List<object> Parameters { get; private set; }
public JsonRpcRequestBuilder(String baseUri, String method, IEnumerable<Object> parameters)
public JsonRpcRequestBuilder(string baseUri, string method, IEnumerable<object> parameters)
: base (baseUri)
{
Method = method;
Parameters = parameters.ToList();
}
public override HttpRequest Build(String path)
public override HttpRequest Build(string path)
{
var request = base.Build(path);
request.Method = HttpMethod.POST;
request.Headers.Accept = "application/json-rpc, application/json";
request.Headers.ContentType = "application/json-rpc";
var message = new Dictionary<String, Object>();
var message = new Dictionary<string, object>();
message["jsonrpc"] = "2.0";
message["method"] = Method;
message["params"] = Parameters;
@ -35,7 +35,7 @@ namespace NzbDrone.Common.Http
return request;
}
public String CreateNextId()
public string CreateNextId()
{
return Guid.NewGuid().ToString().Substring(0, 8);
}

View File

@ -4,8 +4,8 @@ namespace NzbDrone.Common.Http
{
public class JsonRpcResponse<T>
{
public String Id { get; set; }
public string Id { get; set; }
public T Result { get; set; }
public Object Error { get; set; }
public object Error { get; set; }
}
}

View File

@ -9,7 +9,7 @@ namespace NzbDrone.Common.Http
static UserAgentBuilder()
{
UserAgent = String.Format("Sonarr/{0} ({1} {2}) ",
UserAgent = string.Format("Sonarr/{0} ({1} {2}) ",
BuildInfo.Version,
OsInfo.Os, OsInfo.Version.ToString(2));
}

View File

@ -7,19 +7,19 @@ namespace NzbDrone.Common.Instrumentation.Extensions
{
public static void ProgressInfo(this Logger logger, string message, params object[] args)
{
var formattedMessage = String.Format(message, args);
var formattedMessage = string.Format(message, args);
LogProgressMessage(logger, LogLevel.Info, formattedMessage);
}
public static void ProgressDebug(this Logger logger, string message, params object[] args)
{
var formattedMessage = String.Format(message, args);
var formattedMessage = string.Format(message, args);
LogProgressMessage(logger, LogLevel.Debug, formattedMessage);
}
public static void ProgressTrace(this Logger logger, string message, params object[] args)
{
var formattedMessage = String.Format(message, args);
var formattedMessage = string.Format(message, args);
LogProgressMessage(logger, LogLevel.Trace, formattedMessage);
}

View File

@ -9,7 +9,7 @@ namespace NzbDrone.Common.Instrumentation
public static string GetHash(this LogEventInfo logEvent)
{
var stackString = logEvent.StackTrace.ToJson();
var hashSeed = String.Concat(logEvent.LoggerName, logEvent.Exception.GetType().ToString(), stackString, logEvent.Level);
var hashSeed = string.Concat(logEvent.LoggerName, logEvent.Exception.GetType().ToString(), stackString, logEvent.Level);
return HashUtil.CalculateCrc(hashSeed);
}
@ -21,7 +21,7 @@ namespace NzbDrone.Common.Instrumentation
{
if (logEvent.Exception != null)
{
if (String.IsNullOrWhiteSpace(message))
if (string.IsNullOrWhiteSpace(message))
{
message = logEvent.Exception.Message;
}

View File

@ -5,7 +5,7 @@ using NzbDrone.Common.Extensions;
namespace NzbDrone.Common
{
public class PathEqualityComparer : IEqualityComparer<String>
public class PathEqualityComparer : IEqualityComparer<string>
{
public static readonly PathEqualityComparer Instance = new PathEqualityComparer();

View File

@ -17,7 +17,7 @@ namespace NzbDrone.Common.Processes
public override string ToString()
{
return String.Format("{0} - {1} - {2}", Time, Level, Content);
return string.Format("{0} - {1} - {2}", Time, Level, Content);
}
}

View File

@ -23,8 +23,8 @@ namespace NzbDrone.Common.Processes
void SetPriority(int processId, ProcessPriorityClass priority);
void KillAll(string processName);
void Kill(int processId);
Boolean Exists(int processId);
Boolean Exists(string processName);
bool Exists(int processId);
bool Exists(string processName);
ProcessPriorityClass GetCurrentProcessPriority();
Process Start(string path, string args = null, StringDictionary environmentVariables = null, Action<string> onOutputDataReceived = null, Action<string> onErrorDataReceived = null);
Process SpawnNewProcess(string path, string args = null, StringDictionary environmentVariables = null);
@ -58,7 +58,7 @@ namespace NzbDrone.Common.Processes
return GetProcessById(processId) != null;
}
public Boolean Exists(string processName)
public bool Exists(string processName)
{
return GetProcessesByName(processName).Any();
}
@ -342,7 +342,7 @@ namespace NzbDrone.Common.Processes
private string GetMonoArgs(string path, string args)
{
return String.Format("--debug {0} {1}", path, args);
return string.Format("--debug {0} {1}", path, args);
}
}
}

View File

@ -35,7 +35,7 @@ namespace NzbDrone.Common.Reflection
|| type == typeof(string)
|| type == typeof(DateTime)
|| type == typeof(Version)
|| type == typeof(Decimal);
|| type == typeof(decimal);
}
public static bool IsReadable(this PropertyInfo propertyInfo)
@ -54,7 +54,7 @@ namespace NzbDrone.Common.Reflection
if (attribute == null && isRequired)
{
throw new ArgumentException(String.Format("The {0} attribute must be defined on member {1}", typeof(T).Name, member.Name));
throw new ArgumentException(string.Format("The {0} attribute must be defined on member {1}", typeof(T).Name, member.Name));
}
return (T)attribute;

View File

@ -23,7 +23,7 @@ namespace NzbDrone.Common.Serializer
{
throw new JsonSerializationException("Can't convert type " + existingValue.GetType().FullName + " to number");
}
if (objectType == typeof(Int64))
if (objectType == typeof(long))
{
return Convert.ToInt64(reader.Value);
}
@ -33,7 +33,7 @@ namespace NzbDrone.Common.Serializer
public override bool CanConvert(Type objectType)
{
return objectType == typeof(Int32) || objectType == typeof(Int64) || objectType == typeof(int);
return objectType == typeof(int) || objectType == typeof(long) || objectType == typeof(int);
}
}
}

View File

@ -42,7 +42,7 @@ namespace NzbDrone.Common
_logger.Debug("Checking if service {0} exists.", name);
return
ServiceController.GetServices().Any(
s => String.Equals(s.ServiceName, name, StringComparison.InvariantCultureIgnoreCase));
s => string.Equals(s.ServiceName, name, StringComparison.InvariantCultureIgnoreCase));
}
public virtual bool IsServiceRunning(string name)
@ -50,7 +50,7 @@ namespace NzbDrone.Common
_logger.Debug("Checking if '{0}' service is running", name);
var service = ServiceController.GetServices()
.SingleOrDefault(s => String.Equals(s.ServiceName, name, StringComparison.InvariantCultureIgnoreCase));
.SingleOrDefault(s => string.Equals(s.ServiceName, name, StringComparison.InvariantCultureIgnoreCase));
return service != null && (
service.Status != ServiceControllerStatus.Stopped ||
@ -72,7 +72,7 @@ namespace NzbDrone.Common
var serviceInstaller = new ServiceInstaller();
String[] cmdline = { @"/assemblypath=" + Process.GetCurrentProcess().MainModule.FileName };
string[] cmdline = { @"/assemblypath=" + Process.GetCurrentProcess().MainModule.FileName };
var context = new InstallContext("service_install.log", cmdline);
serviceInstaller.Context = context;
@ -112,7 +112,7 @@ namespace NzbDrone.Common
public virtual ServiceController GetService(string serviceName)
{
return ServiceController.GetServices().FirstOrDefault(c => String.Equals(c.ServiceName, serviceName, StringComparison.InvariantCultureIgnoreCase));
return ServiceController.GetServices().FirstOrDefault(c => string.Equals(c.ServiceName, serviceName, StringComparison.InvariantCultureIgnoreCase));
}
public virtual void Stop(string serviceName)
@ -185,7 +185,7 @@ namespace NzbDrone.Common
public void Restart(string serviceName)
{
var args = String.Format("/C net.exe stop \"{0}\" && net.exe start \"{0}\"", serviceName);
var args = string.Format("/C net.exe stop \"{0}\" && net.exe start \"{0}\"", serviceName);
_processProvider.Start("cmd.exe", args);
}

View File

@ -458,7 +458,7 @@ namespace TinyIoC
if (_sourceType != cacheKey._sourceType)
return false;
if (!String.Equals(_methodName, cacheKey._methodName, StringComparison.Ordinal))
if (!string.Equals(_methodName, cacheKey._methodName, StringComparison.Ordinal))
return false;
if (_genericTypes.Length != cacheKey._genericTypes.Length)
@ -532,12 +532,12 @@ namespace TinyIoC
private const string ERROR_TEXT = "Unable to resolve type: {0}";
public TinyIoCResolutionException(Type type)
: base(String.Format(ERROR_TEXT, type.FullName))
: base(string.Format(ERROR_TEXT, type.FullName))
{
}
public TinyIoCResolutionException(Type type, Exception innerException)
: base(String.Format(ERROR_TEXT, type.FullName), innerException)
: base(string.Format(ERROR_TEXT, type.FullName), innerException)
{
}
}
@ -547,12 +547,12 @@ namespace TinyIoC
private const string REGISTER_ERROR_TEXT = "Cannot register type {0} - abstract classes or interfaces are not valid implementation types for {1}.";
public TinyIoCRegistrationTypeException(Type type, string factory)
: base(String.Format(REGISTER_ERROR_TEXT, type.FullName, factory))
: base(string.Format(REGISTER_ERROR_TEXT, type.FullName, factory))
{
}
public TinyIoCRegistrationTypeException(Type type, string factory, Exception innerException)
: base(String.Format(REGISTER_ERROR_TEXT, type.FullName, factory), innerException)
: base(string.Format(REGISTER_ERROR_TEXT, type.FullName, factory), innerException)
{
}
}
@ -563,22 +563,22 @@ namespace TinyIoC
private const string GENERIC_CONSTRAINT_ERROR_TEXT = "Type {1} is not valid for a registration of type {0}";
public TinyIoCRegistrationException(Type type, string method)
: base(String.Format(CONVERT_ERROR_TEXT, type.FullName, method))
: base(string.Format(CONVERT_ERROR_TEXT, type.FullName, method))
{
}
public TinyIoCRegistrationException(Type type, string method, Exception innerException)
: base(String.Format(CONVERT_ERROR_TEXT, type.FullName, method), innerException)
: base(string.Format(CONVERT_ERROR_TEXT, type.FullName, method), innerException)
{
}
public TinyIoCRegistrationException(Type registerType, Type implementationType)
: base(String.Format(GENERIC_CONSTRAINT_ERROR_TEXT, registerType.FullName, implementationType.FullName))
: base(string.Format(GENERIC_CONSTRAINT_ERROR_TEXT, registerType.FullName, implementationType.FullName))
{
}
public TinyIoCRegistrationException(Type registerType, Type implementationType, Exception innerException)
: base(String.Format(GENERIC_CONSTRAINT_ERROR_TEXT, registerType.FullName, implementationType.FullName), innerException)
: base(string.Format(GENERIC_CONSTRAINT_ERROR_TEXT, registerType.FullName, implementationType.FullName), innerException)
{
}
}
@ -588,12 +588,12 @@ namespace TinyIoC
private const string ERROR_TEXT = "Unable to instantiate {0} - referenced object has been reclaimed";
public TinyIoCWeakReferenceException(Type type)
: base(String.Format(ERROR_TEXT, type.FullName))
: base(string.Format(ERROR_TEXT, type.FullName))
{
}
public TinyIoCWeakReferenceException(Type type, Exception innerException)
: base(String.Format(ERROR_TEXT, type.FullName), innerException)
: base(string.Format(ERROR_TEXT, type.FullName), innerException)
{
}
}
@ -603,12 +603,12 @@ namespace TinyIoC
private const string ERROR_TEXT = "Unable to resolve constructor for {0} using provided Expression.";
public TinyIoCConstructorResolutionException(Type type)
: base(String.Format(ERROR_TEXT, type.FullName))
: base(string.Format(ERROR_TEXT, type.FullName))
{
}
public TinyIoCConstructorResolutionException(Type type, Exception innerException)
: base(String.Format(ERROR_TEXT, type.FullName), innerException)
: base(string.Format(ERROR_TEXT, type.FullName), innerException)
{
}
@ -628,12 +628,12 @@ namespace TinyIoC
private const string ERROR_TEXT = "Duplicate implementation of type {0} found ({1}).";
public TinyIoCAutoRegistrationException(Type registerType, IEnumerable<Type> types)
: base(String.Format(ERROR_TEXT, registerType, GetTypesString(types)))
: base(string.Format(ERROR_TEXT, registerType, GetTypesString(types)))
{
}
public TinyIoCAutoRegistrationException(Type registerType, IEnumerable<Type> types, Exception innerException)
: base(String.Format(ERROR_TEXT, registerType, GetTypesString(types)), innerException)
: base(string.Format(ERROR_TEXT, registerType, GetTypesString(types)), innerException)
{
}
@ -949,7 +949,7 @@ namespace TinyIoC
if (lifetimeProvider == null)
throw new ArgumentNullException("lifetimeProvider", "lifetimeProvider is null.");
if (String.IsNullOrEmpty(errorString))
if (string.IsNullOrEmpty(errorString))
throw new ArgumentException("errorString is null or empty.", "errorString");
var currentFactory = instance._Container.GetCurrentFactory(instance._Registration);
@ -1421,7 +1421,7 @@ namespace TinyIoC
//#else
if (!registrationType.IsAssignableFrom(type))
//#endif
throw new ArgumentException(String.Format("types: The type {0} is not assignable from {1}", registrationType.FullName, type.FullName));
throw new ArgumentException(string.Format("types: The type {0} is not assignable from {1}", registrationType.FullName, type.FullName));
if (implementationTypes.Count() != implementationTypes.Distinct().Count())
{
@ -3007,7 +3007,7 @@ namespace TinyIoC
Type = type;
Name = name;
_hashCode = String.Concat(Type.FullName, "|", Name).GetHashCode();
_hashCode = string.Concat(Type.FullName, "|", Name).GetHashCode();
}
public override bool Equals(object obj)
@ -3020,7 +3020,7 @@ namespace TinyIoC
if (Type != typeRegistration.Type)
return false;
if (String.Compare(Name, typeRegistration.Name, StringComparison.Ordinal) != 0)
if (string.Compare(Name, typeRegistration.Name, StringComparison.Ordinal) != 0)
return false;
return true;
@ -3240,11 +3240,11 @@ namespace TinyIoC
// Fail if requesting named resolution and settings set to fail if unresolved
// Or bubble up if we have a parent
if (!String.IsNullOrEmpty(name) && options.NamedResolutionFailureAction == NamedResolutionFailureActions.Fail)
if (!string.IsNullOrEmpty(name) && options.NamedResolutionFailureAction == NamedResolutionFailureActions.Fail)
return (_Parent != null) ? _Parent.CanResolveInternal(registration, parameters, options) : false;
// Attemped unnamed fallback container resolution if relevant and requested
if (!String.IsNullOrEmpty(name) && options.NamedResolutionFailureAction == NamedResolutionFailureActions.AttemptUnnamedResolution)
if (!string.IsNullOrEmpty(name) && options.NamedResolutionFailureAction == NamedResolutionFailureActions.AttemptUnnamedResolution)
{
if (_RegisteredTypes.TryGetValue(new TypeRegistration(checkType), out factory))
{
@ -3311,7 +3311,7 @@ namespace TinyIoC
//#if NETFX_CORE
// if ((genericType == typeof(Func<,,>) && type.GetTypeInfo().GenericTypeArguments[0] == typeof(string) && type.GetTypeInfo().GenericTypeArguments[1] == typeof(IDictionary<String, object>)))
//#else
if ((genericType == typeof(Func<,,>) && type.GetGenericArguments()[0] == typeof(string) && type.GetGenericArguments()[1] == typeof(IDictionary<String, object>)))
if ((genericType == typeof(Func<,,>) && type.GetGenericArguments()[0] == typeof(string) && type.GetGenericArguments()[1] == typeof(IDictionary<string, object>)))
//#endif
return true;
@ -3397,11 +3397,11 @@ namespace TinyIoC
}
// Fail if requesting named resolution and settings set to fail if unresolved
if (!String.IsNullOrEmpty(registration.Name) && options.NamedResolutionFailureAction == NamedResolutionFailureActions.Fail)
if (!string.IsNullOrEmpty(registration.Name) && options.NamedResolutionFailureAction == NamedResolutionFailureActions.Fail)
throw new TinyIoCResolutionException(registration.Type);
// Attemped unnamed fallback container resolution if relevant and requested
if (!String.IsNullOrEmpty(registration.Name) && options.NamedResolutionFailureAction == NamedResolutionFailureActions.AttemptUnnamedResolution)
if (!string.IsNullOrEmpty(registration.Name) && options.NamedResolutionFailureAction == NamedResolutionFailureActions.AttemptUnnamedResolution)
{
if (_RegisteredTypes.TryGetValue(new TypeRegistration(registration.Type, string.Empty), out factory))
{
@ -3479,11 +3479,11 @@ namespace TinyIoC
//#if NETFX_CORE
// MethodInfo resolveMethod = typeof(TinyIoCContainer).GetTypeInfo().GetDeclaredMethods("Resolve").First(mi => mi.GetParameters().Length == 1 && mi.GetParameters()[0].GetType() == typeof(String));
//#else
MethodInfo resolveMethod = typeof(TinyIoCContainer).GetMethod("Resolve", new Type[] { typeof(String) });
MethodInfo resolveMethod = typeof(TinyIoCContainer).GetMethod("Resolve", new Type[] { typeof(string) });
//#endif
resolveMethod = resolveMethod.MakeGenericMethod(returnType);
ParameterExpression[] resolveParameters = new ParameterExpression[] { Expression.Parameter(typeof(String), "name") };
ParameterExpression[] resolveParameters = new ParameterExpression[] { Expression.Parameter(typeof(string), "name") };
var resolveCall = Expression.Call(Expression.Constant(this), resolveMethod, resolveParameters);
var resolveLambda = Expression.Lambda(resolveCall, resolveParameters).Compile();
@ -3506,7 +3506,7 @@ namespace TinyIoC
//#if NETFX_CORE
// MethodInfo resolveMethod = typeof(TinyIoCContainer).GetTypeInfo().GetDeclaredMethods("Resolve").First(mi => mi.GetParameters().Length == 2 && mi.GetParameters()[0].GetType() == typeof(String) && mi.GetParameters()[1].GetType() == typeof(NamedParameterOverloads));
//#else
MethodInfo resolveMethod = typeof(TinyIoCContainer).GetMethod("Resolve", new Type[] { typeof(String), typeof(NamedParameterOverloads) });
MethodInfo resolveMethod = typeof(TinyIoCContainer).GetMethod("Resolve", new Type[] { typeof(string), typeof(NamedParameterOverloads) });
//#endif
resolveMethod = resolveMethod.MakeGenericMethod(returnType);

View File

@ -205,14 +205,14 @@ namespace NzbDrone.Core.Test.DataAugmentation.Scene
private void AssertNoUpdate()
{
_provider1.Verify(c => c.GetSceneMappings(), Times.Once());
Mocker.GetMock<ISceneMappingRepository>().Verify(c => c.Clear(It.IsAny<String>()), Times.Never());
Mocker.GetMock<ISceneMappingRepository>().Verify(c => c.Clear(It.IsAny<string>()), Times.Never());
Mocker.GetMock<ISceneMappingRepository>().Verify(c => c.InsertMany(_fakeMappings), Times.Never());
}
private void AssertMappingUpdated()
{
_provider1.Verify(c => c.GetSceneMappings(), Times.Once());
Mocker.GetMock<ISceneMappingRepository>().Verify(c => c.Clear(It.IsAny<String>()), Times.Once());
Mocker.GetMock<ISceneMappingRepository>().Verify(c => c.Clear(It.IsAny<string>()), Times.Once());
Mocker.GetMock<ISceneMappingRepository>().Verify(c => c.InsertMany(_fakeMappings), Times.Once());
foreach (var sceneMapping in _fakeMappings)

View File

@ -42,7 +42,7 @@ namespace NzbDrone.Core.Test.Datastore
{
MapRepository.Instance.RegisterTypeConverter(typeof(List<EmbeddedType>), new EmbeddedDocumentConverter());
MapRepository.Instance.RegisterTypeConverter(typeof(EmbeddedType), new EmbeddedDocumentConverter());
MapRepository.Instance.RegisterTypeConverter(typeof(Int32), new Int32Converter());
MapRepository.Instance.RegisterTypeConverter(typeof(int), new Int32Converter());
}

View File

@ -26,7 +26,7 @@ namespace NzbDrone.Core.Test.Datastore.SqliteSchemaDumperTests
[TestCase(@"CREATE TABLE ""Test """"Table"" (""My""""Id"" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT)", "Test \"Table", "My\"Id")]
[TestCase(@"CREATE TABLE [Test Table] ([My Id] INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT)", "Test Table", "My Id")]
[TestCase(@" CREATE TABLE `Test ``Table` ( `My`` Id` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT ) ", "Test `Table", "My` Id")]
public void should_parse_table_language_flavors(String sql, String tableName, String columnName)
public void should_parse_table_language_flavors(string sql, string tableName, string columnName)
{
var result = Subject.ReadTableSchema(sql);
@ -43,7 +43,7 @@ namespace NzbDrone.Core.Test.Datastore.SqliteSchemaDumperTests
[TestCase(@"CREATE INDEX ""Test """"Index"" ON ""TestTable"" (""My""""Id"" ASC)", "Test \"Index", "TestTable", "My\"Id")]
[TestCase(@"CREATE INDEX [Test Index] ON [TestTable] ([My Id]) ", "Test Index", "TestTable", "My Id")]
[TestCase(@" CREATE INDEX `Test ``Index` ON ""TestTable"" ( `My`` Id` ASC) ", "Test `Index", "TestTable", "My` Id")]
public void should_parse_index_language_flavors(String sql, String indexName, String tableName, String columnName)
public void should_parse_index_language_flavors(string sql, string indexName, string tableName, string columnName)
{
var result = Subject.ReadIndexSchema(sql);
@ -56,7 +56,7 @@ namespace NzbDrone.Core.Test.Datastore.SqliteSchemaDumperTests
[TestCase(@"CREATE TABLE TestTable (MyId)")]
[TestCase(@"CREATE TABLE TestTable (MyId NOT NULL PRIMARY KEY AUTOINCREMENT)")]
[TestCase("CREATE TABLE TestTable\r\n(\t`MyId`\t NOT NULL PRIMARY KEY AUTOINCREMENT\n)")]
public void should_parse_column_attributes(String sql)
public void should_parse_column_attributes(string sql)
{
var result = Subject.ReadTableSchema(sql);

View File

@ -91,14 +91,14 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
[Test]
public void should_be_false_when_existing_file_doesnt_have_a_release_group()
{
_episodeFile.ReleaseGroup = String.Empty;
_episodeFile.ReleaseGroup = string.Empty;
_subject.IsSatisfiedBy(_remoteEpisode, null).Accepted.Should().BeFalse();
}
[Test]
public void should_should_be_false_when_release_doesnt_have_a_release_group()
{
_remoteEpisode.ParsedEpisodeInfo.ReleaseGroup = String.Empty;
_remoteEpisode.ParsedEpisodeInfo.ReleaseGroup = string.Empty;
_subject.IsSatisfiedBy(_remoteEpisode, null).Accepted.Should().BeFalse();
}

View File

@ -38,7 +38,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
}
[Test, TestCaseSource("IsUpgradeTestCases")]
public void IsUpgradeTest(Quality current, Int32 currentVersion, Quality newQuality, Int32 newVersion, Quality cutoff, Boolean expected)
public void IsUpgradeTest(Quality current, int currentVersion, Quality newQuality, int newVersion, Quality cutoff, bool expected)
{
GivenAutoDownloadPropers(true);

Some files were not shown because too many files have changed in this diff Show More