Zachman61

Basic GPD Check

Jan 15th, 2013
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.51 KB | None | 0 0
  1. // Place If statement on an executable control (Button, label, image, etc.)
  2.  if (openFileDialog1.ShowDialog() == DialogResult.OK)
  3.             {
  4.                 FileName = openFileDialog1.FileName;
  5.                 Reader = new BinaryReader(File.Open(openFileDialog1.FileName, FileMode.Open));
  6.                 ReadFile();
  7.         }
  8. void ReadFile()
  9.         {
  10.             String Magic = Encoding.ASCII.GetString(Reader.ReadBytes(4));
  11.         if (Magic != "XDBF")
  12.         {
  13.         MessageBox.Show("File isn't a valid GPD.");
  14.         }
  15.     }
Advertisement
Add Comment
Please, Sign In to add comment