Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- using System.IO;
- using Stump.DofusProtocol.Tools.D2i;
- namespace WindowsFormsApp1
- {
- public partial class Form1 : Form
- {
- public string path
- {
- get;
- set;
- }
- public string IdOfTextChange
- {
- get;
- set;
- }
- public D2IFile d2i;
- public Form1()
- {
- InitializeComponent();
- }
- private void button1_Click(object sender, EventArgs e)
- {
- OpenFileDialog ofd = new OpenFileDialog();
- DialogResult result = ofd.ShowDialog();
- if (result == DialogResult.OK && ofd.CheckFileExists && Path.GetExtension(ofd.FileName) == ".d2i")
- {
- path = Path.GetFullPath(ofd.FileName);
- MessageBox.Show("Load ! ","Load");
- d2i = new D2IFile(path);
- }
- else { MessageBox.Show("Erreur","Load"); }
- }
- private void loadtext_Click(object sender, EventArgs e)
- {
- if (d2i == null)
- {
- MessageBox.Show("Load a file !", "Error");
- }
- else
- {
- //foreach(var text in d2i.GetAllText())
- //{
- var txt = d2i.GetText(500);
- dataGridView1.Rows.Add("500", txt);
- //}
- }
- }
- private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
- {
- richTextBox1.Text = dataGridView1.CurrentRow.Cells[1].Value.ToString();
- IdOfTextChange= dataGridView1.CurrentRow.Cells[0].Value.ToString();
- groupBox1.Show();
- }
- private void textSave_Click(object sender, EventArgs e)
- {
- var content = richTextBox1.Text;
- d2i.SetText(IdOfTextChange,content);
- groupBox1.Hide();
- }
- private void textCancel_Click(object sender, EventArgs e)
- {
- groupBox1.Hide();
- }
- private void Save_Click(object sender, EventArgs e)
- {
- SaveFileDialog save = new SaveFileDialog();
- if(save.ShowDialog() == DialogResult.OK)
- {
- d2i.Save(save.FileName);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement