Commit 44764797 authored by JoyJ's avatar JoyJ

code format

parent b448b34a
Pipeline #87 passed with stage
in 49 seconds
...@@ -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)
...@@ -258,7 +258,7 @@ public void InitTooltip(CodeConfig codeconfig) ...@@ -258,7 +258,7 @@ public void InitTooltip(CodeConfig codeconfig)
this.popupMenu.Items.SetAutocompleteItems(this.items); this.popupMenu.Items.SetAutocompleteItems(this.items);
} }
#endregion #endregion
#region 悬停的函数说明 #region 悬停的函数说明
//查找函数说明 //查找函数说明
string FindTooltip(string word) string FindTooltip(string word)
......
...@@ -64,30 +64,30 @@ public static string GetNewVersion(string VERURL) ...@@ -64,30 +64,30 @@ 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)
{ {
//从左到右比较数字 //从左到右比较数字
for (int i = 0; i < oldvers.Length; i++) for (int i = 0; i < oldvers.Length; i++)
{ {
int.TryParse(vers[i], out int j); int.TryParse(vers[i], out int j);
int.TryParse(oldvers[i], out int k); int.TryParse(oldvers[i], out int k);
if (j > k)//新的版本号大于旧的 if (j > k)//新的版本号大于旧的
{ {
hasNew = true; hasNew = true;
break; break;
} }
else if (j < k) else if (j < k)
{ {
hasNew = false; hasNew = false;
break; break;
} }
} }
} }
return hasNew; return hasNew;
} }
#endregion #endregion
...@@ -107,12 +107,12 @@ public static string GetHtmlContentByUrl(string url) ...@@ -107,12 +107,12 @@ public static string GetHtmlContentByUrl(string url)
(HttpWebRequest)WebRequest.Create(url); (HttpWebRequest)WebRequest.Create(url);
httpWebRequest.Timeout = 15000; httpWebRequest.Timeout = 15000;
using (HttpWebResponse httpWebResponse = using (HttpWebResponse httpWebResponse =
(HttpWebResponse)httpWebRequest.GetResponse()) (HttpWebResponse)httpWebRequest.GetResponse())
{ {
using (Stream stream = httpWebResponse.GetResponseStream()) using (Stream stream = httpWebResponse.GetResponseStream())
{ {
using (StreamReader streamReader = using (StreamReader streamReader =
new StreamReader(stream, Encoding.UTF8)) new StreamReader(stream, Encoding.UTF8))
{ {
htmlContent = streamReader.ReadToEnd(); htmlContent = streamReader.ReadToEnd();
streamReader.Close(); streamReader.Close();
...@@ -142,11 +142,11 @@ public static bool DownLoad(string filename) ...@@ -142,11 +142,11 @@ public static bool DownLoad(string filename)
try try
{ {
if (File.Exists(filename)) if (File.Exists(filename))
{ {
File.Delete(filename); File.Delete(filename);
} }
HttpWebRequest Myrq = (HttpWebRequest)WebRequest.Create(URL); HttpWebRequest Myrq = (HttpWebRequest)WebRequest.Create(URL);
HttpWebResponse myrp = (HttpWebResponse)Myrq.GetResponse(); HttpWebResponse myrp = (HttpWebResponse)Myrq.GetResponse();
long totalBytes = myrp.ContentLength; long totalBytes = myrp.ContentLength;
......
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,17 +5,16 @@ ...@@ -5,17 +5,16 @@
* 时间: 10:26 * 时间: 10:26
* *
*/ */
using System;
using System.Text; using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
namespace System.IO namespace System.IO
{ {
/// <summary> /// <summary>
/// 路径处理 /// 路径处理
/// </summary> /// </summary>
public class MyPath public class MyPath
{ {
/// <summary> /// <summary>
/// 从相对路径获取真实路径 /// 从相对路径获取真实路径
/// </summary> /// </summary>
...@@ -30,68 +29,69 @@ public static string GetRealPath(string dir) ...@@ -30,68 +29,69 @@ public static string GetRealPath(string dir)
} }
return dir; return dir;
} }
/// <summary> /// <summary>
/// 合并路径 /// 合并路径
/// </summary> /// </summary>
/// <param name="paths"></param> /// <param name="paths"></param>
/// <returns></returns> /// <returns></returns>
public static string Combine(params string[] paths) public static string Combine(params string[] paths)
{ {
if (paths.Length == 0) if (paths.Length == 0)
{ {
throw new ArgumentException("please input path"); throw new ArgumentException("please input path");
} }
else else
{ {
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
string spliter = Path.DirectorySeparatorChar.ToString(); string spliter = Path.DirectorySeparatorChar.ToString();
string firstPath = paths[0]; string firstPath = paths[0];
if (firstPath.StartsWith("HTTP", StringComparison.OrdinalIgnoreCase)) if (firstPath.StartsWith("HTTP", StringComparison.OrdinalIgnoreCase))
{ {
spliter = "/"; spliter = "/";
} }
if (!firstPath.EndsWith(spliter)) if (!firstPath.EndsWith(spliter))
{ {
firstPath += spliter; firstPath += spliter;
} }
builder.Append(firstPath); builder.Append(firstPath);
for (int i = 1; i < paths.Length; i++) for (int i = 1; i < paths.Length; i++)
{ {
string nextPath = paths[i]; string nextPath = paths[i];
if (nextPath.StartsWith("/") || nextPath.StartsWith("\\")) if (nextPath.StartsWith("/") || nextPath.StartsWith("\\"))
{ {
nextPath = nextPath.Substring(1); nextPath = nextPath.Substring(1);
} }
if (i != paths.Length - 1)//not the last one if (i != paths.Length - 1)//not the last one
{ {
if (nextPath.EndsWith("/") || nextPath.EndsWith("\\")) if (nextPath.EndsWith("/") || nextPath.EndsWith("\\"))
{ {
nextPath = nextPath.Substring(0, nextPath.Length - 1) + spliter; nextPath = nextPath.Substring(0, nextPath.Length - 1) + spliter;
} }
else else
{ {
nextPath += spliter; nextPath += spliter;
} }
} }
builder.Append(nextPath); builder.Append(nextPath);
} }
return builder.ToString(); return builder.ToString();
} }
} }
/// <summary> /// <summary>
/// 检查目录是否合法 /// 检查目录是否合法
/// </summary> /// </summary>
/// <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
{ {
class MyComparer<K> : IComparer<K> class MyComparer<K> : IComparer<K>
{ {
public int Compare(K x, K y) public int Compare(K x, K y)
{ {
return 1; //永远不等,允许重复 return 1; //永远不等,允许重复
} }
} }
public class MySortList<K,V> : SortedList<K,V>
{
public MySortList():base(new MyComparer<K>()) public class MySortList<K, V> : SortedList<K, V>
{ {
}
public MySortList() : base(new MyComparer<K>())
public new void Add(K key, V value) {
{ }
//falg用于跳出函数
int flag = 0; public new void Add(K key, V value)
//检查是否具备这个key,并且检查value是否重复 {
foreach (KeyValuePair<K,V> item in this) //falg用于跳出函数
{ int flag = 0;
if (item.Key.ToString() == key.ToString() && item.Value.ToString() == value.ToString()) //检查是否具备这个key,并且检查value是否重复
{ foreach (KeyValuePair<K, V> item in this)
flag=1; {
} if (item.Key.ToString() == key.ToString() && item.Value.ToString() == value.ToString())
} {
if (flag == 1) flag = 1;
}
}
if (flag == 1)
{ {
return; //跳出函数 return; //跳出函数
} }
//否则就加入 //否则就加入
base.Add(key, value); base.Add(key, value);
} }
} }
} }
...@@ -6,47 +6,47 @@ ...@@ -6,47 +6,47 @@
* *
* 要改变这种模板请点击 工具|选项|代码编写|编辑标准头文件 * 要改变这种模板请点击 工具|选项|代码编写|编辑标准头文件
*/ */
using System;
using System.Text;
using System.IO; using System.IO;
using System.Text;
namespace DataEditorX.Common namespace DataEditorX.Common
{ {
/// <summary> /// <summary>
/// Description of MyUtils. /// Description of MyUtils.
/// </summary> /// </summary>
public class MyUtils public class MyUtils
{ {
/// <summary> /// <summary>
/// 计算文件的MD5校验 /// 计算文件的MD5校验
/// </summary> /// </summary>
/// <param name="fileName"></param> /// <param name="fileName"></param>
/// <returns></returns> /// <returns></returns>
public static string GetMD5HashFromFile(string fileName) public static string GetMD5HashFromFile(string fileName)
{ {
try try
{ {
FileStream file = new FileStream(fileName, FileMode.Open); FileStream file = new FileStream(fileName, FileMode.Open);
System.Security.Cryptography.MD5 md5 = new System.Security.Cryptography.MD5CryptoServiceProvider(); System.Security.Cryptography.MD5 md5 = new System.Security.Cryptography.MD5CryptoServiceProvider();
byte[] retVal = md5.ComputeHash(file); byte[] retVal = md5.ComputeHash(file);
file.Close(); file.Close();
StringBuilder sb = new StringBuilder();
for (int i = 0; i < retVal.Length; i++)
{
sb.Append(retVal[i].ToString("x2"));
}
return sb.ToString();
}
catch
{
}
return "";
}
StringBuilder sb = new StringBuilder(); public static bool Md5isEmpty(string md5)
for (int i = 0; i < retVal.Length; i++) {
{ return md5 == null || md5.Length < 16;
sb.Append(retVal[i].ToString("x2")); }
} }
return sb.ToString();
}
catch
{
}
return "";
}
public static bool Md5isEmpty(string md5){
return md5==null||md5.Length<16;
}
}
} }
using System; using System.Text;
using System.Collections.Generic;
using System.Text;
namespace DataEditorX.Common namespace DataEditorX.Common
{ {
public class StrUtil public class StrUtil
{ {
public static string AutoEnter(string str, int lineNum, char re) public static string AutoEnter(string str, int lineNum, char re)
{ {
if (str == null || str.Length == 0) if (str == null || str.Length == 0)
{ {
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;
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
int i = 0; int i = 0;
foreach (char c in ch) foreach (char c in ch)
{ {
int ic = c; int ic = c;
if (ic > 128) if (ic > 128)
{ {
i += 2; i += 2;
} }
...@@ -33,25 +31,27 @@ public static string AutoEnter(string str, int lineNum, char re) ...@@ -33,25 +31,27 @@ public static string AutoEnter(string str, int lineNum, char re)
} }
if (c == '\n' || c == '\r') if (c == '\n' || c == '\r')
{ {
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;
} }
else if (i >= lineNum) else if (i >= lineNum)
{ {
sb.Append(c); sb.Append(c);
sb.Append(re); sb.Append(re);
i = 0; i = 0;
}else{ }
sb.Append(c); else
} {
} sb.Append(c);
return sb.ToString(); }
} }
} return sb.ToString();
}
}
} }
/* /*
* 由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>
...@@ -28,7 +30,7 @@ public enum Compression : ushort { ...@@ -28,7 +30,7 @@ public enum Compression : ushort {
public struct ZipFileEntry public struct ZipFileEntry
{ {
/// <summary>Compression method</summary> /// <summary>Compression method</summary>
public Compression Method; public Compression Method;
/// <summary>Full path and filename as stored in Zip</summary> /// <summary>Full path and filename as stored in Zip</summary>
public string FilenameInZip; public string FilenameInZip;
/// <summary>Original file size</summary> /// <summary>Original file size</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;
...@@ -185,7 +187,7 @@ public static ZipStorer Open(Stream _stream, FileAccess _access) ...@@ -185,7 +187,7 @@ public static ZipStorer Open(Stream _stream, FileAccess _access)
throw new InvalidDataException(); throw new InvalidDataException();
} }
/// <summary> /// <summary>
/// Add full contents of a file into the Zip storage /// Add full contents of a file into the Zip storage
/// </summary> /// </summary>
/// <param name="_method">Compression method</param> /// <param name="_method">Compression method</param>
...@@ -194,7 +196,7 @@ public static ZipStorer Open(Stream _stream, FileAccess _access) ...@@ -194,7 +196,7 @@ public static ZipStorer Open(Stream _stream, FileAccess _access)
/// <param name="_comment">Comment for stored file</param> /// <param name="_comment">Comment for stored file</param>
public void AddFile(string _pathname, string _filenameInZip, string _comment) public void AddFile(string _pathname, string _filenameInZip, string _comment)
{ {
Compression _method=Compression.Deflate; Compression _method=Compression.Deflate;
if (this.access == FileAccess.Read) if (this.access == FileAccess.Read)
{ {
throw new InvalidOperationException("Writing is not alowed"); throw new InvalidOperationException("Writing is not alowed");
...@@ -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)
...@@ -401,7 +403,7 @@ public bool ExtractFile(ZipFileEntry _zfe, string _filename) ...@@ -401,7 +403,7 @@ public bool ExtractFile(ZipFileEntry _zfe, string _filename)
File.SetCreationTime(_filename, _zfe.ModifyTime); File.SetCreationTime(_filename, _zfe.ModifyTime);
File.SetLastWriteTime(_filename, _zfe.ModifyTime); File.SetLastWriteTime(_filename, _zfe.ModifyTime);
return result; return result;
} }
/// <summary> /// <summary>
...@@ -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);
...@@ -671,7 +673,7 @@ private void Store(ref ZipFileEntry _zfe, Stream _source) ...@@ -671,7 +673,7 @@ private void Store(ref ZipFileEntry _zfe, Stream _source)
} }
_zfe.Crc32 = 0 ^ 0xffffffff; _zfe.Crc32 = 0 ^ 0xffffffff;
do do
{ {
bytesRead = _source.Read(buffer, 0, buffer.Length); bytesRead = _source.Read(buffer, 0, buffer.Length);
...@@ -721,8 +723,8 @@ private void Store(ref ZipFileEntry _zfe, Stream _source) ...@@ -721,8 +723,8 @@ private void Store(ref ZipFileEntry _zfe, Stream _source)
private uint DateTimeToDosTime(DateTime _dt) 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>();
...@@ -54,7 +54,7 @@ public void InitMember(string conf) ...@@ -54,7 +54,7 @@ public void InitMember(string conf)
this.dicCardRaces = DataManager.Read(text, MyConfig.TAG_RACE); this.dicCardRaces = DataManager.Read(text, MyConfig.TAG_RACE);
this.dicCardLevels = DataManager.Read(text, MyConfig.TAG_LEVEL); this.dicCardLevels = DataManager.Read(text, MyConfig.TAG_LEVEL);
} }
/// <summary> /// <summary>
/// 规则 /// 规则
/// </summary> /// </summary>
......
...@@ -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>
/// 从文件读取内容,按行读取 /// 从文件读取内容,按行读取
...@@ -122,7 +122,7 @@ public static string SubString(string content, string tag) ...@@ -122,7 +122,7 @@ public static string SubString(string content, string tag)
} }
#endregion #endregion
#region 查找 #region 查找
public static List<long> GetKeys(Dictionary<long, string> dic) public static List<long> GetKeys(Dictionary<long, string> dic)
{ {
...@@ -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
...@@ -16,13 +13,14 @@ namespace DataEditorX.Config ...@@ -16,13 +13,14 @@ namespace DataEditorX.Config
/// 裁剪图片是、配置 /// 裁剪图片是、配置
/// </summary> /// </summary>
public class ImageSet public class ImageSet
{ {
public ImageSet(){ public ImageSet()
{
this.Init(); this.Init();
} }
//初始化 //初始化
void Init() 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);
...@@ -37,7 +35,7 @@ void Init() ...@@ -37,7 +35,7 @@ void Init()
this.H = ints[3]; this.H = ints[3];
this.quilty = MyConfig.ReadInteger(MyConfig.TAG_IMAGE_QUILTY, 95); this.quilty = MyConfig.ReadInteger(MyConfig.TAG_IMAGE_QUILTY, 95);
} }
/// <summary> /// <summary>
/// jpeg质量 /// jpeg质量
/// </summary> /// </summary>
...@@ -70,5 +68,5 @@ void Init() ...@@ -70,5 +68,5 @@ void Init()
/// p怪的中间图 /// p怪的中间图
/// </summary> /// </summary>
public Area pendulumArea; public Area pendulumArea;
} }
} }
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
{ {
...@@ -88,10 +87,10 @@ public class MyConfig : XMLReader ...@@ -88,10 +87,10 @@ public class MyConfig : XMLReader
/// 用本程序打开文件 /// 用本程序打开文件
/// </summary> /// </summary>
public const string TAG_OPEN_IN_THIS = "open_file_in_this"; public const string TAG_OPEN_IN_THIS = "open_file_in_this";
/// <summary> /// <summary>
/// 自动检查更新 /// 自动检查更新
/// </summary> /// </summary>
public const string TAG_AUTO_CHECK_UPDATE = "auto_check_update"; public const string TAG_AUTO_CHECK_UPDATE = "auto_check_update";
/// <summary> /// <summary>
/// add require automatically /// add require automatically
/// </summary> /// </summary>
...@@ -259,20 +258,22 @@ public static Area ReadArea(string key) ...@@ -259,20 +258,22 @@ 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)){ }
return false; if ("false".Equals(val, StringComparison.OrdinalIgnoreCase))
} {
return false;
}
return def; return def;
} }
#endregion #endregion
/// <summary> /// <summary>
/// 语言配置文件名 /// 语言配置文件名
/// </summary> /// </summary>
...@@ -280,27 +281,27 @@ public static bool ReadBoolean(string key,bool def=false) ...@@ -280,27 +281,27 @@ public static bool ReadBoolean(string key,bool def=false)
/// <returns></returns> /// <returns></returns>
public static string GetLanguageFile(string path) 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"); Save(TAG_CHECK_SYSLANG, "false");
string[] words = CultureInfo.InstalledUICulture.EnglishName.Split(' '); string[] words = CultureInfo.InstalledUICulture.EnglishName.Split(' ');
string syslang = words[0]; string syslang = words[0];
string[] files = Directory.GetFiles(path); string[] files = Directory.GetFiles(path);
foreach (string file in files) foreach (string file in files)
{ {
string name = MyPath.GetFullFileName(TAG_LANGUAGE, file); string name = MyPath.GetFullFileName(TAG_LANGUAGE, file);
if (string.IsNullOrEmpty(name)) if (string.IsNullOrEmpty(name))
{ {
continue; continue;
} }
if (syslang.Equals(name, StringComparison.OrdinalIgnoreCase)) if (syslang.Equals(name, StringComparison.OrdinalIgnoreCase))
{ {
Save(TAG_LANGUAGE, syslang); Save(TAG_LANGUAGE, syslang);
break; break;
} }
} }
} }
return MyPath.Combine(path, MyPath.GetFileName(TAG_LANGUAGE, GetAppConfig(TAG_LANGUAGE))); return MyPath.Combine(path, MyPath.GetFileName(TAG_LANGUAGE, GetAppConfig(TAG_LANGUAGE)));
} }
/// <summary> /// <summary>
...@@ -310,7 +311,7 @@ public static string GetLanguageFile(string path) ...@@ -310,7 +311,7 @@ public static string GetLanguageFile(string path)
/// <returns></returns> /// <returns></returns>
public static string GetCardInfoFile(string path) public static string GetCardInfoFile(string path)
{ {
return MyPath.Combine(path, MyPath.GetFileName(TAG_CARDINFO, GetAppConfig(TAG_LANGUAGE))); return MyPath.Combine(path, MyPath.GetFileName(TAG_CARDINFO, GetAppConfig(TAG_LANGUAGE)));
} }
/// <summary> /// <summary>
/// 发送消息打开文件 /// 发送消息打开文件
......
using System; using System.IO;
using System.Collections.Generic;
using System.Text;
using System.IO;
namespace DataEditorX.Config namespace DataEditorX.Config
{ {
...@@ -20,7 +17,7 @@ public void SetPath(string gamepath) ...@@ -20,7 +17,7 @@ public void SetPath(string gamepath)
this.luapath = MyPath.Combine(gamepath, "script"); this.luapath = MyPath.Combine(gamepath, "script");
this.ydkpath = MyPath.Combine(gamepath, "deck"); this.ydkpath = MyPath.Combine(gamepath, "deck");
this.replaypath = MyPath.Combine(gamepath, "replay"); this.replaypath = MyPath.Combine(gamepath, "replay");
} }
/// <summary>游戏目录</summary> /// <summary>游戏目录</summary>
public string gamepath; public string gamepath;
/// <summary>大图目录</summary> /// <summary>大图目录</summary>
...@@ -36,67 +33,67 @@ public void SetPath(string gamepath) ...@@ -36,67 +33,67 @@ public void SetPath(string gamepath)
/// <summary>录像目录</summary> /// <summary>录像目录</summary>
public string replaypath; public string replaypath;
public string GetImage(long id) public string GetImage(long id)
{
return this.GetImage(id.ToString());
}
//public string GetImageThum(long id)
//{
// return GetImageThum(id.ToString());
//}
public string GetImageField(long id)
{
return this.GetImageField(id.ToString());//场地图
}
public string GetScript(long id)
{ {
return this.GetImage(id.ToString()); return this.GetScript(id.ToString());
} }
//public string GetImageThum(long id) public string GetYdk(string name)
//{
// return GetImageThum(id.ToString());
//}
public string GetImageField(long id)
{ {
return this.GetImageField(id.ToString());//场地图 return MyPath.Combine(this.ydkpath, name + ".ydk");
} }
public string GetScript(long id) //字符串id
public string GetImage(string id)
{ {
return this.GetScript(id.ToString()); return MyPath.Combine(this.picpath, id + ".jpg");
} }
public string GetYdk(string name) //public string GetImageThum(string id)
{ //{
return MyPath.Combine(this.ydkpath, name + ".ydk"); // return MyPath.Combine(picpath2, id + ".jpg");
} //}
//字符串id public string GetImageField(string id)
public string GetImage(string id)
{
return MyPath.Combine(this.picpath, id + ".jpg");
}
//public string GetImageThum(string id)
//{
// return MyPath.Combine(picpath2, id + ".jpg");
//}
public string GetImageField(string id)
{ {
return MyPath.Combine(this.fieldpath, id+ ".png");//场地图 return MyPath.Combine(this.fieldpath, id + ".png");//场地图
}
public string GetScript(string id)
{
return MyPath.Combine(this.luapath, "c" + id + ".lua");
}
public string GetModuleScript(string modulescript)
{
return MyPath.Combine(this.luapath, modulescript + ".lua");
} }
public string GetScript(string id)
{
return MyPath.Combine(this.luapath, "c" + id + ".lua");
}
public string GetModuleScript(string modulescript)
{
return MyPath.Combine(this.luapath, modulescript + ".lua");
}
public string[] GetCardfiles(long id) public string[] GetCardfiles(long id)
{ {
string[] files = new string[]{ string[] files = new string[]{
this.GetImage(id),//大图 this.GetImage(id),//大图
//GetImageThum(id),//小图 //GetImageThum(id),//小图
this.GetImageField(id),//场地图 this.GetImageField(id),//场地图
this.GetScript(id) this.GetScript(id)
}; };
return files; return files;
} }
public string[] GetCardfiles(string id) public string[] GetCardfiles(string id)
{ {
string[] files = new string[]{ string[] files = new string[]{
this.GetImage(id),//大图 this.GetImage(id),//大图
//GetImageThum(id),//小图 //GetImageThum(id),//小图
this.GetImageField(id),//场地图 this.GetImageField(id),//场地图
this.GetScript(id) this.GetScript(id)
}; };
return files; return files;
} }
} }
} }
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,20 +7,17 @@ ...@@ -7,20 +7,17 @@
*/ */
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
{ {
public class FastColoredTextBoxEx : FastColoredTextBox public class FastColoredTextBoxEx : FastColoredTextBox
{ {
public Label lbTooltip; public Label lbTooltip;
Point lastMouseCoord; Point lastMouseCoord;
public FastColoredTextBoxEx() : base() public FastColoredTextBoxEx() : base()
{ {
this.SyntaxHighlighter = new MySyntaxHighlighter(); this.SyntaxHighlighter = new MySyntaxHighlighter();
this.TextChanged += this.FctbTextChanged; this.TextChanged += this.FctbTextChanged;
this.ToolTipDelay = 1; this.ToolTipDelay = 1;
...@@ -30,15 +27,15 @@ public FastColoredTextBoxEx() : base() ...@@ -30,15 +27,15 @@ public FastColoredTextBoxEx() : base()
} }
public new event EventHandler<ToolTipNeededEventArgs> ToolTipNeeded; public new event EventHandler<ToolTipNeededEventArgs> ToolTipNeeded;
protected override void OnMouseMove(MouseEventArgs e) protected override void OnMouseMove(MouseEventArgs e)
{ {
base.OnMouseMove(e); base.OnMouseMove(e);
this.lastMouseCoord = e.Location; this.lastMouseCoord = e.Location;
} }
//函数悬停提示 //函数悬停提示
protected override void OnToolTip() protected override void OnToolTip()
{ {
if (this.ToolTip == null) if (this.ToolTip == null)
{ {
return; return;
} }
...@@ -51,36 +48,36 @@ protected override void OnToolTip() ...@@ -51,36 +48,36 @@ protected override void OnToolTip()
//get place under mouse //get place under mouse
Place place = this.PointToPlace(this.lastMouseCoord); Place place = this.PointToPlace(this.lastMouseCoord);
//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;
} }
//get word under mouse //get word under mouse
var r = new Range(this, place, place); var r = new Range(this, place, place);
string hoveredWord = r.GetFragment("[a-zA-Z0-9_]").Text; string hoveredWord = r.GetFragment("[a-zA-Z0-9_]").Text;
//event handler //event handler
var ea = new ToolTipNeededEventArgs(place, hoveredWord); var ea = new ToolTipNeededEventArgs(place, hoveredWord);
ToolTipNeeded(this, ea); ToolTipNeeded(this, ea);
if (ea.ToolTipText != null) if (ea.ToolTipText != null)
{ {
this.ShowTooltipWithLabel(ea.ToolTipTitle, ea.ToolTipText); this.ShowTooltipWithLabel(ea.ToolTipTitle, ea.ToolTipText);
} }
} }
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);
} }
...@@ -143,7 +143,7 @@ public void MenuHistory() ...@@ -143,7 +143,7 @@ public void MenuHistory()
tsmiclear2.Click += this.MenuHistoryClear2_Click; tsmiclear2.Click += this.MenuHistoryClear2_Click;
this.mainForm.AddLuaMenu(tsmiclear2); this.mainForm.AddLuaMenu(tsmiclear2);
} }
void MenuHistoryClear2_Click(object sender, EventArgs e) void MenuHistoryClear2_Click(object sender, EventArgs e)
{ {
this.luahistory.Clear(); this.luahistory.Clear();
......
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
{ {
...@@ -20,14 +14,14 @@ namespace FastColoredTextBoxNS ...@@ -20,14 +14,14 @@ namespace FastColoredTextBoxNS
/// </summary> /// </summary>
public class MySyntaxHighlighter : SyntaxHighlighter public class MySyntaxHighlighter : SyntaxHighlighter
{ {
readonly TextStyle mNumberStyle = new TextStyle(Brushes.Orange, null, FontStyle.Regular); readonly TextStyle mNumberStyle = new TextStyle(Brushes.Orange, null, FontStyle.Regular);
readonly TextStyle mStrStyle = new TextStyle(Brushes.Gold, null, FontStyle.Regular); readonly TextStyle mStrStyle = new TextStyle(Brushes.Gold, null, FontStyle.Regular);
readonly TextStyle conStyle = new TextStyle(Brushes.YellowGreen, null, FontStyle.Regular); readonly TextStyle conStyle = new TextStyle(Brushes.YellowGreen, null, FontStyle.Regular);
readonly TextStyle mKeywordStyle = new TextStyle(Brushes.DeepSkyBlue, null, FontStyle.Regular); readonly TextStyle mKeywordStyle = new TextStyle(Brushes.DeepSkyBlue, null, FontStyle.Regular);
readonly TextStyle mGrayStyle = new TextStyle(Brushes.Gray, null, FontStyle.Regular); readonly TextStyle mGrayStyle = new TextStyle(Brushes.Gray, null, FontStyle.Regular);
readonly TextStyle mFunStyle = new TextStyle(Brushes.LightGray, null, FontStyle.Bold); readonly TextStyle mFunStyle = new TextStyle(Brushes.LightGray, null, FontStyle.Bold);
/// <summary> /// <summary>
/// Highlights Lua code /// Highlights Lua code
/// </summary> /// </summary>
...@@ -47,28 +41,28 @@ public override void LuaSyntaxHighlight(Range range) ...@@ -47,28 +41,28 @@ 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|,|;]");
//range.SetStyle(mFunStyle, @"[:|\.|\s](?<range>[a-zA-Z0-9_]*?)[\(|\)|\s]"); //range.SetStyle(mFunStyle, @"[:|\.|\s](?<range>[a-zA-Z0-9_]*?)[\(|\)|\s]");
//clear folding markers //clear folding markers
range.ClearFoldingMarkers(); range.ClearFoldingMarkers();
//set folding markers //set folding markers
......
This diff is collapsed.
This diff is collapsed.
...@@ -3,96 +3,96 @@ ...@@ -3,96 +3,96 @@
namespace DataEditorX.Core namespace DataEditorX.Core
{ {
public delegate void StatusBool(bool val); public delegate void StatusBool(bool val);
public interface ICommand : ICloneable public interface ICommand : ICloneable
{ {
bool Excute(params object[] args); bool Excute(params object[] args);
} }
public interface IBackableCommand : ICommand public interface IBackableCommand : ICommand
{ {
void Undo(); void Undo();
} }
public interface ICommandManager public interface ICommandManager
{ {
void ExcuteCommand(ICommand command, params object[] args); void ExcuteCommand(ICommand command, params object[] args);
void Undo(); void Undo();
void ReverseUndo();//反撤销 void ReverseUndo();//反撤销
event StatusBool UndoStateChanged; event StatusBool UndoStateChanged;
} }
public class CommandManager : ICommandManager public class CommandManager : ICommandManager
{ {
private readonly Stack<ICommand> undoStack = new Stack<ICommand>(); private readonly Stack<ICommand> undoStack = new Stack<ICommand>();
private readonly Stack<ICommand> reverseStack = new Stack<ICommand>(); private readonly Stack<ICommand> reverseStack = new Stack<ICommand>();
public event StatusBool UndoStateChanged; public event StatusBool UndoStateChanged;
public CommandManager() public CommandManager()
{ {
UndoStateChanged += new StatusBool(this.CommandManager_UndoStateChanged); UndoStateChanged += new StatusBool(this.CommandManager_UndoStateChanged);
UndoStateChanged += new StatusBool(this.CommandManager_ReverseUndoStateChanged); UndoStateChanged += new StatusBool(this.CommandManager_ReverseUndoStateChanged);
} }
private void CommandManager_UndoStateChanged(bool val) private void CommandManager_UndoStateChanged(bool val)
{ {
} }
private void CommandManager_ReverseUndoStateChanged(bool val) 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.reverseStack.Clear(); this.reverseStack.Clear();
if (command is IBackableCommand) if (command is IBackableCommand)
{ {
this.undoStack.Push((ICommand)command.Clone()); this.undoStack.Push((ICommand)command.Clone());
} }
else else
{ {
this.undoStack.Clear(); this.undoStack.Clear();
} }
UndoStateChanged(this.undoStack.Count > 0); UndoStateChanged(this.undoStack.Count > 0);
} }
public void Undo() public void Undo()
{ {
IBackableCommand command = (IBackableCommand)this.undoStack.Pop(); IBackableCommand command = (IBackableCommand)this.undoStack.Pop();
if (command == null) if (command == null)
{ {
return; return;
} }
command.Undo(); command.Undo();
this.reverseStack.Push((ICommand)command.Clone()); this.reverseStack.Push((ICommand)command.Clone());
UndoStateChanged(this.undoStack.Count > 0); UndoStateChanged(this.undoStack.Count > 0);
//UndoStateChanged(reverseStack.Count > 0); //UndoStateChanged(reverseStack.Count > 0);
} }
public void ReverseUndo() public void ReverseUndo()
{ {
IBackableCommand command = (IBackableCommand)this.reverseStack.Pop(); IBackableCommand command = (IBackableCommand)this.reverseStack.Pop();
if (command == null) if (command == null)
{ {
return; return;
} }
command.Excute(); command.Excute();
this.undoStack.Push((ICommand)command.Clone()); this.undoStack.Push((ICommand)command.Clone());
UndoStateChanged(this.undoStack.Count > 0); UndoStateChanged(this.undoStack.Count > 0);
} }
#endregion #endregion
} }
} }
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,13 +6,12 @@ ...@@ -6,13 +6,12 @@
* *
* 要改变这种模板请点击 工具|选项|代码编写|编辑标准头文件 * 要改变这种模板请点击 工具|选项|代码编写|编辑标准头文件
*/ */
using System;
namespace DataEditorX.Core.Info namespace DataEditorX.Core.Info
{ {
public static class CardLink public static class CardLink
{ {
/* /*
0x1 ↙ 0x1 ↙
0x2 ↓ 0x2 ↓
0x4 ↘ 0x4 ↘
...@@ -21,17 +20,18 @@ public static class CardLink ...@@ -21,17 +20,18 @@ public static class CardLink
0x40 ↖ 0x40 ↖
0x80 ↑ 0x80 ↑
0x100 ↗*/ 0x100 ↗*/
public const int DownLeft=0x1; public const int DownLeft=0x1;
public const int Down = 0x2; public const int Down = 0x2;
public const int DownRight = 0x4; public const int DownRight = 0x4;
public const int Left = 0x8; public const int Left = 0x8;
public const int Right = 0x20; public const int Right = 0x20;
public const int UpLeft = 0x40; public const int UpLeft = 0x40;
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,
......
This diff is collapsed.
This diff is collapsed.
...@@ -6,95 +6,98 @@ ...@@ -6,95 +6,98 @@
* *
* 要改变这种模板请点击 工具|选项|代码编写|编辑标准头文件 * 要改变这种模板请点击 工具|选项|代码编写|编辑标准头文件
*/ */
using System;
namespace DataEditorX.Core namespace DataEditorX.Core
{ {
/// <summary> /// <summary>
/// Description of CardPack. /// Description of CardPack.
/// </summary> /// </summary>
public class CardPack public class CardPack
{ {
public CardPack(long id) public CardPack(long id)
{ {
this.CardId=id; this.CardId = id;
} }
public long CardId{ public long CardId
get; {
private set; get;
} private set;
public string pack_id; }
public string pack_name; public string pack_id;
public string rarity; public string pack_name;
public string date; public string rarity;
public string date;
public string GetMseRarity(){
if(this.rarity==null) public string GetMseRarity()
{
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("/")){ }
return this.rarity.Split('/')[0]; if (this.rarity.Contains("/"))
} {
return this.rarity; return this.rarity.Split('/')[0];
} }
} return this.rarity;
}
}
} }
This diff is collapsed.
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 version; public int game;
public MySortList<string, CardInfo> cards; public int version;
} public MySortList<string, CardInfo> cards;
public class CardInfo{ }
public string title; public class CardInfo
public string artwork; {
public int[] artwork_crop; public string title;
/// <summary> public string artwork;
/// ? public int[] artwork_crop;
/// </summary> /// <summary>
public int background; /// ?
/// <summary> /// </summary>
/// ? public int background;
/// </summary> /// <summary>
public int rarity; /// ?
public int attribute; /// </summary>
public int level; public int rarity;
public int icon; public int attribute;
public string description; public int level;
public string pendulum_description; public int icon;
public int[] pendulum_scales ; public string description;
public string[] subtypes; public string pendulum_description;
public string atk; public int[] pendulum_scales ;
public string def; public string[] subtypes;
public string edition; public string atk;
public string @set; public string def;
public string card_number; public string edition;
public string limitation; public string @set;
/// <summary> public string card_number;
/// 0,1,1 public string limitation;
/// </summary> /// <summary>
public int sticker; /// 0,1,1
public string copyright; /// </summary>
public override string ToString() public int sticker;
{ public string copyright;
return string.Format("[CardInfo Title={0}, Artwork={1}, Artwork_crop={2}, Background={3}, Rarity={4}, Attribute={5}, Level={6}, Icon={7}, Description={8}, Pendulum_description={9}, Pendulum_scales={10}, Subtypes={11}, Atk={12}, Def={13}, Edition={14}, Set={15}, Card_number={16}, Limitation={17}, Sticker={18}, Copyright={19}]", this.title, this.artwork, this.artwork_crop, this.background, this.rarity, this.attribute, this.level, this.icon, this.description, this.pendulum_description, this.pendulum_scales, this.subtypes, this.atk, this.def, this.edition, this.set, this.card_number, this.limitation, this.sticker, this.copyright); public override string ToString()
} {
} return string.Format("[CardInfo Title={0}, Artwork={1}, Artwork_crop={2}, Background={3}, Rarity={4}, Attribute={5}, Level={6}, Icon={7}, Description={8}, Pendulum_description={9}, Pendulum_scales={10}, Subtypes={11}, Atk={12}, Def={13}, Edition={14}, Set={15}, Card_number={16}, Limitation={17}, Sticker={18}, Copyright={19}]", this.title, this.artwork, this.artwork_crop, this.background, this.rarity, this.attribute, this.level, this.icon, this.description, this.pendulum_description, this.pendulum_scales, this.subtypes, this.atk, this.def, this.edition, this.set, this.card_number, this.limitation, this.sticker, this.copyright);
}
public class CardJson{ }
public static void Test(){
string json = File.ReadAllText(@"F:\TCGEditor_v1.2\t.tcgb"); public class CardJson
CardSet cardset = JsonConvert.DeserializeObject<CardSet>(json); {
if(cardset.cards!=null){ public static void Test()
int index=0; {
foreach(string key in cardset.cards.Keys){ string json = File.ReadAllText(@"F:\TCGEditor_v1.2\t.tcgb");
Console.WriteLine(key); CardSet cardset = JsonConvert.DeserializeObject<CardSet>(json);
CardInfo card = cardset.cards.Values[index]; if (cardset.cards != null)
Console.WriteLine(card); {
index++; int index=0;
} foreach (string key in cardset.cards.Keys)
} {
Console.ReadKey(); Console.WriteLine(key);
} CardInfo card = cardset.cards.Values[index];
} Console.WriteLine(card);
index++;
}
}
Console.ReadKey();
}
}
} }
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
#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