LCKB
[C#] a own Launcher in Work. - Printable Version

+- LCKB (https://lckb.dev/forum)
+-- Forum: ** OLD LCKB DATABASE ** (https://lckb.dev/forum/forumdisplay.php?fid=109)
+--- Forum: Programmers Gateway (https://lckb.dev/forum/forumdisplay.php?fid=196)
+---- Forum: Coders Talk (https://lckb.dev/forum/forumdisplay.php?fid=192)
+---- Thread: [C#] a own Launcher in Work. (/showthread.php?tid=770)

Pages: 1 2


- HateMe - 04-22-2012


you should use DownloadFileAsync else if the file is bigger u will have proplems

 

for exampel

 

void update()
{
WebClient Client = new WebClient();
Client.DownloadProgressChanged += new DownloadProgressChangedEventHandler(Client_DownloadProgressChanged);
Client.DownloadFileCompleted += new AsyncCompletedEventHandler(Client_DownloadFileCompleted);

// starting the download
Client.DownloadFileAsync(new Uri("http:/myadress/myfile.exe"), "myfile.exe");
}

// getting called if any change is there
void Client_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
{
progressBar1.Maximum = (int)e.TotalBytesToReceive;
progressBar1.Value = (int)e.BytesReceived;

// u also can make a label where the percent get showed
int percent = (int)(((double)progressBar1.Value / (double)progressBar1.Maximum) * 100);
Label1.text = percent.ToString() + " %";
}

// getting called when its done
void Client_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
{
MessageBox.Show("Download done!");
}

 

and also in ur "Launcher" it download only the ".lod" file but the laucnehr download an ".zip" file what he extract and u also have always the same adress means he always download the same




- Nikolee - 04-22-2012


"And how i can set that it dont update everytime then i start the launcher?^^"

 

^for this i got an little solution, i made an version.txt and and read it out with File.Read..

then i set if read 1 do the update.^^

 

how i can count now for every update?^^

 

And how i include the thing with htdocs?

I thought i can name the files 1,2 ect. and it read it out?^^




- HateMe - 04-22-2012


another thing is if u download the file it will just go where the ur "Launcher" is not where it supposed to be for example Data/

 

the orginal launcher is working like this:

 

Starting

reading the vtm.brn to get the version ( "1540" )

reading the lccnct.dta to get the internet adress ( "http://64.15.152.87/lc_update/" )

then he connect to this internet adress from the lccnct.dta + /ip.txt ( "http://64.15.152.87/lc_update/ip.txt" )

there u see this

1
http://lastchaos.patch.aeriagames.com/lc_patch/

 

there he get this adress "http://lastchaos.patch.aeriagames.com/lc_patch/"

 

then he connect to this adress + /version.txt ( "http://lastchaos.patch.aeriagames.com/lc_patch/version.txt" )

there u see this

1568

this number is the maximum version that is there

 

also we remeber the version of the vtm.brn 1540

now 1568 - 1540 = 28 also 28 updates are there

 

now he donwload the .zip files from the url ( "http://lastchaos.patch.aeriagames.com/lc_patch/1541.uip" )

when done downloading the file he extract it

and save the vtm.brn new with 1541

 

this he do tillits 1568

 

alright the code for it u need to make self then u lrean it bether Smile




- Nikolee - 04-22-2012


Now the Programm Reads out an Version.txt if the number is as example 1 its download that what he must. (It also work for the other numbers)

 

But how can i set that it count always +1 for everyone update?

Because i set it with

If(Read=1)

downlaod bla bla bla..^^

 

2

 

//Edit : And i need to know which command let me count?

So if an Update happens the Version.txt count +1 and from the URL the last number count +1

it also can return as example after 30 to 1^^




- someone - 04-23-2012


Just put a simple for to count:

-Pseudocode
----------------------------
get the version from file
get the version from server
FOR current_version = file_version to server_version
download patch
apply patch
IF error THEN
print a message
break loop
ENDIF
save current version to file
ENDFOR
update done

I suggest learning C# from the beginning, because I see you dont even know the basics(expressions, loops, etc).




- Nikolee - 04-23-2012


Just put a simple for to count:

-Pseudocode
----------------------------
get the version from file
get the version from server
FOR current_version = file_version to server_version
download patch
apply patch
IF error THEN
print a message
break loop
ENDIF
save current version to file
ENDFOR
update done

I suggest learning C# from the beginning, because I see you dont even know the basics(expressions, loops, etc).

 

i dont learned anything i still started with this




- HateMe - 04-23-2012


@Nikola someone is right befor u start making somehting like this "launcher" you should learn first the basics there are alot of toturials on the internet Smile for example this one 2

you also can find exampels on youtube




- Nikolee - 04-23-2012


I Learn atm too, i learn with this site 2 ^^

I stopped writing the Launcher and learn to update it ^^

 

Ty for your Help Wink