feat(battle-engine): close the AI-simulation subsystem (verbatim)
Copied the 89 uncopied AI*SimulationUtility/extension files defining the AIVirtualCard/AIVirtualField extension methods; the compile loop then auto-closed the revealed type deps (~3049 files total, drift-clean). 10.0k -> 62 errors.
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
using System;
|
||||
|
||||
namespace Sqlite3Plugin;
|
||||
|
||||
public class DatabaseCorruptionException : Exception
|
||||
{
|
||||
public DatabaseCorruptionException(int rc)
|
||||
: base($"Database is corrupted: code {rc}")
|
||||
{
|
||||
}
|
||||
}
|
||||
80
SVSim.BattleEngine/Engine/Sqlite3Plugin/ResultCode.cs
Normal file
80
SVSim.BattleEngine/Engine/Sqlite3Plugin/ResultCode.cs
Normal file
@@ -0,0 +1,80 @@
|
||||
using System;
|
||||
|
||||
namespace Sqlite3Plugin;
|
||||
|
||||
public class ResultCode
|
||||
{
|
||||
public const int SQLITE_OK = 0;
|
||||
|
||||
public const int SQLITE_ERROR = 1;
|
||||
|
||||
public const int SQLITE_INTERNAL = 2;
|
||||
|
||||
public const int SQLITE_PERM = 3;
|
||||
|
||||
public const int SQLITE_ABORT = 4;
|
||||
|
||||
public const int SQLITE_BUSY = 5;
|
||||
|
||||
public const int SQLITE_LOCKED = 6;
|
||||
|
||||
public const int SQLITE_NOMEM = 7;
|
||||
|
||||
public const int SQLITE_READONLY = 8;
|
||||
|
||||
public const int SQLITE_INTERRUPT = 9;
|
||||
|
||||
public const int SQLITE_IOERR = 10;
|
||||
|
||||
public const int SQLITE_CORRUPT = 11;
|
||||
|
||||
public const int SQLITE_NOTFOUND = 12;
|
||||
|
||||
public const int SQLITE_FULL = 13;
|
||||
|
||||
public const int SQLITE_CANTOPEN = 14;
|
||||
|
||||
public const int SQLITE_PROTOCOL = 15;
|
||||
|
||||
public const int SQLITE_EMPTY = 16;
|
||||
|
||||
public const int SQLITE_SCHEMA = 17;
|
||||
|
||||
public const int SQLITE_TOOBIG = 18;
|
||||
|
||||
public const int SQLITE_CONSTRAINT = 19;
|
||||
|
||||
public const int SQLITE_MISMATCH = 20;
|
||||
|
||||
public const int SQLITE_MISUSE = 21;
|
||||
|
||||
public const int SQLITE_NOLFS = 22;
|
||||
|
||||
public const int SQLITE_AUTH = 23;
|
||||
|
||||
public const int SQLITE_FORMAT = 24;
|
||||
|
||||
public const int SQLITE_RANGE = 25;
|
||||
|
||||
public const int SQLITE_NOTADB = 26;
|
||||
|
||||
public const int SQLITE_NOTICE = 27;
|
||||
|
||||
public const int SQLITE_WARNING = 28;
|
||||
|
||||
public const int SQLITE_ROW = 100;
|
||||
|
||||
public const int SQLITE_DONE = 101;
|
||||
|
||||
public static void CheckCorruption(int rc, string errMsg = null)
|
||||
{
|
||||
if (rc == 11 || rc == 26)
|
||||
{
|
||||
throw new DatabaseCorruptionException(rc);
|
||||
}
|
||||
if (!string.IsNullOrEmpty(errMsg) && errMsg.IndexOf("unsupported file format", StringComparison.OrdinalIgnoreCase) >= 0)
|
||||
{
|
||||
throw new DatabaseCorruptionException(26);
|
||||
}
|
||||
}
|
||||
}
|
||||
72
SVSim.BattleEngine/Engine/Sqlite3Plugin/Sqlite3LibImport.cs
Normal file
72
SVSim.BattleEngine/Engine/Sqlite3Plugin/Sqlite3LibImport.cs
Normal file
@@ -0,0 +1,72 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Sqlite3Plugin;
|
||||
|
||||
public static class Sqlite3LibImport
|
||||
{
|
||||
private const string LibraryName = "libsqlite3";
|
||||
|
||||
[DllImport("libsqlite3")]
|
||||
public static extern int sqlite3_open(byte[] zFilename, out IntPtr ppDB);
|
||||
|
||||
[DllImport("libsqlite3")]
|
||||
public static extern int sqlite3_open_v2(byte[] zFilename, out IntPtr ppDB, int flags, byte[] zVfs);
|
||||
|
||||
[DllImport("libsqlite3")]
|
||||
public static extern int sqlite3_close(IntPtr db);
|
||||
|
||||
[DllImport("libsqlite3")]
|
||||
public static extern int sqlite3_exec(IntPtr db, byte[] zSql, IntPtr xCallback, IntPtr pArg, out IntPtr pzErrMsg);
|
||||
|
||||
[DllImport("libsqlite3")]
|
||||
public static extern int sqlite3_prepare_v2(IntPtr db, byte[] zSql, int nBytes, out IntPtr ppStmt, IntPtr pzTail);
|
||||
|
||||
[DllImport("libsqlite3")]
|
||||
public static extern int sqlite3_bind_text(IntPtr pStmt, int i, byte[] zData, int nData, IntPtr xDel);
|
||||
|
||||
[DllImport("libsqlite3")]
|
||||
public static extern int sqlite3_bind_int(IntPtr pStmt, int i, int iValue);
|
||||
|
||||
[DllImport("libsqlite3")]
|
||||
public static extern int sqlite3_bind_double(IntPtr pStmt, int i, double rValue);
|
||||
|
||||
[DllImport("libsqlite3")]
|
||||
public static extern int sqlite3_bind_null(IntPtr pStmt, int i);
|
||||
|
||||
[DllImport("libsqlite3")]
|
||||
public static extern int sqlite3_reset(IntPtr pStmt);
|
||||
|
||||
[DllImport("libsqlite3")]
|
||||
public static extern int sqlite3_step(IntPtr pStmt);
|
||||
|
||||
[DllImport("libsqlite3")]
|
||||
public static extern int sqlite3_finalize(IntPtr pStmt);
|
||||
|
||||
[DllImport("libsqlite3")]
|
||||
public static extern int sqlite3_column_int(IntPtr pStmt, int i);
|
||||
|
||||
[DllImport("libsqlite3")]
|
||||
public static extern double sqlite3_column_double(IntPtr pStmt, int i);
|
||||
|
||||
[DllImport("libsqlite3")]
|
||||
public static extern int sqlite3_column_bytes(IntPtr pStmt, int i);
|
||||
|
||||
[DllImport("libsqlite3")]
|
||||
public static extern IntPtr sqlite3_column_blob(IntPtr pStmt, int i);
|
||||
|
||||
[DllImport("libsqlite3")]
|
||||
public static extern IntPtr sqlite3_column_text(IntPtr pStmt, int i);
|
||||
|
||||
[DllImport("libsqlite3")]
|
||||
public static extern int sqlite3_column_type(IntPtr pStmt, int i);
|
||||
|
||||
[DllImport("libsqlite3")]
|
||||
public static extern int sqlite3_vfs_register(IntPtr pStmt, int makeDflt);
|
||||
|
||||
[DllImport("libsqlite3")]
|
||||
public static extern int sqlite3_vfs_unregister(IntPtr pVfs);
|
||||
|
||||
[DllImport("libsqlite3")]
|
||||
public static extern IntPtr sqlite3_vfs_find(byte[] zVfsName);
|
||||
}
|
||||
Reference in New Issue
Block a user