Commit 6874592a authored by JoyJ's avatar JoyJ

try to fix linux openfiledialog filter bug

parent 2d7bbbb9
......@@ -353,8 +353,12 @@ bool savefile(bool saveas)
if (saveas)
{
using (SaveFileDialog sfdlg = new SaveFileDialog())
{
try
{
sfdlg.Filter = LanguageHelper.GetMsg(LMSG.ScriptFilter);
}
catch { }
if (sfdlg.ShowDialog() == DialogResult.OK)
{
this.nowFile = sfdlg.FileName;
......@@ -445,8 +449,12 @@ void AboutToolStripMenuItemClick(object sender, EventArgs e)
void Menuitem_openClick(object sender, EventArgs e)
{
using (OpenFileDialog sfdlg = new OpenFileDialog())
{
try
{
sfdlg.Filter = LanguageHelper.GetMsg(LMSG.ScriptFilter);
}
catch { }
if (sfdlg.ShowDialog() == DialogResult.OK)
{
this.nowFile = sfdlg.FileName;
......
......@@ -1129,7 +1129,11 @@ void Menuitem_openClick(object sender, EventArgs e)
using (OpenFileDialog dlg = new OpenFileDialog())
{
dlg.Title = LanguageHelper.GetMsg(LMSG.SelectDataBasePath);
try
{
dlg.Filter = LanguageHelper.GetMsg(LMSG.CdbType);
}
catch { }
if (dlg.ShowDialog() == DialogResult.OK)
{
this.Open(dlg.FileName);
......@@ -1142,7 +1146,11 @@ void Menuitem_newClick(object sender, EventArgs e)
using (SaveFileDialog dlg = new SaveFileDialog())
{
dlg.Title = LanguageHelper.GetMsg(LMSG.SelectDataBasePath);
try
{
dlg.Filter = LanguageHelper.GetMsg(LMSG.CdbType);
}
catch { }
if (dlg.ShowDialog() == DialogResult.OK)
{
if (DataBase.Create(dlg.FileName))
......@@ -1166,7 +1174,11 @@ void Menuitem_readydkClick(object sender, EventArgs e)
using (OpenFileDialog dlg = new OpenFileDialog())
{
dlg.Title = LanguageHelper.GetMsg(LMSG.SelectYdkPath);
try
{
dlg.Filter = LanguageHelper.GetMsg(LMSG.ydkType);
}
catch { }
if (dlg.ShowDialog() == DialogResult.OK)
{
this.tmpCodes.Clear();
......@@ -1379,7 +1391,11 @@ void CopyTo(Card[] cards)
using (OpenFileDialog dlg = new OpenFileDialog())
{
dlg.Title = LanguageHelper.GetMsg(LMSG.SelectDataBasePath);
try
{
dlg.Filter = LanguageHelper.GetMsg(LMSG.CdbType);
}
catch { }
if (dlg.ShowDialog() == DialogResult.OK)
{
filename = dlg.FileName;
......@@ -1446,7 +1462,11 @@ void SaveAsMSE(bool onlyselect)
using (SaveFileDialog dlg = new SaveFileDialog())
{
dlg.Title = LanguageHelper.GetMsg(LMSG.selectMseset);
try
{
dlg.Filter = LanguageHelper.GetMsg(LMSG.MseType);
}
catch { }
if (dlg.ShowDialog() == DialogResult.OK)
{
bool isUpdate = false;
......@@ -1473,7 +1493,11 @@ void ImportImageFromSelect()
using (OpenFileDialog dlg = new OpenFileDialog())
{
dlg.Title = LanguageHelper.GetMsg(LMSG.SelectImage) + "-" + this.tb_cardname.Text;
try
{
dlg.Filter = LanguageHelper.GetMsg(LMSG.ImageType);
}
catch { }
if (dlg.ShowDialog() == DialogResult.OK)
{
//dlg.FileName;
......@@ -1605,7 +1629,11 @@ void Menuitem_exportdataClick(object sender, EventArgs e)
using (SaveFileDialog dlg = new SaveFileDialog())
{
dlg.InitialDirectory = this.ygopath.gamepath;
try
{
dlg.Filter = "Zip|(*.zip|All Files(*.*)|*.*";
}
catch { }
if (dlg.ShowDialog() == DialogResult.OK)
{
this.tasker.SetTask(MyTask.ExportData,
......@@ -1855,7 +1883,11 @@ private void menuitem_readmse_Click(object sender, EventArgs e)
using (OpenFileDialog dlg = new OpenFileDialog())
{
dlg.Title = LanguageHelper.GetMsg(LMSG.selectMseset);
try
{
dlg.Filter = LanguageHelper.GetMsg(LMSG.MseType);
}
catch { }
if (dlg.ShowDialog() == DialogResult.OK)
{
bool isUpdate = MyMsg.Question(LMSG.IfReplaceExistingImage);
......@@ -1988,7 +2020,11 @@ void Menuitem_exportMSEimageClick(object sender, EventArgs e)
using (OpenFileDialog dlg = new OpenFileDialog())
{
dlg.Title = LanguageHelper.GetMsg(LMSG.selectMseset);
try
{
dlg.Filter = LanguageHelper.GetMsg(LMSG.MseType);
}
catch { }
if (dlg.ShowDialog() == DialogResult.OK)
{
string mseset=dlg.FileName;
......@@ -2045,7 +2081,11 @@ void Menuitem_autoreturnClick(object sender, EventArgs e)
using (SaveFileDialog dlg = new SaveFileDialog())
{
dlg.Title = LanguageHelper.GetMsg(LMSG.SelectDataBasePath);
try
{
dlg.Filter = LanguageHelper.GetMsg(LMSG.CdbType);
}
catch { }
if (dlg.ShowDialog() == DialogResult.OK)
{
Card[] cards = DataBase.Read(this.nowCdbFile, true, "");
......@@ -2083,7 +2123,11 @@ void Menuitem_replaceClick(object sender, EventArgs e)
using (SaveFileDialog dlg = new SaveFileDialog())
{
dlg.Title = LanguageHelper.GetMsg(LMSG.SelectDataBasePath);
try
{
dlg.Filter = LanguageHelper.GetMsg(LMSG.CdbType);
}
catch { }
if (dlg.ShowDialog() == DialogResult.OK)
{
Card[] cards = DataBase.Read(this.nowCdbFile, true, "");
......
......@@ -344,13 +344,21 @@ void Menuitem_openClick(object sender, EventArgs e)
{
dlg.Title = LanguageHelper.GetMsg(LMSG.OpenFile);
if (this.GetActive() != null || this.dockPanel.Contents.Count == 0)//判断当前窗口是不是DataEditor
{
try
{
dlg.Filter = LanguageHelper.GetMsg(LMSG.CdbType);
}
catch { }
}
else
{
try
{
dlg.Filter = LanguageHelper.GetMsg(LMSG.ScriptFilter);
}
catch { }
}
if (dlg.ShowDialog() == DialogResult.OK)
{
......@@ -372,13 +380,21 @@ void Menuitem_newClick(object sender, EventArgs e)
{
dlg.Title = LanguageHelper.GetMsg(LMSG.NewFile);
if (this.GetActive() != null)//判断当前窗口是不是DataEditor
{
try
{
dlg.Filter = LanguageHelper.GetMsg(LMSG.CdbType);
}
catch { }
}
else
{
try
{
dlg.Filter = LanguageHelper.GetMsg(LMSG.ScriptFilter);
}
catch { }
}
if (dlg.ShowDialog() == DialogResult.OK)
{
......
......@@ -173,3 +173,4 @@ MainForm.mainMenu.menuitem_closeall 关闭所有
0x4b 从MSE存档导出图片失败。
0x4c 测试完成,没有发现语法错误。
0x4d 一次性打开大量文件将导致卡顿,是否继续?
0x4e 下载完成,即将重新启动程序以完成更新。
\ No newline at end of file
......@@ -169,3 +169,4 @@ MainForm.mainMenu.menuitem_closeall Close All
0x4b Failed to export MSE-set to images fail.
0x4c No syntax error found.
0x4d It is not recommended to open lots of file at a time. Continue?
0x4e Download completed; the application will be restarted.
\ No newline at end of file
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