EXE下载:http://files.cnblogs.com/xe2011/EXEgshop.dataeditorV1.42014-3-11-204242.7z

C#:http://files.cnblogs.com/xe2011/script_gshop.dataeditorV1.42014-3-11-204242.7z

本程序 是C#写的,系统必须安装了.net framework 2.0才能运行。
如不能运行请安装.NET 2.0
http://download.microsoft.com/download/5/6/7/567758a3-759e-473e-bf8f-52154438565a/dotnetfx.exe

自动重命名批处理

gSev.bat  自动对拖拽到它身上的文件重命名为gshopsev.data

Shop.bat  自动对拖拽到它身上的文件重命名为gshop.data

本程序 支持把 gshop.data直接拖拽到程序上进行读取。支持145-151版本的gshop.data的编辑, 一句话只要能打开,然后保存为一个文件,能在次打开就支持。

编辑GSHOP.DATA的建议

1 正确的文件是这样的

   1本程序 可以打开。

  2 覆盖服务端关闭服务器 ,重启服务器 所有有服务都显示在线(绿色)

2 每大修改一分部,保存一次,然后将保存的文件拖拽到本程序 上看是否能打开。不能打开 的一定不能进游戏,需要重试!

3 部分物品堆叠上限是1 如果它的上限是1 你修改的数量大于1 则将无法进入游戏。

这是无法进入游戏的主要原因 比如 白金护身符 默认的堆叠上限为1 你误改成2或者更高 地图服务就掉线,无法进入游戏,提示版本低

4 在进行批量修改时一定要先 不选所有,然后再选要批量修改的。 5 建议修改gshop.data的时候不要修改 elements.data,反过来也是。

【2014年3月8日】

1 增加了查找物品的功能

2 改变了保存文件的方式

【2014年金3月3日】

增加了导入和导出功能

【2014年3月2日】

本程序的前身 这个不知道是哪个大神写的

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Text;
using System.Windows.Forms; using System.Collections;//ArrayList
using System.IO;//FileStream
using System.Runtime.InteropServices;//Marshal namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
Height = ;
} private ArrayList lst = new ArrayList();
public byte[] temp = new byte[];
public byte[] bt; private int amount;
private int gshopItemsCount;//gshop.data所有物品个数
private UInt32 gshopdataVersion;//gshop版本 private int no;
private int maxno = ;
private gds tgds;
private sgds tsgds;
private FileStream wFile;
private FileStream rFile;
private TreeNode tn; public static object rawDeserialize(byte[] rawdatas, Type anytype)
{
int num = Marshal.SizeOf(anytype);
object result;
if (num > rawdatas.Length)
{
result = null;
}
else
{
IntPtr intPtr = Marshal.AllocHGlobal(num);
Marshal.Copy(rawdatas, , intPtr, num);
object obj = Marshal.PtrToStructure(intPtr, anytype);
Marshal.FreeHGlobal(intPtr);
result = obj;
}
return result;
}
public static byte[] rawSerialize(object obj)
{
int num = Marshal.SizeOf(obj);
IntPtr intPtr = Marshal.AllocHGlobal(num);
Marshal.StructureToPtr(obj, intPtr, false);
byte[] array = new byte[num];
Marshal.Copy(intPtr, array, , num);
Marshal.FreeHGlobal(intPtr);
return array;
}
public void show(int i)
{
numericUpDown3.Value = BitConverter.ToInt32(((gds)lst[i]).id, );
numericUpDown4.Value = BitConverter.ToInt32(((gds)lst[i]).no, );
numericUpDown5.Value = BitConverter.ToInt32(((gds)lst[i]).amount, );
numericUpDown6.Value = (decimal)((double)BitConverter.ToInt32(((gds)lst[i]).price, ) / 100.0);
numericUpDown7.Value = BitConverter.ToInt32(((gds)lst[i]).time, );
numericUpDown8.Value = BitConverter.ToInt32(((gds)lst[i]).zid, );
numericUpDown9.Value = BitConverter.ToInt32(((gds)lst[i]).zam, );
numericUpDown10.Value = (decimal)((double)BitConverter.ToInt32(((gds)lst[i]).zpr, ) / 100.0);
comboBox1.Text = comboBox1.Items[BitConverter.ToInt32(((gds)lst[i]).type, )].ToString();
textBox1.Text = Encoding.Default.GetString(((gds)lst[i]).ic);
textBox2.Text = Encoding.Unicode.GetString(((gds)lst[i]).explanation);
textBox3.Text = Encoding.Unicode.GetString(((gds)lst[i]).name);
} public void ldMulu1()
{
comboBox2.Items.Clear();
for (int i = ; i < ; i++)
{
comboBox2.Items.Add(treeView1.Nodes[i].Text);
}
comboBox2.SelectedIndex = ;
}
public void ldMulu2()
{
comboBox3.Items.Clear();
for (int i = ; i < treeView1.Nodes[comboBox2.SelectedIndex].Nodes.Count; i++)
{
comboBox3.Items.Add(treeView1.Nodes[comboBox2.SelectedIndex].Nodes[i].Text);
}
comboBox3.SelectedIndex = ;
}
public void delmore()
{
for (int i = ; i < treeView1.Nodes.Count; i++)
{
for (int j = ; j < treeView1.Nodes[i].Nodes.Count; j++)
{
for (int k = ; k < treeView1.Nodes[i].Nodes[j].Nodes.Count; k++)
{
if (treeView1.Nodes[i].Nodes[j].Nodes[k].Checked)
{
treeView1.Nodes[i].Nodes[j].Nodes.RemoveAt(k);
doAmount(-);
k--;
}
}
}
}
} public void doAmount(int i)
{
amount += i; numericUpDown2.Value = amount; gshopItemsCount = amount;
// toolStripStatusLabel2.Text = String.Format("物品:{0}",gshopItemsCount);
groupBox1.Text = "版本:" + Convert.ToString(gshopdataVersion, ).ToUpper() + String.Format(" 物品:{0} 个", amount);
} private void button1_Click(object sender, EventArgs e)
{
if (treeView1.SelectedNode != null && treeView1.SelectedNode.Level == )
{
tgds.id = BitConverter.GetBytes((int)numericUpDown3.Value);
tgds.no = BitConverter.GetBytes((int)numericUpDown4.Value);
tgds.amount = BitConverter.GetBytes((int)numericUpDown5.Value);
tgds.price = BitConverter.GetBytes((int)(numericUpDown6.Value * 100m));
tgds.time = BitConverter.GetBytes((int)numericUpDown7.Value);
tgds.zid = BitConverter.GetBytes((int)numericUpDown8.Value);
tgds.zam = BitConverter.GetBytes((int)numericUpDown9.Value);
tgds.zpr = BitConverter.GetBytes((int)(numericUpDown10.Value * 100m));
tgds.type = BitConverter.GetBytes(comboBox1.SelectedIndex);
tgds.ic = new byte[tgds.ic.Length];
Encoding.Default.GetBytes(textBox1.Text).CopyTo(tgds.ic, );
tgds.explanation = new byte[tgds.explanation.Length];
Encoding.Unicode.GetBytes(textBox2.Text).CopyTo(tgds.explanation, );
tgds.name = new byte[tgds.name.Length];
Encoding.Unicode.GetBytes(textBox3.Text).CopyTo(tgds.name, );
lst[Convert.ToInt32(treeView1.SelectedNode.Tag)] = tgds;
treeView1.SelectedNode.Text = Encoding.Unicode.GetString(tgds.name);
}
应用更新物品button1.Enabled = false;
} private void button2_Click(object sender, EventArgs e)
{
if (treeView1.SelectedNode != null && tgds.id != null)
{
maxno++;
tn = new TreeNode();
if (treeView1.SelectedNode.Level == )
{
tgds.no = BitConverter.GetBytes(maxno);
tgds.cp = BitConverter.GetBytes(treeView1.SelectedNode.Parent.Index);
tgds.cs = BitConverter.GetBytes(treeView1.SelectedNode.Index);
tn.Text = Encoding.Unicode.GetString(tgds.name);
tn.Tag = lst.Count.ToString();
lst.Add(tgds);
treeView1.Nodes[treeView1.SelectedNode.Parent.Index].Nodes[treeView1.SelectedNode.Index].Nodes.Add(tn);
}
if (treeView1.SelectedNode.Level == )
{
tgds.no = BitConverter.GetBytes(maxno);
tn.Text = Encoding.Unicode.GetString(tgds.name);
tn.Tag = lst.Count.ToString();
lst.Add(tgds);
treeView1.Nodes[treeView1.SelectedNode.Parent.Parent.Index].Nodes[treeView1.SelectedNode.Parent.Index].Nodes.Add(tn);
}
doAmount();
}
} private void button3_Click(object sender, EventArgs e)
{
if (treeView1.SelectedNode != null && treeView1.SelectedNode.Level == )
{
treeView1.SelectedNode.Remove();
doAmount(-); }
} private void button5_Click(object sender, EventArgs e)
{
if (treeView1.SelectedNode != null && treeView1.SelectedNode.Level < )
{
treeView1.SelectedNode.Text = textBox4.Text;
ldMulu1();
}
} private void button6_Click(object sender, EventArgs e)
{
if (treeView1.SelectedNode != null && treeView1.SelectedNode.Level < )
{
if (treeView1.SelectedNode.Level == )
{
treeView1.Nodes[treeView1.SelectedNode.Parent.Index].Nodes.Add(textBox4.Text);
}
else
{
treeView1.Nodes[treeView1.SelectedNode.Index].Nodes.Add(textBox4.Text);
}
ldMulu1();
}
} private void button7_Click(object sender, EventArgs e)
{
if (treeView1.SelectedNode != null && treeView1.SelectedNode.Level == )
{
if (treeView1.SelectedNode.Nodes.Count > )
{
string s = String.Format("删除类别:{0}", treeView1.SelectedNode.Text); if (MessageBox.Show(s, "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
doAmount(-treeView1.SelectedNode.Nodes.Count);
treeView1.SelectedNode.Remove();
ldMulu1();
}
}
else
{
doAmount(-treeView1.SelectedNode.Nodes.Count);
treeView1.SelectedNode.Remove();
ldMulu1();
}
}
} private void button4_Click(object sender, EventArgs e)
{
maxno = ;
for (int i = ; i < treeView1.Nodes.Count; i++)
{
for (int j = ; j < treeView1.Nodes[i].Nodes.Count; j++)
{
for (int k = ; k < treeView1.Nodes[i].Nodes[j].Nodes.Count; k++)
{
maxno++;
tgds = (gds)lst[Convert.ToInt32(treeView1.Nodes[i].Nodes[j].Nodes[k].Tag)];
tgds.no = BitConverter.GetBytes(maxno);
lst[Convert.ToInt32(treeView1.Nodes[i].Nodes[j].Nodes[k].Tag)] = tgds;
}
}
}
} TreeNode theLastNode = null;//最后选择的节点(用于还原节点状态)
private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
{
if (treeView1.SelectedNode.Level < )
{
textBox4.Text = treeView1.SelectedNode.Text;
}
if (treeView1.SelectedNode.Level == )
{
tgds = (gds)lst[Convert.ToInt32(treeView1.SelectedNode.Tag)];
show(Convert.ToInt32(treeView1.SelectedNode.Tag));
// groupBox2.Text = "物品:" + treeView1.SelectedNode.Text;
} toolTip1.SetToolTip(textBox1, textBox1.Text);
toolTip1.SetToolTip(textBox2, textBox2.Text);
toolTip1.SetToolTip(textBox3, textBox3.Text); if (this.treeView1.SelectedNode != null)
{
theLastNode = treeView1.SelectedNode;
} if (treeView1.SelectedNode != null && treeView1.SelectedNode.Level == )
应用更新物品button1.Enabled = true;
else
应用更新物品button1.Enabled = false;
} private void treeView1_BeforeSelect(object sender, TreeViewCancelEventArgs e)
{
e.Node.ForeColor = Color.Blue;
e.Node.NodeFont = new Font("宋体", , FontStyle.Underline);
if (theLastNode != null)
{
theLastNode.ForeColor = SystemColors.WindowText;
theLastNode.NodeFont = new Font("宋体", , FontStyle.Regular);
}
} private void treeView1_BeforeCheck(object sender, TreeViewCancelEventArgs e)
{
//for (int i = 0; i < e.Node.Nodes.Count; i++)
//{
// e.Node.Nodes[i].Checked = e.Node.Checked;
//}
} private void button8_Click(object sender, EventArgs e)
{
if (treeView1.SelectedNode != null)
{
TreeNode treeNode = new TreeNode();
if (treeView1.SelectedNode.Index != )
{
if (treeView1.SelectedNode.Index != )
{
treeNode = (TreeNode)treeView1.SelectedNode.Clone();
if (treeView1.SelectedNode.Level == )
{
treeView1.Nodes.Insert(treeView1.SelectedNode.PrevNode.Index, treeNode);
}
else
{
if (treeView1.SelectedNode.Level != )
{
treeView1.SelectedNode.Parent.Nodes.Insert(treeView1.SelectedNode.PrevNode.Index, treeNode);
}
}
treeView1.SelectedNode.Remove();
treeView1.SelectedNode = treeNode;
}
}
ldMulu1();
}
} private void button9_Click(object sender, EventArgs e)
{
if (treeView1.SelectedNode != null)
{
TreeNode treeNode = new TreeNode();
if (treeView1.SelectedNode.Level == )
{
if (treeView1.SelectedNode.Index != treeView1.Nodes.Count - )
{
treeNode = (TreeNode)treeView1.SelectedNode.Clone();
treeView1.Nodes.Insert(treeView1.SelectedNode.NextNode.Index + , treeNode);
treeView1.SelectedNode.Remove();
treeView1.SelectedNode = treeNode;
}
}
else
{
if (treeView1.SelectedNode.Level != )
{
if (treeView1.SelectedNode.Index != treeView1.SelectedNode.Parent.Nodes.Count - )
{
treeNode = (TreeNode)treeView1.SelectedNode.Clone();
treeView1.SelectedNode.Parent.Nodes.Insert(treeView1.SelectedNode.NextNode.Index + , treeNode);
treeView1.SelectedNode.Remove();
treeView1.SelectedNode = treeNode;
}
}
}
ldMulu1();
}
} private void button10_Click(object sender, EventArgs e)
{
byte[] bytes = BitConverter.GetBytes((int)numericUpDown11.Value);
for (int i = ; i < treeView1.Nodes.Count; i++)
{
for (int j = ; j < treeView1.Nodes[i].Nodes.Count; j++)
{
for (int k = ; k < treeView1.Nodes[i].Nodes[j].Nodes.Count; k++)
{
if (treeView1.Nodes[i].Nodes[j].Nodes[k].Checked)
{
tgds = (gds)lst[Convert.ToInt32(treeView1.Nodes[i].Nodes[j].Nodes[k].Tag)];
tgds.amount = bytes;
lst[Convert.ToInt32(treeView1.Nodes[i].Nodes[j].Nodes[k].Tag)] = tgds;
}
}
}
}
} private void button11_Click(object sender, EventArgs e)
{
byte[] bytes = BitConverter.GetBytes((int)(numericUpDown12.Value * 100m));
for (int i = ; i < treeView1.Nodes.Count; i++)
{
for (int j = ; j < treeView1.Nodes[i].Nodes.Count; j++)
{
for (int k = ; k < treeView1.Nodes[i].Nodes[j].Nodes.Count; k++)
{
if (treeView1.Nodes[i].Nodes[j].Nodes[k].Checked)
{
tgds = (gds)lst[Convert.ToInt32(treeView1.Nodes[i].Nodes[j].Nodes[k].Tag)];
tgds.price = bytes;
lst[Convert.ToInt32(treeView1.Nodes[i].Nodes[j].Nodes[k].Tag)] = tgds;
}
}
}
}
} private void button12_Click(object sender, EventArgs e)
{
byte[] bytes = Encoding.Unicode.GetBytes(textBox5.Text);
for (int i = ; i < treeView1.Nodes.Count; i++)
{
for (int j = ; j < treeView1.Nodes[i].Nodes.Count; j++)
{
for (int k = ; k < treeView1.Nodes[i].Nodes[j].Nodes.Count; k++)
{
if (treeView1.Nodes[i].Nodes[j].Nodes[k].Checked)
{
tgds = (gds)lst[Convert.ToInt32(treeView1.Nodes[i].Nodes[j].Nodes[k].Tag)];
tgds.explanation = new byte[tgds.explanation.Length];
bytes.CopyTo(tgds.explanation, );
lst[Convert.ToInt32(treeView1.Nodes[i].Nodes[j].Nodes[k].Tag)] = tgds;
}
}
}
}
} private void button13_Click(object sender, EventArgs e)
{
for (int i = ; i < treeView1.Nodes.Count; i++)
{
for (int j = ; j < treeView1.Nodes[i].Nodes.Count; j++)
{
for (int k = ; k < treeView1.Nodes[i].Nodes[j].Nodes.Count; k++)
{
if (treeView1.Nodes[i].Nodes[j].Nodes[k].Checked)
{
tn = treeView1.Nodes[i].Nodes[j].Nodes[k];
tn.Checked = false;
treeView1.Nodes[i].Nodes[j].Nodes.RemoveAt(k);
treeView1.Nodes[comboBox2.SelectedIndex].Nodes[comboBox3.SelectedIndex].Nodes.Add(tn);
k--;
}
}
}
}
} private void button14_Click(object sender, EventArgs e)
{
delmore();
} private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
{
if (comboBox2.SelectedIndex > -)
{
ldMulu2();
}
} //OpenGshopdata
private void OpenGshopdata(string sFileName)
{
try
{
rFile = new FileStream(sFileName, FileMode.Open); rFile.Seek(0L, SeekOrigin.Begin);
rFile.Read(temp, , ); //版本
gshopdataVersion = BitConverter.ToUInt32(temp, ); numericUpDown1.Value = BitConverter.ToUInt32(temp, );
// toolStripStatusLabel3.Text ="版本:" + Convert.ToString(gshopdataVersion, 16).ToUpper(); rFile.Read(temp, , );
amount = BitConverter.ToInt32(temp, ); ///
//总共物品个数
// toolStripStatusLabel2.Text = String.Format("物品:{0}", amount);
numericUpDown2.Value = amount;//////////////// groupBox1.Text = "版本:" + Convert.ToString(gshopdataVersion, ).ToUpper() + String.Format(" 物品:{0} 个", amount); bt = new byte[Marshal.SizeOf(typeof(gds))];
for (int i = ; i < amount; i++)
{
rFile.Read(bt, , Marshal.SizeOf(typeof(gds)));
lst.Add((gds)Form1.rawDeserialize(bt, typeof(gds)));
} bt = new byte[];
byte[] array = new byte[];
for (int i = ; i < ; i++)
{
rFile.Read(bt, , );
treeView1.Nodes.Add(Encoding.Unicode.GetString(bt));
comboBox2.Items.Add(Encoding.Unicode.GetString(bt));
rFile.Read(array, , );
int num = BitConverter.ToInt32(array, );
for (int j = ; j < num; j++)
{
rFile.Read(bt, , );
treeView1.Nodes[i].Nodes.Add(Encoding.Unicode.GetString(bt));
}
} rFile.Close();
for (int i = ; i < amount; i++)
{
int num2 = BitConverter.ToInt32(((gds)lst[i]).no, );
if (maxno < num2)
{
maxno = num2;
}
tn = new TreeNode();
tn.Text = Encoding.Unicode.GetString(((gds)lst[i]).name);
tn.Tag = i.ToString();
treeView1.Nodes[BitConverter.ToInt32(((gds)lst[i]).cp, )].Nodes[BitConverter.ToInt32(((gds)lst[i]).cs, )].Nodes.Add(tn);
}
ldMulu1();
}
catch (IOException ex)
{
MessageBox.Show(ex.ToString());
}
} //Savegshop.data
private void SaveGshopdata(string sFileName)
{ try
{
wFile = new FileStream(sFileName, FileMode.Create);
wFile.Seek(0L, SeekOrigin.Begin); temp = BitConverter.GetBytes((int)numericUpDown1.Value);///////ver wFile.Write(temp, , );
temp = BitConverter.GetBytes((int)numericUpDown2.Value);///////total count wFile.Write(temp, , ); no = ;
for (int i = ; i < treeView1.Nodes.Count; i++)
{
for (int j = ; j < treeView1.Nodes[i].Nodes.Count; j++)
{
for (int k = ; k < treeView1.Nodes[i].Nodes[j].Nodes.Count; k++)
{
tgds = (gds)lst[Convert.ToInt32(treeView1.Nodes[i].Nodes[j].Nodes[k].Tag)];
no++;
tgds.cp = BitConverter.GetBytes(i);
tgds.cs = BitConverter.GetBytes(j);
bt = Form1.rawSerialize(tgds);
wFile.Write(bt, , Marshal.SizeOf(typeof(gds)));
}
}
} bt = new byte[];
byte[] array = new byte[];
for (int i = ; i < treeView1.Nodes.Count; i++)
{
bt = new byte[];
Encoding.Unicode.GetBytes(treeView1.Nodes[i].Text).CopyTo(bt, );
wFile.Write(bt, , bt.Length);
wFile.Write(BitConverter.GetBytes(treeView1.Nodes[i].Nodes.Count), , );
for (int j = ; j < treeView1.Nodes[i].Nodes.Count; j++)
{
bt = new byte[];
Encoding.Unicode.GetBytes(treeView1.Nodes[i].Nodes[j].Text).CopyTo(bt, );
wFile.Write(bt, , );
}
}
wFile.Close();
}
catch (IOException ex)
{
MessageBox.Show(ex.ToString());
} } //Save gshopsev.data
private void SaveGshopSevData(string sFileName)
{
try
{
wFile = new FileStream(sFileName, FileMode.Create);
wFile.Seek(0L, SeekOrigin.Begin); wFile.Write(BitConverter.GetBytes((int)numericUpDown1.Value), , );////////////
wFile.Write(BitConverter.GetBytes((int)numericUpDown2.Value), , );///////////////// bt = new byte[Marshal.SizeOf(typeof(sgds))];
no = ;
for (int i = ; i < treeView1.Nodes.Count; i++)
{
for (int j = ; j < treeView1.Nodes[i].Nodes.Count; j++)
{
for (int k = ; k < treeView1.Nodes[i].Nodes[j].Nodes.Count; k++)
{
tgds = (gds)lst[Convert.ToInt32(treeView1.Nodes[i].Nodes[j].Nodes[k].Tag)];
tsgds = default(sgds);
tsgds.no = BitConverter.GetBytes(no);
no++;
tsgds.cp = BitConverter.GetBytes(i);
tsgds.cs = BitConverter.GetBytes(j);
tsgds.id = tgds.id;
tsgds.amount = tgds.amount;
tsgds.price = tgds.price;
tsgds.v1 = tgds.v1;
tsgds.time = tgds.time;
tsgds.v2 = tgds.v2;
bt = Form1.rawSerialize(tsgds);
wFile.Write(bt, , Marshal.SizeOf(typeof(sgds)));
for (int l = ; l < ; l++)
{
wFile.Write(BitConverter.GetBytes(4294967295u), , );
for (int m = ; m < ; m++)
{
wFile.Write(BitConverter.GetBytes(), , );
}
}
}
}
}
wFile.Close();
}
catch (IOException ex)
{
MessageBox.Show(ex.ToString());
}
} private void OpenGshopdata()
{
toolStripStatusLabel1.Text = "加载中...";
sOpenFileName = openFileDialog1.FileName;
Text = openFileDialog1.FileName + " - roman gshop Editor"; ///
treeView1.Nodes.Clear();
lst.Clear();
OpenGshopdata(openFileDialog1.FileName);
//// toolStripStatusLabel1.Text = "加载完毕";
timer1.Enabled = true; if (treeView1.Nodes.Count > )
{
treeView1.Focus();
treeView1.SelectedNode = treeView1.Nodes[];
}
numericUpDown1.Visible = true;
}
private void 打开OToolStripMenuItem1_Click(object sender, EventArgs e)
{
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
OpenGshopdata();
}
} private string CreateFile2(string sFileName)
{
string Dir = System.IO.Path.GetDirectoryName(sFileName) + "\\";
string FileTitle = "gshop";
string FileExt = System.IO.Path.GetExtension(sFileName); string s1 = Dir + FileTitle + FileExt;
int j = ; if (System.IO.File.Exists(s1))
{
string s = string.Format("{0}{1}_{2}{3}", Dir, j, FileTitle, FileExt);
while (System.IO.File.Exists(s))
{
j++;
s = string.Format("{0}{1}_{2}{3}", Dir, j, FileTitle, FileExt);
} if (!System.IO.File.Exists(s))
{
//"D:\Administrator\Desktop\GSHOPDATA\gshop.data"
////"D:\Administrator\Desktop\GSHOPDATA\gshopsev.data"
string gshopsevFileName = System.IO.Path.GetDirectoryName(s) + "\\" + Convert.ToString(j) + "_gshopsev.data"; ////Savegshop.data
SaveGshopdata(s); ////Save gshopsev.data
SaveGshopSevData(gshopsevFileName); //MessageBox.Show(s);
}
return s;
}
else
{
string gshopsevFileName = System.IO.Path.GetDirectoryName(s1) + "\\gshopsev.data"; ////Savegshop.data
SaveGshopdata(s1);
//MessageBox.Show(s1); ////Save gshopsev.data
SaveGshopSevData(gshopsevFileName);
return s1;
}
} private void SaveFile()
{
if (rFile != null)
{ string s = CreateFile2(sOpenFileName);
//string s=saveFileName;
sOpenFileName = s;
string gshopFileTitle = System.IO.Path.GetFileName(s);
string gshopSevTitle = gshopFileTitle.Substring(, gshopFileTitle.Length - ) + "gshopsev.data";
string path = System.IO.Path.GetDirectoryName(s);
//MessageBox.Show(gshopFileTitle);
//MessageBox.Show(gshopSevTitle);
//MessageBox.Show(path); MessageBox.Show("文件已保存!\r\n" + "客户端文件:" + gshopFileTitle +
"\r\n服务端文件:" + gshopSevTitle +
"\r\n存放的路径:" + path,
"ROMAN提示", MessageBoxButtons.OK, MessageBoxIcon.Information); timer1.Enabled = true; }
else
{
MessageBox.Show("null");
}
}
private void 保存SToolStripMenuItem1_Click(object sender, EventArgs e)
{ SaveFile();
toolStripStatusLabel1.Text = "保存成功";
} private string sOpenFileName = "";
private void 定位文件toolStripButton1_Click(object sender, EventArgs e)
{ if (System.IO.File.Exists(sOpenFileName))
{
System.Diagnostics.Process.Start("explorer.exe", @"/select," + sOpenFileName);
}
// Text = sOpenFileDir;
} private void toolStripMenuItem2_Click(object sender, EventArgs e)
{
saveFileDialog1.Title = "导出";
saveFileDialog1.FileName = "exportItem.data";
if (rFile != null && saveFileDialog1.ShowDialog() == DialogResult.OK)
{ try
{
wFile = new FileStream(saveFileDialog1.FileName, FileMode.Create);
wFile.Seek(0L, SeekOrigin.Begin);
for (int i = ; i < treeView1.Nodes.Count; i++)
{
for (int j = ; j < treeView1.Nodes[i].Nodes.Count; j++)
{
for (int k = ; k < treeView1.Nodes[i].Nodes[j].Nodes.Count; k++)
{
if (treeView1.Nodes[i].Nodes[j].Nodes[k].Checked)
{
tgds = (gds)lst[Convert.ToInt32(treeView1.Nodes[i].Nodes[j].Nodes[k].Tag)];
tgds.cp = BitConverter.GetBytes(i);
tgds.cs = BitConverter.GetBytes(j);
bt = Form1.rawSerialize(tgds);
wFile.Write(bt, , Marshal.SizeOf(typeof(gds)));
}
}
}
}
wFile.Close();
}
catch (IOException ex)
{
MessageBox.Show(ex.ToString());
}
}
} private void toolStripMenuItem1_Click(object sender, EventArgs e)
{
if (rFile != null)
{
if (treeView1.SelectedNode == null || treeView1.SelectedNode.Level != )
{
MessageBox.Show("请选中存放导入数据的目录!");
}
else
{
openFileDialog1.Title = "导入";
openFileDialog1.FileName = "exportItem.data";
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
try
{
rFile = new FileStream(openFileDialog1.FileName, FileMode.Open);
rFile.Seek(0L, SeekOrigin.Begin);
int num = Marshal.SizeOf(typeof(gds));
bt = new byte[num];
int num2 = ;
while ((long)num2 < rFile.Length)
{
rFile.Read(bt, , num);
tgds = (gds)Form1.rawDeserialize(bt, typeof(gds));
maxno++;
tgds.no = BitConverter.GetBytes(maxno);
tn = new TreeNode();
tn.Text = Encoding.Unicode.GetString(tgds.name);
tn.Tag = lst.Count.ToString();
lst.Add(tgds);
treeView1.SelectedNode.Nodes.Add(tn);
doAmount();
num2 += num;
}
rFile.Close();
}
catch (IOException ex)
{
MessageBox.Show(ex.ToString());
}
}
}
}
} private void textBox3_DoubleClick(object sender, EventArgs e)
{
textBox3.SelectAll();
} private void textBox1_DoubleClick(object sender, EventArgs e)
{
textBox1.SelectAll();
} private void textBox2_DoubleClick(object sender, EventArgs e)
{
textBox2.SelectAll();
} private void 内容CToolStripMenuItem_Click(object sender, EventArgs e)
{
System.Diagnostics.Process.Start("iexplore.exe", "http://www.cnblogs.com/xe2011/p/3576727.html");
} private void 置顶TToolStripMenuItem_Click(object sender, EventArgs e)
{
TopMost = 置顶TToolStripMenuItem.Checked;
} private void 退出XToolStripMenuItem1_Click(object sender, EventArgs e)
{
Close();
} private void timer1_Tick(object sender, EventArgs e)
{
toolStripStatusLabel1.Text = "Ready";
timer1.Enabled = false;
} private void Form1_Load(object sender, EventArgs e)
{
toolStripStatusLabel1.Text = "Ready";
toolStripStatusLabel2.Text = "";
toolStripStatusLabel3.Text = ""; }
//CHECK NODE COUNT
private int TreeviewCountCheckedNodes(TreeNodeCollection treeNodeCollection)
{
int countchecked = ;
if (treeNodeCollection != null)
{
foreach (TreeNode node in treeNodeCollection)
{
if (node.Nodes.Count == && node.Checked)
{
countchecked++;
}
else if (node.Nodes.Count > )
{
countchecked += TreeviewCountCheckedNodes(node.Nodes);
}
}
}
return countchecked;
} private void timer2_Tick(object sender, EventArgs e)
{
try
{
//状态设置
定位文件toolStripButton1.Enabled = System.IO.File.Exists(sOpenFileName); 保存SToolStripButton.Enabled = (rFile != null);
保存SToolStripMenuItem1.Enabled = (rFile != null); 修改类名称button.Enabled = (treeView1.SelectedNode != null && treeView1.SelectedNode.Level < );
button6.Enabled = (treeView1.SelectedNode != null && treeView1.SelectedNode.Level < );
textBox4.Enabled = (treeView1.SelectedNode != null && treeView1.SelectedNode.Level < ); button7.Enabled = (treeView1.SelectedNode != null && treeView1.SelectedNode.Level == ); // 应用更新物品button1.Enabled = (treeView1.SelectedNode != null && treeView1.SelectedNode.Level == 2);
button2.Enabled = (treeView1.SelectedNode != null && tgds.id != null);
button3.Enabled = (treeView1.SelectedNode != null && treeView1.SelectedNode.Level == ); toolStripMenuItem1.Enabled = (treeView1.SelectedNode != null && treeView1.SelectedNode.Level == );
toolStripMenuItem2.Enabled = (treeView1.SelectedNode != null && treeView1.SelectedNode.Level == ); SearchNodeText.Enabled = textBox7.Text.Trim().Length > ; button8.Enabled = (treeView1.SelectedNode != null);
button9.Enabled = (treeView1.SelectedNode != null); 选中ToolStripMenuItem.Visible = (treeView1.SelectedNode != null && treeView1.SelectedNode.Level == );
清除ToolStripMenuItem.Visible = (treeView1.SelectedNode != null && treeView1.SelectedNode.Level == ); 修改类名称button.Enabled = textBox4.Modified; if (treeView1.Focused)
{
if (button7.Enabled)
{
删除类别TToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Delete;
}
else
{
删除类别TToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.None;
} if (button3.Enabled)
{
删除物品CToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Delete;
}
else
{
删除物品CToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.None;
}
}
else
{
删除物品CToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.None;
}
int ChecknodeItemsCount = TreeviewCountCheckedNodes(treeView1.Nodes);
toolStripStatusLabel2.Text = "选中物品: " + Convert.ToString(ChecknodeItemsCount); 导入toolStripButton1.Enabled = (treeView1.SelectedNode != null && treeView1.SelectedNode.Level == );
导出toolStripButton2.Enabled = (treeView1.SelectedNode != null && treeView1.SelectedNode.Level <= && ChecknodeItemsCount >= ); if (ChecknodeItemsCount > )
{
this.toolStripStatusLabel2.ForeColor = System.Drawing.Color.Red;
}
else
{
this.toolStripStatusLabel2.ForeColor = System.Drawing.Color.Black;
} groupBox3.Visible = (treeView1.SelectedNode.Level == ) && (ChecknodeItemsCount > ); 全选button16.Enabled = (treeView1.SelectedNode != null && treeView1.SelectedNode.Level == ); //Copy1.Enabled = treeView1.SelectedNode != null; // toolTip1.SetToolTip(treeView1, textBox1.Text); }
catch { }
} public void CheckAllNodes(TreeNodeCollection nodes)
{
foreach (TreeNode node in nodes)
{
node.Checked = true;
CheckChildren(node, true);
}
} public void UncheckAllNodes(TreeNodeCollection nodes)
{
foreach (TreeNode node in nodes)
{
node.Checked = false;
CheckChildren(node, false);
}
} private void CheckChildren(TreeNode rootNode, bool isChecked)
{
foreach (TreeNode node in rootNode.Nodes)
{
CheckChildren(node, isChecked);
node.Checked = isChecked;
}
}
private void 全选button16_Click(object sender, EventArgs e)
{
if (treeView1.SelectedNode != null)
{
treeView1.SelectedNode.Checked = false;
if (treeView1.SelectedNode.Level == )
CheckAllChildNodes(treeView1.SelectedNode, true);
}
} private void textBox1_Enter(object sender, EventArgs e)
{
//BeginInvoke((Action)delegate
//{
// textBox1.SelectAll();
//});
} private void textBox2_Enter(object sender, EventArgs e)
{
//BeginInvoke((Action)delegate
//{
// textBox2.SelectAll();
//});
} private void treeView1_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Right)
{
TreeNode tn = treeView1.GetNodeAt(e.X, e.Y);
if (tn != null) treeView1.SelectedNode = tn;
}
} private void treeView1_KeyDown(object sender, KeyEventArgs e)
{
if (treeView1.SelectedNode == null)
return; if (e.KeyCode == Keys.Enter)
{
if (treeView1.SelectedNode.IsExpanded == false)
treeView1.SelectedNode.Expand();
else
treeView1.SelectedNode.Collapse();
} //if (e.KeyCode == Keys.Space)
//{ // treeView1.SelectedNode.Checked = false;
// 全选button16_Click(sender, e); // if (treeView1.SelectedNode.Checked == false)
// { // }
// else
// {
// 不选button17_Click(sender, e);
// } //} if (e.KeyCode == Keys.Escape)
{
不选button17_Click(sender, e);
} } private void treeView1_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == )
{
e.Handled = true;
}
} private void textBox4_Enter(object sender, EventArgs e)
{
//BeginInvoke((Action)delegate
//{
// textBox4.SelectAll();
//});
} public void CheckAllChildNodes(TreeNode treeNode, bool bChecked)
{
foreach (TreeNode node in treeNode.Nodes)
{
node.Checked = bChecked; if (node.Nodes.Count > )
{
this.CheckAllChildNodes(node, bChecked);
}
}
} private void 不选button17_Click(object sender, EventArgs e)
{
foreach (TreeNode tn in treeView1.Nodes)
{
tn.Checked = false;
CheckAllChildNodes(tn, false);
}
} private void 清除当前ToolStripMenuItem_Click(object sender, EventArgs e)
{
CheckAllChildNodes(treeView1.SelectedNode, false);
} private void Form1_DragDrop(object sender, DragEventArgs e)
{
string sFileName = ((System.Array)e.Data.GetData(DataFormats.FileDrop)).GetValue().ToString();
string sFileDir = System.IO.Path.GetDirectoryName(sFileName); openFileDialog1.FileName = sFileName;
OpenGshopdata();
} private void Form1_DragEnter(object sender, DragEventArgs e)
{
if (e.Data.GetDataPresent(DataFormats.FileDrop))
e.Effect = DragDropEffects.Link;
else e.Effect = DragDropEffects.None;
} private void 重新启动RToolStripMenuItem_Click(object sender, EventArgs e)
{
string sFileName = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName;
Close();
System.Diagnostics.Process.Start(sFileName);
} private void textBox4_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
if (修改类名称button.Enabled)
{
button5_Click(sender, e);
textBox4.Modified = false;
}
}
} private void textBox3_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
if (应用更新物品button1.Enabled)
{
button1_Click(sender, e);
textBox3.Modified = false;
}
}
} private void textBox3_TextChanged(object sender, EventArgs e)
{
if (treeView1.SelectedNode != null && treeView1.SelectedNode.Level == )
应用更新物品button1.Enabled = true;
} private void SelectAll(NumericUpDown numericUpDown)
{
numericUpDown.Select(, numericUpDown.Value.ToString().Length);
} private void numericUpDown3_Enter(object sender, EventArgs e)
{
//BeginInvoke((Action)delegate
//{
// SelectAll(numericUpDown3);
//});
} private void textBox4_DoubleClick(object sender, EventArgs e)
{
textBox4.SelectAll();
} private void numericUpDown5_Enter(object sender, EventArgs e)
{
//BeginInvoke((Action)delegate
//{
// SelectAll(numericUpDown5);
//});
} private void numericUpDown6_Enter(object sender, EventArgs e)
{
//BeginInvoke((Action)delegate
//{
// SelectAll(numericUpDown6);
//});
} private void numericUpDown7_Enter(object sender, EventArgs e)
{
//BeginInvoke((Action)delegate
//{
// SelectAll(numericUpDown7);
//});
} private void numericUpDown12_Enter(object sender, EventArgs e)
{
//BeginInvoke((Action)delegate
//{
// SelectAll(numericUpDown12);
//});
} private void numericUpDown11_Enter(object sender, EventArgs e)
{
//BeginInvoke((Action)delegate
//{
// SelectAll(numericUpDown11);
//});
} private void SearchNodes(string SearchText, TreeNode StartNode)
{
TreeNode node = null;
while (StartNode != null)
{
if (StartNode.Text.ToLower().Contains(SearchText.ToLower()))
{
CurrentNodeMatches.Add(StartNode);
} if (StartNode.Nodes.Count != )
{
SearchNodes(SearchText, StartNode.Nodes[]);//Recursive Search
}
StartNode = StartNode.NextNode;
}
} private List<TreeNode> CurrentNodeMatches = new List<TreeNode>();
private int LastNodeIndex = ;
private string LastSearchText; private void SearchNodeText_Click(object sender, EventArgs e)
{
treeView1.Focus();
string searchText = this.textBox7.Text;
if (String.IsNullOrEmpty(searchText))
{
return;
} if (LastSearchText != searchText)
{
//It's a new Search
CurrentNodeMatches.Clear();
LastSearchText = searchText;
LastNodeIndex = ;
SearchNodes(searchText, treeView1.Nodes[]); } if (CurrentNodeMatches.Count == )
toolStripStatusLabel3.Text = "无查找记录!";
else
toolStripStatusLabel3.Text = "";
/// MessageBox.Show("无查找记录!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); if (LastNodeIndex >= && CurrentNodeMatches.Count > && LastNodeIndex < CurrentNodeMatches.Count)
{
TreeNode selectedNode = CurrentNodeMatches[LastNodeIndex];
LastNodeIndex++;
this.treeView1.SelectedNode = selectedNode;
this.treeView1.SelectedNode.Expand();
this.treeView1.Select();
}
else
LastNodeIndex = ;
} private void textBox7_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
SearchNodeText_Click(sender, e);
}
} private void textBox7_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == )
{
e.Handled = true;
}
} private void cOPYToolStripMenuItem_Click(object sender, EventArgs e)
{
if (treeView1.SelectedNode != null)
{
string s = treeView1.SelectedNode.Text;
System.Windows.Forms.Clipboard.SetText(s);
}
} private void Form1_KeyDown(object sender, KeyEventArgs e)
{ } }
}

gshop.data 编辑器通杀版本 支持146-151版本的更多相关文章

  1. chromedriver版本 支持的Chrome版本

    在使用selenium测试时,如果选择chrome浏览器,需要将chrome driver的exe文件放在项目下 错误的driver版本,会导致无法正常打开本机的浏览器 以下为对应关系 来自网络 ch ...

  2. chromedriver版本支持的Chrome版本

    下载chromedriver,链接:http://chromedriver.storage.googleapis.com/index.html   chromedirver版本 支持的Chrome版本 ...

  3. chromedriver对应的支持的Chrome版本(更新至Chrome63)

    很多网友在配置chromedriver的时候会遇到很多麻烦,在网上找了很多资料觉得这个表格不错,就给大家分享出来,希望对大家配置chrome的时候有帮助: chromedriver版本 支持的Chro ...

  4. chromedriver对应的支持的Chrome版本(更新至Chrome64)

    很多网友在配置chromedriver的时候会遇到很多麻烦,在网上找了很多资料觉得这个表格不错,就给大家分享出来,希望对大家配置chrome的时候有帮助: chromedriver版本 支持的Chro ...

  5. New!Devexpress WPF各版本支持VS和SQL Server版本对应图

    点击获取DevExpress v19.2.3完整版试用下载 本文主要为大家介绍DevExpress WPF各大版本支持的VS版本和支持的.Net版本图,Devexpress WPF v19.2.3日前 ...

  6. New!Devexpress WinForms各版本支持Visual Studo和SQL Server版本对应图

    点击获取DevExpress v19.2.3最新完整版试用下载 本文主要为大家介绍DevExpress WinForms各大版本支持的VS版本和支持的.Net版本图,Devexpress WinFor ...

  7. 使用Selenium时,如何选择ChromeDriver驱动版本对应Chrome浏览器版本

      ChromeDriver版本 支持的Chrome版本 v2.46 v72-74 v2.45 v71-73 v2.44 v70-72 v2.43 v69-71 v2.42 v68-70 v2.41 ...

  8. Python爬虫教程-27-Selenium Chrome版本与chromedriver兼容版本对照表

    我们使用Selenium+Chrome时,版本不一样, 会导致 chromedriver 停止运行 chromedriver 所有版本下载链接:http://npm.taobao.org/mirror ...

  9. selenium driver版本和Chrome浏览器版本对应关系

    ChromeDriver v2.41 (2018-07-27) ---- Chrome v67-69ChromeDriver v2.40 (2018-06-07) ---- Chrome v66-68 ...

随机推荐

  1. POJ 2195 Going Home(最小费用最大流)

    http://poj.org/problem?id=2195 题意 :  N*M的点阵中,有N个人,N个房子.让x个人走到这x个房子中,只能上下左右走,每个人每走一步就花1美元,问当所有的人都归位了之 ...

  2. HDU4523+简单

    题意很简单. 一次最多多切出一条边! 其余的就没什么好说的了 import java.util.*; import java.math.*; public class Main{ public sta ...

  3. Arrays.sort 与 Collections.sort

    代码如下: package com.wangzhu.arrays; import java.util.Arrays; import java.util.Collections; public clas ...

  4. strspn和strcspn妙用

    http://blog.csdn.net/aidenliu/article/details/5460201

  5. javaweb学习总结(三十九)——数据库连接池

    一.应用程序直接获取数据库连接的缺点 用户每次请求都需要向数据库获得链接,而数据库创建连接通常需要消耗相对较大的资源,创建时间也较长.假设网站一天10万访问量,数据库服务器就需要创建10万次连接,极大 ...

  6. [译]GotW #4 Class Mechanics

    你对写一个类的细节有多在行?这条款不仅注重公然的错误,更多的是一种专业的风格.了解这些原则将会帮助你设计易于使用和易于管理的类. JG Question 1. 什么使得接口“容易正确使用,错误使用却很 ...

  7. 【HDOJ】1086 You can Solve a Geometry Problem too

    数学题,证明AB和CD.只需证明C.D在AB直线两侧,并且A.B在CD直线两侧.公式为:(ABxAC)*(ABxAD)<= 0 and(CDxCA)*(CDxCB)<= 0 #includ ...

  8. tlplayer,wzplayer支持wince,winphone,windows8 for arm

    tlplayer,wzplayer宣布支持wince,winphone,windows8 for arm,支持http,hls,rtmp,rtsp,mms等媒体流协议. 支持加密视频播放. 目前tlp ...

  9. Visual Studio Solution Configuration

    https://msdn.microsoft.com/en-us/library/bb166577.aspx Solution configurations store solution-level ...

  10. Nagios Core/Icinga 基于栈的缓冲区溢出漏洞

    漏洞名称: Nagios Core/Icinga 基于栈的缓冲区溢出漏洞 CNNVD编号: CNNVD-201402-484 发布时间: 2014-03-03 更新时间: 2014-03-03 危害等 ...