Commit b5418e49 authored by 花桃白音's avatar 花桃白音

add file(lua&jpg) check

parent eaad5ce3
No preview for this file type
......@@ -348,6 +348,7 @@ namespace cardvisa
{
if (File.Exists(pathName))
{
string lostedFiles = "缺少文件:";
string constr = "Data Source=" + pathName + ";";
SqliteDataContext db = new SqliteDataContext(constr);
var datassets = (from q1 in db.Datarows select q1).ToList();
......@@ -359,10 +360,25 @@ namespace cardvisa
for (int i = 0; i < cardcounts; i++)
{
var cardd = datassets[i];
var code = cardd.id;
var cti = new CardTypeInfo(cardd.type);
if (cardd.alias == 0 && cti.IsNeedScript())//非同名卡
{
string parentpath = Path.GetDirectoryName(pathName);
if (!File.Exists(parentpath + "\\script\\c" + code + ".lua"))
{
lostedFiles += "\r\n" + (code.ToString() + ":lua");
}
if (!File.Exists(parentpath + "\\pics\\" + code + ".jpg"))
{
lostedFiles += "\r\n" + (code.ToString() + ":pic");
}
}
cdbh.Add(new sqldata(cardd.id, DateTime.Now, textssets[i], cardd, false));
}
PageFillList();
LflistReader();
richTextBox1.Text = lostedFiles;
}
}
public void PageFillList(int page = 0)
......@@ -1037,7 +1053,7 @@ namespace cardvisa
if (button3.Text == "关闭库")
{
int index = this.listBox1.IndexFromPoint(e.Location);
if (index != ListBox.NoMatches)
if (index != ListBox.NoMatches && index != 0)
{
sqldata sqd = cdbh.cmds[GetCardFromListID()];
string path = Path.GetDirectoryName(cdbh.openedfile);
......@@ -1440,7 +1456,7 @@ namespace cardvisa
else//直接添加数据
{
Add(new sqldata(code, fsinfo.LastWriteTime, cardt, cardd, packDIY), iflegaltype);
}
}
}
db.Dispose();
}
......@@ -1654,6 +1670,31 @@ namespace cardvisa
}
return true;
}
public bool IsNeedScript()
{
if (cardTypeDict.ContainsKey("效果"))
{
return true;
}
else {
if (cardTypeDict.ContainsKey("通常"))
{
return false;
}
else
{
if (cardTypeDict.ContainsKey("魔法") || cardTypeDict.ContainsKey("陷阱"))
{
return true;
}
else
{
//ex白板、衍生物
return false;
}
}
}
}
public string CardTypeFormat(string ex = "", string patt = "|", string name = "type", string prefix = "", string suffix = "")
{
string rt = "";
......
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