Archived
Private
Public Access
1
0

Reworked MloFinder

This commit is contained in:
2022-10-26 21:36:47 +02:00
parent d110af3b43
commit b4e5d26ee1
211 changed files with 10114 additions and 49486 deletions

View File

@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
<metadata>
<id>BitComparer</id>
<version>1.0.0</version>
<authors>BitComparer</authors>
<description>Package Description</description>
<dependencies>
<group targetFramework="net5.0" />
</dependencies>
</metadata>
<files>
<file src="D:\Programmierstuff\FiveM\BitComparer\BitComparer\bin\Debug\net5.0\BitComparer.runtimeconfig.json" target="lib\net5.0\BitComparer.runtimeconfig.json" />
<file src="D:\Programmierstuff\FiveM\BitComparer\BitComparer\bin\Debug\net5.0\BitComparer.dll" target="lib\net5.0\BitComparer.dll" />
</files>
</package>

View File

@@ -3,6 +3,8 @@ build_property.TargetFramework = net5.0
build_property.TargetPlatformMinVersion =
build_property.UsingMicrosoftNETSdkWeb =
build_property.ProjectTypeGuids =
build_property.PublishSingleFile =
build_property.IncludeAllContentForSelfExtract =
build_property._SupportedPlatformList = Android,iOS,Linux,macOS,Windows
build_property.InvariantGlobalization =
build_property.PlatformNeutralAssembly =
build_property._SupportedPlatformList = Linux,macOS,Windows
build_property.RootNamespace = BitComparer
build_property.ProjectDir = D:\Programmierstuff\FiveM\BitComparer\BitComparer\

View File

@@ -3,7 +3,6 @@ D:\Programmierstuff\FiveM\BitComparer\BitComparer\bin\Debug\net5.0\BitComparer.d
D:\Programmierstuff\FiveM\BitComparer\BitComparer\bin\Debug\net5.0\BitComparer.runtimeconfig.json
D:\Programmierstuff\FiveM\BitComparer\BitComparer\bin\Debug\net5.0\BitComparer.runtimeconfig.dev.json
D:\Programmierstuff\FiveM\BitComparer\BitComparer\bin\Debug\net5.0\BitComparer.dll
D:\Programmierstuff\FiveM\BitComparer\BitComparer\bin\Debug\net5.0\ref\BitComparer.dll
D:\Programmierstuff\FiveM\BitComparer\BitComparer\bin\Debug\net5.0\BitComparer.pdb
D:\Programmierstuff\FiveM\BitComparer\BitComparer\obj\Debug\net5.0\BitComparer.csproj.AssemblyReference.cache
D:\Programmierstuff\FiveM\BitComparer\BitComparer\obj\Debug\net5.0\BitComparer.GeneratedMSBuildEditorConfig.editorconfig
@@ -14,3 +13,4 @@ D:\Programmierstuff\FiveM\BitComparer\BitComparer\obj\Debug\net5.0\BitComparer.d
D:\Programmierstuff\FiveM\BitComparer\BitComparer\obj\Debug\net5.0\ref\BitComparer.dll
D:\Programmierstuff\FiveM\BitComparer\BitComparer\obj\Debug\net5.0\BitComparer.pdb
D:\Programmierstuff\FiveM\BitComparer\BitComparer\obj\Debug\net5.0\BitComparer.genruntimeconfig.cache
D:\Programmierstuff\FiveM\BitComparer\BitComparer\obj\Debug\net5.0\refint\BitComparer.dll

View File

@@ -1 +1 @@
16659238264472891
16668109765843786

Binary file not shown.

View File

@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
<metadata>
<id>CarCombiner</id>
<version>1.0.0</version>
<authors>CarCombiner</authors>
<description>Package Description</description>
<dependencies>
<group targetFramework="net5.0" />
</dependencies>
</metadata>
<files>
<file src="D:\Programmierstuff\FiveM\CarCombiner\bin\Debug\net5.0\CarCombiner.runtimeconfig.json" target="lib\net5.0\CarCombiner.runtimeconfig.json" />
<file src="D:\Programmierstuff\FiveM\CarCombiner\bin\Debug\net5.0\CarCombiner.dll" target="lib\net5.0\CarCombiner.dll" />
</files>
</package>

View File

@@ -3,7 +3,6 @@ D:\Programmierstuff\FiveM\CarCombiner\bin\Debug\net5.0\CarCombiner.deps.json
D:\Programmierstuff\FiveM\CarCombiner\bin\Debug\net5.0\CarCombiner.runtimeconfig.json
D:\Programmierstuff\FiveM\CarCombiner\bin\Debug\net5.0\CarCombiner.runtimeconfig.dev.json
D:\Programmierstuff\FiveM\CarCombiner\bin\Debug\net5.0\CarCombiner.dll
D:\Programmierstuff\FiveM\CarCombiner\bin\Debug\net5.0\ref\CarCombiner.dll
D:\Programmierstuff\FiveM\CarCombiner\bin\Debug\net5.0\CarCombiner.pdb
D:\Programmierstuff\FiveM\CarCombiner\obj\Debug\net5.0\CarCombiner.csproj.AssemblyReference.cache
D:\Programmierstuff\FiveM\CarCombiner\obj\Debug\net5.0\CarCombiner.GeneratedMSBuildEditorConfig.editorconfig
@@ -14,3 +13,4 @@ D:\Programmierstuff\FiveM\CarCombiner\obj\Debug\net5.0\CarCombiner.dll
D:\Programmierstuff\FiveM\CarCombiner\obj\Debug\net5.0\ref\CarCombiner.dll
D:\Programmierstuff\FiveM\CarCombiner\obj\Debug\net5.0\CarCombiner.pdb
D:\Programmierstuff\FiveM\CarCombiner\obj\Debug\net5.0\CarCombiner.genruntimeconfig.cache
D:\Programmierstuff\FiveM\CarCombiner\obj\Debug\net5.0\refint\CarCombiner.dll

View File

@@ -1 +1 @@
16659238264472891
16668109765843786

View File

@@ -6,14 +6,12 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CarConverter", "CarConverte
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MloConverter", "MloConverter\MloConverter.csproj", "{20F838BC-A102-4679-B241-16BB2FA84D86}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MloFinderUI", "MloFinderUI\MloFinderUI.csproj", "{27BAA414-43F2-4A46-91A8-0A8D2E7FC7FB}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MloFinder", "MloFinder\MloFinder.csproj", "{B3764965-2F1B-4F16-AF98-42D66BB628C0}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BitComparer", "BitComparer\BitComparer\BitComparer.csproj", "{345F97D7-5089-4FDB-862F-1B998E15ADA4}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MloCombiner", "MloCombiner\MloCombiner.csproj", "{84CC694F-6D57-467B-94D3-F3BCB9951884}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MloFinder", "MloFinder\MloFinder.csproj", "{4C1751A2-9E7B-459E-A5AB-2A420330FE99}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -32,14 +30,6 @@ Global
{20F838BC-A102-4679-B241-16BB2FA84D86}.Debug|Any CPU.Build.0 = Debug|Any CPU
{20F838BC-A102-4679-B241-16BB2FA84D86}.Release|Any CPU.ActiveCfg = Release|Any CPU
{20F838BC-A102-4679-B241-16BB2FA84D86}.Release|Any CPU.Build.0 = Release|Any CPU
{27BAA414-43F2-4A46-91A8-0A8D2E7FC7FB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{27BAA414-43F2-4A46-91A8-0A8D2E7FC7FB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{27BAA414-43F2-4A46-91A8-0A8D2E7FC7FB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{27BAA414-43F2-4A46-91A8-0A8D2E7FC7FB}.Release|Any CPU.Build.0 = Release|Any CPU
{B3764965-2F1B-4F16-AF98-42D66BB628C0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B3764965-2F1B-4F16-AF98-42D66BB628C0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B3764965-2F1B-4F16-AF98-42D66BB628C0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B3764965-2F1B-4F16-AF98-42D66BB628C0}.Release|Any CPU.Build.0 = Release|Any CPU
{345F97D7-5089-4FDB-862F-1B998E15ADA4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{345F97D7-5089-4FDB-862F-1B998E15ADA4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{345F97D7-5089-4FDB-862F-1B998E15ADA4}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -48,5 +38,9 @@ Global
{84CC694F-6D57-467B-94D3-F3BCB9951884}.Debug|Any CPU.Build.0 = Debug|Any CPU
{84CC694F-6D57-467B-94D3-F3BCB9951884}.Release|Any CPU.ActiveCfg = Release|Any CPU
{84CC694F-6D57-467B-94D3-F3BCB9951884}.Release|Any CPU.Build.0 = Release|Any CPU
{4C1751A2-9E7B-459E-A5AB-2A420330FE99}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4C1751A2-9E7B-459E-A5AB-2A420330FE99}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4C1751A2-9E7B-459E-A5AB-2A420330FE99}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4C1751A2-9E7B-459E-A5AB-2A420330FE99}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal

View File

@@ -7,6 +7,7 @@
<PackAsTool>true</PackAsTool>
<ToolCommandName>mcb</ToolCommandName>
<PackageOutputPath>./nupkg</PackageOutputPath>
<PackageLicenseUrl>https://choosealicense.com/licenses/mit/</PackageLicenseUrl>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,23 @@
{
"runtimeTarget": {
"name": ".NETCoreApp,Version=v5.0",
"signature": ""
},
"compilationOptions": {},
"targets": {
".NETCoreApp,Version=v5.0": {
"MloCombiner/1.0.0": {
"runtime": {
"MloCombiner.dll": {}
}
}
}
},
"libraries": {
"MloCombiner/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""
}
}
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,9 @@
{
"runtimeOptions": {
"additionalProbingPaths": [
"C:\\Users\\leon\\.dotnet\\store\\|arch|\\|tfm|",
"C:\\Users\\leon\\.nuget\\packages",
"C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages"
]
}
}

View File

@@ -0,0 +1,9 @@
{
"runtimeOptions": {
"tfm": "net5.0",
"framework": {
"name": "Microsoft.NETCore.App",
"version": "5.0.0"
}
}
}

View File

@@ -0,0 +1,23 @@
{
"runtimeTarget": {
"name": ".NETCoreApp,Version=v5.0",
"signature": ""
},
"compilationOptions": {},
"targets": {
".NETCoreApp,Version=v5.0": {
"MloCombiner/1.0.0": {
"runtime": {
"MloCombiner.dll": {}
}
}
}
},
"libraries": {
"MloCombiner/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""
}
}
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,9 @@
{
"runtimeOptions": {
"tfm": "net5.0",
"framework": {
"name": "Microsoft.NETCore.App",
"version": "5.0.0"
}
}
}

Binary file not shown.

View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>MloCombiner</id>
<version>1.0.0</version>
<authors>MloCombiner</authors>
<licenseUrl>https://choosealicense.com/licenses/mit/</licenseUrl>
<description>Package Description</description>
<packageTypes>
<packageType name="DotnetTool" />
</packageTypes>
</metadata>
<files>
<file src="D:\Programmierstuff\FiveM\MloCombiner\obj\DotnetToolSettings.xml" target="tools\net5.0\any\DotnetToolSettings.xml" />
<file src="D:\Programmierstuff\FiveM\MloCombiner\bin\Debug\net5.0\publish\MloCombiner.dll" target="tools\net5.0\any\MloCombiner.dll" />
<file src="D:\Programmierstuff\FiveM\MloCombiner\bin\Debug\net5.0\publish\MloCombiner.deps.json" target="tools\net5.0\any\MloCombiner.deps.json" />
<file src="D:\Programmierstuff\FiveM\MloCombiner\bin\Debug\net5.0\publish\MloCombiner.runtimeconfig.json" target="tools\net5.0\any\MloCombiner.runtimeconfig.json" />
<file src="D:\Programmierstuff\FiveM\MloCombiner\bin\Debug\net5.0\publish\MloCombiner.pdb" target="tools\net5.0\any\MloCombiner.pdb" />
</files>
</package>

View File

@@ -1,4 +1,4 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v5.0", FrameworkDisplayName = "")]

View File

@@ -0,0 +1,22 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("MloCombiner")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
[assembly: System.Reflection.AssemblyProductAttribute("MloCombiner")]
[assembly: System.Reflection.AssemblyTitleAttribute("MloCombiner")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
// Von der MSBuild WriteCodeFragment-Klasse generiert.

View File

@@ -0,0 +1 @@
7aed07fdb14cd95f9131e99a55ff65ab707b32e3

View File

@@ -0,0 +1,10 @@
is_global = true
build_property.TargetFramework = net5.0
build_property.TargetPlatformMinVersion =
build_property.UsingMicrosoftNETSdkWeb =
build_property.ProjectTypeGuids =
build_property.InvariantGlobalization =
build_property.PlatformNeutralAssembly =
build_property._SupportedPlatformList = Linux,macOS,Windows
build_property.RootNamespace = MloCombiner
build_property.ProjectDir = D:\Programmierstuff\FiveM\MloCombiner\

Binary file not shown.

View File

@@ -0,0 +1 @@
8df0af359821c54cde886b215755298e1c9f70b3

View File

@@ -0,0 +1,16 @@
D:\Programmierstuff\FiveM\MloCombiner\bin\Debug\net5.0\MloCombiner.exe
D:\Programmierstuff\FiveM\MloCombiner\bin\Debug\net5.0\MloCombiner.deps.json
D:\Programmierstuff\FiveM\MloCombiner\bin\Debug\net5.0\MloCombiner.runtimeconfig.json
D:\Programmierstuff\FiveM\MloCombiner\bin\Debug\net5.0\MloCombiner.runtimeconfig.dev.json
D:\Programmierstuff\FiveM\MloCombiner\bin\Debug\net5.0\MloCombiner.dll
D:\Programmierstuff\FiveM\MloCombiner\bin\Debug\net5.0\MloCombiner.pdb
D:\Programmierstuff\FiveM\MloCombiner\obj\Debug\net5.0\MloCombiner.csproj.AssemblyReference.cache
D:\Programmierstuff\FiveM\MloCombiner\obj\Debug\net5.0\MloCombiner.GeneratedMSBuildEditorConfig.editorconfig
D:\Programmierstuff\FiveM\MloCombiner\obj\Debug\net5.0\MloCombiner.AssemblyInfoInputs.cache
D:\Programmierstuff\FiveM\MloCombiner\obj\Debug\net5.0\MloCombiner.AssemblyInfo.cs
D:\Programmierstuff\FiveM\MloCombiner\obj\Debug\net5.0\MloCombiner.csproj.CoreCompileInputs.cache
D:\Programmierstuff\FiveM\MloCombiner\obj\Debug\net5.0\MloCombiner.dll
D:\Programmierstuff\FiveM\MloCombiner\obj\Debug\net5.0\refint\MloCombiner.dll
D:\Programmierstuff\FiveM\MloCombiner\obj\Debug\net5.0\MloCombiner.pdb
D:\Programmierstuff\FiveM\MloCombiner\obj\Debug\net5.0\MloCombiner.genruntimeconfig.cache
D:\Programmierstuff\FiveM\MloCombiner\obj\Debug\net5.0\ref\MloCombiner.dll

Binary file not shown.

View File

@@ -0,0 +1 @@
5e7661eb043a6345446d6bca76e046c71d5f6aa0

Binary file not shown.

View File

@@ -0,0 +1,5 @@
D:\Programmierstuff\FiveM\MloCombiner\bin\Debug\net5.0\publish\MloCombiner.exe
D:\Programmierstuff\FiveM\MloCombiner\bin\Debug\net5.0\publish\MloCombiner.dll
D:\Programmierstuff\FiveM\MloCombiner\bin\Debug\net5.0\publish\MloCombiner.deps.json
D:\Programmierstuff\FiveM\MloCombiner\bin\Debug\net5.0\publish\MloCombiner.runtimeconfig.json
D:\Programmierstuff\FiveM\MloCombiner\bin\Debug\net5.0\publish\MloCombiner.pdb

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<DotNetCliTool Version="1">
<Commands>
<Command Name="mcb" EntryPoint="MloCombiner.dll" Runner="dotnet" />
</Commands>
</DotNetCliTool>

View File

@@ -0,0 +1 @@
"restore":{"projectUniqueName":"D:\\Programmierstuff\\FiveM\\MloCombiner\\MloCombiner.csproj","projectName":"MloCombiner","projectPath":"D:\\Programmierstuff\\FiveM\\MloCombiner\\MloCombiner.csproj","outputPath":"D:\\Programmierstuff\\FiveM\\MloCombiner\\obj\\","projectStyle":"PackageReference","fallbackFolders":["C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages"],"originalTargetFrameworks":["net5.0"],"sources":{"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\":{},"https://api.nuget.org/v3/index.json":{}},"frameworks":{"net5.0":{"targetAlias":"net5.0","projectReferences":{}}},"warningProperties":{"warnAsError":["NU1605"]}}"frameworks":{"net5.0":{"targetAlias":"net5.0","imports":["net461","net462","net47","net471","net472","net48","net481"],"assetTargetFallback":true,"warn":true,"frameworkReferences":{"Microsoft.NETCore.App":{"privateAssets":"all"}},"runtimeIdentifierGraphPath":"C:\\Program Files\\dotnet\\sdk\\6.0.402\\RuntimeIdentifierGraph.json"}}"runtimes":{"":{"#import":[]}}

View File

@@ -0,0 +1 @@
16668109765853863

View File

@@ -1,25 +0,0 @@
**/.dockerignore
**/.env
**/.git
**/.gitignore
**/.project
**/.settings
**/.toolstarget
**/.vs
**/.vscode
**/.idea
**/*.*proj.user
**/*.dbmdl
**/*.jfm
**/azds.yaml
**/bin
**/charts
**/docker-compose*
**/Dockerfile*
**/node_modules
**/npm-debug.log
**/obj
**/secrets.dev.yaml
**/values.dev.yaml
LICENSE
README.md

View File

@@ -1,46 +0,0 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using CodeWalker.GameFiles;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
namespace MloFinder.Controllers {
[ApiController]
public class FinderController : Controller {
private readonly ILogger<FinderController> _logger;
public FinderController(ILogger<FinderController> logger) => _logger = logger;
[HttpPost]
[Route("unpack")]
public async Task<IActionResult> GetLocation([FromQuery] string name) {
try {
if (!name.EndsWith("ymap"))
return Conflict("This api only accepts ymaps!");
using var stream = new MemoryStream();
await Request.Body.CopyToAsync(stream);
byte[] data = stream.ToArray();
var existingFiles = new List<RpfFileEntry>();
Program.Rpf.ScanStructure(log => { }, log => _logger.LogError(log));
Program.Rpf.GetFiles(Program.Rpf.Root, existingFiles, false);
if (existingFiles.Any(f => f.Name == name))
RpfFile.DeleteEntry(existingFiles.SingleOrDefault(f => f.Name == name));
var file = RpfFile.CreateFile(Program.Rpf.Root, name, data);
data = Program.Rpf.ExtractFile(file);
var xml = MetaXml.GetXml(file, data, out name);
return Ok(xml);
}
catch (Exception e) {
_logger.LogError(e, "Error tying to process file");
throw;
}
}
}
}

View File

@@ -1,20 +0,0 @@
FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443
FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
WORKDIR /src
COPY ["MloFinder/MloFinder.csproj", "MloFinder/"]
RUN dotnet restore "MloFinder/MloFinder.csproj"
COPY . .
WORKDIR "/src/MloFinder"
RUN dotnet build "MloFinder.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "MloFinder.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "MloFinder.dll"]

76
MloFinder/Log.cs Normal file
View File

@@ -0,0 +1,76 @@
using System;
using System.IO;
namespace CarCombiner {
public static class Log {
public static bool EnableLogging { get; set; } = true;
private static bool OpenWrite = false;
private static void WriteScaffolding(string text, ConsoleColor color, TextWriter stream) {
Console.ForegroundColor = ConsoleColor.Gray;
Console.Write("[");
Console.ForegroundColor = color;
Console.Write(text);
Console.ForegroundColor = ConsoleColor.Gray;
Console.Write("] >> ");
}
public static void WriteLine(object message, ConsoleColor color = ConsoleColor.Gray) {
if (!EnableLogging) return;
if (OpenWrite) Console.WriteLine();
WriteScaffolding("INFO", ConsoleColor.Cyan, Console.Out);
Console.ForegroundColor = color;
Console.WriteLine(message);
Console.ResetColor();
OpenWrite = false;
}
public static void Write(object message, ConsoleColor color = ConsoleColor.Gray) {
if (!EnableLogging) return;
if (OpenWrite) Console.WriteLine();
WriteScaffolding("INFO", ConsoleColor.Cyan, Console.Out);
Console.ForegroundColor = color;
Console.Write(message);
OpenWrite = true;
}
public static void CompleteWrite(object message) {
if (!EnableLogging || !OpenWrite) return;
Console.WriteLine(message);
Console.ResetColor();
OpenWrite = false;
}
public static void WriteWarning(object message, ConsoleColor color = ConsoleColor.Gray) {
if (!EnableLogging) return;
if (OpenWrite) Console.WriteLine();
WriteScaffolding("WARNING", ConsoleColor.Yellow, Console.Out);
Console.ForegroundColor = color;
Console.WriteLine(message);
Console.ResetColor();
OpenWrite = false;
}
public static void WriteError(object message, ConsoleColor color = ConsoleColor.Red) {
if (OpenWrite) Console.WriteLine();
WriteScaffolding("ERROR", ConsoleColor.Red, Console.Error);
Console.ForegroundColor = color;
Console.WriteLine(message);
Console.ResetColor();
OpenWrite = false;
}
public static string RequestInput(string text) {
if (OpenWrite) Console.WriteLine();
Console.WriteLine("\n" + text);
Console.Write("> ");
string answer = Console.ReadLine();
Console.WriteLine();
OpenWrite = false;
return answer;
}
}
}

View File

@@ -1,21 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.6.3" />
</ItemGroup>
<ItemGroup>
<Reference Include="CodeWalker.Core">
<HintPath>..\..\C#\CodeWalker.Core\bin\Debug\netstandard2.0\CodeWalker.Core.dll</HintPath>
</Reference>
<Reference Include="SharpDX.Mathematics">
<HintPath>..\..\.Librarys\GTA Toolkit\SharpDX.Mathematics.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<PackageReference Include="SharpDX.Mathematics" Version="4.2.0" />
</ItemGroup>
</Project>

View File

@@ -1,28 +1,102 @@
using System;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Xml;
using CarCombiner;
using CodeWalker.GameFiles;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Hosting;
namespace MloFinder {
public class Program {
public static RpfFile Rpf { get; private set; }
public static RpfManager Manager { get; private set; }
class Program {
static void Main(string[] args) {
string ymapFile = null;
public static void Main(string[] args) {
// Create temporarily dlc.rpf file
if (File.Exists("dlc.rpf"))
File.Delete("dlc.rpf");
Rpf = RpfFile.CreateNew(Environment.CurrentDirectory, "dlc.rpf");
Manager = new RpfManager();
Manager.Init(new List<RpfFile> {Rpf});
if (args.Length == 0) {
ymapFile = Log.RequestInput("Specify the ymap file to find the MLO.");
}
else ymapFile = args[0];
CreateHostBuilder(args).Build().Run();
if (!File.Exists(ymapFile)) {
Log.WriteError("The specified ymap file does not exist!");
Console.ReadKey();
}
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder => { webBuilder.UseStartup<Startup>(); });
if (File.Exists(Path.GetTempPath() + "dlc.rpf"))
File.Delete(Path.GetTempPath() + "dlc.rpf");
var rpf = RpfFile.CreateNew(Path.GetTempPath(), "dlc.rpf");
var manager = new RpfManager();
manager.Init(new List<RpfFile> {rpf});
byte[] data = File.ReadAllBytes(ymapFile);
var file = RpfFile.CreateFile(rpf.Root, "mlo.ymap", data);
data = rpf.ExtractFile(file);
var xml = MetaXml.GetXml(file, data, out _);
var doc = new XmlDocument();
doc.LoadXml(xml);
var entities = doc.GetElementsByTagName("entities")[0];
List<Vector3d> positions = new List<Vector3d>();
foreach (XmlNode entity in entities.ChildNodes) {
var pos = entity.FindChild("position");
if (pos == null) continue;
var x = Convert.ToDouble(pos.Attributes.GetNamedItem("x").Value.Replace('.', ','));
var y = Convert.ToDouble(pos.Attributes.GetNamedItem("y").Value.Replace('.', ','));
var z = Convert.ToDouble(pos.Attributes.GetNamedItem("z").Value.Replace('.', ','));
positions.Add(new Vector3d(x, y, z));
}
var decision = Log.RequestInput("How do you want to display the result?\n[1] Display all positions\n[2] Display the first 10 positions\n[3] Display the center of the positions");
if (decision.Equals("1")) {
Log.WriteLine(string.Join("\n", positions));
}
if (decision.Equals("2")) {
if (positions.Count < 10) Log.WriteLine(string.Join("\n", positions));
Log.WriteLine(string.Join("\n", positions.Take(10)));
}
if (decision.Equals("3")) {
Log.WriteLine(CalculateCenterPoint(positions));
}
Console.ReadKey();
}
private static Vector3d CalculateCenterPoint(List<Vector3d> points) {
double sx = 0;
double sy = 0;
double sz = 0;
for (int i = 0; i < points.Count; i++) {
sx += points[i].x;
sy += points[i].y;
sz += points[i].z;
}
double size = points.Count;
return new Vector3d(sx / size, sy / size, sz / size);
}
}
struct Vector3d {
public double x;
public double y;
public double z;
public Vector3d(double x, double y, double z) {
this.x = x;
this.y = y;
this.z = z;
}
public override string ToString() {
return $"{x.ToString().Replace(',', '.')}, {y.ToString().Replace(',', '.')}, {z.ToString().Replace(',', '.')}";
}
}
}

View File

@@ -1,31 +0,0 @@
{
"$schema": "https://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:45623",
"sslPort": 44354
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": false,
"launchUrl": "swagger",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"MloFinder": {
"commandName": "Project",
"dotnetRunMessages": "true",
"launchBrowser": false,
"launchUrl": "swagger",
"applicationUrl": "http://localhost:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}

View File

@@ -1,44 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.HttpsPolicy;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Microsoft.OpenApi.Models;
namespace MloFinder {
public class Startup {
public Startup(IConfiguration configuration) {
Configuration = configuration;
}
public IConfiguration Configuration { get; }
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services) {
services.AddControllers();
services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new OpenApiInfo { Title = "MloFinder", Version = "v1" }); });
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IWebHostEnvironment env) {
if (env.IsDevelopment()) {
app.UseDeveloperExceptionPage();
app.UseSwagger();
app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "MloFinder v1"));
}
app.UseRouting();
app.UseAuthorization();
app.UseEndpoints(endpoints => { endpoints.MapControllers(); });
}
}
}

View File

@@ -0,0 +1,16 @@
using System.Xml;
namespace MloFinder {
public static class XmlNodeExtensions {
public static XmlNode FindChild(this XmlNode parent, string name) {
foreach (XmlNode child in parent.ChildNodes) {
if (child.Name.Equals(name))
return child;
}
return null;
}
}
}

View File

@@ -1,9 +0,0 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
}
}

View File

@@ -1,10 +0,0 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"AllowedHosts": "*"
}

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,9 @@
{
"runtimeOptions": {
"additionalProbingPaths": [
"C:\\Users\\leon\\.dotnet\\store\\|arch|\\|tfm|",
"C:\\Users\\leon\\.nuget\\packages",
"C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages"
]
}
}

View File

@@ -0,0 +1,9 @@
{
"runtimeOptions": {
"tfm": "net5.0",
"framework": {
"name": "Microsoft.NETCore.App",
"version": "5.0.0"
}
}
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,9 @@
{
"runtimeOptions": {
"tfm": "net5.0",
"framework": {
"name": "Microsoft.NETCore.App",
"version": "5.0.0"
}
}
}

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@@ -2,13 +2,11 @@
"runtimeOptions": {
"tfm": "net5.0",
"framework": {
"name": "Microsoft.AspNetCore.App",
"name": "Microsoft.NETCore.App",
"version": "5.0.0"
},
"configProperties": {
"System.GC.Server": true,
"System.Reflection.Metadata.MetadataUpdater.IsSupported": false,
"System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false
"System.Reflection.Metadata.MetadataUpdater.IsSupported": false
}
}
}

Some files were not shown because too many files have changed in this diff Show More