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.Windows.Forms;
- using System.IO;
- using System.Net;
- namespace BattlEye
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- private void button1_Click(object sender, EventArgs e)
- {
- string path1 = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
- string path2 = path1 + "\\AppData\\Local\\ArmA 2 OA\\BattlEye\\BEClient.dll";
- string beClientMD5;
- string beHash;
- TextReader tr = new StreamReader("md5hash.txt");
- beClientMD5 = tr.ReadLine();
- tr.Close();
- beHash = GetMD5HashFromFile(path2);
- beStatus.Text = Status(beHash, beClientMD5);
- }
- private static string GetMD5HashFromFile(string fileName)
- {
- FileStream file = new FileStream(fileName, FileMode.Open);
- System.Security.Cryptography.MD5 md5 = new System.Security.Cryptography.MD5CryptoServiceProvider();
- byte[] retVal = md5.ComputeHash(file);
- file.Close();
- StringBuilder sb = new StringBuilder();
- for (int i = 0; i < retVal.Length; i++)
- {
- sb.Append(retVal[i].ToString("x2"));
- }
- return sb.ToString();
- }
- public static string Status(string md5, string beclientmd5)
- {
- Form1 form = new Form1();
- if (md5 == beclientmd5)
- {
- return "Up to date!";
- }
- else
- {
- return "Wrong version!";
- }
- }
- private void Form1_Load(object sender, EventArgs e)
- {
- WebClient webClient = new WebClient();
- webClient.DownloadFile("http://dl.dropbox.com/u/95266139/md5hash.txt", "md5hash.txt");
- }
- private void button2_Click(object sender, EventArgs e)
- {
- try
- {
- string path1 = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
- string path2 = path1 + "\\AppData\\Local\\ArmA 2 OA\\BattlEye\\BEClient.dll";
- WebClient webClient = new WebClient();
- webClient.DownloadFile("http://dl.dropbox.com/u/95266139/BEClient.dll", path2);
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.ToString());
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement