ArcEmu: Launcher With A Perk - ArcEmu

Jump to content

Toggle shoutbox Lastest Announcements

dfighter  : (07 December 2014 - 12:06 PM) Arcemu is in hibernation mode, please read http://arcemu.org/fo...showtopic=26903
dfighter  : (01 January 2013 - 05:56 PM) Arcemu wishes you all a happy new year!
Hasbro  : (12 September 2012 - 10:01 AM) Please excuse our outage from the web! Our web host had a major malfunction!
dfighter  : (01 September 2012 - 04:05 PM) Since the spam bots just don't want to stop, I've enabled admin verification when registering.
dfighter  : (23 January 2012 - 09:56 PM) Please note that from now on you will need to confirm your email on the wiki in order to edit it!
Hasbro  : (31 December 2011 - 12:50 PM) Happy New Years all!
Navid  : (26 December 2011 - 04:09 AM) Merry Christmas !!!!!! Happy holidays all :)
WAmadeus  : (24 December 2011 - 03:54 PM) Merry Christmas to all!
dfighter  : (24 December 2011 - 11:05 AM) The Arcemu team wishes y'all a Merry Christmukkah!
Hasbro  : (05 October 2011 - 12:53 PM) Looking for web designers for upcoming web related project. If you're interested in designing user interfaces contact me
dfighter  : (02 September 2011 - 03:47 PM) So who here wants vehicles in Arcemu? :P http://arcemu.org/fo...showtopic=25440
Hasbro  : (14 August 2011 - 03:25 PM) Join us on irc, grab an irc client and connect to irc.freenode.net join channel #arcemu /server irc.freenode.net:6667 /join #arcemu
jackpoz  : (03 August 2011 - 05:33 AM) to all Lua Engine (old one) users: please check http://arcemu.org/fo...showtopic=25274
Hasbro  : (20 May 2011 - 05:27 PM) Looking for people experienced with CMake configuration and setup! Contact me asap
Hasbro  : (15 May 2011 - 05:03 PM) ArcEmu is recruiting C++ programmers, contact Hasbro if interested.
paroxysm  : (03 May 2011 - 06:26 PM) Updated luabridge gossip example to describe the whole gossip creation process rather than just how to create menu. Gossip tutorial
paroxysm  : (23 April 2011 - 11:35 AM) Lua writers can refer to the Luabridge Tutorials section in the Wiki to learn how to write gossip code correctly.
Hasbro  : (20 April 2011 - 05:22 PM) Thank you for your continuous contribution of bug reports, we are working on them.
Hasbro  : (17 April 2011 - 03:20 AM) Please consider donating to support our bills. Donations can be sent using PayPal to donations@arcemu.org - Thank you for your support.
paroxysm  : (10 April 2011 - 12:43 AM) Refer to the Luabridge Tutorials section in the Wiki to learn the new syntax of luabridge.
Resize Shouts Area

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Launcher With A Perk

#1 User is offline   HalestormXV 

  • The Ultimatum
  • PipPipPipPipPipPip
  • Group: Members
  • Posts: 1,031
  • Joined: 07-June 08
  • Gender:Male

Posted 12 March 2010 - 11:55 PM

So, how difficult would it be to create a launcher that checks the data directory of the user to see if the most recent version of a custom patch which is stored on a separate website is in the folder and if it isn't give them the option to download it?
**Owner of the Serenade of Sorrow Funserver**
My Most Recent Video: The Book of Kidou
Posted Image
0

#2 User is offline   iEzri 

  • < Ace of spades >
  • Group: Contributor
  • Posts: 1,692
  • Joined: 22-December 08
  • Gender:Female
  • Interests:I'm likely to cause mischief
  • Server OS:Linux

Posted 13 March 2010 - 10:29 AM

View PostHalestormXV, on 12 March 2010 - 11:55 PM, said:

which is stored on a separate website is in the folder


Ok now that would be quite impossible. But if you want the user to download a file from a website if he hasnt already done so i bet there are many easy functions to acomplish what you seem to be trying with VBscript.

FileStream, FileMode.Create, FileAccess.Write, StreamWriter, WriteLine

afaik most people tend to vbscript for launchers as it actually is very very simple to do...
Posted Image I do not join. I lead.
1

#3 User is offline   Darkgroom 

  • Interested
  • Group: Banned
  • Posts: 440
  • Joined: 05-February 09
  • Gender:Male
  • Location:im coming from planet wizzzzz.
  • Interests:VB.net, PHP, C++, C#, girls

Posted 13 March 2010 - 10:50 AM

Yup, you can do this with VB

#4 User is offline   Hopla 

  • The branchmaster
  • Group: Retired
  • Posts: 947
  • Joined: 13-June 08
  • Gender:Male

Posted 13 March 2010 - 11:23 AM

Assuming you'd be making it only Windows compatible you could use an API called URLDownloadToFile.
0

#5 User is offline   HalestormXV 

  • The Ultimatum
  • PipPipPipPipPipPip
  • Group: Members
  • Posts: 1,031
  • Joined: 07-June 08
  • Gender:Male

Posted 13 March 2010 - 04:36 PM

Thanks for all the responces. And yeah I was thinking this could be done in VB, I was looking more at C# though. See the goal is to see if a file is in the data folder, if it isn't then it is downloaded into the folder, with the user's approval of course. Another thing is that the launcher would check a date of the patch in the data folder and compare it with the date from its folder that it was pulled from and then redownload the new one.

Basically it would allow patches that are updated on the website be auto updated to the client so that you do not have to tell the user your patch is outdated download the new one. Similar to what bl!zz does.

And thank you hoopla for the link.


I could have sworn I saw something like this somewhere but since we cleaned out the old posts i can't seem to find it.
**Owner of the Serenade of Sorrow Funserver**
My Most Recent Video: The Book of Kidou
Posted Image
0

#6 User is offline   Tamrael 

  • Newbie
  • Group: Members
  • Posts: 7
  • Joined: 19-July 08

Posted 17 March 2010 - 12:41 PM

View PostHalestormXV, on 13 March 2010 - 04:36 PM, said:

Another thing is that the launcher would check a date of the patch in the data folder and compare it with the date from its folder that it was pulled from and then redownload the new one.

Basically it would allow patches that are updated on the website be auto updated to the client so that you do not have to tell the user your patch is outdated download the new one. Similar to what bl!zz does.


