Commit 77d7c7ae authored by keyongyu's avatar keyongyu

2.2.7.3

parent 79c92359
......@@ -40,6 +40,7 @@ public partial class CodeEditForm : DockContent
string title;
string oldtext;
Dictionary<string,string> tooltipDic;
bool tabisspaces = false;
public CodeEditForm()
{
InitForm();
......@@ -81,10 +82,25 @@ void InitForm()
if(float.TryParse(ConfigurationManager.AppSettings["fontsize"]
, out fontsize))
fctb.Font=new Font(fontname,fontsize);
if(ConfigurationManager.AppSettings["IME"].ToLower()=="true")
if(ReadConfig("IME").ToLower()=="true")
fctb.ImeMode=ImeMode.On;
if (ReadConfig("wordwrap").ToLower() == "true")
fctb.WordWrap = true;
else
fctb.WordWrap = false;
if (ReadConfig("tabisspace").ToLower() == "true")
tabisspaces = true;
else
tabisspaces = false;
}
string ReadConfig(string key)
{
string v = ConfigurationManager.AppSettings[key];
if (string.IsNullOrEmpty(v))
return "";
else
return v;
}
public void LoadXml(string xmlfile)
{
fctb.DescriptionFile=xmlfile;
......@@ -297,37 +313,35 @@ void Menuitem_replaceClick(object sender, EventArgs e)
{
fctb.ShowReplaceDialog();
}
public void Save()
bool savefile(bool saveas)
{
string alltext = fctb.Text;
if(!tabisspaces)
alltext = alltext.Replace(" ", "\t");
if (saveas)
{
using (SaveFileDialog sfdlg = new SaveFileDialog())
{
sfdlg.Filter = "Script(*.lua)|*.lua|All Files(*.*)|*.*";
if (sfdlg.ShowDialog() == DialogResult.OK)
{
nowFile = sfdlg.FileName;
SetTitle();
}
else
return false;
}
}
File.WriteAllText(nowFile, alltext, new UTF8Encoding(false));
return true;
}
public bool Save()
{
if(string.IsNullOrEmpty(nowFile))
{
using(SaveFileDialog sfdlg=new SaveFileDialog())
{
sfdlg.Filter="Script(*.lua)|*.lua|All Files(*.*)|*.*";
if(sfdlg.ShowDialog()==DialogResult.OK)
{
nowFile=sfdlg.FileName;
SetTitle();
}
else
return;
}
}
fctb.SaveToFile(nowFile, new UTF8Encoding(false));
return savefile(string.IsNullOrEmpty(nowFile));
}
public void SaveAs()
public bool SaveAs()
{
using(SaveFileDialog sfdlg=new SaveFileDialog())
{
sfdlg.Filter="Script(*.lua)|*.lua|All Files(*.*)|*.*";
if(sfdlg.ShowDialog()==DialogResult.OK)
{
nowFile=sfdlg.FileName;
}
else
return;
}
fctb.SaveToFile(nowFile, new UTF8Encoding(false));
return savefile(true);
}
void SaveToolStripMenuItemClick(object sender, EventArgs e)
......
......@@ -129,6 +129,7 @@
<ItemGroup>
<None Include="app.config">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
<SubType>Designer</SubType>
</None>
<None Include="chinese\card-attribute.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
......
......@@ -83,7 +83,7 @@ void Init(string datapath)
public const int MAX_HISTORY=0x20;
public static bool isScript(string file)
{
if(file.EndsWith("lua",StringComparison.OrdinalIgnoreCase))
if(file!=null && file.EndsWith("lua",StringComparison.OrdinalIgnoreCase))
return true;
return false;
}
......@@ -479,8 +479,8 @@ void Menuitem_saveClick(object sender, EventArgs e)
CodeEditForm cf= dockPanel1.ActiveContent as CodeEditForm;
if(cf!=null)
{
cf.Save();
MyMsg.Show(LMSG.SaveFileOK);
if(cf.Save())
MyMsg.Show(LMSG.SaveFileOK);
}
}
#endregion
......
......@@ -28,4 +28,4 @@
//
// You can specify all the values or you can use the default the Revision and
// Build Numbers by using the '*' as shown below:
[assembly: AssemblyVersion("2.2.7.2")]
[assembly: AssemblyVersion("2.2.7.3")]
......@@ -27,6 +27,8 @@
IME = false English
-->
<add key="IME" value="false" />
<add key="wordwrap" value="true" />
<add key="tabisspace" value="false" />
<add key="fontname" value="Consolas" />
<add key="fontsize" value="14.5" />
</appSettings>
......
[DataEditorX]2.2.7.2[DataEditorX]
[DataEditorX]2.2.7.3[DataEditorX]
[URL]https://github.com/247321453/DataEditorX/raw/master/win32/win32.zip[URL]
★文件关联
......@@ -58,6 +58,8 @@ Ctrl+鼠标左键 跳转到函数定义
Ctrl+鼠标滑轮 缩放文字
★更新历史
2.2.7.3
lua编辑器,4个空格转换为tab键
2.2.7.2
打开脚本,重复的时候,显示标签
2.2.7.1
......
No preview for this file type
......@@ -27,6 +27,8 @@
IME = false English
-->
<add key="IME" value="false" />
<add key="wordwrap" value="true" />
<add key="tabisspace" value="false" />
<add key="fontname" value="Consolas" />
<add key="fontsize" value="14.5" />
</appSettings>
......
......@@ -27,6 +27,8 @@
IME = false English
-->
<add key="IME" value="false" />
<add key="wordwrap" value="true" />
<add key="tabisspace" value="false" />
<add key="fontname" value="Consolas" />
<add key="fontsize" value="14.5" />
</appSettings>
......
# history
F:\games\ygopro\script\c50485594.lua
F:\games\ygopro\script\c17857780.lua
F:\games\ygopro\script\c47198668.lua
F:\games\ygopro\script\c27551.lua
F:\games\ygopro\cards.cdb
F:\games\ygopro\p.zip.cdb
F:\games\ygopro\script\c168917.lua
F:\games\ygopro\script\c47198668.lua
F:\games\ygopro\script\c50485594.lua
F:\games\ygopro\script\c65518099.lua
F:\games\ygopro\p.zip.cdb
F:\games\ygopro\script\c64496451.lua
F:\games\ygopro\script\c78835747.lua
\ No newline at end of file
[DataEditorX]2.2.7.2[DataEditorX]
[DataEditorX]2.2.7.3[DataEditorX]
[URL]https://github.com/247321453/DataEditorX/raw/master/win32/win32.zip[URL]
★文件关联
......@@ -58,6 +58,8 @@ Ctrl+鼠标左键 跳转到函数定义
Ctrl+鼠标滑轮 缩放文字
★更新历史
2.2.7.3
lua编辑器,4个空格转换为tab键
2.2.7.2
打开脚本,重复的时候,显示标签
2.2.7.1
......
No preview for this file type
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