Commit 2abe825f authored by JoyJ's avatar JoyJ

More code formats; Now use label as tooltip.

parent bc0829bf
......@@ -51,15 +51,15 @@ void InitForm()
this.tooltipDic = new SortedList<string, string>();
this.InitializeComponent();
//设置字体,大小
string fontname = MyConfig.readString(MyConfig.TAG_FONT_NAME);
float fontsize = MyConfig.readFloat(MyConfig.TAG_FONT_SIZE, this.fctb.Font.Size);
string fontname = MyConfig.ReadString(MyConfig.TAG_FONT_NAME);
float fontsize = MyConfig.ReadFloat(MyConfig.TAG_FONT_SIZE, this.fctb.Font.Size);
this.fctb.Font = new Font(fontname, fontsize);
if (MyConfig.readBoolean(MyConfig.TAG_IME))
if (MyConfig.ReadBoolean(MyConfig.TAG_IME))
{
this.fctb.ImeMode = ImeMode.On;
}
if (MyConfig.readBoolean(MyConfig.TAG_WORDWRAP))
if (MyConfig.ReadBoolean(MyConfig.TAG_WORDWRAP))
{
this.fctb.WordWrap = true;
}
......@@ -68,7 +68,7 @@ void InitForm()
this.fctb.WordWrap = false;
}
if (MyConfig.readBoolean(MyConfig.TAG_TAB2SPACES))
if (MyConfig.ReadBoolean(MyConfig.TAG_TAB2SPACES))
{
this.tabisspaces = true;
}
......@@ -370,7 +370,7 @@ void AboutToolStripMenuItemClick(object sender, EventArgs e)
MyMsg.Show(
LanguageHelper.GetMsg(LMSG.About) + "\t" + Application.ProductName + "\n"
+ LanguageHelper.GetMsg(LMSG.Version) + "\t1.1.0.0\n"
+ LanguageHelper.GetMsg(LMSG.Author) + "\t菜菜");
+ LanguageHelper.GetMsg(LMSG.Author) + "\tNanahira & JoyJ");
}
void Menuitem_openClick(object sender, EventArgs e)
......
......@@ -16,7 +16,7 @@ public class ConfHelper
/// </summary>
/// <param name="line"></param>
/// <returns></returns>
public static string getValue(string line)
public static string GetValue(string line)
{
int t = line.IndexOf('=');
if (t > 0)
......@@ -31,7 +31,7 @@ public static string getValue(string line)
/// </summary>
/// <param name="word"></param>
/// <returns></returns>
public static string getValue1(string word)
public static string GetValue1(string word)
{
int i = word.IndexOf(SEP_LINE);
if (i > 0)
......@@ -46,7 +46,7 @@ public static string getValue1(string word)
/// </summary>
/// <param name="word"></param>
/// <returns></returns>
public static string getValue2(string word)
public static string GetValue2(string word)
{
int i = word.IndexOf(SEP_LINE);
if (i > 0)
......@@ -61,16 +61,16 @@ public static string getValue2(string word)
/// </summary>
/// <param name="line"></param>
/// <returns></returns>
public static string getMultLineValue(string line)
public static string GetMultLineValue(string line)
{
return getRegex(getValue(line));
return GetRegex(GetValue(line));
}
/// <summary>
/// 替换特殊符
/// </summary>
/// <param name="word"></param>
/// <returns></returns>
public static string getRegex(string word)
public static string GetRegex(string word)
{
StringBuilder sb = new StringBuilder(word);
sb.Replace("\\r", "\r");
......@@ -84,9 +84,9 @@ public static string getRegex(string word)
/// </summary>
/// <param name="line"></param>
/// <returns></returns>
public static bool getBooleanValue(string line)
public static bool GetBooleanValue(string line)
{
if (getValue(line).ToLower() == "true")
if (GetValue(line).ToLower() == "true")
{
return true;
}
......@@ -101,12 +101,12 @@ public static bool getBooleanValue(string line)
/// <param name="line"></param>
/// <param name="defalut">失败的值</param>
/// <returns></returns>
public static int getIntegerValue(string line, int defalut)
public static int GetIntegerValue(string line, int defalut)
{
int i;
try
{
i = int.Parse(getValue(line));
i = int.Parse(GetValue(line));
return i;
}
catch{}
......
......@@ -14,7 +14,7 @@ namespace DataEditorX.Common
/// </summary>
public static class MyBitmap
{
public static Bitmap readImage(string file)
public static Bitmap ReadImage(string file)
{
if (!File.Exists(file))
{
......
......@@ -110,7 +110,7 @@ public static string CheckDir(string dir,string defalut)
/// <param name="tag">前面</param>
/// <param name="lang"></param>
/// <returns></returns>
public static string getFileName(string tag,string lang)
public static string GetFileName(string tag,string lang)
{
return tag + "_" + lang + ".txt";
}
......@@ -120,7 +120,7 @@ public static string getFileName(string tag,string lang)
/// <param name="tag"></param>
/// <param name="file"></param>
/// <returns></returns>
public static string getFullFileName(string tag, string file)
public static string GetFullFileName(string tag, string file)
{
string name = Path.GetFileNameWithoutExtension(file);
if (!name.StartsWith(tag + "_"))
......
This diff is collapsed.
......@@ -36,7 +36,7 @@ static string reReturn(string content)
text = text.Replace("\r", "\n");
return text;
}
public static string subString(string content, string tag)
public static string SubString(string content, string tag)
{
Regex reg = new Regex(string.Format(@"{0}{1}\n([\S\s]*?)\n{2}", TAG_START, tag, TAG_END), RegexOptions.Multiline);
Match mac = reg.Match(reReturn(content));
......@@ -57,7 +57,7 @@ public static string subString(string content, string tag)
/// <returns></returns>
public static Dictionary<long, string> Read(string content, string tag)
{
return Read(subString(content,tag));
return Read(SubString(content,tag));
}
/// <summary>
/// 从文件读取内容,按行读取
......
......@@ -23,20 +23,20 @@ public class ImageSet
//初始化
void Init()
{
this.normalArea = MyConfig.readArea(MyConfig.TAG_IMAGE_OTHER);
this.normalArea = MyConfig.ReadArea(MyConfig.TAG_IMAGE_OTHER);
this.xyzArea = MyConfig.readArea(MyConfig.TAG_IMAGE_XYZ);
this.xyzArea = MyConfig.ReadArea(MyConfig.TAG_IMAGE_XYZ);
this.pendulumArea = MyConfig.readArea(MyConfig.TAG_IMAGE_PENDULUM);
this.pendulumArea = MyConfig.ReadArea(MyConfig.TAG_IMAGE_PENDULUM);
int[] ints = MyConfig.readIntegers(MyConfig.TAG_IMAGE_SIZE, 4);
int[] ints = MyConfig.ReadIntegers(MyConfig.TAG_IMAGE_SIZE, 4);
this.w = ints[0];
this.h = ints[1];
this.W = ints[2];
this.H = ints[3];
this.quilty = MyConfig.readInteger(MyConfig.TAG_IMAGE_QUILTY, 95);
this.quilty = MyConfig.ReadInteger(MyConfig.TAG_IMAGE_QUILTY, 95);
}
/// <summary>
/// jpeg质量
......
......@@ -181,7 +181,7 @@ public class MyConfig : XMLReader
/// </summary>
/// <param name="key"></param>
/// <returns></returns>
public static string readString(string key)
public static string ReadString(string key)
{
return GetAppConfig(key);
}
......@@ -191,9 +191,9 @@ public static string readString(string key)
/// <param name="key"></param>
/// <param name="def"></param>
/// <returns></returns>
public static int readInteger(string key, int def)
public static int ReadInteger(string key, int def)
{
if (int.TryParse(readString(key), out int i))
if (int.TryParse(ReadString(key), out int i))
{
return i;
}
......@@ -206,9 +206,9 @@ public static int readInteger(string key, int def)
/// <param name="key"></param>
/// <param name="def"></param>
/// <returns></returns>
public static float readFloat(string key, float def)
public static float ReadFloat(string key, float def)
{
if (float.TryParse(readString(key), out float i))
if (float.TryParse(ReadString(key), out float i))
{
return i;
}
......@@ -221,9 +221,9 @@ public static float readFloat(string key, float def)
/// <param name="key"></param>
/// <param name="length"></param>
/// <returns></returns>
public static int[] readIntegers(string key, int length)
public static int[] ReadIntegers(string key, int length)
{
string temp = readString(key);
string temp = ReadString(key);
int[] ints = new int[length];
string[] ws = string.IsNullOrEmpty(temp) ? null : temp.Split(',');
......@@ -241,9 +241,9 @@ public static int[] readIntegers(string key, int length)
/// </summary>
/// <param name="key"></param>
/// <returns></returns>
public static Area readArea(string key)
public static Area ReadArea(string key)
{
int[] ints = readIntegers(key, 4);
int[] ints = ReadIntegers(key, 4);
Area a = new Area();
if (ints != null)
{
......@@ -259,9 +259,9 @@ public static Area readArea(string key)
/// </summary>
/// <param name="key"></param>
/// <returns></returns>
public static bool readBoolean(string key,bool def=false)
public static bool ReadBoolean(string key,bool def=false)
{
string val= readString(key);
string val= ReadString(key);
if("true".Equals(val, StringComparison.OrdinalIgnoreCase)){
return true;
}
......@@ -280,7 +280,7 @@ public static bool readBoolean(string key,bool def=false)
/// <returns></returns>
public static string GetLanguageFile(string path)
{
if (readBoolean(TAG_CHECK_SYSLANG) && Directory.Exists(path))
if (ReadBoolean(TAG_CHECK_SYSLANG) && Directory.Exists(path))
{
Save(TAG_CHECK_SYSLANG, "false");
string[] words = CultureInfo.InstalledUICulture.EnglishName.Split(' ');
......@@ -288,7 +288,7 @@ public static string GetLanguageFile(string path)
string[] files = Directory.GetFiles(path);
foreach (string file in files)
{
string name = MyPath.getFullFileName(MyConfig.TAG_LANGUAGE, file);
string name = MyPath.GetFullFileName(MyConfig.TAG_LANGUAGE, file);
if (string.IsNullOrEmpty(name))
{
continue;
......@@ -301,7 +301,7 @@ public static string GetLanguageFile(string path)
}
}
}
return MyPath.Combine(path, MyPath.getFileName(MyConfig.TAG_LANGUAGE, GetAppConfig(TAG_LANGUAGE)));
return MyPath.Combine(path, MyPath.GetFileName(MyConfig.TAG_LANGUAGE, GetAppConfig(TAG_LANGUAGE)));
}
/// <summary>
/// 卡片信息配置文件名
......@@ -310,7 +310,7 @@ public static string GetLanguageFile(string path)
/// <returns></returns>
public static string GetCardInfoFile(string path)
{
return MyPath.Combine(path, MyPath.getFileName(MyConfig.TAG_CARDINFO, GetAppConfig(TAG_LANGUAGE)));
return MyPath.Combine(path, MyPath.GetFileName(MyConfig.TAG_CARDINFO, GetAppConfig(TAG_LANGUAGE)));
}
/// <summary>
/// 发送消息打开文件
......
......@@ -10,18 +10,21 @@
using System.Drawing.Drawing2D;
using System.Windows.Forms;
using System.Collections.Generic;
using System.Text;
namespace FastColoredTextBoxNS
{
public class FastColoredTextBoxEx : FastColoredTextBox
{
Point lastMouseCoord;
{
private Label lbTooltip;
Point lastMouseCoord;
public FastColoredTextBoxEx() : base()
{
this.SyntaxHighlighter = new MySyntaxHighlighter();
this.InitializeComponent();
this.ToolTipDelay = 1;
this.TextChangedDelayed += this.FctbTextChangedDelayed;
}
public new event EventHandler<ToolTipNeededEventArgs> ToolTipNeeded;
protected override void OnMouseMove(MouseEventArgs e)
......@@ -61,13 +64,16 @@ protected override void OnToolTip()
if (ea.ToolTipText != null)
{
//show tooltip
this.ToolTip.ToolTipTitle = ea.ToolTipTitle;
this.ToolTip.ToolTipIcon = ea.ToolTipIcon;
lbTooltip.Text = $"{ea.ToolTipTitle}\r\n\r\n{ea.ToolTipText}";
lbTooltip.Location = new Point(this.Size.Width - 500, this.lastMouseCoord.Y + this.CharHeight);
//this.ToolTip.ToolTipTitle = ea.ToolTipTitle;
//this.ToolTip.ToolTipIcon = ea.ToolTipIcon;
//ToolTip.SetToolTip(this, ea.ToolTipText);
this.ToolTip.Show(ea.ToolTipText, this, new Point(this.lastMouseCoord.X, this.lastMouseCoord.Y + this.CharHeight));
}
}
//this.ToolTip.Show(ea.ToolTipText, this, new Point(this.lastMouseCoord.X, this.lastMouseCoord.Y + this.CharHeight));
}
}
//高亮当前词
void FctbTextChangedDelayed(object sender, TextChangedEventArgs e)
{
......@@ -101,5 +107,36 @@ void FctbTextChangedDelayed(object sender, TextChangedEventArgs e)
lastNonEmptyLine = i;
}
}
}
private void InitializeComponent()
{
this.lbTooltip = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this)).BeginInit();
this.SuspendLayout();
//
// lbTooltip
//
this.lbTooltip.AutoSize = true;
this.lbTooltip.BackColor = System.Drawing.SystemColors.Desktop;
this.lbTooltip.Font = new System.Drawing.Font("微软雅黑", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lbTooltip.ForeColor = System.Drawing.SystemColors.Control;
this.lbTooltip.Location = new System.Drawing.Point(221, 117);
this.lbTooltip.MaximumSize = new System.Drawing.Size(480, 0);
this.lbTooltip.Name = "lbTooltip";
this.lbTooltip.Size = new System.Drawing.Size(0, 28);
this.lbTooltip.TabIndex = 1;
//
// FastColoredTextBoxEx
//
this.AutoScrollMinSize = new System.Drawing.Size(27, 14);
this.BackColor = System.Drawing.SystemColors.Control;
this.Controls.Add(this.lbTooltip);
this.Name = "FastColoredTextBoxEx";
this.Size = new System.Drawing.Size(584, 327);
((System.ComponentModel.ISupportInitialize)(this)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
\ No newline at end of file
......@@ -76,9 +76,11 @@ void AddHistorys(string[] lines)
}
public void AddHistory(string file)
{
List<string> tmplist = new List<string>();
//添加到开始
tmplist.Add(file);
List<string> tmplist = new List<string>
{
//添加到开始
file
};
//添加旧记录
tmplist.AddRange(this.cdbhistory.ToArray());
tmplist.AddRange(this.luahistory.ToArray());
......
......@@ -29,12 +29,10 @@ public CardEdit(IDataForm dataform)
//添加
public class AddCommand: IBackableCommand
{
private string _undoSQL;
readonly CardEdit cardedit;
private string undoSQL;
readonly IDataForm dataform;
public AddCommand(CardEdit cardedit)
{
this.cardedit = cardedit;
this.dataform = cardedit.dataform;
}
......@@ -64,7 +62,7 @@ public bool Excute(params object[] args)
DataBase.GetInsertSQL(c, true)) >= 2)
{
MyMsg.Show(LMSG.AddSucceed);
this._undoSQL = DataBase.GetDeleteSQL(c);
this.undoSQL = DataBase.GetDeleteSQL(c);
this.dataform.Search(true);
this.dataform.SetCard(c);
return true;
......@@ -74,7 +72,7 @@ public bool Excute(params object[] args)
}
public void Undo()
{
DataBase.Command(this.dataform.GetOpenFile(), this._undoSQL);
DataBase.Command(this.dataform.GetOpenFile(), this.undoSQL);
}
public object Clone()
......@@ -88,16 +86,14 @@ public object Clone()
//修改
public class ModCommand: IBackableCommand
{
private string _undoSQL;
private string undoSQL;
private bool modifiled = false;
private long oldid;
private long newid;
private bool delold;
readonly CardEdit cardedit;
readonly IDataForm dataform;
public ModCommand(CardEdit cardedit)
{
this.cardedit = cardedit;
this.dataform = cardedit.dataform;
}
......@@ -138,12 +134,12 @@ public bool Excute(params object[] args)
}
else
{//删除成功,添加还原sql
this._undoSQL = DataBase.GetDeleteSQL(c) + DataBase.GetInsertSQL(oldCard, false);
this.undoSQL = DataBase.GetDeleteSQL(c) + DataBase.GetInsertSQL(oldCard, false);
}
}
else
{
this._undoSQL = DataBase.GetDeleteSQL(c);//还原就是删除
this.undoSQL = DataBase.GetDeleteSQL(c);//还原就是删除
}
//如果删除旧卡片,则把资源修改名字,否则复制资源
if (modfiles)
......@@ -166,7 +162,7 @@ public bool Excute(params object[] args)
else
{//更新数据
sql = DataBase.GetUpdateSQL(c);
this._undoSQL = DataBase.GetUpdateSQL(oldCard);
this.undoSQL = DataBase.GetUpdateSQL(oldCard);
}
if (DataBase.Command(this.dataform.GetOpenFile(), sql) > 0)
{
......@@ -185,7 +181,7 @@ public bool Excute(params object[] args)
public void Undo()
{
DataBase.Command(this.dataform.GetOpenFile(), this._undoSQL);
DataBase.Command(this.dataform.GetOpenFile(), this.undoSQL);
if (this.modifiled)
{
if (this.delold)
......@@ -210,12 +206,10 @@ public object Clone()
//删除
public class DelCommand : IBackableCommand
{
private string _undoSQL;
readonly CardEdit cardedit;
private string undoSQL;
readonly IDataForm dataform;
public DelCommand(CardEdit cardedit)
{
this.cardedit = cardedit;
this.dataform = cardedit.dataform;
}
......@@ -255,7 +249,7 @@ public bool Excute(params object[] args)
{
MyMsg.Show(LMSG.DeleteSucceed);
this.dataform.Search(true);
this._undoSQL = undo;
this.undoSQL = undo;
return true;
}
else
......@@ -267,7 +261,7 @@ public bool Excute(params object[] args)
}
public void Undo()
{
DataBase.Command(this.dataform.GetOpenFile(), this._undoSQL);
DataBase.Command(this.dataform.GetOpenFile(), this.undoSQL);
}
public object Clone()
......@@ -354,9 +348,9 @@ public bool OpenScript(bool openinthis, string addrequire)
public class CopyCommand : IBackableCommand
{
bool copied = false;
Card[] NewCards;
Card[] newCards;
bool replace;
Card[] OldCards;
Card[] oldCards;
readonly CardEdit cardedit;
readonly IDataForm dataform;
public CopyCommand(CardEdit cardedit)
......@@ -406,15 +400,15 @@ public bool Excute(params object[] args)
}
DataBase.CopyDB(this.dataform.GetOpenFile(), !replace, cards);
this.copied = true;
this.NewCards = cards;
this.newCards = cards;
this.replace = replace;
this.OldCards = oldcards;
this.oldCards = oldcards;
return true;
}
public void Undo()
{
DataBase.DeleteDB(this.dataform.GetOpenFile(), this.NewCards);
DataBase.CopyDB(this.dataform.GetOpenFile(), !this.replace, this.OldCards);
DataBase.DeleteDB(this.dataform.GetOpenFile(), this.newCards);
DataBase.CopyDB(this.dataform.GetOpenFile(), !this.replace, this.oldCards);
}
public object Clone()
......@@ -422,12 +416,12 @@ public object Clone()
CopyCommand replica = new CopyCommand(this.cardedit)
{
copied = this.copied,
NewCards = (Card[])this.NewCards.Clone(),
newCards = (Card[])this.newCards.Clone(),
replace = this.replace
};
if (this.OldCards != null)
if (this.oldCards != null)
{
replica.OldCards = (Card[])this.OldCards.Clone();
replica.oldCards = (Card[])this.oldCards.Clone();
}
return replica;
......
......@@ -30,7 +30,7 @@ public static class CardLink
public const int Up = 0x80;
public const int UpRight = 0x100;
public static bool isLink(int marks, int mark){
public static bool IsLink(int marks, int mark){
return (marks & mark) == mark;
}
}
......
......@@ -17,10 +17,10 @@ public class CardPack
{
public CardPack(long id)
{
this.card_id=id;
this.CardId=id;
}
public long card_id{
public long CardId{
get;
private set;
}
......@@ -29,7 +29,7 @@ public CardPack(long id)
public string rarity;
public string date;
public string getMseRarity(){
public string GetMseRarity(){
if(this.rarity==null)
{
return "common";
......
......@@ -63,7 +63,7 @@ public class MSEConfig
#endregion
public MSEConfig(string path)
{
this.init(path);
this.Init(path);
}
public void SetConfig(string config, string path)
{
......@@ -75,7 +75,7 @@ public void SetConfig(string config, string path)
this.regx_monster = "(\\s\\S*?)";
this.regx_pendulum = "(\\s\\S*?)";
//设置文件名
this.configName = MyPath.getFullFileName(MSEConfig.TAG, config);
this.configName = MyPath.GetFullFileName(MSEConfig.TAG, config);
this.replaces = new SortedList<string, string>();
......@@ -91,56 +91,56 @@ public void SetConfig(string config, string path)
if (line.StartsWith(TAG_CN2TW))
{
this.Iscn2tw = ConfHelper.getBooleanValue(line);
this.Iscn2tw = ConfHelper.GetBooleanValue(line);
}
else if (line.StartsWith(TAG_SPELL))
{
this.str_spell = ConfHelper.getValue(line);
this.str_spell = ConfHelper.GetValue(line);
}
else if (line.StartsWith(TAG_HEAD))
{
this.head = ConfHelper.getMultLineValue(line);
this.head = ConfHelper.GetMultLineValue(line);
}
else if (line.StartsWith(TAG_END))
{
this.end = ConfHelper.getMultLineValue(line);
this.end = ConfHelper.GetMultLineValue(line);
}
else if (line.StartsWith(TAG_TEXT))
{
this.temp_text = ConfHelper.getMultLineValue(line);
this.temp_text = ConfHelper.GetMultLineValue(line);
}
else if (line.StartsWith(TAG_TRAP))
{
this.str_trap = ConfHelper.getValue(line);
this.str_trap = ConfHelper.GetValue(line);
}
else if (line.StartsWith(TAG_REG_PENDULUM))
{
this.regx_pendulum = ConfHelper.getValue(line);
this.regx_pendulum = ConfHelper.GetValue(line);
}
else if (line.StartsWith(TAG_REG_MONSTER))
{
this.regx_monster = ConfHelper.getValue(line);
this.regx_monster = ConfHelper.GetValue(line);
}
else if (line.StartsWith(TAG_MAXCOUNT))
{
this.maxcount = ConfHelper.getIntegerValue(line, 0);
this.maxcount = ConfHelper.GetIntegerValue(line, 0);
}
else if (line.StartsWith(TAG_WIDTH)){
this.width =ConfHelper.getIntegerValue(line,0);
this.width =ConfHelper.GetIntegerValue(line,0);
}
else if (line.StartsWith(TAG_HEIGHT)){
this.height =ConfHelper.getIntegerValue(line,0);
this.height =ConfHelper.GetIntegerValue(line,0);
}
else if (line.StartsWith(TAG_PEND_WIDTH)){
this.pwidth =ConfHelper.getIntegerValue(line,0);
this.pwidth =ConfHelper.GetIntegerValue(line,0);
}
else if (line.StartsWith(TAG_PEND_HEIGHT)){
this.pheight =ConfHelper.getIntegerValue(line,0);
this.pheight =ConfHelper.GetIntegerValue(line,0);
}
else if(line.StartsWith(TAG_NO_TEN)){
this.no10 = ConfHelper.getBooleanValue(line);
this.no10 = ConfHelper.GetBooleanValue(line);
}else if(line.StartsWith(TAG_NO_START_CARDS)){
string val = ConfHelper.getValue(line);
string val = ConfHelper.GetValue(line);
string[] cs = val.Split(',');
this.noStartCards =new long[cs.Length];
int i=0;
......@@ -152,16 +152,16 @@ public void SetConfig(string config, string path)
else if (line.StartsWith(TAG_IMAGE))
{
//如果路径不合法,则为后面的路径
this.imagepath = MyPath.CheckDir(ConfHelper.getValue(line), MyPath.Combine(path, PATH_IMAGE));
this.imagepath = MyPath.CheckDir(ConfHelper.GetValue(line), MyPath.Combine(path, PATH_IMAGE));
//图片缓存目录
this.imagecache = MyPath.Combine(this.imagepath, "cache");
MyPath.CreateDir(this.imagecache);
}
else if (line.StartsWith(TAG_REPALCE))
{//特数字替换
string word = ConfHelper.getValue(line);
string p = ConfHelper.getRegex(ConfHelper.getValue1(word));
string r = ConfHelper.getRegex(ConfHelper.getValue2(word));
string word = ConfHelper.GetValue(line);
string p = ConfHelper.GetRegex(ConfHelper.GetValue1(word));
string r = ConfHelper.GetRegex(ConfHelper.GetValue2(word));
if (!string.IsNullOrEmpty(p))
{
this.replaces.Add(p, r);
......@@ -175,20 +175,20 @@ public void SetConfig(string config, string path)
{//类型
ConfHelper.DicAdd(this.typeDic, line);
}else if(line.StartsWith(TAG_REIMAGE)){
this.reimage = ConfHelper.getBooleanValue(line);
this.reimage = ConfHelper.GetBooleanValue(line);
}
}
}
public void init(string path)
public void Init(string path)
{
this.Iscn2tw = false;
//读取配置
string tmp = MyPath.Combine(path, MyPath.getFileName(MSEConfig.TAG, MyConfig.readString(MyConfig.TAG_MSE)));
string tmp = MyPath.Combine(path, MyPath.GetFileName(MSEConfig.TAG, MyConfig.ReadString(MyConfig.TAG_MSE)));
if (!File.Exists(tmp))
{
tmp = MyPath.Combine(path, MyPath.getFileName(MSEConfig.TAG, FILE_CONFIG_NAME));
tmp = MyPath.Combine(path, MyPath.GetFileName(MSEConfig.TAG, FILE_CONFIG_NAME));
if(!File.Exists(tmp))
{
return;//如果默认的也不存在
......
......@@ -447,32 +447,32 @@ string getMonster(Card c, string img,CardPack cardpack=null,bool rarity=true)
if(cardpack!=null){
sb.AppendLine(this.GetLine(TAG_NUMBER, cardpack.pack_id));
if(rarity){
sb.AppendLine(this.GetLine(TAG_RARITY, cardpack.getMseRarity()));
sb.AppendLine(this.GetLine(TAG_RARITY, cardpack.GetMseRarity()));
}
}
if(c.IsType(CardType.TYPE_LINK)){
if(CardLink.isLink(c.def, CardLink.DownLeft)){
if(CardLink.IsLink(c.def, CardLink.DownLeft)){
sb.AppendLine(this.GetLine(TAG_Link_Marker_DL, "yes"));
}
if(CardLink.isLink(c.def, CardLink.Down)){
if(CardLink.IsLink(c.def, CardLink.Down)){
sb.AppendLine(this.GetLine(TAG_Link_Marker_Down, "yes"));
}
if(CardLink.isLink(c.def, CardLink.DownRight)){
if(CardLink.IsLink(c.def, CardLink.DownRight)){
sb.AppendLine(this.GetLine(TAG_Link_Marker_DR, "yes"));
}
if(CardLink.isLink(c.def, CardLink.UpLeft)){
if(CardLink.IsLink(c.def, CardLink.UpLeft)){
sb.AppendLine(this.GetLine(TAG_Link_Marker_UL, "yes"));
}
if(CardLink.isLink(c.def, CardLink.Up)){
if(CardLink.IsLink(c.def, CardLink.Up)){
sb.AppendLine(this.GetLine(TAG_Link_Marker_Up, "yes"));
}
if(CardLink.isLink(c.def, CardLink.UpRight)){
if(CardLink.IsLink(c.def, CardLink.UpRight)){
sb.AppendLine(this.GetLine(TAG_Link_Marker_UR, "yes"));
}
if(CardLink.isLink(c.def, CardLink.Left)){
if(CardLink.IsLink(c.def, CardLink.Left)){
sb.AppendLine(this.GetLine(TAG_Link_Marker_Left, "yes"));
}
if(CardLink.isLink(c.def, CardLink.Right)){
if(CardLink.IsLink(c.def, CardLink.Right)){
sb.AppendLine(this.GetLine(TAG_Link_Marker_Right, "yes"));
}
sb.AppendLine(this.GetLine(TAG_Link_Number, ""+ this.getLinkNumber(c.def)));
......@@ -520,7 +520,7 @@ string getSpellTrap(Card c, string img, bool isSpell,CardPack cardpack=null,bool
if(cardpack!=null){
sb.AppendLine(this.GetLine(TAG_NUMBER, cardpack.pack_id));
if(rarity){
sb.AppendLine(this.GetLine(TAG_RARITY, cardpack.getMseRarity()));
sb.AppendLine(this.GetLine(TAG_RARITY, cardpack.GetMseRarity()));
}
}
sb.AppendLine(" " + TAG_TEXT + ":");
......@@ -888,7 +888,7 @@ public Card[] ReadCards(string set, bool repalceOld)
string file = MyPath.Combine(this.cfg.imagecache, md5);
if(!File.Exists(file)){
//生成缓存
Bitmap bmp=MyBitmap.readImage(img);
Bitmap bmp=MyBitmap.ReadImage(img);
//缩放
if(isPendulum){
bmp=MyBitmap.Zoom(bmp, this.cfg.pwidth, this.cfg.pheight);
......
......@@ -48,7 +48,7 @@ public override string ToString()
}
public class CardJson{
public static void test(){
public static void Test(){
string json = File.ReadAllText(@"F:\TCGEditor_v1.2\t.tcgb");
CardSet cardset = JsonConvert.DeserializeObject<CardSet>(json);
if(cardset.cards!=null){
......
......@@ -136,7 +136,7 @@ public void ToImg(string img, string saveimg1)
#region 检查更新
public static void CheckVersion(bool showNew)
{
string newver = CheckUpdate.GetNewVersion(MyConfig.readString(MyConfig.TAG_UPDATE_URL));
string newver = CheckUpdate.GetNewVersion(MyConfig.ReadString(MyConfig.TAG_UPDATE_URL));
if (newver == CheckUpdate.DEFALUT)
{ //检查失败
if (!showNew)
......@@ -284,8 +284,8 @@ public void SaveMSEs(string file, Card[] cards,bool isUpdate)
return;
}
string pack_db=MyPath.GetRealPath(MyConfig.readString("pack_db"));
bool rarity=MyConfig.readBoolean("mse_auto_rarity", false);
string pack_db=MyPath.GetRealPath(MyConfig.ReadString("pack_db"));
bool rarity=MyConfig.ReadBoolean("mse_auto_rarity", false);
#if DEBUG
MessageBox.Show("db = "+pack_db+",auto rarity="+rarity);
#endif
......
......@@ -101,7 +101,7 @@ public DataEditForm(string datapath)
}
public DataEditForm()
{//默认启动
string dir = MyConfig.readString(MyConfig.TAG_DATA);
string dir = MyConfig.ReadString(MyConfig.TAG_DATA);
if (string.IsNullOrEmpty(dir))
{
Application.Exit();
......@@ -171,13 +171,13 @@ void DataEditFormLoad(object sender, EventArgs e)
this.oldCard = new Card(0);
this.SetCard(this.oldCard);
//删除资源
this.menuitem_operacardsfile.Checked = MyConfig.readBoolean(MyConfig.TAG_DELETE_WITH);
this.menuitem_operacardsfile.Checked = MyConfig.ReadBoolean(MyConfig.TAG_DELETE_WITH);
//用CodeEditor打开脚本
this.menuitem_openfileinthis.Checked = MyConfig.readBoolean(MyConfig.TAG_OPEN_IN_THIS);
this.menuitem_openfileinthis.Checked = MyConfig.ReadBoolean(MyConfig.TAG_OPEN_IN_THIS);
//自动检查更新
this.menuitem_autocheckupdate.Checked = MyConfig.readBoolean(MyConfig.TAG_AUTO_CHECK_UPDATE);
this.menuitem_autocheckupdate.Checked = MyConfig.ReadBoolean(MyConfig.TAG_AUTO_CHECK_UPDATE);
//add require automatically
this.Addrequire = MyConfig.readString(MyConfig.TAG_ADD_REQUIRE);
this.Addrequire = MyConfig.ReadString(MyConfig.TAG_ADD_REQUIRE);
this.menuitem_addrequire.Checked = (this.Addrequire.Length > 0);
if (this.nowCdbFile != null && File.Exists(this.nowCdbFile))
{
......@@ -295,7 +295,7 @@ void InitPath(string datapath)
this.confcover = MyPath.Combine(datapath, "cover.jpg");
if (File.Exists(this.confcover))
{
this.cover = MyBitmap.readImage(this.confcover);
this.cover = MyBitmap.ReadImage(this.confcover);
}
else
{
......@@ -567,7 +567,7 @@ long GetSelect(ComboBox cb)
}
List<long> keys = (List<long>)cb.Tag;
int index = cb.SelectedIndex;
if (index >= keys.Count)
if (index >= keys.Count || index < 0)
{
return 0;
}
......@@ -1155,7 +1155,7 @@ void Menuitem_aboutClick(object sender, EventArgs e)
MyMsg.Show(
LanguageHelper.GetMsg(LMSG.About) + "\t" + Application.ProductName + "\n"
+ LanguageHelper.GetMsg(LMSG.Version) + "\t" + Application.ProductVersion + "\n"
+ LanguageHelper.GetMsg(LMSG.Author) + "\t菜菜");
+ LanguageHelper.GetMsg(LMSG.Author) + "\tNanahira & JoyJ");
}
void Menuitem_checkupdateClick(object sender, EventArgs e)
......@@ -1197,7 +1197,7 @@ void Menuitem_cancelTaskClick(object sender, EventArgs e)
}
void Menuitem_githubClick(object sender, EventArgs e)
{
System.Diagnostics.Process.Start(MyConfig.readString(MyConfig.TAG_SOURCE_URL));
System.Diagnostics.Process.Start(MyConfig.ReadString(MyConfig.TAG_SOURCE_URL));
}
#endregion
......@@ -1630,12 +1630,12 @@ public void SetImage(long id)
string msepic = MseMaker.GetCardImagePath(this.tasker.MSEImagePath, this.oldCard);
if(File.Exists(msepic))
{
this.pl_image.BackgroundImage = MyBitmap.readImage(msepic);
this.pl_image.BackgroundImage = MyBitmap.ReadImage(msepic);
}
}
else if (File.Exists(pic))
{
this.pl_image.BackgroundImage = MyBitmap.readImage(pic);
this.pl_image.BackgroundImage = MyBitmap.ReadImage(pic);
}
else
{
......@@ -1779,7 +1779,7 @@ void AddMenuItemFormMSE()
string[] files = Directory.GetFiles(this.datapath);
foreach (string file in files)
{
string name = MyPath.getFullFileName(MSEConfig.TAG, file);
string name = MyPath.GetFullFileName(MSEConfig.TAG, file);
//是否是MSE配置文件
if (string.IsNullOrEmpty(name))
{
......@@ -1999,7 +1999,7 @@ void GetLanguageItem()
string[] files = Directory.GetFiles(this.datapath);
foreach (string file in files)
{
string name = MyPath.getFullFileName(MyConfig.TAG_LANGUAGE, file);
string name = MyPath.GetFullFileName(MyConfig.TAG_LANGUAGE, file);
if (string.IsNullOrEmpty(name))
{
continue;
......@@ -2011,7 +2011,7 @@ void GetLanguageItem()
ToolTipText = file
};
tsmi.Click += this.SetLanguage_Click;
if (MyConfig.readString(MyConfig.TAG_LANGUAGE).Equals(name, StringComparison.OrdinalIgnoreCase))
if (MyConfig.ReadString(MyConfig.TAG_LANGUAGE).Equals(name, StringComparison.OrdinalIgnoreCase))
{
tsmi.Checked = true;
}
......@@ -2043,7 +2043,7 @@ void Menuitem_exportMSEimageClick(object sender, EventArgs e)
return;
}
string msepath=MyPath.GetRealPath(MyConfig.readString(MyConfig.TAG_MSE_PATH));
string msepath=MyPath.GetRealPath(MyConfig.ReadString(MyConfig.TAG_MSE_PATH));
if(!File.Exists(msepath)){
MyMsg.Error(LMSG.exportMseImagesErr);
this.menuitem_exportMSEimage.Checked=false;
......@@ -2065,7 +2065,7 @@ void Menuitem_exportMSEimageClick(object sender, EventArgs e)
if (dlg.ShowDialog() == DialogResult.OK)
{
string mseset=dlg.FileName;
string exportpath=MyPath.GetRealPath(MyConfig.readString(MyConfig.TAG_MSE_EXPORT));
string exportpath=MyPath.GetRealPath(MyConfig.ReadString(MyConfig.TAG_MSE_EXPORT));
MseMaker.ExportSet(msepath, mseset, exportpath, delegate{
this.menuitem_exportMSEimage.Checked=false;
});
......@@ -2123,7 +2123,7 @@ void Menuitem_autoreturnClick(object sender, EventArgs e)
if (DataBase.Create(dlg.FileName))
{
//
int len = MyConfig.readInteger(MyConfig.TAG_AUTO_LEN, 30);
int len = MyConfig.ReadInteger(MyConfig.TAG_AUTO_LEN, 30);
for (int i = 0; i < count; i++)
{
if(cards[i].desc!=null){
......@@ -2160,7 +2160,7 @@ void Menuitem_replaceClick(object sender, EventArgs e)
if (DataBase.Create(dlg.FileName))
{
//
_ = MyConfig.readInteger(MyConfig.TAG_AUTO_LEN, 30);
_ = MyConfig.ReadInteger(MyConfig.TAG_AUTO_LEN, 30);
for (int i = 0; i < count; i++)
{
if (cards[i].desc != null)
......
......@@ -200,6 +200,9 @@
<EmbeddedResource Include="CodeEditForm.resx">
<DependentUpon>CodeEditForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Controls\FastColoredTextBoxEx.resx">
<DependentUpon>FastColoredTextBoxEx.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="DataEditForm.resx">
<DependentUpon>DataEditForm.cs</DependentUpon>
</EmbeddedResource>
......@@ -232,8 +235,6 @@
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<Folder Include="Core\TCGEditor" />
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
\ No newline at end of file
......@@ -56,7 +56,7 @@ public void SetDataPath(string datapath)
this.tCards = null;
//数据目录
this.datapath = datapath;
if (MyConfig.readBoolean(MyConfig.TAG_ASYNC))
if (MyConfig.ReadBoolean(MyConfig.TAG_ASYNC))
{
//后台加载数据
this.bgWorker1.RunWorkerAsync();
......@@ -548,7 +548,7 @@ private void bgWorker1_RunWorkerCompleted(object sender, System.ComponentModel.R
private void MainForm_Load(object sender, EventArgs e)
{
//检查更新
if (!MyConfig.readBoolean(MyConfig.TAG_AUTO_CHECK_UPDATE))
if (!MyConfig.ReadBoolean(MyConfig.TAG_AUTO_CHECK_UPDATE))
{
return;
}
......
This diff is collapsed.
This diff is collapsed.
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