Commit 44764797 authored by JoyJ's avatar JoyJ

code format

parent b448b34a
...@@ -5,19 +5,19 @@ ...@@ -5,19 +5,19 @@
* 时间: 19:16 * 时间: 19:16
* *
*/ */
using DataEditorX.Config;
using DataEditorX.Controls;
using DataEditorX.Core;
using DataEditorX.Language;
using FastColoredTextBoxNS;
using System; using System;
using System.IO;
using System.Drawing;
using System.Collections.Generic; using System.Collections.Generic;
using System.Windows.Forms; using System.Drawing;
using System.IO;
using System.Text; using System.Text;
using WeifenLuo.WinFormsUI.Docking;
using FastColoredTextBoxNS;
using DataEditorX.Language;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using DataEditorX.Core; using System.Windows.Forms;
using DataEditorX.Config; using WeifenLuo.WinFormsUI.Docking;
using DataEditorX.Controls;
namespace DataEditorX namespace DataEditorX
{ {
...@@ -91,8 +91,8 @@ void InitForm() ...@@ -91,8 +91,8 @@ void InitForm()
this.popupMenu.ForeColor = this.fctb.ForeColor; this.popupMenu.ForeColor = this.fctb.ForeColor;
this.popupMenu.Closed += new ToolStripDropDownClosedEventHandler(this.popupMenu_Closed); this.popupMenu.Closed += new ToolStripDropDownClosedEventHandler(this.popupMenu_Closed);
this.popupMenu.SelectedColor = Color.LightGray; this.popupMenu.SelectedColor = Color.LightGray;
popupMenu.VisibleChanged += this.PopupMenu_VisibleChanged; this.popupMenu.VisibleChanged += this.PopupMenu_VisibleChanged;
popupMenu.Items.FocussedItemIndexChanged += this.Items_FocussedItemIndexChanged; this.popupMenu.Items.FocussedItemIndexChanged += this.Items_FocussedItemIndexChanged;
this.title = this.Text; this.title = this.Text;
} }
...@@ -105,38 +105,38 @@ private void ToolTip_Popup(object sender, PopupEventArgs e) ...@@ -105,38 +105,38 @@ private void ToolTip_Popup(object sender, PopupEventArgs e)
private void PopupMenu_VisibleChanged(object sender, EventArgs e) private void PopupMenu_VisibleChanged(object sender, EventArgs e)
{ {
this.AdjustPopupMenuSize(); this.AdjustPopupMenuSize();
if (!popupMenu.Visible || popupMenu.Items.FocussedItem == null) if (!this.popupMenu.Visible || this.popupMenu.Items.FocussedItem == null)
{ {
return; return;
} }
this.fctb.ShowTooltipWithLabel(popupMenu.Items.FocussedItem.ToolTipTitle, this.fctb.ShowTooltipWithLabel(this.popupMenu.Items.FocussedItem.ToolTipTitle,
popupMenu.Items.FocussedItem.ToolTipText); this.popupMenu.Items.FocussedItem.ToolTipText);
} }
private void AdjustPopupMenuSize() private void AdjustPopupMenuSize()
{ {
if (!popupMenu.Visible || popupMenu.Items.FocussedItem == null) if (!this.popupMenu.Visible || this.popupMenu.Items.FocussedItem == null)
{ {
popupMenu.Size = new Size(300, 0); this.popupMenu.Size = new Size(300, 0);
popupMenu.MinimumSize = new Size(300, 0); this.popupMenu.MinimumSize = new Size(300, 0);
} }
Size s = TextRenderer.MeasureText(popupMenu.Items.FocussedItem.ToolTipTitle, Size s = TextRenderer.MeasureText(this.popupMenu.Items.FocussedItem.ToolTipTitle,
popupMenu.Items.Font, new Size(0, 0), TextFormatFlags.NoPadding); this.popupMenu.Items.Font, new Size(0, 0), TextFormatFlags.NoPadding);
s = new Size(s.Width + 50, popupMenu.Size.Height); s = new Size(s.Width + 50, this.popupMenu.Size.Height);
if (popupMenu.Size.Width < s.Width) if (this.popupMenu.Size.Width < s.Width)
{ {
popupMenu.Size = s; this.popupMenu.Size = s;
popupMenu.MinimumSize = s; this.popupMenu.MinimumSize = s;
} }
} }
private void Items_FocussedItemIndexChanged(object sender, EventArgs e) private void Items_FocussedItemIndexChanged(object sender, EventArgs e)
{ {
if (popupMenu.Items.FocussedItem == null) if (this.popupMenu.Items.FocussedItem == null)
{ {
return; return;
} }
this.AdjustPopupMenuSize(); this.AdjustPopupMenuSize();
this.fctb.ShowTooltipWithLabel(popupMenu.Items.FocussedItem.ToolTipTitle, this.fctb.ShowTooltipWithLabel(this.popupMenu.Items.FocussedItem.ToolTipTitle,
popupMenu.Items.FocussedItem.ToolTipText); this.popupMenu.Items.FocussedItem.ToolTipText);
} }
void popupMenu_Closed(object sender, ToolStripDropDownClosedEventArgs e) void popupMenu_Closed(object sender, ToolStripDropDownClosedEventArgs e)
......
...@@ -64,9 +64,9 @@ public static string GetNewVersion(string VERURL) ...@@ -64,9 +64,9 @@ public static string GetNewVersion(string VERURL)
public static bool CheckVersion(string ver, string oldver) public static bool CheckVersion(string ver, string oldver)
{ {
bool hasNew = false; bool hasNew = false;
#if DEBUG #if DEBUG
System.Windows.Forms.MessageBox.Show(oldver+"=>"+ver); System.Windows.Forms.MessageBox.Show(oldver + "=>" + ver);
#endif #endif
string[] vers = ver.Split('.'); string[] vers = ver.Split('.');
string[] oldvers = oldver.Split('.'); string[] oldvers = oldver.Split('.');
if (vers.Length == oldvers.Length) if (vers.Length == oldvers.Length)
......
using System; using System.Collections.Generic;
using System.Collections.Generic;
using System.Text;
using System.Globalization; using System.Globalization;
using System.Text;
namespace DataEditorX.Common namespace DataEditorX.Common
{ {
...@@ -109,7 +108,7 @@ public static int GetIntegerValue(string line, int defalut) ...@@ -109,7 +108,7 @@ public static int GetIntegerValue(string line, int defalut)
i = int.Parse(GetValue(line)); i = int.Parse(GetValue(line));
return i; return i;
} }
catch{} catch { }
return defalut; return defalut;
} }
/// <summary> /// <summary>
......
...@@ -2,10 +2,10 @@ ...@@ -2,10 +2,10 @@
* date :2014-02-07 * date :2014-02-07
* desc :图像处理,裁剪,缩放,保存 * desc :图像处理,裁剪,缩放,保存
*/ */
using System.IO;
using System.Drawing; using System.Drawing;
using System.Drawing.Drawing2D; using System.Drawing.Drawing2D;
using System.Drawing.Imaging; using System.Drawing.Imaging;
using System.IO;
namespace DataEditorX.Common namespace DataEditorX.Common
{ {
...@@ -35,7 +35,7 @@ public static Bitmap ReadImage(string file) ...@@ -35,7 +35,7 @@ public static Bitmap ReadImage(string file)
/// <returns>处理好的图像</returns> /// <returns>处理好的图像</returns>
public static Bitmap Zoom(Bitmap sourceBitmap, int newWidth, int newHeight) public static Bitmap Zoom(Bitmap sourceBitmap, int newWidth, int newHeight)
{ {
if ( sourceBitmap != null ) if (sourceBitmap != null)
{ {
Bitmap b = new Bitmap(newWidth, newHeight); Bitmap b = new Bitmap(newWidth, newHeight);
Graphics graphics = Graphics.FromImage(b); Graphics graphics = Graphics.FromImage(b);
...@@ -79,17 +79,17 @@ public static Bitmap Cut(Bitmap sourceBitmap, Area area) ...@@ -79,17 +79,17 @@ public static Bitmap Cut(Bitmap sourceBitmap, Area area)
/// <returns>处理好的图像</returns> /// <returns>处理好的图像</returns>
public static Bitmap Cut(Bitmap sourceBitmap, int StartX, int StartY, int cutWidth, int cutHeight) public static Bitmap Cut(Bitmap sourceBitmap, int StartX, int StartY, int cutWidth, int cutHeight)
{ {
if ( sourceBitmap != null ) if (sourceBitmap != null)
{ {
int w = sourceBitmap.Width; int w = sourceBitmap.Width;
int h = sourceBitmap.Height; int h = sourceBitmap.Height;
//裁剪的区域宽度调整 //裁剪的区域宽度调整
if ( ( StartX + cutWidth ) > w ) if ((StartX + cutWidth) > w)
{ {
cutWidth = w - StartX; cutWidth = w - StartX;
} }
//裁剪的区域高度调整 //裁剪的区域高度调整
if ( ( StartY + cutHeight ) > h ) if ((StartY + cutHeight) > h)
{ {
cutHeight = h - StartY; cutHeight = h - StartY;
} }
...@@ -121,12 +121,12 @@ public static Bitmap Cut(Bitmap sourceBitmap, int StartX, int StartY, int cutWid ...@@ -121,12 +121,12 @@ public static Bitmap Cut(Bitmap sourceBitmap, int StartX, int StartY, int cutWid
/// <param name="filename">保存路径</param> /// <param name="filename">保存路径</param>
/// <param name="quality">质量</param> /// <param name="quality">质量</param>
/// <returns>是否保存成功</returns> /// <returns>是否保存成功</returns>
public static bool SaveAsJPEG(Bitmap bitmap, string filename, int quality=90) public static bool SaveAsJPEG(Bitmap bitmap, string filename, int quality = 90)
{ {
if ( bitmap != null ) if (bitmap != null)
{ {
string path=Path.GetDirectoryName(filename); string path=Path.GetDirectoryName(filename);
if(!Directory.Exists(path))//创建文件夹 if (!Directory.Exists(path))//创建文件夹
{ {
Directory.CreateDirectory(path); Directory.CreateDirectory(path);
} }
...@@ -138,9 +138,9 @@ public static bool SaveAsJPEG(Bitmap bitmap, string filename, int quality=90) ...@@ -138,9 +138,9 @@ public static bool SaveAsJPEG(Bitmap bitmap, string filename, int quality=90)
ImageCodecInfo[] codecs = ImageCodecInfo.GetImageEncoders(); ImageCodecInfo[] codecs = ImageCodecInfo.GetImageEncoders();
ImageCodecInfo ici = null; ImageCodecInfo ici = null;
foreach ( ImageCodecInfo codec in codecs ) foreach (ImageCodecInfo codec in codecs)
{ {
if ( codec.MimeType.IndexOf("jpeg") > -1 ) if (codec.MimeType.IndexOf("jpeg") > -1)
{ {
ici = codec; ici = codec;
break; break;
...@@ -152,7 +152,7 @@ public static bool SaveAsJPEG(Bitmap bitmap, string filename, int quality=90) ...@@ -152,7 +152,7 @@ public static bool SaveAsJPEG(Bitmap bitmap, string filename, int quality=90)
} }
EncoderParameters encoderParams = new EncoderParameters(); EncoderParameters encoderParams = new EncoderParameters();
encoderParams.Param[0] = new EncoderParameter(Encoder.Quality, (long)quality); encoderParams.Param[0] = new EncoderParameter(Encoder.Quality, quality);
if (ici != null) if (ici != null)
{ {
bitmap.Save(filename, ici, encoderParams); bitmap.Save(filename, ici, encoderParams);
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
* 时间: 10:26 * 时间: 10:26
* *
*/ */
using System;
using System.Text; using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
...@@ -84,14 +83,15 @@ public static string Combine(params string[] paths) ...@@ -84,14 +83,15 @@ public static string Combine(params string[] paths)
/// <param name="dir">目录</param> /// <param name="dir">目录</param>
/// <param name="defalut">不合法时,采取的目录</param> /// <param name="defalut">不合法时,采取的目录</param>
/// <returns></returns> /// <returns></returns>
public static string CheckDir(string dir,string defalut) public static string CheckDir(string dir, string defalut)
{ {
DirectoryInfo fo; DirectoryInfo fo;
try try
{ {
fo = new DirectoryInfo(GetRealPath(dir)); fo = new DirectoryInfo(GetRealPath(dir));
} }
catch{ catch
{
//路径不合法 //路径不合法
fo = new DirectoryInfo(defalut); fo = new DirectoryInfo(defalut);
} }
...@@ -110,7 +110,7 @@ public static string CheckDir(string dir,string defalut) ...@@ -110,7 +110,7 @@ public static string CheckDir(string dir,string defalut)
/// <param name="tag">前面</param> /// <param name="tag">前面</param>
/// <param name="lang"></param> /// <param name="lang"></param>
/// <returns></returns> /// <returns></returns>
public static string GetFileName(string tag,string lang) public static string GetFileName(string tag, string lang)
{ {
return tag + "_" + lang + ".txt"; return tag + "_" + lang + ".txt";
} }
......
 using System.Collections.Generic;
using System;
using System.Collections.Generic;
namespace DataEditorX namespace DataEditorX
{ {
...@@ -12,10 +10,10 @@ public int Compare(K x, K y) ...@@ -12,10 +10,10 @@ public int Compare(K x, K y)
} }
} }
public class MySortList<K,V> : SortedList<K,V> public class MySortList<K, V> : SortedList<K, V>
{ {
public MySortList():base(new MyComparer<K>()) public MySortList() : base(new MyComparer<K>())
{ {
} }
...@@ -24,11 +22,11 @@ public new void Add(K key, V value) ...@@ -24,11 +22,11 @@ public new void Add(K key, V value)
//falg用于跳出函数 //falg用于跳出函数
int flag = 0; int flag = 0;
//检查是否具备这个key,并且检查value是否重复 //检查是否具备这个key,并且检查value是否重复
foreach (KeyValuePair<K,V> item in this) foreach (KeyValuePair<K, V> item in this)
{ {
if (item.Key.ToString() == key.ToString() && item.Value.ToString() == value.ToString()) if (item.Key.ToString() == key.ToString() && item.Value.ToString() == value.ToString())
{ {
flag=1; flag = 1;
} }
} }
if (flag == 1) if (flag == 1)
......
...@@ -6,9 +6,8 @@ ...@@ -6,9 +6,8 @@
* *
* 要改变这种模板请点击 工具|选项|代码编写|编辑标准头文件 * 要改变这种模板请点击 工具|选项|代码编写|编辑标准头文件
*/ */
using System;
using System.Text;
using System.IO; using System.IO;
using System.Text;
namespace DataEditorX.Common namespace DataEditorX.Common
{ {
...@@ -45,8 +44,9 @@ public static string GetMD5HashFromFile(string fileName) ...@@ -45,8 +44,9 @@ public static string GetMD5HashFromFile(string fileName)
return ""; return "";
} }
public static bool Md5isEmpty(string md5){ public static bool Md5isEmpty(string md5)
return md5==null||md5.Length<16; {
return md5 == null || md5.Length < 16;
} }
} }
} }
using System; using System.Text;
using System.Collections.Generic;
using System.Text;
namespace DataEditorX.Common namespace DataEditorX.Common
{ {
...@@ -13,7 +11,7 @@ public static string AutoEnter(string str, int lineNum, char re) ...@@ -13,7 +11,7 @@ public static string AutoEnter(string str, int lineNum, char re)
return ""; return "";
} }
str = " "+str.Replace("\r\n", "\n"); str = " " + str.Replace("\r\n", "\n");
char[] ch = str.ToCharArray(); char[] ch = str.ToCharArray();
_ = ch.Length; _ = ch.Length;
...@@ -37,7 +35,7 @@ public static string AutoEnter(string str, int lineNum, char re) ...@@ -37,7 +35,7 @@ public static string AutoEnter(string str, int lineNum, char re)
sb.Append(re); sb.Append(re);
i = 0; i = 0;
} }
else if(c == re) else if (c == re)
{ {
sb.Append(c); sb.Append(c);
i = 0; i = 0;
...@@ -47,7 +45,9 @@ public static string AutoEnter(string str, int lineNum, char re) ...@@ -47,7 +45,9 @@ public static string AutoEnter(string str, int lineNum, char re)
sb.Append(c); sb.Append(c);
sb.Append(re); sb.Append(re);
i = 0; i = 0;
}else{ }
else
{
sb.Append(c); sb.Append(c);
} }
} }
......
/* /*
* 由SharpDevelop创建。 * 由SharpDevelop创建。
* 用户: Acer * 用户: Acer
* 日期: 2014-10-25 * 日期: 2014-10-25
* 时间: 21:30 * 时间: 21:30
* *
*/ */
using System;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
namespace System namespace System
......
using System; using System.Windows.Forms;
using System.Xml; using System.Xml;
using System.IO;
using DataEditorX.Common;
using System.Windows.Forms;
using System.Diagnostics;
using System.Reflection;
namespace DataEditorX.Common namespace DataEditorX.Common
{ {
......
...@@ -15,11 +15,13 @@ public class ZipStorer : IDisposable ...@@ -15,11 +15,13 @@ public class ZipStorer : IDisposable
/// <summary> /// <summary>
/// Compression method enumeration /// Compression method enumeration
/// </summary> /// </summary>
public enum Compression : ushort { public enum Compression : ushort
{
/// <summary>Uncompressed storage</summary> /// <summary>Uncompressed storage</summary>
Store = 0, Store = 0,
/// <summary>Deflate compression method</summary> /// <summary>Deflate compression method</summary>
Deflate = 8 } Deflate = 8
}
#region ZipFileEntry #region ZipFileEntry
/// <summary> /// <summary>
...@@ -151,7 +153,7 @@ public static ZipStorer Create(Stream _stream, string _comment) ...@@ -151,7 +153,7 @@ public static ZipStorer Create(Stream _stream, string _comment)
/// <returns>A valid ZipStorer object</returns> /// <returns>A valid ZipStorer object</returns>
public static ZipStorer Open(string _filename, FileAccess _access) public static ZipStorer Open(string _filename, FileAccess _access)
{ {
Stream stream = (Stream)new FileStream(_filename, FileMode.Open, _access == FileAccess.Read ? FileAccess.Read : FileAccess.ReadWrite); Stream stream = new FileStream(_filename, FileMode.Open, _access == FileAccess.Read ? FileAccess.Read : FileAccess.ReadWrite);
ZipStorer zip = Open(stream, _access); ZipStorer zip = Open(stream, _access);
zip.fileName = _filename; zip.fileName = _filename;
...@@ -237,7 +239,7 @@ public void AddStream(Compression _method, string _filenameInZip, Stream _source ...@@ -237,7 +239,7 @@ public void AddStream(Compression _method, string _filenameInZip, Stream _source
throw new InvalidOperationException("Writing is not alowed"); throw new InvalidOperationException("Writing is not alowed");
} }
if (this.files.Count==0) if (this.files.Count == 0)
{ {
} }
else else
...@@ -325,7 +327,7 @@ public List<ZipFileEntry> ReadCentralDir() ...@@ -325,7 +327,7 @@ public List<ZipFileEntry> ReadCentralDir()
List<ZipFileEntry> result = new List<ZipFileEntry>(); List<ZipFileEntry> result = new List<ZipFileEntry>();
for (int pointer = 0; pointer < this.centralDirImage.Length; ) for (int pointer = 0; pointer < this.centralDirImage.Length;)
{ {
uint signature = BitConverter.ToUInt32(this.centralDirImage, pointer); uint signature = BitConverter.ToUInt32(this.centralDirImage, pointer);
if (signature != 0x02014b50) if (signature != 0x02014b50)
...@@ -561,7 +563,7 @@ private void WriteLocalHeader(ref ZipFileEntry _zfe) ...@@ -561,7 +563,7 @@ private void WriteLocalHeader(ref ZipFileEntry _zfe)
Encoding encoder = _zfe.EncodeUTF8 ? Encoding.UTF8 : _defaultEncoding; Encoding encoder = _zfe.EncodeUTF8 ? Encoding.UTF8 : _defaultEncoding;
byte[] encodedFilename = encoder.GetBytes(_zfe.FilenameInZip); byte[] encodedFilename = encoder.GetBytes(_zfe.FilenameInZip);
this.zipFileStream.Write(new byte[] { 80, 75, 3, 4, 20, 0}, 0, 6); // No extra header this.zipFileStream.Write(new byte[] { 80, 75, 3, 4, 20, 0 }, 0, 6); // No extra header
this.zipFileStream.Write(BitConverter.GetBytes((ushort)(_zfe.EncodeUTF8 ? 0x0800 : 0)), 0, 2); // filename and comment encoding this.zipFileStream.Write(BitConverter.GetBytes((ushort)(_zfe.EncodeUTF8 ? 0x0800 : 0)), 0, 2); // filename and comment encoding
this.zipFileStream.Write(BitConverter.GetBytes((ushort)_zfe.Method), 0, 2); // zipping method this.zipFileStream.Write(BitConverter.GetBytes((ushort)_zfe.Method), 0, 2); // zipping method
this.zipFileStream.Write(BitConverter.GetBytes(this.DateTimeToDosTime(_zfe.ModifyTime)), 0, 4); // zipping date and time this.zipFileStream.Write(BitConverter.GetBytes(this.DateTimeToDosTime(_zfe.ModifyTime)), 0, 4); // zipping date and time
...@@ -643,8 +645,8 @@ private void WriteEndRecord(uint _size, uint _offset) ...@@ -643,8 +645,8 @@ private void WriteEndRecord(uint _size, uint _offset)
byte[] encodedComment = encoder.GetBytes(this.comment); byte[] encodedComment = encoder.GetBytes(this.comment);
this.zipFileStream.Write(new byte[] { 80, 75, 5, 6, 0, 0, 0, 0 }, 0, 8); this.zipFileStream.Write(new byte[] { 80, 75, 5, 6, 0, 0, 0, 0 }, 0, 8);
this.zipFileStream.Write(BitConverter.GetBytes((ushort)this.files.Count+ this.existingFiles), 0, 2); this.zipFileStream.Write(BitConverter.GetBytes((ushort)this.files.Count + this.existingFiles), 0, 2);
this.zipFileStream.Write(BitConverter.GetBytes((ushort)this.files.Count+ this.existingFiles), 0, 2); this.zipFileStream.Write(BitConverter.GetBytes((ushort)this.files.Count + this.existingFiles), 0, 2);
this.zipFileStream.Write(BitConverter.GetBytes(_size), 0, 4); this.zipFileStream.Write(BitConverter.GetBytes(_size), 0, 4);
this.zipFileStream.Write(BitConverter.GetBytes(_offset), 0, 4); this.zipFileStream.Write(BitConverter.GetBytes(_offset), 0, 4);
this.zipFileStream.Write(BitConverter.GetBytes((ushort)encodedComment.Length), 0, 2); this.zipFileStream.Write(BitConverter.GetBytes((ushort)encodedComment.Length), 0, 2);
...@@ -722,7 +724,7 @@ private uint DateTimeToDosTime(DateTime _dt) ...@@ -722,7 +724,7 @@ private uint DateTimeToDosTime(DateTime _dt)
{ {
return (uint)( return (uint)(
(_dt.Second / 2) | (_dt.Minute << 5) | (_dt.Hour << 11) | (_dt.Second / 2) | (_dt.Minute << 5) | (_dt.Hour << 11) |
(_dt.Day<<16) | (_dt.Month << 21) | ((_dt.Year - 1980) << 25)); (_dt.Day << 16) | (_dt.Month << 21) | ((_dt.Year - 1980) << 25));
} }
private DateTime DosTimeToDateTime(uint _dt) private DateTime DosTimeToDateTime(uint _dt)
{ {
......
using System; using FastColoredTextBoxNS;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using FastColoredTextBoxNS;
namespace DataEditorX.Config namespace DataEditorX.Config
{ {
/// <summary> /// <summary>
...@@ -209,7 +208,7 @@ void AddToolIipDic(string key, string val) ...@@ -209,7 +208,7 @@ void AddToolIipDic(string key, string val)
nval += Environment.NewLine; nval += Environment.NewLine;
} }
nval += Environment.NewLine +val; nval += Environment.NewLine + val;
this.tooltipDic[skey] = nval; this.tooltipDic[skey] = nval;
} }
else else
......
...@@ -18,7 +18,7 @@ public class DataConfig ...@@ -18,7 +18,7 @@ public class DataConfig
{ {
public DataConfig() public DataConfig()
{ {
this.InitMember(MyPath.Combine(Application.StartupPath, MyConfig.TAG_CARDINFO+".txt")); this.InitMember(MyPath.Combine(Application.StartupPath, MyConfig.TAG_CARDINFO + ".txt"));
} }
public DataConfig(string conf) public DataConfig(string conf)
{ {
...@@ -31,7 +31,7 @@ public DataConfig(string conf) ...@@ -31,7 +31,7 @@ public DataConfig(string conf)
public void InitMember(string conf) public void InitMember(string conf)
{ {
//conf = MyPath.Combine(datapath, MyConfig.FILE_INFO); //conf = MyPath.Combine(datapath, MyConfig.FILE_INFO);
if(!File.Exists(conf)) if (!File.Exists(conf))
{ {
this.dicCardRules = new Dictionary<long, string>(); this.dicCardRules = new Dictionary<long, string>();
this.dicSetnames = new Dictionary<long, string>(); this.dicSetnames = new Dictionary<long, string>();
......
...@@ -6,11 +6,11 @@ ...@@ -6,11 +6,11 @@
* *
*/ */
using System; using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO; using System.IO;
using System.Text; using System.Text;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Globalization;
using System.Collections.Generic;
namespace DataEditorX.Config namespace DataEditorX.Config
{ {
...@@ -42,7 +42,7 @@ public static string SubString(string content, string tag) ...@@ -42,7 +42,7 @@ public static string SubString(string content, string tag)
Match mac = reg.Match(reReturn(content)); Match mac = reg.Match(reReturn(content));
if (mac.Success)//把相应的内容提取出来 if (mac.Success)//把相应的内容提取出来
{ {
return mac.Groups[1].Value.Replace("\n",Environment.NewLine); return mac.Groups[1].Value.Replace("\n", Environment.NewLine);
} }
return ""; return "";
} }
...@@ -57,7 +57,7 @@ public static string SubString(string content, string tag) ...@@ -57,7 +57,7 @@ public static string SubString(string content, string tag)
/// <returns></returns> /// <returns></returns>
public static Dictionary<long, string> Read(string content, string tag) public static Dictionary<long, string> Read(string content, string tag)
{ {
return Read(SubString(content,tag)); return Read(SubString(content, tag));
} }
/// <summary> /// <summary>
/// 从文件读取内容,按行读取 /// 从文件读取内容,按行读取
...@@ -150,7 +150,7 @@ public static string[] GetValues(Dictionary<long, string> dic) ...@@ -150,7 +150,7 @@ public static string[] GetValues(Dictionary<long, string> dic)
/// <returns></returns> /// <returns></returns>
public static string GetValue(Dictionary<long, string> dic, long key) public static string GetValue(Dictionary<long, string> dic, long key)
{ {
if(dic.ContainsKey(key)) if (dic.ContainsKey(key))
{ {
return dic[key].Trim(); return dic[key].Trim();
} }
......
...@@ -5,9 +5,6 @@ ...@@ -5,9 +5,6 @@
* 时间: 9:02 * 时间: 9:02
* *
*/ */
using System;
using System.Configuration;
using DataEditorX.Config;
using DataEditorX.Common; using DataEditorX.Common;
namespace DataEditorX.Config namespace DataEditorX.Config
...@@ -17,7 +14,8 @@ namespace DataEditorX.Config ...@@ -17,7 +14,8 @@ namespace DataEditorX.Config
/// </summary> /// </summary>
public class ImageSet public class ImageSet
{ {
public ImageSet(){ public ImageSet()
{
this.Init(); this.Init();
} }
//初始化 //初始化
......
using System; using DataEditorX.Common;
using System.Xml; using System;
using System.IO;
using System.Globalization;
using DataEditorX.Common;
using System.Windows.Forms;
using System.Diagnostics; using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Reflection; using System.Reflection;
using System.Windows.Forms;
namespace DataEditorX.Config namespace DataEditorX.Config
{ {
...@@ -259,13 +258,15 @@ public static Area ReadArea(string key) ...@@ -259,13 +258,15 @@ public static Area ReadArea(string key)
/// </summary> /// </summary>
/// <param name="key"></param> /// <param name="key"></param>
/// <returns></returns> /// <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)){ if ("true".Equals(val, StringComparison.OrdinalIgnoreCase))
{
return true; return true;
} }
if("false".Equals(val, StringComparison.OrdinalIgnoreCase)){ if ("false".Equals(val, StringComparison.OrdinalIgnoreCase))
{
return false; return false;
} }
return def; return def;
......
using System; using System.IO;
using System.Collections.Generic;
using System.Text;
using System.IO;
namespace DataEditorX.Config namespace DataEditorX.Config
{ {
...@@ -67,7 +64,7 @@ public string GetImage(string id) ...@@ -67,7 +64,7 @@ public string GetImage(string id)
//} //}
public string GetImageField(string id) public string GetImageField(string id)
{ {
return MyPath.Combine(this.fieldpath, id+ ".png");//场地图 return MyPath.Combine(this.fieldpath, id + ".png");//场地图
} }
public string GetScript(string id) public string GetScript(string id)
{ {
......
using System; using System.Windows.Forms;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
namespace DataEditorX namespace DataEditorX
{ {
......
using System; using System.Windows.Forms;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
namespace DataEditorX namespace DataEditorX
{ {
......
using System; using System.Windows.Forms;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
namespace DataEditorX namespace DataEditorX
{ {
......
...@@ -7,10 +7,7 @@ ...@@ -7,10 +7,7 @@
*/ */
using System; using System;
using System.Drawing; using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Forms; using System.Windows.Forms;
using System.Collections.Generic;
using System.Text;
namespace FastColoredTextBoxNS namespace FastColoredTextBoxNS
{ {
...@@ -53,8 +50,8 @@ protected override void OnToolTip() ...@@ -53,8 +50,8 @@ protected override void OnToolTip()
//check distance //check distance
Point p = this.PlaceToPoint(place); Point p = this.PlaceToPoint(place);
if (Math.Abs(p.X - this.lastMouseCoord.X) > this.CharWidth *2 || if (Math.Abs(p.X - this.lastMouseCoord.X) > this.CharWidth * 2 ||
Math.Abs(p.Y - this.lastMouseCoord.Y) > this.CharHeight *2) Math.Abs(p.Y - this.lastMouseCoord.Y) > this.CharHeight * 2)
{ {
return; return;
} }
...@@ -73,14 +70,14 @@ protected override void OnToolTip() ...@@ -73,14 +70,14 @@ protected override void OnToolTip()
public void ShowTooltipWithLabel(string title, string text, int height) public void ShowTooltipWithLabel(string title, string text, int height)
{ {
lbTooltip.Visible = true; this.lbTooltip.Visible = true;
lbTooltip.Text = $"{title}\r\n\r\n{text}"; this.lbTooltip.Text = $"{title}\r\n\r\n{text}";
lbTooltip.Location = new Point(this.Size.Width - 500, height); this.lbTooltip.Location = new Point(this.Size.Width - 500, height);
} }
public void ShowTooltipWithLabel(string title, string text) public void ShowTooltipWithLabel(string title, string text)
{ {
this.ShowTooltipWithLabel(title,text, this.lastMouseCoord.Y + this.CharHeight); this.ShowTooltipWithLabel(title, text, this.lastMouseCoord.Y + this.CharHeight);
} }
//高亮当前词 //高亮当前词
...@@ -127,7 +124,7 @@ private void InitializeComponent() ...@@ -127,7 +124,7 @@ private void InitializeComponent()
// //
this.lbTooltip.AutoSize = true; this.lbTooltip.AutoSize = true;
this.lbTooltip.BackColor = SystemColors.Desktop; this.lbTooltip.BackColor = SystemColors.Desktop;
this.lbTooltip.Font = new Font("微软雅黑", 15.75F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0))); this.lbTooltip.Font = new Font("微软雅黑", 15.75F, FontStyle.Regular, GraphicsUnit.Point, 0);
this.lbTooltip.ForeColor = SystemColors.Control; this.lbTooltip.ForeColor = SystemColors.Control;
this.lbTooltip.Location = new Point(221, 117); this.lbTooltip.Location = new Point(221, 117);
this.lbTooltip.MaximumSize = new Size(480, 0); this.lbTooltip.MaximumSize = new Size(480, 0);
...@@ -157,7 +154,7 @@ private void FastColoredTextBoxEx_Load(object sender, EventArgs e) ...@@ -157,7 +154,7 @@ private void FastColoredTextBoxEx_Load(object sender, EventArgs e)
private void lbTooltip_MouseMove(object sender, MouseEventArgs e) private void lbTooltip_MouseMove(object sender, MouseEventArgs e)
{ {
lbTooltip.Visible = false; this.lbTooltip.Visible = false;
} }
} }
} }
using System; using DataEditorX.Config;
using DataEditorX.Core;
using DataEditorX.Language;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using DataEditorX.Core;
using DataEditorX.Config;
using System.Windows.Forms; using System.Windows.Forms;
using DataEditorX.Language;
namespace DataEditorX.Controls namespace DataEditorX.Controls
{ {
...@@ -108,7 +108,7 @@ void SaveHistory() ...@@ -108,7 +108,7 @@ void SaveHistory()
texts += Environment.NewLine + str; texts += Environment.NewLine + str;
} }
} }
if(File.Exists(this.historyFile)) if (File.Exists(this.historyFile))
{ {
File.Delete(this.historyFile); File.Delete(this.historyFile);
} }
......
using System; namespace DataEditorX.Controls
using System.Collections.Generic;
using System.Text;
namespace DataEditorX.Controls
{ {
public interface IEditForm public interface IEditForm
{ {
......
...@@ -5,13 +5,7 @@ ...@@ -5,13 +5,7 @@
* 时间: 23:14 * 时间: 23:14
* *
*/ */
using System;
using System.Collections.Generic;
using System.Drawing; using System.Drawing;
using System.Globalization;
using System.IO;
using System.Text.RegularExpressions;
using System.Xml;
namespace FastColoredTextBoxNS namespace FastColoredTextBoxNS
{ {
...@@ -47,23 +41,23 @@ public override void LuaSyntaxHighlight(Range range) ...@@ -47,23 +41,23 @@ public override void LuaSyntaxHighlight(Range range)
//clear style of changed range //clear style of changed range
range.ClearStyle(this.mStrStyle, this.mGrayStyle, this.conStyle, this.mNumberStyle, this.mKeywordStyle, this.mFunStyle); range.ClearStyle(this.mStrStyle, this.mGrayStyle, this.conStyle, this.mNumberStyle, this.mKeywordStyle, this.mFunStyle);
// //
if (LuaStringRegex == null) if (this.LuaStringRegex == null)
{ {
InitLuaRegex(); this.InitLuaRegex();
} }
//string highlighting //string highlighting
range.SetStyle(this.mStrStyle, LuaStringRegex); range.SetStyle(this.mStrStyle, this.LuaStringRegex);
//comment highlighting //comment highlighting
range.SetStyle(this.mGrayStyle, LuaCommentRegex1); range.SetStyle(this.mGrayStyle, this.LuaCommentRegex1);
range.SetStyle(this.mGrayStyle, LuaCommentRegex2); range.SetStyle(this.mGrayStyle, this.LuaCommentRegex2);
range.SetStyle(this.mGrayStyle, LuaCommentRegex3); range.SetStyle(this.mGrayStyle, this.LuaCommentRegex3);
//number highlighting //number highlighting
range.SetStyle(this.mNumberStyle, LuaNumberRegex); range.SetStyle(this.mNumberStyle, this.LuaNumberRegex);
//keyword highlighting //keyword highlighting
range.SetStyle(this.mKeywordStyle, LuaKeywordRegex); range.SetStyle(this.mKeywordStyle, this.LuaKeywordRegex);
//functions highlighting //functions highlighting
range.SetStyle(this.mFunStyle, LuaFunctionsRegex); range.SetStyle(this.mFunStyle, this.LuaFunctionsRegex);
range.SetStyle(this.mNumberStyle, @"\bc\d+\b"); range.SetStyle(this.mNumberStyle, @"\bc\d+\b");
range.SetStyle(this.conStyle, @"[\s|\(|+|,]{0,1}(?<range>[A-Z_]+?)[\)|+|\s|,|;]"); range.SetStyle(this.conStyle, @"[\s|\(|+|,]{0,1}(?<range>[A-Z_]+?)[\)|+|\s|,|;]");
......
...@@ -3,10 +3,10 @@ ...@@ -3,10 +3,10 @@
* desc :卡片类 * desc :卡片类
* ModiftyDate :2014-02-12 * ModiftyDate :2014-02-12
*/ */
using DataEditorX.Core.Info;
using System; using System;
using System.Globalization; using System.Globalization;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using DataEditorX.Core.Info;
namespace DataEditorX.Core namespace DataEditorX.Core
{ {
...@@ -75,7 +75,8 @@ public Card(long cardCode) ...@@ -75,7 +75,8 @@ public Card(long cardCode)
/// <summary>脚本文件文字</summary> /// <summary>脚本文件文字</summary>
public string[] Str public string[] Str
{ {
get { get
{
if (this.str == null) if (this.str == null)
{ {
this.str = new string[STR_MAX]; this.str = new string[STR_MAX];
...@@ -91,7 +92,7 @@ public string[] Str ...@@ -91,7 +92,7 @@ public string[] Str
public long[] GetSetCode() public long[] GetSetCode()
{ {
long[] setcodes = new long[SETCODE_MAX]; long[] setcodes = new long[SETCODE_MAX];
for (int i = 0,k = 0; i < SETCODE_MAX; k += 0x10, i++) for (int i = 0, k = 0; i < SETCODE_MAX; k += 0x10, i++)
{ {
setcodes[i] = (this.setcode >> k) & 0xffff; setcodes[i] = (this.setcode >> k) & 0xffff;
} }
...@@ -222,7 +223,7 @@ public bool EqualsData(Card other) ...@@ -222,7 +223,7 @@ public bool EqualsData(Card other)
public bool Equals(Card other) public bool Equals(Card other)
{ {
bool equalBool=this.EqualsData(other); bool equalBool=this.EqualsData(other);
if(!equalBool) if (!equalBool)
{ {
return false; return false;
} }
...@@ -266,8 +267,9 @@ public override int GetHashCode() ...@@ -266,8 +267,9 @@ public override int GetHashCode()
/// </summary> /// </summary>
/// <param name="type"></param> /// <param name="type"></param>
/// <returns></returns> /// <returns></returns>
public bool IsType(CardType type){ public bool IsType(CardType type)
if((this.type & (long)type) == (long)type) {
if ((this.type & (long)type) == (long)type)
{ {
return true; return true;
} }
...@@ -318,22 +320,26 @@ public string IdString ...@@ -318,22 +320,26 @@ public string IdString
public override string ToString() public override string ToString()
{ {
string str; string str;
if (this.IsType(CardType.TYPE_MONSTER)){ if (this.IsType(CardType.TYPE_MONSTER))
{
str = this.name + "[" + this.IdString + "]\n[" str = this.name + "[" + this.IdString + "]\n["
+ YGOUtil.GetTypeString(this.type) + "] " + YGOUtil.GetTypeString(this.type) + "] "
+ YGOUtil.GetRace(this.race) + "/" + YGOUtil.GetAttributeString(this.attribute) + YGOUtil.GetRace(this.race) + "/" + YGOUtil.GetAttributeString(this.attribute)
+ "\n" + this.levelString() + " " + this.atk + "/" + this.def + "\n" + this.redesc(); + "\n" + this.levelString() + " " + this.atk + "/" + this.def + "\n" + this.redesc();
}else }
else
{ {
str = this.name +"[" + this.IdString +"]\n["+YGOUtil.GetTypeString(this.type)+"]\n"+ this.redesc(); str = this.name + "[" + this.IdString + "]\n[" + YGOUtil.GetTypeString(this.type) + "]\n" + this.redesc();
} }
return str; return str;
} }
public string ToShortString(){ public string ToShortString()
return this.name+" ["+ this.IdString +"]"; {
return this.name + " [" + this.IdString + "]";
} }
public string ToLongString(){ public string ToLongString()
{
return this.ToString(); return this.ToString();
} }
......
using System; using DataEditorX.Config;
using DataEditorX.Language;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text;
using System.IO; using System.IO;
using DataEditorX.Config; using System.Text;
using DataEditorX.Language;
using DataEditorX.Core.Info;
namespace DataEditorX.Core namespace DataEditorX.Core
{ {
...@@ -27,7 +25,7 @@ public CardEdit(IDataForm dataform) ...@@ -27,7 +25,7 @@ public CardEdit(IDataForm dataform)
#region 添加 #region 添加
//添加 //添加
public class AddCommand: IBackableCommand public class AddCommand : IBackableCommand
{ {
private string undoSQL; private string undoSQL;
readonly IDataForm dataform; readonly IDataForm dataform;
...@@ -84,7 +82,7 @@ public object Clone() ...@@ -84,7 +82,7 @@ public object Clone()
#region 修改 #region 修改
//修改 //修改
public class ModCommand: IBackableCommand public class ModCommand : IBackableCommand
{ {
private string undoSQL; private string undoSQL;
private bool modifiled = false; private bool modifiled = false;
...@@ -283,11 +281,16 @@ public bool OpenScript(bool openinthis, string addrequire) ...@@ -283,11 +281,16 @@ public bool OpenScript(bool openinthis, string addrequire)
Card c = this.dataform.GetCard(); Card c = this.dataform.GetCard();
long id = c.id; long id = c.id;
string lua; string lua;
if (c.id > 0) { if (c.id > 0)
{
lua = this.dataform.GetPath().GetScript(id); lua = this.dataform.GetPath().GetScript(id);
} else if (addrequire.Length > 0) { }
else if (addrequire.Length > 0)
{
lua = this.dataform.GetPath().GetModuleScript(addrequire); lua = this.dataform.GetPath().GetModuleScript(addrequire);
} else { }
else
{
return false; return false;
} }
if (!File.Exists(lua)) if (!File.Exists(lua))
...@@ -296,7 +299,7 @@ public bool OpenScript(bool openinthis, string addrequire) ...@@ -296,7 +299,7 @@ public bool OpenScript(bool openinthis, string addrequire)
if (MyMsg.Question(LMSG.IfCreateScript))//是否创建脚本 if (MyMsg.Question(LMSG.IfCreateScript))//是否创建脚本
{ {
using (FileStream fs = new FileStream(lua, using (FileStream fs = new FileStream(lua,
FileMode.OpenOrCreate,FileAccess.Write)) FileMode.OpenOrCreate, FileAccess.Write))
{ {
StreamWriter sw = new StreamWriter(fs, new UTF8Encoding(false)); StreamWriter sw = new StreamWriter(fs, new UTF8Encoding(false));
if (string.IsNullOrEmpty(addrequire)) if (string.IsNullOrEmpty(addrequire))
......
...@@ -46,7 +46,7 @@ private void CommandManager_ReverseUndoStateChanged(bool val) ...@@ -46,7 +46,7 @@ private void CommandManager_ReverseUndoStateChanged(bool val)
#region ICommandManager 成员 #region ICommandManager 成员
public void ExcuteCommand(ICommand command, params object[] args) public void ExcuteCommand(ICommand command, params object[] args)
{ {
if(!command.Excute(args)) if (!command.Excute(args))
{ {
return; return;
} }
......
This diff is collapsed.
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
* 时间: 9:47 * 时间: 9:47
* *
*/ */
using System;
namespace DataEditorX.Core.Info namespace DataEditorX.Core.Info
{ {
......
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
* *
* 要改变这种模板请点击 工具|选项|代码编写|编辑标准头文件 * 要改变这种模板请点击 工具|选项|代码编写|编辑标准头文件
*/ */
using System;
namespace DataEditorX.Core.Info namespace DataEditorX.Core.Info
{ {
...@@ -30,7 +29,8 @@ public static class CardLink ...@@ -30,7 +29,8 @@ public static class CardLink
public const int Up = 0x80; public const int Up = 0x80;
public const int UpRight = 0x100; 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; return (marks & mark) == mark;
} }
} }
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
* 时间: 9:44 * 时间: 9:44
* *
*/ */
using System;
namespace DataEditorX.Core.Info namespace DataEditorX.Core.Info
{ {
......
 
namespace DataEditorX.Core.Info namespace DataEditorX.Core.Info
{ {
public enum CardRule :int public enum CardRule : int
{ {
/// <summary>无</summary> /// <summary>无</summary>
NONE = 0, NONE = 0,
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
* 时间: 9:08 * 时间: 9:08
* *
*/ */
using System;
using System.Collections.Generic; using System.Collections.Generic;
namespace DataEditorX.Core.Info namespace DataEditorX.Core.Info
...@@ -16,61 +15,62 @@ namespace DataEditorX.Core.Info ...@@ -16,61 +15,62 @@ namespace DataEditorX.Core.Info
public enum CardType : long public enum CardType : long
{ {
///<summary>怪兽卡</summary> ///<summary>怪兽卡</summary>
TYPE_MONSTER =0x1 , TYPE_MONSTER =0x1,
///<summary>魔法卡</summary> ///<summary>魔法卡</summary>
TYPE_SPELL =0x2 , TYPE_SPELL =0x2,
///<summary>陷阱卡</summary> ///<summary>陷阱卡</summary>
TYPE_TRAP =0x4 , TYPE_TRAP =0x4,
///<summary>通常</summary> ///<summary>通常</summary>
TYPE_NORMAL =0x10 , TYPE_NORMAL =0x10,
///<summary>效果</summary> ///<summary>效果</summary>
TYPE_EFFECT =0x20 , TYPE_EFFECT =0x20,
///<summary>融合</summary> ///<summary>融合</summary>
TYPE_FUSION =0x40 , TYPE_FUSION =0x40,
///<summary>仪式</summary> ///<summary>仪式</summary>
TYPE_RITUAL =0x80 , TYPE_RITUAL =0x80,
///<summary>陷阱怪兽</summary> ///<summary>陷阱怪兽</summary>
TYPE_TRAPMONSTER =0x100 , TYPE_TRAPMONSTER =0x100,
///<summary>灵魂</summary> ///<summary>灵魂</summary>
TYPE_SPIRIT =0x200 , TYPE_SPIRIT =0x200,
///<summary>同盟</summary> ///<summary>同盟</summary>
TYPE_UNION =0x400 , TYPE_UNION =0x400,
///<summary>二重</summary> ///<summary>二重</summary>
TYPE_DUAL =0x800 , TYPE_DUAL =0x800,
///<summary>调整</summary> ///<summary>调整</summary>
TYPE_TUNER =0x1000 , TYPE_TUNER =0x1000,
///<summary>同调</summary> ///<summary>同调</summary>
TYPE_SYNCHRO =0x2000 , TYPE_SYNCHRO =0x2000,
///<summary>衍生物</summary> ///<summary>衍生物</summary>
TYPE_TOKEN =0x4000 , TYPE_TOKEN =0x4000,
///<summary>速攻</summary> ///<summary>速攻</summary>
TYPE_QUICKPLAY =0x10000 , TYPE_QUICKPLAY =0x10000,
///<summary>永续</summary> ///<summary>永续</summary>
TYPE_CONTINUOUS =0x20000 , TYPE_CONTINUOUS =0x20000,
///<summary>装备</summary> ///<summary>装备</summary>
TYPE_EQUIP =0x40000 , TYPE_EQUIP =0x40000,
///<summary>场地</summary> ///<summary>场地</summary>
TYPE_FIELD =0x80000 , TYPE_FIELD =0x80000,
///<summary>反击</summary> ///<summary>反击</summary>
TYPE_COUNTER =0x100000 , TYPE_COUNTER =0x100000,
///<summary>反转</summary> ///<summary>反转</summary>
TYPE_FLIP =0x200000 , TYPE_FLIP =0x200000,
///<summary>卡通</summary> ///<summary>卡通</summary>
TYPE_TOON =0x400000 , TYPE_TOON =0x400000,
///<summary>超量</summary> ///<summary>超量</summary>
TYPE_XYZ =0x800000 , TYPE_XYZ =0x800000,
///<summary>灵摆</summary> ///<summary>灵摆</summary>
TYPE_PENDULUM =0x1000000 , TYPE_PENDULUM =0x1000000,
///<summary>特殊召唤</summary> ///<summary>特殊召唤</summary>
TYPE_SPSUMMON =0x2000000 , TYPE_SPSUMMON =0x2000000,
///<summary>连接</summary> ///<summary>连接</summary>
TYPE_LINK =0x4000000 , TYPE_LINK =0x4000000,
} }
public static class CardTypes{ public static class CardTypes
{
public static readonly CardType[] TYPE1 = { public static readonly CardType[] TYPE1 = {
CardType.TYPE_TOKEN, CardType.TYPE_TOKEN,
CardType.TYPE_LINK, CardType.TYPE_LINK,
...@@ -157,16 +157,20 @@ public static class CardTypes{ ...@@ -157,16 +157,20 @@ public static class CardTypes{
CardType.TYPE_EFFECT, CardType.TYPE_EFFECT,
CardType.TYPE_NORMAL, CardType.TYPE_NORMAL,
}; };
public static CardType[] GetMonsterTypes(long type,bool no10=false){ public static CardType[] GetMonsterTypes(long type, bool no10 = false)
{
var list = new List<CardType>(5); var list = new List<CardType>(5);
var typeList=new List<CardType[]>(5); var typeList=new List<CardType[]>(5);
if(no10){ if (no10)
{
typeList.Add(TYPE1_10); typeList.Add(TYPE1_10);
typeList.Add(TYPE2_10); typeList.Add(TYPE2_10);
typeList.Add(TYPE3_10); typeList.Add(TYPE3_10);
typeList.Add(TYPE4_10); typeList.Add(TYPE4_10);
typeList.Add(TYPE4_10); typeList.Add(TYPE4_10);
}else{ }
else
{
typeList.Add(TYPE1); typeList.Add(TYPE1);
typeList.Add(TYPE2); typeList.Add(TYPE2);
typeList.Add(TYPE3); typeList.Add(TYPE3);
...@@ -175,11 +179,15 @@ public static class CardTypes{ ...@@ -175,11 +179,15 @@ public static class CardTypes{
} }
int count = typeList.Count; int count = typeList.Count;
for(int i=0;i<count;i++){ for (int i = 0; i < count; i++)
{
CardType[] types = typeList[i]; CardType[] types = typeList[i];
foreach(var t in types){ foreach (var t in types)
if((type & (long)t)==(long)t){ {
if(!list.Contains(t)){ if ((type & (long)t) == (long)t)
{
if (!list.Contains(t))
{
list.Add(t); list.Add(t);
break; break;
} }
......
This diff is collapsed.
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
* *
* 要改变这种模板请点击 工具|选项|代码编写|编辑标准头文件 * 要改变这种模板请点击 工具|选项|代码编写|编辑标准头文件
*/ */
using System;
namespace DataEditorX.Core namespace DataEditorX.Core
{ {
...@@ -17,10 +16,11 @@ public class CardPack ...@@ -17,10 +16,11 @@ public class CardPack
{ {
public CardPack(long id) public CardPack(long id)
{ {
this.CardId=id; this.CardId = id;
} }
public long CardId{ public long CardId
{
get; get;
private set; private set;
} }
...@@ -29,69 +29,72 @@ public CardPack(long id) ...@@ -29,69 +29,72 @@ public CardPack(long id)
public string rarity; public string rarity;
public string date; public string date;
public string GetMseRarity(){ public string GetMseRarity()
if(this.rarity==null) {
if (this.rarity == null)
{ {
return "common"; return "common";
} }
string rarity=this.rarity.Trim().ToLower(); string rarity=this.rarity.Trim().ToLower();
if(rarity.Equals("common") || rarity.Equals("short print")) if (rarity.Equals("common") || rarity.Equals("short print"))
{ {
return "common"; return "common";
} }
if(rarity.Equals("rare") ||rarity.Equals("normal rare")) if (rarity.Equals("rare") || rarity.Equals("normal rare"))
{ {
return "rare"; return "rare";
}else if(rarity.Contains("parallel") || rarity.Contains("Kaiba") || rarity.Contains("duel terminal")) }
else if (rarity.Contains("parallel") || rarity.Contains("Kaiba") || rarity.Contains("duel terminal"))
{ {
return "parallel rare"; return "parallel rare";
} }
else if(rarity.Contains("super") ||rarity.Contains("holofoil")) else if (rarity.Contains("super") || rarity.Contains("holofoil"))
{ {
return "super rare"; return "super rare";
} }
else if(rarity.Contains("ultra")) else if (rarity.Contains("ultra"))
{ {
return "ultra rare"; return "ultra rare";
} }
else if(rarity.Contains("secret")) else if (rarity.Contains("secret"))
{ {
return "secret rare"; return "secret rare";
} }
else if(rarity.Contains("gold")) else if (rarity.Contains("gold"))
{ {
return "gold rare"; return "gold rare";
} }
else if(rarity.Contains("ultimate")) else if (rarity.Contains("ultimate"))
{ {
return "ultimate rare"; return "ultimate rare";
} }
else if(rarity.Contains("prismatic")) else if (rarity.Contains("prismatic"))
{ {
return "prismatic rare"; return "prismatic rare";
} }
else if(rarity.Contains("star")) else if (rarity.Contains("star"))
{ {
return "star rare"; return "star rare";
} }
else if(rarity.Contains("mosaic")) else if (rarity.Contains("mosaic"))
{ {
return "mosaic rare"; return "mosaic rare";
} }
else if(rarity.Contains("platinum")) else if (rarity.Contains("platinum"))
{ {
return "platinum rare"; return "platinum rare";
} }
else if(rarity.Contains("ghost") || rarity.Contains("holographic")) else if (rarity.Contains("ghost") || rarity.Contains("holographic"))
{ {
return "ghost rare"; return "ghost rare";
} }
else if(rarity.Contains("millenium")) else if (rarity.Contains("millenium"))
{ {
return "millenium rare"; return "millenium rare";
} }
if(this.rarity.Contains("/")){ if (this.rarity.Contains("/"))
{
return this.rarity.Split('/')[0]; return this.rarity.Split('/')[0];
} }
return this.rarity; return this.rarity;
......
...@@ -5,15 +5,11 @@ ...@@ -5,15 +5,11 @@
* 时间: 15:47 * 时间: 15:47
* *
*/ */
using System; using DataEditorX.Common;
using System.Configuration; using DataEditorX.Config;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Text; using System.Text;
using DataEditorX.Language;
using System.Globalization;
using DataEditorX.Common;
using DataEditorX.Config;
namespace DataEditorX.Core.Mse namespace DataEditorX.Core.Mse
{ {
...@@ -125,26 +121,34 @@ public void SetConfig(string config, string path) ...@@ -125,26 +121,34 @@ public void SetConfig(string config, string path)
{ {
this.maxcount = ConfHelper.GetIntegerValue(line, 0); this.maxcount = ConfHelper.GetIntegerValue(line, 0);
} }
else if (line.StartsWith(TAG_WIDTH)){ else if (line.StartsWith(TAG_WIDTH))
this.width =ConfHelper.GetIntegerValue(line,0); {
this.width = ConfHelper.GetIntegerValue(line, 0);
} }
else if (line.StartsWith(TAG_HEIGHT)){ 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)){ 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)){ 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)){ 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)){ }
else if (line.StartsWith(TAG_NO_START_CARDS))
{
string val = ConfHelper.GetValue(line); string val = ConfHelper.GetValue(line);
string[] cs = val.Split(','); string[] cs = val.Split(',');
this.noStartCards =new long[cs.Length]; this.noStartCards = new long[cs.Length];
int i=0; int i=0;
foreach(string str in cs){ foreach (string str in cs)
{
long.TryParse(str, out long l); long.TryParse(str, out long l);
this.noStartCards[i++] = l; this.noStartCards[i++] = l;
} }
...@@ -174,7 +178,9 @@ public void SetConfig(string config, string path) ...@@ -174,7 +178,9 @@ public void SetConfig(string config, string path)
else if (line.StartsWith(TAG_TYPE)) else if (line.StartsWith(TAG_TYPE))
{//类型 {//类型
ConfHelper.DicAdd(this.typeDic, line); ConfHelper.DicAdd(this.typeDic, line);
}else if(line.StartsWith(TAG_REIMAGE)){ }
else if (line.StartsWith(TAG_REIMAGE))
{
this.reimage = ConfHelper.GetBooleanValue(line); this.reimage = ConfHelper.GetBooleanValue(line);
} }
} }
...@@ -189,7 +195,7 @@ public void Init(string path) ...@@ -189,7 +195,7 @@ public void Init(string path)
if (!File.Exists(tmp)) if (!File.Exists(tmp))
{ {
tmp = MyPath.Combine(path, MyPath.GetFileName(TAG, FILE_CONFIG_NAME)); tmp = MyPath.Combine(path, MyPath.GetFileName(TAG, FILE_CONFIG_NAME));
if(!File.Exists(tmp)) if (!File.Exists(tmp))
{ {
return;//如果默认的也不存在 return;//如果默认的也不存在
} }
......
using System; namespace DataEditorX.Core.Mse
using System.Collections.Generic;
using System.Text;
namespace DataEditorX.Core.Mse
{ {
public class MseAttribute public class MseAttribute
{ {
......
This diff is collapsed.
 
using Newtonsoft.Json;
using System; using System;
using System.IO; using System.IO;
using Newtonsoft.Json;
namespace DataEditorX namespace DataEditorX
{ {
public class CardSet{ public class CardSet
{
public int game; public int game;
public int version; public int version;
public MySortList<string, CardInfo> cards; public MySortList<string, CardInfo> cards;
} }
public class CardInfo{ public class CardInfo
{
public string title; public string title;
public string artwork; public string artwork;
public int[] artwork_crop; public int[] artwork_crop;
...@@ -47,13 +49,17 @@ public override string ToString() ...@@ -47,13 +49,17 @@ public override string ToString()
} }
} }
public class CardJson{ public class CardJson
public static void Test(){ {
public static void Test()
{
string json = File.ReadAllText(@"F:\TCGEditor_v1.2\t.tcgb"); string json = File.ReadAllText(@"F:\TCGEditor_v1.2\t.tcgb");
CardSet cardset = JsonConvert.DeserializeObject<CardSet>(json); CardSet cardset = JsonConvert.DeserializeObject<CardSet>(json);
if(cardset.cards!=null){ if (cardset.cards != null)
{
int index=0; int index=0;
foreach(string key in cardset.cards.Keys){ foreach (string key in cardset.cards.Keys)
{
Console.WriteLine(key); Console.WriteLine(key);
CardInfo card = cardset.cards.Values[index]; CardInfo card = cardset.cards.Values[index];
Console.WriteLine(card); Console.WriteLine(card);
......
...@@ -5,22 +5,17 @@ ...@@ -5,22 +5,17 @@
* 时间: 19:43 * 时间: 19:43
* *
*/ */
using System; using DataEditorX.Common;
using DataEditorX.Config;
using DataEditorX.Core.Info;
using DataEditorX.Core.Mse;
using DataEditorX.Language;
using System.Collections.Generic; using System.Collections.Generic;
using System.Configuration; using System.ComponentModel;
using System.Drawing; using System.Drawing;
using System.Drawing.Imaging;
using System.IO; using System.IO;
using System.IO.Compression; using System.IO.Compression;
using System.Windows.Forms; using System.Windows.Forms;
using System.ComponentModel;
using DataEditorX.Language;
using DataEditorX.Common;
using DataEditorX.Config;
using DataEditorX.Core.Mse;
using DataEditorX.Core.Info;
using System.Xml;
namespace DataEditorX.Core namespace DataEditorX.Core
{ {
...@@ -103,7 +98,8 @@ public MyTask GetLastTask() ...@@ -103,7 +98,8 @@ public MyTask GetLastTask()
return this.lastTask; return this.lastTask;
} }
public void TestPendulumText(string desc){ public void TestPendulumText(string desc)
{
this.mseHelper.TestPendulum(desc); this.mseHelper.TestPendulum(desc);
} }
#endregion #endregion
...@@ -281,23 +277,23 @@ public string MSEImagePath ...@@ -281,23 +277,23 @@ public string MSEImagePath
public string Datapath { get; } public string Datapath { get; }
public void SaveMSEs(string file, Card[] cards,bool isUpdate) public void SaveMSEs(string file, Card[] cards, bool isUpdate)
{ {
if(cards == null) if (cards == null)
{ {
return; return;
} }
string pack_db=MyPath.GetRealPath(MyConfig.ReadString("pack_db")); string pack_db=MyPath.GetRealPath(MyConfig.ReadString("pack_db"));
bool rarity=MyConfig.ReadBoolean("mse_auto_rarity", false); bool rarity=MyConfig.ReadBoolean("mse_auto_rarity", false);
#if DEBUG #if DEBUG
MessageBox.Show("db = "+pack_db+",auto rarity="+rarity); MessageBox.Show("db = " + pack_db + ",auto rarity=" + rarity);
#endif #endif
int c = cards.Length; int c = cards.Length;
//不分开,或者卡片数小于单个存档的最大值 //不分开,或者卡片数小于单个存档的最大值
if (this.mseHelper.MaxNum == 0 || c < this.mseHelper.MaxNum) if (this.mseHelper.MaxNum == 0 || c < this.mseHelper.MaxNum)
{ {
this.SaveMSE(1, file, cards,pack_db, rarity, isUpdate); this.SaveMSE(1, file, cards, pack_db, rarity, isUpdate);
} }
else else
{ {
...@@ -322,11 +318,11 @@ public void SaveMSEs(string file, Card[] cards,bool isUpdate) ...@@ -322,11 +318,11 @@ public void SaveMSEs(string file, Card[] cards,bool isUpdate)
int t = file.LastIndexOf(".mse-set"); int t = file.LastIndexOf(".mse-set");
string fname = (t > 0) ? file.Substring(0, t) : file; string fname = (t > 0) ? file.Substring(0, t) : file;
fname += string.Format("_{0}.mse-set", i + 1); fname += string.Format("_{0}.mse-set", i + 1);
this.SaveMSE(i + 1, fname, clist.ToArray(),pack_db, rarity, isUpdate); this.SaveMSE(i + 1, fname, clist.ToArray(), pack_db, rarity, isUpdate);
} }
} }
} }
public void SaveMSE(int num, string file, Card[] cards,string pack_db,bool rarity, bool isUpdate) public void SaveMSE(int num, string file, Card[] cards, string pack_db, bool rarity, bool isUpdate)
{ {
string setFile = file + ".txt"; string setFile = file + ".txt";
Dictionary<Card, string> images = this.mseHelper.WriteSet(setFile, cards,pack_db,rarity); Dictionary<Card, string> images = this.mseHelper.WriteSet(setFile, cards,pack_db,rarity);
...@@ -352,7 +348,7 @@ public void SaveMSE(int num, string file, Card[] cards,string pack_db,bool rarit ...@@ -352,7 +348,7 @@ public void SaveMSE(int num, string file, Card[] cards,string pack_db,bool rarit
i++; i++;
this.worker.ReportProgress(i / count, string.Format("{0}/{1}-{2}", i, count, num)); this.worker.ReportProgress(i / count, string.Format("{0}/{1}-{2}", i, count, num));
//TODO 先裁剪图片 //TODO 先裁剪图片
zips.AddFile(this.mseHelper.GetImageCache(img,c), Path.GetFileName(img), ""); zips.AddFile(this.mseHelper.GetImageCache(img, c), Path.GetFileName(img), "");
} }
} }
File.Delete(setFile); File.Delete(setFile);
...@@ -360,7 +356,7 @@ public void SaveMSE(int num, string file, Card[] cards,string pack_db,bool rarit ...@@ -360,7 +356,7 @@ public void SaveMSE(int num, string file, Card[] cards,string pack_db,bool rarit
public Card[] ReadMSE(string mseset, bool repalceOld) public Card[] ReadMSE(string mseset, bool repalceOld)
{ {
//解压所有文件 //解压所有文件
using (ZipStorer zips = ZipStorer.Open(mseset,FileAccess.Read)) using (ZipStorer zips = ZipStorer.Open(mseset, FileAccess.Read))
{ {
zips.EncodeUTF8 = true; zips.EncodeUTF8 = true;
List<ZipStorer.ZipFileEntry> files = zips.ReadCentralDir(); List<ZipStorer.ZipFileEntry> files = zips.ReadCentralDir();
...@@ -439,7 +435,7 @@ public void ExportData(string path, string zipname, string _cdbfile, string modu ...@@ -439,7 +435,7 @@ public void ExportData(string path, string zipname, string _cdbfile, string modu
{ {
if (!string.Equals(file, extra_script) && File.Exists(file)) if (!string.Equals(file, extra_script) && File.Exists(file))
{ {
zips.AddFile(file, file.Replace(path,""), ""); zips.AddFile(file, file.Replace(path, ""), "");
} }
} }
} }
...@@ -531,7 +527,7 @@ public void Run() ...@@ -531,7 +527,7 @@ public void Run()
this.isRun = false; this.isRun = false;
this.lastTask = this.nowTask; this.lastTask = this.nowTask;
this.nowTask = MyTask.NONE; this.nowTask = MyTask.NONE;
if(this.lastTask != MyTask.ReadMSE) if (this.lastTask != MyTask.ReadMSE)
{ {
this.cardlist = null; this.cardlist = null;
} }
......
using System; using DataEditorX.Config;
using System.Text;
using System.IO;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using Microsoft.VisualBasic.FileIO;
using System.Configuration;
using DataEditorX.Config;
using DataEditorX.Core.Info; using DataEditorX.Core.Info;
using Microsoft.VisualBasic.FileIO;
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
namespace DataEditorX.Core namespace DataEditorX.Core
{ {
...@@ -271,7 +268,8 @@ public static void CardRename(long newid, long oldid, YgoPath ygopath) ...@@ -271,7 +268,8 @@ public static void CardRename(long newid, long oldid, YgoPath ygopath)
{ {
if (File.Exists(oldfiles[i])) if (File.Exists(oldfiles[i]))
{ {
try { try
{
File.Move(oldfiles[i], newfiles[i]); File.Move(oldfiles[i], newfiles[i]);
} }
catch { } catch { }
...@@ -290,7 +288,8 @@ public static void CardCopy(long newid, long oldid, YgoPath ygopath) ...@@ -290,7 +288,8 @@ public static void CardCopy(long newid, long oldid, YgoPath ygopath)
{ {
if (File.Exists(oldfiles[i])) if (File.Exists(oldfiles[i]))
{ {
try { try
{
File.Copy(oldfiles[i], newfiles[i], false); File.Copy(oldfiles[i], newfiles[i], false);
} }
catch { } catch { }
......
...@@ -5,18 +5,17 @@ ...@@ -5,18 +5,17 @@
* 时间: 20:22 * 时间: 20:22
* *
*/ */
using DataEditorX.Common;
using DataEditorX.Config;
using DataEditorX.Core;
using DataEditorX.Core.Mse;
using DataEditorX.Language;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing; using System.Drawing;
using System.Globalization; using System.Globalization;
using System.IO; using System.IO;
using System.Windows.Forms; using System.Windows.Forms;
using DataEditorX.Common;
using DataEditorX.Config;
using DataEditorX.Core;
using DataEditorX.Core.Mse;
using DataEditorX.Language;
using WeifenLuo.WinFormsUI.Docking; using WeifenLuo.WinFormsUI.Docking;
namespace DataEditorX namespace DataEditorX
...@@ -343,17 +342,20 @@ void InitCheckPanel(FlowLayoutPanel fpanel, Dictionary<long, string> dic) ...@@ -343,17 +342,20 @@ void InitCheckPanel(FlowLayoutPanel fpanel, Dictionary<long, string> dic)
foreach (long key in dic.Keys) foreach (long key in dic.Keys)
{ {
string value = dic[key]; string value = dic[key];
if(value != null && value.StartsWith("NULL")) if (value != null && value.StartsWith("NULL"))
{ {
Label lab=new Label(); Label lab=new Label();
string[] sizes = value.Split(','); string[] sizes = value.Split(',');
if(sizes.Length>=3){ if (sizes.Length >= 3)
lab.Size=new Size(int.Parse(sizes[1]),int.Parse(sizes[2])); {
lab.Size = new Size(int.Parse(sizes[1]), int.Parse(sizes[2]));
} }
lab.AutoSize = false; lab.AutoSize = false;
lab.Margin = fpanel.Margin; lab.Margin = fpanel.Margin;
fpanel.Controls.Add(lab); fpanel.Controls.Add(lab);
}else{ }
else
{
CheckBox _cbox = new CheckBox CheckBox _cbox = new CheckBox
{ {
//_cbox.Name = fpanel.Name + key.ToString("x"); //_cbox.Name = fpanel.Name + key.ToString("x");
...@@ -404,12 +406,14 @@ void InitListRows() ...@@ -404,12 +406,14 @@ void InitListRows()
if (itemH > 0) if (itemH > 0)
{ {
int n = (this.lv_cardlist.Height - headH) / itemH; int n = (this.lv_cardlist.Height - headH) / itemH;
if (n > 0){ if (n > 0)
{
this.maxRow = n; this.maxRow = n;
} }
//MessageBox.Show("height="+lv_cardlist.Height+",item="+itemH+",head="+headH+",max="+MaxRow); //MessageBox.Show("height="+lv_cardlist.Height+",item="+itemH+",head="+headH+",max="+MaxRow);
} }
if(addTest){ if (addTest)
{
this.lv_cardlist.Items.Clear(); this.lv_cardlist.Items.Clear();
} }
if (this.maxRow < 10) if (this.maxRow < 10)
...@@ -587,13 +591,13 @@ public Card GetOldCard() ...@@ -587,13 +591,13 @@ public Card GetOldCard()
return this.oldCard; return this.oldCard;
} }
private void setLinkMarks(long mark,bool setCheck=false) private void setLinkMarks(long mark, bool setCheck = false)
{ {
if(setCheck) if (setCheck)
{ {
this.SetCheck(this.pl_markers, mark); this.SetCheck(this.pl_markers, mark);
} }
this.tb_link.Text= Convert.ToString(mark, 2).PadLeft(9,'0'); this.tb_link.Text = Convert.ToString(mark, 2).PadLeft(9, '0');
} }
public void SetCard(Card c) public void SetCard(Card c)
...@@ -621,11 +625,13 @@ public void SetCard(Card c) ...@@ -621,11 +625,13 @@ public void SetCard(Card c)
this.tb_setcode4.Text = setcodes[3].ToString("x"); this.tb_setcode4.Text = setcodes[3].ToString("x");
//type,category //type,category
this.SetCheck(this.pl_cardtype, c.type); this.SetCheck(this.pl_cardtype, c.type);
if (c.IsType(Core.Info.CardType.TYPE_LINK)){ if (c.IsType(Core.Info.CardType.TYPE_LINK))
{
this.setLinkMarks(c.def, true); this.setLinkMarks(c.def, true);
} }
else{ else
this.tb_link.Text=""; {
this.tb_link.Text = "";
this.SetCheck(this.pl_markers, 0); this.SetCheck(this.pl_markers, 0);
} }
this.SetCheck(this.pl_category, c.category); this.SetCheck(this.pl_category, c.category);
...@@ -1318,7 +1324,7 @@ public Card[] GetCardList(bool onlyselect) ...@@ -1318,7 +1324,7 @@ public Card[] GetCardList(bool onlyselect)
index = lvitem.Index + (this.page - 1) * this.maxRow; index = lvitem.Index + (this.page - 1) * this.maxRow;
} }
if (index>=0 && index < this.cardlist.Count) if (index >= 0 && index < this.cardlist.Count)
{ {
cards.Add(this.cardlist[index]); cards.Add(this.cardlist[index]);
} }
...@@ -1444,8 +1450,8 @@ void SaveAsMSE(bool onlyselect) ...@@ -1444,8 +1450,8 @@ void SaveAsMSE(bool onlyselect)
if (dlg.ShowDialog() == DialogResult.OK) if (dlg.ShowDialog() == DialogResult.OK)
{ {
bool isUpdate = false; bool isUpdate = false;
#if DEBUG #if DEBUG
isUpdate=MyMsg.Question(LMSG.OnlySet); isUpdate = MyMsg.Question(LMSG.OnlySet);
#endif #endif
this.tasker.SetTask(MyTask.SaveAsMSE, cards, this.tasker.SetTask(MyTask.SaveAsMSE, cards,
dlg.FileName, isUpdate.ToString()); dlg.FileName, isUpdate.ToString());
...@@ -1543,7 +1549,7 @@ public void SetImage(long id) ...@@ -1543,7 +1549,7 @@ public void SetImage(long id)
if (this.menuitem_importmseimg.Checked)//显示MSE图片 if (this.menuitem_importmseimg.Checked)//显示MSE图片
{ {
string msepic = MseMaker.GetCardImagePath(this.tasker.MSEImagePath, this.oldCard); string msepic = MseMaker.GetCardImagePath(this.tasker.MSEImagePath, this.oldCard);
if(File.Exists(msepic)) if (File.Exists(msepic))
{ {
this.pl_image.BackgroundImage = MyBitmap.ReadImage(msepic); this.pl_image.BackgroundImage = MyBitmap.ReadImage(msepic);
} }
...@@ -1685,7 +1691,7 @@ public void CompareCards(string cdbfile, bool checktext) ...@@ -1685,7 +1691,7 @@ public void CompareCards(string cdbfile, bool checktext)
//把文件添加到菜单 //把文件添加到菜单
void AddMenuItemFormMSE() void AddMenuItemFormMSE()
{ {
if(!Directory.Exists(this.datapath)) if (!Directory.Exists(this.datapath))
{ {
return; return;
} }
...@@ -1755,7 +1761,7 @@ private void menuitem_findluafunc_Click(object sender, EventArgs e) ...@@ -1755,7 +1761,7 @@ private void menuitem_findluafunc_Click(object sender, EventArgs e)
//系列名输入时 //系列名输入时
void setCode_InputText(int index, ComboBox cb, TextBox tb) void setCode_InputText(int index, ComboBox cb, TextBox tb)
{ {
if(index>=0 && index < this.setcodeIsedit.Length) if (index >= 0 && index < this.setcodeIsedit.Length)
{ {
if (this.setcodeIsedit[index])//如果正在编辑 if (this.setcodeIsedit[index])//如果正在编辑
{ {
...@@ -1959,16 +1965,22 @@ void Menuitem_exportMSEimageClick(object sender, EventArgs e) ...@@ -1959,16 +1965,22 @@ void Menuitem_exportMSEimageClick(object sender, EventArgs e)
} }
string msepath=MyPath.GetRealPath(MyConfig.ReadString(MyConfig.TAG_MSE_PATH)); string msepath=MyPath.GetRealPath(MyConfig.ReadString(MyConfig.TAG_MSE_PATH));
if(!File.Exists(msepath)){ if (!File.Exists(msepath))
{
MyMsg.Error(LMSG.exportMseImagesErr); MyMsg.Error(LMSG.exportMseImagesErr);
this.menuitem_exportMSEimage.Checked=false; this.menuitem_exportMSEimage.Checked = false;
return; return;
}else{ }
if(MseMaker.MseIsRunning()){ else
{
if (MseMaker.MseIsRunning())
{
MseMaker.MseStop(); MseMaker.MseStop();
this.menuitem_exportMSEimage.Checked=false; this.menuitem_exportMSEimage.Checked = false;
return; return;
}else{ }
else
{
} }
} }
...@@ -1981,26 +1993,32 @@ void Menuitem_exportMSEimageClick(object sender, EventArgs e) ...@@ -1981,26 +1993,32 @@ void Menuitem_exportMSEimageClick(object sender, EventArgs e)
{ {
string mseset=dlg.FileName; 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{ MseMaker.ExportSet(msepath, mseset, exportpath, delegate
this.menuitem_exportMSEimage.Checked=false; {
this.menuitem_exportMSEimage.Checked = false;
}); });
this.menuitem_exportMSEimage.Checked=true; this.menuitem_exportMSEimage.Checked = true;
}else{ }
this.menuitem_exportMSEimage.Checked=false; else
{
this.menuitem_exportMSEimage.Checked = false;
} }
} }
} }
void Menuitem_testPendulumTextClick(object sender, EventArgs e) void Menuitem_testPendulumTextClick(object sender, EventArgs e)
{ {
Card c = this.GetCard(); Card c = this.GetCard();
if(c != null){ if (c != null)
{
this.tasker.TestPendulumText(c.desc); this.tasker.TestPendulumText(c.desc);
} }
} }
void Menuitem_export_select_sqlClick(object sender, EventArgs e) void Menuitem_export_select_sqlClick(object sender, EventArgs e)
{ {
using(SaveFileDialog dlg = new SaveFileDialog()){ using (SaveFileDialog dlg = new SaveFileDialog())
if(dlg.ShowDialog() == DialogResult.OK){ {
if (dlg.ShowDialog() == DialogResult.OK)
{
DataBase.ExportSql(dlg.FileName, this.GetCardList(true)); DataBase.ExportSql(dlg.FileName, this.GetCardList(true));
MyMsg.Show("OK"); MyMsg.Show("OK");
} }
...@@ -2008,8 +2026,10 @@ void Menuitem_export_select_sqlClick(object sender, EventArgs e) ...@@ -2008,8 +2026,10 @@ void Menuitem_export_select_sqlClick(object sender, EventArgs e)
} }
void Menuitem_export_all_sqlClick(object sender, EventArgs e) void Menuitem_export_all_sqlClick(object sender, EventArgs e)
{ {
using(SaveFileDialog dlg = new SaveFileDialog()){ using (SaveFileDialog dlg = new SaveFileDialog())
if(dlg.ShowDialog() == DialogResult.OK){ {
if (dlg.ShowDialog() == DialogResult.OK)
{
DataBase.ExportSql(dlg.FileName, this.GetCardList(false)); DataBase.ExportSql(dlg.FileName, this.GetCardList(false));
MyMsg.Show("OK"); MyMsg.Show("OK");
} }
...@@ -2041,7 +2061,8 @@ void Menuitem_autoreturnClick(object sender, EventArgs e) ...@@ -2041,7 +2061,8 @@ void Menuitem_autoreturnClick(object sender, EventArgs e)
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++) for (int i = 0; i < count; i++)
{ {
if(cards[i].desc!=null){ if (cards[i].desc != null)
{
cards[i].desc = StrUtil.AutoEnter(cards[i].desc, len, ' '); cards[i].desc = StrUtil.AutoEnter(cards[i].desc, len, ' ');
} }
} }
...@@ -2092,10 +2113,13 @@ void Menuitem_replaceClick(object sender, EventArgs e) ...@@ -2092,10 +2113,13 @@ void Menuitem_replaceClick(object sender, EventArgs e)
private void text2LinkMarks(string text) private void text2LinkMarks(string text)
{ {
try{ try
{
long mark=Convert.ToInt64(text, 2); long mark=Convert.ToInt64(text, 2);
this.setLinkMarks(mark, true); this.setLinkMarks(mark, true);
}catch{ }
catch
{
// //
} }
} }
...@@ -2138,10 +2162,13 @@ private void menuitem_language_Click(object sender, EventArgs e) ...@@ -2138,10 +2162,13 @@ private void menuitem_language_Click(object sender, EventArgs e)
void Tb_linkKeyPress(object sender, KeyPressEventArgs e) void Tb_linkKeyPress(object sender, KeyPressEventArgs e)
{ {
if(e.KeyChar != '0' && e.KeyChar != '1' && e.KeyChar != 1 && e.KeyChar!=22 && e.KeyChar!=3 && e.KeyChar != 8){ if (e.KeyChar != '0' && e.KeyChar != '1' && e.KeyChar != 1 && e.KeyChar != 22 && e.KeyChar != 3 && e.KeyChar != 8)
// MessageBox.Show("key="+(int)e.KeyChar); {
// MessageBox.Show("key="+(int)e.KeyChar);
e.Handled = true; e.Handled = true;
}else{ }
else
{
this.text2LinkMarks(this.tb_link.Text); this.text2LinkMarks(this.tb_link.Text);
} }
} }
......
...@@ -5,13 +5,12 @@ ...@@ -5,13 +5,12 @@
* 时间: 10:21 * 时间: 10:21
* *
*/ */
using System;
namespace DataEditorX.Language namespace DataEditorX.Language
{ {
public enum LMSG : uint public enum LMSG : uint
{ {
titleInfo = 0 , titleInfo = 0,
titleError = 0x1, titleError = 0x1,
titleWarning = 0x2, titleWarning = 0x2,
titleQuestion = 0x3, titleQuestion = 0x3,
......
...@@ -6,10 +6,10 @@ ...@@ -6,10 +6,10 @@
* *
*/ */
using System; using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO; using System.IO;
using System.Text; using System.Text;
using System.Globalization;
using System.Collections.Generic;
using System.Windows.Forms; using System.Windows.Forms;
namespace DataEditorX.Language namespace DataEditorX.Language
......
...@@ -5,12 +5,7 @@ ...@@ -5,12 +5,7 @@
* 时间: 7:40 * 时间: 7:40
* *
*/ */
using System;
using System.IO;
using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
using System.Configuration;
using System.Collections.Generic;
namespace DataEditorX.Language namespace DataEditorX.Language
{ {
...@@ -19,34 +14,34 @@ namespace DataEditorX.Language ...@@ -19,34 +14,34 @@ namespace DataEditorX.Language
/// </summary> /// </summary>
public static class MyMsg public static class MyMsg
{ {
static readonly string info, warning, error, question; static readonly string _info, _warning, _error, _question;
static MyMsg() static MyMsg()
{ {
info = LanguageHelper.GetMsg(LMSG.titleInfo); _info = LanguageHelper.GetMsg(LMSG.titleInfo);
warning = LanguageHelper.GetMsg(LMSG.titleWarning); _warning = LanguageHelper.GetMsg(LMSG.titleWarning);
error = LanguageHelper.GetMsg(LMSG.titleError); _error = LanguageHelper.GetMsg(LMSG.titleError);
question = LanguageHelper.GetMsg(LMSG.titleQuestion); _question = LanguageHelper.GetMsg(LMSG.titleQuestion);
} }
public static void Show(string strMsg) public static void Show(string strMsg)
{ {
MessageBox.Show(strMsg, info, MessageBox.Show(strMsg, _info,
MessageBoxButtons.OK, MessageBoxIcon.Information); MessageBoxButtons.OK, MessageBoxIcon.Information);
} }
public static void Warning(string strWarn) public static void Warning(string strWarn)
{ {
MessageBox.Show(strWarn, warning, MessageBox.Show(strWarn, _warning,
MessageBoxButtons.OK, MessageBoxIcon.Warning); MessageBoxButtons.OK, MessageBoxIcon.Warning);
} }
public static void Error(string strError) public static void Error(string strError)
{ {
MessageBox.Show(strError, error, MessageBox.Show(strError, _error,
MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBoxButtons.OK, MessageBoxIcon.Error);
} }
public static bool Question(string strQues) public static bool Question(string strQues)
{ {
if(MessageBox.Show(strQues, question, if (MessageBox.Show(strQues, _question,
MessageBoxButtons.OKCancel, MessageBoxButtons.OKCancel,
MessageBoxIcon.Question)==DialogResult.OK) MessageBoxIcon.Question) == DialogResult.OK)
{ {
return true; return true;
} }
...@@ -57,24 +52,24 @@ public static bool Question(string strQues) ...@@ -57,24 +52,24 @@ public static bool Question(string strQues)
} }
public static void Show(LMSG msg) public static void Show(LMSG msg)
{ {
MessageBox.Show(LanguageHelper.GetMsg(msg), info, MessageBox.Show(LanguageHelper.GetMsg(msg), _info,
MessageBoxButtons.OK, MessageBoxIcon.Information); MessageBoxButtons.OK, MessageBoxIcon.Information);
} }
public static void Warning(LMSG msg) public static void Warning(LMSG msg)
{ {
MessageBox.Show(LanguageHelper.GetMsg(msg), warning, MessageBox.Show(LanguageHelper.GetMsg(msg), _warning,
MessageBoxButtons.OK, MessageBoxIcon.Warning); MessageBoxButtons.OK, MessageBoxIcon.Warning);
} }
public static void Error(LMSG msg) public static void Error(LMSG msg)
{ {
MessageBox.Show(LanguageHelper.GetMsg(msg), error, MessageBox.Show(LanguageHelper.GetMsg(msg), _error,
MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBoxButtons.OK, MessageBoxIcon.Error);
} }
public static bool Question(LMSG msg) public static bool Question(LMSG msg)
{ {
if(MessageBox.Show(LanguageHelper.GetMsg(msg), question, if (MessageBox.Show(LanguageHelper.GetMsg(msg), _question,
MessageBoxButtons.OKCancel, MessageBoxButtons.OKCancel,
MessageBoxIcon.Question)==DialogResult.OK) MessageBoxIcon.Question) == DialogResult.OK)
{ {
return true; return true;
} }
......
...@@ -5,18 +5,16 @@ ...@@ -5,18 +5,16 @@
* 时间: 9:19 * 时间: 9:19
* *
*/ */
using DataEditorX.Config;
using DataEditorX.Controls;
using DataEditorX.Core;
using DataEditorX.Language;
using System; using System;
using System.IO; using System.IO;
using System.Drawing; using System.Threading;
using System.Windows.Forms; using System.Windows.Forms;
using WeifenLuo.WinFormsUI.Docking; using WeifenLuo.WinFormsUI.Docking;
using DataEditorX.Language;
using DataEditorX.Core;
using DataEditorX.Config;
using DataEditorX.Controls;
using System.Threading;
namespace DataEditorX namespace DataEditorX
{ {
public partial class MainForm : Form, IMainForm public partial class MainForm : Form, IMainForm
...@@ -114,7 +112,7 @@ void InitForm() ...@@ -114,7 +112,7 @@ void InitForm()
{ {
if (dc is Form) if (dc is Form)
{ {
LanguageHelper.SetFormLabel((Form)dc); LanguageHelper.SetFormLabel(dc);
} }
} }
//添加历史菜单 //添加历史菜单
...@@ -385,7 +383,7 @@ void Menuitem_newClick(object sender, EventArgs e) ...@@ -385,7 +383,7 @@ void Menuitem_newClick(object sender, EventArgs e)
if (dlg.ShowDialog() == DialogResult.OK) if (dlg.ShowDialog() == DialogResult.OK)
{ {
string file = dlg.FileName; string file = dlg.FileName;
if(File.Exists(file)) if (File.Exists(file))
{ {
File.Delete(file); File.Delete(file);
} }
......
...@@ -5,14 +5,11 @@ ...@@ -5,14 +5,11 @@
* 时间: 12:00 * 时间: 12:00
* *
*/ */
using DataEditorX.Config;
using DataEditorX.Language;
using System; using System;
using System.Configuration;
using System.Diagnostics;
using System.IO; using System.IO;
using System.Reflection;
using System.Windows.Forms; using System.Windows.Forms;
using DataEditorX.Config;
using DataEditorX.Language;
namespace DataEditorX namespace DataEditorX
......
#region Using directives #region Using directives
using System;
using System.Reflection; using System.Reflection;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
......
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