Skip to content
MPGHThe Dark Arts
/
RegisterLog in
Forum
Community
What's NewLatest posts across the boardTrendingHottest threads right nowSubscribedThreads you follow
Discussion
GeneralIntroductionsEntertainmentDebate FortFlaming & Rage
Board
News & AnnouncementsMPGH TimesSuggestions & HelpGiveaways
More Sections
Art & Graphic DesignProgrammingHackingCryptocurrency
Hacks & Cheats
Games
ValorantCS2 / CS:GOCall of Duty / WarzoneFortniteApex LegendsEscape From Tarkov
+14 moreLeague of LegendsGTA VMinecraftRustROTMGBattlefieldTroveBattleOnCombat ArmsCrossFireBlackshotRuneScapeDayZDead by Daylight
Resources
Game Hacking TutorialsReverse EngineeringGeneral Game HackingAnti-CheatConsole Game Hacking
Tools
Game Hacking ToolsTrainers & CheatsHack/Release NewsNew
Submit a release →Share your cheat, tool, or config with the community.
AINEW
AI Tools
General & DiscussionPrompt EngineeringLLM JailbreaksHotAI Agents & AutomationLocal / Open Models
AI × Gaming
AI Aimbots & VisionML Anti-CheatGame Bots & Automation
Create
AI Coding / Vibe CodingAI Art & MediaAI Voice & TTS
The AI frontier →Where game hacking meets modern machine learning. Jump in.
Marketplace
Buy & Sell
SellingBuyingTradingUser Services
Trust & Safety
Middleman LoungeMarketplace TalkVouch Copy Profiles
Money
Cryptocurrency TalkCurrency ExchangeWork & Job Offers
Start selling →List accounts, services, and goods. Use the middleman to trade safe.
MPGH The Dark Arts

A community for offensive security research, reverse engineering, and AI.

Community

ForumMarketplaceSearch

Account

RegisterLog in

Legal

Privacy PolicyForum RulesHelp & FAQ
© 2026 MPGH · All rights reserved.Built by the community, for the community. For educational purposes onlyContent is shared for security research and education — we don't condone illegal use. You're responsible for complying with applicable laws. Use at your own risk.
Home › Forum › Programming › Game Development › Developing an Updater for your software

Developing an Updater for your software

Posts 1–9 of 9 · Page 1 of 1
radnomguywfq3
radnomguywfq3
Developing an Updater for your software
I wrote an updater for JevaEngine but apparently it's not considered to be allowed or w\e. Idk, anyway, you'll learn:
  • Developing a basic HTTP Client and...
  • Interfacing with a vBulletin Forum
  • Parsing cirtical data with a RegEx engine(it's built into .Net)
  • Using the XDocument to parse XML documents and select specific content from such documents.
  • Extracting and building Zip archives
  • Constructing hash tables for the purpose of hashing your filesystem and assuring that it does not require any updates.
  • Some basic OOP methods.
K SO FML Because this is going to be a long one.

Here we go:

Overview
The objective this tutorial has here-on assigned to you is to develop an application which updates local content by communicating with a remote v-Bulletin forum. As you know, attachments cannot be downloaded anonymously and thus you're module which interfaces with the vBulletin forum will have to handle sessionHash cookies, and other less critical elements while browsing content. That means you will also have to handle a front-end login system. News related data which contains informations regarding the actual content of the news along with it's author and meta-data which describes the attachments bound to that post. Using this meta-data you will select two files used for the update, the first being a zip-archives which physically has all the files that are to be updated and the second is a hash-table which contains a hash of all the files in that archive.

You will take that hash-table and compare it to one which will be locally generated; if they differ then your application will conclude that an update is indeed required and you will resume to download the secondary update file, the zip archive which contains the files relating to that update.


You can download the example I wrote and ask me on MSN if you need any help understanding it. But you'd be better of just asking here

VBulletinSession.cs
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Net;

namespace JevaEngineUpdater
{
    public enum UserStatus
    {
        SignedIn,
        SignedOut,
    }

    public class VBulletinSession : HttpClient
    {

        private const String VB_LOGINPAGE = "login.php?do=login";
        private const String VB_RSS2PAGE = "external.php";

        private Dictionary<String, String> m_cookies;

        //WHEN YOU CONSTRUCT THIS: THE DOMAIN INCLUDES /forum/
        public VBulletinSession(String sWorkingDomain) :
            base(sWorkingDomain)
        {
            m_cookies = new Dictionary<string, string>();
        }

        protected override void initilizeHeaders()
        {
            Headers.Clear();

            Headers.Add("Content-Type", "application/x-www-form-urlencoded");

            if (m_cookies.Count > 0)
            {
                String sCookiesBuffer = String.Empty;

                List<String> cookieBuffer = new List<String>();

                foreach (KeyValuePair<String, String> key in m_cookies)
                {
                    if(key.Value.Length > 0)
                        cookieBuffer.Add(String.Format("{0}={1}", key.Key, key.Value));
                }

                String s = String.Join("; ", cookieBuffer.ToArray());
                Headers.Add("Cookie", String.Join(" ;", cookieBuffer.ToArray()));
            }
        }

        public bool querySignIn(String sUsername, String sPassword)
        {
            m_cookies.Clear(); //Clear cookies for login.

            VariableData[] vd = new VariableData[] {
                new VariableData("vb_login_username", sUsername),
                new VariableData("vb_login_password", sPassword),
                new VariableData("s", ""),
                new VariableData("securitytoken", "guest"),
                new VariableData("do", "login"),
                new VariableData("vb_login_md5password", Hash.hashData(sPassword, Encoding.ASCII).ToLower()),
                new VariableData("vb_login_md5password_utf", Hash.hashData(sPassword, Encoding.UTF8).ToLower()),

            };

            String sVars = encodeVars(vd);

            String s = System.Text.Encoding.ASCII.GetString(*******ata(VB_LOGINPAGE, DataMethod.POST, encodeVars(vd)));

            foreach (String sHead in ResponseHeaders)
            {
                String[] sValue = ResponseHeaders.GetValues(sHead);

                switch (sHead.ToLower())
                {
                    case "set-cookie":
                        {
                            foreach (String sCookie in sValue)
                            {
                                String sEntry = sCookie.Substring(0, sCookie.IndexOf(';'));
                                String sCookieValue = String.Empty;
                                String sCookieName = sEntry;

                                if (sEntry.IndexOf('=') >= 0)
                                {
                                    sCookieName = sEntry.Substring(0, sEntry.IndexOf("="));
                                    sCookieValue = sEntry.Substring(sEntry.IndexOf("=") + 1);
                                }

                                if (!m_cookies.ContainsKey(sCookieName))
                                    m_cookies.Add(sCookieName, sCookieValue);
                            }
                        }
                        break;
                }
            }

            if (s.ToLower().IndexOf(String.Format("Thank you for logging in, {0}.", sUsername)) > 0)
                return true;
            else if (Regex.IsMatch(s, @"(?:Welcome|Thank[ ]you[ ]for[ ]logging[ ]in),[ ]Jetamay", RegexOptions.IgnoreCase))
                return true;
            else if (Regex.IsMatch(s, @"Welcome,[ ]<a.*>Jetamay</a>"))
                return true;

            return false;
        }

        public JRSSParser getRssParser(int iForumId)
        {
            JRSSParser parser = new JRSSParser();
            parser.parseRss(String.Format("{0}?forumids={1}", resolveToAbsolute(VB_RSS2PAGE).AbsoluteUri, iForumId));

            return parser;
        }

        public byte[] downloadAttachment(JRSSAttachment attachment)
        {
            return downloadData(attachment.RelativeUri);
        }
    }
}
HashTable.cs
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

using System.Text.RegularExpressions;

using System.Collections.Specialized;

namespace JevaEngineUpdater
{
    [Serializable()]

    public class HashTable
    {
        private const string REGEX_FILENAME = "FileName";
        private const string REGEX_FILEHASH = "MD5HASH";

        private Dictionary<String, String> m_hashes;

        public HashTable(String sTable)
        {
            MatchCollection mc = Regex.Matches(sTable, String.Format("\"{0}\"=\"{1}\"", @"(?<FileName>.*)", @"(?<MD5HASH>.*)"));

            foreach (Match m in mc)
            {
                Group fileName = m.Groups[REGEX_FILENAME];
                Group fileHash = m.Groups[REGEX_FILEHASH];

                if (fileName.Success == fileName.Success == true)
                {
                    m_hashes.Add(fileName.Value, fileHash.Value);
                }
                else
                    throw new Exception("Malformed statement encountered in hash-table list.");
            }
        }

        public HashTable(Dictionary<String, String> hashEntries)
        {
            m_hashes = new Dictionary<String, String>(hashEntries);
        } 
   
        public HashTable(params KeyValuePair<String, String>[] hashEntries)
        {
            m_hashes = new Dictionary<String, String>();

            foreach (KeyValuePair<String, String> keyPair in hashEntries)
            {
                m_hashes.Add(keyPair.Key, keyPair.Value);
            }
        }

        public HashTable()
        {
            m_hashes = new Dictionary<String, String>();
        }

        public void clear()
        {
            m_hashes.Clear();
        }

        public void add(String sFileName, String sHash)
        {
            m_hashes.Add(sFileName, sHash);
        }

        public void fush(Stream dest)
        {
            StreamWriter sw = new StreamWriter(dest);

            foreach (KeyValuePair<String, String> pair in this.HashEntries)
            {
                sw.WriteLine(String.Format("\"{0}\"=\"{1}\"", pair.Key, pair.Value));
            }

            sw.Flush();
        }

        public static HashTable operator +(HashTable a, HashTable b)
        {
            HashTable htBuffer = new HashTable(a.HashEntries);

            foreach (KeyValuePair<String, String> keyPair in b.HashEntries)
            {
                htBuffer.add(keyPair.Key, keyPair.Value);
            }

            return htBuffer;
        }

        public Dictionary<String, String> HashEntries
        {
            get
            {
                return m_hashes;
            }
        }
    }
}
Hash.cs
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

using System.Security.Cryptography;

using Ionic.Zip;

namespace JevaEngineUpdater
{
    public static class Hash
    {
        public static string hashData(Stream inStream)
        {
            MD5 md5Hash = new MD5CryptoServiceProvider();
            StringBuilder sb = new StringBuilder();

            byte[] hash = md5Hash.ComputeHash(inStream);

            foreach (byte b in hash)
            {
                sb.Append(b.ToString("X2"));
            }

            return sb.ToString();
        }

        public static string hashData(String sData, Encoding encodingType)
        {
            return hashData(new MemoryStream(encodingType.GetBytes(sData)));
        }

        public static string hashData(byte[] bData)
        {
            return hashData(new MemoryStream(bData, false));
        }

        public static HashTable hashDirectory(DirectoryInfo dirInfo)
        {
            HashTable hsWorking = new HashTable();

            foreach (FileInfo file in dirInfo.GetFiles())
            {

                if (Path.GetFullPath(file.FullName).CompareTo(Path.GetFullPath(System.Reflection.Assembly.GetExecutingAssembly().Location)) == 0)
                    continue;

                try
                {
                    FileStream fs = new FileStream(file.FullName, FileMode.Open);

                    if (!file.FullName.StartsWith(Environment.CurrentDirectory.ToLower(), StringComparison.CurrentCultureIgnoreCase))
                        throw new Exception("Absolute path of hashee must be contained within the applications working directory.");

                    hsWorking.add(file.FullName.Substring(Environment.CurrentDirectory.Length), hashData(fs));

                    fs.Close();
                }
                catch (IOException ex)
                {
                    throw new Exception("Error while attempting to compute the hash of a file: " + ex.Message);
                }
            }

            foreach (DirectoryInfo dir in dirInfo.GetDirectories())
            {
                hsWorking += hashDirectory(dir);
            }

            return hsWorking;
        }

        public static HashTable hashDirectory(String sDirectory)
        {
            return hashDirectory(new DirectoryInfo(sDirectory));
        }
    }
}
JRSSAttachment
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace JevaEngineUpdater
{
    public class JRSSAttachment
    {
        private String m_sName;
        private String m_sRelativeUri;
        
        public JRSSAttachment(String sName, String sRelativeUri)
        {
            m_sName = sName;
            m_sRelativeUri = sRelativeUri;
        }

        public String Name
        {
            get
            {
                return m_sName;
            }
        }

        public String RelativeUri
        {
            get
            {
                return m_sRelativeUri;
            }
        }
    }
}
JRSSAttachmentCollection
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace JevaEngineUpdater
{
    public class JRSSAttachmentCollection
    {
        private List<JRSSAttachment> m_attachments;

        public JRSSAttachmentCollection(params JRSSAttachment[] attachments)
        {
            m_attachments = new List<JRSSAttachment>(attachments);
        }

        public void add(JRSSAttachment attachment)
        {
            m_attachments.Add(attachment);
        }

        public void remove(JRSSAttachment attachment)
        {
            m_attachments.Remove(attachment);
        }

        public JRSSAttachment this[int iIndex]
        {
            get
            {
                if (iIndex >= m_attachments.Count)
                    return null;

                return m_attachments[iIndex];
            }
        }

        public JRSSAttachment this[String sName]
        {
            get
            {
                foreach (JRSSAttachment attachment in m_attachments)
                {
                    if (String.Compare(sName, attachment.Name, true) == 0)
                        return attachment;
                }
                return null;
            }
        }

    }
}
HttpClient.cs
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
namespace JevaEngineUpdater
{
    public enum DataMethod
    {
        POST,
        GET,
    }

    public struct VariableData
    {
        private String m_sName;
        private String m_sValue;

        public VariableData(String sName, String sValue)
        {
            m_sName = sName;
            m_sValue = sValue;
        }

        public String Name
        {
            get
            {
                return m_sName;
            }
            set
            {
                m_sName = value;
            }
        }

        public String Value
        {
            get
            {
                return m_sValue;
            }
            set
            {
                m_sValue = value;
            }
        }
    }

    public abstract class HttpClient
    {
        private Uri m_workingDomain;
        private WebClient m_workingClient;

        public HttpClient(String sWorkingDomain)
        {
            m_workingClient = new WebClient();

            m_workingDomain = new Uri(sWorkingDomain);
        }

        protected abstract void initilizeHeaders();

        protected Uri resolveToAbsolute(String sRelative)
        {
            Uri uriResolved;

            if (!Uri.TryCreate(m_workingDomain, sRelative, out uriResolved))
                throw new Exception("Error resolving relative uri to absolute uri.");

            return uriResolved;
        }

        protected static String resolveMethod(DataMethod dataMethod)
        {
            switch (dataMethod)
            {
                case DataMethod.POST:
                    return "POST";
                case DataMethod.GET:
                    return "GET";
                default:
                    throw new Exception("Unable to resolve data method to it's http representation in the header.");
            }
        }

        protected static String urlEncode(String sData)
        {
            String sEncoded = "$&+,/:;=?@ \"<>#%{}|\\~^[]`";
            StringBuilder sb = new StringBuilder();

            byte[] bOriginal = System.Text.Encoding.ASCII.GetBytes(sData);

            for (int i = 0; i < bOriginal.Length; i++)
            {
                sb.Append((sEncoded.Contains(sData[i]) ? String.Format("%{0}", bOriginal[i].ToString("X2")) : Convert.ToString(sData[i])));
            }

            return sb.ToString();
        }

        protected static String encodeVars(params VariableData[] variables)
        {

            List<String> varList = new List<String>();
            foreach (VariableData var in variables)
            {
                if (String.IsNullOrEmpty(var.Name) || String.IsNullOrEmpty(var.Name))
                    throw new Exception("Cannot encode a variable with an empty\\null name and\\or value");

                varList.Add(String.Format("{0}={1}", urlEncode(var.Name), urlEncode(var.Value)));
            }

            return String.Join("&", varList.ToArray());
        }

        public byte[] downloadData(String sRelativeUri)
        {

            initilizeHeaders();
            return m_workingClient.DownloadData(resolveToAbsolute(sRelativeUri));
        }

        public byte[] *******ata(String sRelativeUri, DataMethod method, byte[] bDataBuffer)
        {
            initilizeHeaders();
            return m_workingClient.*******ata(resolveToAbsolute(sRelativeUri), resolveMethod(method), bDataBuffer);
        }

        public byte[] *******ata(String sRelativeUri, DataMethod method, String sDataBuffer)
        {
            return *******ata(sRelativeUri, method, System.Text.Encoding.ASCII.GetBytes(sDataBuffer));
        }

        public WebHeaderCollection ResponseHeaders
        {
            get
            {
                return m_workingClient.ResponseHeaders;
            }
        }

        public WebHeaderCollection Headers
        {
            get
            {
                return m_workingClient.Headers;
            }
        }
    }
}
JRSSEntry.cs
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace JevaEngineUpdater
{
    public class JRSSEntry
    {
        private String m_sTitle;
        private String m_sContent;
        private String m_sPublisher;
        private JRSSAttachmentCollection m_attachments;

        public JRSSEntry(String sTitle, String sContent, String sPublisher, params JRSSAttachment[] attachments)
        {
            m_sTitle = sTitle;
            m_sContent = sContent;
            m_sPublisher = sPublisher;
            m_attachments = new JRSSAttachmentCollection(attachments);
        }

        public String Title
        {
            get
            {
                return m_sTitle;
            }
        }

        public String Content
        {
            get
            {
                return m_sContent;
            }
        }

        public String Publisher
        {
            get
            {
                return m_sPublisher;
            }
        }

        public JRSSAttachmentCollection Attachments
        {
            get
            {
                return m_attachments;
            }
        }
    }
}
JRSSParser.cs
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using System.Xml.Linq;

using System.Text.RegularExpressions;

namespace JevaEngineUpdater
{
    public class JRSSParser
    {
        private const String REGEX_ATTACHMENTS  = "<a[ ]href=\"" + @"http://www\.mpgh\.net/forum/(?<AttachmentExtention>.*)" + "\"" + @">(?<FileName>.*)</a>";
        private const String REGEXNAME_FILEURL  = "AttachmentExtention";
        private const String REGEXNAME_DATETIME = "";

        private const String REGEXNAME_FILENAME = "FileName";

        private List<JRSSEntry> m_entries;

        public JRSSParser()
        {
            m_entries = new List<JRSSEntry>();
        }

        public void parseRss(String sUrl)
        {
            try
            {
                XDocument workingDoc = XDocument.Load(sUrl);
                XElement workingElement = workingDoc****ot.Element("channel");

                if (workingElement == null)
                    throw new Exception("Error parsing RSS Entry, assure queries results is of valid xml form and format.");
                
                m_entries.Clear();

                var entryBuffer = from entry in workingElement.Descendants("item")
                                  select new
                                  {
                                      Title = entry.Element("title").Value,
                                      Date = entry.Element("pubDate").Value,
                                      Publisher = entry.Element(((XNamespace)"http://purl.org/dc/elements/1.1/") + "creator").Value,
                                      Content = entry.Element(((XNamespace)"http://purl.org/rss/1.0/modules/content/") + "encoded").Value,
                                  };

                foreach (var entry in entryBuffer)
                {

                    MatchCollection mc = Regex.Matches(entry.Content, REGEX_ATTACHMENTS);
                    List<JRSSAttachment> m_attachmentBuffer = new List<JRSSAttachment>();

                    foreach (Match m in mc)
                    {
                        Group attch = m.Groups[REGEXNAME_FILEURL];
                        Group name = m.Groups[REGEXNAME_FILENAME];
                      
                        foreach (Group g in m.Groups)
                            System.Console.WriteLine(g.Value);

                        if (attch.Success == name.Success == true)
                            m_attachmentBuffer.Add(new JRSSAttachment(name.Value, attch.Value));
                        else
                            throw new Exception("The RSS response is of an unexpected format. Namely, attachments seems to be illustrated in an unexpected or malformed fassion.");
                    }

                    m_entries.Insert(m_entries.Count, new JRSSEntry(entry.Title, entry.Content, entry.Publisher, m_attachmentBuffer.ToArray()));
                    
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Error while loading rss: " + ex.Message);
            }
        }

        public JRSSEntry[] Entries
        {
            get
            {
                return m_entries.ToArray();
            }
        }
    }
}
Login.cs
Code:
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;

namespace JevaEngineUpdater
{
    public partial class Login : Form
    {
        public Login()
        {
            InitializeComponent();
        }

        public String Username
        {
            get
            {
                return txtUsername.Text;
            }
        }

        public String Password
        {
            get
            {
                return txtPassword.Text;
            }
        }

        private void btnLogin_Click(object sender, EventArgs e)
        {
            Hide();
        }
    }
}
update.cs
Code:
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 Ionic.Zip;

using System.Collections.Specialized;

using System.IO;

namespace JevaEngineUpdater
{
    public partial class Update : Form
    {
        private delegate void NewUpdate_dlg();
        private delegate void SetStatus_dlg(String sStatus);

        private const String ATTACHMENT_HASHTABLE = "hashtable.txt";
        private const String ATTACHMENT_ARCHIVE = "update.zip";

        private bool m_stopRss = false;
        private JRSSParser m_rssParser;

        private VBulletinSession m_vbSession;

        public Update()
        {
            InitializeComponent();
        }

        private void Update_Load(object sender, EventArgs e)
        {
            m_rssParser = new JRSSParser();
            wbrNews.DocumentText = "<center>Loading...</center>";

            m_vbSession = new VBulletinSession("http://mpgh.net/forum/");

            IntPtr h = this.Handle;

            login();
            bgrRss****nWorkerAsync();
        }

        public void login()
        {
            Login lgn = new Login();
            lgn.ShowDialog();
            while (!m_vbSession.querySignIn(lgn.Username, lgn.Password))
            {
                MessageBox.Show("Unable to authenticate this user. Assure MPGH's servers are in a stable state; Contact the application publisher for help.");
                lgn.ShowDialog();
            }

            MessageBox.Show("You've successfully been authenticated.");
            
        }

        public bool navNews(Label lbl)
        {
            JRSSEntry entry = lbl.Tag as JRSSEntry;

            if(entry == null)
                return false;

            wbrNews.DocumentText = entry.Content;

            return true;
        }

        public void initNews()
        {
            KeyValuePair<Label, Label>[] wrkLabels = new KeyValuePair<Label, Label>[] { 
                                                                    new KeyValuePair<Label, Label>(lblA0, lblP0),
                                                                    new KeyValuePair<Label, Label>(lblA1, lblP1),
                                                                    new KeyValuePair<Label, Label>(lblA2, lblP2),
                                                                    new KeyValuePair<Label, Label>(lblA3, lblP3), };
            lock (m_rssParser)
            {
                int iMaxCount = wrkLabels.Length;
                foreach (JRSSEntry entry in m_rssParser.Entries)
                {
                    Label lblAuthor = wrkLabels[wrkLabels.Length - iMaxCount].Key;
                    Label lblTitle = wrkLabels[wrkLabels.Length - iMaxCount].Value;

                    if (iMaxCount > 0 && entry.Title.StartsWith("[JE_NN]"))
                    {
                        iMaxCount--;

                        lblAuthor.Text = "By: " + entry.Publisher;

                        lblTitle.Text = entry.Title;
                        lblTitle.Tag = entry;

                        lblTitle.Visible = lblAuthor.Visible = true;
                    }else
                        lblTitle.Visible = lblAuthor.Visible = false;
                }

                navNews(lblP0);
            }
        }

        private void setStatus(String sStatus)
        {
            lblStatus.Text = sStatus;
        }

        private HashTable getFsHash()
        {
            DirectoryInfo dirInfo = new DirectoryInfo(Environment.CurrentDirectory);

            return Hash.hashDirectory(dirInfo);
        }

        private void installUpdate(ZipInputStream src)
        {
            ZipEntry zr = src.GetNextEntry();
            do
            {
                if (!zr.IsDirectory)
                    zr.Extract(Path.Combine(Environment.CurrentDirectory, zr.FileName), ExtractExistingFileAction.OverwriteSilently);
                
                zr = src.GetNextEntry();
            } while (zr != null);
        }

        private void updateFs(HashTable localHashTable, HashTable remoteHashTable, Stream updateSourceZip)
        {
            foreach (KeyValuePair<String, String> hash in remoteHashTable.HashEntries)
            {
                if (!localHashTable.HashEntries.ContainsKey(hash.Key) ||
                    String.Compare(localHashTable.HashEntries[hash.Key], hash.Value, true) != 0)
                {
                    DialogResult dlgr = MessageBox.Show("JevaEngine has detected that an update " +
                                    "on your corrent version of the engine is " + 
                                    "required. Would you like to perform the update?", "Update", MessageBoxButtons.YesNo);

                    if(dlgr == DialogResult.Yes)
                        installUpdate(new ZipInputStream(updateSourceZip));

                    break;
                }
            }
        }

        private void bgrRss_DoWork(object sender, DoWorkEventArgs e)
        {
            NewUpdate_dlg dlgNewsUpdate = initNews;
            SetStatus_dlg dlgSetStatus = setStatus;

             try
             {

                
                while (!m_stopRss)
                {

                    this.Invoke(dlgSetStatus, "Gathering news & content from RSS feed.");
                    
                    JRSSEntry primary = null;

                    lock (m_rssParser)
                    {
                        m_rssParser = m_vbSession.getRssParser(48);

                        primary = (m_rssParser.Entries.Length > 0 ? m_rssParser.Entries[0] : null);
                    
                    }

                    
                    this.Invoke(dlgNewsUpdate);
                    this.Invoke(dlgSetStatus, "Building local FS Hash-Table");

                    HashTable localht = getFsHash();

                    FileStream fs = new FileStream("hashtable.txt", FileMode.Create);
                    localht.fush(fs);
                    fs.Close();

                    this.Invoke(dlgSetStatus, "Downloading remote hash-table.");

                    JRSSAttachment atchTable = primary.Attachments[ATTACHMENT_HASHTABLE];
                    JRSSAttachment atchUpdate = primary.Attachments[ATTACHMENT_ARCHIVE];

                    if(atchTable == null || atchUpdate == null)
                        throw new Exception("Invalid or otherwise malformed RSS content parsed.");

                    updateFs(localht,
                        new HashTable(
                            Encoding.ASCII.GetString(m_vbSession.downloadAttachment(atchTable))
                            ),
                        new MemoryStream(m_vbSession.downloadAttachment(atchUpdate)));

                    this.Invoke(dlgSetStatus, "Contrasting & Updating local FS.");

                    System.Threading.Thread.Sleep(new TimeSpan(0, 2, 0));

                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(String.Format("RSS Query thread has been halted due to connection failtures. You will not be able to recieve updates or global notifications. Assure the MPGH server is in a stable condition and restart the updater.\n{0}", ex.Message));
            }
        }

        private void lblP0_Click(object sender, EventArgs e)
        {
            navNews(lblP0);
        }

        private void lblP1_Click(object sender, EventArgs e)
        {
            navNews(lblP1);
        }

        private void lblP2_Click(object sender, EventArgs e)
        {
            navNews(lblP2);
        }

        private void lblP3_Click(object sender, EventArgs e)
        {
            navNews(lblP3);
        }
    }
}
#1 · edited 15y ago · 15y ago
Alen
Alen
That is a most fascinating tutorial Jeremy, keep up the hard work! I'm sure you'll own this section in no time

Toodle-loo now, I have other sections to check upon
#2 · 15y ago
Margherita
Margherita
Great tutorial Jeta
#3 · 15y ago
radnomguywfq3
radnomguywfq3
asdf I probably should've commented the code, lol.
#4 · 15y ago
LY
Lyoto Machida
Nice, But no thank you

I stay with my Visual BAsic /me
#5 · 15y ago
radnomguywfq3
radnomguywfq3
Quote Originally Posted by -Away View Post
Nice, But no thank you

I stay with my Visual BAsic /me
I'm writing a VB Tutorial on writing a tile-based RPG - starting it now :O
#6 · 15y ago
Dropdead2112
Dropdead2112
Amazing tutorial. Thank you very much!
#7 · 15y ago
XI
XinLoiBby
Just curious since you know how to do Update for vBulletin , is it possible you can create a java based one for a game ?
#8 · 15y ago
radnomguywfq3
radnomguywfq3
Quote Originally Posted by XinLoiBby View Post
Just curious since you know how to do Update for vBulletin , is it possible you can create a java based one for a game ?
Yeah, you can do it in anyting which allows you to open a socket to a web server. Preferably you'd want access to some libraries that parse XML documents - a regex engine also works fine too.
#9 · 15y ago
Posts 1–9 of 9 · Page 1 of 1

Post a Reply

Tags for this Thread

None