Fix all warnings & Trim (#2226)

* Fix AutoFishing crash
* Fix all warnings
* Remove DotNetZip.
* Fix the usage of HttpClient.
This commit is contained in:
BruceChen 2022-10-02 18:31:08 +08:00 committed by GitHub
parent 4aa6c1c99f
commit 1d52d1eadd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
227 changed files with 2201 additions and 43564 deletions

View file

@ -1,8 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
namespace MinecraftClient
{
@ -14,7 +12,7 @@ namespace MinecraftClient
/// </summary>
public static class ConsoleIO
{
private static IAutoComplete autocomplete_engine;
private static IAutoComplete? autocomplete_engine;
/// <summary>
/// Reset the IO mechanism and clear all buffers
@ -77,8 +75,8 @@ namespace MinecraftClient
public static string ReadLine()
{
if (BasicIO)
return Console.ReadLine();
else
return Console.ReadLine() ?? String.Empty;
else
return ConsoleInteractive.ConsoleReader.RequestImmediateInput();
}
@ -87,7 +85,7 @@ namespace MinecraftClient
/// </summary>
public static void DebugReadInput()
{
ConsoleKeyInfo k = new ConsoleKeyInfo();
ConsoleKeyInfo k;
while (true)
{
k = Console.ReadKey(true);
@ -119,14 +117,11 @@ namespace MinecraftClient
/// </param>
public static void WriteLineFormatted(string str, bool acceptnewlines = false, bool? displayTimestamp = null)
{
StringBuilder output = new StringBuilder();
StringBuilder output = new();
if (!String.IsNullOrEmpty(str))
{
if (displayTimestamp == null)
{
displayTimestamp = EnableTimestamps;
}
displayTimestamp ??= EnableTimestamps;
if (displayTimestamp.Value)
{
int hour = DateTime.Now.Hour, minute = DateTime.Now.Minute, second = DateTime.Now.Second;
@ -183,10 +178,10 @@ namespace MinecraftClient
public static void AutocompleteHandler(object? sender, ConsoleKey e)
{
if (e != ConsoleKey.Tab) return;
if (autocomplete_engine == null)
return;
var buffer = ConsoleInteractive.ConsoleReader.GetBufferContent();
autocomplete_engine.AutoComplete(buffer.Text[..buffer.CursorPosition]);
}