Skip to content

Commit

Permalink
Merge pull request #2219 from yahiheb/fix-name-violation
Browse files Browse the repository at this point in the history
Fix name violation
  • Loading branch information
nopara73 committed Sep 9, 2019
2 parents 9eaa395 + f3b77ae commit 891bf5e
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public static class ManagedFileDialogExtensions
{
private class ManagedSystemDialogImpl : ISystemDialogImpl
{
private async Task<string[]> Show(SystemDialog d, IWindowImpl parent)
private async Task<string[]> ShowAsync(SystemDialog d, IWindowImpl parent)
{
var model = new ManagedFileChooserViewModel((FileSystemDialog)d);

Expand All @@ -34,12 +34,12 @@ private async Task<string[]> Show(SystemDialog d, IWindowImpl parent)

public async Task<string[]> ShowFileDialogAsync(FileDialog dialog, IWindowImpl parent)
{
return await Show(dialog, parent);
return await ShowAsync(dialog, parent);
}

public async Task<string> ShowFolderDialogAsync(OpenFolderDialog dialog, IWindowImpl parent)
{
return (await Show(dialog, parent))?.FirstOrDefault();
return (await ShowAsync(dialog, parent))?.FirstOrDefault();
}
}

Expand Down
10 changes: 7 additions & 3 deletions WalletWasabi.Packager/NSubsys/PeUtility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,18 @@ public enum SubSystemType : ushort
public struct ImageDosHeader
{
[FieldOffset(60)]
public uint e_lfanew;
private uint _fileAddressNew;

public uint FileAddressNew => _fileAddressNew;
}

[StructLayout(LayoutKind.Explicit)]
public struct ImageOptionalHeader
{
[FieldOffset(68)]
public ushort Subsystem;
private ushort _subsystem;

public ushort Subsystem => _subsystem;
}

/// <summary>
Expand All @@ -50,7 +54,7 @@ public PeUtility(string filePath)
var dosHeader = FromBinaryReader<ImageDosHeader>(reader);

// Seek the new PE Header and skip NtHeadersSignature (4 bytes) & IMAGE_FILE_HEADER struct (20bytes).
Stream.Seek(dosHeader.e_lfanew + 4 + 20, SeekOrigin.Begin);
Stream.Seek(dosHeader.FileAddressNew + 4 + 20, SeekOrigin.Begin);

MainHeaderOffset = Stream.Position;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace WalletWasabi.Exceptions
{
public class TorSocks5FailureResponseException : Exception
{
public RepField RepField;
public RepField RepField { get; }

public TorSocks5FailureResponseException(RepField rep) : base($"Tor SOCKS5 proxy responded with {rep}.")
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,22 @@ internal class Penalty4 : Penalty
internal override int PenaltyCalculate(BitMatrix matrix)
{
int width = matrix.Width;
int DarkBitCount = 0;
int darkBitCount = 0;

for (int j = 0; j < width; j++)
{
for (int i = 0; i < width; i++)
{
if (matrix[i, j])
{
DarkBitCount++;
darkBitCount++;
}
}
}

int MatrixCount = width * width;
int matrixCount = width * width;

double ratio = (double)DarkBitCount / MatrixCount;
double ratio = (double)darkBitCount / matrixCount;

return Math.Abs((int)((ratio * 100) - 50)) / 5 * 10;
}
Expand Down
6 changes: 3 additions & 3 deletions WalletWasabi/Stores/HashChain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,16 +110,16 @@ public void UpdateServerTipHeight(int height)
}
}

public bool TryGetHeight(uint256 hash, out int Height)
public bool TryGetHeight(uint256 hash, out int height)
{
lock (Lock)
{
Height = Chain.FirstOrDefault(x => x.Value == hash).Key;
height = Chain.FirstOrDefault(x => x.Value == hash).Key;

// Default int will be 0. We do not know if this refers to the 0th hash or it just means the hash was not found.
// So let's check if the height contains or not.
// If the given height is 0, then check if the chain has a key with 0. If it does not have, then return false. If it has, check if the hash is the same or not.
if (Height == 0 && (!Chain.ContainsKey(0) || Chain[0] != hash))
if (height == 0 && (!Chain.ContainsKey(0) || Chain[0] != hash))
{
return false;
}
Expand Down

0 comments on commit 891bf5e

Please sign in to comment.