Skip to content

Commit

Permalink
Linter pass
Browse files Browse the repository at this point in the history
  • Loading branch information
Lauriethefish committed Oct 27, 2023
1 parent cee16ee commit 62c8af2
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 27 deletions.
4 changes: 2 additions & 2 deletions QuestPatcher.Core/AndroidDebugBridge.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,15 +114,15 @@ public async Task<ProcessOutput> RunCommand(string command, params int[] allowed
while (true)
{
var output = await ProcessUtil.InvokeAndCaptureOutput(_adbPath, command);
if(output.StandardOutput.Length > 0)
if (output.StandardOutput.Length > 0)
{
Log.Verbose("Standard output: {StandardOutput}", output.StandardOutput);
}
if (output.ErrorOutput.Length > 0)
{
Log.Verbose("Error output: {ErrorOutput}", output.ErrorOutput);
}
if(output.ExitCode != 0)
if (output.ExitCode != 0)
{
Log.Verbose("Exit code: {ExitCode}", output.ExitCode);
}
Expand Down
4 changes: 2 additions & 2 deletions QuestPatcher.Core/FileUtil.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System.Threading.Tasks;
using System.IO;
using System.IO;
using System.Threading.Tasks;

namespace QuestPatcher.Core
{
Expand Down
1 change: 0 additions & 1 deletion QuestPatcher.Core/Modding/QModProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection.PortableExecutable;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
Expand Down
8 changes: 4 additions & 4 deletions QuestPatcher.Zip/ApkZip.cs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public static ApkZip Open(Stream stream)
}

var apkZip = new ApkZip(centralDirectoryRecords, postFilesOffset, stream, reader);
if(stream.CanWrite)
if (stream.CanWrite)
{
// Load the digests of each file from the signature. When we re-sign the APK later, we then only need to hash the changed files.
apkZip._existingHashes = JarSigner.CollectExistingHashes(apkZip);
Expand Down Expand Up @@ -376,7 +376,7 @@ private static void SeekToEndOfEntry(Stream stream, CentralDirectoryFileHeader h
// Some data descriptors contain the signature, some do not.
// The signature was originally not part of the ZIP specification but has been widely adopted.
uint _crc = reader.ReadUInt32();
if(_crc == DataDescriptorSignature)
if (_crc == DataDescriptorSignature)
{
// If the signature was present, and so we just read the signature, read the actual CRC here.
// In the situation that the CRC32 happened to equal the data descriptor signature, this will read invalid data.
Expand Down Expand Up @@ -413,15 +413,15 @@ private void Save()

private void ThrowIfDisposed()
{
if(_disposed)
if (_disposed)
{
throw new ObjectDisposedException(GetType().FullName);
}
}

public void Dispose()
{
if(_disposed)
if (_disposed)
{
return;
}
Expand Down
2 changes: 1 addition & 1 deletion QuestPatcher.Zip/Crc32.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class Crc32

static Crc32()
{
for(uint b = 0; b < 256; b++)
for (uint b = 0; b < 256; b++)
{
uint current = b;

Expand Down
14 changes: 7 additions & 7 deletions QuestPatcher/BrowseImportManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ private async Task ShowDialogAndHandleResult(List<FilePickerFileType> filters, F

await AttemptImportFiles(files.Select(file => new FileImportInfo(file.Path.LocalPath)
{
PreferredCopyType = knownFileCopyType
PreferredCopyType = knownFileCopyType
}).ToList());
}

Expand All @@ -110,7 +110,7 @@ public async Task AttemptImportFiles(ICollection<FileImportInfo> files)

// Append all files to the new or existing queue
Log.Debug("Enqueuing {FilesEnqueued} files", files.Count);
foreach(var importInfo in files)
foreach (var importInfo in files)
{
_currentImportQueue.Enqueue(importInfo);
}
Expand Down Expand Up @@ -156,7 +156,7 @@ public async Task AttemptImportUri(Uri uri)
HttpContentHeaders headers;
try
{
if(_locker.IsFree)
if (_locker.IsFree)
{
// Make sure that the download progress bar is visible
_locker.StartOperation();
Expand All @@ -175,15 +175,15 @@ public async Task AttemptImportUri(Uri uri)
};
await builder.OpenDialogue(_mainWindow);
return;
}
finally
}
finally
{
_locker.FinishOperation();
}

// Get the file name/extension from the headers
string? extension = Path.GetExtension(headers.ContentDisposition?.FileName);
if(extension == null)
if (extension == null)
{
var builder = new DialogBuilder
{
Expand All @@ -200,7 +200,7 @@ await AttemptImportFiles(new List<FileImportInfo> {
new FileImportInfo(tempFile.Path)
{
OverrideExtension = extension
}
}
});
}

Expand Down
7 changes: 1 addition & 6 deletions QuestPatcher/FileImportInfo.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using QuestPatcher.Core.Modding;
using QuestPatcher.Core.Modding;

namespace QuestPatcher
{
Expand Down
7 changes: 3 additions & 4 deletions QuestPatcher/ViewModels/LoadedViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using System.Linq;
using System.Runtime.InteropServices;
using Avalonia.Input;
using Org.BouncyCastle.Crypto.Tls;
using QuestPatcher.Core;
using QuestPatcher.Core.Models;
using QuestPatcher.ViewModels.Modding;
Expand Down Expand Up @@ -92,7 +91,7 @@ public async void OnDragAndDrop(object? sender, DragEventArgs args)
// We need to handle this to avoid crashing QuestPatcher.
try
{
var text = args.Data.GetText();
string? text = args.Data.GetText();
if (text != null)
{
var creationOptions = new UriCreationOptions();
Expand All @@ -104,15 +103,15 @@ public async void OnDragAndDrop(object? sender, DragEventArgs args)
}

var files = args.Data.GetFiles();
if(files != null)
if (files != null)
{
Log.Debug("Files found in drag and drop. Processing . . .");
await _browseManager.AttemptImportFiles(files.Select(file => new FileImportInfo(file.Path.LocalPath)
{
PreferredCopyType = OtherItemsView.SelectedFileCopy
}).ToList());
}

}
catch (COMException)
{
Expand Down

0 comments on commit 62c8af2

Please sign in to comment.