Faire un système de mise à jour par internet

Statut
N'est pas ouverte pour d'autres réponses.

MMs R.

Premium
Inscription
24 Avril 2013
Messages
1 541
Réactions
621
Points
18 329
RGCoins
25
Helloo

Je vous présente mon tuto en vidéo car il est long et sa sera peut être plus simple a comprendre.

Je vous laisse a vidéo et bonne chance ;)

Vous devez être inscrit pour voir les médias

Tchiaoooo
 
Merci pour le partage ! mais le problème c'est que quand j'ouvre le texte winrar bug :'( Je pense que sa vient de chez moi mais esque sa fait sa a quelqu’un d'autre ?
 
Merci pour le partage ! mais le problème c'est que quand j'ouvre le texte winrar bug :'( Je pense que sa vient de chez moi mais esque sa fait sa a quelqu’un d'autre ?
Quand tu ouvre quelle texte en winrar ??
 
namespace WindowsFormsApplication2
{
public partial class Form1 : XtraForm
{
private readonly string Version = "1.0.0.0";




public void checkForUpdate()
{
string URL = " Votre Site ou ya votre serveur FTP ";
string appNAME = "tool.rar";
string serverVersion;
string serverVersionName = "ToolVersion.txt";

WebRequest req = WebRequest.Create(URL + serverVersionName);
WebResponse res = req.GetResponse();
Stream str = res.GetResponseStream();
StreamReader tr = new StreamReader(str);
serverVersion = tr.ReadLine();

if (getVersion() != serverVersion)
{
DialogResult dialogResult = MessageBox.Show("A New Update is Available \nDo You Want to Download it now ?", "Auto Update Panel", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
if (dialogResult == DialogResult.Yes)
{
WebClient client = new WebClient();
byte[] appdata = client.DownloadData(URL + appNAME);

if (saveFileDialog1.ShowDialog() == DialogResult.OK)
{
using (FileStream fs = File.Create(saveFileDialog1.FileName))
{
fs.Write(appdata, 0, appdata.Length);
}
MessageBox.Show("Download Location " + saveFileDialog1.FileName + " Enjoy The New Features !!", "Auto Update Pannel", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
else if (dialogResult == DialogResult.No)
{
// do nothing
}
}
else
{
// do nothing
}
}




Ensuite cree un fichier Txt ou vous metre 1.0.0.0 (quand vous le modifirai par 1.0.0.1 sa uploadera la new MAJ
Ensuite crée un RAR avec votre tool

Et les metre les deux sur votre serveur FTP
 
Presque le même code sur Java
 
namespace WindowsFormsApplication2
{
public partial class Form1 : XtraForm
{
private readonly string Version = "1.0.0.0";




public void checkForUpdate()
{
string URL = " Votre Site ou ya votre serveur FTP ";
string appNAME = "tool.rar";
string serverVersion;
string serverVersionName = "ToolVersion.txt";

WebRequest req = WebRequest.Create(URL + serverVersionName);
WebResponse res = req.GetResponse();
Stream str = res.GetResponseStream();
StreamReader tr = new StreamReader(str);
serverVersion = tr.ReadLine();

if (getVersion() != serverVersion)
{
DialogResult dialogResult = MessageBox.Show("A New Update is Available \nDo You Want to Download it now ?", "Auto Update Panel", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
if (dialogResult == DialogResult.Yes)
{
WebClient client = new WebClient();
byte[] appdata = client.DownloadData(URL + appNAME);

if (saveFileDialog1.ShowDialog() == DialogResult.OK)
{
using (FileStream fs = File.Create(saveFileDialog1.FileName))
{
fs.Write(appdata, 0, appdata.Length);
}
MessageBox.Show("Download Location " + saveFileDialog1.FileName + " Enjoy The New Features !!", "Auto Update Pannel", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
else if (dialogResult == DialogResult.No)
{
// do nothing
}
}
else
{
// do nothing
}
}




Ensuite cree un fichier Txt ou vous metre 1.0.0.0 (quand vous le modifirai par 1.0.0.1 sa uploadera la new MAJ
Ensuite crée un RAR avec votre tool

Et les metre les deux sur votre serveur FTP
Le bon codage :ok:
 
Salut, je pense que j'ai mieux je pose car j'ai la source sur mon pc xD

la form de votre tool, prog, virus ect....

Code:
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 System.Net;
using System.Diagnostics;
namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {

            string ver = Application.ProductVersion.ToString();
                WebClient Client = new WebClient();
                string vers = Client.DownloadString("lien/maj.html");
       
            if (ver != vers) {

                    DialogResult result = MessageBox.Show("Une mise à  jours est disponible", "Mise à jours", MessageBoxButtons.YesNo);
                    if (result == DialogResult.Yes)
                    {
                        Client.DownloadProgressChanged += tele_ProgressChanged;
                        Client.DownloadFileCompleted += tele_DownloadCompleted;
                        Client.DownloadFileAsync(new Uri("Adresse du update à télécharger"), "Nom du update à télécharger.exe");
                    }
                    else if (result == DialogResult.No)
                    {
                        MessageBox.Show("Certaine fonction du logiciel risque d'être plus fonctionnel");
                    }

            }
        }
        private void tele_ProgressChanged(object sender, DownloadProgressChangedEventArgs e)
{
    double bytesIn = double.Parse(e.BytesReceived.ToString());
    double totalBytes = double.Parse(e.TotalBytesToReceive.ToString());
    double percentage = bytesIn / totalBytes * 100;
    progressBar1.Value = Int32.Parse(Math.Truncate(percentage).ToString());
}

        private void tele_DownloadCompleted(object sender, System.ComponentModel.AsyncCompletedEventArgs e)
{
    Process.Start("nom du update.exe");
    this.Close();
   
}

    }
}

dans un nouveau projet pour faire l'update

Code:
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 System.Net;
using System.Diagnostics;
namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            WebClient Client = new WebClient();
            Client.DownloadProgressChanged += tele_ProgressChanged;

            Client.DownloadFileCompleted += tele_DownloadCompleted;

            Client.DownloadFileAsync(new Uri("Adresse du logiciel à télécharger"), "Nom du logiciel à télécharger.exe");

       
        }
        private void tele_ProgressChanged(object sender, DownloadProgressChangedEventArgs e)
{
    double bytesIn = double.Parse(e.BytesReceived.ToString());
    double totalBytes = double.Parse(e.TotalBytesToReceive.ToString());
    double percentage = bytesIn / totalBytes * 100;
    progressBar1.Value = Int32.Parse(Math.Truncate(percentage).ToString());
}

        private void tele_DownloadCompleted(object sender, System.ComponentModel.AsyncCompletedEventArgs e)
{
    Process.Start("nom du logiciel.exe");
    this.Close();
   
}

    }
}
 
Bon tuto, je te remercie! :)
 
SHARP update est plus jolie coté mise a jour !!
 
Merci
 
Il y existe un tuto sur youtube , pour faire la meme chose sans rien uploader ni rien , que avec les option de visual stuio ou basic ;)
 
Helloo

Je vous présente mon tuto en vidéo car il est long et sa sera peut être plus simple a comprendre.

Je vous laisse a vidéo et bonne chance ;)

Vous devez être inscrit pour voir les médias

Tchiaoooo
La vidéo est morte !
 
Helloo

Je vous présente mon tuto en vidéo car il est long et sa sera peut être plus simple a comprendre.

Je vous laisse a vidéo et bonne chance ;)

Vous devez être inscrit pour voir les médias

Tchiaoooo

Vidéo morte.
 
Merci pour le partage il faut une base de donées séparer du site ou utilisé la même
 
Statut
N'est pas ouverte pour d'autres réponses.
Retour
Haut