Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Conquer Online 2 > CO2 Private Server
You last visited: Today at 00:21

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[Help]How to make your own auto patcher?

Discussion on [Help]How to make your own auto patcher? within the CO2 Private Server forum part of the Conquer Online 2 category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Nov 2007
Posts: 87
Received Thanks: 0
[Help]How to make your own auto patcher?

Hi there, How can I make my own auto patcher?

Can anyone help?

Thanks
kyle191 is offline  
Old 12/29/2011, 02:54   #2
 
elite*gold: 0
Join Date: Dec 2011
Posts: 1,537
Received Thanks: 785
Code:
    public class Autopatcher
    {
        /// <summary>
        /// The url.
        /// </summary>
        private string m_url;

        /// <summary>
        /// Get's the URL of the autopatcher.
        /// </summary>
        /// <returns>The correct url.</returns>
        public string GetURL()
        {
            return (m_url.EndsWith("/") ? m_url : m_url + "/");
        }

        /// <summary>
        /// Creating a new instance of an autopatcher.
        /// </summary>
        /// <param name="URL">The url where the patches are located. Ex. http://127.0.0.1/autopatcher/ </param>
        public Autopatcher(string URL)
        {
            m_url = URL;
        }

        /// <summary>
        /// The progress percentage.
        /// </summary>
        private int Progress = 0;

        /// <summary>
        /// Get's the progress percentage of the patching.
        /// </summary>
        /// <returns>The progress percentage.</returns>
        public int GetProgress()
        {
            return Progress;
        }

        /// <summary>
        /// The current patch.
        /// </summary>
        private int CurrentPatch;

        /// <summary>
        /// Get's the current patch.
        /// </summary>
        /// <returns>The current patch.</returns>
        public int GetCurrentPatch()
        {
            return CurrentPatch;
        }

        /// <summary>
        /// The patch result.
        /// </summary>
        private PatchResult Result;

        /// <summary>
        /// Get's the current patch result.
        /// </summary>
        /// <returns>The patch result.</returns>
        public PatchResult GetLastResult()
        {
            return Result;
        }

        /// <summary>
        /// Begins a new patch download.
        /// </summary>
        /// <param name="_CurrentPatch">The current patch to download.</param>
        public void BeginPatch(int _CurrentPatch)
        {
            CurrentPatch = _CurrentPatch;
            Result = Patch();
        }

        /// <summary>
        /// This method is called from BeginPatch(int) and will return Result.
        /// </summary>
        /// <returns>Result</returns>
        private PatchResult Patch()
        {
            Result = new PatchResult();
            try
            {
                Result.Error = false;
                

                WebClient client = new WebClient();
                int targetpatch = int.Parse(client.DownloadString(GetURL() + "version.dat"));

                if (targetpatch > CurrentPatch)
                {
                    Result.UpToDate = false;
                    Uri uri = new Uri(m_url + CurrentPatch + "/");
                    client.DownloadFileAsync(uri, CurrentPatch + ".rar");
                    client.DownloadProgressChanged += new DownloadProgressChangedEventHandler(BeginProgress);
                    client.DownloadFileCompleted += new AsyncCompletedEventHandler(BeginEndPatch);
                }
                else
                    Result.UpToDate = true;

                return Result;
            }
            catch (Exception e)
            {
                Result.Error = true;
                Result.exception = e;
                return Result;
            }
        }

        /// <summary>
        /// The progress event.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BeginProgress(object sender, DownloadProgressChangedEventArgs e)
        {
            Progress += e.ProgressPercentage;
        }

        /// <summary>
        /// The end event.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BeginEndPatch(object sender, AsyncCompletedEventArgs e)
        {
            CurrentPatch++;
            BeginPatch(CurrentPatch);
        }
    }
Code:
    public class PatchResult
    {
        public bool Error;
        public bool UpToDate;
        public Exception exception;
    }
From an old autopatch library I made, figure out how to use or improve it yourself.
I don't have a username is offline  
Thanks
1 User
Reply


Similar Threads Similar Threads
How to make registration and patcher ? i want to make flyff p server .
05/22/2011 - Flyff Private Server - 3 Replies
Help me pls ..
Auto patcher
02/07/2011 - Metin2 Private Server - 0 Replies
Hallo ich versuch es immer wieder und ja .... ich habe den auto patcher config angepasst client aufn server gelade usw... patlist angepasst nur wen ich dann patchen will kommt fehler patchlist 1-7 oder 1-89 oder 1-5900:D ich würde mich freun wenn einer mich pn und mir helfen kann bekommt ein dickes thx oder mehr...
[Guide] how to make auto patcher working on Static IP
05/21/2010 - CO2 PServer Guides & Releases - 3 Replies
well its Simple but more guys asking me that Auto patcher not working on Static IPS here is the way you just need to open that port number : 9528 i hoppe its usefull :)
Auto Patcher...
02/10/2010 - Metin2 Private Server - 2 Replies
Hallo, Community! Ich hab mal in Google nach Auto Patcher VB gesucht... Und bin fündig geworden. Er ist geeignet für online Spiele. Ihr müsst den SourceCode laden und dann halt den Patcher zu einem Metin2 Patcher coden :P Hier mal der Download! Möglicherweise ist er nur VB 2006 compatibel... Könnts ja testen :awesome:



All times are GMT +2. The time now is 00:21.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.