Results 1 to 14 of 14
  1. #1
    krazyshank's Avatar
    Join Date
    Jan 2012
    Gender
    male
    Location
    RealmStock
    Posts
    2,589
    Reputation
    467
    Thanks
    16,666
    My Mood
    Angelic

    How to make your own wServer.exe restarter - C#

    This is a very simplistic method you can use to make your own restarter.

    You'll notice that when the web server chashes, instead of closing, windows fault detection kicks in and prompts the user for "advice".
    This is WerFault.exe. If we run a method that detects it running, we can then close it, and execute our server again.
    Code:
    Process[] prs = Process.GetProcesses(); //use the windows API to get an array of current processes on the local machine.
                        foreach (Process pr in prs) 
                        {
                            if (pr.ProcessName == "WerFault") //for each process there is, if its name is "WerFault" then...
                            {
                                pr.Kill(); //KILL IT!
                                Process.Start(@"C:\PooperScooper\bin\wServer.exe"); //Then start wServer again, in the ""s put your path to wServer
                            }
                        }
    Now obviously this method will only check and restart ONCE. We need to call it every few seconds so it will check every few seconds.
    A simple way to do is is by creating a new timer on your form or in your console app and for the "tick" event for your timer put the code above.
    (for windows form users, you can drag a timer from the toolbox in visual studio, doubleclick it and you'll be brought to an auto-generaterated event handler for your timer called "timer_tick". Inside the brackets put the code above.)
    EXAMPLE:
    Code:
    private void timer1_Tick(object sender, EventArgs e)
            {
                   // PASTE THE CODE:
                   Process[] prs = Process.GetProcesses(); //use the windows API to get an array of current processes on the local machine.
                        foreach (Process pr in prs) 
                        {
                            if (pr.ProcessName == "WerFault") //for each process there is, if its name is "WerFault" then...
                            {
                                pr.Kill(); //KILL IT!
                                Process.Start(@"C:\PooperScooper\bin\wServer.exe"); //Then start wServer again, in the ""s put your path to wServer
                            }
                        }
             }
    DON'T FORGET TO START YOUR TIMER!
    Example being having a button, that when pressed, calls timer1.Start();

    yeah this isn't the best tut but it will help a few people for sure
    have fun!
    Last edited by krazyshank; 05-12-2013 at 01:35 PM.

    Accepting PayPal - Bitcoin - Giftcards - Items:

    Find it here: MPGH Sales Thread

  2. The Following 4 Users Say Thank You to krazyshank For This Useful Post:

    Alde. (05-12-2013),Goodfeet (05-15-2014),lkdjnfoskjednfblksjdfn (09-22-2015),TynanM (05-13-2013)

  3. #2
    MasterFart's Avatar
    Join Date
    Mar 2013
    Gender
    male
    Location
    Eastern Steppes
    Posts
    833
    Reputation
    15
    Thanks
    124
    Whrn i use your Krazy Pserver, when it crashes it auto restarts. Is this for older versions of your pservers?
    Also, when it crashes nothing comes up. At least on my 2 laptops.

  4. #3
    krazyshank's Avatar
    Join Date
    Jan 2012
    Gender
    male
    Location
    RealmStock
    Posts
    2,589
    Reputation
    467
    Thanks
    16,666
    My Mood
    Angelic
    Quote Originally Posted by MasterFart View Post
    Whrn i use your Krazy Pserver, when it crashes it auto restarts. Is this for older versions of your pservers?
    Also, when it crashes nothing comes up. At least on my 2 laptops.
    This has nothing to do with KrazyServer.
    It's to make your own application, how you want to.

    Accepting PayPal - Bitcoin - Giftcards - Items:

    Find it here: MPGH Sales Thread

  5. #4
    MasterFart's Avatar
    Join Date
    Mar 2013
    Gender
    male
    Location
    Eastern Steppes
    Posts
    833
    Reputation
    15
    Thanks
    124
    Small question forgot about this, but when i try to use your KrazyServer2 Item Spawner, it brings up something like "the specified program "Adobeflashblahblahblah" could not be found. The Spawner is not compatible with anything else. Just wondering how to fix it.
    Edit: Also i get it now @Abovecomments
    Last edited by MasterFart; 05-11-2013 at 09:18 PM.

  6. #5
    krazyshank's Avatar
    Join Date
    Jan 2012
    Gender
    male
    Location
    RealmStock
    Posts
    2,589
    Reputation
    467
    Thanks
    16,666
    My Mood
    Angelic
    Quote Originally Posted by MasterFart View Post
    Small question forgot about this, but when i try to use your KrazyServer2 Item Spawner, it brings up something like "the specified program "Adobeflashblahblahblah" could not be found. The Spawner is not compatible with anything else. Just wondering how to fix it.
    Edit: Also i get it now @Abovecomments
    Can you guys please post that stuff elsewhere. Or just pm me...

    Accepting PayPal - Bitcoin - Giftcards - Items:

    Find it here: MPGH Sales Thread

  7. #6
    MasterFart's Avatar
    Join Date
    Mar 2013
    Gender
    male
    Location
    Eastern Steppes
    Posts
    833
    Reputation
    15
    Thanks
    124
    Sorry. i thought it was just a quick question. :/

  8. #7
    Toyzz's Avatar
    Join Date
    Jan 2013
    Gender
    male
    Location
    Binary
    Posts
    63
    Reputation
    10
    Thanks
    66
    My Mood
    Amused
    Not bad Krazy, try doing one that attaches to teh process as a virtual debugger and watch for exceptions that are not catcher .net has a built in library for it

  9. #8
    krazyshank's Avatar
    Join Date
    Jan 2012
    Gender
    male
    Location
    RealmStock
    Posts
    2,589
    Reputation
    467
    Thanks
    16,666
    My Mood
    Angelic
    Quote Originally Posted by Toyzz View Post
    Not bad Krazy, try doing one that attaches to teh process as a virtual debugger and watch for exceptions that are not catcher .net has a built in library for it
    Yeah i'm aware of that, this is just a simple way for less-knowledgeable people

    Accepting PayPal - Bitcoin - Giftcards - Items:

    Find it here: MPGH Sales Thread

  10. #9
    Toyzz's Avatar
    Join Date
    Jan 2013
    Gender
    male
    Location
    Binary
    Posts
    63
    Reputation
    10
    Thanks
    66
    My Mood
    Amused
    Quote Originally Posted by krazyshank View Post
    Yeah i'm aware of that, this is just a simple way for less-knowledgeable people
    True and it works, so thats a plus

  11. #10
    RaymondW's Avatar
    Join Date
    Oct 2012
    Gender
    male
    Location
    Michigan
    Posts
    132
    Reputation
    10
    Thanks
    470
    My Mood
    Cynical
    Old thread? all process.blah the process gives me an error

  12. #11
    krazyshank's Avatar
    Join Date
    Jan 2012
    Gender
    male
    Location
    RealmStock
    Posts
    2,589
    Reputation
    467
    Thanks
    16,666
    My Mood
    Angelic
    Quote Originally Posted by RaymondW View Post
    Old thread? all process.blah the process gives me an error
    Import the Diagnostics class.
    ( using System.Diagnostics; )

    Accepting PayPal - Bitcoin - Giftcards - Items:

    Find it here: MPGH Sales Thread

  13. #12
    RaymondW's Avatar
    Join Date
    Oct 2012
    Gender
    male
    Location
    Michigan
    Posts
    132
    Reputation
    10
    Thanks
    470
    My Mood
    Cynical
    Ah thank you

  14. #13
    RaymondW's Avatar
    Join Date
    Oct 2012
    Gender
    male
    Location
    Michigan
    Posts
    132
    Reputation
    10
    Thanks
    470
    My Mood
    Cynical
    Hrm, when i use it, after wserver crashes it goes totally chaotic and opens tons and tons of wservers and giving me an unknown error or something.

    Code:
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Windows.Forms;
    using System.Diagnostics;
    
    namespace Auto_Restart_wServer
    {
        public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();
            }
    
            private void timer1_Tick(object sender, EventArgs e)
            {
                // PASTE THE CODE:
                Process[] prs = Process.GetProcesses(); //use the windows API to get an array of current processes on the local machine.
                foreach (Process pr in prs)
                {
                    if (pr.ProcessName == "WerFault") //for each process there is, if its name is "WerFault" then...
                    {
                        pr.Kill(); //KILL IT!
                        Process.Start(@"C:\Users\Raymond\Desktop\REALM OF THE MAD GOD\Clean Server Files\rotmg_svr-master\wServer\bin\Release\wServer.exe"); //Then start wServer again, in the ""s put your path to wServer
                    }
                }
            }
    
            private void button1_Click(object sender, EventArgs e)
            {
                timer1.Start();
            }
        }
    }

  15. The Following User Says Thank You to RaymondW For This Useful Post:

    Goodfeet (05-15-2014)

  16. #14
    IamTheZ's Avatar
    Join Date
    Aug 2013
    Gender
    male
    Posts
    1
    Reputation
    10
    Thanks
    1
    HELP ME I DONT KNOW HOW TO GET THIS PSERVER RUNNING

  17. The Following User Says Thank You to IamTheZ For This Useful Post:

    BlackRayquaza (02-07-2015)

Similar Threads

  1. [HELP]How to make your OWN Chams
    By true1playa in forum Combat Arms Hacks & Cheats
    Replies: 13
    Last Post: 08-07-2008, 03:15 PM
  2. [Tutorial] How to make your own undetected module in VB6
    By markfracasso11 in forum Visual Basic Programming
    Replies: 17
    Last Post: 10-15-2007, 09:34 AM
  3. [Tutorial] How to make your own undetected module in VB6
    By markfracasso11 in forum WarRock - International Hacks
    Replies: 22
    Last Post: 09-25-2007, 05:35 AM
  4. (TUT)how to make your own warrock menu
    By aprill27 in forum WarRock - International Hacks
    Replies: 0
    Last Post: 09-21-2007, 03:46 PM
  5. How to make your own radiostation?
    By nasir91 in forum General
    Replies: 3
    Last Post: 04-30-2007, 07:25 AM