dimitrifrom31 Posted September 6, 2009 Share Posted September 6, 2009 I was given a code made by Luis to run an exe via a button on the Panel. Only "problem" is that the server is not stopped before the exe is ran, that was not a big deal for my previous usage but for the one I want to make now I really need the server to be stopped so here is the code if any1 can help : <% ''''''''''''''''''''''''''''''''''''''''''' 'Variables ''''''''''''''''''''''''''''''''''''''''''' Dim pageTitle As String = "MyCustomProgramName" Dim stopGameServer As Boolean = False Dim relativePath As String = "" Dim command As String = "cd %path%" + vbnewline + "%path%\MyCustomProgram.exe" Dim startMessage As String = "The program is running please wait...<br>" Dim endMessage As String = "Operation terminated successfuly.<br>You can close this window." ''''''''''''''''''''''''''''''''''''''''''' ''''''''''''''''''''''''''''''''''''''''''' Response.Write("<!DOCTYPE HTML PUBLIC ""-//W3C//DTD HTML 4.0 Transitional//EN"">") Response.Write("<HTML><TITLE>" & pageTitle & "</TITLE><BODY bgcolor=""#000000""><font face=""Lucida Console"" size=""2"" color=""#FFFFFF"">") If TCAdminSDK.Web.Session.IsAuthenticated Then Dim serviceid As String = Request.QueryString("serviceid") Dim service As New TCAdminSDK.Objects.Service service.ServiceID = serviceid If service.Find Then Dim path As String = System.IO.Path.Combine(service.AutomationFilesPath, relativePath) command = command.Replace("%path%", path) Response.Write(startMessage) Response.Flush() If service.UserID = TCAdminSDK.Web.Session.CurrentUser Or TCAdminSDK.Web.Session.CurrentUserType = TCAdminSDK.Objects.UserType.Admin Or TCAdminSDK.Web.Session.CurrentUserType = TCAdminSDK.Objects.UserType.SubAdmin Then Dim serviceWasRunning As Boolean = False If stopGameServer And service.CurrentStatus = TCAdminSDK.Objects.ServiceStatus.Running Then Response.Write("Stopping the game server...") Response.Flush() service.Stop() serviceWasRunning = True End If Dim serverplugin As TCAdminBase.Plugins.IGenericPlugIn = TCAdminSDK.Remote.InstanceCreator.GetPluginFromServer(service.ServerID, "TCAdminMonitor.StandardPlugins.RemoteServers.ServerUtilities") serverplugin.Execute(New Object() {"ExecuteScript", service.WorkingDirectory, command}) If serviceWasRunning Then Response.Write("Starting the game server...") Response.Flush() service.Start() End If End If Response.Write(endMessage) Response.Flush() End If End If Response.Write("</font></BODY></HTML>") %> Note that I noticed that this code is supposed to stop the server but it just doesnt so there must be some typo or error somewhere. Link to comment Share on other sites More sharing options...
LFA Posted September 10, 2009 Share Posted September 10, 2009 Change the value of stopGameServer to true Dim stopGameServer As Boolean = True Link to comment Share on other sites More sharing options...
dimitrifrom31 Posted September 10, 2009 Author Share Posted September 10, 2009 Change the value of stopGameServer to true Dim stopGameServer As Boolean = True lol i will do that, thought that it was already supposed to stop the game server like this, ty. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.