Remove rule to prefer conditional expression over assignement
MODIFY
.editorconfig
.editorconfig
@@ -103,9 +103,6 @@ csharp_prefer_braces = true:error
#do not suggest readonly fields
dotnet_style_readonly_field = false:error
-#prefer conditional expression over assignement
-dotnet_style_prefer_conditional_expression_over_assignment = true:error
-
# name all constant fields using PascalCase
dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = error

MODIFY
WalletWasabi.Gui/Config.cs
WalletWasabi.Gui/Config.cs
@@ -149,11 +149,18 @@ namespace WalletWasabi.Gui
return _backendUri;
}
- _backendUri = Network == Network.Main
- ? new Uri(MainNetBackendUriV3)
- : Network == Network.TestNet
- ? new Uri(TestNetBackendUriV3)
- : new Uri(RegTestBackendUriV3);
+ if (Network == Network.Main)
+ {
+ _backendUri = new Uri(MainNetBackendUriV3);
+ }
+ else if (Network == Network.TestNet)
+ {
+ _backendUri = new Uri(TestNetBackendUriV3);
+ }
+ else // RegTest
+ {
+ _backendUri = new Uri(RegTestBackendUriV3);
+ }
return _backendUri;
}
@@ -165,11 +172,18 @@ namespace WalletWasabi.Gui
return _fallbackBackendUri;
}
- _fallbackBackendUri = Network == Network.Main
- ? new Uri(MainNetFallbackBackendUri)
- : Network == Network.TestNet
- ? new Uri(TestNetFallbackBackendUri)
- : new Uri(RegTestBackendUriV3);
+ if (Network == Network.Main)
+ {
+ _fallbackBackendUri = new Uri(MainNetFallbackBackendUri);
+ }
+ else if (Network == Network.TestNet)
+ {
+ _fallbackBackendUri = new Uri(TestNetFallbackBackendUri);
+ }
+ else // RegTest
+ {
+ _fallbackBackendUri = new Uri(RegTestBackendUriV3);
+ }
return _fallbackBackendUri;
}

MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/CoinJoinTabViewModel.cs
WalletWasabi.Gui/Controls/WalletExplorer/CoinJoinTabViewModel.cs
@@ -336,9 +336,14 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
else
{
var available = Global.WalletService.Coins.Where(x => x.Confirmed && !x.Unavailable);
- RequiredBTC = available.Any()
- ? registrableRound.State.CalculateRequiredAmount(available.Where(x => x.AnonymitySet < Global.Config.PrivacyLevelStrong).Select(x => x.Amount).ToArray())
- : registrableRound.State.CalculateRequiredAmount();
+ if (available.Any())
+ {
+ RequiredBTC = registrableRound.State.CalculateRequiredAmount(available.Where(x => x.AnonymitySet < Global.Config.PrivacyLevelStrong).Select(x => x.Amount).ToArray());
+ }
+ else
+ {
+ RequiredBTC = registrableRound.State.CalculateRequiredAmount();
+ }
}
}
}

MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/HistoryTabViewModel.cs
WalletWasabi.Gui/Controls/WalletExplorer/HistoryTabViewModel.cs
@@ -155,11 +155,22 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
continue;
}
- DateTimeOffset dateTime = foundTransaction.Height.Type == HeightType.Chain
- ? walletService.ProcessedBlocks.Any(x => x.Value.height == foundTransaction.Height)
- ? walletService.ProcessedBlocks.First(x => x.Value.height == foundTransaction.Height).Value.dateTime
- : DateTimeOffset.UtcNow
- : foundTransaction.FirstSeenIfMempoolTime ?? DateTimeOffset.UtcNow;
+ DateTimeOffset dateTime;
+ if (foundTransaction.Height.Type == HeightType.Chain)
+ {
+ if (walletService.ProcessedBlocks.Any(x => x.Value.height == foundTransaction.Height))
+ {
+ dateTime = walletService.ProcessedBlocks.First(x => x.Value.height == foundTransaction.Height).Value.dateTime;
+ }
+ else
+ {
+ dateTime = DateTimeOffset.UtcNow;
+ }
+ }
+ else
+ {
+ dateTime = foundTransaction.FirstSeenIfMempoolTime ?? DateTimeOffset.UtcNow;
+ }
if (found != default) // if found
{
@@ -177,15 +188,35 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
{
SmartTransaction foundSpenderTransaction = walletService.TransactionCache.First(x => x.GetHash() == coin.SpenderTransactionId);
- dateTime = foundSpenderTransaction.Height.Type == HeightType.Chain
- ? walletService.ProcessedBlocks != null // NullReferenceException appeared here.
- ? walletService.ProcessedBlocks.Any(x => x.Value.height == foundSpenderTransaction.Height)
- ? walletService.ProcessedBlocks != null // NullReferenceException appeared here.
- ? walletService.ProcessedBlocks.First(x => x.Value.height == foundSpenderTransaction.Height).Value.dateTime
- : DateTimeOffset.UtcNow
- : DateTimeOffset.UtcNow
- : DateTimeOffset.UtcNow
- : foundSpenderTransaction.FirstSeenIfMempoolTime ?? DateTimeOffset.UtcNow;
+ if (foundSpenderTransaction.Height.Type == HeightType.Chain)
+ {
+ if (walletService.ProcessedBlocks != null) // NullReferenceException appeared here.
+ {
+ if (walletService.ProcessedBlocks.Any(x => x.Value.height == foundSpenderTransaction.Height))
+ {
+ if (walletService.ProcessedBlocks != null) // NullReferenceException appeared here.
+ {
+ dateTime = walletService.ProcessedBlocks.First(x => x.Value.height == foundSpenderTransaction.Height).Value.dateTime;
+ }
+ else
+ {
+ dateTime = DateTimeOffset.UtcNow;
+ }
+ }
+ else
+ {
+ dateTime = DateTimeOffset.UtcNow;
+ }
+ }
+ else
+ {
+ dateTime = DateTimeOffset.UtcNow;
+ }
+ }
+ else
+ {
+ dateTime = foundSpenderTransaction.FirstSeenIfMempoolTime ?? DateTimeOffset.UtcNow;
+ }
var foundSpenderCoin = txRecordList.FirstOrDefault(x => x.transactionId == coin.SpenderTransactionId);
if (foundSpenderCoin != default) // if found

MODIFY
WalletWasabi.Gui/Models/LoadWalletEntry.cs
WalletWasabi.Gui/Models/LoadWalletEntry.cs
@@ -18,15 +18,26 @@ namespace WalletWasabi.Gui.Models
public LoadWalletEntry(HardwareWalletInfo hwi)
{
- WalletName = string.IsNullOrWhiteSpace(hwi.Error)
- ? hwi.Type.ToString()
- : !hwi.Initialized
- ? hwi.Type.ToString() + $" - Not Initialized"
- : !hwi.Ready
- ? hwi.Type.ToString() + $" - Device Not Ready"
- : hwi.NeedPin
- ? hwi.Type.ToString()
- : hwi.Type.ToString() + $" - Error: {hwi.Error}";
+ if (string.IsNullOrWhiteSpace(hwi.Error))
+ {
+ WalletName = hwi.Type.ToString();
+ }
+ else if (!hwi.Initialized)
+ {
+ WalletName = hwi.Type.ToString() + $" - Not Initialized";
+ }
+ else if (!hwi.Ready)
+ {
+ WalletName = hwi.Type.ToString() + $" - Device Not Ready";
+ }
+ else if (hwi.NeedPin)
+ {
+ WalletName = hwi.Type.ToString();
+ }
+ else
+ {
+ WalletName = hwi.Type.ToString() + $" - Error: {hwi.Error}";
+ }
HardwareWalletInfo = hwi;
}

Remove rule to prefer conditional expression over assignement