Skip to content

Commit

Permalink
Fix private specifier inspections
Browse files Browse the repository at this point in the history
  • Loading branch information
hlysine committed Feb 25, 2022
1 parent 2be51c1 commit 0cd03e3
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace QuickDictionary.UserInterface.Converters;

class InverseNullToVisibilityConverter : IValueConverter
internal class InverseNullToVisibilityConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace QuickDictionary.UserInterface.Converters;

class NullToVisibilityConverter : IValueConverter
internal class NullToVisibilityConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
Expand Down
36 changes: 18 additions & 18 deletions QuickDictionary/UserInterface/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ private bool engineBusy
}
}

string title;
private string title;

int updateProgress;
private int updateProgress;

public int UpdateProgress
{
Expand All @@ -85,7 +85,7 @@ public int UpdateProgress
}
}

bool showNewWordPanel;
private bool showNewWordPanel;

public bool ShowNewWordPanel
{
Expand All @@ -97,7 +97,7 @@ public bool ShowNewWordPanel
}
}

string newListName;
private string newListName;

public string NewListName
{
Expand Down Expand Up @@ -159,9 +159,9 @@ public bool AutoOcr

private bool stopSelectionUpdate;

readonly SemaphoreSlim updateFinished = new(0, 1);
private readonly SemaphoreSlim updateFinished = new(0, 1);

readonly DispatcherTimer autoOcrTimer;
private readonly DispatcherTimer autoOcrTimer;

public MainWindow()
{
Expand All @@ -177,11 +177,11 @@ public MainWindow()
autoOcrTimer.Tick += AutoOcrTimer_Tick;
}

Point cursor;
DateTime cursorIdleSince;
AutoOcrHighlighter highlighter;
Bitmap wordBitmap;
bool autoLookUpDone;
private Point cursor;
private DateTime cursorIdleSince;
private AutoOcrHighlighter highlighter;
private Bitmap wordBitmap;
private bool autoLookUpDone;

private async Task autoLookup(Point newCursor)
{
Expand Down Expand Up @@ -248,7 +248,7 @@ private async void AutoOcrTimer_Tick(object sender, EventArgs e)
autoOcrTimer.Start();
}

Bitmap screenshot;
private Bitmap screenshot;

private async void startOcr()
{
Expand Down Expand Up @@ -314,7 +314,7 @@ private async void KeyHook_KeyPressed(object sender, KeyPressedEventArgs e)
}
}

static OcrEntry findClosestOcrEntry(List<OcrEntry> ocrEntries, float x, float y, bool strict)
private static OcrEntry findClosestOcrEntry(List<OcrEntry> ocrEntries, float x, float y, bool strict)
{
var word = ocrEntries.FirstOrDefault(w => w.Rect.Contains(x, y));

Expand All @@ -335,7 +335,7 @@ static OcrEntry findClosestOcrEntry(List<OcrEntry> ocrEntries, float x, float y,
return null;
}

async Task<OcrEntry> ocrAtPoint(Point position, bool strict)
private async Task<OcrEntry> ocrAtPoint(Point position, bool strict)
{
engineBusy = true;
Pix tessImg;
Expand Down Expand Up @@ -526,7 +526,7 @@ private void clipboardChanged(object sender, EventArgs e)

private readonly SemaphoreSlim highlighterSemaphore = new(1, 1);

async void updateHighlighter(string word, Dictionary dict)
private async void updateHighlighter(string word, Dictionary dict)
{
try
{
Expand Down Expand Up @@ -589,7 +589,7 @@ await TaskUtils.WaitUntil(() =>
}
}

async void search(string word)
private async void search(string word)
{
if (word.Length < 100)
{
Expand Down Expand Up @@ -793,7 +793,7 @@ protected override CefReturnValue OnBeforeResourceLoad(IWebBrowser chromiumWebBr
}
}

bool canExit;
private bool canExit;

private async void mainWindow_Closing(object sender, CancelEventArgs e)
{
Expand Down Expand Up @@ -826,7 +826,7 @@ private async void mainWindow_Closing(object sender, CancelEventArgs e)
}
}

string lastWordUrl;
private string lastWordUrl;

private async void btnNewWordPanel_Checked(object sender, RoutedEventArgs e)
{
Expand Down
16 changes: 8 additions & 8 deletions QuickDictionary/UserInterface/Ocr/AutoOcrHighlighter.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,18 @@ public string Description
}
}

const int padding = 3;
private const int padding = 3;

public OcrEntry OcrEntry { get; set; }

public void SetWord(OcrEntry word)
public void SetWord(OcrEntry entry)
{
OcrEntry = word;
Left = word.Rect.Left - padding;
Top = word.Rect.Top - padding;
Width = word.Rect.Width + padding * 2;
Height = word.Rect.Height + padding * 2 + 3;
this.word = word.Word;
OcrEntry = entry;
Left = entry.Rect.Left - padding;
Top = entry.Rect.Top - padding;
Width = entry.Rect.Width + padding * 2;
Height = entry.Rect.Height + padding * 2 + 3;
this.word = entry.Word;
}

public AutoOcrHighlighter()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public bool EditLists
}
}

string renameListName;
private string renameListName;
public string RenameListName
{
get => renameListName;
Expand Down
7 changes: 4 additions & 3 deletions QuickDictionary/Utils/WebUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public static async Task<string> GetFinalRedirectAsync(string url)
var newUrl = url;
do
{
HttpWebRequest req = null;
HttpWebRequest req;
HttpWebResponse resp = null;
try
{
Expand Down Expand Up @@ -78,11 +78,10 @@ public static async Task<HttpStatusCode> GetFinalStatusCodeAsync(string url)
return HttpStatusCode.NotFound;

var maxRedirectCount = 8; // prevent infinite loops
var newUrl = url;
var statusCode = HttpStatusCode.NotFound;
do
{
HttpWebRequest req = null;
HttpWebRequest req;
HttpWebResponse resp = null;
try
{
Expand All @@ -91,6 +90,8 @@ public static async Task<HttpStatusCode> GetFinalStatusCodeAsync(string url)
req.AllowAutoRedirect = false;
resp = (HttpWebResponse)await req.GetResponseAsync();
statusCode = resp.StatusCode;
string newUrl;

switch (resp.StatusCode)
{
case HttpStatusCode.OK:
Expand Down

0 comments on commit 0cd03e3

Please sign in to comment.