diff --git a/.editorconfig b/.editorconfig index 3a1882a26..9d3f6f768 100644 --- a/.editorconfig +++ b/.editorconfig @@ -10,6 +10,7 @@ root = true insert_final_newline = true indent_style = space indent_size = 4 +charset = utf-8 [project.json] indent_size = 2 @@ -146,4 +147,4 @@ indent_size = 2 [*.sh] end_of_line = lf [*.{cmd, bat}] -end_of_line = crlf \ No newline at end of file +end_of_line = crlf 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 9aa786b64..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 4e38a9198..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; +using System; namespace BTCPayServer.Client { diff --git a/BTCPayServer.Client/GreenFieldValidationException.cs b/BTCPayServer.Client/GreenFieldValidationException.cs index 664a76c1c..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; using System.Text; using BTCPayServer.Client.Models; diff --git a/BTCPayServer.Client/JsonConverters/DecimalStringJsonConverter.cs b/BTCPayServer.Client/JsonConverters/DecimalStringJsonConverter.cs index 2e29590d8..f3ec5c797 100644 --- a/BTCPayServer.Client/JsonConverters/DecimalStringJsonConverter.cs +++ b/BTCPayServer.Client/JsonConverters/DecimalStringJsonConverter.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Globalization; using Newtonsoft.Json; using Newtonsoft.Json.Linq; diff --git a/BTCPayServer.Client/JsonConverters/NodeUriJsonConverter.cs b/BTCPayServer.Client/JsonConverters/NodeUriJsonConverter.cs index 229eb6a97..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; 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 c4d8f1604..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; 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 863e159ed..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 System; using NBitcoin.JsonConverters; using Newtonsoft.Json; diff --git a/BTCPayServer.Client/Models/ApprovePayoutRequest.cs b/BTCPayServer.Client/Models/ApprovePayoutRequest.cs index c6a781ef2..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 d1813eeab..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/CreateApiKeyRequest.cs b/BTCPayServer.Client/Models/CreateApiKeyRequest.cs index 2f535da61..7239cf94f 100644 --- a/BTCPayServer.Client/Models/CreateApiKeyRequest.cs +++ b/BTCPayServer.Client/Models/CreateApiKeyRequest.cs @@ -1,4 +1,4 @@ -using BTCPayServer.Client.JsonConverters; +using BTCPayServer.Client.JsonConverters; using Newtonsoft.Json; namespace BTCPayServer.Client.Models 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 7251e4597..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 4adf4c385..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 System; 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 58919bb32..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; +using System; namespace BTCPayServer.Client.Models { diff --git a/BTCPayServer.Client/Models/GreenfieldValidationError.cs b/BTCPayServer.Client/Models/GreenfieldValidationError.cs index d02390fae..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; +using System; 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 d3a216590..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 System; 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 4170188e6..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 System; 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.Client/Permissions.cs b/BTCPayServer.Client/Permissions.cs index 79f6aa82d..94c7f19f4 100644 --- a/BTCPayServer.Client/Permissions.cs +++ b/BTCPayServer.Client/Permissions.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; diff --git a/BTCPayServer.Common/Altcoins/BTCPayNetworkProvider.Bitcoin.cs b/BTCPayServer.Common/Altcoins/BTCPayNetworkProvider.Bitcoin.cs index e4c27b234..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.BitcoinGold.cs b/BTCPayServer.Common/Altcoins/BTCPayNetworkProvider.BitcoinGold.cs index 63d32b9ec..774c486ca 100644 --- a/BTCPayServer.Common/Altcoins/BTCPayNetworkProvider.BitcoinGold.cs +++ b/BTCPayServer.Common/Altcoins/BTCPayNetworkProvider.BitcoinGold.cs @@ -1,4 +1,4 @@ -using NBitcoin; +using NBitcoin; namespace BTCPayServer { diff --git a/BTCPayServer.Common/Altcoins/BTCPayNetworkProvider.Bitcoinplus.cs b/BTCPayServer.Common/Altcoins/BTCPayNetworkProvider.Bitcoinplus.cs index e83a31360..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 b72299531..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.Chaincoin.cs b/BTCPayServer.Common/Altcoins/BTCPayNetworkProvider.Chaincoin.cs index 925a46419..894c44212 100644 --- a/BTCPayServer.Common/Altcoins/BTCPayNetworkProvider.Chaincoin.cs +++ b/BTCPayServer.Common/Altcoins/BTCPayNetworkProvider.Chaincoin.cs @@ -1,4 +1,4 @@ -using NBitcoin; +using NBitcoin; namespace BTCPayServer { diff --git a/BTCPayServer.Common/Altcoins/BTCPayNetworkProvider.Dash.cs b/BTCPayServer.Common/Altcoins/BTCPayNetworkProvider.Dash.cs index 789005e98..d293c0f4a 100644 --- a/BTCPayServer.Common/Altcoins/BTCPayNetworkProvider.Dash.cs +++ b/BTCPayServer.Common/Altcoins/BTCPayNetworkProvider.Dash.cs @@ -1,4 +1,4 @@ -using NBitcoin; +using NBitcoin; namespace BTCPayServer { diff --git a/BTCPayServer.Common/Altcoins/BTCPayNetworkProvider.Dogecoin.cs b/BTCPayServer.Common/Altcoins/BTCPayNetworkProvider.Dogecoin.cs index 66483bfab..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 7b2a27f8d..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 f69ceb4c2..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 3b7458f67..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 0e5b45158..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 94a37694f..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 11bfa5ec6..6456d6cfd 100644 --- a/BTCPayServer.Common/Altcoins/BTCPayNetworkProvider.cs +++ b/BTCPayServer.Common/Altcoins/BTCPayNetworkProvider.cs @@ -1,8 +1,6 @@ -using System; +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 97eb44da8..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/Altcoins/Liquid/BTCPayNetworkProvider.LiquidAssets.cs b/BTCPayServer.Common/Altcoins/Liquid/BTCPayNetworkProvider.LiquidAssets.cs index dc20f4bd7..a14c49c2b 100644 --- a/BTCPayServer.Common/Altcoins/Liquid/BTCPayNetworkProvider.LiquidAssets.cs +++ b/BTCPayServer.Common/Altcoins/Liquid/BTCPayNetworkProvider.LiquidAssets.cs @@ -1,4 +1,4 @@ -using NBitcoin; +using NBitcoin; namespace BTCPayServer { diff --git a/BTCPayServer.Common/BTCPayNetwork.cs b/BTCPayServer.Common/BTCPayNetwork.cs index 658d1deca..155649991 100644 --- a/BTCPayServer.Common/BTCPayNetwork.cs +++ b/BTCPayServer.Common/BTCPayNetwork.cs @@ -1,12 +1,10 @@ -using System; -using System.Collections; +using System; 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 cfa09a52a..8117663f1 100644 --- a/BTCPayServer.Common/CustomThreadPool.cs +++ b/BTCPayServer.Common/CustomThreadPool.cs @@ -1,6 +1,5 @@ -using System; +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 6fd3b0025..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 5c7404b74..def1a79f4 100644 --- a/BTCPayServer.Common/Logging/ConsoleLogger.cs +++ b/BTCPayServer.Common/Logging/ConsoleLogger.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Concurrent; using System.Runtime.InteropServices; using System.Text; @@ -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 0ce737f52..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 System; 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 edd06e3ff..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; 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 90eb42b5a..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 b81f373f9..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 c6681b089..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 System; 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/ApplicationDbContext.cs b/BTCPayServer.Data/Data/ApplicationDbContext.cs index c8c11e437..1de87caa7 100644 --- a/BTCPayServer.Data/Data/ApplicationDbContext.cs +++ b/BTCPayServer.Data/Data/ApplicationDbContext.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Linq; using Microsoft.AspNetCore.Identity.EntityFrameworkCore; using Microsoft.EntityFrameworkCore; diff --git a/BTCPayServer.Data/Data/ApplicationDbContextFactory.cs b/BTCPayServer.Data/Data/ApplicationDbContextFactory.cs index af6b251e8..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 System; 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 0f9aabb8d..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 69a88b4f6..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 System; 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 826ce7580..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; 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/OffchainTransactionData.cs b/BTCPayServer.Data/Data/OffchainTransactionData.cs index 18e63d071..17a17eb9d 100644 --- a/BTCPayServer.Data/Data/OffchainTransactionData.cs +++ b/BTCPayServer.Data/Data/OffchainTransactionData.cs @@ -1,4 +1,4 @@ -using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations; namespace BTCPayServer.Data { diff --git a/BTCPayServer.Data/Data/PairedSINData.cs b/BTCPayServer.Data/Data/PairedSINData.cs index 7ed062922..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 System; using Microsoft.EntityFrameworkCore; namespace BTCPayServer.Data diff --git a/BTCPayServer.Data/Data/PairingCodeData.cs b/BTCPayServer.Data/Data/PairingCodeData.cs index 36df41022..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 System; using Microsoft.EntityFrameworkCore; namespace BTCPayServer.Data diff --git a/BTCPayServer.Data/Data/PayjoinLock.cs b/BTCPayServer.Data/Data/PayjoinLock.cs index dd8f11588..65bc9fb85 100644 --- a/BTCPayServer.Data/Data/PayjoinLock.cs +++ b/BTCPayServer.Data/Data/PayjoinLock.cs @@ -1,4 +1,4 @@ -using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations; 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 8052120d6..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; 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 3b65cf1fe..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/PlannedTransaction.cs b/BTCPayServer.Data/Data/PlannedTransaction.cs index f658df60c..54d8848c6 100644 --- a/BTCPayServer.Data/Data/PlannedTransaction.cs +++ b/BTCPayServer.Data/Data/PlannedTransaction.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.ComponentModel.DataAnnotations; namespace BTCPayServer.Data diff --git a/BTCPayServer.Data/Data/PullPaymentData.cs b/BTCPayServer.Data/Data/PullPaymentData.cs index 89dc0b1dd..36c416227 100644 --- a/BTCPayServer.Data/Data/PullPaymentData.cs +++ b/BTCPayServer.Data/Data/PullPaymentData.cs @@ -1,10 +1,8 @@ -using System; +using System; 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 71c6eba1d..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 34e2693ef..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/StoreData.cs b/BTCPayServer.Data/Data/StoreData.cs index 21832ff23..11c7269ba 100644 --- a/BTCPayServer.Data/Data/StoreData.cs +++ b/BTCPayServer.Data/Data/StoreData.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations.Schema; using BTCPayServer.Client.Models; diff --git a/BTCPayServer.Data/Data/StoredFile.cs b/BTCPayServer.Data/Data/StoredFile.cs index 27d3918d9..1281afa15 100644 --- a/BTCPayServer.Data/Data/StoredFile.cs +++ b/BTCPayServer.Data/Data/StoredFile.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.ComponentModel.DataAnnotations.Schema; namespace BTCPayServer.Data 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 8bb2aa10f..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 f0bd1116b..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; +using System.Collections.Generic; namespace BTCPayServer.Data { diff --git a/BTCPayServer.Data/Data/WalletTransactionData.cs b/BTCPayServer.Data/Data/WalletTransactionData.cs index 829c6318a..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 91052fd66..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 System; 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 539d831ab..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 b7bbc1ca8..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 36df44e9b..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 1d128ec65..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 System; 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 c629846f4..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 f4b533443..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 f7a46f305..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 System; 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 e3f6448be..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 113ea550c..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 8baccdeac..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 b3f7d2bb7..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 a88e4862d..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 System; 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 798b3a705..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 System; 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 cc10b408a..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/20180719095626_CanDeleteStores.cs b/BTCPayServer.Data/Migrations/20180719095626_CanDeleteStores.cs index 33620c799..39e9c9235 100644 --- a/BTCPayServer.Data/Migrations/20180719095626_CanDeleteStores.cs +++ b/BTCPayServer.Data/Migrations/20180719095626_CanDeleteStores.cs @@ -1,4 +1,4 @@ -using BTCPayServer.Data; +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 3a6571ab6..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/20190219032533_AppsTagging.cs b/BTCPayServer.Data/Migrations/20190219032533_AppsTagging.cs index 2eb8b0cf2..ecdccd0b9 100644 --- a/BTCPayServer.Data/Migrations/20190219032533_AppsTagging.cs +++ b/BTCPayServer.Data/Migrations/20190219032533_AppsTagging.cs @@ -1,4 +1,4 @@ -using BTCPayServer.Data; +using BTCPayServer.Data; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; diff --git a/BTCPayServer.Data/Migrations/20190225091644_AddOpenIddict.cs b/BTCPayServer.Data/Migrations/20190225091644_AddOpenIddict.cs index 2e75a3523..dfcfe169a 100644 --- a/BTCPayServer.Data/Migrations/20190225091644_AddOpenIddict.cs +++ b/BTCPayServer.Data/Migrations/20190225091644_AddOpenIddict.cs @@ -1,4 +1,4 @@ -using System; +using System; using BTCPayServer.Data; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; diff --git a/BTCPayServer.Data/Migrations/20190324141717_AddFiles.cs b/BTCPayServer.Data/Migrations/20190324141717_AddFiles.cs index ebc973bd5..582510a06 100644 --- a/BTCPayServer.Data/Migrations/20190324141717_AddFiles.cs +++ b/BTCPayServer.Data/Migrations/20190324141717_AddFiles.cs @@ -1,4 +1,4 @@ -using System; +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 9579b8c9e..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/20190701082105_sort_paymentrequests.cs b/BTCPayServer.Data/Migrations/20190701082105_sort_paymentrequests.cs index 468ceb2e4..8512fbd3b 100644 --- a/BTCPayServer.Data/Migrations/20190701082105_sort_paymentrequests.cs +++ b/BTCPayServer.Data/Migrations/20190701082105_sort_paymentrequests.cs @@ -1,4 +1,4 @@ -using System; +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 df2238d22..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/Migrations/20200110064617_OpenIddictUpdate.cs b/BTCPayServer.Data/Migrations/20200110064617_OpenIddictUpdate.cs index 732756590..6b916efdd 100644 --- a/BTCPayServer.Data/Migrations/20200110064617_OpenIddictUpdate.cs +++ b/BTCPayServer.Data/Migrations/20200110064617_OpenIddictUpdate.cs @@ -1,4 +1,4 @@ -using System; +using System; using BTCPayServer.Data; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; diff --git a/BTCPayServer.Data/Migrations/20200119130108_ExtendApiKeys.cs b/BTCPayServer.Data/Migrations/20200119130108_ExtendApiKeys.cs index 9eeb5b83c..56bfe8629 100644 --- a/BTCPayServer.Data/Migrations/20200119130108_ExtendApiKeys.cs +++ b/BTCPayServer.Data/Migrations/20200119130108_ExtendApiKeys.cs @@ -1,4 +1,4 @@ -using BTCPayServer.Data; +using BTCPayServer.Data; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; diff --git a/BTCPayServer.Data/Migrations/20200224134444_Remove_OpenIddict.cs b/BTCPayServer.Data/Migrations/20200224134444_Remove_OpenIddict.cs index d356af760..2626f9da3 100644 --- a/BTCPayServer.Data/Migrations/20200224134444_Remove_OpenIddict.cs +++ b/BTCPayServer.Data/Migrations/20200224134444_Remove_OpenIddict.cs @@ -1,4 +1,4 @@ -using System; +using System; using BTCPayServer.Data; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; diff --git a/BTCPayServer.Data/Migrations/20200225133433_AddApiKeyLabel.cs b/BTCPayServer.Data/Migrations/20200225133433_AddApiKeyLabel.cs index 100e6e344..e5f6fc6ac 100644 --- a/BTCPayServer.Data/Migrations/20200225133433_AddApiKeyLabel.cs +++ b/BTCPayServer.Data/Migrations/20200225133433_AddApiKeyLabel.cs @@ -1,4 +1,4 @@ -using BTCPayServer.Data; +using BTCPayServer.Data; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; diff --git a/BTCPayServer.Data/Migrations/20200402065615_AddApiKeyBlob.cs b/BTCPayServer.Data/Migrations/20200402065615_AddApiKeyBlob.cs index 5b901f003..4787e8fc6 100644 --- a/BTCPayServer.Data/Migrations/20200402065615_AddApiKeyBlob.cs +++ b/BTCPayServer.Data/Migrations/20200402065615_AddApiKeyBlob.cs @@ -1,4 +1,4 @@ -using BTCPayServer.Data; +using BTCPayServer.Data; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; diff --git a/BTCPayServer.Data/Migrations/20200413052418_PlannedTransactions.cs b/BTCPayServer.Data/Migrations/20200413052418_PlannedTransactions.cs index 56419b9fc..88c39db7f 100644 --- a/BTCPayServer.Data/Migrations/20200413052418_PlannedTransactions.cs +++ b/BTCPayServer.Data/Migrations/20200413052418_PlannedTransactions.cs @@ -1,4 +1,4 @@ -using System; +using System; using BTCPayServer.Data; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; diff --git a/BTCPayServer.Data/Migrations/20200507092343_AddArchivedToInvoice.cs b/BTCPayServer.Data/Migrations/20200507092343_AddArchivedToInvoice.cs index 96946ce83..f514cb18f 100644 --- a/BTCPayServer.Data/Migrations/20200507092343_AddArchivedToInvoice.cs +++ b/BTCPayServer.Data/Migrations/20200507092343_AddArchivedToInvoice.cs @@ -1,4 +1,4 @@ -using BTCPayServer.Data; +using BTCPayServer.Data; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; diff --git a/BTCPayServer.Data/Migrations/20200625064111_refundnotificationpullpayments.cs b/BTCPayServer.Data/Migrations/20200625064111_refundnotificationpullpayments.cs index 3f05b8227..1a3f68f32 100644 --- a/BTCPayServer.Data/Migrations/20200625064111_refundnotificationpullpayments.cs +++ b/BTCPayServer.Data/Migrations/20200625064111_refundnotificationpullpayments.cs @@ -1,4 +1,4 @@ -using System; +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 fb354dc85..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 e2250240a..5dc85a06e 100644 --- a/BTCPayServer.Rating/CurrencyNameTable.cs +++ b/BTCPayServer.Rating/CurrencyNameTable.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Globalization; using System.IO; @@ -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/CurrencyPair.cs b/BTCPayServer.Rating/CurrencyPair.cs index 0e579c6d1..2b474ea66 100644 --- a/BTCPayServer.Rating/CurrencyPair.cs +++ b/BTCPayServer.Rating/CurrencyPair.cs @@ -1,4 +1,4 @@ -using System; +using System; using BTCPayServer.Services.Rates; namespace BTCPayServer.Rating diff --git a/BTCPayServer.Rating/ExchangeRates.cs b/BTCPayServer.Rating/ExchangeRates.cs index 2a249896e..78300cfce 100644 --- a/BTCPayServer.Rating/ExchangeRates.cs +++ b/BTCPayServer.Rating/ExchangeRates.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections; using System.Collections.Generic; using System.Globalization; @@ -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 5c9271b9d..5a2bd6584 100644 --- a/BTCPayServer.Rating/MultiValueDictionary.cs +++ b/BTCPayServer.Rating/MultiValueDictionary.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft. All rights reserved. +// Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. // From https://github.com/dotnet/corefxlab/blob/master/src/System.Collections.Generic.MultiValueDictionary/System/Collections/Generic/MultiValueDictionary.cs using System; @@ -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 1cd614085..1dad04258 100644 --- a/BTCPayServer.Rating/Providers/BackgroundFetcherRateProvider.cs +++ b/BTCPayServer.Rating/Providers/BackgroundFetcherRateProvider.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Globalization; using System.Linq; @@ -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 d38df23ce..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 4785cc517..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; 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 7956f392b..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 8f5e0a1ea..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 6fe4c212d..bad5974e8 100644 --- a/BTCPayServer.Rating/Providers/ExchangeSharpRateProvider.cs +++ b/BTCPayServer.Rating/Providers/ExchangeSharpRateProvider.cs @@ -1,9 +1,7 @@ -using System; +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 f3b449cc8..c26772d7e 100644 --- a/BTCPayServer.Rating/Providers/FallbackRateProvider.cs +++ b/BTCPayServer.Rating/Providers/FallbackRateProvider.cs @@ -1,6 +1,5 @@ -using System; +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 53d6e6b6b..16584b0db 100644 --- a/BTCPayServer.Rating/Providers/HttpClientRequestMaker.cs +++ b/BTCPayServer.Rating/Providers/HttpClientRequestMaker.cs @@ -1,13 +1,10 @@ -using System; +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 d1fece419..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 7bba26c06..1e033d3bd 100644 --- a/BTCPayServer.Rating/Providers/KrakenExchangeRateProvider.cs +++ b/BTCPayServer.Rating/Providers/KrakenExchangeRateProvider.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; @@ -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 1569cb968..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; 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 b4f55e69b..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 9a3890b2f..9dec2bac1 100644 --- a/BTCPayServer.Rating/RateRules.cs +++ b/BTCPayServer.Rating/RateRules.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Globalization; using System.Linq; @@ -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 770b28d90..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; 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 b82a8d48b..c2c44999d 100644 --- a/BTCPayServer.Rating/Services/RateProviderFactory.cs +++ b/BTCPayServer.Rating/Services/RateProviderFactory.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Net.Http; @@ -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 f26cb393c..43e085570 100644 --- a/BTCPayServer.Tests/BTCPayServerTester.cs +++ b/BTCPayServer.Tests/BTCPayServerTester.cs @@ -1,24 +1,16 @@ -using System; +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 de4b0ff95..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 e70afce26..02867faff 100644 --- a/BTCPayServer.Tests/CustomerHttpServer.cs +++ b/BTCPayServer.Tests/CustomerHttpServer.cs @@ -1,15 +1,12 @@ -using System; -using System.Collections.Generic; +using System; 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 14eb03a7b..4976f59e6 100644 --- a/BTCPayServer.Tests/Extensions.cs +++ b/BTCPayServer.Tests/Extensions.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Text; using System.Threading; using System.Threading.Tasks; @@ -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 506d7011f..44062c07d 100644 --- a/BTCPayServer.Tests/FakeServer.cs +++ b/BTCPayServer.Tests/FakeServer.cs @@ -1,8 +1,5 @@ -using System; -using System.Collections.Generic; +using System; 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 b371f9ff0..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 System; 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 095806887..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 System; 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 317905e96..679eabbc4 100644 --- a/BTCPayServer.Tests/MockDelay.cs +++ b/BTCPayServer.Tests/MockDelay.cs @@ -1,8 +1,7 @@ -using System; +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 edf23cf61..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 a21de8ab5..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 System; 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 f1349fb12..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 9250c7569..a05bc8c13 100644 --- a/BTCPayServer.Tests/ProcessLauncher.cs +++ b/BTCPayServer.Tests/ProcessLauncher.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; @@ -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/RateRulesTest.cs b/BTCPayServer.Tests/RateRulesTest.cs index cc05c7688..c9c13f2f8 100644 --- a/BTCPayServer.Tests/RateRulesTest.cs +++ b/BTCPayServer.Tests/RateRulesTest.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Globalization; using System.Linq; 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 1841d5581..da5e8e335 100644 --- a/BTCPayServer.Tests/SeleniumTests.cs +++ b/BTCPayServer.Tests/SeleniumTests.cs @@ -1,27 +1,18 @@ -using System; +using System; using System.Globalization; 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 ed5cb1ede..9cb775455 100644 --- a/BTCPayServer.Tests/ServerTester.cs +++ b/BTCPayServer.Tests/ServerTester.cs @@ -1,29 +1,18 @@ -using System; +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 242962f3e..6cfc58431 100644 --- a/BTCPayServer.Tests/TestAccount.cs +++ b/BTCPayServer.Tests/TestAccount.cs @@ -1,10 +1,8 @@ -using System; -using System.Collections.Generic; +using System; 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 077beee01..82466e84d 100644 --- a/BTCPayServer.Tests/TestUtils.cs +++ b/BTCPayServer.Tests/TestUtils.cs @@ -1,9 +1,7 @@ -using System; -using System.Collections.Generic; +using System; 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 7b4714453..e83befab1 100644 --- a/BTCPayServer.Tests/UnitTest1.cs +++ b/BTCPayServer.Tests/UnitTest1.cs @@ -1,6 +1,5 @@ -using System; +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 fb941a79a..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 d2eb75757..4030e9aa7 100644 --- a/BTCPayServer.Tests/Utils.cs +++ b/BTCPayServer.Tests/Utils.cs @@ -1,9 +1,7 @@ -using System; -using System.Collections.Generic; +using System; 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 0474257fd..8b7376ad8 100644 --- a/BTCPayServer/BitpayHttpException.cs +++ b/BTCPayServer/BitpayHttpException.cs @@ -1,6 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; +using System; namespace BTCPayServer { diff --git a/BTCPayServer/Configuration/BTCPayServerOptions.cs b/BTCPayServer/Configuration/BTCPayServerOptions.cs index 0f6da84cd..b596bb90d 100644 --- a/BTCPayServer/Configuration/BTCPayServerOptions.cs +++ b/BTCPayServer/Configuration/BTCPayServerOptions.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.IO; using System.Linq; diff --git a/BTCPayServer/Configuration/ConfigException.cs b/BTCPayServer/Configuration/ConfigException.cs index 3a3869727..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; +using System; namespace BTCPayServer.Configuration { diff --git a/BTCPayServer/Configuration/ConfigurationExtensions.cs b/BTCPayServer/Configuration/ConfigurationExtensions.cs index c3750196a..ec91e7e4f 100644 --- a/BTCPayServer/Configuration/ConfigurationExtensions.cs +++ b/BTCPayServer/Configuration/ConfigurationExtensions.cs @@ -1,11 +1,8 @@ -using System; -using System.Collections.Generic; +using System; 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 2aadbcdc6..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 dae46fd72..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; using System.Linq; using System.Threading.Tasks; using BTCPayServer.Controllers; diff --git a/BTCPayServer/Configuration/ExternalService.cs b/BTCPayServer/Configuration/ExternalService.cs index 519dfc630..82e258655 100644 --- a/BTCPayServer/Configuration/ExternalService.cs +++ b/BTCPayServer/Configuration/ExternalService.cs @@ -1,9 +1,7 @@ -using System; +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 293954d21..8259333b8 100644 --- a/BTCPayServer/Controllers/AccessTokenController.cs +++ b/BTCPayServer/Controllers/AccessTokenController.cs @@ -1,16 +1,11 @@ -using System; +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 1357b08b6..668ecbc8b 100644 --- a/BTCPayServer/Controllers/AccountController.cs +++ b/BTCPayServer/Controllers/AccountController.cs @@ -1,8 +1,5 @@ -using System; -using System.Collections.Generic; +using System; 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 16c8288fe..ff20089f5 100644 --- a/BTCPayServer/Controllers/AppsController.Crowdfund.cs +++ b/BTCPayServer/Controllers/AppsController.Crowdfund.cs @@ -1,11 +1,8 @@ -using System; +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.PointOfSale.cs b/BTCPayServer/Controllers/AppsController.PointOfSale.cs index 32b66ce0c..0bd81b043 100644 --- a/BTCPayServer/Controllers/AppsController.PointOfSale.cs +++ b/BTCPayServer/Controllers/AppsController.PointOfSale.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Linq; using System.Text; using System.Text.Encodings.Web; diff --git a/BTCPayServer/Controllers/AppsController.cs b/BTCPayServer/Controllers/AppsController.cs index 81dac5cfb..45496f7ee 100644 --- a/BTCPayServer/Controllers/AppsController.cs +++ b/BTCPayServer/Controllers/AppsController.cs @@ -1,5 +1,4 @@ -using System; -using System.Collections.Generic; +using System; 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 ce2a4da0d..7da71f701 100644 --- a/BTCPayServer/Controllers/AppsPublicController.cs +++ b/BTCPayServer/Controllers/AppsPublicController.cs @@ -1,8 +1,7 @@ -using System; +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 efab2f7cf..b41232480 100644 --- a/BTCPayServer/Controllers/ErrorController.cs +++ b/BTCPayServer/Controllers/ErrorController.cs @@ -1,8 +1,5 @@ -using System; -using System.Collections.Generic; +using System; 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 f16db20eb..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; 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 e8ca3830f..29a2e65b7 100644 --- a/BTCPayServer/Controllers/HomeController.cs +++ b/BTCPayServer/Controllers/HomeController.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Diagnostics; using System.IO; using System.Linq; @@ -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 64a6f606e..52beaa07f 100644 --- a/BTCPayServer/Controllers/InvoiceController.API.cs +++ b/BTCPayServer/Controllers/InvoiceController.API.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Linq; using System.Threading; using System.Threading.Tasks; @@ -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 06cf0a5bd..211707ff9 100644 --- a/BTCPayServer/Controllers/InvoiceController.UI.cs +++ b/BTCPayServer/Controllers/InvoiceController.UI.cs @@ -1,6 +1,5 @@ -using System; +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 1c9f560e3..b8477fc63 100644 --- a/BTCPayServer/Controllers/InvoiceController.cs +++ b/BTCPayServer/Controllers/InvoiceController.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; @@ -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 097ad166a..06eed35ea 100644 --- a/BTCPayServer/Controllers/Macaroons.cs +++ b/BTCPayServer/Controllers/Macaroons.cs @@ -1,7 +1,5 @@ -using System; -using System.Collections.Generic; +using System; 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 83f3f134d..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; 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/NotificationsController.cs b/BTCPayServer/Controllers/NotificationsController.cs index 371d4e70b..4a664d9e9 100644 --- a/BTCPayServer/Controllers/NotificationsController.cs +++ b/BTCPayServer/Controllers/NotificationsController.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Linq; using System.Threading; using System.Threading.Tasks; 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 e9a420667..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; 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 e49abc1f5..4d869a39f 100644 --- a/BTCPayServer/Controllers/PublicLightningNodeInfoController.cs +++ b/BTCPayServer/Controllers/PublicLightningNodeInfoController.cs @@ -1,10 +1,8 @@ -using System; +using System; 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 502625b05..034bb5345 100644 --- a/BTCPayServer/Controllers/PullPaymentController.cs +++ b/BTCPayServer/Controllers/PullPaymentController.cs @@ -1,21 +1,17 @@ -using System; -using System.Collections.Generic; +using System; 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 dd440651f..712193734 100644 --- a/BTCPayServer/Controllers/RateController.cs +++ b/BTCPayServer/Controllers/RateController.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -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 05bc75b91..d8b31afe7 100644 --- a/BTCPayServer/Controllers/ServerController.cs +++ b/BTCPayServer/Controllers/ServerController.cs @@ -1,32 +1,25 @@ -using System; +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 a19b3aca3..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; 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.Changelly.cs b/BTCPayServer/Controllers/StoresController.Changelly.cs index 6c2671643..f95d7fc5c 100644 --- a/BTCPayServer/Controllers/StoresController.Changelly.cs +++ b/BTCPayServer/Controllers/StoresController.Changelly.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Net.Http; using System.Threading.Tasks; using BTCPayServer.Data; diff --git a/BTCPayServer/Controllers/StoresController.CoinSwitch.cs b/BTCPayServer/Controllers/StoresController.CoinSwitch.cs index 4365a4511..9ba03b702 100644 --- a/BTCPayServer/Controllers/StoresController.CoinSwitch.cs +++ b/BTCPayServer/Controllers/StoresController.CoinSwitch.cs @@ -1,4 +1,4 @@ -using System.Threading.Tasks; +using System.Threading.Tasks; using BTCPayServer.Data; using BTCPayServer.Models.StoreViewModels; using BTCPayServer.Payments.CoinSwitch; diff --git a/BTCPayServer/Controllers/StoresController.Email.cs b/BTCPayServer/Controllers/StoresController.Email.cs index 1a8d2ae0e..600c74db9 100644 --- a/BTCPayServer/Controllers/StoresController.Email.cs +++ b/BTCPayServer/Controllers/StoresController.Email.cs @@ -1,10 +1,8 @@ -using System; +using System; 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 43cea0a7c..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; 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 f7d3e53ce..a55965bb5 100644 --- a/BTCPayServer/Controllers/StoresController.cs +++ b/BTCPayServer/Controllers/StoresController.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Globalization; using System.Linq; @@ -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 c775f856d..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 2054fb50f..677a1359c 100644 --- a/BTCPayServer/Controllers/VaultController.cs +++ b/BTCPayServer/Controllers/VaultController.cs @@ -1,27 +1,18 @@ -using System; +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 d3e86bf29..3f48ea373 100644 --- a/BTCPayServer/Controllers/WalletsController.PSBT.cs +++ b/BTCPayServer/Controllers/WalletsController.PSBT.cs @@ -1,8 +1,6 @@ -using System; +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 c0fc336a4..040618817 100644 --- a/BTCPayServer/Controllers/WalletsController.PullPayments.cs +++ b/BTCPayServer/Controllers/WalletsController.PullPayments.cs @@ -1,13 +1,9 @@ -using System; +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 9f593f2e3..29f877821 100644 --- a/BTCPayServer/Controllers/WalletsController.cs +++ b/BTCPayServer/Controllers/WalletsController.cs @@ -1,9 +1,7 @@ -using System; +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 9d2a31f1f..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 a9f1ce5ca..bfbbd86de 100644 --- a/BTCPayServer/CurrencyValue.cs +++ b/BTCPayServer/CurrencyValue.cs @@ -1,16 +1,13 @@ -using System; -using System.Collections.Generic; +using System; 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 07a42c899..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 System; using BTCPayServer.Payments; namespace BTCPayServer.Data diff --git a/BTCPayServer/Data/HistoricalAddressInvoiceDataExtensions.cs b/BTCPayServer/Data/HistoricalAddressInvoiceDataExtensions.cs index bd43aa832..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; +using System; namespace BTCPayServer.Data { diff --git a/BTCPayServer/Data/InvoiceDataExtensions.cs b/BTCPayServer/Data/InvoiceDataExtensions.cs index 5ed69fb80..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 46bc10189..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/PaymentRequestDataExtensions.cs b/BTCPayServer/Data/PaymentRequestDataExtensions.cs index e88e535fc..daf648ea0 100644 --- a/BTCPayServer/Data/PaymentRequestDataExtensions.cs +++ b/BTCPayServer/Data/PaymentRequestDataExtensions.cs @@ -1,4 +1,4 @@ -using BTCPayServer.Client.Models; +using BTCPayServer.Client.Models; using NBXplorer; using Newtonsoft.Json.Linq; diff --git a/BTCPayServer/Data/PullPaymentsExtensions.cs b/BTCPayServer/Data/PullPaymentsExtensions.cs index a04c74ad6..3165f3de5 100644 --- a/BTCPayServer/Data/PullPaymentsExtensions.cs +++ b/BTCPayServer/Data/PullPaymentsExtensions.cs @@ -1,20 +1,14 @@ -using System; +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/StoreBlob.cs b/BTCPayServer/Data/StoreBlob.cs index 9a933b11b..44d4267c5 100644 --- a/BTCPayServer/Data/StoreBlob.cs +++ b/BTCPayServer/Data/StoreBlob.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; diff --git a/BTCPayServer/Data/StoreDataExtensions.cs b/BTCPayServer/Data/StoreDataExtensions.cs index 50456f183..bcab2867d 100644 --- a/BTCPayServer/Data/StoreDataExtensions.cs +++ b/BTCPayServer/Data/StoreDataExtensions.cs @@ -1,15 +1,10 @@ -using System; +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 8deed331a..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 System; using Newtonsoft.Json; namespace BTCPayServer.Data diff --git a/BTCPayServer/Data/WalletTransactionDataExtensions.cs b/BTCPayServer/Data/WalletTransactionDataExtensions.cs index 41d7b233c..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 System; using Newtonsoft.Json; using Newtonsoft.Json.Linq; diff --git a/BTCPayServer/DerivationSchemeParser.cs b/BTCPayServer/DerivationSchemeParser.cs index caabee53a..53a19b0af 100644 --- a/BTCPayServer/DerivationSchemeParser.cs +++ b/BTCPayServer/DerivationSchemeParser.cs @@ -1,11 +1,7 @@ -using System; +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 5c1e31df9..10b8e6461 100644 --- a/BTCPayServer/DerivationSchemeSettings.cs +++ b/BTCPayServer/DerivationSchemeSettings.cs @@ -1,8 +1,6 @@ -using System; +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 036867614..23232402f 100644 --- a/BTCPayServer/EventAggregator.cs +++ b/BTCPayServer/EventAggregator.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Threading; @@ -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 3ef12e6a0..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 901345e00..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; +using System; namespace BTCPayServer.Events { diff --git a/BTCPayServer/Events/InvoiceNewAddressEvent.cs b/BTCPayServer/Events/InvoiceNewAddressEvent.cs index 5c7c68153..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 9a26a6928..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 62d7ba8c4..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 f97ac5f9d..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 b90df232d..ac5db3540 100644 --- a/BTCPayServer/ExplorerClientProvider.cs +++ b/BTCPayServer/ExplorerClientProvider.cs @@ -1,8 +1,7 @@ -using System; +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 33b23a03e..dab1efc7f 100644 --- a/BTCPayServer/Extensions.cs +++ b/BTCPayServer/Extensions.cs @@ -1,45 +1,33 @@ -using System; +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 8850f885a..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; using System.Threading; using System.Threading.Tasks; using BTCPayServer.SSH; diff --git a/BTCPayServer/Extensions/ServiceCollectionExtensions.cs b/BTCPayServer/Extensions/ServiceCollectionExtensions.cs index 3f681a011..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/UrlHelperExtensions.cs b/BTCPayServer/Extensions/UrlHelperExtensions.cs index 92e2e3fe4..847ed1c07 100644 --- a/BTCPayServer/Extensions/UrlHelperExtensions.cs +++ b/BTCPayServer/Extensions/UrlHelperExtensions.cs @@ -1,4 +1,4 @@ - + using BTCPayServer.Controllers; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Routing; diff --git a/BTCPayServer/Extensions/WebHostExtensions.cs b/BTCPayServer/Extensions/WebHostExtensions.cs index f2d20cd05..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 45839d17e..1d5f7e576 100644 --- a/BTCPayServer/Filters/ContentSecurityPolicyAttribute.cs +++ b/BTCPayServer/Filters/ContentSecurityPolicyAttribute.cs @@ -1,7 +1,5 @@ -using System; -using System.Collections.Generic; +using System; 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 9d83ef633..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; using System.Threading.Tasks; using BTCPayServer.Configuration; using Microsoft.AspNetCore.Mvc; diff --git a/BTCPayServer/Filters/OnlyMediaTypeAttribute.cs b/BTCPayServer/Filters/OnlyMediaTypeAttribute.cs index fb4e7e03c..07794b43c 100644 --- a/BTCPayServer/Filters/OnlyMediaTypeAttribute.cs +++ b/BTCPayServer/Filters/OnlyMediaTypeAttribute.cs @@ -1,9 +1,6 @@ -using System; -using System.Collections.Generic; +using System; 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 829a68dc8..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 System; using Microsoft.AspNetCore.Mvc.Filters; namespace BTCPayServer.Filters diff --git a/BTCPayServer/Filters/XContentTypeOptionsAttribute.cs b/BTCPayServer/Filters/XContentTypeOptionsAttribute.cs index 4f29bcd53..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 System; using Microsoft.AspNetCore.Mvc.Filters; namespace BTCPayServer.Filters diff --git a/BTCPayServer/Filters/XFrameOptionsAttribute.cs b/BTCPayServer/Filters/XFrameOptionsAttribute.cs index d037ee7e8..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 System; using Microsoft.AspNetCore.Mvc.Filters; namespace BTCPayServer.Filters diff --git a/BTCPayServer/Filters/XXSSProtectionAttribute.cs b/BTCPayServer/Filters/XXSSProtectionAttribute.cs index 4979322a0..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 System; using Microsoft.AspNetCore.Mvc.Filters; namespace BTCPayServer.Filters diff --git a/BTCPayServer/HostedServices/BackgroundJobSchedulerHostedService.cs b/BTCPayServer/HostedServices/BackgroundJobSchedulerHostedService.cs index 4e28ab518..4c836e038 100644 --- a/BTCPayServer/HostedServices/BackgroundJobSchedulerHostedService.cs +++ b/BTCPayServer/HostedServices/BackgroundJobSchedulerHostedService.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Threading; @@ -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 29b4c58fd..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; 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 fe9bfa937..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; 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 1a36eac45..fc9a0fbc1 100644 --- a/BTCPayServer/HostedServices/CssThemeManager.cs +++ b/BTCPayServer/HostedServices/CssThemeManager.cs @@ -1,19 +1,10 @@ -using System; -using System.Collections.Concurrent; +using System; 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 a7363dc06..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; 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 06d8e0488..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; 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 a6307f492..d878a3211 100644 --- a/BTCPayServer/HostedServices/EventHostedServiceBase.cs +++ b/BTCPayServer/HostedServices/EventHostedServiceBase.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Threading; using System.Threading.Channels; @@ -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 81210516f..83133f511 100644 --- a/BTCPayServer/HostedServices/InvoiceNotificationManager.cs +++ b/BTCPayServer/HostedServices/InvoiceNotificationManager.cs @@ -1,9 +1,7 @@ -using System; -using System.Collections.Concurrent; +using System; 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 cf2c40d49..c3a94114b 100644 --- a/BTCPayServer/HostedServices/InvoiceWatcher.cs +++ b/BTCPayServer/HostedServices/InvoiceWatcher.cs @@ -1,5 +1,4 @@ -using System; -using System.Collections.Concurrent; +using System; 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 87279f802..cb93b187b 100644 --- a/BTCPayServer/HostedServices/NBXplorerWaiter.cs +++ b/BTCPayServer/HostedServices/NBXplorerWaiter.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; @@ -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 72ac9b337..e268dd3c4 100644 --- a/BTCPayServer/HostedServices/PullPaymentHostedService.cs +++ b/BTCPayServer/HostedServices/PullPaymentHostedService.cs @@ -1,7 +1,6 @@ -using System; +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 520971218..2b389ab2d 100644 --- a/BTCPayServer/HostedServices/RatesHostedService.cs +++ b/BTCPayServer/HostedServices/RatesHostedService.cs @@ -1,15 +1,11 @@ -using System; +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 e86950d2d..0ab2b70a2 100644 --- a/BTCPayServer/HostedServices/Socks5HttpProxyServer.cs +++ b/BTCPayServer/HostedServices/Socks5HttpProxyServer.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Buffers; using System.IO.Pipelines; using System.Net; @@ -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 4acade425..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; 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 61c826261..99bed5819 100644 --- a/BTCPayServer/Hosting/BTCPayServerServices.cs +++ b/BTCPayServer/Hosting/BTCPayServerServices.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.IO; using System.Threading; using BTCPayServer.Configuration; @@ -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 6b40de569..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; 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 382e3afc9..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; 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 708852b27..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 b786dd80b..a20b7011c 100644 --- a/BTCPayServer/Hosting/MigrationStartupTask.cs +++ b/BTCPayServer/Hosting/MigrationStartupTask.cs @@ -1,5 +1,4 @@ -using System; -using System.Collections.Generic; +using System; 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 50a4520c3..cee213e96 100644 --- a/BTCPayServer/Hosting/ResourceBundleProvider.cs +++ b/BTCPayServer/Hosting/ResourceBundleProvider.cs @@ -1,21 +1,19 @@ -using System; +using System; using System.Collections.Generic; 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 de8529859..ec7765212 100644 --- a/BTCPayServer/Hosting/Startup.cs +++ b/BTCPayServer/Hosting/Startup.cs @@ -1,12 +1,10 @@ -using System; +using System; using System.IO; 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 f06713ae7..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 e5aca5425..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; using System.Threading; using System.Threading.Tasks; diff --git a/BTCPayServer/JsonConverters/CurrencyPairJsonConverter.cs b/BTCPayServer/JsonConverters/CurrencyPairJsonConverter.cs index 2ac5e7f20..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; 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 b36218e62..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; 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 6aa434a50..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; 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 b9ba8a690..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 System; 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 a1e0bbb83..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; 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 ee9f8946c..da72ada20 100644 --- a/BTCPayServer/Logging/InvoiceLog.cs +++ b/BTCPayServer/Logging/InvoiceLog.cs @@ -1,7 +1,6 @@ -using System; +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 67f3ec7ab..6a3544b15 100644 --- a/BTCPayServer/ModelBinders/DerivationSchemeModelBinder.cs +++ b/BTCPayServer/ModelBinders/DerivationSchemeModelBinder.cs @@ -1,8 +1,7 @@ -using System; +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 1a95de163..f9c10ef96 100644 --- a/BTCPayServer/ModelBinders/InvariantDecimalModelBinder.cs +++ b/BTCPayServer/ModelBinders/InvariantDecimalModelBinder.cs @@ -1,11 +1,9 @@ -// Copied and adjusted from https://github.com/aspnet/Mvc/blob/master/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Binders/DecimalModelBinder.cs +// Copied and adjusted from https://github.com/aspnet/Mvc/blob/master/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Binders/DecimalModelBinder.cs using System; 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 f5e3b8fab..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 1711abe54..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 c2f9a48f6..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 fa12b7370..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 c462c2d3c..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 4c20017bc..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 c49e45980..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 5f2643dfc..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 83ce70ff5..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; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using BTCPayServer.Services.Apps; diff --git a/BTCPayServer/Models/AppViewModels/UpdatePointOfSaleViewModel.cs b/BTCPayServer/Models/AppViewModels/UpdatePointOfSaleViewModel.cs index bd16d3713..614bb8a3b 100644 --- a/BTCPayServer/Models/AppViewModels/UpdatePointOfSaleViewModel.cs +++ b/BTCPayServer/Models/AppViewModels/UpdatePointOfSaleViewModel.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using BTCPayServer.Services.Apps; using BTCPayServer.Validation; diff --git a/BTCPayServer/Models/AppViewModels/ViewCrowdfundViewModel.cs b/BTCPayServer/Models/AppViewModels/ViewCrowdfundViewModel.cs index 47a669f8d..545e8dc90 100644 --- a/BTCPayServer/Models/AppViewModels/ViewCrowdfundViewModel.cs +++ b/BTCPayServer/Models/AppViewModels/ViewCrowdfundViewModel.cs @@ -1,8 +1,7 @@ -using System; +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/Authorization/AuthorizeViewModel.cs b/BTCPayServer/Models/Authorization/AuthorizeViewModel.cs index 1bbae52bb..26ebfc0b5 100644 --- a/BTCPayServer/Models/Authorization/AuthorizeViewModel.cs +++ b/BTCPayServer/Models/Authorization/AuthorizeViewModel.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using Microsoft.AspNetCore.Mvc.ModelBinding; diff --git a/BTCPayServer/Models/BitpayErrorsModel.cs b/BTCPayServer/Models/BitpayErrorsModel.cs index 5ed6186b8..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 21c3f2a12..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 65caf78f1..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 0c4bbac70..74a0b20e4 100644 --- a/BTCPayServer/Models/CreateInvoiceRequest.cs +++ b/BTCPayServer/Models/CreateInvoiceRequest.cs @@ -1,12 +1,7 @@ -using System; +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 695404451..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 ecaa859f5..382c8dfb9 100644 --- a/BTCPayServer/Models/GetTokensResponse.cs +++ b/BTCPayServer/Models/GetTokensResponse.cs @@ -1,13 +1,10 @@ -using System; -using System.Collections.Generic; +using System; 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 6afb0369f..d28a2e088 100644 --- a/BTCPayServer/Models/InvoiceResponse.cs +++ b/BTCPayServer/Models/InvoiceResponse.cs @@ -1,7 +1,5 @@ -using System; +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 5c2f38034..3e8d6ad1b 100644 --- a/BTCPayServer/Models/InvoicingModels/CreateInvoiceModel.cs +++ b/BTCPayServer/Models/InvoicingModels/CreateInvoiceModel.cs @@ -1,9 +1,7 @@ -using System; +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 918a15be3..4ba1f46ef 100644 --- a/BTCPayServer/Models/InvoicingModels/InvoiceDetailsModel.cs +++ b/BTCPayServer/Models/InvoicingModels/InvoiceDetailsModel.cs @@ -1,8 +1,5 @@ -using System; +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 f516ec091..ca0404d3f 100644 --- a/BTCPayServer/Models/InvoicingModels/InvoicesModel.cs +++ b/BTCPayServer/Models/InvoicingModels/InvoicesModel.cs @@ -1,7 +1,5 @@ -using System; +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 c4ee8812a..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 e1243b918..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 262fe354b..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 c5f16c558..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 7ace4349f..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 5049c1926..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 10a8ed971..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 5e2b6e235..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 7679bd6ca..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 b81031848..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 e71ea2246..b3cb8671a 100644 --- a/BTCPayServer/Models/NotificationViewModels/IndexViewModel.cs +++ b/BTCPayServer/Models/NotificationViewModels/IndexViewModel.cs @@ -1,13 +1,5 @@ -using System; +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 5eef1611c..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 25b8ac4f6..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 3cd7b1551..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 System; using BTCPayServer.Services; namespace BTCPayServer.Models.ServerViewModels diff --git a/BTCPayServer/Models/ServerViewModels/EmailsViewModel.cs b/BTCPayServer/Models/ServerViewModels/EmailsViewModel.cs index e202d6729..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 f8f1f5a69..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 d484057a6..fe81cad83 100644 --- a/BTCPayServer/Models/ServerViewModels/LndSeedBackupViewModel.cs +++ b/BTCPayServer/Models/ServerViewModels/LndSeedBackupViewModel.cs @@ -1,6 +1,5 @@ -using System; +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/LndServicesViewModel.cs b/BTCPayServer/Models/ServerViewModels/LndServicesViewModel.cs index 3ece5c1b5..6ddcfd8a5 100644 --- a/BTCPayServer/Models/ServerViewModels/LndServicesViewModel.cs +++ b/BTCPayServer/Models/ServerViewModels/LndServicesViewModel.cs @@ -1,4 +1,4 @@ -using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations; namespace BTCPayServer.Models.ServerViewModels { diff --git a/BTCPayServer/Models/ServerViewModels/LogsViewModel.cs b/BTCPayServer/Models/ServerViewModels/LogsViewModel.cs index da39d6646..86daa18e4 100644 --- a/BTCPayServer/Models/ServerViewModels/LogsViewModel.cs +++ b/BTCPayServer/Models/ServerViewModels/LogsViewModel.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.IO; namespace BTCPayServer.Models.ServerViewModels diff --git a/BTCPayServer/Models/ServerViewModels/MaintenanceViewModel.cs b/BTCPayServer/Models/ServerViewModels/MaintenanceViewModel.cs index 2edebd0fd..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 b206d9841..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 7866b4525..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 f399bcf2b..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 64bd2b6aa..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 608fad72b..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; 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 734bd0c98..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 e8b55f76e..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 4163b9b87..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 addc17ef1..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/PayButtonViewModel.cs b/BTCPayServer/Models/StoreViewModels/PayButtonViewModel.cs index 2b81a88f9..963359f98 100644 --- a/BTCPayServer/Models/StoreViewModels/PayButtonViewModel.cs +++ b/BTCPayServer/Models/StoreViewModels/PayButtonViewModel.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using BTCPayServer.ModelBinders; using BTCPayServer.Models.AppViewModels; diff --git a/BTCPayServer/Models/StoreViewModels/RatesViewModel.cs b/BTCPayServer/Models/StoreViewModels/RatesViewModel.cs index aaab8cb9f..fa7bfde21 100644 --- a/BTCPayServer/Models/StoreViewModels/RatesViewModel.cs +++ b/BTCPayServer/Models/StoreViewModels/RatesViewModel.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; diff --git a/BTCPayServer/Models/StoreViewModels/StoreUsersViewModel.cs b/BTCPayServer/Models/StoreViewModels/StoreUsersViewModel.cs index 46df85d8a..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 491c1fe82..c91280e3d 100644 --- a/BTCPayServer/Models/StoreViewModels/StoreViewModel.cs +++ b/BTCPayServer/Models/StoreViewModels/StoreViewModel.cs @@ -1,7 +1,6 @@ -using System.Collections.Generic; +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 44e79bf59..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 44fdf08d6..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 4f4c0eb0c..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 System; using Newtonsoft.Json; using Newtonsoft.Json.Linq; diff --git a/BTCPayServer/Models/ViewPullPaymentModel.cs b/BTCPayServer/Models/ViewPullPaymentModel.cs index e7ae7fe4e..603d8517a 100644 --- a/BTCPayServer/Models/ViewPullPaymentModel.cs +++ b/BTCPayServer/Models/ViewPullPaymentModel.cs @@ -1,10 +1,6 @@ -using System; +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/ListTransactionsViewModel.cs b/BTCPayServer/Models/WalletViewModels/ListTransactionsViewModel.cs index 5c13df8fc..d14788c0a 100644 --- a/BTCPayServer/Models/WalletViewModels/ListTransactionsViewModel.cs +++ b/BTCPayServer/Models/WalletViewModels/ListTransactionsViewModel.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using BTCPayServer.Services.Labels; diff --git a/BTCPayServer/Models/WalletViewModels/ListWalletsViewModel.cs b/BTCPayServer/Models/WalletViewModels/ListWalletsViewModel.cs index 9219a4f4b..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 7a24bbc23..36fc5f130 100644 --- a/BTCPayServer/Models/WalletViewModels/PayoutsModel.cs +++ b/BTCPayServer/Models/WalletViewModels/PayoutsModel.cs @@ -1,7 +1,5 @@ -using System; +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 d967eb47b..723c4411d 100644 --- a/BTCPayServer/Models/WalletViewModels/PullPaymentsModel.cs +++ b/BTCPayServer/Models/WalletViewModels/PullPaymentsModel.cs @@ -1,10 +1,7 @@ -using System; +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 26e855279..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; 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 2b4fc70e8..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 326080960..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 6b856d8a8..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 945e89527..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 fc627d624..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/WalletSendModel.cs b/BTCPayServer/Models/WalletViewModels/WalletSendModel.cs index 7cd21434d..93f24f4f8 100644 --- a/BTCPayServer/Models/WalletViewModels/WalletSendModel.cs +++ b/BTCPayServer/Models/WalletViewModels/WalletSendModel.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using BTCPayServer.Services.Labels; diff --git a/BTCPayServer/Models/WalletViewModels/WalletSendVaultModel.cs b/BTCPayServer/Models/WalletViewModels/WalletSendVaultModel.cs index d07416744..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 8ef89b548..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 422e720ac..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; 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 7d6f2030a..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 System; 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 0218d8b5b..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 ab4c514a8..6f6e470d0 100644 --- a/BTCPayServer/Payments/Bitcoin/NBXplorerListener.cs +++ b/BTCPayServer/Payments/Bitcoin/NBXplorerListener.cs @@ -1,24 +1,19 @@ -using System; +using System; using System.Collections.Concurrent; using System.Collections.Generic; 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 67f12f6e5..946542514 100644 --- a/BTCPayServer/Payments/IPaymentFilter.cs +++ b/BTCPayServer/Payments/IPaymentFilter.cs @@ -1,7 +1,5 @@ -using System; -using System.Collections.Generic; +using System; 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 01d87f040..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/IPaymentMethodHandler.cs b/BTCPayServer/Payments/IPaymentMethodHandler.cs index e621b4729..530f336b7 100644 --- a/BTCPayServer/Payments/IPaymentMethodHandler.cs +++ b/BTCPayServer/Payments/IPaymentMethodHandler.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Threading.Tasks; using BTCPayServer.Data; diff --git a/BTCPayServer/Payments/ISupportedPaymentMethod.cs b/BTCPayServer/Payments/ISupportedPaymentMethod.cs index 9b3adc0cd..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 5cc6894a8..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 3f38e276b..49ac375b8 100644 --- a/BTCPayServer/Payments/Lightning/LightningLikePaymentHandler.cs +++ b/BTCPayServer/Payments/Lightning/LightningLikePaymentHandler.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Globalization; using System.Linq; @@ -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 59e5dfd4e..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 a4e95dc52..ac09e1650 100644 --- a/BTCPayServer/Payments/Lightning/LightningListener.cs +++ b/BTCPayServer/Payments/Lightning/LightningListener.cs @@ -1,8 +1,7 @@ -using System; +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 625666942..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 System; 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 0dd2b9444..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 631ee6350..130bc4307 100644 --- a/BTCPayServer/Payments/PayJoin/PayjoinReceiverContext.cs +++ b/BTCPayServer/Payments/PayJoin/PayjoinReceiverContext.cs @@ -1,12 +1,10 @@ -using System; +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/PaymentMethodExtensions.cs b/BTCPayServer/Payments/PaymentMethodExtensions.cs index be6941012..e8ea891e6 100644 --- a/BTCPayServer/Payments/PaymentMethodExtensions.cs +++ b/BTCPayServer/Payments/PaymentMethodExtensions.cs @@ -1,4 +1,4 @@ -using Newtonsoft.Json; +using Newtonsoft.Json; using Newtonsoft.Json.Linq; namespace BTCPayServer.Payments diff --git a/BTCPayServer/Payments/PaymentMethodId.cs b/BTCPayServer/Payments/PaymentMethodId.cs index d637beb22..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; +using System; namespace BTCPayServer.Payments { diff --git a/BTCPayServer/Payments/PaymentMethodUnavailableException.cs b/BTCPayServer/Payments/PaymentMethodUnavailableException.cs index be609c940..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; +using System; namespace BTCPayServer.Payments { diff --git a/BTCPayServer/Payments/PaymentTypes.Bitcoin.cs b/BTCPayServer/Payments/PaymentTypes.Bitcoin.cs index b74ffaabf..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; 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 6486ea5c7..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 229364865..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 System; 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 a175ecd78..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 bebb40e94..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 8207634b9..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 3798cdf93..45afc180f 100644 --- a/BTCPayServer/SSH/SSHFingerprint.cs +++ b/BTCPayServer/SSH/SSHFingerprint.cs @@ -1,9 +1,6 @@ -using System; -using System.Collections.Generic; +using System; 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 d0b7eab0a..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 b283b3d27..7f94c73f2 100644 --- a/BTCPayServer/SearchString.cs +++ b/BTCPayServer/SearchString.cs @@ -1,15 +1,13 @@ -using System; +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/AuthenticationSchemes.cs b/BTCPayServer/Security/AuthenticationSchemes.cs index 4594f2e09..652d06997 100644 --- a/BTCPayServer/Security/AuthenticationSchemes.cs +++ b/BTCPayServer/Security/AuthenticationSchemes.cs @@ -1,4 +1,4 @@ -namespace BTCPayServer.Security +namespace BTCPayServer.Security { public class AuthenticationSchemes { diff --git a/BTCPayServer/Security/Bitpay/BitToken.cs b/BTCPayServer/Security/Bitpay/BitToken.cs index e14f89810..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 System; using NBitpayClient; namespace BTCPayServer.Security.Bitpay diff --git a/BTCPayServer/Security/Bitpay/BitpayAuthenticationHandler.cs b/BTCPayServer/Security/Bitpay/BitpayAuthenticationHandler.cs index 4b8916372..4890faa81 100644 --- a/BTCPayServer/Security/Bitpay/BitpayAuthenticationHandler.cs +++ b/BTCPayServer/Security/Bitpay/BitpayAuthenticationHandler.cs @@ -1,14 +1,10 @@ -using System; +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 57ff252bb..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 b2e181493..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 1dcc230c9..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 ea8c86f0c..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 eef508a08..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; +using System; namespace BTCPayServer.Security.Bitpay { diff --git a/BTCPayServer/Security/Bitpay/TokenRepository.cs b/BTCPayServer/Security/Bitpay/TokenRepository.cs index d7bc8f62b..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; 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 3756a868e..9a83b15f4 100644 --- a/BTCPayServer/Security/ContentSecurityPolicies.cs +++ b/BTCPayServer/Security/ContentSecurityPolicies.cs @@ -1,8 +1,7 @@ -using System; +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 93a995ae7..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 f6b212558..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 ee531245a..f9079fc37 100644 --- a/BTCPayServer/Security/GreenField/BasicAuthenticationHandler.cs +++ b/BTCPayServer/Security/GreenField/BasicAuthenticationHandler.cs @@ -1,13 +1,11 @@ -using System; +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 3275a2950..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 System; using Microsoft.AspNetCore.Authorization; namespace BTCPayServer.Security diff --git a/BTCPayServer/Security/SecurityExtensions.cs b/BTCPayServer/Security/SecurityExtensions.cs index a3e3bd270..60d288a14 100644 --- a/BTCPayServer/Security/SecurityExtensions.cs +++ b/BTCPayServer/Security/SecurityExtensions.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Linq; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Http; diff --git a/BTCPayServer/Security/ServerPolicies.cs b/BTCPayServer/Security/ServerPolicies.cs index b8431da65..671887422 100644 --- a/BTCPayServer/Security/ServerPolicies.cs +++ b/BTCPayServer/Security/ServerPolicies.cs @@ -1,4 +1,4 @@ -using BTCPayServer.Client; +using BTCPayServer.Client; using Microsoft.AspNetCore.Authorization; namespace BTCPayServer.Security diff --git a/BTCPayServer/Services/Altcoins/Monero/Configuration/MoneroLikeConfiguration.cs b/BTCPayServer/Services/Altcoins/Monero/Configuration/MoneroLikeConfiguration.cs index 3a8b96a9e..3d6a60a35 100644 --- a/BTCPayServer/Services/Altcoins/Monero/Configuration/MoneroLikeConfiguration.cs +++ b/BTCPayServer/Services/Altcoins/Monero/Configuration/MoneroLikeConfiguration.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; namespace BTCPayServer.Services.Altcoins.Monero.Configuration 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 42d08b326..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 ee14548cc..87c4fe239 100644 --- a/BTCPayServer/Services/Apps/AppService.cs +++ b/BTCPayServer/Services/Apps/AppService.cs @@ -1,47 +1,33 @@ -using System; +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 afb5783df..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; +using System; namespace BTCPayServer.Services.Apps { diff --git a/BTCPayServer/Services/BTCPayNetworkJsonSerializerSettings.cs b/BTCPayServer/Services/BTCPayNetworkJsonSerializerSettings.cs index f3219d668..b9d631648 100644 --- a/BTCPayServer/Services/BTCPayNetworkJsonSerializerSettings.cs +++ b/BTCPayServer/Services/BTCPayNetworkJsonSerializerSettings.cs @@ -1,8 +1,6 @@ -using System; +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 5533e93c2..fbd146a55 100644 --- a/BTCPayServer/Services/BTCPayServerEnvironment.cs +++ b/BTCPayServer/Services/BTCPayServerEnvironment.cs @@ -1,21 +1,18 @@ -using System; -using System.Collections.Generic; +using System; 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 be678d38d..4471a0a47 100644 --- a/BTCPayServer/Services/DelayedTransactionBroadcaster.cs +++ b/BTCPayServer/Services/DelayedTransactionBroadcaster.cs @@ -1,15 +1,13 @@ -using System; +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 852af8282..0bad6eaa4 100644 --- a/BTCPayServer/Services/DynamicDnsSettings.cs +++ b/BTCPayServer/Services/DynamicDnsSettings.cs @@ -1,13 +1,11 @@ -using System; +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 7d96e487c..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 84b7b94f9..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 3b2cb5bec..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 6f73862ac..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; 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 24675210d..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; using System.Threading; using System.Threading.Tasks; diff --git a/BTCPayServer/Services/Invoices/Export/CsvSerializer.cs b/BTCPayServer/Services/Invoices/Export/CsvSerializer.cs index e4f7420f0..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; 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 e1f6b7522..4e837d70b 100644 --- a/BTCPayServer/Services/Invoices/Export/InvoiceExport.cs +++ b/BTCPayServer/Services/Invoices/Export/InvoiceExport.cs @@ -1,11 +1,7 @@ -using System; +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 51cd7d838..85fead7a7 100644 --- a/BTCPayServer/Services/Invoices/InvoiceEntity.cs +++ b/BTCPayServer/Services/Invoices/InvoiceEntity.cs @@ -1,9 +1,7 @@ -using System; +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 5f3fb6e92..ee845bb1a 100644 --- a/BTCPayServer/Services/Invoices/PaymentMethodDictionary.cs +++ b/BTCPayServer/Services/Invoices/PaymentMethodDictionary.cs @@ -1,14 +1,13 @@ -using System; +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 a52c689a8..ee5800722 100644 --- a/BTCPayServer/Services/LanguageService.cs +++ b/BTCPayServer/Services/LanguageService.cs @@ -1,8 +1,6 @@ -using System.Collections.Generic; +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 403f61cf7..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; 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 36eeff879..b36160117 100644 --- a/BTCPayServer/Services/LightningConfigurationProvider.cs +++ b/BTCPayServer/Services/LightningConfigurationProvider.cs @@ -1,16 +1,13 @@ -using System; +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 42387a6c6..c158db4d0 100644 --- a/BTCPayServer/Services/Mails/EmailSender.cs +++ b/BTCPayServer/Services/Mails/EmailSender.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Net.Mail; using System.Threading.Tasks; using BTCPayServer.Logging; @@ -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 4f88bdd4b..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 73189f976..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 625886566..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 66d2cc0c0..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; using System.Threading.Tasks; namespace BTCPayServer.Services.Mails diff --git a/BTCPayServer/Services/Mails/StoreEmailSender.cs b/BTCPayServer/Services/Mails/StoreEmailSender.cs index 9c805f52f..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; using System.Threading.Tasks; using BTCPayServer.Data; using BTCPayServer.Services.Stores; diff --git a/BTCPayServer/Services/MigrationSettings.cs b/BTCPayServer/Services/MigrationSettings.cs index 56266662d..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 7758727ad..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 b7af725e9..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 0128174bb..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 System; using BTCPayServer.Models.NotificationViewModels; namespace BTCPayServer.Services.Notifications diff --git a/BTCPayServer/Services/Notifications/NotificationManager.cs b/BTCPayServer/Services/Notifications/NotificationManager.cs index 9383b923e..b3965d524 100644 --- a/BTCPayServer/Services/Notifications/NotificationManager.cs +++ b/BTCPayServer/Services/Notifications/NotificationManager.cs @@ -1,13 +1,10 @@ -using System; +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 d5ef55568..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; +using System; namespace BTCPayServer.Services.Notifications { diff --git a/BTCPayServer/Services/Notifications/NotificationSender.cs b/BTCPayServer/Services/Notifications/NotificationSender.cs index c2fad5568..3f3d36d52 100644 --- a/BTCPayServer/Services/Notifications/NotificationSender.cs +++ b/BTCPayServer/Services/Notifications/NotificationSender.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Linq; using System.Threading.Tasks; using BTCPayServer.Data; diff --git a/BTCPayServer/Services/PayjoinClient.cs b/BTCPayServer/Services/PayjoinClient.cs index b15a433a4..e4793b725 100644 --- a/BTCPayServer/Services/PayjoinClient.cs +++ b/BTCPayServer/Services/PayjoinClient.cs @@ -1,22 +1,15 @@ -using System; +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 fd7ba2efa..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 169d2e961..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 e07ccf0d1..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 6a9f7be7a..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/Socks5HttpClientHandler.cs b/BTCPayServer/Services/Socks5HttpClientHandler.cs index 55c36b36d..5df345d38 100644 --- a/BTCPayServer/Services/Socks5HttpClientHandler.cs +++ b/BTCPayServer/Services/Socks5HttpClientHandler.cs @@ -1,4 +1,4 @@ -using System.Net; +using System.Net; using System.Net.Http; using BTCPayServer.HostedServices; diff --git a/BTCPayServer/Services/Stores/StoreRepository.cs b/BTCPayServer/Services/Stores/StoreRepository.cs index c40ecb676..f47dbd34c 100644 --- a/BTCPayServer/Services/Stores/StoreRepository.cs +++ b/BTCPayServer/Services/Stores/StoreRepository.cs @@ -1,11 +1,9 @@ -using System; +using System; using System.Collections.Generic; 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 640278097..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 51cb81d99..758f5601c 100644 --- a/BTCPayServer/Services/TorServices.cs +++ b/BTCPayServer/Services/TorServices.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.IO; using System.Linq; @@ -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 8285a33e0..eddb63d57 100644 --- a/BTCPayServer/Services/Torrc.cs +++ b/BTCPayServer/Services/Torrc.cs @@ -1,9 +1,7 @@ -using System; +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 f22583f39..6c3041447 100644 --- a/BTCPayServer/Services/WalletRepository.cs +++ b/BTCPayServer/Services/WalletRepository.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; @@ -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 449b831bf..286857d84 100644 --- a/BTCPayServer/Services/Wallets/BTCPayWallet.cs +++ b/BTCPayServer/Services/Wallets/BTCPayWallet.cs @@ -1,8 +1,7 @@ -using System; +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 933998455..a1b2b4561 100644 --- a/BTCPayServer/Services/Wallets/BTCPayWalletProvider.cs +++ b/BTCPayServer/Services/Wallets/BTCPayWalletProvider.cs @@ -1,7 +1,6 @@ -using System; +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/Models/StorageProvider.cs b/BTCPayServer/Storage/Models/StorageProvider.cs index 799b9fc78..777b5c012 100644 --- a/BTCPayServer/Storage/Models/StorageProvider.cs +++ b/BTCPayServer/Storage/Models/StorageProvider.cs @@ -1,4 +1,4 @@ -namespace BTCPayServer.Storage.Models +namespace BTCPayServer.Storage.Models { public enum StorageProvider { diff --git a/BTCPayServer/Storage/Models/StorageSettings.cs b/BTCPayServer/Storage/Models/StorageSettings.cs index eff339ebe..5d571c45e 100644 --- a/BTCPayServer/Storage/Models/StorageSettings.cs +++ b/BTCPayServer/Storage/Models/StorageSettings.cs @@ -1,4 +1,4 @@ -using System.ComponentModel.DataAnnotations.Schema; +using System.ComponentModel.DataAnnotations.Schema; using Newtonsoft.Json; using Newtonsoft.Json.Linq; diff --git a/BTCPayServer/Storage/Services/FileService.cs b/BTCPayServer/Storage/Services/FileService.cs index d5dc37a25..75cb16651 100644 --- a/BTCPayServer/Storage/Services/FileService.cs +++ b/BTCPayServer/Storage/Services/FileService.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; 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 76957920e..0b1efd802 100644 --- a/BTCPayServer/StorePolicies.cs +++ b/BTCPayServer/StorePolicies.cs @@ -1,7 +1,5 @@ -using System; +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 aeddfb3e9..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 78f679636..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; using System.Text.RegularExpressions; -using System.Threading.Tasks; namespace BTCPayServer.Validation { diff --git a/BTCPayServer/Validation/HDFingerPrintValidator.cs b/BTCPayServer/Validation/HDFingerPrintValidator.cs index 63347e921..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 6bcf253a4..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 942d37053..edd07e3eb 100644 --- a/BTCPayServer/Validation/PubKeyValidator.cs +++ b/BTCPayServer/Validation/PubKeyValidator.cs @@ -1,7 +1,5 @@ -using System; -using System.Collections.Generic; +using System; using System.ComponentModel.DataAnnotations; -using System.Text; using NBitcoin; namespace BTCPayServer.Validation diff --git a/BTCPayServer/Validation/UriAttribute.cs b/BTCPayServer/Validation/UriAttribute.cs index 0e9c75e08..4cfaf01fa 100644 --- a/BTCPayServer/Validation/UriAttribute.cs +++ b/BTCPayServer/Validation/UriAttribute.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.ComponentModel.DataAnnotations; using System.Globalization; diff --git a/BTCPayServer/Views/Manage/ManageNavPages.cs b/BTCPayServer/Views/Manage/ManageNavPages.cs index c197c829b..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 40cb46546..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 b2c313cc3..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 0a7cbcfef..7a5962dd5 100644 --- a/BTCPayServer/Views/ViewsRazor.cs +++ b/BTCPayServer/Views/ViewsRazor.cs @@ -1,8 +1,5 @@ -using System; -using System.Collections.Generic; +using System; 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 fa4438528..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 5cc5447af..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; using System.Text.RegularExpressions; -using System.Threading.Tasks; using BTCPayServer.Payments; namespace BTCPayServer diff --git a/BTCPayServer/WebSocketHelper.cs b/BTCPayServer/WebSocketHelper.cs index c3ceec3b8..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; 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 a2aee7d96..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 85a424967..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 diff --git a/btcpayserver.sln b/btcpayserver.sln index 29f7e4822..14b199bf7 100644 --- a/btcpayserver.sln +++ b/btcpayserver.sln @@ -9,6 +9,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BTCPayServer.Tests", "BTCPa EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Misc", "Misc", "{29290EC7-00E6-4C4B-96D9-4D7E9611DF28}" ProjectSection(SolutionItems) = preProject + .editorconfig = .editorconfig amd64.Dockerfile = amd64.Dockerfile arm32v7.Dockerfile = arm32v7.Dockerfile arm64v8.Dockerfile = arm64v8.Dockerfile @@ -25,7 +26,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BTCPayServer.Common", "BTCP EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BTCPayServer.Data", "BTCPayServer.Data\BTCPayServer.Data.csproj", "{4D7A865D-3945-4C70-9CC8-B09A274A697E}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BTCPayServer.Client", "BTCPayServer.Client\BTCPayServer.Client.csproj", "{21A13304-7168-49A0-86C2-0A1A9453E9C7}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BTCPayServer.Client", "BTCPayServer.Client\BTCPayServer.Client.csproj", "{21A13304-7168-49A0-86C2-0A1A9453E9C7}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution