1
0

fix: fix BMapSharpTest

This commit is contained in:
2026-02-06 22:07:35 +08:00
parent f7074eb98f
commit 705af2aa3f
2 changed files with 14 additions and 13 deletions

View File

@@ -1,19 +1,19 @@
using System; using System;
using System.IO;
using System.Text; using System.Text;
using System.Collections.Generic;
using System.Diagnostics;
using BMapSharp; using BMapSharp;
namespace BMapSharpTest { namespace BMapSharpTest {
internal class Program { internal class Program {
static void Main(string[] args) { static int Main(string[] args) {
// Parse arguments // Parse arguments
Cli cli;
try { try {
cli = new Cli();
} catch (CliException e) { } catch (CliException e) {
Console.WriteLine($"Can not launch test. Reason: {e.Message}"); Console.WriteLine($"Can not launch test. Reason: {e.Message}");
Environment.Exit(0); return 2;
} }
// Check console encoding. // Check console encoding.
@@ -21,7 +21,7 @@ namespace BMapSharpTest {
// Check BMap status. // Check BMap status.
if (!BMapSharp.BMapWrapper.Utils.IsBMapAvailable()) { if (!BMapSharp.BMapWrapper.Utils.IsBMapAvailable()) {
Console.WriteLine("Fail to initialize native BMap."); Console.WriteLine("Fail to initialize native BMap.");
Environment.Exit(0); return 1;
} }
// Waiting debugger // Waiting debugger
@@ -30,19 +30,20 @@ namespace BMapSharpTest {
Console.ReadKey(true); Console.ReadKey(true);
// Start testbench // Start testbench
string file_name = resolved_args.mFileName; // "LightCameraTest.nmo"; string file_name = cli.FileName;
string temp_folder = resolved_args.mTempFolder; // "Temp"; var temp_dir_info = Directory.CreateTempSubdirectory();
string texture_folder = resolved_args.mTextureFolder; // "F:\\Ballance\\Ballance\\Textures"; string temp_dir = temp_dir_info.FullName;
string[] encodings = resolved_args.mEncodings; // ["cp1252", "gb2312"]; string texture_dir = Path.Combine(cli.BallanceDirectory, "Textures");
string[] encodings = cli.Encodings;
using (var reader = new BMapSharp.BMapWrapper.BMFileReader(file_name, temp_folder, texture_folder, encodings)) { using (var reader = new BMapSharp.BMapWrapper.BMFileReader(file_name, temp_dir, texture_dir, encodings)) {
TestSuits.TestCommon.Test(reader); TestSuits.TestCommon.Test(reader);
TestSuits.TestIEquatable.Test(reader); TestSuits.TestIEquatable.Test(reader);
} }
Console.WriteLine("Press any key to quit..."); Console.WriteLine("Press any key to quit...");
Console.ReadKey(true); Console.ReadKey(true);
return 0;
} }
} }

View File

@@ -1,7 +1,7 @@
using BMapSharp.BMapWrapper;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using BMapSharp.BMapWrapper;
namespace BMapSharpTest.TestSuits { namespace BMapSharpTest.TestSuits {