Commit 14d0780e authored by nanahira's avatar nanahira

add protections in database reading

parent 73350c43
......@@ -16,7 +16,7 @@ namespace YGOSharp
public static string nullString = "";
internal static void initialize(string databaseFullPath)
internal static bool initialize(string databaseFullPath)
{
nullName = InterString.Get("未知卡片");
nullString = "";
......@@ -27,6 +27,8 @@ namespace YGOSharp
nullString += "更多关于电脑/安卓版KoishiPro及7210服务器的信息可加QQ群338443272";
nullString += "\r\n\r\n";
nullString += "喜欢游戏王DIY的朋友欢迎来222服QQ群642043095";
bool success = true;
try {
using (SqliteConnection connection = new SqliteConnection("Data Source=" + databaseFullPath))
{
connection.Open();
......@@ -43,6 +45,11 @@ namespace YGOSharp
}
}
}
catch (System.Exception e) {
success = false;
}
return success;
}
internal static Card GetCard(int id)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment