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 PackageIO;
- namespace Tutorial_ReadWriteCSharp
- {
- public partial class Form1 : Form
- {
- string path;
- public Form1()
- {
- InitializeComponent();
- }
- private void exitToolStripMenuItem_Click(object sender, EventArgs e)
- {
- Application.Exit();
- }
- private void openToolStripMenuItem_Click(object sender, EventArgs e)
- {
- OpenFileDialog open = new OpenFileDialog();
- open.Title = "Choose your DF3 Game .txt file!";
- open.Filter = "Text Files (.txt) | *.txt";
- if (open.ShowDialog() == DialogResult.OK)
- {
- path = open.FileName;
- Reader readfile = new Reader(path);
- readfile.Position = 0x0;
- if (readfile.PeekString(0xB) == "DF3GAMEFILE")
- {
- MessageBox.Show("The file has been opened!");
- groupBox1.Enabled = true;
- readfile.Position = 0x225;
- textBox1.Text = Convert.ToString(readfile.PeekString(0x3F));
- }
- else
- {
- MessageBox.Show("The file has been found however it was not a DF3 File!!!");
- }
- }
- else
- {
- }
- }
- private void Form1_Load(object sender, EventArgs e)
- {
- textBox1.MaxLength = 63;
- }
- private void button1_Click(object sender, EventArgs e)
- {
- Writer write = new Writer(path, Endian.Little, 0L);
- write.Position = 0x225;
- write.WriteString(textBox1.Text);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment