+ setDeleteServerFilesModalOpen(false)}>
+
+
+
+ Confirmation
+
+
+
+ Are you sure you want to delete the server files? You cannot reverse this action!
+
+
+
+
+
+
+
+
+
+
+ setDeleteProfileModalOpen(false)}>
+
+
+
+ Confirmation
+
+
+
+ Are you sure you want to delete the profile? You cannot reverse this action!
+
+
+
+
+
+
+
+
+
+
+ setDeleteEverythingModalOpen(false)}>
+
+
+
+ Confirmation
+
+
+
+ Are you sure you want to delete everything? You cannot reverse this action!
+
+
+
+
+
+
+
+
+
+
);
}
\ No newline at end of file
diff --git a/server/helpers.go b/server/helpers.go
index f7752f6..4336270 100644
--- a/server/helpers.go
+++ b/server/helpers.go
@@ -41,7 +41,10 @@ func generateNewDefaultServer(id int) Server {
}*/
return Server{
- Id: id,
+ Id: id,
+
+ DisableUpdateOnStart: false,
+
ServerAlias: "Server " + strconv.Itoa(id),
ServerName: "A server managed by ArkAscendedServerManager",
diff --git a/server/server.go b/server/server.go
index 859d98e..3d5698a 100644
--- a/server/server.go
+++ b/server/server.go
@@ -20,6 +20,10 @@ type Server struct {
Command *exec.Cmd `json:"-"`
ctx context.Context
+ //PREFERENCES
+
+ DisableUpdateOnStart bool `json:"disableUpdateOnStart"`
+
//CONFIGURATION VARIABLES
// Id is the id of the server
diff --git a/server/server_controller.go b/server/server_controller.go
index e99396c..90b4af1 100644
--- a/server/server_controller.go
+++ b/server/server_controller.go
@@ -238,6 +238,37 @@ func (c *ServerController) GetAllServersFromDir() (map[int]*Server, error) {
return c.Servers, nil
}
+// DeleteServerFilesWithError deletes the server files from the server with the given id. If it fails it returns an error which is catch-able
+func (c *ServerController) DeleteServerFilesWithError(id int) error {
+ server, err := c.GetServerWithError(id, false)
+ if err != nil {
+ return fmt.Errorf("Failed to get server: " + strconv.Itoa(id) + " error: " + err.Error())
+ }
+ serverPath := server.ServerPath
+
+ err = os.RemoveAll(serverPath)
+ if err != nil {
+ return fmt.Errorf("Failed to delete server " + strconv.Itoa(id) + " files: " + serverPath + " error: " + err.Error())
+ }
+
+ return nil
+}
+
+// DeleteProfileWithError deletes the profile with the given id. If it fails it returns an error which is catch-able
+func (c *ServerController) DeleteProfileWithError(id int) error {
+
+ serverDir := path.Join(c.serverDir, strconv.Itoa(id))
+
+ err := os.RemoveAll(serverDir)
+ if err != nil {
+ return fmt.Errorf("Failed to delete server " + strconv.Itoa(id) + " profile error: " + err.Error())
+ }
+
+ delete(c.Servers, id)
+
+ return nil
+}
+
//region Boilerplate functions
// GetAllServers gets all servers and saves them to ServerController.Servers and also returns them, if it fails it returns nil and error. If they already exist in the map it will just get that.
@@ -306,6 +337,30 @@ func (c *ServerController) CreateServer(saveToConfig bool) (Server, error) {
}
+// DeleteServerFiles deletes the server files from the server with the given id. If it fails it returns an error which is catch-able
+func (c *ServerController) DeleteServerFiles(id int) error {
+ err := c.DeleteServerFilesWithError(id)
+ if err != nil {
+ newErr := fmt.Errorf("Failed deleting server: " + err.Error())
+ runtime.LogError(c.ctx, newErr.Error())
+ return newErr
+ }
+ return nil
+
+}
+
+// DeleteProfile deletes the profile with the given id. If it fails it returns an error which is catch-able
+func (c *ServerController) DeleteProfile(id int) error {
+ err := c.DeleteProfileWithError(id)
+ if err != nil {
+ newErr := fmt.Errorf("Failed deleting profile: " + err.Error())
+ runtime.LogError(c.ctx, newErr.Error())
+ return newErr
+ }
+ return nil
+
+}
+
//region Private
// getServerFromDir gets the server from the server dir if it does not exist and shouldReturnNew is true it returns a new server.