PotatoVnDBMapper 1.1.1

dotnet add package PotatoVnDBMapper --version 1.1.1
                    
NuGet\Install-Package PotatoVnDBMapper -Version 1.1.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="PotatoVnDBMapper" Version="1.1.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="PotatoVnDBMapper" Version="1.1.1" />
                    
Directory.Packages.props
<PackageReference Include="PotatoVnDBMapper" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add PotatoVnDBMapper --version 1.1.1
                    
#r "nuget: PotatoVnDBMapper, 1.1.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package PotatoVnDBMapper@1.1.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=PotatoVnDBMapper&version=1.1.1
                    
Install as a Cake Addin
#tool nuget:?package=PotatoVnDBMapper&version=1.1.1
                    
Install as a Cake Tool

PotatoVnDB Mapper

这是一个用于将vndb的游戏id映射到其他游戏数据库的工具(目前映射到了bangumi、steam和月幕Galgame)。

本nuget包为本项目的简单封装,提供了一个简单的接口来获取映射结果。

使用方法

使用前请安装本nuget包,并下载映射库vn_mapper.db。它每周一晚上自动更新,覆盖发布在 db-latest这一个release里,地址固定:

https://github.com/GoldenPotato137/PotatoDBMapper/releases/download/db-latest/vn_mapper.db
using NugetPackage;
using PotatoDBMapper.Models;

var mapper = new VnDbMapper();
mapper.Init("path_to_db"); //打开数据库

// MapModel为原表<map>中条目的映射,请参考原项目获取这些数据的含义
MapModel? map = await mapper.TryGetMapAsync(10680); //获取vndb id为10680的映射结果
Console.WriteLine($"{map?.BgmId} {map?.SteamId} {map?.YmgalId}");

//反过来查也行,一个游戏可能会映射到多个vndb游戏,故结果是个列表
List<MapModel> byBgm = await mapper.TryGetMapsWithBgmId(44123); //bangumi条目id
List<MapModel> bySteam = await mapper.TryGetMapsWithSteamId(1776970); //steam appid
List<MapModel> byYmgal = await mapper.TryGetMapsWithYmgalId(31147); //月幕Galgame的gid

//搜索某游戏的映射表,返回List<(MapModel, double)>,double为相似度,按相似度从高到低排序
//async Task<List<(MapModel model, double similarity)>> TryGetMapsWithName(string gameName, double minSimilarity = 0.75)
List<(MapModel, double)> maps = await mapper.TryGetMapsWithName("近月少女的礼仪", 0.8);

//要反复搜索的话用带索引的这个,结果与上面完全一致,但每次只要几毫秒
List<(MapModel, double)> fast = await mapper.TryGetMapsWithNameCache("近月少女的礼仪", 0.8);

mapper.Dispose(); //释放资源

按名字搜索时,原名、英文名与中文名都可以,名字会先归一化(全角转半角、统一大小写、去掉空白) 再比较,规则与建库时一致。

按名字搜索的两个接口

两者结果完全一致,区别只在时间与内存的取舍:

方法 首次 之后每次 常驻内存
TryGetMapsWithName 约100ms 约100ms 不占
TryGetMapsWithNameCache 约110ms建索引 几毫秒 约23MB

TryGetMapsWithName不建也不用索引,title表一行一行读出来比完就扔,整张表不会同时堆在内存里。 只查一两次、或者不想让那23MB一直占着的话用这个。

TryGetMapsWithNameCache第一次调用会把title表读进内存建索引(十几万个名字),之后的搜索都在内存里做。 介意首次那一下耗时的话,可以提前调PreloadTitlesAsync()预热。适合搜索框这种要反复查的场景。

关于映射结果

MapModel里各库的Id为0表示没匹配到,Similarity是两边游戏名的相似度,越接近1越可信。 各阈值下的正确率与召回率见项目README, 一般卡Similarity >= 0.8就能有98%以上的正确率。

只需要表结构、想自己写查询的话,可以只装 PotatoVnDBMapper.Models。

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on PotatoVnDBMapper:

Repository Stars
GoldenPotato137/PotatoVN
一款Visual Novel管理软件
Version Downloads Last Updated
1.1.1 221 8/13/2026
1.0.4 2,333 4/9/2025
1.0.3 228 4/2/2025
1.0.2 231 3/31/2025
1.0.1 226 3/31/2025