1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
| 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 WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
string _fullversion = "http://ton-site.com/download/fullversion/launcher.exe"; // Lien de la version compléte
string _MAJ = "http://ton-site.com/download/fullversion/";
string _chemin = "C:/Program Files(x86)/jeu/version.txt"; // Chemin de la version.txt sur le PC
WebClient _WClient = new WebClient();
bool _existe = false;
string _version = ""; // lien de la version
label1.Visible = false;
richTextBox1.Visible = false;
richTextBox2.Visible = false;
try
{
// Verification de la version
if (File.Exists(_chemin))
{
_existe = true;
}
else
{
_existe = false;
_WClient.DownloadFile(_fullversion, "C:/Program Files(x86)/jeu/");
}
}
catch (Exception error)
{
MessageBox.Show("Erreur" + error);
}
if (_existe == true)
{
StreamReader _lecture = new StreamReader(_chemin, System.Text.Encoding.Default);
string _actuelle = _WClient.DownloadString(_version);
richTextBox1.Text = _lecture.ReadToEnd();
richTextBox2.Text = (_actuelle);
if (richTextBox1.Text == richTextBox2.Text)
{
}
}
}
}
} |