mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
Trim
This commit is contained in:
parent
aceccaf5b5
commit
3d13eb51e6
4 changed files with 24 additions and 38 deletions
|
|
@ -52,21 +52,6 @@ namespace MinecraftClient
|
|||
/// </summary>
|
||||
static void Main(string[] args)
|
||||
{
|
||||
//Setup ConsoleIO
|
||||
ConsoleIO.LogPrefix = "§8[MCC] ";
|
||||
if (args.Length >= 1 && args[args.Length - 1] == "BasicIO" || args.Length >= 1 && args[args.Length - 1] == "BasicIO-NoColor")
|
||||
{
|
||||
if (args.Length >= 1 && args[args.Length - 1] == "BasicIO-NoColor")
|
||||
{
|
||||
ConsoleIO.BasicIO_NoColor = true;
|
||||
}
|
||||
ConsoleIO.BasicIO = true;
|
||||
args = args.Where(o => !Object.ReferenceEquals(o, args[args.Length - 1])).ToArray();
|
||||
}
|
||||
|
||||
if (!ConsoleIO.BasicIO)
|
||||
ConsoleInteractive.ConsoleWriter.Init();
|
||||
|
||||
Task.Factory.StartNew(() =>
|
||||
{
|
||||
//Take advantage of Windows 10 / Mac / Linux UTF-8 console
|
||||
|
|
@ -86,6 +71,21 @@ namespace MinecraftClient
|
|||
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
|
||||
});
|
||||
|
||||
//Setup ConsoleIO
|
||||
ConsoleIO.LogPrefix = "§8[MCC] ";
|
||||
if (args.Length >= 1 && args[args.Length - 1] == "BasicIO" || args.Length >= 1 && args[args.Length - 1] == "BasicIO-NoColor")
|
||||
{
|
||||
if (args.Length >= 1 && args[args.Length - 1] == "BasicIO-NoColor")
|
||||
{
|
||||
ConsoleIO.BasicIO_NoColor = true;
|
||||
}
|
||||
ConsoleIO.BasicIO = true;
|
||||
args = args.Where(o => !Object.ReferenceEquals(o, args[args.Length - 1])).ToArray();
|
||||
}
|
||||
|
||||
if (!ConsoleIO.BasicIO)
|
||||
ConsoleInteractive.ConsoleWriter.Init();
|
||||
|
||||
ConsoleIO.WriteLine($"Minecraft Console Client v{Version} - for MC {MCLowestVersion} to {MCHighestVersion} - Github.com/MCCTeam");
|
||||
|
||||
//Build information to facilitate processing of bug reports
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
//// Block IDs are packed in the array of 64-bits integers
|
||||
dataTypes.SkipNextVarInt(cache); // Entry length
|
||||
Span<byte> entryDataByte = stackalloc byte[8];
|
||||
Span<long> entryDataLong = MemoryMarshal.Cast<byte, long>(entryDataByte);
|
||||
Span<long> entryDataLong = MemoryMarshal.Cast<byte, long>(entryDataByte); // Faster than MemoryMarshal.Read<long>
|
||||
|
||||
Block[] blocks = new Block[Chunk.SizeX * Chunk.SizeY * Chunk.SizeZ];
|
||||
int startOffset = 64; // Read the first data immediately
|
||||
|
|
|
|||
|
|
@ -97,7 +97,5 @@ namespace MinecraftClient.Protocol.Session
|
|||
|
||||
return session;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -263,39 +263,27 @@ namespace MinecraftClient
|
|||
try
|
||||
{
|
||||
string[] Lines = File.ReadAllLines(file);
|
||||
|
||||
ConcurrentDictionary<int, Section> sectionInfo = new();
|
||||
Parallel.For(0, Lines.Length, idx =>
|
||||
{
|
||||
string line = Lines[idx].Split('#')[0].Trim();
|
||||
if (line.Length > 2 && line[0] == '[' && line[^1] == ']')
|
||||
sectionInfo[idx] = GetSection(line[1..^1]);
|
||||
});
|
||||
|
||||
Section section = Section.Default;
|
||||
for (int idx = 0; idx < Lines.Length; ++idx)
|
||||
foreach (string lineRAW in Lines)
|
||||
{
|
||||
if (sectionInfo.ContainsKey(idx))
|
||||
{
|
||||
section = sectionInfo[idx];
|
||||
continue;
|
||||
}
|
||||
string line = lineRAW.Split('#')[0].Trim();
|
||||
|
||||
Parallel.Invoke(() =>
|
||||
if (line.Length > 1)
|
||||
{
|
||||
string line = Lines[idx].Split('#')[0].Trim();
|
||||
if (line.Length > 1)
|
||||
if (line.Length > 2 && line[0] == '[' && line[^1] == ']')
|
||||
section = GetSection(line[1..^1]);
|
||||
else
|
||||
{
|
||||
string argName = line.Split('=')[0];
|
||||
if (section == Section.Main && argName == "password")
|
||||
line = Lines[idx].Trim(); //Do not strip # in passwords
|
||||
line = lineRAW.Trim(); //Do not strip # in passwords
|
||||
if (line.Length > (argName.Length + 1))
|
||||
{
|
||||
string argValue = line[(argName.Length + 1)..];
|
||||
LoadSingleSetting(section, argName, argValue);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (IOException) { }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue