Register for your free account! | Forgot your password?

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

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

Advertisement



can anyone convert this 5165 autorestarter code to 5533+ code?

Discussion on can anyone convert this 5165 autorestarter code to 5533+ code? within the CO2 Private Server forum part of the Conquer Online 2 category.

Reply
 
Old   #1
 
marcbacor6666's Avatar
 
elite*gold: 0
Join Date: Oct 2006
Posts: 557
Received Thanks: 76
can anyone convert this 5165 autorestarter code to 5533+ code?

Code:
 #region timers
            Thetimer = new System.Timers.Timer();
            Thetimer.Interval = 100000;
            Thetimer.Elapsed += new ElapsedEventHandler(Thetimer_Elapsed);
            Thetimer.Start();
            #endregion

also if u can add a checker of the port to know if port is online or not it will be good

port 9958 or 5816
marcbacor6666 is offline  
Old 04/24/2012, 12:45   #2
 
_DreadNought_'s Avatar
 
elite*gold: 28
Join Date: Jun 2010
Posts: 2,223
Received Thanks: 867
Sure I can buddy! Anything for you, heard about you, your really good at coding!

Code:
Environment.Exit(0);
That will invoke a restart, you dont need that timer.

I mean it! Pro codes.
_DreadNought_ is offline  
Old 04/24/2012, 12:51   #3
 
marcbacor6666's Avatar
 
elite*gold: 0
Join Date: Oct 2006
Posts: 557
Received Thanks: 76
its not for restart :P its for exit
marcbacor6666 is offline  
Old 04/24/2012, 13:22   #4
 
elite*gold: 0
Join Date: Dec 2011
Posts: 1,537
Received Thanks: 785
Your code is not a restarter.
Code:
const int[] RestartHours = new int[]
{
00,
12
// ...
};
private static bool restarted;
private static void Restart()
{
restarted = false;
System.Threading.Thread restartThread = new System.Threading.Thread(
new System.Threading.ThreadStart(delegate
{
while (!restarted)
{
if (RestartHours.Contains(DateTime.Now.Hour) && !restarted)
{
System.Windows.Forms.Application.Restart();
}
System.Threading.Thread.Sleep(10000);
}
}));
restartThread.Start();
}
Add System.Windows.Forms to your references.

If you don't want to use that then use this method.
Code:
private const int[] RestartHours = new int[]
{
00,
12
// ...
};
private const string processName = "ConquerServer.exe";
private static bool restarted;

private static void Restart()
{
restarted = false;
System.Threading.Thread restartThread = new System.Threading.Thread(
new System.Threading.ThreadStart(delegate
{
while (!restarted)
{
if (RestartHours.Contains(DateTime.Now.Hour) && !restarted)
{
System.Diagnostics.Process.Start(processName);
Environment.Exit(0);
}
System.Threading.Thread.Sleep(10000);
}
}));
restartThread.Start();
}
Manual restart method:
Code:
private const string processName = "ConquerServer.exe";

private static void Restart()
{
System.Diagnostics.Process.Start(processName);
Environment.Exit(0);
}
Any problems with it let me know as I just did this out of my head.

Call Restart() a single time from the Main method.

Port check:
Code:
public static bool CheckLocalPort(int Port)
{
try {
System.Net.Sockets.Socket testSocket = new System.Net.Sockets.Socket();
testSocket.Bind(new System.Net.IPEndPoint(IPAddress.Parse("127.0.0.1"), Port));
testSocket.Shutdown(System.Net.Sockets.SocketShutdown.Both);
testSocket.Close();
return true;
}
catch {
return false;
}
}
public static bool CheckExternPort(int Port)
{
try {
System.Net.Sockets.Socket testSocket = new System.Net.Sockets.Socket();
testSocket.Connect(new System.Net.IPEndPoint(IPAddress.Parse("127.0.0.1"), Port));
testSocket.Disconnect(false);
return true;
}
catch {
return false;
}
}
Example usage:
Code:
Console.WriteLine(CheckLocalPort(80));//checking port 80 and writing true if available and false if not.
I don't have a username is offline  
Old 04/24/2012, 13:32   #5
 
_DreadNought_'s Avatar
 
elite*gold: 28
Join Date: Jun 2010
Posts: 2,223
Received Thanks: 867
You do realize I actually had no intention of helping?XD

Ofc that wouldnt restart lol
_DreadNought_ is offline  
Old 04/24/2012, 13:39   #6
 
marcbacor6666's Avatar
 
elite*gold: 0
Join Date: Oct 2006
Posts: 557
Received Thanks: 76
what .cs will i insert this
marcbacor6666 is offline  
Old 04/24/2012, 18:49   #7
 
elite*gold: 0
Join Date: Dec 2011
Posts: 1,537
Received Thanks: 785
Any .cs you wanna call them from. I'd say Program.cs
I don't have a username is offline  
Old 04/25/2012, 09:21   #8
 
marcbacor6666's Avatar
 
elite*gold: 0
Join Date: Oct 2006
Posts: 557
Received Thanks: 76
can u put a guide?
marcbacor6666 is offline  
Old 04/25/2012, 11:03   #9
 
elite*gold: 0
Join Date: Dec 2011
Posts: 1,537
Received Thanks: 785
Ermm.. Learn to code.
I don't have a username is offline  
Thanks
1 User
Reply


Similar Threads Similar Threads
[Biete]1x Allstar Akali Code 2x Riot Nasus Code 7x PAX JAX Code
09/26/2011 - League of Legends Trading - 7 Replies
Hi, ich habe die Codes gewonnen und möchte sie nun verkaufen da ich kein LoL mehr Spiele. Skype: nashvil. mit dem Punkt! Ich erhalte die Paysafecards zuerst! Egal wieviele TBM ihr habt!
Biete AW50F Code + Javelin Code + Kamazaki Code an
08/18/2011 - WarRock Trading - 6 Replies
Biete AW50F Code + Javelin Code + Kamazaki Code an Was biete Ich _________________________________________________ _ _________________ ----- AW50F CODE ----- Javelin Code
Waffen Code´s - Premium Code´s - Dinar Code´s [VERKAUFBAR] ! ! !
03/10/2011 - WarRock Trading - 9 Replies
Waffen Code´s - Premium Code´s - Dinar Code´s ! ! ! Hallo Leute , ich verkaufe Code´s . Die Code´s werde ich jetzt darunter hinschreiben und ihr könnt euch bei mir melden 50 % Günstiger Als WarRock Marketplace . 1.Waffen Code´s >>> G36 Code Xm8 Code Javelin Code



All times are GMT +2. The time now is 02:30.


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.