put a text-file on the webserver and download that first.in it you store the date of newest patch.rest is simple(and so is this solution) but it works fine (don't forget to first check on network an so on ^^ )

and since vb2008 has such api included you won't need URLDownloadToFile.

search in namespace My.Computer.Network there is everything one need to do such things :P
0

#7 User is offline   alleycat 

  • Helps so much & is so mature & gay
  • PipPipPipPipPip
  • Group: Members
  • Posts: 835
  • Joined: 25-July 08
  • Gender:Male

Posted 18 March 2010 - 11:14 AM

You could do this in C# using System.Net, and the best way to work out a custom patch would be to have a text file with the current version of the patch in it, and that same txt file on the website you are downloading from, and have the launcher download and compare the two txts and if different, download the patch and replace the old one with the new one.
I can haz cookie?
0

#8 User is offline   HalestormXV 

  • The Ultimatum
  • PipPipPipPipPipPip
  • Group: Members
  • Posts: 1,031
  • Joined: 07-June 08
  • Gender:Male

Posted 21 March 2010 - 01:05 PM

So is anyone up to attempting this? I can try but will fail (but can still try), anyone else want to give it a shot? Since many seem eager to know that this will work.
**Owner of the Serenade of Sorrow Funserver**
My Most Recent Video: The Book of Kidou
Posted Image
0

#9 User is offline   Hopla 

  • The branchmaster
  • Group: Retired
  • Posts: 947
  • Joined: 13-June 08
  • Gender:Male

Posted 21 March 2010 - 02:31 PM

Why don't you generate an MD5 hash for both server and client file and compare them, if they're not identical overwrite the patch with the newly downloaded one.
0

#10 User is offline   HalestormXV 

  • The Ultimatum
  • PipPipPipPipPipPip
  • Group: Members
  • Posts: 1,031
  • Joined: 07-June 08
  • Gender:Male

Posted 21 March 2010 - 04:48 PM

View PostHopla, on 21 March 2010 - 02:31 PM, said:

Why don't you generate an MD5 hash for both server and client file and compare them, if they're not identical overwrite the patch with the newly downloaded one.


Do that via a text file? and generate it for a string? Then have the script read the text file in the directory and the text file in the webserver directory?
**Owner of the Serenade of Sorrow Funserver**
My Most Recent Video: The Book of Kidou
Posted Image
0

#11 User is offline   Hopla 

  • The branchmaster
  • Group: Retired
  • Posts: 947
  • Joined: 13-June 08
  • Gender:Male

Posted 22 March 2010 - 04:18 PM

Just like this:
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.Security.Cryptography;
using System.Net;
using Microsoft.Win32;

namespace Downloader
{
    public partial class PatchDownloader : Form
    {
        public PatchDownloader()
        {
            InitializeComponent();
        }

        private void Button_BrowseClient_Click(object sender, EventArgs e)
        {
            DialogResult result = openFileDialog.ShowDialog();
            if( result == DialogResult.OK )
            {
                Textbox_ClientFile.Text = openFileDialog.FileName;
            }
        }

        private void Button_CalculateMD5_Click(object sender, EventArgs e)
        {
            Textbox_Time.Clear();
            Textbox_LastHash.Text = Textbox_ClientHash.Text;
            String ClientFile = Textbox_ClientFile.Text;
            if( ClientFile.Length == 0 )
            {
                Textbox_ClientFile.Text = "Invalid or no file provided to hash.";
                return;
            }

            DateTime Start = DateTime.Now;

            String ClientHash = GenerateMD5FromFile(ClientFile);
            if( ClientHash.Length == 0 )
            {
                Textbox_ClientHash.Text = "Invalid or no file selected (INVALID HASH).";
                return;
            }
            Textbox_ClientHash.Text = ClientHash;

            WebClient web = new WebClient();
            StringBuilder WebHash = new StringBuilder();
            try
            {
                String URLFile = Textbox_URLFile.Text;
                String URLHash = Textbox_URLHash.Text;

                byte[] bytesHash = web.DownloadData(URLHash);
                foreach(char hChar in bytesHash)
                {
                    WebHash.Append(String.Format("{0}", hChar));
                }

                Textbox_LastHash.Text = WebHash.ToString();
                if (ClientHash.Equals(WebHash.ToString()))
                {
                    HashCompare.BackColor = Color.Green;
                    HashCompare.Text = "Hash Matches (file up to date).";
                }
                else
                {
                    HashCompare.BackColor = Color.Red;
                    HashCompare.Text = "Hash Mismatches (file out to date).";

                    // Query the path of WoW in the registry
                    RegistryKey RegKey = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Blizzard Entertainment\\World of Warcraft");
                    if( RegKey == null )
                    {
                        MessageBox.Show("WoW is not installed or registry key is missing.");
                        return;
                    }

                    String WoWPath  = RegKey.GetValue("InstallPath").ToString();    // Path to WoW
                    String DataPath = WoWPath + "/data/";                           // Path to WoW + /data/
                    String SubDir   = Directory.GetDirectories(DataPath).First();   // Path to WoW + /data/ + enGB/enUS/...
                    String BaseFile = URLFile.Split('/').Last();                    // Filename + extension of server file
                    String FullPath = SubDir + "/" + BaseFile;                      // Full path of client destination patch file

                    // Hook DownloadFileCompleted event to notice if the download is complete and notify the user
                    web.DownloadFile(URLFile, FullPath);
                }
            }
            catch (System.Exception err)
            {
                MessageBox.Show(err.Message);
            }

            TimeSpan Diff = DateTime.Now - Start;
            Textbox_Time.Text = String.Format("Elapsed time: {0}ms.", Diff.TotalMilliseconds);
        }

        private static string GenerateMD5FromFile(string FileName)
        {
            if (File.Exists(FileName) == false)
                return "";

            FileStream Stream = new FileStream(FileName, FileMode.Open, FileAccess.Read);
            MD5CryptoServiceProvider MD5 = new MD5CryptoServiceProvider();
            MD5.ComputeHash(Stream);

            byte[] Hash = MD5.Hash;
            StringBuilder Buf = new StringBuilder();
            foreach(byte _Byte in Hash)
            {
                Buf.Append(String.Format("{0:X1}", _Byte));
            }
            Stream.Close();
            return Buf.ToString();
        }
    }
}


This method will hash the whole file so it gives you an accurate result of the content inside the file.
Since this is CPU intensive work I'd advice you to pre-hash the server file and add it to a public file on your server (like: http://www.MyServer....latest-hash.txt) and check the hash with the client generated one in a seperated worker thread (so the main thread doesn't lock up your program).
Rest is self-explanatory, if the hash doesn't match you overwrite the file with a file you download from the master server.

Note to people thinking about copy pasting this:
The code contains places where arguments are not verified or there's room for improvement, it's just a quick and dirty start if anyone is ever planning on doing a project similiar to this one.
0

#12 User is offline   Wil 

  • Advanced Member
  • Group: Super Moderator
  • Posts: 224
  • Joined: 31-January 09
  • Gender:Male
  • Server OS:Windows

Posted 14 September 2010 - 05:13 PM

The launcher that I made that is pinned in the forums now has a feature for downloading addons. I might be able to make it download patch files as well, Right now it just updates Arc GM and Feedback tools.

If you could give me a little more information maybe even a file to try I could play around with it and see what I can do..... Let me know :)
Nothing
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users