Yi Meng tcp file transfer and Automatic Update system introduction (TCP File Transfer) (ii)

Source: Internet
Author: User

Yi Meng tcp file upload download and Automatic Update system introduction (TCP File Transfer)

The system is based on the open source Networkcomms communication framework, which was previously charged, is now free and Kaiyuan, the author is the United Kingdom, the development time of more than 5 years, the framework is very stable.

Project Address: https://item.taobao.com/item.htm?spm=686.1000925.0.0.AjdBGP&id=537538462790

Consulting qq:286275658

Demo Program: HTTP://PAN.BAIDU.COM/S/1GEVFMCR

The principle of automatic upgrade:

(1) After the client is logged in, determine the version number in the local configuration file and the server version number, if it is smaller than the server version number, close this program, start the upgrade program

Start the upgrade program private void Appupdate () {
Contact Server Request Server version number Upgradeconfig UPGRADECONIFG = appoutter.tcpconn.sendreceiveobject<string, UPGRADECONFIG&G t; ("Getupmsg", "resupmsg", "the", "Test");
If the server has a large version number, start the upgrade program if (Upgradeconifg.appversion > Getmenuversion ()) {
Get the name of the upgrade program from the configuration file, start the program string upgradeapppath = system.configuration.configurationmanager.appsettings["UPGR Adeapp "]; String callBack = AppDomain.CurrentDomain.BaseDirectory + Upgradeapppath; if (file.exists (CallBack)) {if (Properties.Settings.Default.IpAddress = = System.configu Ration. configurationmanager.appsettings["IPAddress"]) {System.Diagnostics.Process proc ESS = System.Diagnostics.Process.Start (callBack); } else {System.Diagnostics.Process Process = System.diagnost Ics. Process.Start (CallBack, "s"); }} else {MessageBox.Show ("target program does not exist" + callBack); } System.Environment.Exit (0); } }

Configuration file for the upgrade program:

Exeappname is the main program name that is configured to restart the main program after the upgrade is completed and after you close itself.

Part of the code:

private void Startupdate ()
{
Set get file information class priority Pugau
Upgradeconfig UPGRADECONIFG = connection. Sendreceiveobject<string, upgradeconfig> ("Getupmsg", "resupmsg", "the", "Test", Customoptions, customoptions);

if (upgradeconifg.appversion > 0)
{
Listbox1.datasource = upgradeconifg.filelist;

TextBox1.Text = UpgradeConifg.AppVersion.ToString ();

The number of files that need to be downloaded
Upfilescount = UpgradeConifg.FileList.Count;

Send Message request download upgrade file

string filePath = AppDomain.CurrentDomain.BaseDirectory;

Sends the local file's storage path to the server side (which is then brought back by the server-side Sendinfo)
Connection. Sendobject<string> ("Getupfile", FilePath, customoptions);
}
Else
{
MessageBox.Show ("No upgrade required");
}
}


   private void Startupdate ()        {            //Set Get File information class  priority            upgradeconfig UPGRADECONIFG = connection. Sendreceiveobject<string, upgradeconfig> ("Getupmsg", "resupmsg", "the", "Test", Customoptions, customoptions);            if (upgradeconifg.appversion > 0)            {                listbox1.datasource = upgradeconifg.filelist;                TextBox1.Text = UpgradeConifg.AppVersion.ToString ();                The number of files that need to be downloaded                 upfilescount = upgradeConifg.FileList.Count;                Send Message request download upgrade file                string filePath = AppDomain.CurrentDomain.BaseDirectory;                The storage path of the local file is sent to the server side (and then brought back by the server-side sendinfo)                 connection. Sendobject<string> ("Getupfile", FilePath, customoptions);            }            else            {                MessageBox.Show ("No upgrade required");            }        }

After getting the list of files for this upgrade from the server, download the files from the server to local.

After the upgrade is complete, close the program, start the main program, complete the upgrade.

Yi Meng tcp file transfer and Automatic Update system introduction (TCP File Transfer) (ii)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.