Guest User

Untitled

a guest
Dec 15th, 2013
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.00 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10. using PackageIO;
  11.  
  12. namespace Tutorial_ReadWriteCSharp
  13. {
  14.     public partial class Form1 : Form
  15.     {
  16.         string path;
  17.        
  18.         public Form1()
  19.         {
  20.             InitializeComponent();
  21.         }
  22.  
  23.         private void exitToolStripMenuItem_Click(object sender, EventArgs e)
  24.         {
  25.             Application.Exit();
  26.         }
  27.  
  28.         private void openToolStripMenuItem_Click(object sender, EventArgs e)
  29.         {
  30.             OpenFileDialog open = new OpenFileDialog();
  31.             open.Title = "Choose your DF3 Game .txt file!";
  32.             open.Filter = "Text Files (.txt) | *.txt";
  33.             if (open.ShowDialog() == DialogResult.OK)
  34.             {
  35.                 path = open.FileName;
  36.                 Reader readfile = new Reader(path);
  37.                 readfile.Position = 0x0;
  38.                 if (readfile.PeekString(0xB) == "DF3GAMEFILE")
  39.                 {
  40.                     MessageBox.Show("The file has been opened!");
  41.                     groupBox1.Enabled = true;
  42.                     readfile.Position = 0x225;
  43.                     textBox1.Text = Convert.ToString(readfile.PeekString(0x3F));
  44.                    
  45.                    
  46.                 }
  47.                 else
  48.                 {
  49.                     MessageBox.Show("The file has been found however it was not a DF3 File!!!");
  50.                 }
  51.  
  52.             }
  53.             else
  54.             {
  55.  
  56.             }
  57.         }
  58.  
  59.         private void Form1_Load(object sender, EventArgs e)
  60.         {
  61.             textBox1.MaxLength = 63;
  62.         }
  63.  
  64.         private void button1_Click(object sender, EventArgs e)
  65.         {
  66.             Writer write = new Writer(path, Endian.Little, 0L);
  67.             write.Position = 0x225;
  68.             write.WriteString(textBox1.Text);
  69.  
  70.         }
  71.     }
  72. }
Advertisement
Add Comment
Please, Sign In to add comment