Commit 5491a5a2 authored by keyongyu's avatar keyongyu

2.3.0.0

parent 42aea75b
......@@ -231,7 +231,7 @@ private void InitializeComponent()
this.fctb.Font = new System.Drawing.Font("Consolas", 14.25F);
this.fctb.ForeColor = System.Drawing.Color.GhostWhite;
this.fctb.Hotkeys = resources.GetString("fctb.Hotkeys");
this.fctb.IndentBackColor = System.Drawing.SystemColors.WindowFrame;
this.fctb.IndentBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
this.fctb.IsReplaceMode = false;
this.fctb.Language = FastColoredTextBoxNS.Language.Lua;
this.fctb.LeftBracket = '(';
......
using System;
using System.Xml;
using System.IO;
using DataEditorX.Common;
using System.Windows.Forms;
using System.Diagnostics;
using System.Reflection;
namespace DataEditorX.Common
{
public class XMLReader
{
#region XML操作config
/// <summary>
/// 保存值
/// </summary>
/// <param name="appKey"></param>
/// <param name="appValue"></param>
public static void Save(string appKey, string appValue)
{
XmlDocument xDoc = new XmlDocument();
xDoc.Load(System.Windows.Forms.Application.ExecutablePath + ".config");
XmlNode xNode = xDoc.SelectSingleNode("//appSettings");
XmlElement xElem = (XmlElement)xNode.SelectSingleNode("//add[@key='" + appKey + "']");
if (xElem != null) //存在,则更新
xElem.SetAttribute("value", appValue);
else//不存在,则插入
{
XmlElement xNewElem = xDoc.CreateElement("add");
xNewElem.SetAttribute("key", appKey);
xNewElem.SetAttribute("value", appValue);
xNode.AppendChild(xNewElem);
}
xDoc.Save(System.Windows.Forms.Application.ExecutablePath + ".config");
}
/// <summary>
/// 获取值
/// </summary>
/// <param name="appKey"></param>
/// <returns></returns>
public static string GetAppConfig(string appKey)
{
XmlDocument xDoc = new XmlDocument();
xDoc.Load(System.Windows.Forms.Application.ExecutablePath + ".config");
XmlNode xNode = xDoc.SelectSingleNode("//appSettings");
XmlElement xElem = (XmlElement)xNode.SelectSingleNode("//add[@key='" + appKey + "']");
if (xElem != null)
{
return xElem.Attributes["value"].Value;
}
return string.Empty;
}
#endregion
}
}
......@@ -11,7 +11,7 @@ namespace DataEditorX.Config
/// <summary>
/// 配置
/// </summary>
public class MyConfig
public class MyConfig : XMLReader
{
#region 常量
/// <summary>
......@@ -241,53 +241,7 @@ public static bool readBoolean(string key)
return false;
}
#endregion
#region XML操作config
/// <summary>
/// 保存值
/// </summary>
/// <param name="appKey"></param>
/// <param name="appValue"></param>
public static void Save(string appKey, string appValue)
{
XmlDocument xDoc = new XmlDocument();
xDoc.Load(System.Windows.Forms.Application.ExecutablePath + ".config");
XmlNode xNode = xDoc.SelectSingleNode("//appSettings");
XmlElement xElem = (XmlElement)xNode.SelectSingleNode("//add[@key='" + appKey + "']");
if (xElem != null) //存在,则更新
xElem.SetAttribute("value", appValue);
else//不存在,则插入
{
XmlElement xNewElem = xDoc.CreateElement("add");
xNewElem.SetAttribute("key", appKey);
xNewElem.SetAttribute("value", appValue);
xNode.AppendChild(xNewElem);
}
xDoc.Save(System.Windows.Forms.Application.ExecutablePath + ".config");
}
/// <summary>
/// 获取值
/// </summary>
/// <param name="appKey"></param>
/// <returns></returns>
public static string GetAppConfig(string appKey)
{
XmlDocument xDoc = new XmlDocument();
xDoc.Load(System.Windows.Forms.Application.ExecutablePath + ".config");
XmlNode xNode = xDoc.SelectSingleNode("//appSettings");
XmlElement xElem = (XmlElement)xNode.SelectSingleNode("//add[@key='" + appKey + "']");
if (xElem != null)
{
return xElem.Attributes["value"].Value;
}
return string.Empty;
}
#endregion
/// <summary>
/// 语言配置文件名
......
......@@ -4,6 +4,7 @@
* ModiftyDate :2014-02-12
*/
using System;
using System.Globalization;
using System.Text.RegularExpressions;
using DataEditorX.Core.Info;
......@@ -12,6 +13,8 @@ namespace DataEditorX.Core
public struct Card : IEquatable<Card>
{
public const int STR_MAX = 0x10;
public const int SETCODE_MAX = 4;
#region 构造
/// <summary>
/// 卡片
......@@ -20,7 +23,6 @@ public struct Card : IEquatable<Card>
/// <param name="cardName">名字</param>
public Card(long cardCode)
{
this.id = cardCode;
this.name = "";
this.ot = 0;
......@@ -34,18 +36,10 @@ public Card(long cardCode)
this.attribute = 0;
this.category = 0;
this.desc = "";
int i;
this.str = new string[STR_MAX];
for (i = 0; i < STR_MAX; i++)
str[i] = "";
for (int i = 0; i < STR_MAX; i++)
this.str[i] = "";
}
public void InitStrs()
{
int i;
this.str = new string[STR_MAX];
for (i = 0; i < STR_MAX; i++)
str[i] = "";
}
#endregion
#region 成员
......@@ -75,9 +69,59 @@ public void InitStrs()
public string name;
/// <summary>描述文本</summary>
public string desc;
/// <summary>脚本文件组</summary>
public string[] str;
#endregion
string[] str;
/// <summary>脚本文件文字</summary>
public string[] Str
{
get {
if (this.str == null)
{
this.str = new string[STR_MAX];
for (int i = 0; i < STR_MAX; i++)
this.str[i] = "";
}
return this.str;
}
set { this.str = value; }
}
public long[] GetSetCode()
{
long[] setcodes = new long[SETCODE_MAX];
for (int i = 0,k=0; i < SETCODE_MAX; k +=0x10,i++)
{
setcodes[i] = (this.setcode >> k) & 0xffff;
}
return setcodes;
}
public void SetSetCode(params long[] setcodes)
{
int i = 0;
this.setcode = 0;
if (setcodes != null)
{
foreach (long sc in setcodes)
{
this.setcode += (sc << i);
i += 0x10;
}
}
}
public void SetSetCode(params string[] setcodes)
{
int i = 0;
this.setcode = 0;
long temp;
if (setcodes != null)
{
foreach (string sc in setcodes)
{
long.TryParse(sc, NumberStyles.HexNumber, null, out temp);
this.setcode += (temp << i);
i += 0x10;
}
}
}
#endregion
#region 比较、哈希值、操作符
/// <summary>
......
......@@ -146,7 +146,7 @@ static Card ReadCard(SQLiteDataReader reader,bool reNewLine)
for ( int i = 0; i < 0x10; i++ )
{
temp = reader.GetString(reader.GetOrdinal("str"+(i+1).ToString()));
c.str[i]= ( temp == null ) ? "":temp;
c.Str[i]= ( temp == null ) ? "":temp;
}
return c;
}
......@@ -354,8 +354,7 @@ public static string GetInsertSQL(Card c, bool ignore)
{
if (c == null)
return "";
if (c.str == null)
c.InitStrs();
StringBuilder st = new StringBuilder();
if(ignore)
st.Append("INSERT or ignore into datas values(");
......@@ -381,7 +380,7 @@ public static string GetInsertSQL(Card c, bool ignore)
st.Append(c.desc.Replace("'", "''"));
for ( int i = 0; i < 0x10; i++ )
{
st.Append("','"); st.Append(c.str[i].Replace("'", "''"));
st.Append("','"); st.Append(c.Str[i].Replace("'", "''"));
}
st.Append("');");
string sql = st.ToString();
......@@ -401,8 +400,7 @@ public static string GetUpdateSQL(Card c)
StringBuilder st = new StringBuilder();
if (c == null)
return "";
if (c.str == null)
c.InitStrs();
st.Append("update datas set ot="); st.Append(c.ot.ToString());
st.Append(",alias="); st.Append(c.alias.ToString());
st.Append(",setcode="); st.Append(c.setcode.ToString());
......@@ -419,7 +417,7 @@ public static string GetUpdateSQL(Card c)
for ( int i = 0; i < 0x10; i++ )
{
st.Append("str"); st.Append(( i + 1 ).ToString()); st.Append("='");
st.Append(c.str[i].Replace("'", "''"));
st.Append(c.Str[i].Replace("'", "''"));
if ( i < 15 )
{
st.Append("',");
......
This diff is collapsed.
......@@ -278,16 +278,11 @@ void InitCheckPanel(FlowLayoutPanel fpanel, Dictionary<long, string> dic)
_cbox.Text = dic[key];
_cbox.AutoSize = true;
_cbox.Margin = fpanel.Margin;
_cbox.Click += PanelOnCheckClick;
//_cbox.Click += PanelOnCheckClick;
fpanel.Controls.Add(_cbox);
}
fpanel.ResumeLayout(false);
fpanel.PerformLayout();
}
//FlowLayoutPanel点击CheckBox
void PanelOnCheckClick(object sender, EventArgs e)
{
}
//初始化ComboBox
void InitComboBox(ComboBox cb, Dictionary<long, string> tempdic)
......@@ -325,10 +320,10 @@ void InitListRows()
MaxRow = 20;
}
//设置checkbox
string SetCheck(FlowLayoutPanel fpl, long number)
void SetCheck(FlowLayoutPanel fpl, long number)
{
long temp;
string strType = "";
//string strType = "";
foreach (Control c in fpl.Controls)
{
if (c is CheckBox)
......@@ -342,13 +337,13 @@ string SetCheck(FlowLayoutPanel fpl, long number)
if ((temp & number) == temp && temp != 0)
{
cbox.Checked = true;
strType += "/" + c.Text;
//strType += "/" + c.Text;
}
else
cbox.Checked = false;
}
}
return strType;
//return strType;
}
//设置combobox
void SetSelect(ComboBox cb, long k)
......@@ -453,15 +448,14 @@ public Card GetOldCard()
public void SetCard(Card c)
{
oldCard = c;
if (c.str == null)
c.InitStrs();
tb_cardname.Text = c.name;
tb_cardtext.Text = c.desc;
strs = new string[c.str.Length];
Array.Copy(c.str, strs, c.str.Length);
strs = new string[c.Str.Length];
Array.Copy(c.Str, strs, Card.STR_MAX);
lb_scripttext.Items.Clear();
lb_scripttext.Items.AddRange(c.str);
lb_scripttext.Items.AddRange(c.Str);
tb_edittext.Text = "";
//data
SetSelect(cb_cardrule, c.ot);
......@@ -469,18 +463,11 @@ public void SetCard(Card c)
SetSelect(cb_cardlevel, (c.level & 0xff));
SetSelect(cb_cardrace, c.race);
//setcode
long sc1 = c.setcode & 0xffff;
long sc2 = (c.setcode >> 0x10) & 0xffff;
long sc3 = (c.setcode >> 0x20) & 0xffff;
long sc4 = (c.setcode >> 0x30) & 0xffff;
tb_setcode1.Text = sc1.ToString("x");
tb_setcode2.Text = sc2.ToString("x");
tb_setcode3.Text = sc3.ToString("x");
tb_setcode4.Text = sc4.ToString("x");
//SetSelect(cb_setname1, sc1);
//SetSelect(cb_setname2, sc2);
//SetSelect(cb_setname3, sc3);
//SetSelect(cb_setname4, sc4);
long[] setcodes = c.GetSetCode();
tb_setcode1.Text = setcodes[0].ToString("x");
tb_setcode2.Text = setcodes[1].ToString("x");
tb_setcode3.Text = setcodes[2].ToString("x");
tb_setcode4.Text = setcodes[3].ToString("x");
//type,category
SetCheck(pl_cardtype, c.type);
SetCheck(pl_category, c.category);
......@@ -504,23 +491,18 @@ public Card GetCard()
c.name = tb_cardname.Text;
c.desc = tb_cardtext.Text;
Array.Copy(strs, c.str, c.str.Length);
Array.Copy(strs, c.Str, Card.STR_MAX);
c.ot = (int)GetSelect(cb_cardrule);
c.attribute = (int)GetSelect(cb_cardattribute);
c.level = (int)GetSelect(cb_cardlevel);
c.race = (int)GetSelect(cb_cardrace);
//setcode
int.TryParse(tb_setcode1.Text, NumberStyles.HexNumber, null, out temp);
c.setcode = temp;
int.TryParse(tb_setcode2.Text, NumberStyles.HexNumber, null, out temp);
c.setcode += ((long)temp << 0x10);
int.TryParse(tb_setcode3.Text, NumberStyles.HexNumber, null, out temp);
c.setcode += ((long)temp << 0x20);
int.TryParse(tb_setcode4.Text, NumberStyles.HexNumber, null, out temp);
c.setcode += ((long)temp << 0x30);
//c.setcode = getSetcodeByText();
//系列
c.SetSetCode(
tb_setcode1.Text,
tb_setcode2.Text,
tb_setcode3.Text,
tb_setcode4.Text);
c.type = GetCheck(pl_cardtype);
c.category = GetCheck(pl_category);
......
......@@ -69,6 +69,7 @@
</Compile>
<Compile Include="Common\CheckUpdate.cs" />
<Compile Include="Common\ConfHelper.cs" />
<Compile Include="Common\XMLReader.cs" />
<Compile Include="Config\YgoPath.cs" />
<Compile Include="Controls\DoubleContorl.cs">
<SubType>Component</SubType>
......
......@@ -86,7 +86,7 @@ private void InitializeComponent()
this.dockPanel1.Location = new System.Drawing.Point(0, 25);
this.dockPanel1.Margin = new System.Windows.Forms.Padding(0);
this.dockPanel1.Name = "dockPanel1";
this.dockPanel1.Size = new System.Drawing.Size(868, 572);
this.dockPanel1.Size = new System.Drawing.Size(864, 573);
dockPanelGradient1.EndColor = System.Drawing.SystemColors.ControlLight;
dockPanelGradient1.StartColor = System.Drawing.SystemColors.ControlLight;
autoHideStripSkin1.DockStripGradient = dockPanelGradient1;
......@@ -143,7 +143,7 @@ private void InitializeComponent()
this.mainMenu.Location = new System.Drawing.Point(0, 0);
this.mainMenu.MdiWindowListItem = this.menuitem_windows;
this.mainMenu.Name = "mainMenu";
this.mainMenu.Size = new System.Drawing.Size(868, 25);
this.mainMenu.Size = new System.Drawing.Size(864, 25);
this.mainMenu.TabIndex = 3;
this.mainMenu.Text = "mainMenu";
//
......@@ -335,7 +335,7 @@ private void InitializeComponent()
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.BackColor = System.Drawing.SystemColors.Control;
this.ClientSize = new System.Drawing.Size(868, 597);
this.ClientSize = new System.Drawing.Size(864, 598);
this.Controls.Add(this.dockPanel1);
this.Controls.Add(this.mainMenu);
this.IsMdiContainer = true;
......
......@@ -505,12 +505,13 @@ private void bgWorker1_DoWork(object sender, System.ComponentModel.DoWorkEventAr
{
Init();
}
#endregion
private void bgWorker1_RunWorkerCompleted(object sender, System.ComponentModel.RunWorkerCompletedEventArgs e)
{
//更新UI
InitForm();
}
#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.9.9")]
[assembly: AssemblyVersion("2.3.0.0")]
......@@ -21,7 +21,7 @@
<!-- DataEditorX update url-->
<add key="updateURL" value="https://github.com/247321453/DataEditorX/tree/master/win32/readme.txt" />
<!-- delete,modify with card's files image script -->
<add key="opera_with_cards_file" value="false" />
<add key="opera_with_cards_file" value="true" />
<!-- open file in this.such as lua -->
<add key="open_file_in_this" value="true" />
<!-- Cut Images Setting -->
......
★更新历史
2.3.0.0
调整界面
2.2.9.9
添加开始的时候,异步加载数据
改进CodeEditor的代码提示和函数搜索
......
[DataEditorX]2.2.9.9[DataEditorX]
[DataEditorX]2.3.0.0[DataEditorX]
[URL]https://github.com/247321453/DataEditorX/raw/master/win32/win32.zip[URL]
★运行环境(Environment)
......
No preview for this file type
......@@ -21,7 +21,7 @@
<!-- DataEditorX update url-->
<add key="updateURL" value="https://github.com/247321453/DataEditorX/tree/master/win32/readme.txt" />
<!-- delete,modify with card's files image script -->
<add key="opera_with_cards_file" value="false" />
<add key="opera_with_cards_file" value="true" />
<!-- open file in this.such as lua -->
<add key="open_file_in_this" value="true" />
<!-- Cut Images Setting -->
......
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<connectionStrings>
<!-- Example connection to a SQL Server Database on localhost. -->
<!-- <add name="ExampleConnectionString"
<connectionStrings>
<!-- Example connection to a SQL Server Database on localhost. -->
<!-- <add name="ExampleConnectionString"
connectionString="Data Source=.;Initial Catalog=DBName;Integrated Security=True"
providerName="System.Data.SqlClient" /> -->
</connectionStrings>
<appSettings>
<!-- access these values via the property:
</connectionStrings>
<appSettings>
<!-- access these values via the property:
System.Configuration.ConfigurationManager.AppSettings[key]
-->
<!-- MSE language data/mse_xxx.txt -->
<add key="mse" value="Chinese-Simplified" />
<!-- MSE language data/mse_xxx.txt -->
<add key="mse" value="Chinese-Simplified" />
<!-- Language data/cardinfo_xxxx.txt data/language_xxx.txt -->
<add key="language" value="chinese" />
<!-- DataEditorX source code -->
<add key="sourceURL" value="https://github.com/247321453/DataEditorX" />
<!-- DataEditorX update url-->
<add key="updateURL" value="https://github.com/247321453/DataEditorX/tree/master/win32/readme.txt" />
<!-- async load data -->
<add key="async" value="false" />
<!-- DataEditorX source code -->
<add key="sourceURL" value="https://github.com/247321453/DataEditorX" />
<!-- DataEditorX update url-->
<add key="updateURL" value="https://github.com/247321453/DataEditorX/tree/master/win32/readme.txt" />
<!-- delete,modify with card's files image script -->
<add key="opera_with_cards_file" value="true" />
<!-- open file in this.such as lua -->
<add key="open_file_in_this" value="true" />
<!-- Cut Images Setting -->
<add key="image_quilty" value="100" />
<add key="image" value="44,64,177,254" />
<add key="image_other" value="25,54,128,128" />
<add key="image_xyz" value="24,51,128,128" />
<add key="image_pendulum" value="14,46,149,120" />
<!-- CodeEdiotr Setting
<add key="image_quilty" value="100" />
<add key="image" value="44,64,177,254" />
<add key="image_other" value="25,54,128,128" />
<add key="image_xyz" value="24,51,128,128" />
<add key="image_pendulum" value="14,46,149,120" />
<!-- CodeEdiotr Setting
IME = true 使用輸入法,正常顯示文字,反應變慢
IME = false English
-->
<add key="IME" value="false" />
<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>
<add key="fontname" value="Consolas" />
<add key="fontsize" value="14.5" />
</appSettings>
</configuration>
\ No newline at end of file
★更新历史
2.3.0.0
调整界面
2.2.9.9
添加开始的时候,异步加载数据
改进CodeEditor的代码提示和函数搜索
......
[DataEditorX]2.2.9.9[DataEditorX]
[DataEditorX]2.3.0.0[DataEditorX]
[URL]https://github.com/247321453/DataEditorX/raw/master/win32/win32.zip[URL]
★运行环境(Environment)
......
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