diff --git a/BTCPayServer.Client/BTCPayServerClient.Authorization.cs b/BTCPayServer.Client/BTCPayServerClient.Authorization.cs index 204f9f3da..9ec8062aa 100644 --- a/BTCPayServer.Client/BTCPayServerClient.Authorization.cs +++ b/BTCPayServer.Client/BTCPayServerClient.Authorization.cs @@ -1,8 +1,5 @@ using System; using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; -using BTCPayServer.Client.Models; namespace BTCPayServer.Client { diff --git a/BTCPayServer.Client/BTCPayServerClient.Health.cs b/BTCPayServer.Client/BTCPayServerClient.Health.cs index 2a9c70833..0643b364d 100644 --- a/BTCPayServer.Client/BTCPayServerClient.Health.cs +++ b/BTCPayServer.Client/BTCPayServerClient.Health.cs @@ -1,4 +1,3 @@ -using System.Net.Http; using System.Threading; using System.Threading.Tasks; using BTCPayServer.Client.Models; diff --git a/BTCPayServer.Client/BTCPayServerClient.Lightning.Store.cs b/BTCPayServer.Client/BTCPayServerClient.Lightning.Store.cs index 0b48ce774..f07e06c47 100644 --- a/BTCPayServer.Client/BTCPayServerClient.Lightning.Store.cs +++ b/BTCPayServer.Client/BTCPayServerClient.Lightning.Store.cs @@ -4,7 +4,6 @@ using System.Net.Http; using System.Threading; using System.Threading.Tasks; using BTCPayServer.Client.Models; -using BTCPayServer.Lightning; namespace BTCPayServer.Client { diff --git a/BTCPayServer.Client/BTCPayServerClient.PullPayments.cs b/BTCPayServer.Client/BTCPayServerClient.PullPayments.cs index 32b3e6448..294c5a120 100644 --- a/BTCPayServer.Client/BTCPayServerClient.PullPayments.cs +++ b/BTCPayServer.Client/BTCPayServerClient.PullPayments.cs @@ -1,7 +1,5 @@ -using System; using System.Collections.Generic; using System.Net.Http; -using System.Text; using System.Threading; using System.Threading.Tasks; using System.Web; diff --git a/BTCPayServer.Client/BTCPayServerClient.ServerInfo.cs b/BTCPayServer.Client/BTCPayServerClient.ServerInfo.cs index eab3f4b8f..deefb5adc 100644 --- a/BTCPayServer.Client/BTCPayServerClient.ServerInfo.cs +++ b/BTCPayServer.Client/BTCPayServerClient.ServerInfo.cs @@ -1,4 +1,3 @@ -using System.Net.Http; using System.Threading; using System.Threading.Tasks; using BTCPayServer.Client.Models; diff --git a/BTCPayServer.Client/GreenFieldAPIException.cs b/BTCPayServer.Client/GreenFieldAPIException.cs index edc01a18e..c6a1d88d7 100644 --- a/BTCPayServer.Client/GreenFieldAPIException.cs +++ b/BTCPayServer.Client/GreenFieldAPIException.cs @@ -1,7 +1,4 @@ using System; -using System.Collections.Generic; -using System.Text; -using System.Xml.Linq; namespace BTCPayServer.Client { diff --git a/BTCPayServer.Client/GreenFieldValidationException.cs b/BTCPayServer.Client/GreenFieldValidationException.cs index b14375dea..6c0a67664 100644 --- a/BTCPayServer.Client/GreenFieldValidationException.cs +++ b/BTCPayServer.Client/GreenFieldValidationException.cs @@ -1,6 +1,4 @@ using System; -using System.Collections.Generic; -using System.Runtime.Serialization; using System.Text; using BTCPayServer.Client.Models; diff --git a/BTCPayServer.Client/JsonConverters/NodeUriJsonConverter.cs b/BTCPayServer.Client/JsonConverters/NodeUriJsonConverter.cs index 9e22c9eb4..c47eab9aa 100644 --- a/BTCPayServer.Client/JsonConverters/NodeUriJsonConverter.cs +++ b/BTCPayServer.Client/JsonConverters/NodeUriJsonConverter.cs @@ -1,8 +1,5 @@ using System; -using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; -using System.Text; -using BTCPayServer.Client.Models; using BTCPayServer.Lightning; using NBitcoin.JsonConverters; using Newtonsoft.Json; diff --git a/BTCPayServer.Client/JsonConverters/PermissionJsonConverter.cs b/BTCPayServer.Client/JsonConverters/PermissionJsonConverter.cs index 393d3e678..a408d56fd 100644 --- a/BTCPayServer.Client/JsonConverters/PermissionJsonConverter.cs +++ b/BTCPayServer.Client/JsonConverters/PermissionJsonConverter.cs @@ -1,7 +1,5 @@ using System; -using System.Collections.Generic; using System.Reflection; -using System.Text; using NBitcoin.JsonConverters; using Newtonsoft.Json; diff --git a/BTCPayServer.Client/JsonConverters/TimeSpanJsonConverter.cs b/BTCPayServer.Client/JsonConverters/TimeSpanJsonConverter.cs index 7087783ec..621fb783a 100644 --- a/BTCPayServer.Client/JsonConverters/TimeSpanJsonConverter.cs +++ b/BTCPayServer.Client/JsonConverters/TimeSpanJsonConverter.cs @@ -1,6 +1,4 @@ using System; -using System.Collections.Generic; -using System.Text; using NBitcoin.JsonConverters; using Newtonsoft.Json; diff --git a/BTCPayServer.Client/Models/ApprovePayoutRequest.cs b/BTCPayServer.Client/Models/ApprovePayoutRequest.cs index d88b00192..1f2191458 100644 --- a/BTCPayServer.Client/Models/ApprovePayoutRequest.cs +++ b/BTCPayServer.Client/Models/ApprovePayoutRequest.cs @@ -1,7 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Text; - namespace BTCPayServer.Client.Models { public class ApprovePayoutRequest diff --git a/BTCPayServer.Client/Models/ConnectToNodeRequest.cs b/BTCPayServer.Client/Models/ConnectToNodeRequest.cs index 1970e2b80..d877b6fa6 100644 --- a/BTCPayServer.Client/Models/ConnectToNodeRequest.cs +++ b/BTCPayServer.Client/Models/ConnectToNodeRequest.cs @@ -1,6 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Text; using BTCPayServer.Client.JsonConverters; using BTCPayServer.Lightning; using Newtonsoft.Json; diff --git a/BTCPayServer.Client/Models/CreateLightningInvoiceRequest.cs b/BTCPayServer.Client/Models/CreateLightningInvoiceRequest.cs index 0d3597aff..4282b422c 100644 --- a/BTCPayServer.Client/Models/CreateLightningInvoiceRequest.cs +++ b/BTCPayServer.Client/Models/CreateLightningInvoiceRequest.cs @@ -1,5 +1,4 @@ using System; -using System.Security.Cryptography; using BTCPayServer.Lightning; using BTCPayServer.Lightning.JsonConverters; using Newtonsoft.Json; diff --git a/BTCPayServer.Client/Models/CreatePayoutRequest.cs b/BTCPayServer.Client/Models/CreatePayoutRequest.cs index d50b225b2..d8b665b4b 100644 --- a/BTCPayServer.Client/Models/CreatePayoutRequest.cs +++ b/BTCPayServer.Client/Models/CreatePayoutRequest.cs @@ -1,6 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Text; using BTCPayServer.JsonConverters; using Newtonsoft.Json; diff --git a/BTCPayServer.Client/Models/CreatePullPaymentRequest.cs b/BTCPayServer.Client/Models/CreatePullPaymentRequest.cs index 469412940..474c35624 100644 --- a/BTCPayServer.Client/Models/CreatePullPaymentRequest.cs +++ b/BTCPayServer.Client/Models/CreatePullPaymentRequest.cs @@ -1,6 +1,4 @@ using System; -using System.Collections.Generic; -using System.Text; using BTCPayServer.Client.JsonConverters; using BTCPayServer.JsonConverters; using Newtonsoft.Json; diff --git a/BTCPayServer.Client/Models/GreenfieldAPIError.cs b/BTCPayServer.Client/Models/GreenfieldAPIError.cs index ebeb3ce34..f37f76df5 100644 --- a/BTCPayServer.Client/Models/GreenfieldAPIError.cs +++ b/BTCPayServer.Client/Models/GreenfieldAPIError.cs @@ -1,6 +1,4 @@ using System; -using System.Collections.Generic; -using System.Text; namespace BTCPayServer.Client.Models { diff --git a/BTCPayServer.Client/Models/GreenfieldValidationError.cs b/BTCPayServer.Client/Models/GreenfieldValidationError.cs index 2d35206d7..f4afaf9bf 100644 --- a/BTCPayServer.Client/Models/GreenfieldValidationError.cs +++ b/BTCPayServer.Client/Models/GreenfieldValidationError.cs @@ -1,6 +1,4 @@ using System; -using System.Collections.Generic; -using System.Text; namespace BTCPayServer.Client.Models { diff --git a/BTCPayServer.Client/Models/LightningNodeInformationData.cs b/BTCPayServer.Client/Models/LightningNodeInformationData.cs index 5617bc0b9..80ac5fa6d 100644 --- a/BTCPayServer.Client/Models/LightningNodeInformationData.cs +++ b/BTCPayServer.Client/Models/LightningNodeInformationData.cs @@ -1,8 +1,5 @@ -using System.Collections.Generic; using BTCPayServer.Client.JsonConverters; using BTCPayServer.Lightning; -using NBitcoin; -using NBitcoin.JsonConverters; using Newtonsoft.Json; namespace BTCPayServer.Client.Models diff --git a/BTCPayServer.Client/Models/PayoutData.cs b/BTCPayServer.Client/Models/PayoutData.cs index 45c55710b..ea8698bf1 100644 --- a/BTCPayServer.Client/Models/PayoutData.cs +++ b/BTCPayServer.Client/Models/PayoutData.cs @@ -1,6 +1,4 @@ using System; -using System.Collections.Generic; -using System.Text; using BTCPayServer.JsonConverters; using Newtonsoft.Json; using Newtonsoft.Json.Converters; diff --git a/BTCPayServer.Client/Models/PullPaymentBaseData.cs b/BTCPayServer.Client/Models/PullPaymentBaseData.cs index 8d95fc2f1..e9256621e 100644 --- a/BTCPayServer.Client/Models/PullPaymentBaseData.cs +++ b/BTCPayServer.Client/Models/PullPaymentBaseData.cs @@ -1,6 +1,4 @@ using System; -using System.Collections.Generic; -using System.Text; using BTCPayServer.Client.JsonConverters; using BTCPayServer.JsonConverters; using Newtonsoft.Json; diff --git a/BTCPayServer.Client/Models/StoreBaseData.cs b/BTCPayServer.Client/Models/StoreBaseData.cs index 6ba7b93d6..33cb6c00f 100644 --- a/BTCPayServer.Client/Models/StoreBaseData.cs +++ b/BTCPayServer.Client/Models/StoreBaseData.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.ComponentModel; using BTCPayServer.Client.JsonConverters; using Newtonsoft.Json; using Newtonsoft.Json.Converters; diff --git a/BTCPayServer.Common/Altcoins/BTCPayNetworkProvider.Bitcoin.cs b/BTCPayServer.Common/Altcoins/BTCPayNetworkProvider.Bitcoin.cs index 409ef5658..26bce2f00 100644 --- a/BTCPayServer.Common/Altcoins/BTCPayNetworkProvider.Bitcoin.cs +++ b/BTCPayServer.Common/Altcoins/BTCPayNetworkProvider.Bitcoin.cs @@ -1,7 +1,4 @@ -using System; using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; using NBitcoin; using NBXplorer; diff --git a/BTCPayServer.Common/Altcoins/BTCPayNetworkProvider.Bitcoinplus.cs b/BTCPayServer.Common/Altcoins/BTCPayNetworkProvider.Bitcoinplus.cs index 8daa72352..ada2627ea 100644 --- a/BTCPayServer.Common/Altcoins/BTCPayNetworkProvider.Bitcoinplus.cs +++ b/BTCPayServer.Common/Altcoins/BTCPayNetworkProvider.Bitcoinplus.cs @@ -1,7 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; using NBitcoin; using NBXplorer; diff --git a/BTCPayServer.Common/Altcoins/BTCPayNetworkProvider.Bitcore.cs b/BTCPayServer.Common/Altcoins/BTCPayNetworkProvider.Bitcore.cs index ce9de9f7e..5a4eac655 100644 --- a/BTCPayServer.Common/Altcoins/BTCPayNetworkProvider.Bitcore.cs +++ b/BTCPayServer.Common/Altcoins/BTCPayNetworkProvider.Bitcore.cs @@ -1,7 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; using NBitcoin; using NBXplorer; diff --git a/BTCPayServer.Common/Altcoins/BTCPayNetworkProvider.Dogecoin.cs b/BTCPayServer.Common/Altcoins/BTCPayNetworkProvider.Dogecoin.cs index b2b22b3c7..e76e23a81 100644 --- a/BTCPayServer.Common/Altcoins/BTCPayNetworkProvider.Dogecoin.cs +++ b/BTCPayServer.Common/Altcoins/BTCPayNetworkProvider.Dogecoin.cs @@ -1,7 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; using NBitcoin; using NBXplorer; diff --git a/BTCPayServer.Common/Altcoins/BTCPayNetworkProvider.Feathercoin.cs b/BTCPayServer.Common/Altcoins/BTCPayNetworkProvider.Feathercoin.cs index 9ed929e82..559e4f911 100644 --- a/BTCPayServer.Common/Altcoins/BTCPayNetworkProvider.Feathercoin.cs +++ b/BTCPayServer.Common/Altcoins/BTCPayNetworkProvider.Feathercoin.cs @@ -1,7 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; using NBitcoin; using NBXplorer; diff --git a/BTCPayServer.Common/Altcoins/BTCPayNetworkProvider.Groestlcoin.cs b/BTCPayServer.Common/Altcoins/BTCPayNetworkProvider.Groestlcoin.cs index 4c6a9ed70..69a650744 100644 --- a/BTCPayServer.Common/Altcoins/BTCPayNetworkProvider.Groestlcoin.cs +++ b/BTCPayServer.Common/Altcoins/BTCPayNetworkProvider.Groestlcoin.cs @@ -1,7 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; using NBitcoin; namespace BTCPayServer diff --git a/BTCPayServer.Common/Altcoins/BTCPayNetworkProvider.Litecoin.cs b/BTCPayServer.Common/Altcoins/BTCPayNetworkProvider.Litecoin.cs index 02424a312..a7bd452c5 100644 --- a/BTCPayServer.Common/Altcoins/BTCPayNetworkProvider.Litecoin.cs +++ b/BTCPayServer.Common/Altcoins/BTCPayNetworkProvider.Litecoin.cs @@ -1,7 +1,4 @@ -using System; using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; using NBitcoin; using NBXplorer; diff --git a/BTCPayServer.Common/Altcoins/BTCPayNetworkProvider.Monacoin.cs b/BTCPayServer.Common/Altcoins/BTCPayNetworkProvider.Monacoin.cs index e3ee1105b..937373e7a 100644 --- a/BTCPayServer.Common/Altcoins/BTCPayNetworkProvider.Monacoin.cs +++ b/BTCPayServer.Common/Altcoins/BTCPayNetworkProvider.Monacoin.cs @@ -1,7 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; using NBitcoin; using NBXplorer; diff --git a/BTCPayServer.Common/Altcoins/BTCPayNetworkProvider.Polis.cs b/BTCPayServer.Common/Altcoins/BTCPayNetworkProvider.Polis.cs index 598063ce7..2fbc99c56 100644 --- a/BTCPayServer.Common/Altcoins/BTCPayNetworkProvider.Polis.cs +++ b/BTCPayServer.Common/Altcoins/BTCPayNetworkProvider.Polis.cs @@ -1,7 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; using NBitcoin; using NBXplorer; diff --git a/BTCPayServer.Common/Altcoins/BTCPayNetworkProvider.Ufo.cs b/BTCPayServer.Common/Altcoins/BTCPayNetworkProvider.Ufo.cs index 70952e88b..014ec57ec 100644 --- a/BTCPayServer.Common/Altcoins/BTCPayNetworkProvider.Ufo.cs +++ b/BTCPayServer.Common/Altcoins/BTCPayNetworkProvider.Ufo.cs @@ -1,7 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; using NBitcoin; using NBXplorer; diff --git a/BTCPayServer.Common/Altcoins/BTCPayNetworkProvider.Viacoin.cs b/BTCPayServer.Common/Altcoins/BTCPayNetworkProvider.Viacoin.cs index d1f749c3e..43effbaad 100644 --- a/BTCPayServer.Common/Altcoins/BTCPayNetworkProvider.Viacoin.cs +++ b/BTCPayServer.Common/Altcoins/BTCPayNetworkProvider.Viacoin.cs @@ -1,7 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; using NBitcoin; using NBXplorer; diff --git a/BTCPayServer.Common/Altcoins/BTCPayNetworkProvider.cs b/BTCPayServer.Common/Altcoins/BTCPayNetworkProvider.cs index bf5a7b511..6456d6cfd 100644 --- a/BTCPayServer.Common/Altcoins/BTCPayNetworkProvider.cs +++ b/BTCPayServer.Common/Altcoins/BTCPayNetworkProvider.cs @@ -1,8 +1,6 @@ using System; using System.Collections.Generic; -using System.IO; using System.Linq; -using System.Threading.Tasks; using NBitcoin; using NBXplorer; @@ -10,7 +8,7 @@ namespace BTCPayServer { public partial class BTCPayNetworkProvider { - Dictionary _Networks = new Dictionary(); + readonly Dictionary _Networks = new Dictionary(); private readonly NBXplorerNetworkProvider _NBXplorerNetworkProvider; diff --git a/BTCPayServer.Common/Altcoins/Liquid/BTCPayNetworkProvider.Liquid.cs b/BTCPayServer.Common/Altcoins/Liquid/BTCPayNetworkProvider.Liquid.cs index 931ee5ee5..bef65cd3f 100644 --- a/BTCPayServer.Common/Altcoins/Liquid/BTCPayNetworkProvider.Liquid.cs +++ b/BTCPayServer.Common/Altcoins/Liquid/BTCPayNetworkProvider.Liquid.cs @@ -1,7 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; using NBitcoin; using NBitcoin.Altcoins; using NBitcoin.Altcoins.Elements; diff --git a/BTCPayServer.Common/BTCPayNetwork.cs b/BTCPayServer.Common/BTCPayNetwork.cs index 96847d8e1..155649991 100644 --- a/BTCPayServer.Common/BTCPayNetwork.cs +++ b/BTCPayServer.Common/BTCPayNetwork.cs @@ -1,12 +1,10 @@ using System; -using System.Collections; using System.Collections.Generic; using System.IO; using System.Linq; using NBitcoin; using NBXplorer; using NBXplorer.Models; -using Newtonsoft.Json; namespace BTCPayServer { @@ -33,7 +31,7 @@ namespace BTCPayServer } } - static Dictionary _Settings; + static readonly Dictionary _Settings; public static BTCPayDefaultSettings GetDefaultSettings(NetworkType chainType) { diff --git a/BTCPayServer.Common/CustomThreadPool.cs b/BTCPayServer.Common/CustomThreadPool.cs index 048444062..8117663f1 100644 --- a/BTCPayServer.Common/CustomThreadPool.cs +++ b/BTCPayServer.Common/CustomThreadPool.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Concurrent; -using System.Collections.Generic; using System.Linq; using System.Threading; using System.Threading.Tasks; @@ -9,12 +8,12 @@ namespace BTCPayServer { public class CustomThreadPool : IDisposable { - CancellationTokenSource _Cancel = new CancellationTokenSource(); - TaskCompletionSource _Exited; + readonly CancellationTokenSource _Cancel = new CancellationTokenSource(); + readonly TaskCompletionSource _Exited; int _ExitedCount = 0; - Thread[] _Threads; + readonly Thread[] _Threads; Exception _UnhandledException; - BlockingCollection<(Action, TaskCompletionSource)> _Actions = new BlockingCollection<(Action, TaskCompletionSource)>(new ConcurrentQueue<(Action, TaskCompletionSource)>()); + readonly BlockingCollection<(Action, TaskCompletionSource)> _Actions = new BlockingCollection<(Action, TaskCompletionSource)>(new ConcurrentQueue<(Action, TaskCompletionSource)>()); public CustomThreadPool(int threadCount, string threadName) { diff --git a/BTCPayServer.Common/Extensions.cs b/BTCPayServer.Common/Extensions.cs index 18cdc8027..c2d0fe45b 100644 --- a/BTCPayServer.Common/Extensions.cs +++ b/BTCPayServer.Common/Extensions.cs @@ -1,6 +1,4 @@ -using System; using System.Collections.Generic; -using System.Text; namespace BTCPayServer { diff --git a/BTCPayServer.Common/Logging/ConsoleLogger.cs b/BTCPayServer.Common/Logging/ConsoleLogger.cs index 85c31268b..def1a79f4 100644 --- a/BTCPayServer.Common/Logging/ConsoleLogger.cs +++ b/BTCPayServer.Common/Logging/ConsoleLogger.cs @@ -13,7 +13,7 @@ namespace BTCPayServer.Logging { public class CustomConsoleLogProvider : ILoggerProvider { - ConsoleLoggerProcessor _Processor; + readonly ConsoleLoggerProcessor _Processor; public CustomConsoleLogProvider(ConsoleLoggerProcessor processor) { _Processor = processor; diff --git a/BTCPayServer.Common/Logging/Logs.cs b/BTCPayServer.Common/Logging/Logs.cs index 8c87d51ae..81846a910 100644 --- a/BTCPayServer.Common/Logging/Logs.cs +++ b/BTCPayServer.Common/Logging/Logs.cs @@ -1,7 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging.Abstractions; @@ -43,7 +40,7 @@ namespace BTCPayServer.Logging public class FuncLoggerFactory : ILoggerFactory { - private Func createLogger; + private readonly Func createLogger; public FuncLoggerFactory(Func createLogger) { this.createLogger = createLogger; diff --git a/BTCPayServer.Common/Shims.cs b/BTCPayServer.Common/Shims.cs index 3d61cbfb1..b85db38f8 100644 --- a/BTCPayServer.Common/Shims.cs +++ b/BTCPayServer.Common/Shims.cs @@ -2,11 +2,8 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; -using System.Collections; -using System.Collections.Generic; using System.IO; using System.Text; -using Newtonsoft.Json; namespace Microsoft.Extensions.Logging.Console.Internal diff --git a/BTCPayServer.Common/SynchronizationContextRemover.cs b/BTCPayServer.Common/SynchronizationContextRemover.cs index 082648844..363ee2897 100644 --- a/BTCPayServer.Common/SynchronizationContextRemover.cs +++ b/BTCPayServer.Common/SynchronizationContextRemover.cs @@ -1,9 +1,6 @@ using System; -using System.Collections.Generic; -using System.Linq; using System.Runtime.CompilerServices; using System.Threading; -using System.Threading.Tasks; namespace BTCPayServer { diff --git a/BTCPayServer.Common/ZipUtils.cs b/BTCPayServer.Common/ZipUtils.cs index ba59392c5..bd41d7792 100644 --- a/BTCPayServer.Common/ZipUtils.cs +++ b/BTCPayServer.Common/ZipUtils.cs @@ -1,5 +1,3 @@ -using System; -using System.Collections.Generic; using System.IO; using System.IO.Compression; using System.Text; diff --git a/BTCPayServer.Data/Data/APIKeyData.cs b/BTCPayServer.Data/Data/APIKeyData.cs index 65922ad4e..db02b20cd 100644 --- a/BTCPayServer.Data/Data/APIKeyData.cs +++ b/BTCPayServer.Data/Data/APIKeyData.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Collections.Immutable; using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; -using System.Linq; -using System.Threading.Tasks; using Microsoft.EntityFrameworkCore; namespace BTCPayServer.Data diff --git a/BTCPayServer.Data/Data/AddressInvoiceData.cs b/BTCPayServer.Data/Data/AddressInvoiceData.cs index 079f63888..f71d338e9 100644 --- a/BTCPayServer.Data/Data/AddressInvoiceData.cs +++ b/BTCPayServer.Data/Data/AddressInvoiceData.cs @@ -1,7 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; using Microsoft.EntityFrameworkCore; namespace BTCPayServer.Data diff --git a/BTCPayServer.Data/Data/AppData.cs b/BTCPayServer.Data/Data/AppData.cs index 7754c95f9..946fa7065 100644 --- a/BTCPayServer.Data/Data/AppData.cs +++ b/BTCPayServer.Data/Data/AppData.cs @@ -1,7 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; using Microsoft.EntityFrameworkCore; using Newtonsoft.Json; diff --git a/BTCPayServer.Data/Data/ApplicationDbContextFactory.cs b/BTCPayServer.Data/Data/ApplicationDbContextFactory.cs index b5dfa5c7d..cdbcfe3ef 100644 --- a/BTCPayServer.Data/Data/ApplicationDbContextFactory.cs +++ b/BTCPayServer.Data/Data/ApplicationDbContextFactory.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using JetBrains.Annotations; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; @@ -19,8 +15,8 @@ namespace BTCPayServer.Data } public class ApplicationDbContextFactory { - string _ConnectionString; - DatabaseType _Type; + readonly string _ConnectionString; + readonly DatabaseType _Type; public ApplicationDbContextFactory(DatabaseType type, string connectionString) { _ConnectionString = connectionString ?? throw new ArgumentNullException(nameof(connectionString)); diff --git a/BTCPayServer.Data/Data/ApplicationUser.cs b/BTCPayServer.Data/Data/ApplicationUser.cs index 8d1280102..8f853392a 100644 --- a/BTCPayServer.Data/Data/ApplicationUser.cs +++ b/BTCPayServer.Data/Data/ApplicationUser.cs @@ -1,8 +1,4 @@ -using System; using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using BTCPayServer.Data; using Microsoft.AspNetCore.Identity; namespace BTCPayServer.Data diff --git a/BTCPayServer.Data/Data/HistoricalAddressInvoiceData.cs b/BTCPayServer.Data/Data/HistoricalAddressInvoiceData.cs index 65cf05de3..c77d2beac 100644 --- a/BTCPayServer.Data/Data/HistoricalAddressInvoiceData.cs +++ b/BTCPayServer.Data/Data/HistoricalAddressInvoiceData.cs @@ -1,7 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; using Microsoft.EntityFrameworkCore; namespace BTCPayServer.Data diff --git a/BTCPayServer.Data/Data/InvoiceData.cs b/BTCPayServer.Data/Data/InvoiceData.cs index 97715db49..4bfc065f7 100644 --- a/BTCPayServer.Data/Data/InvoiceData.cs +++ b/BTCPayServer.Data/Data/InvoiceData.cs @@ -1,8 +1,6 @@ using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations.Schema; -using System.Linq; -using System.Threading.Tasks; using Microsoft.EntityFrameworkCore; namespace BTCPayServer.Data diff --git a/BTCPayServer.Data/Data/InvoiceEventData.cs b/BTCPayServer.Data/Data/InvoiceEventData.cs index 09d39e5e2..d41c65f17 100644 --- a/BTCPayServer.Data/Data/InvoiceEventData.cs +++ b/BTCPayServer.Data/Data/InvoiceEventData.cs @@ -1,7 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; using Microsoft.EntityFrameworkCore; namespace BTCPayServer.Data diff --git a/BTCPayServer.Data/Data/NotificationData.cs b/BTCPayServer.Data/Data/NotificationData.cs index 05827c1b7..aa9d496b4 100644 --- a/BTCPayServer.Data/Data/NotificationData.cs +++ b/BTCPayServer.Data/Data/NotificationData.cs @@ -1,9 +1,5 @@ using System; -using System.Collections.Generic; using System.ComponentModel.DataAnnotations; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using Microsoft.EntityFrameworkCore; namespace BTCPayServer.Data diff --git a/BTCPayServer.Data/Data/PairedSINData.cs b/BTCPayServer.Data/Data/PairedSINData.cs index 2e9eb9259..36e7c00c6 100644 --- a/BTCPayServer.Data/Data/PairedSINData.cs +++ b/BTCPayServer.Data/Data/PairedSINData.cs @@ -1,7 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; using Microsoft.EntityFrameworkCore; namespace BTCPayServer.Data diff --git a/BTCPayServer.Data/Data/PairingCodeData.cs b/BTCPayServer.Data/Data/PairingCodeData.cs index 65ecc3fcd..21f6fed6f 100644 --- a/BTCPayServer.Data/Data/PairingCodeData.cs +++ b/BTCPayServer.Data/Data/PairingCodeData.cs @@ -1,7 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; using Microsoft.EntityFrameworkCore; namespace BTCPayServer.Data diff --git a/BTCPayServer.Data/Data/PaymentData.cs b/BTCPayServer.Data/Data/PaymentData.cs index c204c1b45..32210eb97 100644 --- a/BTCPayServer.Data/Data/PaymentData.cs +++ b/BTCPayServer.Data/Data/PaymentData.cs @@ -1,7 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; using Microsoft.EntityFrameworkCore; namespace BTCPayServer.Data diff --git a/BTCPayServer.Data/Data/PaymentRequestData.cs b/BTCPayServer.Data/Data/PaymentRequestData.cs index 5868cb282..0ac26af41 100644 --- a/BTCPayServer.Data/Data/PaymentRequestData.cs +++ b/BTCPayServer.Data/Data/PaymentRequestData.cs @@ -1,7 +1,4 @@ using System; -using System.Collections.Generic; -using System.Text; -using BTCPayServer.Client.Models; using Microsoft.EntityFrameworkCore; namespace BTCPayServer.Data diff --git a/BTCPayServer.Data/Data/PayoutData.cs b/BTCPayServer.Data/Data/PayoutData.cs index f2bd8d226..9ef8e22c7 100644 --- a/BTCPayServer.Data/Data/PayoutData.cs +++ b/BTCPayServer.Data/Data/PayoutData.cs @@ -1,8 +1,5 @@ using System; -using System.Collections.Generic; using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; -using System.Text; using Microsoft.EntityFrameworkCore; using NBitcoin; diff --git a/BTCPayServer.Data/Data/PendingInvoiceData.cs b/BTCPayServer.Data/Data/PendingInvoiceData.cs index 6a447dc41..43e7d2380 100644 --- a/BTCPayServer.Data/Data/PendingInvoiceData.cs +++ b/BTCPayServer.Data/Data/PendingInvoiceData.cs @@ -1,7 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; using Microsoft.EntityFrameworkCore; namespace BTCPayServer.Data diff --git a/BTCPayServer.Data/Data/PullPaymentData.cs b/BTCPayServer.Data/Data/PullPaymentData.cs index 5ef9aa67c..36c416227 100644 --- a/BTCPayServer.Data/Data/PullPaymentData.cs +++ b/BTCPayServer.Data/Data/PullPaymentData.cs @@ -3,8 +3,6 @@ using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using System.Linq; -using System.Runtime.CompilerServices; -using System.Text; using Microsoft.EntityFrameworkCore; using NBitcoin; diff --git a/BTCPayServer.Data/Data/RefundData.cs b/BTCPayServer.Data/Data/RefundData.cs index 10995dbd9..da3754807 100644 --- a/BTCPayServer.Data/Data/RefundData.cs +++ b/BTCPayServer.Data/Data/RefundData.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; using System.ComponentModel.DataAnnotations; -using System.Text; -using System.Xml.Linq; using Microsoft.EntityFrameworkCore; namespace BTCPayServer.Data diff --git a/BTCPayServer.Data/Data/SettingData.cs b/BTCPayServer.Data/Data/SettingData.cs index 8374d3435..a7421bdc1 100644 --- a/BTCPayServer.Data/Data/SettingData.cs +++ b/BTCPayServer.Data/Data/SettingData.cs @@ -1,8 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - namespace BTCPayServer.Data { public class SettingData diff --git a/BTCPayServer.Data/Data/U2FDevice.cs b/BTCPayServer.Data/Data/U2FDevice.cs index 87b09679b..abf752310 100644 --- a/BTCPayServer.Data/Data/U2FDevice.cs +++ b/BTCPayServer.Data/Data/U2FDevice.cs @@ -1,4 +1,3 @@ -using System; using System.ComponentModel.DataAnnotations; namespace BTCPayServer.Data diff --git a/BTCPayServer.Data/Data/UserStore.cs b/BTCPayServer.Data/Data/UserStore.cs index 1573ad666..fc488cef7 100644 --- a/BTCPayServer.Data/Data/UserStore.cs +++ b/BTCPayServer.Data/Data/UserStore.cs @@ -1,7 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; using Microsoft.EntityFrameworkCore; namespace BTCPayServer.Data diff --git a/BTCPayServer.Data/Data/WalletData.cs b/BTCPayServer.Data/Data/WalletData.cs index 307c9fe37..6e011ff4b 100644 --- a/BTCPayServer.Data/Data/WalletData.cs +++ b/BTCPayServer.Data/Data/WalletData.cs @@ -1,9 +1,4 @@ using System.Collections.Generic; -using System.Linq; -using System.Reflection.Emit; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Http; -using Newtonsoft.Json; namespace BTCPayServer.Data { diff --git a/BTCPayServer.Data/Data/WalletTransactionData.cs b/BTCPayServer.Data/Data/WalletTransactionData.cs index d874e8eb5..ea6168716 100644 --- a/BTCPayServer.Data/Data/WalletTransactionData.cs +++ b/BTCPayServer.Data/Data/WalletTransactionData.cs @@ -1,7 +1,4 @@ -using System; using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; using Microsoft.EntityFrameworkCore; using Newtonsoft.Json; diff --git a/BTCPayServer.Data/Migrations/20170913143004_Init.cs b/BTCPayServer.Data/Migrations/20170913143004_Init.cs index 0b01bdc63..70707fc2a 100644 --- a/BTCPayServer.Data/Migrations/20170913143004_Init.cs +++ b/BTCPayServer.Data/Migrations/20170913143004_Init.cs @@ -1,5 +1,4 @@ using System; -using System.Collections.Generic; using BTCPayServer.Data; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; diff --git a/BTCPayServer.Data/Migrations/20170926073744_Settings.cs b/BTCPayServer.Data/Migrations/20170926073744_Settings.cs index 567a30b1a..488e0d820 100644 --- a/BTCPayServer.Data/Migrations/20170926073744_Settings.cs +++ b/BTCPayServer.Data/Migrations/20170926073744_Settings.cs @@ -1,5 +1,3 @@ -using System; -using System.Collections.Generic; using BTCPayServer.Data; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; diff --git a/BTCPayServer.Data/Migrations/20170926084408_RequiresEmailConfirmation.cs b/BTCPayServer.Data/Migrations/20170926084408_RequiresEmailConfirmation.cs index 9dfd8e1db..9a123c0c0 100644 --- a/BTCPayServer.Data/Migrations/20170926084408_RequiresEmailConfirmation.cs +++ b/BTCPayServer.Data/Migrations/20170926084408_RequiresEmailConfirmation.cs @@ -1,5 +1,3 @@ -using System; -using System.Collections.Generic; using BTCPayServer.Data; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; diff --git a/BTCPayServer.Data/Migrations/20171006013443_AddressMapping.cs b/BTCPayServer.Data/Migrations/20171006013443_AddressMapping.cs index cf7d902ab..756be1e29 100644 --- a/BTCPayServer.Data/Migrations/20171006013443_AddressMapping.cs +++ b/BTCPayServer.Data/Migrations/20171006013443_AddressMapping.cs @@ -1,5 +1,3 @@ -using System; -using System.Collections.Generic; using BTCPayServer.Data; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; diff --git a/BTCPayServer.Data/Migrations/20171010082424_Tokens.cs b/BTCPayServer.Data/Migrations/20171010082424_Tokens.cs index 26fa2cbc1..2bb7f08ad 100644 --- a/BTCPayServer.Data/Migrations/20171010082424_Tokens.cs +++ b/BTCPayServer.Data/Migrations/20171010082424_Tokens.cs @@ -1,5 +1,4 @@ using System; -using System.Collections.Generic; using BTCPayServer.Data; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; diff --git a/BTCPayServer.Data/Migrations/20171012020112_PendingInvoices.cs b/BTCPayServer.Data/Migrations/20171012020112_PendingInvoices.cs index dbfaeabb9..5ed483217 100644 --- a/BTCPayServer.Data/Migrations/20171012020112_PendingInvoices.cs +++ b/BTCPayServer.Data/Migrations/20171012020112_PendingInvoices.cs @@ -1,5 +1,3 @@ -using System; -using System.Collections.Generic; using BTCPayServer.Data; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; diff --git a/BTCPayServer.Data/Migrations/20171023101754_StoreBlob.cs b/BTCPayServer.Data/Migrations/20171023101754_StoreBlob.cs index 04fc15bd6..67e5543fe 100644 --- a/BTCPayServer.Data/Migrations/20171023101754_StoreBlob.cs +++ b/BTCPayServer.Data/Migrations/20171023101754_StoreBlob.cs @@ -1,5 +1,3 @@ -using System; -using System.Collections.Generic; using BTCPayServer.Data; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; diff --git a/BTCPayServer.Data/Migrations/20171024163354_RenewUsedAddresses.cs b/BTCPayServer.Data/Migrations/20171024163354_RenewUsedAddresses.cs index ca50ae456..9a50572f6 100644 --- a/BTCPayServer.Data/Migrations/20171024163354_RenewUsedAddresses.cs +++ b/BTCPayServer.Data/Migrations/20171024163354_RenewUsedAddresses.cs @@ -1,5 +1,4 @@ using System; -using System.Collections.Generic; using BTCPayServer.Data; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; diff --git a/BTCPayServer.Data/Migrations/20171105235734_PaymentAccounted.cs b/BTCPayServer.Data/Migrations/20171105235734_PaymentAccounted.cs index 745c3befa..04445b8e4 100644 --- a/BTCPayServer.Data/Migrations/20171105235734_PaymentAccounted.cs +++ b/BTCPayServer.Data/Migrations/20171105235734_PaymentAccounted.cs @@ -1,5 +1,3 @@ -using System; -using System.Collections.Generic; using BTCPayServer.Data; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; diff --git a/BTCPayServer.Data/Migrations/20171221054550_AltcoinSupport.cs b/BTCPayServer.Data/Migrations/20171221054550_AltcoinSupport.cs index 489c644f7..ba670f25b 100644 --- a/BTCPayServer.Data/Migrations/20171221054550_AltcoinSupport.cs +++ b/BTCPayServer.Data/Migrations/20171221054550_AltcoinSupport.cs @@ -1,5 +1,3 @@ -using System; -using System.Collections.Generic; using BTCPayServer.Data; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; diff --git a/BTCPayServer.Data/Migrations/20180106095215_DerivationStrategies.cs b/BTCPayServer.Data/Migrations/20180106095215_DerivationStrategies.cs index daafb7b17..692486b10 100644 --- a/BTCPayServer.Data/Migrations/20180106095215_DerivationStrategies.cs +++ b/BTCPayServer.Data/Migrations/20180106095215_DerivationStrategies.cs @@ -1,5 +1,3 @@ -using System; -using System.Collections.Generic; using BTCPayServer.Data; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; diff --git a/BTCPayServer.Data/Migrations/20180109021122_defaultcrypto.cs b/BTCPayServer.Data/Migrations/20180109021122_defaultcrypto.cs index 157d85bce..9a1819f1a 100644 --- a/BTCPayServer.Data/Migrations/20180109021122_defaultcrypto.cs +++ b/BTCPayServer.Data/Migrations/20180109021122_defaultcrypto.cs @@ -1,5 +1,3 @@ -using System; -using System.Collections.Generic; using BTCPayServer.Data; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; diff --git a/BTCPayServer.Data/Migrations/20180114123253_events.cs b/BTCPayServer.Data/Migrations/20180114123253_events.cs index be6a85bdb..9abc9d0e0 100644 --- a/BTCPayServer.Data/Migrations/20180114123253_events.cs +++ b/BTCPayServer.Data/Migrations/20180114123253_events.cs @@ -1,5 +1,4 @@ using System; -using System.Collections.Generic; using BTCPayServer.Data; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; diff --git a/BTCPayServer.Data/Migrations/20180402095640_appdata.cs b/BTCPayServer.Data/Migrations/20180402095640_appdata.cs index 4f7319e0e..07f32f64a 100644 --- a/BTCPayServer.Data/Migrations/20180402095640_appdata.cs +++ b/BTCPayServer.Data/Migrations/20180402095640_appdata.cs @@ -1,5 +1,4 @@ using System; -using System.Collections.Generic; using BTCPayServer.Data; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; diff --git a/BTCPayServer.Data/Migrations/20180429083930_legacyapikey.cs b/BTCPayServer.Data/Migrations/20180429083930_legacyapikey.cs index e2c032588..1beb80638 100644 --- a/BTCPayServer.Data/Migrations/20180429083930_legacyapikey.cs +++ b/BTCPayServer.Data/Migrations/20180429083930_legacyapikey.cs @@ -1,5 +1,3 @@ -using System; -using System.Collections.Generic; using BTCPayServer.Data; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; diff --git a/BTCPayServer.Data/Migrations/20190121133309_AddPaymentRequests.cs b/BTCPayServer.Data/Migrations/20190121133309_AddPaymentRequests.cs index 4ca43cbff..3902624ab 100644 --- a/BTCPayServer.Data/Migrations/20190121133309_AddPaymentRequests.cs +++ b/BTCPayServer.Data/Migrations/20190121133309_AddPaymentRequests.cs @@ -1,4 +1,3 @@ -using System; using BTCPayServer.Data; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; diff --git a/BTCPayServer.Data/Migrations/20190425081749_AddU2fDevices.cs b/BTCPayServer.Data/Migrations/20190425081749_AddU2fDevices.cs index 8ba8907f3..276012636 100644 --- a/BTCPayServer.Data/Migrations/20190425081749_AddU2fDevices.cs +++ b/BTCPayServer.Data/Migrations/20190425081749_AddU2fDevices.cs @@ -1,4 +1,3 @@ -using System; using BTCPayServer.Data; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; diff --git a/BTCPayServer.Data/Migrations/20190802142637_WalletData.cs b/BTCPayServer.Data/Migrations/20190802142637_WalletData.cs index becee5f7a..f1c5d9c79 100644 --- a/BTCPayServer.Data/Migrations/20190802142637_WalletData.cs +++ b/BTCPayServer.Data/Migrations/20190802142637_WalletData.cs @@ -1,4 +1,3 @@ -using System; using BTCPayServer.Data; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; diff --git a/BTCPayServer.Data/MigrationsExtensions.cs b/BTCPayServer.Data/MigrationsExtensions.cs index c60c87a96..e39a0af10 100644 --- a/BTCPayServer.Data/MigrationsExtensions.cs +++ b/BTCPayServer.Data/MigrationsExtensions.cs @@ -1,6 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Text; using Microsoft.EntityFrameworkCore.Infrastructure; namespace BTCPayServer.Migrations diff --git a/BTCPayServer.Rating/CurrencyNameTable.cs b/BTCPayServer.Rating/CurrencyNameTable.cs index 1bb76e9a8..5dc85a06e 100644 --- a/BTCPayServer.Rating/CurrencyNameTable.cs +++ b/BTCPayServer.Rating/CurrencyNameTable.cs @@ -27,7 +27,7 @@ namespace BTCPayServer.Services.Rates _Currencies = LoadCurrency().ToDictionary(k => k.Code); } - static Dictionary _CurrencyProviders = new Dictionary(); + static readonly Dictionary _CurrencyProviders = new Dictionary(); public string FormatCurrency(string price, string currency) { @@ -130,7 +130,7 @@ namespace BTCPayServer.Services.Rates return value.ToString("C", provider) + $" ({currency})"; } - Dictionary _Currencies; + readonly Dictionary _Currencies; static CurrencyData[] LoadCurrency() { diff --git a/BTCPayServer.Rating/ExchangeRates.cs b/BTCPayServer.Rating/ExchangeRates.cs index 0229f2c0f..78300cfce 100644 --- a/BTCPayServer.Rating/ExchangeRates.cs +++ b/BTCPayServer.Rating/ExchangeRates.cs @@ -8,7 +8,7 @@ namespace BTCPayServer.Rating { public class ExchangeRates : IEnumerable { - Dictionary _AllRates = new Dictionary(); + readonly Dictionary _AllRates = new Dictionary(); public ExchangeRates() { @@ -28,7 +28,8 @@ namespace BTCPayServer.Rating Add(rate); } } - List _Rates = new List(); + + readonly List _Rates = new List(); public MultiValueDictionary ByExchange { get; diff --git a/BTCPayServer.Rating/MultiValueDictionary.cs b/BTCPayServer.Rating/MultiValueDictionary.cs index d3e82d170..5a2bd6584 100644 --- a/BTCPayServer.Rating/MultiValueDictionary.cs +++ b/BTCPayServer.Rating/MultiValueDictionary.cs @@ -34,7 +34,7 @@ namespace BTCPayServer /// /// The private dictionary that this class effectively wraps around /// - private Dictionary dictionary; + private readonly Dictionary dictionary; /// /// The function to construct a new @@ -900,8 +900,8 @@ namespace BTCPayServer private class Enumerator : IEnumerator>> { - private MultiValueDictionary multiValueDictionary; - private int version; + private readonly MultiValueDictionary multiValueDictionary; + private readonly int version; private KeyValuePair> current; private Dictionary.Enumerator enumerator; private enum EnumerationState { BeforeFirst, During, AfterLast }; @@ -1002,8 +1002,8 @@ namespace BTCPayServer ICollection, IReadOnlyCollection { - private TKey key; - private ICollection collection; + private readonly TKey key; + private readonly ICollection collection; #region Private Concrete API /*====================================================================== diff --git a/BTCPayServer.Rating/Providers/BackgroundFetcherRateProvider.cs b/BTCPayServer.Rating/Providers/BackgroundFetcherRateProvider.cs index 331e433ba..1dad04258 100644 --- a/BTCPayServer.Rating/Providers/BackgroundFetcherRateProvider.cs +++ b/BTCPayServer.Rating/Providers/BackgroundFetcherRateProvider.cs @@ -80,7 +80,7 @@ namespace BTCPayServer.Services.Rates } } - IRateProvider _Inner; + readonly IRateProvider _Inner; public IRateProvider Inner => _Inner; public BackgroundFetcherRateProvider(IRateProvider inner) diff --git a/BTCPayServer.Rating/Providers/BitbankRateProvider.cs b/BTCPayServer.Rating/Providers/BitbankRateProvider.cs index 99ee2bd28..1aa573a3e 100644 --- a/BTCPayServer.Rating/Providers/BitbankRateProvider.cs +++ b/BTCPayServer.Rating/Providers/BitbankRateProvider.cs @@ -1,5 +1,3 @@ -using System; -using System.Collections.Generic; using System.Linq; using System.Net.Http; using System.Threading; diff --git a/BTCPayServer.Rating/Providers/BitflyerRateProvider.cs b/BTCPayServer.Rating/Providers/BitflyerRateProvider.cs index 7b8ed3404..fbef38b26 100644 --- a/BTCPayServer.Rating/Providers/BitflyerRateProvider.cs +++ b/BTCPayServer.Rating/Providers/BitflyerRateProvider.cs @@ -1,6 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; using System.Net.Http; using System.Threading; using System.Threading.Tasks; diff --git a/BTCPayServer.Rating/Providers/BitpayRateProvider.cs b/BTCPayServer.Rating/Providers/BitpayRateProvider.cs index f42ae6216..7e5081323 100644 --- a/BTCPayServer.Rating/Providers/BitpayRateProvider.cs +++ b/BTCPayServer.Rating/Providers/BitpayRateProvider.cs @@ -1,8 +1,5 @@ -using System; -using System.Collections.Generic; using System.Linq; using System.Net.Http; -using System.Text; using System.Threading; using System.Threading.Tasks; using BTCPayServer.Rating; diff --git a/BTCPayServer.Rating/Providers/ByllsRateProvider.cs b/BTCPayServer.Rating/Providers/ByllsRateProvider.cs index 698b09656..944978e7b 100644 --- a/BTCPayServer.Rating/Providers/ByllsRateProvider.cs +++ b/BTCPayServer.Rating/Providers/ByllsRateProvider.cs @@ -1,4 +1,3 @@ -using System; using System.Net.Http; using System.Threading; using System.Threading.Tasks; diff --git a/BTCPayServer.Rating/Providers/ExchangeSharpRateProvider.cs b/BTCPayServer.Rating/Providers/ExchangeSharpRateProvider.cs index 00b8d28e6..bad5974e8 100644 --- a/BTCPayServer.Rating/Providers/ExchangeSharpRateProvider.cs +++ b/BTCPayServer.Rating/Providers/ExchangeSharpRateProvider.cs @@ -1,9 +1,7 @@ using System; using System.Collections.Concurrent; using System.Collections.Generic; -using System.IO; using System.Linq; -using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; @@ -14,7 +12,7 @@ namespace BTCPayServer.Services.Rates { public class ExchangeSharpRateProvider : IRateProvider where T : ExchangeAPI, new() { - HttpClient _httpClient; + readonly HttpClient _httpClient; public ExchangeSharpRateProvider(HttpClient httpClient, bool reverseCurrencyPair = false) { if (httpClient == null) @@ -48,7 +46,7 @@ namespace BTCPayServer.Services.Rates } // ExchangeSymbolToGlobalSymbol throws exception which would kill perf - ConcurrentDictionary notFoundSymbols = new ConcurrentDictionary(); + readonly ConcurrentDictionary notFoundSymbols = new ConcurrentDictionary(); private async Task CreateExchangeRate(T exchangeAPI, KeyValuePair ticker) { if (notFoundSymbols.TryGetValue(ticker.Key, out _)) diff --git a/BTCPayServer.Rating/Providers/FallbackRateProvider.cs b/BTCPayServer.Rating/Providers/FallbackRateProvider.cs index def866aa7..c26772d7e 100644 --- a/BTCPayServer.Rating/Providers/FallbackRateProvider.cs +++ b/BTCPayServer.Rating/Providers/FallbackRateProvider.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Linq; using System.Threading; using System.Threading.Tasks; using BTCPayServer.Rating; @@ -9,7 +8,7 @@ namespace BTCPayServer.Services.Rates { public class FallbackRateProvider : IRateProvider { - IRateProvider[] _Providers; + readonly IRateProvider[] _Providers; public FallbackRateProvider(IRateProvider[] providers) { if (providers == null) diff --git a/BTCPayServer.Rating/Providers/HttpClientRequestMaker.cs b/BTCPayServer.Rating/Providers/HttpClientRequestMaker.cs index ebe70c345..16584b0db 100644 --- a/BTCPayServer.Rating/Providers/HttpClientRequestMaker.cs +++ b/BTCPayServer.Rating/Providers/HttpClientRequestMaker.cs @@ -1,13 +1,10 @@ using System; using System.Collections.Generic; -using System.IO; using System.Net; using System.Net.Http; -using System.Text; using System.Threading; using System.Threading.Tasks; using ExchangeSharp; -using Microsoft.Extensions.Logging; namespace BTCPayServer.Services.Rates { @@ -132,7 +129,7 @@ namespace BTCPayServer.Services.Rates } } public Dictionary> Headers { get; } - static IReadOnlyList Empty = new List().AsReadOnly(); + static readonly IReadOnlyList Empty = new List().AsReadOnly(); public IReadOnlyList GetHeader(string name) { Headers.TryGetValue(name, out var list); diff --git a/BTCPayServer.Rating/Providers/IRateProvider.cs b/BTCPayServer.Rating/Providers/IRateProvider.cs index 5ee4f33a1..04616746f 100644 --- a/BTCPayServer.Rating/Providers/IRateProvider.cs +++ b/BTCPayServer.Rating/Providers/IRateProvider.cs @@ -1,6 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Text; using System.Threading; using System.Threading.Tasks; using BTCPayServer.Rating; diff --git a/BTCPayServer.Rating/Providers/KrakenExchangeRateProvider.cs b/BTCPayServer.Rating/Providers/KrakenExchangeRateProvider.cs index 48f67fd88..1e033d3bd 100644 --- a/BTCPayServer.Rating/Providers/KrakenExchangeRateProvider.cs +++ b/BTCPayServer.Rating/Providers/KrakenExchangeRateProvider.cs @@ -20,7 +20,8 @@ namespace BTCPayServer.Services.Rates { _Helper = new ExchangeKrakenAPI(); } - ExchangeKrakenAPI _Helper; + + readonly ExchangeKrakenAPI _Helper; public HttpClient HttpClient { get @@ -34,10 +35,10 @@ namespace BTCPayServer.Services.Rates } HttpClient _LocalClient; - static HttpClient _Client = new HttpClient(); + static readonly HttpClient _Client = new HttpClient(); // ExchangeSymbolToGlobalSymbol throws exception which would kill perf - ConcurrentDictionary notFoundSymbols = new ConcurrentDictionary(new Dictionary() + readonly ConcurrentDictionary notFoundSymbols = new ConcurrentDictionary(new Dictionary() { {"ADAXBT","ADAXBT"}, { "BSVUSD","BSVUSD"}, @@ -70,9 +71,7 @@ namespace BTCPayServer.Services.Rates }); string[] _Symbols = Array.Empty(); DateTimeOffset? _LastSymbolUpdate = null; - - - Dictionary _TickerMapping = new Dictionary() + readonly Dictionary _TickerMapping = new Dictionary() { { "XXDG", "DOGE" }, { "XXBT", "BTC" }, diff --git a/BTCPayServer.Rating/Providers/NullRateProvider.cs b/BTCPayServer.Rating/Providers/NullRateProvider.cs index a0a7b5f2b..f3c81af0d 100644 --- a/BTCPayServer.Rating/Providers/NullRateProvider.cs +++ b/BTCPayServer.Rating/Providers/NullRateProvider.cs @@ -1,6 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; using System.Threading; using System.Threading.Tasks; using BTCPayServer.Rating; diff --git a/BTCPayServer.Rating/Providers/PolisRateProvider.cs b/BTCPayServer.Rating/Providers/PolisRateProvider.cs index ba0c2fde4..192f2fd74 100644 --- a/BTCPayServer.Rating/Providers/PolisRateProvider.cs +++ b/BTCPayServer.Rating/Providers/PolisRateProvider.cs @@ -1,4 +1,3 @@ -using System; using System.Net.Http; using System.Threading; using System.Threading.Tasks; diff --git a/BTCPayServer.Rating/RateRules.cs b/BTCPayServer.Rating/RateRules.cs index 210165db0..9dec2bac1 100644 --- a/BTCPayServer.Rating/RateRules.cs +++ b/BTCPayServer.Rating/RateRules.cs @@ -95,8 +95,8 @@ namespace BTCPayServer.Rating } } - SyntaxNode root; - RuleList ruleList; + readonly SyntaxNode root; + readonly RuleList ruleList; decimal _Spread; private const string ImplicitSatsRule = "SATS_X = SATS_BTC * BTC_X;\nSATS_BTC = 0.00000001;\n"; @@ -401,8 +401,8 @@ namespace BTCPayServer.Rating } class FlattenExpressionRewriter : CSharpSyntaxRewriter { - RateRules parent; - CurrencyPair pair; + readonly RateRules parent; + readonly CurrencyPair pair; int nested = 0; public FlattenExpressionRewriter(RateRules parent, CurrencyPair pair) { @@ -491,8 +491,8 @@ namespace BTCPayServer.Rating }; } } - private SyntaxNode expression; - FlattenExpressionRewriter flatten; + private readonly SyntaxNode expression; + readonly FlattenExpressionRewriter flatten; public static RateRule CreateFromExpression(string expression, CurrencyPair currencyPair) { diff --git a/BTCPayServer.Rating/Services/RateFetcher.cs b/BTCPayServer.Rating/Services/RateFetcher.cs index 194787342..7a9feb0fc 100644 --- a/BTCPayServer.Rating/Services/RateFetcher.cs +++ b/BTCPayServer.Rating/Services/RateFetcher.cs @@ -1,14 +1,9 @@ using System; -using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; -using System.Net.Http; using System.Threading; using System.Threading.Tasks; using BTCPayServer.Rating; -using ExchangeSharp; -using Microsoft.Extensions.Caching.Memory; -using Microsoft.Extensions.Options; using static BTCPayServer.Services.Rates.RateProviderFactory; namespace BTCPayServer.Services.Rates diff --git a/BTCPayServer.Rating/Services/RateProviderFactory.cs b/BTCPayServer.Rating/Services/RateProviderFactory.cs index 257a778b7..c2c44999d 100644 --- a/BTCPayServer.Rating/Services/RateProviderFactory.cs +++ b/BTCPayServer.Rating/Services/RateProviderFactory.cs @@ -6,11 +6,7 @@ using System.Threading; using System.Threading.Tasks; using BTCPayServer.Rating; using ExchangeSharp; -using Microsoft.Extensions.Caching.Memory; -using Microsoft.Extensions.Logging; -using Microsoft.Extensions.Options; using Newtonsoft.Json.Linq; -using MemoryCache = Microsoft.Extensions.Caching.Memory.MemoryCache; namespace BTCPayServer.Services.Rates { diff --git a/BTCPayServer.Tests/BTCPayServerTester.cs b/BTCPayServer.Tests/BTCPayServerTester.cs index 3cd693c19..43e085570 100644 --- a/BTCPayServer.Tests/BTCPayServerTester.cs +++ b/BTCPayServer.Tests/BTCPayServerTester.cs @@ -1,24 +1,16 @@ using System; using System.Collections.Generic; -using System.Diagnostics; using System.IO; using System.Linq; -using System.Net; using System.Net.Http; -using System.Net.Sockets; -using System.Runtime.CompilerServices; using System.Security.Claims; -using System.Security.Principal; using System.Text; using System.Threading; using System.Threading.Tasks; using BTCPayServer.Configuration; using BTCPayServer.HostedServices; using BTCPayServer.Hosting; -using BTCPayServer.Payments; -using BTCPayServer.Payments.Lightning; using BTCPayServer.Rating; -using BTCPayServer.Security; using BTCPayServer.Services; using BTCPayServer.Services.Invoices; using BTCPayServer.Services.Rates; @@ -29,15 +21,11 @@ using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting.Server.Features; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; -using Microsoft.AspNetCore.Mvc.Controllers; -using Microsoft.AspNetCore.Mvc.Routing; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; using Microsoft.Extensions.Logging; using NBitcoin; using NBXplorer; -using NBXplorer.DerivationStrategy; -using Xunit; using AuthenticationSchemes = BTCPayServer.Security.AuthenticationSchemes; namespace BTCPayServer.Tests @@ -50,7 +38,7 @@ namespace BTCPayServer.Tests public class BTCPayServerTester : IDisposable { - private string _Directory; + private readonly string _Directory; public BTCPayServerTester(string scope) { diff --git a/BTCPayServer.Tests/ChangellyTests.cs b/BTCPayServer.Tests/ChangellyTests.cs index c092772a3..46023e2c8 100644 --- a/BTCPayServer.Tests/ChangellyTests.cs +++ b/BTCPayServer.Tests/ChangellyTests.cs @@ -1,7 +1,5 @@ -using System; using System.Collections.Generic; using System.Linq; -using System.Net.Http; using System.Threading.Tasks; using BTCPayServer.Controllers; using BTCPayServer.Data; @@ -10,10 +8,8 @@ using BTCPayServer.Models.StoreViewModels; using BTCPayServer.Payments.Changelly; using BTCPayServer.Payments.Changelly.Models; using BTCPayServer.Services.Rates; -using BTCPayServer.Services.Stores; using BTCPayServer.Tests.Logging; using Microsoft.AspNetCore.Mvc; -using Microsoft.Extensions.Logging; using Xunit; using Xunit.Abstractions; diff --git a/BTCPayServer.Tests/ChargeTester.cs b/BTCPayServer.Tests/ChargeTester.cs index 41f425a30..7a4cf631b 100644 --- a/BTCPayServer.Tests/ChargeTester.cs +++ b/BTCPayServer.Tests/ChargeTester.cs @@ -1,16 +1,12 @@ -using System; -using System.Collections.Generic; -using System.Text; using BTCPayServer.Lightning; using BTCPayServer.Lightning.Charge; -using BTCPayServer.Payments.Lightning; using NBitcoin; namespace BTCPayServer.Tests { public class ChargeTester { - private ServerTester _Parent; + private readonly ServerTester _Parent; public ChargeTester(ServerTester serverTester, string environmentName, string defaultValue, string defaultHost, Network network) { diff --git a/BTCPayServer.Tests/CheckoutUITests.cs b/BTCPayServer.Tests/CheckoutUITests.cs index 3ae9531a0..5eb52f8b7 100644 --- a/BTCPayServer.Tests/CheckoutUITests.cs +++ b/BTCPayServer.Tests/CheckoutUITests.cs @@ -1,16 +1,12 @@ using System; using System.Linq; -using System.Net.Http; -using System.Threading; using System.Threading.Tasks; using BTCPayServer.Lightning; using BTCPayServer.Payments; using BTCPayServer.Tests.Logging; using BTCPayServer.Views.Stores; using NBitcoin; -using NBitpayClient; using OpenQA.Selenium; -using OpenQA.Selenium.Interactions; using OpenQA.Selenium.Support.UI; using Xunit; using Xunit.Abstractions; diff --git a/BTCPayServer.Tests/CrowdfundTests.cs b/BTCPayServer.Tests/CrowdfundTests.cs index 1c57f4fe3..6553ffc2f 100644 --- a/BTCPayServer.Tests/CrowdfundTests.cs +++ b/BTCPayServer.Tests/CrowdfundTests.cs @@ -1,25 +1,12 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Net.Http; -using System.Threading; using System.Threading.Tasks; using BTCPayServer.Client.Models; using BTCPayServer.Controllers; -using BTCPayServer.Data; -using BTCPayServer.Events; -using BTCPayServer.Models; using BTCPayServer.Models.AppViewModels; -using BTCPayServer.Models.StoreViewModels; -using BTCPayServer.Payments.Changelly; -using BTCPayServer.Payments.Changelly.Models; using BTCPayServer.Services.Apps; using BTCPayServer.Services.Invoices; -using BTCPayServer.Services.Rates; -using BTCPayServer.Services.Stores; using BTCPayServer.Tests.Logging; using Microsoft.AspNetCore.Mvc; -using Microsoft.Extensions.Logging; using NBitcoin; using NBitpayClient; using Xunit; diff --git a/BTCPayServer.Tests/CustomerHttpServer.cs b/BTCPayServer.Tests/CustomerHttpServer.cs index 4af81ee59..02867faff 100644 --- a/BTCPayServer.Tests/CustomerHttpServer.cs +++ b/BTCPayServer.Tests/CustomerHttpServer.cs @@ -1,15 +1,12 @@ using System; -using System.Collections.Generic; using System.IO; using System.Linq; -using System.Text; using System.Threading; using System.Threading.Channels; using System.Threading.Tasks; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting.Server.Features; -using Microsoft.AspNetCore.Http; using Newtonsoft.Json; using Newtonsoft.Json.Linq; @@ -17,9 +14,9 @@ namespace BTCPayServer.Tests { public class CustomServer : IDisposable { - IWebHost _Host = null; - CancellationTokenSource _Closed = new CancellationTokenSource(); - Channel _Requests = Channel.CreateUnbounded(); + readonly IWebHost _Host = null; + readonly CancellationTokenSource _Closed = new CancellationTokenSource(); + readonly Channel _Requests = Channel.CreateUnbounded(); public CustomServer() { var port = Utils.FreeTcpPort(); diff --git a/BTCPayServer.Tests/ElementsTests.cs b/BTCPayServer.Tests/ElementsTests.cs index 27122d7be..035cba800 100644 --- a/BTCPayServer.Tests/ElementsTests.cs +++ b/BTCPayServer.Tests/ElementsTests.cs @@ -12,7 +12,6 @@ using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration.Memory; using NBitcoin; using NBitcoin.Payment; -using NBitcoin.RPC; using NBitpayClient; using Xunit; using Xunit.Abstractions; diff --git a/BTCPayServer.Tests/Extensions.cs b/BTCPayServer.Tests/Extensions.cs index 0bec56f7e..4976f59e6 100644 --- a/BTCPayServer.Tests/Extensions.cs +++ b/BTCPayServer.Tests/Extensions.cs @@ -13,7 +13,7 @@ namespace BTCPayServer.Tests { public static class Extensions { - private static JsonSerializerSettings jsonSettings = new JsonSerializerSettings { ContractResolver = new CamelCasePropertyNamesContractResolver() }; + private static readonly JsonSerializerSettings jsonSettings = new JsonSerializerSettings { ContractResolver = new CamelCasePropertyNamesContractResolver() }; public static string ToJson(this object o) { var res = JsonConvert.SerializeObject(o, Formatting.None, jsonSettings); diff --git a/BTCPayServer.Tests/FakeServer.cs b/BTCPayServer.Tests/FakeServer.cs index f9fcd8063..44062c07d 100644 --- a/BTCPayServer.Tests/FakeServer.cs +++ b/BTCPayServer.Tests/FakeServer.cs @@ -1,8 +1,5 @@ using System; -using System.Collections.Generic; using System.Linq; -using System.Net.Http; -using System.Text; using System.Threading; using System.Threading.Channels; using System.Threading.Tasks; @@ -10,7 +7,6 @@ using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting.Server.Features; using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; @@ -19,15 +15,15 @@ namespace BTCPayServer.Tests public class FakeServer : IDisposable { IWebHost webHost; - SemaphoreSlim semaphore; - CancellationTokenSource cts = new CancellationTokenSource(); + readonly SemaphoreSlim semaphore; + readonly CancellationTokenSource cts = new CancellationTokenSource(); public FakeServer() { _channel = Channel.CreateUnbounded(); semaphore = new SemaphoreSlim(0); } - Channel _channel; + readonly Channel _channel; public async Task Start() { webHost = new WebHostBuilder() diff --git a/BTCPayServer.Tests/GreenfieldAPITests.cs b/BTCPayServer.Tests/GreenfieldAPITests.cs index 002af96a4..2bd699e87 100644 --- a/BTCPayServer.Tests/GreenfieldAPITests.cs +++ b/BTCPayServer.Tests/GreenfieldAPITests.cs @@ -2,7 +2,6 @@ using System; using System.IO; using System.Linq; using System.Net.Http; -using System.Reflection.Metadata; using System.Threading; using System.Threading.Tasks; using BTCPayServer.Client; @@ -11,7 +10,6 @@ using BTCPayServer.Controllers; using BTCPayServer.Events; using BTCPayServer.JsonConverters; using BTCPayServer.Services; -using BTCPayServer.Services.Stores; using BTCPayServer.Tests.Logging; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; @@ -19,8 +17,6 @@ using NBitcoin; using NBitpayClient; using Newtonsoft.Json; using Newtonsoft.Json.Linq; -using OpenQA.Selenium; -using Org.BouncyCastle.Utilities.Collections; using Xunit; using Xunit.Abstractions; using CreateApplicationUserRequest = BTCPayServer.Client.Models.CreateApplicationUserRequest; diff --git a/BTCPayServer.Tests/LightningDTester.cs b/BTCPayServer.Tests/LightningDTester.cs index 623c45871..9922182dd 100644 --- a/BTCPayServer.Tests/LightningDTester.cs +++ b/BTCPayServer.Tests/LightningDTester.cs @@ -1,7 +1,4 @@ using System; -using System.Collections.Generic; -using System.Text; -using System.Threading.Tasks; using BTCPayServer.Lightning.CLightning; using NBitcoin; @@ -9,7 +6,7 @@ namespace BTCPayServer.Tests { public class LightningDTester { - ServerTester parent; + readonly ServerTester parent; public LightningDTester(ServerTester parent, string environmentName, string defaultRPC, string defaultHost, Network network) { this.parent = parent; diff --git a/BTCPayServer.Tests/Lnd/LndMockTester.cs b/BTCPayServer.Tests/Lnd/LndMockTester.cs index 7eb9dc1f2..4c6a8830c 100644 --- a/BTCPayServer.Tests/Lnd/LndMockTester.cs +++ b/BTCPayServer.Tests/Lnd/LndMockTester.cs @@ -1,6 +1,4 @@ using System; -using System.Collections.Generic; -using System.Text; using BTCPayServer.Lightning.LND; using NBitcoin; @@ -8,7 +6,7 @@ namespace BTCPayServer.Tests.Lnd { public class LndMockTester { - private ServerTester _Parent; + private readonly ServerTester _Parent; public LndMockTester(ServerTester serverTester, string environmentName, string defaultValue, string defaultHost, Network network) { diff --git a/BTCPayServer.Tests/Logging/Logs.cs b/BTCPayServer.Tests/Logging/Logs.cs index 66722f36a..109ef28c6 100644 --- a/BTCPayServer.Tests/Logging/Logs.cs +++ b/BTCPayServer.Tests/Logging/Logs.cs @@ -1,5 +1,4 @@ using System; -using System.Collections.Generic; using System.Text; using Microsoft.Extensions.Logging; using Xunit.Abstractions; @@ -13,7 +12,7 @@ namespace BTCPayServer.Tests.Logging public class XUnitLogProvider : ILoggerProvider { - ITestOutputHelper _Helper; + readonly ITestOutputHelper _Helper; public XUnitLogProvider(ITestOutputHelper helper) { _Helper = helper; @@ -30,7 +29,7 @@ namespace BTCPayServer.Tests.Logging } public class XUnitLog : ILog, ILogger, IDisposable { - ITestOutputHelper _Helper; + readonly ITestOutputHelper _Helper; public XUnitLog(ITestOutputHelper helper) { _Helper = helper; diff --git a/BTCPayServer.Tests/MockDelay.cs b/BTCPayServer.Tests/MockDelay.cs index d53f6d65c..679eabbc4 100644 --- a/BTCPayServer.Tests/MockDelay.cs +++ b/BTCPayServer.Tests/MockDelay.cs @@ -2,7 +2,6 @@ using System; using System.Collections.Generic; using System.Globalization; using System.Linq; -using System.Text; using System.Threading; using System.Threading.Tasks; @@ -16,7 +15,7 @@ namespace BTCPayServer.Tests public TaskCompletionSource CTS; } - List waits = new List(); + readonly List waits = new List(); DateTimeOffset _Now = new DateTimeOffset(1970, 1, 1, 0, 0, 0, TimeSpan.Zero); public async Task Wait(TimeSpan delay, CancellationToken cancellation) { diff --git a/BTCPayServer.Tests/Mocks/MockRateProvider.cs b/BTCPayServer.Tests/Mocks/MockRateProvider.cs index 338ace10f..39275915b 100644 --- a/BTCPayServer.Tests/Mocks/MockRateProvider.cs +++ b/BTCPayServer.Tests/Mocks/MockRateProvider.cs @@ -1,6 +1,4 @@ -using System; using System.Collections.Generic; -using System.Text; using System.Threading; using System.Threading.Tasks; using BTCPayServer.Rating; diff --git a/BTCPayServer.Tests/Mocks/UrlHelperMock.cs b/BTCPayServer.Tests/Mocks/UrlHelperMock.cs index 909790786..43182b943 100644 --- a/BTCPayServer.Tests/Mocks/UrlHelperMock.cs +++ b/BTCPayServer.Tests/Mocks/UrlHelperMock.cs @@ -1,6 +1,4 @@ using System; -using System.Collections.Generic; -using System.Text; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Routing; @@ -8,7 +6,7 @@ namespace BTCPayServer.Tests.Mocks { public class UrlHelperMock : IUrlHelper { - Uri _BaseUrl; + readonly Uri _BaseUrl; public UrlHelperMock(Uri baseUrl) { _BaseUrl = baseUrl; diff --git a/BTCPayServer.Tests/PSBTTests.cs b/BTCPayServer.Tests/PSBTTests.cs index be4388c29..000c3f6c0 100644 --- a/BTCPayServer.Tests/PSBTTests.cs +++ b/BTCPayServer.Tests/PSBTTests.cs @@ -1,7 +1,5 @@ -using System; using System.Collections.Generic; using System.Linq; -using System.Text; using System.Threading.Tasks; using BTCPayServer.Controllers; using BTCPayServer.Models; diff --git a/BTCPayServer.Tests/PayJoinTests.cs b/BTCPayServer.Tests/PayJoinTests.cs index c4b02e8cf..270d8c3e5 100644 --- a/BTCPayServer.Tests/PayJoinTests.cs +++ b/BTCPayServer.Tests/PayJoinTests.cs @@ -1,16 +1,12 @@ using System; -using System.Collections.Generic; using System.Linq; using System.Net.Http; using System.Text; -using System.Threading; using System.Threading.Tasks; using BTCPayServer.Controllers; using BTCPayServer.Data; using BTCPayServer.Events; using BTCPayServer.Models; -using BTCPayServer.Models.InvoicingModels; -using BTCPayServer.Models.WalletViewModels; using BTCPayServer.Payments; using BTCPayServer.Payments.Bitcoin; using BTCPayServer.Payments.PayJoin; @@ -19,21 +15,14 @@ using BTCPayServer.Services.Invoices; using BTCPayServer.Services.Wallets; using BTCPayServer.Tests.Logging; using BTCPayServer.Views.Wallets; -using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Mvc; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Hosting; -using Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.ObjectModel; using NBitcoin; -using NBitcoin.Altcoins; using NBitcoin.Payment; using NBitpayClient; using NBXplorer.DerivationStrategy; using NBXplorer.Models; using Newtonsoft.Json.Linq; using OpenQA.Selenium; -using TwentyTwenty.Storage; using Xunit; using Xunit.Abstractions; diff --git a/BTCPayServer.Tests/PaymentHandlerTest.cs b/BTCPayServer.Tests/PaymentHandlerTest.cs index eb4cd416a..b23abcad9 100644 --- a/BTCPayServer.Tests/PaymentHandlerTest.cs +++ b/BTCPayServer.Tests/PaymentHandlerTest.cs @@ -18,9 +18,9 @@ namespace BTCPayServer.Tests [Trait("Fast", "Fast")] public class PaymentHandlerTest { - private BitcoinLikePaymentHandler handlerBTC; - private LightningLikePaymentHandler handlerLN; - private Dictionary> currencyPairRateResult; + private readonly BitcoinLikePaymentHandler handlerBTC; + private readonly LightningLikePaymentHandler handlerLN; + private readonly Dictionary> currencyPairRateResult; public PaymentHandlerTest(ITestOutputHelper helper) { diff --git a/BTCPayServer.Tests/PaymentRequestTests.cs b/BTCPayServer.Tests/PaymentRequestTests.cs index 159f1ada7..9c2158e98 100644 --- a/BTCPayServer.Tests/PaymentRequestTests.cs +++ b/BTCPayServer.Tests/PaymentRequestTests.cs @@ -1,26 +1,11 @@ using System; -using System.Collections.Generic; using System.Linq; -using System.Net.Http; -using System.Threading; using System.Threading.Tasks; using BTCPayServer.Controllers; -using BTCPayServer.Data; -using BTCPayServer.Events; -using BTCPayServer.Models; -using BTCPayServer.Models.AppViewModels; using BTCPayServer.Models.PaymentRequestViewModels; -using BTCPayServer.Models.StoreViewModels; -using BTCPayServer.Payments.Changelly; -using BTCPayServer.Payments.Changelly.Models; -using BTCPayServer.Services.Apps; using BTCPayServer.Services.Invoices; -using BTCPayServer.Services.Rates; -using BTCPayServer.Services.Stores; using BTCPayServer.Tests.Logging; using Microsoft.AspNetCore.Mvc; -using Microsoft.Extensions.Logging; -using NBitcoin; using NBitpayClient; using Xunit; using Xunit.Abstractions; diff --git a/BTCPayServer.Tests/ProcessLauncher.cs b/BTCPayServer.Tests/ProcessLauncher.cs index 10ade2447..a05bc8c13 100644 --- a/BTCPayServer.Tests/ProcessLauncher.cs +++ b/BTCPayServer.Tests/ProcessLauncher.cs @@ -43,7 +43,7 @@ namespace BTCPayServer.Tests return true; } - Stack _Directories = new Stack(); + readonly Stack _Directories = new Stack(); public void PushDirectory() { _Directories.Push(_CurrentDirectory); diff --git a/BTCPayServer.Tests/SeleniumTester.cs b/BTCPayServer.Tests/SeleniumTester.cs index 4ab3d3a4d..0e9396546 100644 --- a/BTCPayServer.Tests/SeleniumTester.cs +++ b/BTCPayServer.Tests/SeleniumTester.cs @@ -1,13 +1,8 @@ using System; -using System.Collections.Generic; -using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; -using System.Net.Http; -using System.Reflection; using System.Runtime.CompilerServices; -using System.Text; using System.Threading; using System.Threading.Tasks; using BTCPayServer; @@ -20,8 +15,6 @@ using BTCPayServer.Views.Manage; using BTCPayServer.Views.Stores; using BTCPayServer.Views.Wallets; using NBitcoin; -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; using OpenQA.Selenium; using OpenQA.Selenium.Chrome; using OpenQA.Selenium.Interactions; diff --git a/BTCPayServer.Tests/SeleniumTests.cs b/BTCPayServer.Tests/SeleniumTests.cs index 35ee1c0e5..da5e8e335 100644 --- a/BTCPayServer.Tests/SeleniumTests.cs +++ b/BTCPayServer.Tests/SeleniumTests.cs @@ -4,24 +4,15 @@ using System.Linq; using System.Text.RegularExpressions; using System.Threading; using System.Threading.Tasks; -using BTCPayServer.Client.Models; -using BTCPayServer.Controllers; using BTCPayServer.Data; using BTCPayServer.Models; using BTCPayServer.Services.Wallets; using BTCPayServer.Tests.Logging; using BTCPayServer.Views.Wallets; -using ExchangeSharp; -using Microsoft.AspNetCore.Components.Web; using Microsoft.EntityFrameworkCore; using NBitcoin; using NBitcoin.Payment; -using NBitcoin.RPC; -using NBitpayClient; -using Newtonsoft.Json; using OpenQA.Selenium; -using OpenQA.Selenium.Chrome; -using OpenQA.Selenium.Interactions; using Xunit; using Xunit.Abstractions; diff --git a/BTCPayServer.Tests/ServerTester.cs b/BTCPayServer.Tests/ServerTester.cs index f8512d258..9cb775455 100644 --- a/BTCPayServer.Tests/ServerTester.cs +++ b/BTCPayServer.Tests/ServerTester.cs @@ -1,29 +1,18 @@ using System; using System.Collections.Generic; -using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Net.Http; using System.Runtime.CompilerServices; -using System.Text; -using System.Threading; using System.Threading.Tasks; -using BTCPayServer.Controllers; using BTCPayServer.Lightning; -using BTCPayServer.Lightning.CLightning; -using BTCPayServer.Models.AccountViewModels; -using BTCPayServer.Payments.Lightning; -using BTCPayServer.Services; using BTCPayServer.Tests.Lnd; using BTCPayServer.Tests.Logging; -using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Mvc; using NBitcoin; using NBitcoin.RPC; using NBitpayClient; using NBXplorer; -using NBXplorer.Models; namespace BTCPayServer.Tests { @@ -34,7 +23,7 @@ namespace BTCPayServer.Tests return new ServerTester(scope, newDb); } - string _Directory; + readonly string _Directory; public ServerTester(string scope, bool newDb) { _Directory = scope; @@ -196,7 +185,7 @@ namespace BTCPayServer.Tests public ExplorerClient LTCExplorerClient { get; set; } public ExplorerClient LBTCExplorerClient { get; set; } - HttpClient _Http = new HttpClient(); + readonly HttpClient _Http = new HttpClient(); public BTCPayServerTester PayTester { diff --git a/BTCPayServer.Tests/StorageTests.cs b/BTCPayServer.Tests/StorageTests.cs index dede64436..e72b1c460 100644 --- a/BTCPayServer.Tests/StorageTests.cs +++ b/BTCPayServer.Tests/StorageTests.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.IO; using System.Threading.Tasks; using BTCPayServer.Controllers; using BTCPayServer.Models; @@ -11,10 +10,8 @@ using BTCPayServer.Storage.Services.Providers.FileSystemStorage.Configuration; using BTCPayServer.Storage.ViewModels; using BTCPayServer.Tests.Logging; using DBriize.Utils; -using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Configuration; -using Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.Resources; using Xunit; using Xunit.Abstractions; diff --git a/BTCPayServer.Tests/TestAccount.cs b/BTCPayServer.Tests/TestAccount.cs index 8f4b60dfa..6cfc58431 100644 --- a/BTCPayServer.Tests/TestAccount.cs +++ b/BTCPayServer.Tests/TestAccount.cs @@ -1,10 +1,8 @@ using System; -using System.Collections.Generic; using System.Linq; using System.Net.Http; using System.Text; using System.Threading.Tasks; -using Amazon.S3.Model; using BTCPayServer.Client; using BTCPayServer.Client.Models; using BTCPayServer.Controllers; @@ -14,10 +12,7 @@ using BTCPayServer.Lightning; using BTCPayServer.Lightning.CLightning; using BTCPayServer.Models.AccountViewModels; using BTCPayServer.Models.StoreViewModels; -using BTCPayServer.Payments; -using BTCPayServer.Payments.Lightning; using BTCPayServer.Services; -using BTCPayServer.Services.Invoices; using BTCPayServer.Services.Stores; using BTCPayServer.Services.Wallets; using BTCPayServer.Tests.Logging; @@ -35,7 +30,7 @@ namespace BTCPayServer.Tests { public class TestAccount { - ServerTester parent; + readonly ServerTester parent; public TestAccount(ServerTester parent) { diff --git a/BTCPayServer.Tests/TestUtils.cs b/BTCPayServer.Tests/TestUtils.cs index c4a9e47d4..82466e84d 100644 --- a/BTCPayServer.Tests/TestUtils.cs +++ b/BTCPayServer.Tests/TestUtils.cs @@ -1,9 +1,7 @@ using System; -using System.Collections.Generic; using System.IO; using System.Linq; using System.Net.Http; -using System.Text; using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Http; diff --git a/BTCPayServer.Tests/UnitTest1.cs b/BTCPayServer.Tests/UnitTest1.cs index 373083614..e83befab1 100644 --- a/BTCPayServer.Tests/UnitTest1.cs +++ b/BTCPayServer.Tests/UnitTest1.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; @@ -8,8 +7,6 @@ using System.Net; using System.Net.Http; using System.Runtime.CompilerServices; using System.Security; -using System.Security.Claims; -using System.Security.Cryptography.X509Certificates; using System.Text; using System.Text.RegularExpressions; using System.Threading; @@ -33,37 +30,29 @@ using BTCPayServer.Payments; using BTCPayServer.Payments.Bitcoin; using BTCPayServer.Payments.Lightning; using BTCPayServer.Rating; -using BTCPayServer.Security; using BTCPayServer.Security.Bitpay; using BTCPayServer.Services; using BTCPayServer.Services.Apps; using BTCPayServer.Services.Invoices; using BTCPayServer.Services.Rates; -using BTCPayServer.Services.Stores; using BTCPayServer.Tests.Logging; using BTCPayServer.U2F.Models; using BTCPayServer.Validation; using ExchangeSharp; -using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.Caching.Memory; -using Microsoft.Extensions.DependencyInjection; using NBitcoin; using NBitcoin.DataEncoders; using NBitcoin.Payment; using NBitpayClient; -using NBitpayClient.Extensions; using NBXplorer.DerivationStrategy; using NBXplorer.Models; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using Newtonsoft.Json.Schema; -using TwentyTwenty.Storage; using Xunit; using Xunit.Abstractions; using Xunit.Sdk; -using MemoryCache = Microsoft.Extensions.Caching.Memory.MemoryCache; using RatesViewModel = BTCPayServer.Models.StoreViewModels.RatesViewModel; namespace BTCPayServer.Tests @@ -605,7 +594,7 @@ namespace BTCPayServer.Tests // Pays 75% var invoiceAddress = BitcoinAddress.Create(invoice.CryptoInfo[0].Address, tester.ExplorerNode.Network); tester.ExplorerNode.SendToAddress(invoiceAddress, - Money.Satoshis((decimal)invoice.BtcDue.Satoshi * 0.75m)); + Money.Satoshis(invoice.BtcDue.Satoshi * 0.75m)); TestUtils.Eventually(() => { diff --git a/BTCPayServer.Tests/UtilitiesTests.cs b/BTCPayServer.Tests/UtilitiesTests.cs index 59fcbb1a4..b473e368e 100644 --- a/BTCPayServer.Tests/UtilitiesTests.cs +++ b/BTCPayServer.Tests/UtilitiesTests.cs @@ -1,11 +1,8 @@ -using System; -using System.Collections.Generic; using System.IO; using System.Linq; using System.Net.Http; using System.Text; using System.Threading.Tasks; -using BTCPayServer.Services.Rates; using Microsoft.Extensions.Configuration; using NBitcoin.DataEncoders; using Newtonsoft.Json.Linq; diff --git a/BTCPayServer.Tests/Utils.cs b/BTCPayServer.Tests/Utils.cs index 3cfc85964..4030e9aa7 100644 --- a/BTCPayServer.Tests/Utils.cs +++ b/BTCPayServer.Tests/Utils.cs @@ -1,9 +1,7 @@ using System; -using System.Collections.Generic; using System.IO; using System.Net; using System.Net.Sockets; -using System.Text; using System.Threading; namespace BTCPayServer.Tests diff --git a/BTCPayServer/BitpayHttpException.cs b/BTCPayServer/BitpayHttpException.cs index 8fd37829c..8b7376ad8 100644 --- a/BTCPayServer/BitpayHttpException.cs +++ b/BTCPayServer/BitpayHttpException.cs @@ -1,6 +1,4 @@ using System; -using System.Collections.Generic; -using System.Text; namespace BTCPayServer { diff --git a/BTCPayServer/Configuration/ConfigException.cs b/BTCPayServer/Configuration/ConfigException.cs index a5cda5739..137a1b827 100644 --- a/BTCPayServer/Configuration/ConfigException.cs +++ b/BTCPayServer/Configuration/ConfigException.cs @@ -1,7 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; namespace BTCPayServer.Configuration { diff --git a/BTCPayServer/Configuration/ConfigurationExtensions.cs b/BTCPayServer/Configuration/ConfigurationExtensions.cs index eb11bf779..ec91e7e4f 100644 --- a/BTCPayServer/Configuration/ConfigurationExtensions.cs +++ b/BTCPayServer/Configuration/ConfigurationExtensions.cs @@ -1,11 +1,8 @@ using System; -using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Net; -using System.Threading.Tasks; using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.Primitives; using NBitcoin; namespace BTCPayServer.Configuration diff --git a/BTCPayServer/Configuration/DefaultConfiguration.cs b/BTCPayServer/Configuration/DefaultConfiguration.cs index 2f364a0b0..e24a31bd2 100644 --- a/BTCPayServer/Configuration/DefaultConfiguration.cs +++ b/BTCPayServer/Configuration/DefaultConfiguration.cs @@ -1,16 +1,10 @@ -using System; -using System.Collections.Generic; using System.IO; using System.Linq; using System.Net; using System.Text; -using System.Threading.Tasks; using CommandLine; -using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.Logging; using NBitcoin; -using NBXplorer; namespace BTCPayServer.Configuration { diff --git a/BTCPayServer/Configuration/ExternalConnectionString.cs b/BTCPayServer/Configuration/ExternalConnectionString.cs index c850b99fb..7c67e3362 100644 --- a/BTCPayServer/Configuration/ExternalConnectionString.cs +++ b/BTCPayServer/Configuration/ExternalConnectionString.cs @@ -1,6 +1,4 @@ using System; -using System.Collections.Generic; -using System.IO; using System.Linq; using System.Threading.Tasks; using BTCPayServer.Controllers; diff --git a/BTCPayServer/Configuration/ExternalService.cs b/BTCPayServer/Configuration/ExternalService.cs index ce091ab74..82e258655 100644 --- a/BTCPayServer/Configuration/ExternalService.cs +++ b/BTCPayServer/Configuration/ExternalService.cs @@ -2,8 +2,6 @@ using System; using System.Collections.Generic; using System.Globalization; using System.Linq; -using System.Threading.Tasks; -using BTCPayServer.Lightning; using Microsoft.Extensions.Configuration; namespace BTCPayServer.Configuration diff --git a/BTCPayServer/Controllers/AccessTokenController.cs b/BTCPayServer/Controllers/AccessTokenController.cs index 8ecb22971..8259333b8 100644 --- a/BTCPayServer/Controllers/AccessTokenController.cs +++ b/BTCPayServer/Controllers/AccessTokenController.cs @@ -1,16 +1,11 @@ using System; using System.Collections.Generic; -using System.Text; using System.Threading.Tasks; using BTCPayServer.Filters; using BTCPayServer.Models; -using BTCPayServer.Security; using BTCPayServer.Security.Bitpay; using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Cors; using Microsoft.AspNetCore.Mvc; -using NBitcoin.DataEncoders; -using NBitpayClient; namespace BTCPayServer.Controllers { @@ -18,7 +13,7 @@ namespace BTCPayServer.Controllers [BitpayAPIConstraint()] public class AccessTokenController : Controller { - TokenRepository _TokenRepository; + readonly TokenRepository _TokenRepository; public AccessTokenController(TokenRepository tokenRepository) { _TokenRepository = tokenRepository ?? throw new ArgumentNullException(nameof(tokenRepository)); diff --git a/BTCPayServer/Controllers/AccountController.cs b/BTCPayServer/Controllers/AccountController.cs index dedaaec4a..668ecbc8b 100644 --- a/BTCPayServer/Controllers/AccountController.cs +++ b/BTCPayServer/Controllers/AccountController.cs @@ -1,8 +1,5 @@ using System; -using System.Collections.Generic; using System.Globalization; -using System.Linq; -using System.Security.Claims; using System.Threading.Tasks; using BTCPayServer.Data; using BTCPayServer.Events; @@ -19,10 +16,7 @@ using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; -using Microsoft.AspNetCore.Mvc.Rendering; using Microsoft.Extensions.Logging; -using Microsoft.Extensions.Options; -using Newtonsoft.Json; using NicolasDorier.RateLimits; using U2F.Core.Exceptions; @@ -35,14 +29,14 @@ namespace BTCPayServer.Controllers private readonly UserManager _userManager; private readonly SignInManager _signInManager; private readonly EmailSenderFactory _EmailSenderFactory; - StoreRepository storeRepository; - RoleManager _RoleManager; - SettingsRepository _SettingsRepository; - Configuration.BTCPayServerOptions _Options; + readonly StoreRepository storeRepository; + readonly RoleManager _RoleManager; + readonly SettingsRepository _SettingsRepository; + readonly Configuration.BTCPayServerOptions _Options; private readonly BTCPayServerEnvironment _btcPayServerEnvironment; public U2FService _u2FService; private readonly EventAggregator _eventAggregator; - ILogger _logger; + readonly ILogger _logger; public AccountController( UserManager userManager, diff --git a/BTCPayServer/Controllers/AppsController.Crowdfund.cs b/BTCPayServer/Controllers/AppsController.Crowdfund.cs index e423dedd6..ff20089f5 100644 --- a/BTCPayServer/Controllers/AppsController.Crowdfund.cs +++ b/BTCPayServer/Controllers/AppsController.Crowdfund.cs @@ -1,11 +1,8 @@ using System; using System.Linq; -using System.Text; -using System.Text.Encodings.Web; using System.Threading.Tasks; using BTCPayServer.Models.AppViewModels; using BTCPayServer.Services.Apps; -using BTCPayServer.Services.Mails; using Microsoft.AspNetCore.Mvc; namespace BTCPayServer.Controllers diff --git a/BTCPayServer/Controllers/AppsController.cs b/BTCPayServer/Controllers/AppsController.cs index 7e7da5dd2..45496f7ee 100644 --- a/BTCPayServer/Controllers/AppsController.cs +++ b/BTCPayServer/Controllers/AppsController.cs @@ -1,5 +1,4 @@ using System; -using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using BTCPayServer.Data; @@ -9,13 +8,9 @@ using BTCPayServer.Security; using BTCPayServer.Services.Apps; using BTCPayServer.Services.Mails; using BTCPayServer.Services.Rates; -using Ganss.XSS; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; -using Microsoft.EntityFrameworkCore; -using NBitcoin; -using NBitcoin.DataEncoders; namespace BTCPayServer.Controllers { @@ -42,13 +37,13 @@ namespace BTCPayServer.Controllers _AppService = AppService; } - private UserManager _UserManager; - private ApplicationDbContextFactory _ContextFactory; + private readonly UserManager _UserManager; + private readonly ApplicationDbContextFactory _ContextFactory; private readonly EventAggregator _EventAggregator; - private BTCPayNetworkProvider _NetworkProvider; + private readonly BTCPayNetworkProvider _NetworkProvider; private readonly CurrencyNameTable _currencies; private readonly EmailSenderFactory _emailSenderFactory; - private AppService _AppService; + private readonly AppService _AppService; public string CreatedAppId { get; set; } diff --git a/BTCPayServer/Controllers/AppsPublicController.cs b/BTCPayServer/Controllers/AppsPublicController.cs index 97f20ee5a..7da71f701 100644 --- a/BTCPayServer/Controllers/AppsPublicController.cs +++ b/BTCPayServer/Controllers/AppsPublicController.cs @@ -2,7 +2,6 @@ using System; using System.Collections.Generic; using System.Globalization; using System.Linq; -using System.Security.Claims; using System.Threading; using System.Threading.Tasks; using BTCPayServer.Configuration; @@ -11,7 +10,6 @@ using BTCPayServer.Filters; using BTCPayServer.ModelBinders; using BTCPayServer.Models; using BTCPayServer.Models.AppViewModels; -using BTCPayServer.Security; using BTCPayServer.Services.Apps; using Microsoft.AspNetCore.Cors; using Microsoft.AspNetCore.Http.Extensions; diff --git a/BTCPayServer/Controllers/ErrorController.cs b/BTCPayServer/Controllers/ErrorController.cs index 1d93ac2b4..b41232480 100644 --- a/BTCPayServer/Controllers/ErrorController.cs +++ b/BTCPayServer/Controllers/ErrorController.cs @@ -1,8 +1,5 @@ using System; -using System.Collections.Generic; using System.Linq; -using System.Text; -using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; namespace BTCPayServer.Controllers diff --git a/BTCPayServer/Controllers/GreenField/ApiKeysController.cs b/BTCPayServer/Controllers/GreenField/ApiKeysController.cs index b82f7cc36..a853c6349 100644 --- a/BTCPayServer/Controllers/GreenField/ApiKeysController.cs +++ b/BTCPayServer/Controllers/GreenField/ApiKeysController.cs @@ -10,7 +10,6 @@ using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; using NBitcoin; using NBitcoin.DataEncoders; -using Org.BouncyCastle.Ocsp; namespace BTCPayServer.Controllers.GreenField { diff --git a/BTCPayServer/Controllers/GreenField/GreenFieldUtils.cs b/BTCPayServer/Controllers/GreenField/GreenFieldUtils.cs index 996ed7a30..51a436b5f 100644 --- a/BTCPayServer/Controllers/GreenField/GreenFieldUtils.cs +++ b/BTCPayServer/Controllers/GreenField/GreenFieldUtils.cs @@ -1,6 +1,4 @@ -using System; using System.Collections.Generic; -using System.Linq; using BTCPayServer.Client.Models; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.ModelBinding; diff --git a/BTCPayServer/Controllers/GreenField/LightningNodeApiController.cs b/BTCPayServer/Controllers/GreenField/LightningNodeApiController.cs index fdd89dbfb..6979fcfff 100644 --- a/BTCPayServer/Controllers/GreenField/LightningNodeApiController.cs +++ b/BTCPayServer/Controllers/GreenField/LightningNodeApiController.cs @@ -5,11 +5,9 @@ using System.Threading.Tasks; using BTCPayServer.Client.Models; using BTCPayServer.HostedServices; using BTCPayServer.Lightning; -using BTCPayServer.Payments.Changelly.Models; using BTCPayServer.Services; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Filters; -using NBitcoin; using Newtonsoft.Json.Linq; namespace BTCPayServer.Controllers.GreenField diff --git a/BTCPayServer/Controllers/GreenField/PullPaymentController.cs b/BTCPayServer/Controllers/GreenField/PullPaymentController.cs index 7cc67ee2b..8d60e9d1f 100644 --- a/BTCPayServer/Controllers/GreenField/PullPaymentController.cs +++ b/BTCPayServer/Controllers/GreenField/PullPaymentController.cs @@ -1,7 +1,5 @@ using System; -using System.Collections.Generic; using System.Linq; -using System.Runtime.CompilerServices; using System.Threading; using System.Threading.Tasks; using BTCPayServer; @@ -9,21 +7,14 @@ using BTCPayServer.Client; using BTCPayServer.Client.Models; using BTCPayServer.Data; using BTCPayServer.HostedServices; -using BTCPayServer.Lightning; -using BTCPayServer.ModelBinders; using BTCPayServer.Payments; using BTCPayServer.Security; using BTCPayServer.Services; -using BTCPayServer.Services.Invoices; using BTCPayServer.Services.Rates; -using ExchangeSharp; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Routing; using Microsoft.EntityFrameworkCore; -using NBitpayClient; -using NUglify.Helpers; -using Org.BouncyCastle.Ocsp; namespace BTCPayServer.Controllers.GreenField { diff --git a/BTCPayServer/Controllers/GreenField/UsersController.cs b/BTCPayServer/Controllers/GreenField/UsersController.cs index 51136ae99..14bc1202a 100644 --- a/BTCPayServer/Controllers/GreenField/UsersController.cs +++ b/BTCPayServer/Controllers/GreenField/UsersController.cs @@ -1,5 +1,4 @@ using System.Linq; -using System.Reflection; using System.Threading; using System.Threading.Tasks; using BTCPayServer.Client; @@ -14,7 +13,6 @@ using BTCPayServer.Services; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; -using Microsoft.AspNetCore.Mvc.ModelBinding; using Microsoft.Extensions.Logging; using NicolasDorier.RateLimits; diff --git a/BTCPayServer/Controllers/HomeController.cs b/BTCPayServer/Controllers/HomeController.cs index a133a4aee..29a2e65b7 100644 --- a/BTCPayServer/Controllers/HomeController.cs +++ b/BTCPayServer/Controllers/HomeController.cs @@ -8,7 +8,6 @@ using BTCPayServer.Data; using BTCPayServer.HostedServices; using BTCPayServer.Models; using BTCPayServer.Security; -using BTCPayServer.Services; using BTCPayServer.Services.Apps; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Hosting; diff --git a/BTCPayServer/Controllers/InvoiceController.API.cs b/BTCPayServer/Controllers/InvoiceController.API.cs index 72792ba8a..52beaa07f 100644 --- a/BTCPayServer/Controllers/InvoiceController.API.cs +++ b/BTCPayServer/Controllers/InvoiceController.API.cs @@ -16,8 +16,8 @@ namespace BTCPayServer.Controllers [Authorize(Policies.CanCreateInvoice, AuthenticationSchemes = AuthenticationSchemes.Bitpay)] public class InvoiceControllerAPI : Controller { - private InvoiceController _InvoiceController; - private InvoiceRepository _InvoiceRepository; + private readonly InvoiceController _InvoiceController; + private readonly InvoiceRepository _InvoiceRepository; public InvoiceControllerAPI(InvoiceController invoiceController, InvoiceRepository invoiceRepository) diff --git a/BTCPayServer/Controllers/InvoiceController.UI.cs b/BTCPayServer/Controllers/InvoiceController.UI.cs index 11a5d9b67..211707ff9 100644 --- a/BTCPayServer/Controllers/InvoiceController.UI.cs +++ b/BTCPayServer/Controllers/InvoiceController.UI.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Configuration; using System.Globalization; using System.Linq; using System.Net.Mime; @@ -22,7 +21,6 @@ using BTCPayServer.Security; using BTCPayServer.Services.Invoices; using BTCPayServer.Services.Invoices.Export; using DBriize.Utils; -using Google.Cloud.Storage.V1; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Rendering; @@ -32,7 +30,6 @@ using NBitcoin; using NBitpayClient; using NBXplorer; using Newtonsoft.Json.Linq; -using TwentyTwenty.Storage; using StoreData = BTCPayServer.Data.StoreData; namespace BTCPayServer.Controllers @@ -554,7 +551,7 @@ namespace BTCPayServer.Controllers return new EmptyResult(); } - ArraySegment DummyBuffer = new ArraySegment(new Byte[1]); + readonly ArraySegment DummyBuffer = new ArraySegment(new Byte[1]); private async Task NotifySocket(WebSocket webSocket, string invoiceId, string expectedId) { if (invoiceId != expectedId || webSocket.State != WebSocketState.Open) diff --git a/BTCPayServer/Controllers/InvoiceController.cs b/BTCPayServer/Controllers/InvoiceController.cs index 9edf16b66..b8477fc63 100644 --- a/BTCPayServer/Controllers/InvoiceController.cs +++ b/BTCPayServer/Controllers/InvoiceController.cs @@ -18,11 +18,9 @@ using BTCPayServer.Services.Apps; using BTCPayServer.Services.Invoices; using BTCPayServer.Services.Rates; using BTCPayServer.Services.Stores; -using BTCPayServer.Services.Wallets; using BTCPayServer.Validation; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; -using NBitcoin; using NBitpayClient; using Newtonsoft.Json; using CreateInvoiceRequest = BTCPayServer.Models.CreateInvoiceRequest; @@ -33,18 +31,18 @@ namespace BTCPayServer.Controllers [Filters.BitpayAPIConstraint(false)] public partial class InvoiceController : Controller { - InvoiceRepository _InvoiceRepository; - ContentSecurityPolicies _CSP; - RateFetcher _RateProvider; - StoreRepository _StoreRepository; - UserManager _UserManager; - private CurrencyNameTable _CurrencyNameTable; - EventAggregator _EventAggregator; - BTCPayNetworkProvider _NetworkProvider; + readonly InvoiceRepository _InvoiceRepository; + readonly ContentSecurityPolicies _CSP; + readonly RateFetcher _RateProvider; + readonly StoreRepository _StoreRepository; + readonly UserManager _UserManager; + private readonly CurrencyNameTable _CurrencyNameTable; + readonly EventAggregator _EventAggregator; + readonly BTCPayNetworkProvider _NetworkProvider; private readonly PaymentMethodHandlerDictionary _paymentMethodHandlerDictionary; private readonly ApplicationDbContextFactory _dbContextFactory; private readonly PullPaymentHostedService _paymentHostedService; - IServiceProvider _ServiceProvider; + readonly IServiceProvider _ServiceProvider; public InvoiceController( IServiceProvider serviceProvider, InvoiceRepository invoiceRepository, diff --git a/BTCPayServer/Controllers/Macaroons.cs b/BTCPayServer/Controllers/Macaroons.cs index 31d4d53b0..06eed35ea 100644 --- a/BTCPayServer/Controllers/Macaroons.cs +++ b/BTCPayServer/Controllers/Macaroons.cs @@ -1,7 +1,5 @@ using System; -using System.Collections.Generic; using System.IO; -using System.Linq; using System.Threading.Tasks; namespace BTCPayServer.Controllers diff --git a/BTCPayServer/Controllers/ManageController.2FA.cs b/BTCPayServer/Controllers/ManageController.2FA.cs index e0335930f..753d0e3fe 100644 --- a/BTCPayServer/Controllers/ManageController.2FA.cs +++ b/BTCPayServer/Controllers/ManageController.2FA.cs @@ -4,7 +4,6 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using BTCPayServer.Data; -using BTCPayServer.Models; using BTCPayServer.Models.ManageViewModels; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; diff --git a/BTCPayServer/Controllers/ManageController.APIKeys.cs b/BTCPayServer/Controllers/ManageController.APIKeys.cs index 62e4031f5..a0499d0b5 100644 --- a/BTCPayServer/Controllers/ManageController.APIKeys.cs +++ b/BTCPayServer/Controllers/ManageController.APIKeys.cs @@ -6,13 +6,11 @@ using System.Threading.Tasks; using BTCPayServer.Client; using BTCPayServer.Data; using BTCPayServer.Models; -using BTCPayServer.Security; using BTCPayServer.Security.GreenField; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using NBitcoin; using NBitcoin.DataEncoders; -using YamlDotNet.Core.Tokens; namespace BTCPayServer.Controllers { diff --git a/BTCPayServer/Controllers/ManageController.U2F.cs b/BTCPayServer/Controllers/ManageController.U2F.cs index c827194f9..2e4df074c 100644 --- a/BTCPayServer/Controllers/ManageController.U2F.cs +++ b/BTCPayServer/Controllers/ManageController.U2F.cs @@ -1,4 +1,3 @@ -using System; using System.Threading.Tasks; using BTCPayServer.Models; using BTCPayServer.U2F.Models; diff --git a/BTCPayServer/Controllers/ManageController.cs b/BTCPayServer/Controllers/ManageController.cs index 90f6840d8..5fef8d0d8 100644 --- a/BTCPayServer/Controllers/ManageController.cs +++ b/BTCPayServer/Controllers/ManageController.cs @@ -1,11 +1,7 @@ using System; -using System.Globalization; -using System.Linq; -using System.Text; using System.Text.Encodings.Web; using System.Threading.Tasks; using BTCPayServer.Data; -using BTCPayServer.Models; using BTCPayServer.Models.ManageViewModels; using BTCPayServer.Security; using BTCPayServer.Security.GreenField; @@ -14,7 +10,6 @@ using BTCPayServer.Services.Mails; using BTCPayServer.Services.Stores; using BTCPayServer.Services.Wallets; using BTCPayServer.U2F; -using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Identity; @@ -33,13 +28,13 @@ namespace BTCPayServer.Controllers private readonly EmailSenderFactory _EmailSenderFactory; private readonly ILogger _logger; private readonly UrlEncoder _urlEncoder; - IWebHostEnvironment _Env; + readonly IWebHostEnvironment _Env; public U2FService _u2FService; private readonly BTCPayServerEnvironment _btcPayServerEnvironment; private readonly APIKeyRepository _apiKeyRepository; private readonly IAuthorizationService _authorizationService; private readonly LinkGenerator _linkGenerator; - StoreRepository _StoreRepository; + readonly StoreRepository _StoreRepository; diff --git a/BTCPayServer/Controllers/PaymentRequestController.cs b/BTCPayServer/Controllers/PaymentRequestController.cs index 0de69ca44..077d567c1 100644 --- a/BTCPayServer/Controllers/PaymentRequestController.cs +++ b/BTCPayServer/Controllers/PaymentRequestController.cs @@ -1,8 +1,6 @@ using System; using System.Collections.Generic; -using System.Globalization; using System.Linq; -using System.Security.Claims; using System.Threading; using System.Threading.Tasks; using BTCPayServer.Data; @@ -11,23 +9,16 @@ using BTCPayServer.Filters; using BTCPayServer.Models; using BTCPayServer.Models.PaymentRequestViewModels; using BTCPayServer.PaymentRequest; -using BTCPayServer.Payments; -using BTCPayServer.Payments.Lightning; -using BTCPayServer.Rating; using BTCPayServer.Security; using BTCPayServer.Services.Invoices; using BTCPayServer.Services.PaymentRequests; using BTCPayServer.Services.Rates; using BTCPayServer.Services.Stores; -using Ganss.XSS; using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Http.Extensions; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Rendering; using Microsoft.AspNetCore.Routing; -using Microsoft.EntityFrameworkCore.Metadata.Internal; -using NBitpayClient; namespace BTCPayServer.Controllers { diff --git a/BTCPayServer/Controllers/PublicController.cs b/BTCPayServer/Controllers/PublicController.cs index bf9a44318..c29eb6380 100644 --- a/BTCPayServer/Controllers/PublicController.cs +++ b/BTCPayServer/Controllers/PublicController.cs @@ -1,11 +1,8 @@ using System; -using System.Collections.Generic; -using System.Linq; using System.Threading; using System.Threading.Tasks; using System.Web; using BTCPayServer.Data; -using BTCPayServer.Filters; using BTCPayServer.Models; using BTCPayServer.Models.StoreViewModels; using BTCPayServer.Services.Stores; @@ -23,8 +20,8 @@ namespace BTCPayServer.Controllers _StoreRepository = storeRepository; } - private InvoiceController _InvoiceController; - private StoreRepository _StoreRepository; + private readonly InvoiceController _InvoiceController; + private readonly StoreRepository _StoreRepository; [HttpGet] [IgnoreAntiforgeryToken] diff --git a/BTCPayServer/Controllers/PublicLightningNodeInfoController.cs b/BTCPayServer/Controllers/PublicLightningNodeInfoController.cs index b1cab187e..4d869a39f 100644 --- a/BTCPayServer/Controllers/PublicLightningNodeInfoController.cs +++ b/BTCPayServer/Controllers/PublicLightningNodeInfoController.cs @@ -3,8 +3,6 @@ using System.Linq; using System.Threading.Tasks; using BTCPayServer.Data; using BTCPayServer.Filters; -using BTCPayServer.Lightning; -using BTCPayServer.Models.StoreViewModels; using BTCPayServer.Payments; using BTCPayServer.Payments.Lightning; using BTCPayServer.Services.Stores; diff --git a/BTCPayServer/Controllers/PullPaymentController.cs b/BTCPayServer/Controllers/PullPaymentController.cs index 581295710..034bb5345 100644 --- a/BTCPayServer/Controllers/PullPaymentController.cs +++ b/BTCPayServer/Controllers/PullPaymentController.cs @@ -1,21 +1,17 @@ using System; -using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Threading.Tasks; using BTCPayServer; using BTCPayServer.Data; using BTCPayServer.HostedServices; -using BTCPayServer.ModelBinders; using BTCPayServer.Models; using BTCPayServer.Payments; using BTCPayServer.Services; using BTCPayServer.Services.Rates; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; -using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Internal; namespace BTCPayServer.Controllers { diff --git a/BTCPayServer/Controllers/RateController.cs b/BTCPayServer/Controllers/RateController.cs index 6b14017bc..712193734 100644 --- a/BTCPayServer/Controllers/RateController.cs +++ b/BTCPayServer/Controllers/RateController.cs @@ -30,10 +30,11 @@ namespace BTCPayServer.Controllers return HttpContext.GetStoreData(); } } - RateFetcher _RateProviderFactory; - BTCPayNetworkProvider _NetworkProvider; - CurrencyNameTable _CurrencyNameTable; - StoreRepository _StoreRepo; + + readonly RateFetcher _RateProviderFactory; + readonly BTCPayNetworkProvider _NetworkProvider; + readonly CurrencyNameTable _CurrencyNameTable; + readonly StoreRepository _StoreRepo; public TokenRepository TokenRepository { get; } diff --git a/BTCPayServer/Controllers/ServerController.cs b/BTCPayServer/Controllers/ServerController.cs index 4b867a6e4..d8b31afe7 100644 --- a/BTCPayServer/Controllers/ServerController.cs +++ b/BTCPayServer/Controllers/ServerController.cs @@ -1,32 +1,25 @@ using System; using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; using System.Globalization; using System.IO; using System.Linq; using System.Net; using System.Net.Http; using System.Net.Mail; -using System.Runtime.CompilerServices; using System.Threading.Tasks; -using BTCPayServer.Client; using BTCPayServer.Configuration; using BTCPayServer.Data; using BTCPayServer.HostedServices; -using BTCPayServer.Lightning; using BTCPayServer.Logging; using BTCPayServer.Models; using BTCPayServer.Models.ServerViewModels; -using BTCPayServer.Payments.Lightning; using BTCPayServer.Services; using BTCPayServer.Services.Apps; using BTCPayServer.Services.Mails; -using BTCPayServer.Services.Rates; using BTCPayServer.Services.Stores; using BTCPayServer.Storage.Models; using BTCPayServer.Storage.Services; using BTCPayServer.Storage.Services.Providers; -using BTCPayServer.Validation; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; @@ -43,13 +36,13 @@ namespace BTCPayServer.Controllers AuthenticationSchemes = BTCPayServer.Security.AuthenticationSchemes.Cookie)] public partial class ServerController : Controller { - private UserManager _UserManager; - SettingsRepository _SettingsRepository; + private readonly UserManager _UserManager; + readonly SettingsRepository _SettingsRepository; private readonly NBXplorerDashboard _dashBoard; - private StoreRepository _StoreRepository; - LightningConfigurationProvider _LnConfigProvider; + private readonly StoreRepository _StoreRepository; + readonly LightningConfigurationProvider _LnConfigProvider; private readonly TorServices _torServices; - private BTCPayServerOptions _Options; + private readonly BTCPayServerOptions _Options; private readonly AppService _AppService; private readonly CheckConfigurationHostedService _sshState; private readonly StoredFileRepository _StoredFileRepository; diff --git a/BTCPayServer/Controllers/StorageController.cs b/BTCPayServer/Controllers/StorageController.cs index 9ef49b7f8..204c0aacc 100644 --- a/BTCPayServer/Controllers/StorageController.cs +++ b/BTCPayServer/Controllers/StorageController.cs @@ -1,4 +1,3 @@ -using System; using System.Threading.Tasks; using BTCPayServer.Configuration; using BTCPayServer.Storage.Services; @@ -11,7 +10,7 @@ namespace BTCPayServer.Storage public class StorageController : Controller { private readonly FileService _FileService; - private string _dir; + private readonly string _dir; public StorageController(FileService fileService, BTCPayServerOptions serverOptions) { diff --git a/BTCPayServer/Controllers/StoresController.BTCLike.cs b/BTCPayServer/Controllers/StoresController.BTCLike.cs index e12f66231..f827b5599 100644 --- a/BTCPayServer/Controllers/StoresController.BTCLike.cs +++ b/BTCPayServer/Controllers/StoresController.BTCLike.cs @@ -1,17 +1,10 @@ using System; -using System.Collections.Generic; -using System.Globalization; using System.IO; using System.Linq; -using System.Net.WebSockets; -using System.Reflection.Metadata.Ecma335; -using System.Text; -using System.Threading; using System.Threading.Tasks; using BTCPayServer.Client; using BTCPayServer.Data; using BTCPayServer.Events; -using BTCPayServer.Logging; using BTCPayServer.Models; using BTCPayServer.Models.StoreViewModels; using BTCPayServer.Payments; @@ -19,12 +12,9 @@ using BTCPayServer.Services; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; -using Microsoft.Extensions.Logging; using NBitcoin; using NBXplorer.DerivationStrategy; using NBXplorer.Models; -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; namespace BTCPayServer.Controllers { diff --git a/BTCPayServer/Controllers/StoresController.Email.cs b/BTCPayServer/Controllers/StoresController.Email.cs index 4c712f665..600c74db9 100644 --- a/BTCPayServer/Controllers/StoresController.Email.cs +++ b/BTCPayServer/Controllers/StoresController.Email.cs @@ -3,8 +3,6 @@ using System.Net.Mail; using System.Threading.Tasks; using BTCPayServer.Data; using BTCPayServer.Models.ServerViewModels; -using BTCPayServer.Models.StoreViewModels; -using BTCPayServer.Payments.Changelly; using BTCPayServer.Services.Mails; using Microsoft.AspNetCore.Mvc; diff --git a/BTCPayServer/Controllers/StoresController.LightningLike.cs b/BTCPayServer/Controllers/StoresController.LightningLike.cs index 5507f2661..6fe0b8557 100644 --- a/BTCPayServer/Controllers/StoresController.LightningLike.cs +++ b/BTCPayServer/Controllers/StoresController.LightningLike.cs @@ -1,7 +1,5 @@ using System; -using System.Collections.Generic; using System.Linq; -using System.Net; using System.Threading; using System.Threading.Tasks; using BTCPayServer.Data; diff --git a/BTCPayServer/Controllers/StoresController.cs b/BTCPayServer/Controllers/StoresController.cs index e4011b909..a55965bb5 100644 --- a/BTCPayServer/Controllers/StoresController.cs +++ b/BTCPayServer/Controllers/StoresController.cs @@ -6,7 +6,6 @@ using System.Net.Http; using System.Threading; using System.Threading.Tasks; using BTCPayServer.Client; -using BTCPayServer.Client.Models; using BTCPayServer.Configuration; using BTCPayServer.Data; using BTCPayServer.HostedServices; @@ -42,7 +41,7 @@ namespace BTCPayServer.Controllers [AutoValidateAntiforgeryToken] public partial class StoresController : Controller { - RateFetcher _RateFactory; + readonly RateFetcher _RateFactory; public string CreatedStoreId { get; set; } public StoresController( IServiceProvider serviceProvider, @@ -90,21 +89,22 @@ namespace BTCPayServer.Controllers _BtcpayServerOptions = btcpayServerOptions; _BTCPayEnv = btcpayEnv; } - BTCPayServerOptions _BtcpayServerOptions; - BTCPayServerEnvironment _BTCPayEnv; - IServiceProvider _ServiceProvider; - BTCPayNetworkProvider _NetworkProvider; - private ExplorerClientProvider _ExplorerProvider; - private IFeeProviderFactory _FeeRateProvider; - BTCPayWalletProvider _WalletProvider; - AccessTokenController _TokenController; - StoreRepository _Repo; - TokenRepository _TokenRepository; - UserManager _UserManager; - private LanguageService _LangService; + + readonly BTCPayServerOptions _BtcpayServerOptions; + readonly BTCPayServerEnvironment _BTCPayEnv; + readonly IServiceProvider _ServiceProvider; + readonly BTCPayNetworkProvider _NetworkProvider; + private readonly ExplorerClientProvider _ExplorerProvider; + private readonly IFeeProviderFactory _FeeRateProvider; + readonly BTCPayWalletProvider _WalletProvider; + readonly AccessTokenController _TokenController; + readonly StoreRepository _Repo; + readonly TokenRepository _TokenRepository; + readonly UserManager _UserManager; + private readonly LanguageService _LangService; private readonly ChangellyClientProvider _changellyClientProvider; - IWebHostEnvironment _Env; - private IHttpClientFactory _httpClientFactory; + readonly IWebHostEnvironment _Env; + private readonly IHttpClientFactory _httpClientFactory; private readonly PaymentMethodHandlerDictionary _paymentMethodHandlerDictionary; private readonly SettingsRepository _settingsRepository; private readonly IAuthorizationService _authorizationService; @@ -761,7 +761,7 @@ namespace BTCPayServer.Controllers } else { - pairingCode = ((DataWrapper>)await _TokenController.Tokens(tokenRequest)).Data[0].PairingCode; + pairingCode = (await _TokenController.Tokens(tokenRequest)).Data[0].PairingCode; } GeneratedPairingCode = pairingCode; diff --git a/BTCPayServer/Controllers/UserStoresController.cs b/BTCPayServer/Controllers/UserStoresController.cs index 54d29950e..4839901d7 100644 --- a/BTCPayServer/Controllers/UserStoresController.cs +++ b/BTCPayServer/Controllers/UserStoresController.cs @@ -1,18 +1,12 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading; using System.Threading.Tasks; using BTCPayServer.Data; using BTCPayServer.Models; using BTCPayServer.Models.StoreViewModels; using BTCPayServer.Security; using BTCPayServer.Services.Stores; -using BTCPayServer.Services.Wallets; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; -using NBXplorer.DerivationStrategy; namespace BTCPayServer.Controllers { @@ -21,9 +15,9 @@ namespace BTCPayServer.Controllers [AutoValidateAntiforgeryToken] public partial class UserStoresController : Controller { - private StoreRepository _Repo; - private BTCPayNetworkProvider _NetworkProvider; - private UserManager _UserManager; + private readonly StoreRepository _Repo; + private readonly BTCPayNetworkProvider _NetworkProvider; + private readonly UserManager _UserManager; public UserStoresController( UserManager userManager, diff --git a/BTCPayServer/Controllers/VaultController.cs b/BTCPayServer/Controllers/VaultController.cs index ec96a2eec..677a1359c 100644 --- a/BTCPayServer/Controllers/VaultController.cs +++ b/BTCPayServer/Controllers/VaultController.cs @@ -1,27 +1,18 @@ using System; using System.Collections.Generic; using System.Globalization; -using System.IO; using System.Linq; -using System.Net.WebSockets; -using System.Text; using System.Threading; using System.Threading.Tasks; using BTCPayServer.Client; using BTCPayServer.Data; using BTCPayServer.Hwi; using BTCPayServer.ModelBinders; -using BTCPayServer.Models; -using BTCPayServer.Models.StoreViewModels; -using BTCPayServer.Payments; -using BTCPayServer.Security; -using BTCPayServer.Services; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using NBitcoin; using NBXplorer.DerivationStrategy; -using Newtonsoft.Json; using Newtonsoft.Json.Linq; namespace BTCPayServer.Controllers diff --git a/BTCPayServer/Controllers/WalletsController.PSBT.cs b/BTCPayServer/Controllers/WalletsController.PSBT.cs index d4ea7262e..3f48ea373 100644 --- a/BTCPayServer/Controllers/WalletsController.PSBT.cs +++ b/BTCPayServer/Controllers/WalletsController.PSBT.cs @@ -1,8 +1,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Net.Http; -using System.Text; using System.Threading; using System.Threading.Tasks; using BTCPayServer.HostedServices; diff --git a/BTCPayServer/Controllers/WalletsController.PullPayments.cs b/BTCPayServer/Controllers/WalletsController.PullPayments.cs index 1f69919d1..040618817 100644 --- a/BTCPayServer/Controllers/WalletsController.PullPayments.cs +++ b/BTCPayServer/Controllers/WalletsController.PullPayments.cs @@ -1,13 +1,9 @@ using System; using System.Collections.Generic; -using System.Dynamic; using System.Globalization; using System.Linq; -using System.Net.WebSockets; -using System.Text; using System.Threading; using System.Threading.Tasks; -using Amazon.Runtime.Internal.Util; using BTCPayServer.Data; using BTCPayServer.HostedServices; using BTCPayServer.ModelBinders; @@ -15,17 +11,10 @@ using BTCPayServer.Models; using BTCPayServer.Models.WalletViewModels; using BTCPayServer.Payments; using BTCPayServer.Rating; -using BTCPayServer.Services.Rates; using BTCPayServer.Views; -using ExchangeSharp; -using Microsoft.AspNetCore.Html; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.Internal; -using Microsoft.Extensions.Primitives; using NBitcoin; -using NBitcoin.Payment; -using TwentyTwenty.Storage; namespace BTCPayServer.Controllers { diff --git a/BTCPayServer/Controllers/WalletsController.cs b/BTCPayServer/Controllers/WalletsController.cs index 890dfb789..29f877821 100644 --- a/BTCPayServer/Controllers/WalletsController.cs +++ b/BTCPayServer/Controllers/WalletsController.cs @@ -2,8 +2,6 @@ using System; using System.Collections.Generic; using System.Globalization; using System.Linq; -using System.Net.WebSockets; -using System.Text; using System.Threading; using System.Threading.Tasks; using BTCPayServer.Client; @@ -59,7 +57,7 @@ namespace BTCPayServer.Controllers public RateFetcher RateFetcher { get; } - CurrencyNameTable _currencyTable; + readonly CurrencyNameTable _currencyTable; public WalletsController(StoreRepository repo, WalletRepository walletRepository, CurrencyNameTable currencyTable, @@ -106,7 +104,7 @@ namespace BTCPayServer.Controllers } // Borrowed from https://github.com/ManageIQ/guides/blob/master/labels.md - string[] LabelColorScheme = new string[] + readonly string[] LabelColorScheme = new string[] { "#fbca04", "#0e8a16", diff --git a/BTCPayServer/CorsPolicies.cs b/BTCPayServer/CorsPolicies.cs index d26f9880b..1d767694a 100644 --- a/BTCPayServer/CorsPolicies.cs +++ b/BTCPayServer/CorsPolicies.cs @@ -1,8 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - namespace BTCPayServer { public static class CorsPolicies diff --git a/BTCPayServer/CurrencyValue.cs b/BTCPayServer/CurrencyValue.cs index ee177665f..bfbbd86de 100644 --- a/BTCPayServer/CurrencyValue.cs +++ b/BTCPayServer/CurrencyValue.cs @@ -1,16 +1,13 @@ using System; -using System.Collections.Generic; using System.Globalization; -using System.Linq; using System.Text.RegularExpressions; -using System.Threading.Tasks; using BTCPayServer.Services.Rates; namespace BTCPayServer { public class CurrencyValue { - static Regex _Regex = new Regex("^([0-9]+(\\.[0-9]+)?)\\s*([a-zA-Z]+)$"); + static readonly Regex _Regex = new Regex("^([0-9]+(\\.[0-9]+)?)\\s*([a-zA-Z]+)$"); public static bool TryParse(string str, out CurrencyValue value) { value = null; diff --git a/BTCPayServer/Data/AddressInvoiceDataExtensions.cs b/BTCPayServer/Data/AddressInvoiceDataExtensions.cs index 9303e3129..7dfc5cfc3 100644 --- a/BTCPayServer/Data/AddressInvoiceDataExtensions.cs +++ b/BTCPayServer/Data/AddressInvoiceDataExtensions.cs @@ -1,7 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; using BTCPayServer.Payments; namespace BTCPayServer.Data diff --git a/BTCPayServer/Data/HistoricalAddressInvoiceDataExtensions.cs b/BTCPayServer/Data/HistoricalAddressInvoiceDataExtensions.cs index 798aee04e..1d0375f76 100644 --- a/BTCPayServer/Data/HistoricalAddressInvoiceDataExtensions.cs +++ b/BTCPayServer/Data/HistoricalAddressInvoiceDataExtensions.cs @@ -1,7 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; namespace BTCPayServer.Data { diff --git a/BTCPayServer/Data/InvoiceDataExtensions.cs b/BTCPayServer/Data/InvoiceDataExtensions.cs index 619313453..1cfd65ea9 100644 --- a/BTCPayServer/Data/InvoiceDataExtensions.cs +++ b/BTCPayServer/Data/InvoiceDataExtensions.cs @@ -1,7 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; using BTCPayServer.Services.Invoices; namespace BTCPayServer.Data diff --git a/BTCPayServer/Data/PaymentDataExtensions.cs b/BTCPayServer/Data/PaymentDataExtensions.cs index 90d4282d6..3423b88a4 100644 --- a/BTCPayServer/Data/PaymentDataExtensions.cs +++ b/BTCPayServer/Data/PaymentDataExtensions.cs @@ -1,7 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; using BTCPayServer.Services.Invoices; using Newtonsoft.Json.Linq; diff --git a/BTCPayServer/Data/PullPaymentsExtensions.cs b/BTCPayServer/Data/PullPaymentsExtensions.cs index 4dedc0e07..3165f3de5 100644 --- a/BTCPayServer/Data/PullPaymentsExtensions.cs +++ b/BTCPayServer/Data/PullPaymentsExtensions.cs @@ -1,20 +1,14 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Security.Cryptography; using System.Text; using System.Threading.Tasks; using BTCPayServer.Client.JsonConverters; using BTCPayServer.JsonConverters; using BTCPayServer.Payments; using BTCPayServer.Services; -using Microsoft.AspNetCore.Identity; -using Microsoft.AspNetCore.Mvc.NewtonsoftJson; -using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.EntityFrameworkCore; using NBitcoin; -using NBitcoin.Crypto; -using NBitcoin.DataEncoders; using NBitcoin.JsonConverters; using NBitcoin.Payment; using Newtonsoft.Json; diff --git a/BTCPayServer/Data/StoreDataExtensions.cs b/BTCPayServer/Data/StoreDataExtensions.cs index 798a7fa89..bcab2867d 100644 --- a/BTCPayServer/Data/StoreDataExtensions.cs +++ b/BTCPayServer/Data/StoreDataExtensions.cs @@ -1,15 +1,10 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Security.Claims; using System.Text; -using System.Threading.Tasks; using BTCPayServer.Payments; -using BTCPayServer.Security; using BTCPayServer.Services.Rates; -using NBitcoin; using NBXplorer; -using NBXplorer.DerivationStrategy; using Newtonsoft.Json.Linq; namespace BTCPayServer.Data diff --git a/BTCPayServer/Data/WalletDataExtensions.cs b/BTCPayServer/Data/WalletDataExtensions.cs index ca251b1fa..f1645b5d1 100644 --- a/BTCPayServer/Data/WalletDataExtensions.cs +++ b/BTCPayServer/Data/WalletDataExtensions.cs @@ -1,7 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; using Newtonsoft.Json; namespace BTCPayServer.Data diff --git a/BTCPayServer/Data/WalletTransactionDataExtensions.cs b/BTCPayServer/Data/WalletTransactionDataExtensions.cs index 5071fb5f8..5544e917d 100644 --- a/BTCPayServer/Data/WalletTransactionDataExtensions.cs +++ b/BTCPayServer/Data/WalletTransactionDataExtensions.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using Microsoft.EntityFrameworkCore.Internal; using Newtonsoft.Json; using Newtonsoft.Json.Linq; diff --git a/BTCPayServer/DerivationSchemeParser.cs b/BTCPayServer/DerivationSchemeParser.cs index 89d08dc15..53a19b0af 100644 --- a/BTCPayServer/DerivationSchemeParser.cs +++ b/BTCPayServer/DerivationSchemeParser.cs @@ -1,11 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Text; -using System.Threading.Tasks; using NBitcoin; -using NBitcoin.DataEncoders; -using NBXplorer; using NBXplorer.DerivationStrategy; namespace BTCPayServer diff --git a/BTCPayServer/DerivationSchemeSettings.cs b/BTCPayServer/DerivationSchemeSettings.cs index 1fad90982..10b8e6461 100644 --- a/BTCPayServer/DerivationSchemeSettings.cs +++ b/BTCPayServer/DerivationSchemeSettings.cs @@ -1,8 +1,6 @@ using System; using System.Collections.Generic; -using System.Globalization; using System.Linq; -using System.Threading.Tasks; using BTCPayServer.Payments; using NBitcoin; using NBitcoin.DataEncoders; diff --git a/BTCPayServer/EventAggregator.cs b/BTCPayServer/EventAggregator.cs index 8ba96d19f..23232402f 100644 --- a/BTCPayServer/EventAggregator.cs +++ b/BTCPayServer/EventAggregator.cs @@ -17,8 +17,8 @@ namespace BTCPayServer { class Subscription : IEventAggregatorSubscription { - private EventAggregator aggregator; - Type t; + private readonly EventAggregator aggregator; + readonly Type t; public Subscription(EventAggregator aggregator, Type t) { this.aggregator = aggregator; @@ -126,7 +126,7 @@ namespace BTCPayServer return subscription; } - Dictionary>> _Subscriptions = new Dictionary>>(); + readonly Dictionary>> _Subscriptions = new Dictionary>>(); public IEventAggregatorSubscription Subscribe(Func subscription) { diff --git a/BTCPayServer/Events/InvoiceDataChangedEvent.cs b/BTCPayServer/Events/InvoiceDataChangedEvent.cs index 3d95d27f1..8c5124bff 100644 --- a/BTCPayServer/Events/InvoiceDataChangedEvent.cs +++ b/BTCPayServer/Events/InvoiceDataChangedEvent.cs @@ -1,7 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; using BTCPayServer.Services.Invoices; namespace BTCPayServer.Events diff --git a/BTCPayServer/Events/InvoiceEvent.cs b/BTCPayServer/Events/InvoiceEvent.cs index 46a903abd..b55f7384d 100644 --- a/BTCPayServer/Events/InvoiceEvent.cs +++ b/BTCPayServer/Events/InvoiceEvent.cs @@ -1,7 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; using BTCPayServer.Services.Invoices; namespace BTCPayServer.Events diff --git a/BTCPayServer/Events/InvoiceIPNEvent.cs b/BTCPayServer/Events/InvoiceIPNEvent.cs index b9d261780..96922b8f9 100644 --- a/BTCPayServer/Events/InvoiceIPNEvent.cs +++ b/BTCPayServer/Events/InvoiceIPNEvent.cs @@ -1,8 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - namespace BTCPayServer.Events { public class InvoiceIPNEvent diff --git a/BTCPayServer/Events/InvoiceNeedUpdateEvent.cs b/BTCPayServer/Events/InvoiceNeedUpdateEvent.cs index 185642de2..f18b36dd2 100644 --- a/BTCPayServer/Events/InvoiceNeedUpdateEvent.cs +++ b/BTCPayServer/Events/InvoiceNeedUpdateEvent.cs @@ -1,7 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; namespace BTCPayServer.Events { diff --git a/BTCPayServer/Events/InvoiceNewAddressEvent.cs b/BTCPayServer/Events/InvoiceNewAddressEvent.cs index 808913997..48e9161b3 100644 --- a/BTCPayServer/Events/InvoiceNewAddressEvent.cs +++ b/BTCPayServer/Events/InvoiceNewAddressEvent.cs @@ -1,8 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - namespace BTCPayServer.Events { public class InvoiceNewAddressEvent diff --git a/BTCPayServer/Events/InvoiceStopWatchedEvent.cs b/BTCPayServer/Events/InvoiceStopWatchedEvent.cs index 0414730f3..ef169ce21 100644 --- a/BTCPayServer/Events/InvoiceStopWatchedEvent.cs +++ b/BTCPayServer/Events/InvoiceStopWatchedEvent.cs @@ -1,8 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - namespace BTCPayServer.Events { public class InvoiceStopWatchedEvent diff --git a/BTCPayServer/Events/NBXplorerStateChangedEvent.cs b/BTCPayServer/Events/NBXplorerStateChangedEvent.cs index 8d7ea978d..cb5115073 100644 --- a/BTCPayServer/Events/NBXplorerStateChangedEvent.cs +++ b/BTCPayServer/Events/NBXplorerStateChangedEvent.cs @@ -1,7 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; using BTCPayServer.HostedServices; namespace BTCPayServer.Events diff --git a/BTCPayServer/Events/NewBlockEvent.cs b/BTCPayServer/Events/NewBlockEvent.cs index d25261821..5faef5d6c 100644 --- a/BTCPayServer/Events/NewBlockEvent.cs +++ b/BTCPayServer/Events/NewBlockEvent.cs @@ -1,8 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - namespace BTCPayServer.Events { public class NewBlockEvent diff --git a/BTCPayServer/Events/UserRegisteredEvent.cs b/BTCPayServer/Events/UserRegisteredEvent.cs index 0c4ea21c7..d09477610 100644 --- a/BTCPayServer/Events/UserRegisteredEvent.cs +++ b/BTCPayServer/Events/UserRegisteredEvent.cs @@ -1,6 +1,5 @@ using System; using BTCPayServer.Data; -using Microsoft.AspNetCore.Http; namespace BTCPayServer.Events { diff --git a/BTCPayServer/ExplorerClientProvider.cs b/BTCPayServer/ExplorerClientProvider.cs index 339521e48..ac5db3540 100644 --- a/BTCPayServer/ExplorerClientProvider.cs +++ b/BTCPayServer/ExplorerClientProvider.cs @@ -2,7 +2,6 @@ using System; using System.Collections.Generic; using System.Linq; using System.Net.Http; -using System.Threading.Tasks; using BTCPayServer.Configuration; using BTCPayServer.HostedServices; using BTCPayServer.Logging; @@ -13,11 +12,12 @@ namespace BTCPayServer { public class ExplorerClientProvider { - BTCPayNetworkProvider _NetworkProviders; - BTCPayServerOptions _Options; + readonly BTCPayNetworkProvider _NetworkProviders; + readonly BTCPayServerOptions _Options; public BTCPayNetworkProvider NetworkProviders => _NetworkProviders; - NBXplorerDashboard _Dashboard; + + readonly NBXplorerDashboard _Dashboard; public ExplorerClientProvider(IHttpClientFactory httpClientFactory, BTCPayNetworkProvider networkProviders, BTCPayServerOptions options, NBXplorerDashboard dashboard) { _Dashboard = dashboard; @@ -55,7 +55,7 @@ namespace BTCPayServer return explorer; } - Dictionary _Clients = new Dictionary(); + readonly Dictionary _Clients = new Dictionary(); public ExplorerClient GetExplorerClient(string cryptoCode) { diff --git a/BTCPayServer/Extensions.cs b/BTCPayServer/Extensions.cs index 9f12bd60d..dab1efc7f 100644 --- a/BTCPayServer/Extensions.cs +++ b/BTCPayServer/Extensions.cs @@ -1,45 +1,33 @@ using System; using System.Collections.Generic; using System.Globalization; -using System.IO; using System.Linq; using System.Net; using System.Net.WebSockets; using System.Security.Claims; using System.Text; -using System.Text.Encodings.Web; using System.Threading; using System.Threading.Tasks; using BTCPayServer.Configuration; using BTCPayServer.Data; using BTCPayServer.Lightning; -using BTCPayServer.Logging; using BTCPayServer.Models; using BTCPayServer.Payments; using BTCPayServer.Payments.Bitcoin; using BTCPayServer.Services; using BTCPayServer.Services.Invoices; using BTCPayServer.Services.Wallets; -using Microsoft.AspNetCore.Hosting; -using Microsoft.AspNetCore.Html; using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Identity; -using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.ViewFeatures; -using Microsoft.AspNetCore.Routing; -using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Logging; using NBitcoin; using NBitcoin.Payment; using NBitpayClient; -using NBXplorer; using NBXplorer.DerivationStrategy; using NBXplorer.Models; using Newtonsoft.Json; using Newtonsoft.Json.Linq; -using Newtonsoft.Json.Serialization; namespace BTCPayServer { diff --git a/BTCPayServer/Extensions/SSHClientExtensions.cs b/BTCPayServer/Extensions/SSHClientExtensions.cs index 7a79242fc..f734af26f 100644 --- a/BTCPayServer/Extensions/SSHClientExtensions.cs +++ b/BTCPayServer/Extensions/SSHClientExtensions.cs @@ -1,6 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; using System.Threading; using System.Threading.Tasks; using BTCPayServer.SSH; diff --git a/BTCPayServer/Extensions/ServiceCollectionExtensions.cs b/BTCPayServer/Extensions/ServiceCollectionExtensions.cs index ef89a798f..3a21f649f 100644 --- a/BTCPayServer/Extensions/ServiceCollectionExtensions.cs +++ b/BTCPayServer/Extensions/ServiceCollectionExtensions.cs @@ -1,7 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; using BTCPayServer.Hosting; namespace Microsoft.Extensions.DependencyInjection diff --git a/BTCPayServer/Extensions/WebHostExtensions.cs b/BTCPayServer/Extensions/WebHostExtensions.cs index d5272cc78..4014c8967 100644 --- a/BTCPayServer/Extensions/WebHostExtensions.cs +++ b/BTCPayServer/Extensions/WebHostExtensions.cs @@ -1,6 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Linq; using System.Threading; using System.Threading.Tasks; using BTCPayServer.Hosting; diff --git a/BTCPayServer/Filters/ContentSecurityPolicyAttribute.cs b/BTCPayServer/Filters/ContentSecurityPolicyAttribute.cs index e2f67cdce..1d5f7e576 100644 --- a/BTCPayServer/Filters/ContentSecurityPolicyAttribute.cs +++ b/BTCPayServer/Filters/ContentSecurityPolicyAttribute.cs @@ -1,7 +1,5 @@ using System; -using System.Collections.Generic; using System.Linq; -using System.Text; using System.Threading.Tasks; using BTCPayServer.Security; using Microsoft.AspNetCore.Mvc.Filters; diff --git a/BTCPayServer/Filters/OnlyIfSupportAttribute.cs b/BTCPayServer/Filters/OnlyIfSupportAttribute.cs index 37dffee7a..a4ae1c679 100644 --- a/BTCPayServer/Filters/OnlyIfSupportAttribute.cs +++ b/BTCPayServer/Filters/OnlyIfSupportAttribute.cs @@ -1,6 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; using System.Threading.Tasks; using BTCPayServer.Configuration; using Microsoft.AspNetCore.Mvc; diff --git a/BTCPayServer/Filters/OnlyMediaTypeAttribute.cs b/BTCPayServer/Filters/OnlyMediaTypeAttribute.cs index ef1919b37..07794b43c 100644 --- a/BTCPayServer/Filters/OnlyMediaTypeAttribute.cs +++ b/BTCPayServer/Filters/OnlyMediaTypeAttribute.cs @@ -1,9 +1,6 @@ using System; -using System.Collections.Generic; using System.Linq; -using System.Text; using Microsoft.AspNetCore.Mvc.ActionConstraints; -using Microsoft.Extensions.Primitives; namespace BTCPayServer.Filters { diff --git a/BTCPayServer/Filters/ReferrerPolicyAttribute.cs b/BTCPayServer/Filters/ReferrerPolicyAttribute.cs index 8dac91d17..2b84475a6 100644 --- a/BTCPayServer/Filters/ReferrerPolicyAttribute.cs +++ b/BTCPayServer/Filters/ReferrerPolicyAttribute.cs @@ -1,7 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc.Filters; namespace BTCPayServer.Filters diff --git a/BTCPayServer/Filters/XContentTypeOptionsAttribute.cs b/BTCPayServer/Filters/XContentTypeOptionsAttribute.cs index 9420b3325..8d53fae10 100644 --- a/BTCPayServer/Filters/XContentTypeOptionsAttribute.cs +++ b/BTCPayServer/Filters/XContentTypeOptionsAttribute.cs @@ -1,7 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc.Filters; namespace BTCPayServer.Filters diff --git a/BTCPayServer/Filters/XFrameOptionsAttribute.cs b/BTCPayServer/Filters/XFrameOptionsAttribute.cs index ba6c79a7a..54ce23547 100644 --- a/BTCPayServer/Filters/XFrameOptionsAttribute.cs +++ b/BTCPayServer/Filters/XFrameOptionsAttribute.cs @@ -1,7 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc.Filters; namespace BTCPayServer.Filters diff --git a/BTCPayServer/Filters/XXSSProtectionAttribute.cs b/BTCPayServer/Filters/XXSSProtectionAttribute.cs index 494771c87..b9f59a121 100644 --- a/BTCPayServer/Filters/XXSSProtectionAttribute.cs +++ b/BTCPayServer/Filters/XXSSProtectionAttribute.cs @@ -1,7 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc.Filters; namespace BTCPayServer.Filters diff --git a/BTCPayServer/HostedServices/BackgroundJobSchedulerHostedService.cs b/BTCPayServer/HostedServices/BackgroundJobSchedulerHostedService.cs index d101ee6a6..4c836e038 100644 --- a/BTCPayServer/HostedServices/BackgroundJobSchedulerHostedService.cs +++ b/BTCPayServer/HostedServices/BackgroundJobSchedulerHostedService.cs @@ -9,7 +9,6 @@ using BTCPayServer.Services; using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; using NBitcoin; -using NicolasDorier.RateLimits; namespace BTCPayServer.HostedServices { @@ -87,8 +86,8 @@ namespace BTCPayServer.HostedServices } } - private Channel _Jobs = Channel.CreateUnbounded(); - HashSet _Processing = new HashSet(); + private readonly Channel _Jobs = Channel.CreateUnbounded(); + readonly HashSet _Processing = new HashSet(); public void Schedule(Func act, TimeSpan scheduledIn) { _Jobs.Writer.TryWrite(new BackgroundJob(act, scheduledIn, Delay)); diff --git a/BTCPayServer/HostedServices/BaseAsyncService.cs b/BTCPayServer/HostedServices/BaseAsyncService.cs index aa8def2cc..52efbb80a 100644 --- a/BTCPayServer/HostedServices/BaseAsyncService.cs +++ b/BTCPayServer/HostedServices/BaseAsyncService.cs @@ -1,14 +1,8 @@ using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; using System.Runtime.CompilerServices; -using System.Text; using System.Threading; using System.Threading.Tasks; using BTCPayServer.Logging; -using BTCPayServer.Services; -using BTCPayServer.Services.Rates; using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; diff --git a/BTCPayServer/HostedServices/CheckConfigurationHostedService.cs b/BTCPayServer/HostedServices/CheckConfigurationHostedService.cs index 49e9d2e67..2c7110d56 100644 --- a/BTCPayServer/HostedServices/CheckConfigurationHostedService.cs +++ b/BTCPayServer/HostedServices/CheckConfigurationHostedService.cs @@ -1,16 +1,10 @@ using System; -using System.Collections.Generic; -using System.Linq; using System.Threading; using System.Threading.Tasks; using BTCPayServer.Configuration; -using BTCPayServer.Data; using BTCPayServer.Logging; -using BTCPayServer.Services; -using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; -using NBitcoin.DataEncoders; namespace BTCPayServer.HostedServices { @@ -18,7 +12,7 @@ namespace BTCPayServer.HostedServices { private readonly BTCPayServerOptions _options; Task _testingConnection; - CancellationTokenSource _cancellationTokenSource = new CancellationTokenSource(); + readonly CancellationTokenSource _cancellationTokenSource = new CancellationTokenSource(); public CheckConfigurationHostedService(BTCPayServerOptions options) { diff --git a/BTCPayServer/HostedServices/CssThemeManager.cs b/BTCPayServer/HostedServices/CssThemeManager.cs index dcb3c547d..fc9a0fbc1 100644 --- a/BTCPayServer/HostedServices/CssThemeManager.cs +++ b/BTCPayServer/HostedServices/CssThemeManager.cs @@ -1,19 +1,10 @@ using System; -using System.Collections.Concurrent; using System.Collections.Generic; -using System.Linq; -using System.Threading; using System.Threading.Tasks; -using BTCPayServer.Events; -using BTCPayServer.Logging; using BTCPayServer.Security; using BTCPayServer.Services; using BTCPayServer.Services.Apps; using Microsoft.AspNetCore.Mvc.Filters; -using Microsoft.Extensions.Hosting; -using Microsoft.Extensions.Logging; -using NBXplorer; -using NBXplorer.Models; namespace BTCPayServer.HostedServices { @@ -130,8 +121,8 @@ namespace BTCPayServer.HostedServices public class CssThemeManagerHostedService : BaseAsyncService { - private SettingsRepository _SettingsRepository; - private CssThemeManager _CssThemeManager; + private readonly SettingsRepository _SettingsRepository; + private readonly CssThemeManager _CssThemeManager; public CssThemeManagerHostedService(SettingsRepository settingsRepository, CssThemeManager cssThemeManager) { diff --git a/BTCPayServer/HostedServices/DelayedTransactionBroadcasterHostedService.cs b/BTCPayServer/HostedServices/DelayedTransactionBroadcasterHostedService.cs index 5f89b3403..aaa206a2c 100644 --- a/BTCPayServer/HostedServices/DelayedTransactionBroadcasterHostedService.cs +++ b/BTCPayServer/HostedServices/DelayedTransactionBroadcasterHostedService.cs @@ -1,11 +1,6 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading; using System.Threading.Tasks; -using BTCPayServer.Logging; using BTCPayServer.Services; -using Microsoft.Extensions.Logging; namespace BTCPayServer.HostedServices { diff --git a/BTCPayServer/HostedServices/DynamicDnsHostedService.cs b/BTCPayServer/HostedServices/DynamicDnsHostedService.cs index d63a2b010..859e205ad 100644 --- a/BTCPayServer/HostedServices/DynamicDnsHostedService.cs +++ b/BTCPayServer/HostedServices/DynamicDnsHostedService.cs @@ -1,6 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; using System.Net.Http; using System.Threading; using System.Threading.Tasks; @@ -29,7 +27,7 @@ namespace BTCPayServer.HostedServices }; } - TimeSpan Period = TimeSpan.FromMinutes(60); + readonly TimeSpan Period = TimeSpan.FromMinutes(60); async Task UpdateRecord() { using (var timeout = CancellationTokenSource.CreateLinkedTokenSource(Cancellation)) diff --git a/BTCPayServer/HostedServices/EventHostedServiceBase.cs b/BTCPayServer/HostedServices/EventHostedServiceBase.cs index 48fdb98f5..d878a3211 100644 --- a/BTCPayServer/HostedServices/EventHostedServiceBase.cs +++ b/BTCPayServer/HostedServices/EventHostedServiceBase.cs @@ -21,7 +21,7 @@ namespace BTCPayServer.HostedServices _EventAggregator = eventAggregator; } - Channel _Events = Channel.CreateUnbounded(); + readonly Channel _Events = Channel.CreateUnbounded(); public async Task ProcessEvents(CancellationToken cancellationToken) { while (await _Events.Reader.WaitToReadAsync(cancellationToken)) diff --git a/BTCPayServer/HostedServices/InvoiceNotificationManager.cs b/BTCPayServer/HostedServices/InvoiceNotificationManager.cs index 345ca179a..83133f511 100644 --- a/BTCPayServer/HostedServices/InvoiceNotificationManager.cs +++ b/BTCPayServer/HostedServices/InvoiceNotificationManager.cs @@ -1,9 +1,7 @@ using System; -using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; using System.Net.Http; -using System.Reflection; using System.Text; using System.Threading; using System.Threading.Tasks; @@ -13,8 +11,6 @@ using BTCPayServer.Services; using BTCPayServer.Services.Invoices; using BTCPayServer.Services.Mails; using Microsoft.Extensions.Hosting; -using Microsoft.Extensions.Logging; -using Microsoft.Extensions.Logging.Abstractions; using NBitpayClient; using NBXplorer; using Newtonsoft.Json; @@ -24,7 +20,7 @@ namespace BTCPayServer.HostedServices { public class InvoiceNotificationManager : IHostedService { - HttpClient _Client; + readonly HttpClient _Client; public class ScheduledJob { @@ -39,9 +35,9 @@ namespace BTCPayServer.HostedServices } } - IBackgroundJobClient _JobClient; - EventAggregator _EventAggregator; - InvoiceRepository _InvoiceRepository; + readonly IBackgroundJobClient _JobClient; + readonly EventAggregator _EventAggregator; + readonly InvoiceRepository _InvoiceRepository; private readonly EmailSenderFactory _EmailSenderFactory; public InvoiceNotificationManager( @@ -206,7 +202,7 @@ namespace BTCPayServer.HostedServices public string NotificationURL { get; set; } } - Encoding UTF8 = new UTF8Encoding(false); + readonly Encoding UTF8 = new UTF8Encoding(false); private async Task SendNotification(InvoicePaymentNotificationEventWrapper notification, CancellationToken cancellationToken) { var request = new HttpRequestMessage(); @@ -239,7 +235,7 @@ namespace BTCPayServer.HostedServices return response; } - Dictionary _SendingRequestsByInvoiceId = new Dictionary(); + readonly Dictionary _SendingRequestsByInvoiceId = new Dictionary(); /// @@ -297,9 +293,8 @@ namespace BTCPayServer.HostedServices return await sending; } - int MaxTry = 6; - - CompositeDisposable leases = new CompositeDisposable(); + readonly int MaxTry = 6; + readonly CompositeDisposable leases = new CompositeDisposable(); public Task StartAsync(CancellationToken cancellationToken) { leases.Add(_EventAggregator.Subscribe(async e => diff --git a/BTCPayServer/HostedServices/InvoiceWatcher.cs b/BTCPayServer/HostedServices/InvoiceWatcher.cs index 4e6772f70..c3a94114b 100644 --- a/BTCPayServer/HostedServices/InvoiceWatcher.cs +++ b/BTCPayServer/HostedServices/InvoiceWatcher.cs @@ -1,5 +1,4 @@ using System; -using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; using System.Threading; @@ -13,7 +12,6 @@ using BTCPayServer.Services.Notifications.Blobs; using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; using NBitcoin; -using NBitpayClient; using NBXplorer; namespace BTCPayServer.HostedServices @@ -38,9 +36,9 @@ namespace BTCPayServer.HostedServices public bool Dirty => _Dirty; } - InvoiceRepository _InvoiceRepository; - EventAggregator _EventAggregator; - ExplorerClientProvider _ExplorerClientProvider; + readonly InvoiceRepository _InvoiceRepository; + readonly EventAggregator _EventAggregator; + readonly ExplorerClientProvider _ExplorerClientProvider; private readonly NotificationSender _notificationSender; public InvoiceWatcher( @@ -54,7 +52,8 @@ namespace BTCPayServer.HostedServices _ExplorerClientProvider = explorerClientProvider; _notificationSender = notificationSender; } - CompositeDisposable leases = new CompositeDisposable(); + + readonly CompositeDisposable leases = new CompositeDisposable(); private async Task UpdateInvoice(UpdateInvoiceContext context) @@ -219,7 +218,7 @@ namespace BTCPayServer.HostedServices } - Channel _WatchRequests = Channel.CreateUnbounded(); + readonly Channel _WatchRequests = Channel.CreateUnbounded(); Task _Loop; CancellationTokenSource _Cts; diff --git a/BTCPayServer/HostedServices/NBXplorerWaiter.cs b/BTCPayServer/HostedServices/NBXplorerWaiter.cs index 34610138b..cb93b187b 100644 --- a/BTCPayServer/HostedServices/NBXplorerWaiter.cs +++ b/BTCPayServer/HostedServices/NBXplorerWaiter.cs @@ -29,7 +29,8 @@ namespace BTCPayServer.HostedServices public StatusResult Status { get; set; } public string Error { get; set; } } - ConcurrentDictionary _Summaries = new ConcurrentDictionary(); + + readonly ConcurrentDictionary _Summaries = new ConcurrentDictionary(); public void Publish(BTCPayNetworkBase network, NBXplorerState state, StatusResult status, string error) { var summary = new NBXplorerSummary() { Network = network, State = state, Status = status, Error = error }; @@ -59,7 +60,7 @@ namespace BTCPayServer.HostedServices public class NBXplorerWaiters : IHostedService { - List _Waiters = new List(); + readonly List _Waiters = new List(); public NBXplorerWaiters(NBXplorerDashboard dashboard, ExplorerClientProvider explorerClientProvider, EventAggregator eventAggregator) { foreach (var explorer in explorerClientProvider.GetAll()) @@ -90,10 +91,10 @@ namespace BTCPayServer.HostedServices _Dashboard.Publish(_Network, State, null, null); } - NBXplorerDashboard _Dashboard; - BTCPayNetwork _Network; - EventAggregator _Aggregator; - ExplorerClient _Client; + readonly NBXplorerDashboard _Dashboard; + readonly BTCPayNetwork _Network; + readonly EventAggregator _Aggregator; + readonly ExplorerClient _Client; CancellationTokenSource _Cts; Task _Loop; diff --git a/BTCPayServer/HostedServices/PullPaymentHostedService.cs b/BTCPayServer/HostedServices/PullPaymentHostedService.cs index 536434258..e268dd3c4 100644 --- a/BTCPayServer/HostedServices/PullPaymentHostedService.cs +++ b/BTCPayServer/HostedServices/PullPaymentHostedService.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Runtime.InteropServices.ComTypes; using System.Threading; using System.Threading.Channels; using System.Threading.Tasks; @@ -10,24 +9,15 @@ using BTCPayServer.Data; using BTCPayServer.Events; using BTCPayServer.Logging; using BTCPayServer.Payments; -using BTCPayServer.Rating; using BTCPayServer.Services; using BTCPayServer.Services.Notifications; using BTCPayServer.Services.Notifications.Blobs; using BTCPayServer.Services.Rates; -using Microsoft.AspNetCore.Components.Web; -using Microsoft.AspNetCore.Http.Features; using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; using NBitcoin; using NBitcoin.DataEncoders; -using NBitcoin.Payment; using NBitcoin.RPC; -using NBXplorer; -using Org.BouncyCastle.Bcpg.OpenPgp; -using Serilog.Configuration; -using SQLitePCL; namespace BTCPayServer.HostedServices { diff --git a/BTCPayServer/HostedServices/RatesHostedService.cs b/BTCPayServer/HostedServices/RatesHostedService.cs index 404cae989..2b389ab2d 100644 --- a/BTCPayServer/HostedServices/RatesHostedService.cs +++ b/BTCPayServer/HostedServices/RatesHostedService.cs @@ -1,15 +1,11 @@ using System; using System.Collections.Generic; -using System.IO; using System.Linq; -using System.Runtime.CompilerServices; -using System.Text; using System.Threading; using System.Threading.Tasks; using BTCPayServer.Logging; using BTCPayServer.Services; using BTCPayServer.Services.Rates; -using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; using NBitcoin; using Newtonsoft.Json; @@ -28,8 +24,8 @@ namespace BTCPayServer.HostedServices return ""; } } - private SettingsRepository _SettingsRepository; - RateProviderFactory _RateProviderFactory; + private readonly SettingsRepository _SettingsRepository; + readonly RateProviderFactory _RateProviderFactory; public RatesHostedService(SettingsRepository repo, RateProviderFactory rateProviderFactory) { diff --git a/BTCPayServer/HostedServices/Socks5HttpProxyServer.cs b/BTCPayServer/HostedServices/Socks5HttpProxyServer.cs index 5b1ba0da6..0ab2b70a2 100644 --- a/BTCPayServer/HostedServices/Socks5HttpProxyServer.cs +++ b/BTCPayServer/HostedServices/Socks5HttpProxyServer.cs @@ -7,10 +7,7 @@ using System.Text; using System.Threading; using System.Threading.Tasks; using BTCPayServer.Configuration; -using BTCPayServer.Lightning.Eclair.Models; using BTCPayServer.Logging; -using Microsoft.AspNetCore.Hosting; -using Microsoft.AspNetCore.Hosting.Server.Features; using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; using NBitcoin; diff --git a/BTCPayServer/HostedServices/TorServicesHostedService.cs b/BTCPayServer/HostedServices/TorServicesHostedService.cs index 4ce5a5e99..086a30d0e 100644 --- a/BTCPayServer/HostedServices/TorServicesHostedService.cs +++ b/BTCPayServer/HostedServices/TorServicesHostedService.cs @@ -1,10 +1,7 @@ using System; -using System.Collections.Generic; -using System.Linq; using System.Threading.Tasks; using BTCPayServer.Configuration; using BTCPayServer.Services; -using Microsoft.Extensions.Hosting; namespace BTCPayServer.HostedServices { diff --git a/BTCPayServer/HostedServices/UserEventHostedService.cs b/BTCPayServer/HostedServices/UserEventHostedService.cs index b1aedfb23..c0584a02e 100644 --- a/BTCPayServer/HostedServices/UserEventHostedService.cs +++ b/BTCPayServer/HostedServices/UserEventHostedService.cs @@ -8,7 +8,6 @@ using BTCPayServer.Services.Mails; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; -using Microsoft.AspNetCore.Mvc.Routing; using Microsoft.AspNetCore.Routing; using Microsoft.Extensions.Logging; diff --git a/BTCPayServer/Hosting/BTCPayServerServices.cs b/BTCPayServer/Hosting/BTCPayServerServices.cs index fc33d8816..99bed5819 100644 --- a/BTCPayServer/Hosting/BTCPayServerServices.cs +++ b/BTCPayServer/Hosting/BTCPayServerServices.cs @@ -35,7 +35,6 @@ using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.ModelBinding; -using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; @@ -47,7 +46,6 @@ using NBitpayClient; using NBXplorer.DerivationStrategy; using Newtonsoft.Json; using NicolasDorier.RateLimits; -using Npgsql; using Serilog; namespace BTCPayServer.Hosting diff --git a/BTCPayServer/Hosting/BTCpayMiddleware.cs b/BTCPayServer/Hosting/BTCpayMiddleware.cs index eef409ea1..1a39fe18a 100644 --- a/BTCPayServer/Hosting/BTCpayMiddleware.cs +++ b/BTCPayServer/Hosting/BTCpayMiddleware.cs @@ -1,15 +1,11 @@ using System; -using System.Collections.Generic; -using System.IO; using System.Linq; using System.Net.WebSockets; -using System.Text; using System.Threading.Tasks; using BTCPayServer.Configuration; using BTCPayServer.Logging; using BTCPayServer.Models; using BTCPayServer.Services; -using BTCPayServer.Services.Stores; using Microsoft.AspNetCore.Http; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Primitives; @@ -19,9 +15,9 @@ namespace BTCPayServer.Hosting { public class BTCPayMiddleware { - RequestDelegate _Next; - BTCPayServerOptions _Options; - BTCPayServerEnvironment _Env; + readonly RequestDelegate _Next; + readonly BTCPayServerOptions _Options; + readonly BTCPayServerEnvironment _Env; public BTCPayMiddleware(RequestDelegate next, BTCPayServerOptions options, diff --git a/BTCPayServer/Hosting/HeadersOverrideMiddleware.cs b/BTCPayServer/Hosting/HeadersOverrideMiddleware.cs index 53172f0e3..5dc81e5e8 100644 --- a/BTCPayServer/Hosting/HeadersOverrideMiddleware.cs +++ b/BTCPayServer/Hosting/HeadersOverrideMiddleware.cs @@ -1,6 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; using System.Threading.Tasks; using BTCPayServer.Configuration; using Microsoft.AspNetCore.Http; @@ -10,8 +8,8 @@ namespace BTCPayServer.Hosting { public class HeadersOverrideMiddleware { - RequestDelegate _Next; - string overrideXForwardedProto; + readonly RequestDelegate _Next; + readonly string overrideXForwardedProto; public HeadersOverrideMiddleware(RequestDelegate next, IConfiguration options) { diff --git a/BTCPayServer/Hosting/IStartupTask.cs b/BTCPayServer/Hosting/IStartupTask.cs index f044f5d03..69ec7b505 100644 --- a/BTCPayServer/Hosting/IStartupTask.cs +++ b/BTCPayServer/Hosting/IStartupTask.cs @@ -1,6 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Linq; using System.Threading; using System.Threading.Tasks; diff --git a/BTCPayServer/Hosting/MigrationStartupTask.cs b/BTCPayServer/Hosting/MigrationStartupTask.cs index e2e97c51b..a20b7011c 100644 --- a/BTCPayServer/Hosting/MigrationStartupTask.cs +++ b/BTCPayServer/Hosting/MigrationStartupTask.cs @@ -1,5 +1,4 @@ using System; -using System.Collections.Generic; using System.Linq; using System.Threading; using System.Threading.Tasks; @@ -11,16 +10,15 @@ using BTCPayServer.Services.Stores; using Microsoft.AspNetCore.Identity; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Logging; -using Npgsql; namespace BTCPayServer.Hosting { public class MigrationStartupTask : IStartupTask { - private ApplicationDbContextFactory _DBContextFactory; - private StoreRepository _StoreRepository; - private BTCPayNetworkProvider _NetworkProvider; - private SettingsRepository _Settings; + private readonly ApplicationDbContextFactory _DBContextFactory; + private readonly StoreRepository _StoreRepository; + private readonly BTCPayNetworkProvider _NetworkProvider; + private readonly SettingsRepository _Settings; private readonly UserManager _userManager; public MigrationStartupTask( BTCPayNetworkProvider networkProvider, diff --git a/BTCPayServer/Hosting/ResourceBundleProvider.cs b/BTCPayServer/Hosting/ResourceBundleProvider.cs index 02cd87b8d..cee213e96 100644 --- a/BTCPayServer/Hosting/ResourceBundleProvider.cs +++ b/BTCPayServer/Hosting/ResourceBundleProvider.cs @@ -4,18 +4,16 @@ using System.IO; using System.Linq; using System.Reflection; using System.Text; -using System.Threading.Tasks; using BundlerMinifier.TagHelpers; using Microsoft.AspNetCore.Hosting; using Newtonsoft.Json.Linq; -using Newtonsoft.Json.Serialization; namespace BTCPayServer.Hosting { public class ResourceBundleProvider : IBundleProvider { - BundleProvider _InnerProvider; - Lazy> _BundlesByName; + readonly BundleProvider _InnerProvider; + readonly Lazy> _BundlesByName; public ResourceBundleProvider(IWebHostEnvironment hosting, BundleOptions options) { if (options.UseBundles) diff --git a/BTCPayServer/Hosting/Startup.cs b/BTCPayServer/Hosting/Startup.cs index ff0c1c00b..ec7765212 100644 --- a/BTCPayServer/Hosting/Startup.cs +++ b/BTCPayServer/Hosting/Startup.cs @@ -4,9 +4,7 @@ using System.Net; using BTCPayServer.Configuration; using BTCPayServer.Data; using BTCPayServer.Filters; -using BTCPayServer.JsonConverters; using BTCPayServer.Logging; -using BTCPayServer.Models; using BTCPayServer.PaymentRequest; using BTCPayServer.Security; using BTCPayServer.Services.Apps; @@ -34,7 +32,8 @@ namespace BTCPayServer.Hosting _Env = env; LoggerFactory = loggerFactory; } - IWebHostEnvironment _Env; + + readonly IWebHostEnvironment _Env; public IConfiguration Configuration { get; set; diff --git a/BTCPayServer/HwiWebSocketTransport.cs b/BTCPayServer/HwiWebSocketTransport.cs index 0d3564942..53446de94 100644 --- a/BTCPayServer/HwiWebSocketTransport.cs +++ b/BTCPayServer/HwiWebSocketTransport.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; using System.Net.WebSockets; -using System.Text; using System.Threading; using System.Threading.Tasks; using Newtonsoft.Json.Linq; diff --git a/BTCPayServer/IDelay.cs b/BTCPayServer/IDelay.cs index 2e46c2c16..f4f98dec7 100644 --- a/BTCPayServer/IDelay.cs +++ b/BTCPayServer/IDelay.cs @@ -1,6 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; using System.Threading; using System.Threading.Tasks; diff --git a/BTCPayServer/JsonConverters/CurrencyPairJsonConverter.cs b/BTCPayServer/JsonConverters/CurrencyPairJsonConverter.cs index d53449617..e5175ea07 100644 --- a/BTCPayServer/JsonConverters/CurrencyPairJsonConverter.cs +++ b/BTCPayServer/JsonConverters/CurrencyPairJsonConverter.cs @@ -1,8 +1,5 @@ using System; -using System.Collections.Generic; -using System.Linq; using System.Reflection; -using System.Threading.Tasks; using BTCPayServer.Rating; using NBitcoin.JsonConverters; using Newtonsoft.Json; diff --git a/BTCPayServer/JsonConverters/CurrencyValueJsonConverter.cs b/BTCPayServer/JsonConverters/CurrencyValueJsonConverter.cs index 7646d6ecd..cdb06d584 100644 --- a/BTCPayServer/JsonConverters/CurrencyValueJsonConverter.cs +++ b/BTCPayServer/JsonConverters/CurrencyValueJsonConverter.cs @@ -1,8 +1,5 @@ using System; -using System.Collections.Generic; -using System.Linq; using System.Reflection; -using System.Threading.Tasks; using NBitcoin.JsonConverters; using Newtonsoft.Json; diff --git a/BTCPayServer/JsonConverters/DateTimeMilliJsonConverter.cs b/BTCPayServer/JsonConverters/DateTimeMilliJsonConverter.cs index 97f49e632..bb9fc8031 100644 --- a/BTCPayServer/JsonConverters/DateTimeMilliJsonConverter.cs +++ b/BTCPayServer/JsonConverters/DateTimeMilliJsonConverter.cs @@ -1,9 +1,5 @@ using System; -using System.Collections.Generic; -using System.Linq; using System.Reflection; -using System.Threading.Tasks; -using NBitcoin.JsonConverters; using Newtonsoft.Json; namespace BTCPayServer.JsonConverters @@ -17,7 +13,7 @@ namespace BTCPayServer.JsonConverters typeof(DateTimeOffset?).GetTypeInfo().IsAssignableFrom(objectType.GetTypeInfo()); } - static DateTimeOffset unixRef = new DateTimeOffset(1970, 1, 1, 0, 0, 0, TimeSpan.Zero); + static readonly DateTimeOffset unixRef = new DateTimeOffset(1970, 1, 1, 0, 0, 0, TimeSpan.Zero); public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { if (reader.Value == null) @@ -35,7 +31,7 @@ namespace BTCPayServer.JsonConverters var v = (long)value; if (v < 0) throw new FormatException("Invalid datetime (less than 1/1/1970)"); - return unixRef + TimeSpan.FromMilliseconds((long)v); + return unixRef + TimeSpan.FromMilliseconds(v); } private long DateTimeToUnixTime(in DateTime time) { diff --git a/BTCPayServer/JsonConverters/PaymentMethodIdJsonConverter.cs b/BTCPayServer/JsonConverters/PaymentMethodIdJsonConverter.cs index f332ed298..1884d3357 100644 --- a/BTCPayServer/JsonConverters/PaymentMethodIdJsonConverter.cs +++ b/BTCPayServer/JsonConverters/PaymentMethodIdJsonConverter.cs @@ -1,11 +1,5 @@ using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Linq; -using System.Reflection; -using System.Threading.Tasks; using BTCPayServer.Payments; -using BTCPayServer.Rating; using NBitcoin.JsonConverters; using Newtonsoft.Json; diff --git a/BTCPayServer/JsonConverters/UriJsonConverter.cs b/BTCPayServer/JsonConverters/UriJsonConverter.cs index 876fd55b1..031c0fa9a 100644 --- a/BTCPayServer/JsonConverters/UriJsonConverter.cs +++ b/BTCPayServer/JsonConverters/UriJsonConverter.cs @@ -1,8 +1,5 @@ using System; -using System.Collections.Generic; -using System.Linq; using System.Reflection; -using System.Threading.Tasks; using NBitcoin.JsonConverters; using Newtonsoft.Json; diff --git a/BTCPayServer/Logging/InvoiceLog.cs b/BTCPayServer/Logging/InvoiceLog.cs index 956cb6be2..da72ada20 100644 --- a/BTCPayServer/Logging/InvoiceLog.cs +++ b/BTCPayServer/Logging/InvoiceLog.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Threading.Tasks; namespace BTCPayServer.Logging { @@ -17,7 +16,7 @@ namespace BTCPayServer.Logging } public class InvoiceLogs { - List _InvoiceLogs = new List(); + readonly List _InvoiceLogs = new List(); public void Write(string data) { lock (_InvoiceLogs) diff --git a/BTCPayServer/ModelBinders/DerivationSchemeModelBinder.cs b/BTCPayServer/ModelBinders/DerivationSchemeModelBinder.cs index 3f5d86cdb..6a3544b15 100644 --- a/BTCPayServer/ModelBinders/DerivationSchemeModelBinder.cs +++ b/BTCPayServer/ModelBinders/DerivationSchemeModelBinder.cs @@ -2,7 +2,6 @@ using System; using System.Reflection; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc.ModelBinding; -using NBitcoin; using NBXplorer.DerivationStrategy; namespace BTCPayServer.ModelBinders diff --git a/BTCPayServer/ModelBinders/InvariantDecimalModelBinder.cs b/BTCPayServer/ModelBinders/InvariantDecimalModelBinder.cs index e56a5138e..f9c10ef96 100644 --- a/BTCPayServer/ModelBinders/InvariantDecimalModelBinder.cs +++ b/BTCPayServer/ModelBinders/InvariantDecimalModelBinder.cs @@ -4,8 +4,6 @@ using System.Globalization; using System.Runtime.ExceptionServices; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc.ModelBinding; -using Microsoft.Extensions.Logging; -using Microsoft.Extensions.Logging.Abstractions; namespace BTCPayServer.ModelBinders { diff --git a/BTCPayServer/ModelBinders/PaymentMethodIdModelBinder.cs b/BTCPayServer/ModelBinders/PaymentMethodIdModelBinder.cs index 0c7dc58c8..97a031a90 100644 --- a/BTCPayServer/ModelBinders/PaymentMethodIdModelBinder.cs +++ b/BTCPayServer/ModelBinders/PaymentMethodIdModelBinder.cs @@ -1,6 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Linq; using System.Reflection; using System.Threading.Tasks; using BTCPayServer.Payments; diff --git a/BTCPayServer/ModelBinders/WalletIdModelBinder.cs b/BTCPayServer/ModelBinders/WalletIdModelBinder.cs index 2a6e7e30c..cabadf399 100644 --- a/BTCPayServer/ModelBinders/WalletIdModelBinder.cs +++ b/BTCPayServer/ModelBinders/WalletIdModelBinder.cs @@ -1,6 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Linq; using System.Reflection; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc.ModelBinding; diff --git a/BTCPayServer/Models/AccountViewModels/ForgotPasswordViewModel.cs b/BTCPayServer/Models/AccountViewModels/ForgotPasswordViewModel.cs index d199cff82..70a8c3b65 100644 --- a/BTCPayServer/Models/AccountViewModels/ForgotPasswordViewModel.cs +++ b/BTCPayServer/Models/AccountViewModels/ForgotPasswordViewModel.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; using System.ComponentModel.DataAnnotations; -using System.Linq; -using System.Threading.Tasks; namespace BTCPayServer.Models.AccountViewModels { diff --git a/BTCPayServer/Models/AccountViewModels/LoginViewModel.cs b/BTCPayServer/Models/AccountViewModels/LoginViewModel.cs index a9b075495..c5184e02d 100644 --- a/BTCPayServer/Models/AccountViewModels/LoginViewModel.cs +++ b/BTCPayServer/Models/AccountViewModels/LoginViewModel.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; using System.ComponentModel.DataAnnotations; -using System.Linq; -using System.Threading.Tasks; namespace BTCPayServer.Models.AccountViewModels { diff --git a/BTCPayServer/Models/AccountViewModels/LoginWith2faViewModel.cs b/BTCPayServer/Models/AccountViewModels/LoginWith2faViewModel.cs index 7fb012d8c..3c318468f 100644 --- a/BTCPayServer/Models/AccountViewModels/LoginWith2faViewModel.cs +++ b/BTCPayServer/Models/AccountViewModels/LoginWith2faViewModel.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; using System.ComponentModel.DataAnnotations; -using System.Linq; -using System.Threading.Tasks; namespace BTCPayServer.Models.AccountViewModels { diff --git a/BTCPayServer/Models/AccountViewModels/LoginWithRecoveryCodeViewModel.cs b/BTCPayServer/Models/AccountViewModels/LoginWithRecoveryCodeViewModel.cs index 60af5438b..14d5f2ace 100644 --- a/BTCPayServer/Models/AccountViewModels/LoginWithRecoveryCodeViewModel.cs +++ b/BTCPayServer/Models/AccountViewModels/LoginWithRecoveryCodeViewModel.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; using System.ComponentModel.DataAnnotations; -using System.Linq; -using System.Threading.Tasks; namespace BTCPayServer.Models.AccountViewModels { diff --git a/BTCPayServer/Models/AccountViewModels/RegisterViewModel.cs b/BTCPayServer/Models/AccountViewModels/RegisterViewModel.cs index a865c4387..48bcc36bc 100644 --- a/BTCPayServer/Models/AccountViewModels/RegisterViewModel.cs +++ b/BTCPayServer/Models/AccountViewModels/RegisterViewModel.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; using System.ComponentModel.DataAnnotations; -using System.Linq; -using System.Threading.Tasks; namespace BTCPayServer.Models.AccountViewModels { diff --git a/BTCPayServer/Models/AccountViewModels/ResetPasswordViewModel.cs b/BTCPayServer/Models/AccountViewModels/ResetPasswordViewModel.cs index 2f2f930fa..1fd440157 100644 --- a/BTCPayServer/Models/AccountViewModels/ResetPasswordViewModel.cs +++ b/BTCPayServer/Models/AccountViewModels/ResetPasswordViewModel.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; using System.ComponentModel.DataAnnotations; -using System.Linq; -using System.Threading.Tasks; namespace BTCPayServer.Models.AccountViewModels { diff --git a/BTCPayServer/Models/AppViewModels/CreateAppViewModel.cs b/BTCPayServer/Models/AppViewModels/CreateAppViewModel.cs index 5a58fc51b..3c13b783d 100644 --- a/BTCPayServer/Models/AppViewModels/CreateAppViewModel.cs +++ b/BTCPayServer/Models/AppViewModels/CreateAppViewModel.cs @@ -1,8 +1,5 @@ -using System; -using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; -using System.Threading.Tasks; using BTCPayServer.Data; using BTCPayServer.Services.Apps; using Microsoft.AspNetCore.Mvc.Rendering; diff --git a/BTCPayServer/Models/AppViewModels/ListAppsViewModel.cs b/BTCPayServer/Models/AppViewModels/ListAppsViewModel.cs index b514db59b..b7b3d61a2 100644 --- a/BTCPayServer/Models/AppViewModels/ListAppsViewModel.cs +++ b/BTCPayServer/Models/AppViewModels/ListAppsViewModel.cs @@ -1,8 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - namespace BTCPayServer.Models.AppViewModels { public class ListAppsViewModel diff --git a/BTCPayServer/Models/AppViewModels/UpdateCrowdfundViewModel.cs b/BTCPayServer/Models/AppViewModels/UpdateCrowdfundViewModel.cs index 9cf694acb..02572b8d9 100644 --- a/BTCPayServer/Models/AppViewModels/UpdateCrowdfundViewModel.cs +++ b/BTCPayServer/Models/AppViewModels/UpdateCrowdfundViewModel.cs @@ -1,5 +1,4 @@ using System; -using System.Collections; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using BTCPayServer.Services.Apps; diff --git a/BTCPayServer/Models/AppViewModels/ViewCrowdfundViewModel.cs b/BTCPayServer/Models/AppViewModels/ViewCrowdfundViewModel.cs index cbeb29d03..545e8dc90 100644 --- a/BTCPayServer/Models/AppViewModels/ViewCrowdfundViewModel.cs +++ b/BTCPayServer/Models/AppViewModels/ViewCrowdfundViewModel.cs @@ -2,7 +2,6 @@ using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; -using System.Threading.Tasks; using BTCPayServer.Payments; using BTCPayServer.Services.Rates; diff --git a/BTCPayServer/Models/BitpayErrorsModel.cs b/BTCPayServer/Models/BitpayErrorsModel.cs index 2e058e0b5..a51efa792 100644 --- a/BTCPayServer/Models/BitpayErrorsModel.cs +++ b/BTCPayServer/Models/BitpayErrorsModel.cs @@ -1,6 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Text; using Newtonsoft.Json; namespace BTCPayServer.Models diff --git a/BTCPayServer/Models/BitpayTranslatorViewModel.cs b/BTCPayServer/Models/BitpayTranslatorViewModel.cs index 646fad6c6..71960347f 100644 --- a/BTCPayServer/Models/BitpayTranslatorViewModel.cs +++ b/BTCPayServer/Models/BitpayTranslatorViewModel.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; using System.ComponentModel.DataAnnotations; -using System.Linq; -using System.Threading.Tasks; namespace BTCPayServer.Models { diff --git a/BTCPayServer/Models/ConfirmModel.cs b/BTCPayServer/Models/ConfirmModel.cs index b26f7163b..e4834ca53 100644 --- a/BTCPayServer/Models/ConfirmModel.cs +++ b/BTCPayServer/Models/ConfirmModel.cs @@ -1,8 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - namespace BTCPayServer.Models { public class ConfirmModel diff --git a/BTCPayServer/Models/CreateInvoiceRequest.cs b/BTCPayServer/Models/CreateInvoiceRequest.cs index 8721eb349..74a0b20e4 100644 --- a/BTCPayServer/Models/CreateInvoiceRequest.cs +++ b/BTCPayServer/Models/CreateInvoiceRequest.cs @@ -1,12 +1,7 @@ using System; using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using NBitcoin; -using NBitcoin.JsonConverters; using NBitpayClient; using Newtonsoft.Json; -using Newtonsoft.Json.Linq; namespace BTCPayServer.Models { diff --git a/BTCPayServer/Models/DataWrapper.cs b/BTCPayServer/Models/DataWrapper.cs index 90335a83d..dcb80ba70 100644 --- a/BTCPayServer/Models/DataWrapper.cs +++ b/BTCPayServer/Models/DataWrapper.cs @@ -1,6 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Text; using Newtonsoft.Json; namespace BTCPayServer.Models diff --git a/BTCPayServer/Models/ErrorViewModel.cs b/BTCPayServer/Models/ErrorViewModel.cs index 8fc78ae22..d770fdb06 100644 --- a/BTCPayServer/Models/ErrorViewModel.cs +++ b/BTCPayServer/Models/ErrorViewModel.cs @@ -1,4 +1,3 @@ -using System; using System.ComponentModel.DataAnnotations; namespace BTCPayServer.Models diff --git a/BTCPayServer/Models/GetTokensResponse.cs b/BTCPayServer/Models/GetTokensResponse.cs index 8eb9382c4..382c8dfb9 100644 --- a/BTCPayServer/Models/GetTokensResponse.cs +++ b/BTCPayServer/Models/GetTokensResponse.cs @@ -1,13 +1,10 @@ using System; -using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; using BTCPayServer.Security.Bitpay; -using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; -using NBitcoin.DataEncoders; using Newtonsoft.Json; using Newtonsoft.Json.Linq; @@ -16,7 +13,7 @@ namespace BTCPayServer.Models //{"data":[{"pos":"FfZ6WCa8TunAvPCpQZXkdBsoH4Yo18FyPaJ5X5qjrVVY"},{"pos/invoice":"H1pwwh2tMeSCri9rh5VvHWEHokGdf2EGtghfZkUEbeZv"},{"merchant":"89zEBr9orAc6wgybAABp8ioGcjYeFrUaZgMzjxNuqYty"},{"merchant/invoice":"8e7ijDxGfJsWXWgJuKXjjNgxnX1xpsBM8cTZCFnU7ehj"}]} public class GetTokensResponse : IActionResult { - BitTokenEntity[] _Tokens; + readonly BitTokenEntity[] _Tokens; public GetTokensResponse(BitTokenEntity[] tokens) { if (tokens == null) diff --git a/BTCPayServer/Models/InvoiceResponse.cs b/BTCPayServer/Models/InvoiceResponse.cs index 8e73839ce..d28a2e088 100644 --- a/BTCPayServer/Models/InvoiceResponse.cs +++ b/BTCPayServer/Models/InvoiceResponse.cs @@ -1,7 +1,5 @@ using System; using System.Collections.Generic; -using System.Text; -using NBitcoin; using Newtonsoft.Json; using Newtonsoft.Json.Linq; @@ -18,10 +16,10 @@ namespace BTCPayServer.Models { var v = (long)reader.Value; Check(v); - return unixRef + TimeSpan.FromMilliseconds((long)v); + return unixRef + TimeSpan.FromMilliseconds(v); } - static DateTimeOffset unixRef = new DateTimeOffset(1970, 1, 1, 0, 0, 0, TimeSpan.Zero); + static readonly DateTimeOffset unixRef = new DateTimeOffset(1970, 1, 1, 0, 0, 0, TimeSpan.Zero); public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) { var date = ((DateTimeOffset)value).ToUniversalTime(); diff --git a/BTCPayServer/Models/InvoicingModels/CreateInvoiceModel.cs b/BTCPayServer/Models/InvoicingModels/CreateInvoiceModel.cs index 4e80633eb..3e8d6ad1b 100644 --- a/BTCPayServer/Models/InvoicingModels/CreateInvoiceModel.cs +++ b/BTCPayServer/Models/InvoicingModels/CreateInvoiceModel.cs @@ -2,8 +2,6 @@ using System; using System.Collections.Generic; using System.ComponentModel; using System.ComponentModel.DataAnnotations; -using System.Linq; -using System.Threading.Tasks; using BTCPayServer.Validation; using Microsoft.AspNetCore.Mvc.Rendering; diff --git a/BTCPayServer/Models/InvoicingModels/InvoiceDetailsModel.cs b/BTCPayServer/Models/InvoicingModels/InvoiceDetailsModel.cs index 000b1fec2..4ba1f46ef 100644 --- a/BTCPayServer/Models/InvoicingModels/InvoiceDetailsModel.cs +++ b/BTCPayServer/Models/InvoicingModels/InvoiceDetailsModel.cs @@ -1,8 +1,5 @@ using System; using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using BTCPayServer.Data; using BTCPayServer.Payments; using BTCPayServer.Payments.Bitcoin; using BTCPayServer.Services.Invoices; diff --git a/BTCPayServer/Models/InvoicingModels/InvoicesModel.cs b/BTCPayServer/Models/InvoicingModels/InvoicesModel.cs index cf130e418..ca0404d3f 100644 --- a/BTCPayServer/Models/InvoicingModels/InvoicesModel.cs +++ b/BTCPayServer/Models/InvoicingModels/InvoicesModel.cs @@ -1,7 +1,5 @@ using System; using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; using BTCPayServer.Services.Invoices; namespace BTCPayServer.Models.InvoicingModels diff --git a/BTCPayServer/Models/InvoicingModels/PaymentModel.cs b/BTCPayServer/Models/InvoicingModels/PaymentModel.cs index b7d1f8003..97a0e4370 100644 --- a/BTCPayServer/Models/InvoicingModels/PaymentModel.cs +++ b/BTCPayServer/Models/InvoicingModels/PaymentModel.cs @@ -1,7 +1,4 @@ -using System; using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; namespace BTCPayServer.Models.InvoicingModels { diff --git a/BTCPayServer/Models/InvoicingModels/RefundModel.cs b/BTCPayServer/Models/InvoicingModels/RefundModel.cs index 74bb130c6..d538457b8 100644 --- a/BTCPayServer/Models/InvoicingModels/RefundModel.cs +++ b/BTCPayServer/Models/InvoicingModels/RefundModel.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; using System.ComponentModel.DataAnnotations; -using System.Linq; -using System.Threading.Tasks; -using BTCPayServer.Payments; using Microsoft.AspNetCore.Mvc.Rendering; namespace BTCPayServer.Models.InvoicingModels diff --git a/BTCPayServer/Models/InvoicingModels/UpdateCustomerModel.cs b/BTCPayServer/Models/InvoicingModels/UpdateCustomerModel.cs index 8b0cba545..f819fed40 100644 --- a/BTCPayServer/Models/InvoicingModels/UpdateCustomerModel.cs +++ b/BTCPayServer/Models/InvoicingModels/UpdateCustomerModel.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; using System.ComponentModel.DataAnnotations; -using System.Linq; -using System.Threading.Tasks; namespace BTCPayServer.Models.InvoicingModels { diff --git a/BTCPayServer/Models/ManageViewModels/ChangePasswordViewModel.cs b/BTCPayServer/Models/ManageViewModels/ChangePasswordViewModel.cs index 235971dd3..856ec180a 100644 --- a/BTCPayServer/Models/ManageViewModels/ChangePasswordViewModel.cs +++ b/BTCPayServer/Models/ManageViewModels/ChangePasswordViewModel.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; using System.ComponentModel.DataAnnotations; -using System.Linq; -using System.Threading.Tasks; namespace BTCPayServer.Models.ManageViewModels { diff --git a/BTCPayServer/Models/ManageViewModels/EnableAuthenticatorViewModel.cs b/BTCPayServer/Models/ManageViewModels/EnableAuthenticatorViewModel.cs index 3187f77ae..54148234c 100644 --- a/BTCPayServer/Models/ManageViewModels/EnableAuthenticatorViewModel.cs +++ b/BTCPayServer/Models/ManageViewModels/EnableAuthenticatorViewModel.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; using System.ComponentModel.DataAnnotations; -using System.Linq; -using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc.ModelBinding; namespace BTCPayServer.Models.ManageViewModels diff --git a/BTCPayServer/Models/ManageViewModels/GenerateRecoveryCodesViewModel.cs b/BTCPayServer/Models/ManageViewModels/GenerateRecoveryCodesViewModel.cs index a0a5979f3..77e735615 100644 --- a/BTCPayServer/Models/ManageViewModels/GenerateRecoveryCodesViewModel.cs +++ b/BTCPayServer/Models/ManageViewModels/GenerateRecoveryCodesViewModel.cs @@ -1,9 +1,3 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.Linq; -using System.Threading.Tasks; - namespace BTCPayServer.Models.ManageViewModels { public class GenerateRecoveryCodesViewModel diff --git a/BTCPayServer/Models/ManageViewModels/IndexViewModel.cs b/BTCPayServer/Models/ManageViewModels/IndexViewModel.cs index 57570d9e2..643b0a88f 100644 --- a/BTCPayServer/Models/ManageViewModels/IndexViewModel.cs +++ b/BTCPayServer/Models/ManageViewModels/IndexViewModel.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; using System.ComponentModel.DataAnnotations; -using System.Linq; -using System.Threading.Tasks; -using BTCPayServer.Validation; namespace BTCPayServer.Models.ManageViewModels { diff --git a/BTCPayServer/Models/ManageViewModels/RemoveLoginViewModel.cs b/BTCPayServer/Models/ManageViewModels/RemoveLoginViewModel.cs index 8dfc33483..9e48237c3 100644 --- a/BTCPayServer/Models/ManageViewModels/RemoveLoginViewModel.cs +++ b/BTCPayServer/Models/ManageViewModels/RemoveLoginViewModel.cs @@ -1,9 +1,3 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.Linq; -using System.Threading.Tasks; - namespace BTCPayServer.Models.ManageViewModels { public class RemoveLoginViewModel diff --git a/BTCPayServer/Models/ManageViewModels/SetPasswordViewModel.cs b/BTCPayServer/Models/ManageViewModels/SetPasswordViewModel.cs index 6e618fd14..3b5da97f8 100644 --- a/BTCPayServer/Models/ManageViewModels/SetPasswordViewModel.cs +++ b/BTCPayServer/Models/ManageViewModels/SetPasswordViewModel.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; using System.ComponentModel.DataAnnotations; -using System.Linq; -using System.Threading.Tasks; namespace BTCPayServer.Models.ManageViewModels { diff --git a/BTCPayServer/Models/ManageViewModels/TwoFactorAuthenticationViewModel.cs b/BTCPayServer/Models/ManageViewModels/TwoFactorAuthenticationViewModel.cs index 326ef56e9..a69823ce3 100644 --- a/BTCPayServer/Models/ManageViewModels/TwoFactorAuthenticationViewModel.cs +++ b/BTCPayServer/Models/ManageViewModels/TwoFactorAuthenticationViewModel.cs @@ -1,9 +1,3 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.Linq; -using System.Threading.Tasks; - namespace BTCPayServer.Models.ManageViewModels { public class TwoFactorAuthenticationViewModel diff --git a/BTCPayServer/Models/NotificationViewModels/IndexViewModel.cs b/BTCPayServer/Models/NotificationViewModels/IndexViewModel.cs index 7eb62ab5b..b3cb8671a 100644 --- a/BTCPayServer/Models/NotificationViewModels/IndexViewModel.cs +++ b/BTCPayServer/Models/NotificationViewModels/IndexViewModel.cs @@ -1,13 +1,5 @@ using System; using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using System.Text; -using System.Threading.Tasks; -using BTCPayServer.Data; -using BTCPayServer.Events; -using BTCPayServer.Services.Notifications.Blobs; -using Newtonsoft.Json; namespace BTCPayServer.Models.NotificationViewModels { diff --git a/BTCPayServer/Models/PaymentRequestViewModels/ListPaymentRequestsViewModel.cs b/BTCPayServer/Models/PaymentRequestViewModels/ListPaymentRequestsViewModel.cs index c5f6768e9..0abe7c75c 100644 --- a/BTCPayServer/Models/PaymentRequestViewModels/ListPaymentRequestsViewModel.cs +++ b/BTCPayServer/Models/PaymentRequestViewModels/ListPaymentRequestsViewModel.cs @@ -1,9 +1,7 @@ using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; -using BTCPayServer.Client.Models; using BTCPayServer.Data; -using BTCPayServer.Services.PaymentRequests; using BTCPayServer.Services.Rates; using Microsoft.AspNetCore.Mvc.Rendering; using PaymentRequestData = BTCPayServer.Data.PaymentRequestData; diff --git a/BTCPayServer/Models/PostRedictViewModel.cs b/BTCPayServer/Models/PostRedictViewModel.cs index 9703aa47c..2580d9b28 100644 --- a/BTCPayServer/Models/PostRedictViewModel.cs +++ b/BTCPayServer/Models/PostRedictViewModel.cs @@ -1,7 +1,4 @@ -using System; using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; namespace BTCPayServer.Models { diff --git a/BTCPayServer/Models/ServerViewModels/ChargeServiceViewModel.cs b/BTCPayServer/Models/ServerViewModels/ChargeServiceViewModel.cs index 25fdc36b6..3bb882b0f 100644 --- a/BTCPayServer/Models/ServerViewModels/ChargeServiceViewModel.cs +++ b/BTCPayServer/Models/ServerViewModels/ChargeServiceViewModel.cs @@ -1,8 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - namespace BTCPayServer.Models.ServerViewModels { public class ChargeServiceViewModel diff --git a/BTCPayServer/Models/ServerViewModels/DynamicDnsViewModel.cs b/BTCPayServer/Models/ServerViewModels/DynamicDnsViewModel.cs index 41c09e0a9..ccdf7fc63 100644 --- a/BTCPayServer/Models/ServerViewModels/DynamicDnsViewModel.cs +++ b/BTCPayServer/Models/ServerViewModels/DynamicDnsViewModel.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.Linq; -using System.Threading.Tasks; using BTCPayServer.Services; namespace BTCPayServer.Models.ServerViewModels diff --git a/BTCPayServer/Models/ServerViewModels/EmailsViewModel.cs b/BTCPayServer/Models/ServerViewModels/EmailsViewModel.cs index bea06c398..8d63c1189 100644 --- a/BTCPayServer/Models/ServerViewModels/EmailsViewModel.cs +++ b/BTCPayServer/Models/ServerViewModels/EmailsViewModel.cs @@ -1,10 +1,5 @@ -using System; -using System.Collections.Generic; using System.ComponentModel.DataAnnotations; -using System.Linq; -using System.Threading.Tasks; using BTCPayServer.Services.Mails; -using Microsoft.AspNetCore.Mvc.Rendering; namespace BTCPayServer.Models.ServerViewModels { diff --git a/BTCPayServer/Models/ServerViewModels/LightningWalletServices.cs b/BTCPayServer/Models/ServerViewModels/LightningWalletServices.cs index 3742d4a06..8574e965e 100644 --- a/BTCPayServer/Models/ServerViewModels/LightningWalletServices.cs +++ b/BTCPayServer/Models/ServerViewModels/LightningWalletServices.cs @@ -1,8 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - namespace BTCPayServer.Models.ServerViewModels { public class LightningWalletServices diff --git a/BTCPayServer/Models/ServerViewModels/LndSeedBackupViewModel.cs b/BTCPayServer/Models/ServerViewModels/LndSeedBackupViewModel.cs index 83ebfc4fc..fe81cad83 100644 --- a/BTCPayServer/Models/ServerViewModels/LndSeedBackupViewModel.cs +++ b/BTCPayServer/Models/ServerViewModels/LndSeedBackupViewModel.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; using System.Globalization; using System.IO; using System.Threading.Tasks; diff --git a/BTCPayServer/Models/ServerViewModels/MaintenanceViewModel.cs b/BTCPayServer/Models/ServerViewModels/MaintenanceViewModel.cs index 763663a82..c39050e92 100644 --- a/BTCPayServer/Models/ServerViewModels/MaintenanceViewModel.cs +++ b/BTCPayServer/Models/ServerViewModels/MaintenanceViewModel.cs @@ -1,11 +1,4 @@ -using System; -using System.Collections.Generic; using System.ComponentModel.DataAnnotations; -using System.Linq; -using System.Threading.Tasks; -using BTCPayServer.Configuration; -using BTCPayServer.SSH; -using Renci.SshNet; namespace BTCPayServer.Models.ServerViewModels { diff --git a/BTCPayServer/Models/ServerViewModels/SSHServiceViewModel.cs b/BTCPayServer/Models/ServerViewModels/SSHServiceViewModel.cs index ebf02760b..df8298911 100644 --- a/BTCPayServer/Models/ServerViewModels/SSHServiceViewModel.cs +++ b/BTCPayServer/Models/ServerViewModels/SSHServiceViewModel.cs @@ -1,8 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - namespace BTCPayServer.Models.ServerViewModels { public class SSHServiceViewModel diff --git a/BTCPayServer/Models/ServerViewModels/ServicesViewModel.cs b/BTCPayServer/Models/ServerViewModels/ServicesViewModel.cs index e759e9cc8..81be9a023 100644 --- a/BTCPayServer/Models/ServerViewModels/ServicesViewModel.cs +++ b/BTCPayServer/Models/ServerViewModels/ServicesViewModel.cs @@ -1,9 +1,5 @@ -using System; using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; using BTCPayServer.Configuration; -using BTCPayServer.Services; namespace BTCPayServer.Models.ServerViewModels { diff --git a/BTCPayServer/Models/ServerViewModels/UserViewModel.cs b/BTCPayServer/Models/ServerViewModels/UserViewModel.cs index f39ecce70..a1d39f3e1 100644 --- a/BTCPayServer/Models/ServerViewModels/UserViewModel.cs +++ b/BTCPayServer/Models/ServerViewModels/UserViewModel.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; using System.ComponentModel.DataAnnotations; -using System.Linq; -using System.Threading.Tasks; namespace BTCPayServer.Models.ServerViewModels { diff --git a/BTCPayServer/Models/ServerViewModels/UsersViewModel.cs b/BTCPayServer/Models/ServerViewModels/UsersViewModel.cs index eadca5a09..d6944d1ce 100644 --- a/BTCPayServer/Models/ServerViewModels/UsersViewModel.cs +++ b/BTCPayServer/Models/ServerViewModels/UsersViewModel.cs @@ -1,7 +1,4 @@ -using System; using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; namespace BTCPayServer.Models.ServerViewModels { diff --git a/BTCPayServer/Models/ServerViewModels/ViewFilesViewModel.cs b/BTCPayServer/Models/ServerViewModels/ViewFilesViewModel.cs index b23239dbd..ae180151d 100644 --- a/BTCPayServer/Models/ServerViewModels/ViewFilesViewModel.cs +++ b/BTCPayServer/Models/ServerViewModels/ViewFilesViewModel.cs @@ -1,6 +1,5 @@ using System.Collections.Generic; using BTCPayServer.Data; -using BTCPayServer.Storage.Models; namespace BTCPayServer.Models.ServerViewModels { diff --git a/BTCPayServer/Models/StatusMessageModel.cs b/BTCPayServer/Models/StatusMessageModel.cs index acb09a952..4b4f68543 100644 --- a/BTCPayServer/Models/StatusMessageModel.cs +++ b/BTCPayServer/Models/StatusMessageModel.cs @@ -1,6 +1,4 @@ using System; -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; namespace BTCPayServer.Models { diff --git a/BTCPayServer/Models/StoreViewModels/CheckoutExperienceViewModel.cs b/BTCPayServer/Models/StoreViewModels/CheckoutExperienceViewModel.cs index 3ac381862..f8cc09831 100644 --- a/BTCPayServer/Models/StoreViewModels/CheckoutExperienceViewModel.cs +++ b/BTCPayServer/Models/StoreViewModels/CheckoutExperienceViewModel.cs @@ -1,11 +1,8 @@ using System; -using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; -using System.Threading.Tasks; using BTCPayServer.Payments; using BTCPayServer.Services; -using BTCPayServer.Validation; using Microsoft.AspNetCore.Mvc.Rendering; namespace BTCPayServer.Models.StoreViewModels diff --git a/BTCPayServer/Models/StoreViewModels/CreateStoreViewModel.cs b/BTCPayServer/Models/StoreViewModels/CreateStoreViewModel.cs index c4e91082d..b465f63fe 100644 --- a/BTCPayServer/Models/StoreViewModels/CreateStoreViewModel.cs +++ b/BTCPayServer/Models/StoreViewModels/CreateStoreViewModel.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; using System.ComponentModel.DataAnnotations; -using System.Linq; -using System.Threading.Tasks; namespace BTCPayServer.Models.StoreViewModels { diff --git a/BTCPayServer/Models/StoreViewModels/DerivationSchemeViewModel.cs b/BTCPayServer/Models/StoreViewModels/DerivationSchemeViewModel.cs index 85a081848..9d7215dd0 100644 --- a/BTCPayServer/Models/StoreViewModels/DerivationSchemeViewModel.cs +++ b/BTCPayServer/Models/StoreViewModels/DerivationSchemeViewModel.cs @@ -1,10 +1,6 @@ -using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; -using System.Linq; -using System.Threading.Tasks; using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Mvc.Rendering; using NBitcoin; namespace BTCPayServer.Models.StoreViewModels diff --git a/BTCPayServer/Models/StoreViewModels/LightningNodeViewModel.cs b/BTCPayServer/Models/StoreViewModels/LightningNodeViewModel.cs index 36cc69ffb..86146bfbf 100644 --- a/BTCPayServer/Models/StoreViewModels/LightningNodeViewModel.cs +++ b/BTCPayServer/Models/StoreViewModels/LightningNodeViewModel.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; using System.ComponentModel.DataAnnotations; -using System.Linq; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Mvc.Rendering; namespace BTCPayServer.Models.StoreViewModels { diff --git a/BTCPayServer/Models/StoreViewModels/PairingModel.cs b/BTCPayServer/Models/StoreViewModels/PairingModel.cs index e304ecef4..551c00299 100644 --- a/BTCPayServer/Models/StoreViewModels/PairingModel.cs +++ b/BTCPayServer/Models/StoreViewModels/PairingModel.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; using System.ComponentModel.DataAnnotations; -using System.Linq; -using System.Threading.Tasks; namespace BTCPayServer.Models.StoreViewModels { diff --git a/BTCPayServer/Models/StoreViewModels/StoreUsersViewModel.cs b/BTCPayServer/Models/StoreViewModels/StoreUsersViewModel.cs index 8be658178..69cf2d912 100644 --- a/BTCPayServer/Models/StoreViewModels/StoreUsersViewModel.cs +++ b/BTCPayServer/Models/StoreViewModels/StoreUsersViewModel.cs @@ -1,8 +1,5 @@ -using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; -using System.Linq; -using System.Threading.Tasks; namespace BTCPayServer.Models.StoreViewModels { diff --git a/BTCPayServer/Models/StoreViewModels/StoreViewModel.cs b/BTCPayServer/Models/StoreViewModels/StoreViewModel.cs index 14116ee91..c91280e3d 100644 --- a/BTCPayServer/Models/StoreViewModels/StoreViewModel.cs +++ b/BTCPayServer/Models/StoreViewModels/StoreViewModel.cs @@ -1,7 +1,6 @@ using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using BTCPayServer.Client.Models; -using BTCPayServer.Data; using BTCPayServer.Validation; namespace BTCPayServer.Models.StoreViewModels diff --git a/BTCPayServer/Models/StoreViewModels/StoresViewModel.cs b/BTCPayServer/Models/StoreViewModels/StoresViewModel.cs index d125bf835..a57fcd045 100644 --- a/BTCPayServer/Models/StoreViewModels/StoresViewModel.cs +++ b/BTCPayServer/Models/StoreViewModels/StoresViewModel.cs @@ -1,8 +1,4 @@ -using System; using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using NBitcoin; namespace BTCPayServer.Models.StoreViewModels { diff --git a/BTCPayServer/Models/StoreViewModels/TokensViewModel.cs b/BTCPayServer/Models/StoreViewModels/TokensViewModel.cs index 3731e074c..95d145d06 100644 --- a/BTCPayServer/Models/StoreViewModels/TokensViewModel.cs +++ b/BTCPayServer/Models/StoreViewModels/TokensViewModel.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; using System.ComponentModel.DataAnnotations; -using System.Linq; -using System.Threading.Tasks; using BTCPayServer.Validation; using Microsoft.AspNetCore.Mvc.Rendering; diff --git a/BTCPayServer/Models/StoreViewModels/UpdateChangellySettingsViewModel.cs b/BTCPayServer/Models/StoreViewModels/UpdateChangellySettingsViewModel.cs index 9a3db8815..a153f51fb 100644 --- a/BTCPayServer/Models/StoreViewModels/UpdateChangellySettingsViewModel.cs +++ b/BTCPayServer/Models/StoreViewModels/UpdateChangellySettingsViewModel.cs @@ -1,8 +1,4 @@ -using System.Collections.Generic; using System.ComponentModel.DataAnnotations; -using System.Runtime.InteropServices; -using BTCPayServer.Payments; -using Microsoft.AspNetCore.Mvc.Rendering; namespace BTCPayServer.Models.StoreViewModels { diff --git a/BTCPayServer/Models/StoreViewModels/UpdateCoinSwitchSettingsViewModel.cs b/BTCPayServer/Models/StoreViewModels/UpdateCoinSwitchSettingsViewModel.cs index 910e03597..132dc2000 100644 --- a/BTCPayServer/Models/StoreViewModels/UpdateCoinSwitchSettingsViewModel.cs +++ b/BTCPayServer/Models/StoreViewModels/UpdateCoinSwitchSettingsViewModel.cs @@ -1,6 +1,5 @@ using System.Collections.Generic; using System.ComponentModel.DataAnnotations; -using BTCPayServer.Payments.CoinSwitch; using Microsoft.AspNetCore.Mvc.Rendering; namespace BTCPayServer.Models.StoreViewModels diff --git a/BTCPayServer/Models/TokenRequest.cs b/BTCPayServer/Models/TokenRequest.cs index 6f05671a6..435c45d3e 100644 --- a/BTCPayServer/Models/TokenRequest.cs +++ b/BTCPayServer/Models/TokenRequest.cs @@ -1,7 +1,4 @@ using System; -using System.Collections.Generic; -using System.Text; -using NBitcoin; using Newtonsoft.Json; using Newtonsoft.Json.Linq; diff --git a/BTCPayServer/Models/ViewPullPaymentModel.cs b/BTCPayServer/Models/ViewPullPaymentModel.cs index 0b939183e..603d8517a 100644 --- a/BTCPayServer/Models/ViewPullPaymentModel.cs +++ b/BTCPayServer/Models/ViewPullPaymentModel.cs @@ -1,10 +1,6 @@ using System; using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using AngleSharp.Dom; using BTCPayServer.Data; -using BTCPayServer.Payments; using BTCPayServer.Services.Rates; using BTCPayServer.Views; diff --git a/BTCPayServer/Models/WalletViewModels/ListWalletsViewModel.cs b/BTCPayServer/Models/WalletViewModels/ListWalletsViewModel.cs index 01811960c..b17c21899 100644 --- a/BTCPayServer/Models/WalletViewModels/ListWalletsViewModel.cs +++ b/BTCPayServer/Models/WalletViewModels/ListWalletsViewModel.cs @@ -1,7 +1,4 @@ -using System; using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; namespace BTCPayServer.Models.WalletViewModels { diff --git a/BTCPayServer/Models/WalletViewModels/PayoutsModel.cs b/BTCPayServer/Models/WalletViewModels/PayoutsModel.cs index 5e2d299a4..36fc5f130 100644 --- a/BTCPayServer/Models/WalletViewModels/PayoutsModel.cs +++ b/BTCPayServer/Models/WalletViewModels/PayoutsModel.cs @@ -1,7 +1,5 @@ using System; using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; namespace BTCPayServer.Models.WalletViewModels { diff --git a/BTCPayServer/Models/WalletViewModels/PullPaymentsModel.cs b/BTCPayServer/Models/WalletViewModels/PullPaymentsModel.cs index 692ff9445..723c4411d 100644 --- a/BTCPayServer/Models/WalletViewModels/PullPaymentsModel.cs +++ b/BTCPayServer/Models/WalletViewModels/PullPaymentsModel.cs @@ -2,9 +2,6 @@ using System; using System.Collections.Generic; using System.ComponentModel; using System.ComponentModel.DataAnnotations; -using System.Linq; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Html; namespace BTCPayServer.Models.WalletViewModels { diff --git a/BTCPayServer/Models/WalletViewModels/RescanWalletModel.cs b/BTCPayServer/Models/WalletViewModels/RescanWalletModel.cs index 38794157e..ee8e9b408 100644 --- a/BTCPayServer/Models/WalletViewModels/RescanWalletModel.cs +++ b/BTCPayServer/Models/WalletViewModels/RescanWalletModel.cs @@ -1,8 +1,5 @@ using System; -using System.Collections.Generic; using System.ComponentModel.DataAnnotations; -using System.Linq; -using System.Threading.Tasks; using NBXplorer.Models; namespace BTCPayServer.Models.WalletViewModels diff --git a/BTCPayServer/Models/WalletViewModels/SignWithSeedViewModel.cs b/BTCPayServer/Models/WalletViewModels/SignWithSeedViewModel.cs index f3ab25bdd..5d713dbb0 100644 --- a/BTCPayServer/Models/WalletViewModels/SignWithSeedViewModel.cs +++ b/BTCPayServer/Models/WalletViewModels/SignWithSeedViewModel.cs @@ -1,5 +1,4 @@ using System; -using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using NBitcoin; diff --git a/BTCPayServer/Models/WalletViewModels/SigningContextModel.cs b/BTCPayServer/Models/WalletViewModels/SigningContextModel.cs index 0500127f3..b123c27f3 100644 --- a/BTCPayServer/Models/WalletViewModels/SigningContextModel.cs +++ b/BTCPayServer/Models/WalletViewModels/SigningContextModel.cs @@ -1,7 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; using NBitcoin; namespace BTCPayServer.Models.WalletViewModels diff --git a/BTCPayServer/Models/WalletViewModels/WalletModel.cs b/BTCPayServer/Models/WalletViewModels/WalletModel.cs index 956da05fc..cd9338cec 100644 --- a/BTCPayServer/Models/WalletViewModels/WalletModel.cs +++ b/BTCPayServer/Models/WalletViewModels/WalletModel.cs @@ -1,10 +1,3 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.Linq; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Mvc.Rendering; - namespace BTCPayServer.Models.WalletViewModels { public class WalletModel diff --git a/BTCPayServer/Models/WalletViewModels/WalletPSBTCombineViewModel.cs b/BTCPayServer/Models/WalletViewModels/WalletPSBTCombineViewModel.cs index 590779de3..5b8fe1efc 100644 --- a/BTCPayServer/Models/WalletViewModels/WalletPSBTCombineViewModel.cs +++ b/BTCPayServer/Models/WalletViewModels/WalletPSBTCombineViewModel.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; using System.ComponentModel.DataAnnotations; -using System.IO; -using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Http; using NBitcoin; diff --git a/BTCPayServer/Models/WalletViewModels/WalletPSBTReadyViewModel.cs b/BTCPayServer/Models/WalletViewModels/WalletPSBTReadyViewModel.cs index 7818a04de..eef5ec347 100644 --- a/BTCPayServer/Models/WalletViewModels/WalletPSBTReadyViewModel.cs +++ b/BTCPayServer/Models/WalletViewModels/WalletPSBTReadyViewModel.cs @@ -1,7 +1,5 @@ -using System; using System.Collections.Generic; using System.Linq; -using System.Threading.Tasks; using NBitcoin; namespace BTCPayServer.Models.WalletViewModels diff --git a/BTCPayServer/Models/WalletViewModels/WalletPSBTViewModel.cs b/BTCPayServer/Models/WalletViewModels/WalletPSBTViewModel.cs index 5f831c99e..111b1e0a2 100644 --- a/BTCPayServer/Models/WalletViewModels/WalletPSBTViewModel.cs +++ b/BTCPayServer/Models/WalletViewModels/WalletPSBTViewModel.cs @@ -1,7 +1,5 @@ -using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; -using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Http; using NBitcoin; diff --git a/BTCPayServer/Models/WalletViewModels/WalletSendVaultModel.cs b/BTCPayServer/Models/WalletViewModels/WalletSendVaultModel.cs index 1fbba61f0..225f4cf74 100644 --- a/BTCPayServer/Models/WalletViewModels/WalletSendVaultModel.cs +++ b/BTCPayServer/Models/WalletViewModels/WalletSendVaultModel.cs @@ -1,8 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - namespace BTCPayServer.Models.WalletViewModels { public class WalletSendVaultModel diff --git a/BTCPayServer/Models/WalletViewModels/WalletSettingsViewModel.cs b/BTCPayServer/Models/WalletViewModels/WalletSettingsViewModel.cs index fafdb1230..b537b8710 100644 --- a/BTCPayServer/Models/WalletViewModels/WalletSettingsViewModel.cs +++ b/BTCPayServer/Models/WalletViewModels/WalletSettingsViewModel.cs @@ -1,8 +1,5 @@ -using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; -using System.Linq; -using System.Threading.Tasks; namespace BTCPayServer.Models.WalletViewModels { diff --git a/BTCPayServer/PaymentRequest/PaymentRequestHub.cs b/BTCPayServer/PaymentRequest/PaymentRequestHub.cs index b62ed5438..3f9093160 100644 --- a/BTCPayServer/PaymentRequest/PaymentRequestHub.cs +++ b/BTCPayServer/PaymentRequest/PaymentRequestHub.cs @@ -1,5 +1,4 @@ using System; -using System.Collections.Generic; using System.Linq; using System.Threading; using System.Threading.Tasks; @@ -8,7 +7,6 @@ using BTCPayServer.Data; using BTCPayServer.Events; using BTCPayServer.HostedServices; using BTCPayServer.Logging; -using BTCPayServer.Payments; using BTCPayServer.Services.PaymentRequests; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Http; diff --git a/BTCPayServer/PaymentRequest/PaymentRequestService.cs b/BTCPayServer/PaymentRequest/PaymentRequestService.cs index 0aadb711e..e684fe7f3 100644 --- a/BTCPayServer/PaymentRequest/PaymentRequestService.cs +++ b/BTCPayServer/PaymentRequest/PaymentRequestService.cs @@ -1,12 +1,9 @@ using System; -using System.Collections.Generic; -using System.Globalization; using System.Linq; using System.Threading.Tasks; using BTCPayServer.Data; using BTCPayServer.Models.PaymentRequestViewModels; using BTCPayServer.Payments; -using BTCPayServer.Payments.Lightning; using BTCPayServer.Services.Apps; using BTCPayServer.Services.Invoices; using BTCPayServer.Services.PaymentRequests; diff --git a/BTCPayServer/Payments/Bitcoin/BitcoinLikeOnChainPaymentMethod.cs b/BTCPayServer/Payments/Bitcoin/BitcoinLikeOnChainPaymentMethod.cs index 10657d8b1..8b4b2f271 100644 --- a/BTCPayServer/Payments/Bitcoin/BitcoinLikeOnChainPaymentMethod.cs +++ b/BTCPayServer/Payments/Bitcoin/BitcoinLikeOnChainPaymentMethod.cs @@ -1,12 +1,6 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; using BTCPayServer.Client.Models; -using BTCPayServer.Services.Invoices; -using BTCPayServer.Services.Wallets; using NBitcoin; -using NBXplorer.JsonConverters; using Newtonsoft.Json; namespace BTCPayServer.Payments.Bitcoin diff --git a/BTCPayServer/Payments/Bitcoin/BitcoinLikePaymentData.cs b/BTCPayServer/Payments/Bitcoin/BitcoinLikePaymentData.cs index 05d1903c9..8557aa99d 100644 --- a/BTCPayServer/Payments/Bitcoin/BitcoinLikePaymentData.cs +++ b/BTCPayServer/Payments/Bitcoin/BitcoinLikePaymentData.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; using BTCPayServer.Client.Models; -using BTCPayServer.Data; using BTCPayServer.Services.Invoices; using NBitcoin; using Newtonsoft.Json; diff --git a/BTCPayServer/Payments/Bitcoin/BitcoinLikePaymentHandler.cs b/BTCPayServer/Payments/Bitcoin/BitcoinLikePaymentHandler.cs index 8b6f9dcf6..0ca412b39 100644 --- a/BTCPayServer/Payments/Bitcoin/BitcoinLikePaymentHandler.cs +++ b/BTCPayServer/Payments/Bitcoin/BitcoinLikePaymentHandler.cs @@ -20,11 +20,11 @@ namespace BTCPayServer.Payments.Bitcoin { public class BitcoinLikePaymentHandler : PaymentMethodHandlerBase { - ExplorerClientProvider _ExplorerProvider; + readonly ExplorerClientProvider _ExplorerProvider; private readonly BTCPayNetworkProvider _networkProvider; - private IFeeProviderFactory _FeeRateProviderFactory; + private readonly IFeeProviderFactory _FeeRateProviderFactory; private readonly NBXplorerDashboard _dashboard; - private Services.Wallets.BTCPayWalletProvider _WalletProvider; + private readonly Services.Wallets.BTCPayWalletProvider _WalletProvider; public BitcoinLikePaymentHandler(ExplorerClientProvider provider, BTCPayNetworkProvider networkProvider, diff --git a/BTCPayServer/Payments/Bitcoin/NBXplorerListener.cs b/BTCPayServer/Payments/Bitcoin/NBXplorerListener.cs index 0e8dbcb89..6f6e470d0 100644 --- a/BTCPayServer/Payments/Bitcoin/NBXplorerListener.cs +++ b/BTCPayServer/Payments/Bitcoin/NBXplorerListener.cs @@ -5,20 +5,15 @@ using System.Linq; using System.Threading; using System.Threading.Tasks; using BTCPayServer; -using BTCPayServer.Controllers; using BTCPayServer.Events; using BTCPayServer.HostedServices; using BTCPayServer.Logging; -using BTCPayServer.Payments; using BTCPayServer.Payments.PayJoin; -using BTCPayServer.Services; using BTCPayServer.Services.Invoices; using BTCPayServer.Services.Wallets; -using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; using NBitcoin; -using NBitcoin.Altcoins.Elements; using NBitcoin.RPC; using NBXplorer; using NBXplorer.DerivationStrategy; @@ -31,14 +26,14 @@ namespace BTCPayServer.Payments.Bitcoin /// public class NBXplorerListener : IHostedService { - EventAggregator _Aggregator; + readonly EventAggregator _Aggregator; private readonly PayJoinRepository _payJoinRepository; - ExplorerClientProvider _ExplorerClients; - IHostApplicationLifetime _Lifetime; - InvoiceRepository _InvoiceRepository; + readonly ExplorerClientProvider _ExplorerClients; + readonly IHostApplicationLifetime _Lifetime; + readonly InvoiceRepository _InvoiceRepository; private TaskCompletionSource _RunningTask; private CancellationTokenSource _Cts; - BTCPayWalletProvider _Wallets; + readonly BTCPayWalletProvider _Wallets; public NBXplorerListener(ExplorerClientProvider explorerClients, BTCPayWalletProvider wallets, InvoiceRepository invoiceRepository, @@ -55,8 +50,8 @@ namespace BTCPayServer.Payments.Bitcoin _Lifetime = lifetime; } - CompositeDisposable leases = new CompositeDisposable(); - ConcurrentDictionary _SessionsByCryptoCode = new ConcurrentDictionary(); + readonly CompositeDisposable leases = new CompositeDisposable(); + readonly ConcurrentDictionary _SessionsByCryptoCode = new ConcurrentDictionary(); private Timer _ListenPoller; TimeSpan _PollInterval; diff --git a/BTCPayServer/Payments/Changelly/Changelly.cs b/BTCPayServer/Payments/Changelly/Changelly.cs index ec430c755..240944957 100644 --- a/BTCPayServer/Payments/Changelly/Changelly.cs +++ b/BTCPayServer/Payments/Changelly/Changelly.cs @@ -1,13 +1,10 @@ using System; using System.Collections.Generic; using System.Globalization; -using System.Linq; -using System.Net; using System.Net.Http; using System.Text; using System.Threading.Tasks; using BTCPayServer.Payments.Changelly.Models; -using Newtonsoft.Json; using Newtonsoft.Json.Linq; using SshNet.Security.Cryptography; diff --git a/BTCPayServer/Payments/IPaymentFilter.cs b/BTCPayServer/Payments/IPaymentFilter.cs index 97fd10ddd..946542514 100644 --- a/BTCPayServer/Payments/IPaymentFilter.cs +++ b/BTCPayServer/Payments/IPaymentFilter.cs @@ -1,7 +1,5 @@ using System; -using System.Collections.Generic; using System.Linq; -using System.Threading.Tasks; namespace BTCPayServer.Payments { @@ -71,7 +69,7 @@ namespace BTCPayServer.Payments } class PredicateFilter : IPaymentFilter { - private Func predicate; + private readonly Func predicate; public PredicateFilter(Func predicate) { diff --git a/BTCPayServer/Payments/IPaymentMethodDetails.cs b/BTCPayServer/Payments/IPaymentMethodDetails.cs index bc5877671..80d8a24b0 100644 --- a/BTCPayServer/Payments/IPaymentMethodDetails.cs +++ b/BTCPayServer/Payments/IPaymentMethodDetails.cs @@ -1,9 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using NBitcoin; - namespace BTCPayServer.Payments { /// diff --git a/BTCPayServer/Payments/ISupportedPaymentMethod.cs b/BTCPayServer/Payments/ISupportedPaymentMethod.cs index c350481e6..d6587d4da 100644 --- a/BTCPayServer/Payments/ISupportedPaymentMethod.cs +++ b/BTCPayServer/Payments/ISupportedPaymentMethod.cs @@ -1,9 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using BTCPayServer.Services.Invoices; - namespace BTCPayServer.Payments { /// diff --git a/BTCPayServer/Payments/Lightning/LightningLikePaymentData.cs b/BTCPayServer/Payments/Lightning/LightningLikePaymentData.cs index 29512e6a3..7e16216c4 100644 --- a/BTCPayServer/Payments/Lightning/LightningLikePaymentData.cs +++ b/BTCPayServer/Payments/Lightning/LightningLikePaymentData.cs @@ -1,13 +1,6 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; using BTCPayServer.Client.Models; -using BTCPayServer.Data; -using BTCPayServer.JsonConverters; using BTCPayServer.Lightning; using BTCPayServer.Lightning.JsonConverters; -using BTCPayServer.Payments.Lightning; using BTCPayServer.Services.Invoices; using NBitcoin; using Newtonsoft.Json; diff --git a/BTCPayServer/Payments/Lightning/LightningLikePaymentHandler.cs b/BTCPayServer/Payments/Lightning/LightningLikePaymentHandler.cs index afde5b522..49ac375b8 100644 --- a/BTCPayServer/Payments/Lightning/LightningLikePaymentHandler.cs +++ b/BTCPayServer/Payments/Lightning/LightningLikePaymentHandler.cs @@ -21,8 +21,7 @@ namespace BTCPayServer.Payments.Lightning public class LightningLikePaymentHandler : PaymentMethodHandlerBase { public static int LIGHTNING_TIMEOUT = 5000; - - NBXplorerDashboard _Dashboard; + readonly NBXplorerDashboard _Dashboard; private readonly LightningClientFactoryService _lightningClientFactory; private readonly BTCPayNetworkProvider _networkProvider; private readonly SocketFactory _socketFactory; @@ -47,10 +46,10 @@ namespace BTCPayServer.Payments.Lightning { //direct casting to (BTCPayNetwork) is fixed in other pull requests with better generic interfacing for handlers var storeBlob = store.GetStoreBlob(); - var test = GetNodeInfo(paymentMethod.PreferOnion, supportedPaymentMethod, (BTCPayNetwork)network); + var test = GetNodeInfo(paymentMethod.PreferOnion, supportedPaymentMethod, network); var invoice = paymentMethod.ParentEntity; var due = Extensions.RoundUp(invoice.ProductInformation.Price / paymentMethod.Rate, network.Divisibility); - var client = _lightningClientFactory.Create(supportedPaymentMethod.GetLightningUrl(), (BTCPayNetwork)network); + var client = _lightningClientFactory.Create(supportedPaymentMethod.GetLightningUrl(), network); var expiry = invoice.ExpirationTime - DateTimeOffset.UtcNow; if (expiry < TimeSpan.Zero) expiry = TimeSpan.FromSeconds(1); diff --git a/BTCPayServer/Payments/Lightning/LightningLikePaymentMethodDetails.cs b/BTCPayServer/Payments/Lightning/LightningLikePaymentMethodDetails.cs index 06eb4ca49..793e98ec6 100644 --- a/BTCPayServer/Payments/Lightning/LightningLikePaymentMethodDetails.cs +++ b/BTCPayServer/Payments/Lightning/LightningLikePaymentMethodDetails.cs @@ -1,9 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using NBitcoin; - namespace BTCPayServer.Payments.Lightning { public class LightningLikePaymentMethodDetails : IPaymentMethodDetails diff --git a/BTCPayServer/Payments/Lightning/LightningListener.cs b/BTCPayServer/Payments/Lightning/LightningListener.cs index c06252c00..ac09e1650 100644 --- a/BTCPayServer/Payments/Lightning/LightningListener.cs +++ b/BTCPayServer/Payments/Lightning/LightningListener.cs @@ -2,7 +2,6 @@ using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; -using System.Net.Http; using System.Threading; using System.Threading.Channels; using System.Threading.Tasks; @@ -20,14 +19,14 @@ namespace BTCPayServer.Payments.Lightning { public class LightningListener : IHostedService { - EventAggregator _Aggregator; - InvoiceRepository _InvoiceRepository; + readonly EventAggregator _Aggregator; + readonly InvoiceRepository _InvoiceRepository; private readonly IMemoryCache _memoryCache; - BTCPayNetworkProvider _NetworkProvider; + readonly BTCPayNetworkProvider _NetworkProvider; private readonly LightningClientFactoryService lightningClientFactory; - Channel _CheckInvoices = Channel.CreateUnbounded(); + readonly Channel _CheckInvoices = Channel.CreateUnbounded(); Task _CheckingInvoice; - Dictionary<(string, string), LightningInstanceListener> _InstanceListeners = new Dictionary<(string, string), LightningInstanceListener>(); + readonly Dictionary<(string, string), LightningInstanceListener> _InstanceListeners = new Dictionary<(string, string), LightningInstanceListener>(); public LightningListener(EventAggregator aggregator, InvoiceRepository invoiceRepository, @@ -124,10 +123,8 @@ namespace BTCPayServer.Payments.Lightning }); } - ConcurrentDictionary _ListeningInstances = new ConcurrentDictionary(); - - - CompositeDisposable leases = new CompositeDisposable(); + readonly ConcurrentDictionary _ListeningInstances = new ConcurrentDictionary(); + readonly CompositeDisposable leases = new CompositeDisposable(); public Task StartAsync(CancellationToken cancellationToken) { leases.Add(_Aggregator.Subscribe(inv => @@ -170,9 +167,8 @@ namespace BTCPayServer.Payments.Lightning } } - CancellationTokenSource _Cts = new CancellationTokenSource(); - - HashSet _InvoiceIds = new HashSet(); + readonly CancellationTokenSource _Cts = new CancellationTokenSource(); + readonly HashSet _InvoiceIds = new HashSet(); private Timer _ListenPoller; public async Task StopAsync(CancellationToken cancellationToken) @@ -202,7 +198,7 @@ namespace BTCPayServer.Payments.Lightning public class LightningInstanceListener { - private LightningSupportedPaymentMethod supportedPaymentMethod; + private readonly LightningSupportedPaymentMethod supportedPaymentMethod; private readonly InvoiceRepository invoiceRepository; private readonly EventAggregator _eventAggregator; private readonly BTCPayNetwork network; @@ -319,7 +315,7 @@ namespace BTCPayServer.Payments.Lightning } bool _ErrorAlreadyLogged = false; - ConcurrentDictionary _ListenedInvoices = new ConcurrentDictionary(); + readonly ConcurrentDictionary _ListenedInvoices = new ConcurrentDictionary(); public async Task AddPayment(LightningInvoice notification, string invoiceId) { diff --git a/BTCPayServer/Payments/Lightning/LightningSupportedPaymentMethod.cs b/BTCPayServer/Payments/Lightning/LightningSupportedPaymentMethod.cs index 52ff47b99..b7968e7f5 100644 --- a/BTCPayServer/Payments/Lightning/LightningSupportedPaymentMethod.cs +++ b/BTCPayServer/Payments/Lightning/LightningSupportedPaymentMethod.cs @@ -1,9 +1,5 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; using BTCPayServer.Lightning; -using NBitcoin; namespace BTCPayServer.Payments.Lightning { diff --git a/BTCPayServer/Payments/PayJoin/PayJoinEndpointController.cs b/BTCPayServer/Payments/PayJoin/PayJoinEndpointController.cs index afffc49aa..2154d8335 100644 --- a/BTCPayServer/Payments/PayJoin/PayJoinEndpointController.cs +++ b/BTCPayServer/Payments/PayJoin/PayJoinEndpointController.cs @@ -5,12 +5,9 @@ using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; -using Amazon.S3.Model; -using BTCPayServer.Data; using BTCPayServer.Events; using BTCPayServer.Filters; using BTCPayServer.HostedServices; -using BTCPayServer.Logging; using BTCPayServer.Payments.Bitcoin; using BTCPayServer.Services; using BTCPayServer.Services.Invoices; @@ -22,7 +19,6 @@ using NBitcoin; using NBitcoin.Crypto; using NBitcoin.DataEncoders; using NBXplorer; -using NBXplorer.DerivationStrategy; using NBXplorer.Models; using Newtonsoft.Json.Linq; using NicolasDorier.RateLimits; @@ -53,8 +49,8 @@ namespace BTCPayServer.Payments.PayJoin _blind = blind.ToBytes(); } - static UTXODeterministicComparer _Instance; - private byte[] _blind; + static readonly UTXODeterministicComparer _Instance; + private readonly byte[] _blind; public static UTXODeterministicComparer Instance => _Instance; public int Compare([AllowNull] UTXO x, [AllowNull] UTXO y) diff --git a/BTCPayServer/Payments/PayJoin/PayJoinRepository.cs b/BTCPayServer/Payments/PayJoin/PayJoinRepository.cs index 6b6820a96..68d331419 100644 --- a/BTCPayServer/Payments/PayJoin/PayJoinRepository.cs +++ b/BTCPayServer/Payments/PayJoin/PayJoinRepository.cs @@ -1,11 +1,7 @@ -using System; -using System.Collections.Generic; -using System.Linq; using System.Threading.Tasks; using BTCPayServer.Data; using Microsoft.EntityFrameworkCore; using NBitcoin; -using NBXplorer.Models; namespace BTCPayServer.Payments.PayJoin { diff --git a/BTCPayServer/Payments/PayJoin/PayjoinReceiverContext.cs b/BTCPayServer/Payments/PayJoin/PayjoinReceiverContext.cs index 76060db3c..130bc4307 100644 --- a/BTCPayServer/Payments/PayJoin/PayjoinReceiverContext.cs +++ b/BTCPayServer/Payments/PayJoin/PayjoinReceiverContext.cs @@ -1,12 +1,10 @@ using System; using System.Collections.Generic; -using System.Linq; using System.Threading.Tasks; using BTCPayServer.Logging; using BTCPayServer.Services.Invoices; using Microsoft.Extensions.Logging; using NBitcoin; -using NBitcoin.JsonConverters; using NBitpayClient; using NBXplorer; diff --git a/BTCPayServer/Payments/PaymentMethodId.cs b/BTCPayServer/Payments/PaymentMethodId.cs index fecc5823c..e136f9b59 100644 --- a/BTCPayServer/Payments/PaymentMethodId.cs +++ b/BTCPayServer/Payments/PaymentMethodId.cs @@ -1,7 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; namespace BTCPayServer.Payments { diff --git a/BTCPayServer/Payments/PaymentMethodUnavailableException.cs b/BTCPayServer/Payments/PaymentMethodUnavailableException.cs index 0cf866341..a9e065e95 100644 --- a/BTCPayServer/Payments/PaymentMethodUnavailableException.cs +++ b/BTCPayServer/Payments/PaymentMethodUnavailableException.cs @@ -1,7 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; namespace BTCPayServer.Payments { diff --git a/BTCPayServer/Payments/PaymentTypes.Bitcoin.cs b/BTCPayServer/Payments/PaymentTypes.Bitcoin.cs index 98fb4fee1..6f4467ff6 100644 --- a/BTCPayServer/Payments/PaymentTypes.Bitcoin.cs +++ b/BTCPayServer/Payments/PaymentTypes.Bitcoin.cs @@ -1,11 +1,8 @@ using System; -using System.Collections.Generic; using System.Globalization; using System.Linq; -using System.Threading.Tasks; using BTCPayServer.Payments.Bitcoin; using BTCPayServer.Services.Invoices; -using Newtonsoft.Json; using Newtonsoft.Json.Linq; namespace BTCPayServer.Payments diff --git a/BTCPayServer/Payments/PaymentTypes.Lightning.cs b/BTCPayServer/Payments/PaymentTypes.Lightning.cs index 4e9fa2ea5..d3613dc50 100644 --- a/BTCPayServer/Payments/PaymentTypes.Lightning.cs +++ b/BTCPayServer/Payments/PaymentTypes.Lightning.cs @@ -1,7 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; using BTCPayServer.Payments.Lightning; using BTCPayServer.Services.Invoices; using Newtonsoft.Json; diff --git a/BTCPayServer/Payments/PaymentTypes.cs b/BTCPayServer/Payments/PaymentTypes.cs index eeea7594a..352b67dd7 100644 --- a/BTCPayServer/Payments/PaymentTypes.cs +++ b/BTCPayServer/Payments/PaymentTypes.cs @@ -1,7 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; using BTCPayServer.Services.Altcoins.Monero.Payments; using BTCPayServer.Services.Invoices; using Newtonsoft.Json.Linq; diff --git a/BTCPayServer/Program.cs b/BTCPayServer/Program.cs index 0de8d4c19..d92a1c656 100644 --- a/BTCPayServer/Program.cs +++ b/BTCPayServer/Program.cs @@ -1,22 +1,12 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Diagnostics; using System.IO; -using System.Linq; using System.Net; using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Threading; using BTCPayServer.Configuration; using BTCPayServer.Hosting; using BTCPayServer.Logging; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting.Server.Features; -using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; -using NBitcoin; -using Serilog; [assembly: InternalsVisibleTo("BTCPayServer.Tests")] namespace BTCPayServer diff --git a/BTCPayServer/Roles.cs b/BTCPayServer/Roles.cs index ce4dceaf0..692a7580e 100644 --- a/BTCPayServer/Roles.cs +++ b/BTCPayServer/Roles.cs @@ -1,8 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - namespace BTCPayServer { public class Roles diff --git a/BTCPayServer/SSH/SSHCommandResult.cs b/BTCPayServer/SSH/SSHCommandResult.cs index cca3c0ea8..af8ad7d82 100644 --- a/BTCPayServer/SSH/SSHCommandResult.cs +++ b/BTCPayServer/SSH/SSHCommandResult.cs @@ -1,8 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - namespace BTCPayServer.SSH { public class SSHCommandResult diff --git a/BTCPayServer/SSH/SSHFingerprint.cs b/BTCPayServer/SSH/SSHFingerprint.cs index 044080976..45afc180f 100644 --- a/BTCPayServer/SSH/SSHFingerprint.cs +++ b/BTCPayServer/SSH/SSHFingerprint.cs @@ -1,9 +1,6 @@ using System; -using System.Collections.Generic; using System.Globalization; using System.Linq; -using System.Text; -using System.Threading.Tasks; using NBitcoin; using NBitcoin.DataEncoders; @@ -75,8 +72,8 @@ namespace BTCPayServer.SSH throw new ArgumentException(paramName: nameof(hash), message: "Invalid length, expected 16 or 32"); } - byte[] _ShortFingerprint; - byte[] _FullHash; + readonly byte[] _ShortFingerprint; + readonly byte[] _FullHash; public bool Match(byte[] shortFingerprint, byte[] hostKey) { @@ -89,7 +86,7 @@ namespace BTCPayServer.SSH return Utils.ArrayEqual(_FullHash, NBitcoin.Crypto.Hashes.SHA256(hostKey)); } - string _Original; + readonly string _Original; public override string ToString() { return _Original; diff --git a/BTCPayServer/SSH/SSHSettings.cs b/BTCPayServer/SSH/SSHSettings.cs index 59048ba72..628ede1e4 100644 --- a/BTCPayServer/SSH/SSHSettings.cs +++ b/BTCPayServer/SSH/SSHSettings.cs @@ -1,8 +1,5 @@ -using System; using System.Collections.Generic; using System.Linq; -using System.Threading.Tasks; -using Microsoft.Extensions.Configuration; using Renci.SshNet; namespace BTCPayServer.SSH diff --git a/BTCPayServer/SearchString.cs b/BTCPayServer/SearchString.cs index 18a25c523..7f94c73f2 100644 --- a/BTCPayServer/SearchString.cs +++ b/BTCPayServer/SearchString.cs @@ -2,14 +2,12 @@ using System; using System.Collections.Generic; using System.Globalization; using System.Linq; -using System.Text.RegularExpressions; -using System.Threading.Tasks; namespace BTCPayServer { public class SearchString { - string _OriginalString; + readonly string _OriginalString; public SearchString(string str) { str = str ?? string.Empty; diff --git a/BTCPayServer/Security/AuthenticationExtensions.cs b/BTCPayServer/Security/AuthenticationExtensions.cs index d3ec13cee..5c6aa80c6 100644 --- a/BTCPayServer/Security/AuthenticationExtensions.cs +++ b/BTCPayServer/Security/AuthenticationExtensions.cs @@ -1,4 +1,3 @@ -using System; using BTCPayServer.Security.Bitpay; using Microsoft.AspNetCore.Authentication; diff --git a/BTCPayServer/Security/Bitpay/BitToken.cs b/BTCPayServer/Security/Bitpay/BitToken.cs index 5c8cdfd8a..aa2c1dd1c 100644 --- a/BTCPayServer/Security/Bitpay/BitToken.cs +++ b/BTCPayServer/Security/Bitpay/BitToken.cs @@ -1,7 +1,4 @@ using System; -using System.Collections.Generic; -using System.Text; -using NBitcoin; using NBitpayClient; namespace BTCPayServer.Security.Bitpay diff --git a/BTCPayServer/Security/Bitpay/BitpayAuthenticationHandler.cs b/BTCPayServer/Security/Bitpay/BitpayAuthenticationHandler.cs index 77441eebc..4890faa81 100644 --- a/BTCPayServer/Security/Bitpay/BitpayAuthenticationHandler.cs +++ b/BTCPayServer/Security/Bitpay/BitpayAuthenticationHandler.cs @@ -1,14 +1,10 @@ using System; using System.Collections.Generic; using System.IO; -using System.Linq; using System.Security.Claims; using System.Text; using System.Text.Encodings.Web; using System.Threading.Tasks; -using BTCPayServer.Data; -using BTCPayServer.Logging; -using BTCPayServer.Services; using BTCPayServer.Services.Stores; using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Http; @@ -17,17 +13,15 @@ using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; using NBitcoin; using NBitcoin.DataEncoders; -using NBitpayClient; using NBitpayClient.Extensions; -using Newtonsoft.Json.Linq; namespace BTCPayServer.Security.Bitpay { public class BitpayAuthenticationHandler : AuthenticationHandler { - StoreRepository _StoreRepository; - TokenRepository _TokenRepository; + readonly StoreRepository _StoreRepository; + readonly TokenRepository _TokenRepository; public BitpayAuthenticationHandler( TokenRepository tokenRepository, StoreRepository storeRepository, diff --git a/BTCPayServer/Security/Bitpay/BitpayAuthenticationOptions.cs b/BTCPayServer/Security/Bitpay/BitpayAuthenticationOptions.cs index 639dc3648..68d2c6c4d 100644 --- a/BTCPayServer/Security/Bitpay/BitpayAuthenticationOptions.cs +++ b/BTCPayServer/Security/Bitpay/BitpayAuthenticationOptions.cs @@ -1,7 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; using Microsoft.AspNetCore.Authentication; namespace BTCPayServer.Security.Bitpay diff --git a/BTCPayServer/Security/Bitpay/BitpayAuthenticationTypes.cs b/BTCPayServer/Security/Bitpay/BitpayAuthenticationTypes.cs index 6127176bb..13c55ac24 100644 --- a/BTCPayServer/Security/Bitpay/BitpayAuthenticationTypes.cs +++ b/BTCPayServer/Security/Bitpay/BitpayAuthenticationTypes.cs @@ -1,8 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - namespace BTCPayServer.Security.Bitpay { public class BitpayAuthenticationTypes diff --git a/BTCPayServer/Security/Bitpay/BitpayAuthorizationHandler.cs b/BTCPayServer/Security/Bitpay/BitpayAuthorizationHandler.cs index a39123187..112348483 100644 --- a/BTCPayServer/Security/Bitpay/BitpayAuthorizationHandler.cs +++ b/BTCPayServer/Security/Bitpay/BitpayAuthorizationHandler.cs @@ -1,17 +1,10 @@ -using System; using System.Linq; -using System.Security.Claims; using System.Threading.Tasks; using BTCPayServer.Client; using BTCPayServer.Data; -using BTCPayServer.Security.Bitpay; -using BTCPayServer.Services; using BTCPayServer.Services.Stores; -using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Identity; -using Microsoft.AspNetCore.Routing; namespace BTCPayServer.Security.Bitpay { diff --git a/BTCPayServer/Security/Bitpay/BitpayClaims.cs b/BTCPayServer/Security/Bitpay/BitpayClaims.cs index b1eed5a98..fe817ad4d 100644 --- a/BTCPayServer/Security/Bitpay/BitpayClaims.cs +++ b/BTCPayServer/Security/Bitpay/BitpayClaims.cs @@ -1,8 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - namespace BTCPayServer.Security.Bitpay { public class BitpayClaims diff --git a/BTCPayServer/Security/Bitpay/PairingCodeEntity.cs b/BTCPayServer/Security/Bitpay/PairingCodeEntity.cs index 06a2671d6..009cdbbf9 100644 --- a/BTCPayServer/Security/Bitpay/PairingCodeEntity.cs +++ b/BTCPayServer/Security/Bitpay/PairingCodeEntity.cs @@ -1,6 +1,4 @@ using System; -using System.Collections.Generic; -using System.Text; namespace BTCPayServer.Security.Bitpay { diff --git a/BTCPayServer/Security/Bitpay/TokenRepository.cs b/BTCPayServer/Security/Bitpay/TokenRepository.cs index 8eae010e9..c2a72a107 100644 --- a/BTCPayServer/Security/Bitpay/TokenRepository.cs +++ b/BTCPayServer/Security/Bitpay/TokenRepository.cs @@ -1,15 +1,10 @@ using System; -using System.Collections.Generic; using System.Linq; -using System.Text; using System.Threading.Tasks; using BTCPayServer.Data; -using DBriize; using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Query; using NBitcoin; using NBitcoin.DataEncoders; -using Newtonsoft.Json; namespace BTCPayServer.Security.Bitpay { @@ -23,7 +18,7 @@ namespace BTCPayServer.Security.Bitpay public class TokenRepository { - ApplicationDbContextFactory _Factory; + readonly ApplicationDbContextFactory _Factory; public TokenRepository(ApplicationDbContextFactory dbFactory) { if (dbFactory == null) diff --git a/BTCPayServer/Security/ContentSecurityPolicies.cs b/BTCPayServer/Security/ContentSecurityPolicies.cs index 2b0abf499..9a83b15f4 100644 --- a/BTCPayServer/Security/ContentSecurityPolicies.cs +++ b/BTCPayServer/Security/ContentSecurityPolicies.cs @@ -2,7 +2,6 @@ using System; using System.Collections.Generic; using System.Linq; using System.Text; -using System.Threading.Tasks; namespace BTCPayServer.Security { @@ -66,7 +65,8 @@ namespace BTCPayServer.Security { } - HashSet _Policies = new HashSet(); + + readonly HashSet _Policies = new HashSet(); public void Add(ConsentSecurityPolicy policy) { if (_Policies.Any(p => p.Name == policy.Name && p.Value == policy.Name)) @@ -109,7 +109,7 @@ namespace BTCPayServer.Security _Policies.Clear(); } - HashSet authorized = new HashSet(); + readonly HashSet authorized = new HashSet(); internal void AddAllAuthorized(string v) { authorized.Add(v); diff --git a/BTCPayServer/Security/CookieAuthorizationHandler.cs b/BTCPayServer/Security/CookieAuthorizationHandler.cs index bbec638d4..ae12981c3 100644 --- a/BTCPayServer/Security/CookieAuthorizationHandler.cs +++ b/BTCPayServer/Security/CookieAuthorizationHandler.cs @@ -1,16 +1,10 @@ -using System; -using System.Linq; -using System.Security.Claims; using System.Threading.Tasks; using BTCPayServer.Client; using BTCPayServer.Data; using BTCPayServer.Services.Stores; -using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Identity; -using Microsoft.AspNetCore.Routing; -using Microsoft.Extensions.Primitives; namespace BTCPayServer.Security { @@ -51,7 +45,7 @@ namespace BTCPayServer.Security return; - var store = await _storeRepository.FindStore((string)storeId, userid); + var store = await _storeRepository.FindStore(storeId, userid); if (store == null) return; bool success = false; diff --git a/BTCPayServer/Security/GreenField/APIKeyExtensions.cs b/BTCPayServer/Security/GreenField/APIKeyExtensions.cs index c437fb391..bb8136945 100644 --- a/BTCPayServer/Security/GreenField/APIKeyExtensions.cs +++ b/BTCPayServer/Security/GreenField/APIKeyExtensions.cs @@ -1,7 +1,6 @@ using System; using System.Linq; using BTCPayServer.Client; -using BTCPayServer.Security.Bitpay; using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Http; diff --git a/BTCPayServer/Security/GreenField/APIKeysAuthenticationHandler.cs b/BTCPayServer/Security/GreenField/APIKeysAuthenticationHandler.cs index acceb49b6..df9dd9003 100644 --- a/BTCPayServer/Security/GreenField/APIKeysAuthenticationHandler.cs +++ b/BTCPayServer/Security/GreenField/APIKeysAuthenticationHandler.cs @@ -1,13 +1,10 @@ -using System; using System.Collections.Generic; using System.Linq; using System.Security.Claims; -using System.Text; using System.Text.Encodings.Web; using System.Threading.Tasks; using BTCPayServer.Client; using BTCPayServer.Data; -using BTCPayServer.Security.Bitpay; using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Identity; using Microsoft.Extensions.Logging; diff --git a/BTCPayServer/Security/GreenField/BasicAuthenticationHandler.cs b/BTCPayServer/Security/GreenField/BasicAuthenticationHandler.cs index 3657ad8ac..f9079fc37 100644 --- a/BTCPayServer/Security/GreenField/BasicAuthenticationHandler.cs +++ b/BTCPayServer/Security/GreenField/BasicAuthenticationHandler.cs @@ -1,13 +1,11 @@ using System; using System.Collections.Generic; -using System.Linq; using System.Security.Claims; using System.Text; using System.Text.Encodings.Web; using System.Threading.Tasks; using BTCPayServer.Client; using BTCPayServer.Data; -using BTCPayServer.Security.Bitpay; using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Identity; using Microsoft.Extensions.Logging; diff --git a/BTCPayServer/Security/GreenField/GreenFieldAuthorizationHandler.cs b/BTCPayServer/Security/GreenField/GreenFieldAuthorizationHandler.cs index 0b797a883..601dba588 100644 --- a/BTCPayServer/Security/GreenField/GreenFieldAuthorizationHandler.cs +++ b/BTCPayServer/Security/GreenField/GreenFieldAuthorizationHandler.cs @@ -1,6 +1,4 @@ using System.Collections.Generic; -using System.Linq; -using System.Security.Claims; using System.Threading.Tasks; using BTCPayServer.Client; using BTCPayServer.Data; @@ -8,7 +6,6 @@ using BTCPayServer.Services.Stores; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Identity; -using Microsoft.AspNetCore.Routing; namespace BTCPayServer.Security.GreenField { @@ -54,7 +51,7 @@ namespace BTCPayServer.Security.GreenField { if (string.IsNullOrEmpty(userid)) break; - var store = await _storeRepository.FindStore((string)storeId, userid); + var store = await _storeRepository.FindStore(storeId, userid); if (store == null) break; if (Policies.IsStoreModifyPolicy(policy) || policy == Policies.CanUseLightningNodeInStore) diff --git a/BTCPayServer/Security/GreenField/GreenFieldConstants.cs b/BTCPayServer/Security/GreenField/GreenFieldConstants.cs index b34385b48..8556b43ac 100644 --- a/BTCPayServer/Security/GreenField/GreenFieldConstants.cs +++ b/BTCPayServer/Security/GreenField/GreenFieldConstants.cs @@ -1,6 +1,3 @@ -using System.Collections.Generic; -using BTCPayServer.Client; - namespace BTCPayServer.Security.GreenField { public static class GreenFieldConstants diff --git a/BTCPayServer/Security/PolicyRequirement.cs b/BTCPayServer/Security/PolicyRequirement.cs index 5d214c8dd..59816d816 100644 --- a/BTCPayServer/Security/PolicyRequirement.cs +++ b/BTCPayServer/Security/PolicyRequirement.cs @@ -1,7 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; namespace BTCPayServer.Security diff --git a/BTCPayServer/Services/Altcoins/Monero/Payments/MoneroLikePaymentData.cs b/BTCPayServer/Services/Altcoins/Monero/Payments/MoneroLikePaymentData.cs index f0e456593..d12a88f2a 100644 --- a/BTCPayServer/Services/Altcoins/Monero/Payments/MoneroLikePaymentData.cs +++ b/BTCPayServer/Services/Altcoins/Monero/Payments/MoneroLikePaymentData.cs @@ -1,5 +1,4 @@ using BTCPayServer.Client.Models; -using BTCPayServer.Data; using BTCPayServer.Payments; using BTCPayServer.Services.Altcoins.Monero.Utils; using BTCPayServer.Services.Invoices; diff --git a/BTCPayServer/Services/Altcoins/Monero/Payments/MoneroLikePaymentMethodHandler.cs b/BTCPayServer/Services/Altcoins/Monero/Payments/MoneroLikePaymentMethodHandler.cs index eb7c0d089..5815bfb18 100644 --- a/BTCPayServer/Services/Altcoins/Monero/Payments/MoneroLikePaymentMethodHandler.cs +++ b/BTCPayServer/Services/Altcoins/Monero/Payments/MoneroLikePaymentMethodHandler.cs @@ -4,7 +4,6 @@ using System.Globalization; using System.Linq; using System.Threading.Tasks; using BTCPayServer.Data; -using BTCPayServer.Lightning; using BTCPayServer.Logging; using BTCPayServer.Models; using BTCPayServer.Models.InvoicingModels; diff --git a/BTCPayServer/Services/Altcoins/Monero/Services/MoneroListener.cs b/BTCPayServer/Services/Altcoins/Monero/Services/MoneroListener.cs index 5917bdf57..8f3bbca69 100644 --- a/BTCPayServer/Services/Altcoins/Monero/Services/MoneroListener.cs +++ b/BTCPayServer/Services/Altcoins/Monero/Services/MoneroListener.cs @@ -26,8 +26,8 @@ namespace BTCPayServer.Services.Altcoins.Monero.Services private readonly MoneroLikeConfiguration _MoneroLikeConfiguration; private readonly BTCPayNetworkProvider _networkProvider; private readonly ILogger _logger; - private CompositeDisposable leases = new CompositeDisposable(); - private Queue> taskQueue = new Queue>(); + private readonly CompositeDisposable leases = new CompositeDisposable(); + private readonly Queue> taskQueue = new Queue>(); private CancellationTokenSource _Cts; public MoneroListener(InvoiceRepository invoiceRepository, diff --git a/BTCPayServer/Services/Altcoins/Monero/Services/MoneroRPCProvider.cs b/BTCPayServer/Services/Altcoins/Monero/Services/MoneroRPCProvider.cs index 41538d596..63552dfef 100644 --- a/BTCPayServer/Services/Altcoins/Monero/Services/MoneroRPCProvider.cs +++ b/BTCPayServer/Services/Altcoins/Monero/Services/MoneroRPCProvider.cs @@ -18,7 +18,7 @@ namespace BTCPayServer.Services.Altcoins.Monero.Services public ImmutableDictionary DaemonRpcClients; public ImmutableDictionary WalletRpcClients; - private ConcurrentDictionary _summaries = + private readonly ConcurrentDictionary _summaries = new ConcurrentDictionary(); public ConcurrentDictionary Summaries => _summaries; diff --git a/BTCPayServer/Services/Altcoins/Monero/UI/MoneroLikeStoreController.cs b/BTCPayServer/Services/Altcoins/Monero/UI/MoneroLikeStoreController.cs index f9fb05d48..697aaa7fc 100644 --- a/BTCPayServer/Services/Altcoins/Monero/UI/MoneroLikeStoreController.cs +++ b/BTCPayServer/Services/Altcoins/Monero/UI/MoneroLikeStoreController.cs @@ -103,7 +103,7 @@ namespace BTCPayServer.Services.Altcoins.Monero.UI !excludeFilters.Match(new PaymentMethodId(cryptoCode, MoneroPaymentType.Instance)), Summary = summary, CryptoCode = cryptoCode, - AccountIndex = settings?.AccountIndex ?? accountsResponse?.SubaddressAccounts?.FirstOrDefault()?.AccountIndex ?? (long)0, + AccountIndex = settings?.AccountIndex ?? accountsResponse?.SubaddressAccounts?.FirstOrDefault()?.AccountIndex ?? 0, Accounts = accounts == null ? null : new SelectList(accounts, nameof(SelectListItem.Value), nameof(SelectListItem.Text)) }; diff --git a/BTCPayServer/Services/Apps/AppHubStreamer.cs b/BTCPayServer/Services/Apps/AppHubStreamer.cs index 3633c802f..e27e953f0 100644 --- a/BTCPayServer/Services/Apps/AppHubStreamer.cs +++ b/BTCPayServer/Services/Apps/AppHubStreamer.cs @@ -1,33 +1,16 @@ -using System; -using System.Collections.Concurrent; -using System.Collections.Generic; -using System.Linq; using System.Threading; -using System.Threading.Channels; using System.Threading.Tasks; using BTCPayServer.Controllers; -using BTCPayServer.Data; using BTCPayServer.Events; using BTCPayServer.HostedServices; -using BTCPayServer.Logging; -using BTCPayServer.Models.AppViewModels; -using BTCPayServer.Payments; -using BTCPayServer.Rating; -using BTCPayServer.Services.Apps; -using BTCPayServer.Services.Invoices; -using BTCPayServer.Services.Rates; using Microsoft.AspNetCore.SignalR; -using Microsoft.Extensions.Caching.Memory; -using Microsoft.Extensions.Hosting; -using Microsoft.Extensions.Logging; -using NBitcoin; namespace BTCPayServer.Services.Apps { public class AppHubStreamer : EventHostedServiceBase { private readonly AppService _appService; - private IHubContext _HubContext; + private readonly IHubContext _HubContext; public AppHubStreamer(EventAggregator eventAggregator, IHubContext hubContext, diff --git a/BTCPayServer/Services/Apps/AppService.cs b/BTCPayServer/Services/Apps/AppService.cs index 4e5b48a18..87c4fe239 100644 --- a/BTCPayServer/Services/Apps/AppService.cs +++ b/BTCPayServer/Services/Apps/AppService.cs @@ -1,47 +1,33 @@ using System; using System.Collections.Generic; -using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; -using System.Security.Claims; using System.Threading.Tasks; using BTCPayServer.Data; -using BTCPayServer.Filters; -using BTCPayServer.Models; using BTCPayServer.Models.AppViewModels; using BTCPayServer.Payments; -using BTCPayServer.Rating; -using BTCPayServer.Security; -using BTCPayServer.Services.Apps; using BTCPayServer.Services.Invoices; using BTCPayServer.Services.Rates; using BTCPayServer.Services.Stores; using ExchangeSharp; using Ganss.XSS; -using Microsoft.AspNetCore.Cors; -using Microsoft.AspNetCore.Http.Extensions; -using Microsoft.AspNetCore.Identity; -using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; using NBitcoin; using NBitcoin.DataEncoders; -using NBitpayClient; using Newtonsoft.Json.Linq; using NUglify.Helpers; using YamlDotNet.RepresentationModel; using YamlDotNet.Serialization; -using YamlDotNet.Serialization.NamingConventions; -using static BTCPayServer.Controllers.AppsController; using static BTCPayServer.Models.AppViewModels.ViewCrowdfundViewModel; namespace BTCPayServer.Services.Apps { public class AppService { - ApplicationDbContextFactory _ContextFactory; + readonly ApplicationDbContextFactory _ContextFactory; private readonly InvoiceRepository _InvoiceRepository; - CurrencyNameTable _Currencies; + readonly CurrencyNameTable _Currencies; private readonly StoreRepository _storeRepository; private readonly HtmlSanitizer _HtmlSanitizer; public CurrencyNameTable Currencies => _Currencies; diff --git a/BTCPayServer/Services/Apps/CrowdfundSettings.cs b/BTCPayServer/Services/Apps/CrowdfundSettings.cs index e9f7f5fbc..76d3e94c8 100644 --- a/BTCPayServer/Services/Apps/CrowdfundSettings.cs +++ b/BTCPayServer/Services/Apps/CrowdfundSettings.cs @@ -1,7 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; namespace BTCPayServer.Services.Apps { diff --git a/BTCPayServer/Services/BTCPayNetworkJsonSerializerSettings.cs b/BTCPayServer/Services/BTCPayNetworkJsonSerializerSettings.cs index fde79e4e8..b9d631648 100644 --- a/BTCPayServer/Services/BTCPayNetworkJsonSerializerSettings.cs +++ b/BTCPayServer/Services/BTCPayNetworkJsonSerializerSettings.cs @@ -1,8 +1,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Components.Web; using NBitcoin; using Newtonsoft.Json; @@ -43,7 +41,7 @@ namespace BTCPayServer.Services } } - Dictionary _Serializers = new Dictionary(); + readonly Dictionary _Serializers = new Dictionary(); public JsonSerializerSettings GetSerializer(Network network) { diff --git a/BTCPayServer/Services/BTCPayServerEnvironment.cs b/BTCPayServer/Services/BTCPayServerEnvironment.cs index 2995c7111..fbd146a55 100644 --- a/BTCPayServer/Services/BTCPayServerEnvironment.cs +++ b/BTCPayServer/Services/BTCPayServerEnvironment.cs @@ -1,21 +1,18 @@ using System; -using System.Collections.Generic; using System.Linq; using System.Reflection; using System.Text; -using System.Threading.Tasks; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Http; using Microsoft.Extensions.Hosting; using NBitcoin; -using NBXplorer; namespace BTCPayServer.Services { public class BTCPayServerEnvironment { - IHttpContextAccessor httpContext; - TorServices torServices; + readonly IHttpContextAccessor httpContext; + readonly TorServices torServices; public BTCPayServerEnvironment(IWebHostEnvironment env, BTCPayNetworkProvider provider, IHttpContextAccessor httpContext, TorServices torServices) { this.httpContext = httpContext; diff --git a/BTCPayServer/Services/DelayedTransactionBroadcaster.cs b/BTCPayServer/Services/DelayedTransactionBroadcaster.cs index 2d1a63ab8..4471a0a47 100644 --- a/BTCPayServer/Services/DelayedTransactionBroadcaster.cs +++ b/BTCPayServer/Services/DelayedTransactionBroadcaster.cs @@ -2,14 +2,12 @@ using System; using System.Collections.Generic; using System.Linq; using System.Threading; -using System.Threading.Channels; using System.Threading.Tasks; using BTCPayServer.Data; using BTCPayServer.Logging; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Logging; using NBitcoin; -using NBXplorer; namespace BTCPayServer.Services { diff --git a/BTCPayServer/Services/DynamicDnsSettings.cs b/BTCPayServer/Services/DynamicDnsSettings.cs index f0daba8b7..0bad6eaa4 100644 --- a/BTCPayServer/Services/DynamicDnsSettings.cs +++ b/BTCPayServer/Services/DynamicDnsSettings.cs @@ -1,13 +1,11 @@ using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; -using System.Linq; using System.Net.Http; using System.Net.Http.Headers; using System.Reflection; using System.Text; using System.Threading.Tasks; -using BTCPayServer.Hosting; using NBitcoin.DataEncoders; using Newtonsoft.Json; diff --git a/BTCPayServer/Services/Fees/FixedFeeProvider.cs b/BTCPayServer/Services/Fees/FixedFeeProvider.cs index b38a18960..17de998d5 100644 --- a/BTCPayServer/Services/Fees/FixedFeeProvider.cs +++ b/BTCPayServer/Services/Fees/FixedFeeProvider.cs @@ -1,6 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Linq; using System.Threading.Tasks; using NBitcoin; diff --git a/BTCPayServer/Services/Fees/IFeeProvider.cs b/BTCPayServer/Services/Fees/IFeeProvider.cs index 050863cb8..a9e258976 100644 --- a/BTCPayServer/Services/Fees/IFeeProvider.cs +++ b/BTCPayServer/Services/Fees/IFeeProvider.cs @@ -1,10 +1,5 @@ -using System; -using System.Collections.Generic; -using System.Linq; using System.Threading.Tasks; using NBitcoin; -using NBXplorer; -using NBXplorer.Models; namespace BTCPayServer.Services { diff --git a/BTCPayServer/Services/Fees/IFeeProviderFactory.cs b/BTCPayServer/Services/Fees/IFeeProviderFactory.cs index 82cc6663c..358ec3143 100644 --- a/BTCPayServer/Services/Fees/IFeeProviderFactory.cs +++ b/BTCPayServer/Services/Fees/IFeeProviderFactory.cs @@ -1,8 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - namespace BTCPayServer.Services { public interface IFeeProviderFactory diff --git a/BTCPayServer/Services/Fees/NBxplorerFeeProvider.cs b/BTCPayServer/Services/Fees/NBxplorerFeeProvider.cs index c7b8756dd..4c936ba15 100644 --- a/BTCPayServer/Services/Fees/NBxplorerFeeProvider.cs +++ b/BTCPayServer/Services/Fees/NBxplorerFeeProvider.cs @@ -1,6 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; using System.Threading.Tasks; using NBitcoin; using NBXplorer; @@ -34,8 +32,9 @@ namespace BTCPayServer.Services.Fees _Factory = parent; _ExplorerClient = explorerClient; } - NBXplorerFeeProviderFactory _Factory; - ExplorerClient _ExplorerClient; + + readonly NBXplorerFeeProviderFactory _Factory; + readonly ExplorerClient _ExplorerClient; public async Task GetFeeRateAsync(int blockTarget = 20) { try diff --git a/BTCPayServer/Services/IBackgroundJobClient.cs b/BTCPayServer/Services/IBackgroundJobClient.cs index a006569c1..193939802 100644 --- a/BTCPayServer/Services/IBackgroundJobClient.cs +++ b/BTCPayServer/Services/IBackgroundJobClient.cs @@ -1,6 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; using System.Threading; using System.Threading.Tasks; diff --git a/BTCPayServer/Services/Invoices/Export/CsvSerializer.cs b/BTCPayServer/Services/Invoices/Export/CsvSerializer.cs index 3c87f3351..8c0cbe534 100644 --- a/BTCPayServer/Services/Invoices/Export/CsvSerializer.cs +++ b/BTCPayServer/Services/Invoices/Export/CsvSerializer.cs @@ -1,9 +1,6 @@ using System; -using System.Collections; using System.Collections.Generic; -using System.ComponentModel; using System.Globalization; -using System.IO; using System.Linq; using System.Reflection; using System.Text; @@ -16,7 +13,7 @@ namespace BTCPayServer.Services.Invoices.Export /// public class CsvSerializer where T : class, new() { - private List _properties; + private readonly List _properties; public bool IgnoreEmptyLines { get; set; } = true; public bool IgnoreReferenceTypesExceptString { get; set; } = true; diff --git a/BTCPayServer/Services/Invoices/Export/InvoiceExport.cs b/BTCPayServer/Services/Invoices/Export/InvoiceExport.cs index 06372f029..4e837d70b 100644 --- a/BTCPayServer/Services/Invoices/Export/InvoiceExport.cs +++ b/BTCPayServer/Services/Invoices/Export/InvoiceExport.cs @@ -2,10 +2,6 @@ using System; using System.Collections.Generic; using System.Globalization; using System.Linq; -using System.Threading.Tasks; -using BTCPayServer.Payments; -using BTCPayServer.Payments.Bitcoin; -using BTCPayServer.Services.Invoices; using BTCPayServer.Services.Rates; using Newtonsoft.Json; diff --git a/BTCPayServer/Services/Invoices/InvoiceEntity.cs b/BTCPayServer/Services/Invoices/InvoiceEntity.cs index 171217b1f..85fead7a7 100644 --- a/BTCPayServer/Services/Invoices/InvoiceEntity.cs +++ b/BTCPayServer/Services/Invoices/InvoiceEntity.cs @@ -2,8 +2,6 @@ using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations.Schema; using System.Linq; -using System.Text; -using System.Threading.Tasks; using BTCPayServer.Client.Models; using BTCPayServer.Data; using BTCPayServer.JsonConverters; @@ -14,8 +12,6 @@ using NBitcoin; using NBitcoin.DataEncoders; using NBitpayClient; using NBXplorer; -using NBXplorer.DerivationStrategy; -using NBXplorer.Models; using Newtonsoft.Json; using Newtonsoft.Json.Linq; @@ -623,11 +619,11 @@ namespace BTCPayServer.Services.Invoices } public class InvoiceState { - static Dictionary _StringToInvoiceStatus; - static Dictionary _InvoiceStatusToString; + static readonly Dictionary _StringToInvoiceStatus; + static readonly Dictionary _InvoiceStatusToString; - static Dictionary _StringToExceptionStatus; - static Dictionary _ExceptionStatusToString; + static readonly Dictionary _StringToExceptionStatus; + static readonly Dictionary _ExceptionStatusToString; static InvoiceState() { diff --git a/BTCPayServer/Services/Invoices/InvoiceRepository.cs b/BTCPayServer/Services/Invoices/InvoiceRepository.cs index 3c77e2621..1af271460 100644 --- a/BTCPayServer/Services/Invoices/InvoiceRepository.cs +++ b/BTCPayServer/Services/Invoices/InvoiceRepository.cs @@ -12,7 +12,6 @@ using DBriize; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Logging; using NBitcoin; -using Newtonsoft.Json.Linq; using Encoders = NBitcoin.DataEncoders.Encoders; namespace BTCPayServer.Services.Invoices @@ -30,9 +29,9 @@ namespace BTCPayServer.Services.Invoices } } - private ApplicationDbContextFactory _ContextFactory; + private readonly ApplicationDbContextFactory _ContextFactory; private readonly BTCPayNetworkProvider _Networks; - private CustomThreadPool _IndexerThread; + private readonly CustomThreadPool _IndexerThread; public InvoiceRepository(ApplicationDbContextFactory contextFactory, string dbreezePath, BTCPayNetworkProvider networks) diff --git a/BTCPayServer/Services/Invoices/PaymentMethodDictionary.cs b/BTCPayServer/Services/Invoices/PaymentMethodDictionary.cs index cf63c7a49..ee845bb1a 100644 --- a/BTCPayServer/Services/Invoices/PaymentMethodDictionary.cs +++ b/BTCPayServer/Services/Invoices/PaymentMethodDictionary.cs @@ -1,14 +1,13 @@ using System; using System.Collections; using System.Collections.Generic; -using System.Threading.Tasks; using BTCPayServer.Payments; namespace BTCPayServer.Services.Invoices { public class PaymentMethodDictionary : IEnumerable { - Dictionary _Inner = new Dictionary(); + readonly Dictionary _Inner = new Dictionary(); public PaymentMethodDictionary() { diff --git a/BTCPayServer/Services/LanguageService.cs b/BTCPayServer/Services/LanguageService.cs index 08f0dced1..ee5800722 100644 --- a/BTCPayServer/Services/LanguageService.cs +++ b/BTCPayServer/Services/LanguageService.cs @@ -1,8 +1,6 @@ using System.Collections.Generic; using System.IO; -using System.Linq; using Microsoft.AspNetCore.Hosting; -using Microsoft.Extensions.Hosting; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using Newtonsoft.Json.Serialization; diff --git a/BTCPayServer/Services/LightningClientFactoryService.cs b/BTCPayServer/Services/LightningClientFactoryService.cs index 551e2ccbd..8ec085270 100644 --- a/BTCPayServer/Services/LightningClientFactoryService.cs +++ b/BTCPayServer/Services/LightningClientFactoryService.cs @@ -1,8 +1,5 @@ using System; -using System.Collections.Generic; -using System.Linq; using System.Net.Http; -using System.Threading.Tasks; using BTCPayServer.Lightning; namespace BTCPayServer.Services diff --git a/BTCPayServer/Services/LightningConfigurationProvider.cs b/BTCPayServer/Services/LightningConfigurationProvider.cs index be82eaab6..b36160117 100644 --- a/BTCPayServer/Services/LightningConfigurationProvider.cs +++ b/BTCPayServer/Services/LightningConfigurationProvider.cs @@ -1,16 +1,13 @@ using System; using System.Collections.Concurrent; using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; using NBitcoin; -using NBitcoin.DataEncoders; namespace BTCPayServer.Services { public class LightningConfigurationProvider { - ConcurrentDictionary _Map = new ConcurrentDictionary(); + readonly ConcurrentDictionary _Map = new ConcurrentDictionary(); public ulong KeepConfig(ulong secret, LightningConfigurations configuration) { CleanExpired(); diff --git a/BTCPayServer/Services/Mails/EmailSender.cs b/BTCPayServer/Services/Mails/EmailSender.cs index a3306213e..c158db4d0 100644 --- a/BTCPayServer/Services/Mails/EmailSender.cs +++ b/BTCPayServer/Services/Mails/EmailSender.cs @@ -9,7 +9,7 @@ namespace BTCPayServer.Services.Mails { public abstract class EmailSender : IEmailSender { - IBackgroundJobClient _JobClient; + readonly IBackgroundJobClient _JobClient; public EmailSender(IBackgroundJobClient jobClient) { diff --git a/BTCPayServer/Services/Mails/EmailSenderFactory.cs b/BTCPayServer/Services/Mails/EmailSenderFactory.cs index 12c288350..1ae7d0d65 100644 --- a/BTCPayServer/Services/Mails/EmailSenderFactory.cs +++ b/BTCPayServer/Services/Mails/EmailSenderFactory.cs @@ -1,6 +1,3 @@ -using System; -using System.Collections.Concurrent; -using System.Threading.Tasks; using BTCPayServer.Services.Stores; namespace BTCPayServer.Services.Mails diff --git a/BTCPayServer/Services/Mails/EmailSettings.cs b/BTCPayServer/Services/Mails/EmailSettings.cs index e3ca4352e..083817671 100644 --- a/BTCPayServer/Services/Mails/EmailSettings.cs +++ b/BTCPayServer/Services/Mails/EmailSettings.cs @@ -1,10 +1,6 @@ -using System; -using System.Collections.Generic; using System.ComponentModel.DataAnnotations; -using System.Linq; using System.Net; using System.Net.Mail; -using System.Threading.Tasks; namespace BTCPayServer.Services.Mails { diff --git a/BTCPayServer/Services/Mails/IEmailSender.cs b/BTCPayServer/Services/Mails/IEmailSender.cs index ec2d6ed4a..8429b6878 100644 --- a/BTCPayServer/Services/Mails/IEmailSender.cs +++ b/BTCPayServer/Services/Mails/IEmailSender.cs @@ -1,8 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - namespace BTCPayServer.Services.Mails { public interface IEmailSender diff --git a/BTCPayServer/Services/Mails/ServerEmailSender.cs b/BTCPayServer/Services/Mails/ServerEmailSender.cs index 11bfba69a..e80329195 100644 --- a/BTCPayServer/Services/Mails/ServerEmailSender.cs +++ b/BTCPayServer/Services/Mails/ServerEmailSender.cs @@ -1,6 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; using System.Threading.Tasks; namespace BTCPayServer.Services.Mails diff --git a/BTCPayServer/Services/Mails/StoreEmailSender.cs b/BTCPayServer/Services/Mails/StoreEmailSender.cs index 7d7b64137..999cfb1be 100644 --- a/BTCPayServer/Services/Mails/StoreEmailSender.cs +++ b/BTCPayServer/Services/Mails/StoreEmailSender.cs @@ -1,6 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; using System.Threading.Tasks; using BTCPayServer.Data; using BTCPayServer.Services.Stores; diff --git a/BTCPayServer/Services/MigrationSettings.cs b/BTCPayServer/Services/MigrationSettings.cs index cf7ebb60b..21cdb58f6 100644 --- a/BTCPayServer/Services/MigrationSettings.cs +++ b/BTCPayServer/Services/MigrationSettings.cs @@ -1,8 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - namespace BTCPayServer.Services { public class MigrationSettings diff --git a/BTCPayServer/Services/Notifications/Blobs/NewVersionNotification.cs b/BTCPayServer/Services/Notifications/Blobs/NewVersionNotification.cs index 5ad967417..3dcfbb7a5 100644 --- a/BTCPayServer/Services/Notifications/Blobs/NewVersionNotification.cs +++ b/BTCPayServer/Services/Notifications/Blobs/NewVersionNotification.cs @@ -1,6 +1,4 @@ -using BTCPayServer.Data; using BTCPayServer.Models.NotificationViewModels; -using Newtonsoft.Json; namespace BTCPayServer.Services.Notifications.Blobs { diff --git a/BTCPayServer/Services/Notifications/Blobs/PayoutNotification.cs b/BTCPayServer/Services/Notifications/Blobs/PayoutNotification.cs index 209cae10f..bec68b5f7 100644 --- a/BTCPayServer/Services/Notifications/Blobs/PayoutNotification.cs +++ b/BTCPayServer/Services/Notifications/Blobs/PayoutNotification.cs @@ -1,11 +1,6 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; using BTCPayServer.Configuration; using BTCPayServer.Controllers; using BTCPayServer.Models.NotificationViewModels; -using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Routing; namespace BTCPayServer.Services.Notifications.Blobs diff --git a/BTCPayServer/Services/Notifications/INotificationHandler.cs b/BTCPayServer/Services/Notifications/INotificationHandler.cs index acaee8bc5..e22911ddf 100644 --- a/BTCPayServer/Services/Notifications/INotificationHandler.cs +++ b/BTCPayServer/Services/Notifications/INotificationHandler.cs @@ -1,7 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; using BTCPayServer.Models.NotificationViewModels; namespace BTCPayServer.Services.Notifications diff --git a/BTCPayServer/Services/Notifications/NotificationManager.cs b/BTCPayServer/Services/Notifications/NotificationManager.cs index 7a60720ae..b3965d524 100644 --- a/BTCPayServer/Services/Notifications/NotificationManager.cs +++ b/BTCPayServer/Services/Notifications/NotificationManager.cs @@ -1,13 +1,10 @@ using System; using System.Collections.Generic; -using System.Globalization; using System.Linq; using System.Security.Claims; -using System.Text; using System.Threading.Tasks; using BTCPayServer.Data; using BTCPayServer.Models.NotificationViewModels; -using Google.Apis.Storage.v1.Data; using Microsoft.AspNetCore.Identity; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Caching.Memory; diff --git a/BTCPayServer/Services/Notifications/NotificationScopes.cs b/BTCPayServer/Services/Notifications/NotificationScopes.cs index 793de7edc..68278ad04 100644 --- a/BTCPayServer/Services/Notifications/NotificationScopes.cs +++ b/BTCPayServer/Services/Notifications/NotificationScopes.cs @@ -1,9 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using BTCPayServer.Data; -using Microsoft.EntityFrameworkCore; namespace BTCPayServer.Services.Notifications { diff --git a/BTCPayServer/Services/PayjoinClient.cs b/BTCPayServer/Services/PayjoinClient.cs index e93cadb6a..e4793b725 100644 --- a/BTCPayServer/Services/PayjoinClient.cs +++ b/BTCPayServer/Services/PayjoinClient.cs @@ -1,22 +1,15 @@ using System; using System.Collections.Generic; -using System.Configuration; using System.Globalization; using System.Linq; using System.Net.Http; using System.Text; using System.Threading; using System.Threading.Tasks; -using BTCPayServer.Logging; -using BTCPayServer.Payments.Changelly.Models; -using Google.Apis.Http; -using Microsoft.Extensions.Logging; using NBitcoin; using NBitcoin.Payment; using Newtonsoft.Json; using Newtonsoft.Json.Linq; -using NUglify.Helpers; -using TwentyTwenty.Storage; using IHttpClientFactory = System.Net.Http.IHttpClientFactory; namespace BTCPayServer.Services @@ -77,7 +70,7 @@ namespace BTCPayServer.Services public const string BIP21EndpointKey = "pj"; private readonly ExplorerClientProvider _explorerClientProvider; - private IHttpClientFactory _httpClientFactory; + private readonly IHttpClientFactory _httpClientFactory; public PayjoinClient(ExplorerClientProvider explorerClientProvider, IHttpClientFactory httpClientFactory) { @@ -406,7 +399,7 @@ namespace BTCPayServer.Services return null; return t.EnumValue; } - static string UnknownError = "Unknown error from the receiver"; + static readonly string UnknownError = "Unknown error from the receiver"; public static string GetMessage(string errorCode) { return Get().FirstOrDefault(o => o.ErrorCode == errorCode).Message ?? UnknownError; diff --git a/BTCPayServer/Services/PoliciesSettings.cs b/BTCPayServer/Services/PoliciesSettings.cs index 1ae9ea9af..382992bab 100644 --- a/BTCPayServer/Services/PoliciesSettings.cs +++ b/BTCPayServer/Services/PoliciesSettings.cs @@ -1,8 +1,5 @@ -using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; -using System.Linq; -using System.Threading.Tasks; using BTCPayServer.Services.Apps; using BTCPayServer.Validation; using Newtonsoft.Json; diff --git a/BTCPayServer/Services/Safe.cs b/BTCPayServer/Services/Safe.cs index d6005ec3e..f595b72d1 100644 --- a/BTCPayServer/Services/Safe.cs +++ b/BTCPayServer/Services/Safe.cs @@ -1,7 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; using Ganss.XSS; using Microsoft.AspNetCore.Html; using Microsoft.AspNetCore.Mvc.Rendering; diff --git a/BTCPayServer/Services/SettingsRepository.cs b/BTCPayServer/Services/SettingsRepository.cs index 22aa0bc05..1f35d11d3 100644 --- a/BTCPayServer/Services/SettingsRepository.cs +++ b/BTCPayServer/Services/SettingsRepository.cs @@ -1,4 +1,3 @@ -using System.Linq; using System.Threading; using System.Threading.Tasks; using BTCPayServer.Data; @@ -10,7 +9,7 @@ namespace BTCPayServer.Services { public class SettingsRepository { - private ApplicationDbContextFactory _ContextFactory; + private readonly ApplicationDbContextFactory _ContextFactory; private readonly EventAggregator _EventAggregator; public SettingsRepository(ApplicationDbContextFactory contextFactory, EventAggregator eventAggregator) diff --git a/BTCPayServer/Services/SocketFactory.cs b/BTCPayServer/Services/SocketFactory.cs index 3807756db..ab9a7bfc8 100644 --- a/BTCPayServer/Services/SocketFactory.cs +++ b/BTCPayServer/Services/SocketFactory.cs @@ -1,11 +1,8 @@ -using System.Collections.Concurrent; using System.Net; -using System.Net.Http; using System.Net.Sockets; using System.Threading; using System.Threading.Tasks; using BTCPayServer.Configuration; -using NBitcoin; using NBitcoin.Protocol; using NBitcoin.Protocol.Connectors; diff --git a/BTCPayServer/Services/Stores/StoreRepository.cs b/BTCPayServer/Services/Stores/StoreRepository.cs index 3f6996196..f47dbd34c 100644 --- a/BTCPayServer/Services/Stores/StoreRepository.cs +++ b/BTCPayServer/Services/Stores/StoreRepository.cs @@ -4,8 +4,6 @@ using System.Linq; using System.Threading.Tasks; using BTCPayServer.Data; using BTCPayServer.Migrations; -using BTCPayServer.Models; -using BTCPayServer.Services.Invoices; using Microsoft.EntityFrameworkCore; using NBitcoin; using NBitcoin.DataEncoders; @@ -14,7 +12,7 @@ namespace BTCPayServer.Services.Stores { public class StoreRepository { - private ApplicationDbContextFactory _ContextFactory; + private readonly ApplicationDbContextFactory _ContextFactory; public StoreRepository(ApplicationDbContextFactory contextFactory) { diff --git a/BTCPayServer/Services/ThemesSettings.cs b/BTCPayServer/Services/ThemesSettings.cs index 600b8ebbb..d1353051a 100644 --- a/BTCPayServer/Services/ThemesSettings.cs +++ b/BTCPayServer/Services/ThemesSettings.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; using System.ComponentModel.DataAnnotations; -using System.Linq; -using System.Threading.Tasks; using Newtonsoft.Json; namespace BTCPayServer.Services diff --git a/BTCPayServer/Services/TorServices.cs b/BTCPayServer/Services/TorServices.cs index 5ad9f3cd2..758f5601c 100644 --- a/BTCPayServer/Services/TorServices.cs +++ b/BTCPayServer/Services/TorServices.cs @@ -12,7 +12,7 @@ namespace BTCPayServer.Services public class TorServices { private readonly BTCPayNetworkProvider _networks; - BTCPayServerOptions _Options; + readonly BTCPayServerOptions _Options; public TorServices(BTCPayServer.BTCPayNetworkProvider networks, BTCPayServerOptions options) { _networks = networks; diff --git a/BTCPayServer/Services/Torrc.cs b/BTCPayServer/Services/Torrc.cs index bafe08785..eddb63d57 100644 --- a/BTCPayServer/Services/Torrc.cs +++ b/BTCPayServer/Services/Torrc.cs @@ -1,9 +1,7 @@ using System; using System.Collections.Generic; -using System.Linq; using System.Net; using System.Text; -using System.Threading.Tasks; namespace BTCPayServer.Services { diff --git a/BTCPayServer/Services/WalletRepository.cs b/BTCPayServer/Services/WalletRepository.cs index 23cee6658..6c3041447 100644 --- a/BTCPayServer/Services/WalletRepository.cs +++ b/BTCPayServer/Services/WalletRepository.cs @@ -9,7 +9,7 @@ namespace BTCPayServer.Services { public class WalletRepository { - private ApplicationDbContextFactory _ContextFactory; + private readonly ApplicationDbContextFactory _ContextFactory; public WalletRepository(ApplicationDbContextFactory contextFactory) { diff --git a/BTCPayServer/Services/Wallets/BTCPayWallet.cs b/BTCPayServer/Services/Wallets/BTCPayWallet.cs index f3da9171b..286857d84 100644 --- a/BTCPayServer/Services/Wallets/BTCPayWallet.cs +++ b/BTCPayServer/Services/Wallets/BTCPayWallet.cs @@ -2,7 +2,6 @@ using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; -using System.Text; using System.Threading; using System.Threading.Tasks; using BTCPayServer.Data; @@ -39,8 +38,8 @@ namespace BTCPayServer.Services.Wallets } public class BTCPayWallet { - private ExplorerClient _Client; - private IMemoryCache _MemoryCache; + private readonly ExplorerClient _Client; + private readonly IMemoryCache _MemoryCache; public BTCPayWallet(ExplorerClient client, IMemoryCache memoryCache, BTCPayNetwork network, ApplicationDbContextFactory dbContextFactory) { @@ -155,7 +154,8 @@ namespace BTCPayServer.Services.Wallets _MemoryCache.Remove("CACHEDBALANCE_" + strategy.ToString()); _FetchingUTXOs.TryRemove(strategy.ToString(), out var unused); } - ConcurrentDictionary> _FetchingUTXOs = new ConcurrentDictionary>(); + + readonly ConcurrentDictionary> _FetchingUTXOs = new ConcurrentDictionary>(); private async Task GetUTXOChanges(DerivationStrategyBase strategy, CancellationToken cancellation) { diff --git a/BTCPayServer/Services/Wallets/BTCPayWalletProvider.cs b/BTCPayServer/Services/Wallets/BTCPayWalletProvider.cs index 7411e2e56..a1b2b4561 100644 --- a/BTCPayServer/Services/Wallets/BTCPayWalletProvider.cs +++ b/BTCPayServer/Services/Wallets/BTCPayWalletProvider.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Threading.Tasks; using Microsoft.Extensions.Caching.Memory; using Microsoft.Extensions.Options; @@ -9,9 +8,9 @@ namespace BTCPayServer.Services.Wallets { public class BTCPayWalletProvider { - private ExplorerClientProvider _Client; - BTCPayNetworkProvider _NetworkProvider; - IOptions _Options; + private readonly ExplorerClientProvider _Client; + readonly BTCPayNetworkProvider _NetworkProvider; + readonly IOptions _Options; public BTCPayWalletProvider(ExplorerClientProvider client, IOptions memoryCacheOption, Data.ApplicationDbContextFactory dbContextFactory, @@ -32,7 +31,7 @@ namespace BTCPayServer.Services.Wallets } } - Dictionary _Wallets = new Dictionary(); + readonly Dictionary _Wallets = new Dictionary(); public BTCPayWallet GetWallet(BTCPayNetworkBase network) { diff --git a/BTCPayServer/Storage/Services/Providers/FileSystemStorage/FileSystemFileProviderService.cs b/BTCPayServer/Storage/Services/Providers/FileSystemStorage/FileSystemFileProviderService.cs index 72badf517..10d5a94f1 100644 --- a/BTCPayServer/Storage/Services/Providers/FileSystemStorage/FileSystemFileProviderService.cs +++ b/BTCPayServer/Storage/Services/Providers/FileSystemStorage/FileSystemFileProviderService.cs @@ -5,8 +5,6 @@ using BTCPayServer.Configuration; using BTCPayServer.Data; using BTCPayServer.Storage.Models; using BTCPayServer.Storage.Services.Providers.FileSystemStorage.Configuration; -using ExchangeSharp; -using Microsoft.AspNetCore.Hosting; using Newtonsoft.Json; using TwentyTwenty.Storage; using TwentyTwenty.Storage.Local; diff --git a/BTCPayServer/Storage/Services/StoredFileRepository.cs b/BTCPayServer/Storage/Services/StoredFileRepository.cs index c7743505e..e7d9a9384 100644 --- a/BTCPayServer/Storage/Services/StoredFileRepository.cs +++ b/BTCPayServer/Storage/Services/StoredFileRepository.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using BTCPayServer.Data; -using BTCPayServer.Storage.Models; using Microsoft.EntityFrameworkCore; namespace BTCPayServer.Storage.Services diff --git a/BTCPayServer/StorePolicies.cs b/BTCPayServer/StorePolicies.cs index 76c5b120a..0b1efd802 100644 --- a/BTCPayServer/StorePolicies.cs +++ b/BTCPayServer/StorePolicies.cs @@ -1,7 +1,5 @@ using System; using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; namespace BTCPayServer { diff --git a/BTCPayServer/TransactionComparer.cs b/BTCPayServer/TransactionComparer.cs index 2ea0ab53e..f50c40032 100644 --- a/BTCPayServer/TransactionComparer.cs +++ b/BTCPayServer/TransactionComparer.cs @@ -1,7 +1,4 @@ -using System; using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; using NBitcoin; namespace BTCPayServer @@ -9,7 +6,7 @@ namespace BTCPayServer public class TransactionComparer : IEqualityComparer { - private static TransactionComparer _Instance = new TransactionComparer(); + private static readonly TransactionComparer _Instance = new TransactionComparer(); public static TransactionComparer Instance { get diff --git a/BTCPayServer/U2F/U2FService.cs b/BTCPayServer/U2F/U2FService.cs index 9aac64471..8773c129e 100644 --- a/BTCPayServer/U2F/U2FService.cs +++ b/BTCPayServer/U2F/U2FService.cs @@ -4,11 +4,8 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using BTCPayServer.Data; -using BTCPayServer.Models; using BTCPayServer.U2F.Models; -using Microsoft.AspNetCore.Identity; using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Query; using NBitcoin; using U2F.Core.Exceptions; using U2F.Core.Models; diff --git a/BTCPayServer/Validation/EmailValidator.cs b/BTCPayServer/Validation/EmailValidator.cs index 31c3558d9..7f51a500f 100644 --- a/BTCPayServer/Validation/EmailValidator.cs +++ b/BTCPayServer/Validation/EmailValidator.cs @@ -1,8 +1,5 @@ using System; -using System.Collections.Generic; -using System.Linq; using System.Text.RegularExpressions; -using System.Threading.Tasks; namespace BTCPayServer.Validation { diff --git a/BTCPayServer/Validation/HDFingerPrintValidator.cs b/BTCPayServer/Validation/HDFingerPrintValidator.cs index d9800cc61..ebcbfccb2 100644 --- a/BTCPayServer/Validation/HDFingerPrintValidator.cs +++ b/BTCPayServer/Validation/HDFingerPrintValidator.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; using System.ComponentModel.DataAnnotations; -using System.Linq; -using System.Threading.Tasks; using NBitcoin; using NBitcoin.DataEncoders; diff --git a/BTCPayServer/Validation/KeyPathValidator.cs b/BTCPayServer/Validation/KeyPathValidator.cs index f608e244f..e7f5ccbfa 100644 --- a/BTCPayServer/Validation/KeyPathValidator.cs +++ b/BTCPayServer/Validation/KeyPathValidator.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; using System.ComponentModel.DataAnnotations; -using System.Linq; -using System.Threading.Tasks; using NBitcoin; namespace BTCPayServer.Validation diff --git a/BTCPayServer/Validation/PubKeyValidator.cs b/BTCPayServer/Validation/PubKeyValidator.cs index bc33fa795..edd07e3eb 100644 --- a/BTCPayServer/Validation/PubKeyValidator.cs +++ b/BTCPayServer/Validation/PubKeyValidator.cs @@ -1,7 +1,5 @@ using System; -using System.Collections.Generic; using System.ComponentModel.DataAnnotations; -using System.Text; using NBitcoin; namespace BTCPayServer.Validation diff --git a/BTCPayServer/Views/Manage/ManageNavPages.cs b/BTCPayServer/Views/Manage/ManageNavPages.cs index 2579ab6bd..044ef5903 100644 --- a/BTCPayServer/Views/Manage/ManageNavPages.cs +++ b/BTCPayServer/Views/Manage/ManageNavPages.cs @@ -1,8 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - namespace BTCPayServer.Views.Manage { public enum ManageNavPages diff --git a/BTCPayServer/Views/Server/ServerNavPages.cs b/BTCPayServer/Views/Server/ServerNavPages.cs index 52ff401b4..043864e01 100644 --- a/BTCPayServer/Views/Server/ServerNavPages.cs +++ b/BTCPayServer/Views/Server/ServerNavPages.cs @@ -1,8 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - namespace BTCPayServer.Views.Server { public enum ServerNavPages diff --git a/BTCPayServer/Views/Stores/StoreNavPages.cs b/BTCPayServer/Views/Stores/StoreNavPages.cs index 1268c8a5e..ab8060240 100644 --- a/BTCPayServer/Views/Stores/StoreNavPages.cs +++ b/BTCPayServer/Views/Stores/StoreNavPages.cs @@ -1,10 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Mvc.Rendering; -using Microsoft.AspNetCore.Mvc.ViewFeatures; - namespace BTCPayServer.Views.Stores { public enum StoreNavPages diff --git a/BTCPayServer/Views/ViewsRazor.cs b/BTCPayServer/Views/ViewsRazor.cs index bd09a2fed..7a5962dd5 100644 --- a/BTCPayServer/Views/ViewsRazor.cs +++ b/BTCPayServer/Views/ViewsRazor.cs @@ -1,8 +1,5 @@ using System; -using System.Collections.Generic; using System.Globalization; -using System.Linq; -using System.Threading.Tasks; using Microsoft.AspNetCore.Html; using Microsoft.AspNetCore.Mvc.ViewFeatures; diff --git a/BTCPayServer/Views/Wallets/WalletsNavPages.cs b/BTCPayServer/Views/Wallets/WalletsNavPages.cs index b0647236b..a6cd34866 100644 --- a/BTCPayServer/Views/Wallets/WalletsNavPages.cs +++ b/BTCPayServer/Views/Wallets/WalletsNavPages.cs @@ -1,8 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - namespace BTCPayServer.Views.Wallets { public enum WalletsNavPages diff --git a/BTCPayServer/WalletId.cs b/BTCPayServer/WalletId.cs index faebc7ade..3fabdca36 100644 --- a/BTCPayServer/WalletId.cs +++ b/BTCPayServer/WalletId.cs @@ -1,8 +1,5 @@ using System; -using System.Collections.Generic; -using System.Linq; using System.Text.RegularExpressions; -using System.Threading.Tasks; using BTCPayServer.Payments; namespace BTCPayServer diff --git a/BTCPayServer/WebSocketHelper.cs b/BTCPayServer/WebSocketHelper.cs index 4384bf8fc..77ff529e3 100644 --- a/BTCPayServer/WebSocketHelper.cs +++ b/BTCPayServer/WebSocketHelper.cs @@ -1,6 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; using System.Net.WebSockets; using System.Text; using System.Threading; @@ -29,10 +27,8 @@ namespace BTCPayServer const int ORIGINAL_BUFFER_SIZE = 1024 * 5; const int MAX_BUFFER_SIZE = 1024 * 1024 * 5; - - ArraySegment _Buffer; - - UTF8Encoding UTF8 = new UTF8Encoding(false, true); + readonly ArraySegment _Buffer; + readonly UTF8Encoding UTF8 = new UTF8Encoding(false, true); public async Task NextMessageAsync(CancellationToken cancellation) { var buffer = _Buffer; diff --git a/BTCPayServer/WellKnownTempData.cs b/BTCPayServer/WellKnownTempData.cs index c95972600..e3ac4f9ab 100644 --- a/BTCPayServer/WellKnownTempData.cs +++ b/BTCPayServer/WellKnownTempData.cs @@ -1,8 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - namespace BTCPayServer { public class WellKnownTempData diff --git a/BTCPayServer/ZoneLimits.cs b/BTCPayServer/ZoneLimits.cs index 5189c7b96..69edb48aa 100644 --- a/BTCPayServer/ZoneLimits.cs +++ b/BTCPayServer/ZoneLimits.cs @@ -1,8 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - namespace BTCPayServer { public class ZoneLimits