Пример #1
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="oid"></param>
 /// <returns></returns>
 public override OperationState Open(object oid)
 {
     try
     {
         if (oid == null || !(oid is string))
         {
             MessageDisplayer.DisplayError("Error", "");
             return(OperationState.STOP);
         }
         bool   isMonouser = ApplicationManager.ApplcationConfiguration.IsMonouser();
         string filePath   = (string)oid;
         if (isMonouser && ApplicationManager.useZip() && !System.IO.File.Exists(filePath))
         {
             MessageDisplayer.DisplayError("Error", "File not found: " + filePath);
             return(OperationState.STOP);
         }
         if (isMonouser && !ApplicationManager.useZip() && !System.IO.Directory.Exists(filePath))
         {
             MessageDisplayer.DisplayError("Error", "Directory not found: " + filePath);
             return(OperationState.STOP);
         }
         Kernel.Application.Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Background, new Action(() => this.OpenOrCreate(filePath, false)));
         return(OperationState.CONTINUE);
     }
     catch (BcephalException e)
     {
         MessageDisplayer.DisplayError("Error", e.Message);
         return(OperationState.STOP);
     }
 }
Пример #2
0
        public override Kernel.Application.OperationState Create()
        {
            Presentation presentation = GetNewPresentation();

            ((PresentationSideBar)SideBar).PresentationGroup.PresentationTreeView.AddPresentation(presentation);
            PresentationEditorItem page = (PresentationEditorItem)getEditor().addOrSelectPage(presentation);
            OperationState         sate = page.getPresentationForm().SlideView.Open();

            if (sate == OperationState.STOP)
            {
                MessageDisplayer.DisplayError("Bcephal - MS PowerPoint Error", "Unable to create powerPoint file!");
                return(OperationState.STOP);
            }
            String fileName = page.getPresentationForm().SlideView.DocumentName;

            presentation.slideFileName      = presentation.name + Path.GetExtension(fileName);
            presentation.slideFileExtension = Path.GetExtension(fileName);
            initializePageHandlers(page);
            page.Title = presentation.name;
            getPresentationEditor().ListChangeHandler.AddNew(presentation);
            page.getPresentationForm().EditedObject     = presentation;
            page.getPresentationForm().listeBrowserData = GetPresentationService().ReportService.getBrowserDatas();
            if (!String.IsNullOrEmpty(Kernel.Util.UserPreferencesUtil.GetPowerPowerPointSavingRepository()))
            {
                page.EditedObject.userSavingDir = Kernel.Util.UserPreferencesUtil.GetPowerPowerPointSavingRepository();
            }
            page.getPresentationForm().displayObject();
            page.IsModify = true;
            refreshInReportSidebar(page);
            return(OperationState.CONTINUE);
        }
Пример #3
0
        /// <summary>
        /// Sauve les objets en cours d'édition sur la page.
        /// </summary>
        /// <returns>
        /// OperationState.CONTINUE si l'opération a réussi
        /// OperationState.STOP sinon
        /// </returns>
        public override OperationState Save(EditorItem <Presentation> page)
        {
            if (page.IsModify)
            {
                if (!page.validateEdition())
                {
                    return(OperationState.STOP);
                }
                try
                {
                    Mask(true);
                    PresentationEditorItem currentPage = (PresentationEditorItem)page;
                    if (currentPage.getPresentationForm().SlideView != null)
                    {
                        String name = currentPage.getPresentationForm().PresentationPropertiesPanel.nameTextBox.Text;
                        Rename(name);
                        String savingFolder = currentPage.getPresentationForm().PresentationPropertiesPanel.savingFolderTextBox.Text;
                        String filePath     = buildPowerPointFilePath(page.EditedObject.name);
                        String tempFolder   = GetPresentationService().FileService.GetFileDirs().TempPresentationFolder;
                        page.EditedObject.userSavingDir      = buildPowerPointSavingFolderPath(savingFolder, page.EditedObject.oid);
                        page.EditedObject.slideFileName      = Path.GetFileName(filePath);
                        page.EditedObject.slideFileExtension = Path.GetExtension(filePath);
                        filePath = tempFolder + Path.DirectorySeparatorChar + Path.GetFileName(filePath);
                        if (currentPage.getPresentationForm().SlideView.SaveAs(filePath) != OperationState.CONTINUE)
                        {
                            MessageDisplayer.DisplayError("Unable to save " + page.EditedObject.name, "Unable to save file :\n" + filePath);
                            OnChange();
                            Mask(false);
                            return(OperationState.STOP);
                        }
                        String fileName = currentPage.getPresentationForm().SlideView.DocumentName + Path.GetExtension(filePath);
                        String path     = currentPage.getPresentationForm().SlideView.DocumentUrl;
                        GetPresentationService().FileService.FileTransferService.uploadPresentation(fileName, tempFolder);
                        page.EditedObject.slideFileName = fileName;
                    }

                    GetPresentationService().SavePresentationHandler += UpdateSaveInfo;
                    GetPresentationService().Save(page.EditedObject);
                }
                catch (Exception)
                {
                    DisplayError("Unable to save " + page.EditedObject.name, "Unable to save " + page.EditedObject.name + " named : " + page.EditedObject.name);
                    OnChange();
                    Mask(false);
                    return(OperationState.STOP);
                }
            }
            return(OperationState.CONTINUE);
        }
Пример #4
0
 /// <summary>
 /// Cette methode permet d'ouvrir un fichier existant.
 ///
 /// 1. On affiche le dialog de fichier pour pemettre à l'utilisateur
 ///    de sélectionner un fichier à ouvrir.
 ///
 /// 2. On valide le nom pour se rassurer que ce fichier existe bien.
 ///
 /// 3. On transmet le nom et le répertoire au serveur
 ///    qui se charge d'effectuer l'ouverture du fichier
 ///    et renvoie les références du fichier ainsi ouvert.
 ///
 /// 4. Si durant ce processus une erreur survient,
 ///    un message d'erreur est afficher et le processus est interromu.
 ///
 /// </summary>
 /// <returns>CONTINUE si l'ouverture du fichier se termine avec succès. STOP sinon</returns>
 public override OperationState Search()
 {
     try
     {
         string pathDirectory = Kernel.Util.UserPreferencesUtil.GetFileOpeningRepository();
         string filePath      = openFileDialogForMispFiles("Open File", pathDirectory);
         if (filePath == null || string.IsNullOrWhiteSpace(filePath))
         {
             return(OperationState.STOP);
         }
         return(Open(filePath));
     }
     catch (BcephalException e)
     {
         MessageDisplayer.DisplayError("Error", e.Message);
         return(OperationState.STOP);
     }
 }
Пример #5
0
        /// <summary>
        /// Procède à la fermeture de la page.
        /// </summary>
        /// <param name="page"></param>
        /// <returns></returns>
        public void OnClosePage(object param)
        {
            Controllable page = (Controllable)param;

            if (page == null)
            {
                return;
            }
            try
            {
                if (OpenedPages.Contains(page))
                {
                    OpenedPages.Remove(page);
                }
                if (ActivePage != null && ActivePage.Equals(page))
                {
                    ActivePage = null;
                    FunctionalityType functionalityType = page.NavigationToken != null ? page.NavigationToken.FunctionalityType : FunctionalityType.MAIN_FONCTIONALITY;
                    bool isSubFonctionality             = functionalityType == FunctionalityType.SUB_FONCTIONALITY;
                    if (isSubFonctionality && page.ParentController != null)
                    {
                        openPage(page.ParentController);
                    }
                    else if (OpenedPages.Count > 0)
                    {
                        openPage(OpenedPages[OpenedPages.Count - 1]);
                        return;
                    }
                    else
                    {
                        openHomePage();
                    }
                }
            }
            catch (Exception e)
            {
                MessageDisplayer.DisplayError("Error", e.Message);
                return;
            }
            return;
        }
Пример #6
0
        /// <summary>
        /// Ouvre la table passée en parametre dans l'éditeur.
        /// </summary>
        /// <param name="table">La table à ouvrir</param>
        /// <returns>
        /// - CONTINUE si l'ouverture de la table se termine avec succès.
        /// - STOP sinon
        /// </returns>
        public override OperationState Open(Presentation presentation)
        {
            string filePath = GetPresentationService().FileService.FileTransferService.downloadPresentation(presentation.name + EdrawSlide.POWER_POINT_EXT);

            if (string.IsNullOrWhiteSpace(filePath))
            {
            }

            filePath = filePath + presentation.name + EdrawSlide.POWER_POINT_EXT;
            ((PresentationSideBar)SideBar).PresentationGroup.PresentationTreeView.AddPresentationIfNatExist(presentation);
            PresentationEditorItem page = (PresentationEditorItem)getEditor().addOrSelectPage(presentation);
            OperationState         sate = page.getPresentationForm().SlideView.Open(filePath);

            if (sate == OperationState.STOP)
            {
                MessageDisplayer.DisplayError("Bcephal - MS PowerPoint Error", "Unable to create powerPoint file!");
                return(OperationState.STOP);
            }
            refreshInReportSidebar(page);
            ((PresentationEditorItem)page).getPresentationForm().displayObject();
            initializePageHandlers(page);
            getEditor().ListChangeHandler.AddNew(presentation);
            return(OperationState.CONTINUE);
        }
Пример #7
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="filePath">Chemin absolue vers le fichier à ouvrir ou à créer</param>
        /// <param name="create">Est ce la creation</param>
        /// <returns></returns>
        //public OperationState OpenOrCreate(string filePath, bool create)
        //{
        //    action = new BusyAction(false)
        //    {
        //        DoWork = () =>
        //        {
        //            try
        //            {
        //                bool isMonouser = ApplicationManager.ApplcationConfiguration.IsMonouser();
        //                String message = create ? "File creation..." : "File loading...";
        //                action.ReportProgress(0, message);
        //                if (isMonouser && !System.IO.File.Exists(filePath) && !create && ApplicationManager.useZip())
        //                {
        //                    MessageDisplayer.DisplayError("Error", "File not found: " + filePath);
        //                    return OperationState.STOP;
        //                }
        //                if (isMonouser && !System.IO.Directory.Exists(filePath) && !create && !ApplicationManager.useZip())
        //                {
        //                    MessageDisplayer.DisplayError("Error", "Directory not found: " + filePath);
        //                    return OperationState.STOP;
        //                }

        //                string fileDir = System.IO.Path.GetDirectoryName(filePath);
        //                string fileName = System.IO.Path.GetFileName(filePath);
        //                //string fileNameWithoutExtension = System.IO.Path.GetFileNameWithoutExtension(filePath);

        //                action.ReportProgress(10, message);

        //                Misp.Kernel.Domain.File file = create ?
        //                    this.GetFileInfoService().CreateFile(fileDir, fileName) :
        //                    this.GetFileInfoService().OpenFile(fileDir, fileName);

        //                message = create ? "File created!" : "File loaded!";
        //                action.ReportProgress(99, message);

        //                if (file == null) return OperationState.STOP;
        //                this.ApplicationManager.File = file;
        //                this.ApplicationManager.AllocationCount = this.GetFileInfoService().GetAllocationCount();

        //                Util.UserPreferencesUtil.AddRecentFile(filePath);
        //                Util.UserPreferencesUtil.SetFileOpeningRepository(filePath);
        //               action.ReportProgress(100, message);
        //            }
        //            catch (BcephalException e)
        //            {
        //                MessageDisplayer.DisplayError(create ? "Create file" : "Open file", e.Message);
        //                action = null;
        //                return OperationState.STOP;
        //            }
        //            return OperationState.CONTINUE;
        //        },


        //        EndWork = () =>
        //        {
        //            try
        //            {
        //                string fileNameWithoutExtension = "";
        //                if (filePath.EndsWith(FILE_EXTENSION)) fileNameWithoutExtension = System.IO.Path.GetFileNameWithoutExtension(filePath);
        //                else fileNameWithoutExtension = System.IO.Path.GetFileName(filePath);
        //                ApplicationManager.MainWindow.Title = fileNameWithoutExtension + " - B-Cephal";
        //                ApplicationManager.MainWindow.MenuBar.customizeForFileOpened();
        //                this.ToolBar.DisplayAllControls();
        //                ApplicationManager.MainWindow.MenuBar.GetFileMenu().lastFilePath = filePath;
        //                ApplicationManager.MainWindow.MenuBar.GetFileMenu().BuildSaveAsMenu();
        //                ApplicationManager.MainWindow.MenuBar.GetFileMenu().BuildRecentOpenedFiles();
        //                ApplicationManager.MainWindow.MenuBar.GetFileMenu().BackupSimpleMenu.IsEnabled = true;
        //                ApplicationManager.MainWindow.MenuBar.GetFileMenu().BackupAutomaticMenu.IsEnabled = true;
        //                RefreshDashboard();
        //            }
        //            catch (Exception e)
        //            {
        //                MessageDisplayer.DisplayError("Error", e.Message);
        //                return OperationState.STOP;
        //            }
        //            finally
        //            {
        //                action = null;
        //            }

        //            return OperationState.CONTINUE;
        //        }

        //    };

        //    action.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(ApplicationManager.MainWindow.OnBusyPropertyChanged);
        //    action.Run();
        //    return OperationState.CONTINUE;

        //}

        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public override OperationState SaveAs()
        {
            action = new BusyAction(false)
            {
                DoWork = () =>
                {
                    try
                    {
                        String message = "Saving File ";
                        action.ReportProgress(0, message);
                        string filePath = "";
                        System.Windows.Application.Current.Dispatcher.Invoke((Action)(() =>
                        {
                            filePath = openFileDialogForFolders("Save as", null);
                        }
                                                                                      ));

                        if (filePath == null || string.IsNullOrWhiteSpace(filePath))
                        {
                            return(OperationState.STOP);
                        }

                        string fileDir  = System.IO.Path.GetDirectoryName(filePath);
                        string fileName = System.IO.Path.GetFileName(filePath);
                        string fileNameWithoutExtension = System.IO.Path.GetFileNameWithoutExtension(filePath);

                        message = "Saving File as " + fileName;
                        action.ReportProgress(10, message);

                        Misp.Kernel.Domain.File file = this.GetFileInfoService().SaveAs(fileDir, fileName);
                        if (file == null)
                        {
                            return(OperationState.STOP);
                        }
                        this.ApplicationManager.File            = file;
                        this.ApplicationManager.AllocationCount = this.GetFileInfoService().GetAllocationCount();
                        System.Windows.Application.Current.Dispatcher.Invoke((Action)(() =>
                        {
                            ApplicationManager.MainWindow.Title = fileNameWithoutExtension + " - B-Cephal";
                        }
                                                                                      ));

                        message = "File saved as " + fileNameWithoutExtension;
                        action.ReportProgress(99, message);
                        UserPreferencesUtil.AddRecentFile(filePath);
                        System.Windows.Application.Current.Dispatcher.Invoke((Action)(() =>
                        {
                            ApplicationManager.MainWindow.MenuBar.GetFileMenu().BuildRecentOpenedFiles();
                            RefreshDashboard();
                        }
                                                                                      ));

                        message = "File " + fileNameWithoutExtension + " opened";
                        action.ReportProgress(100, message);
                    }
                    catch (BcephalException e)
                    {
                        MessageDisplayer.DisplayError("Saving file as ", e.Message);
                        action = null;
                        return(OperationState.STOP);
                    }
                    return(OperationState.CONTINUE);
                },

                EndWork = () =>
                {
                    return(OperationState.CONTINUE);
                },
            };
            action.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(ApplicationManager.MainWindow.OnBusyPropertyChanged);
            action.Run();
            return(OperationState.CONTINUE);
        }
Пример #8
0
        public void OpenOrCreate(string filePath, bool create)
        {
            try
            {
                ApplicationManager.MainWindow.IsBussy = true;
                bool isMonouser = ApplicationManager.ApplcationConfiguration.IsMonouser();

                if (isMonouser && !System.IO.File.Exists(filePath) && !create && ApplicationManager.useZip())
                {
                    MessageDisplayer.DisplayError("Error", "File not found: " + filePath);
                }
                else if (isMonouser && !System.IO.Directory.Exists(filePath) && !create && !ApplicationManager.useZip())
                {
                    MessageDisplayer.DisplayError("Error", "Directory not found: " + filePath);
                }
                else
                {
                    string fileDir  = System.IO.Path.GetDirectoryName(filePath);
                    string fileName = System.IO.Path.GetFileName(filePath);

                    Misp.Kernel.Domain.File file = create ?
                                                   this.GetFileInfoService().CreateFile(fileDir, fileName) :
                                                   this.GetFileInfoService().OpenFile(fileDir, fileName);

                    if (file != null)
                    {
                        this.ApplicationManager.File            = file;
                        this.ApplicationManager.AllocationCount = this.GetFileInfoService().GetAllocationCount();
                        Util.UserPreferencesUtil.AddRecentFile(filePath);
                        Util.UserPreferencesUtil.SetFileOpeningRepository(filePath);

                        string fileNameWithoutExtension = "";
                        if (filePath.EndsWith(FILE_EXTENSION))
                        {
                            fileNameWithoutExtension = System.IO.Path.GetFileNameWithoutExtension(filePath);
                        }
                        else
                        {
                            fileNameWithoutExtension = System.IO.Path.GetFileName(filePath);
                        }
                        ApplicationManager.MainWindow.Title = fileNameWithoutExtension + " - B-Cephal";
                        ApplicationManager.MainWindow.MenuBar.customizeForFileOpened();
                        this.ToolBar.DisplayAllControls();
                        ApplicationManager.MainWindow.MenuBar.GetFileMenu().lastFilePath = filePath;
                        ApplicationManager.MainWindow.MenuBar.GetFileMenu().BuildSaveAsMenu();
                        ApplicationManager.MainWindow.MenuBar.GetFileMenu().BuildRecentOpenedFiles();
                        ApplicationManager.MainWindow.MenuBar.GetFileMenu().BackupSimpleMenu.IsEnabled = true;
                        ApplicationManager.MainWindow.MenuBar.GetFileMenu().BackupAutomaticMenu.IsEnabled = true;
                        RefreshDashboard();
                    }
                }
            }
            catch (BcephalException e)
            {
                MessageDisplayer.DisplayError(create ? "Create file" : "Open file", e.Message);
            }
            finally
            {
                ApplicationManager.MainWindow.IsBussy = false;
            }
        }
Пример #9
0
        /// <summary>
        /// Display the page that corresponds to the history token
        /// If there is a valid history token, then navigate to the corresponding page
        /// otherwise open the home page
        /// </summary>
        /// <param name="token"></param>
        protected void OnOpenPage(object param)
        {
            NavigationToken token = (NavigationToken)param;
            Controllable    page  = null;

            try
            {
                string functionality = token.Functionality;
                if (functionality == FunctionalitiesCode.HELP_ABOUT)
                {
                    OpenAboutDialog(); return;
                }
                if (functionality == FunctionalitiesCode.LOAD_TABLES_AND_GRIDS)
                {
                    StartRunAllAllocation(); return;
                }
                if (functionality == FunctionalitiesCode.LOAD_CLEAR_TABLES_AND_GRIDS)
                {
                    StartClearAllAllocation(); return;
                }
                if (functionality == FunctionalitiesCode.LOAD_LOG)
                {
                    StartAllocationLog(); return;
                }
                if (functionality == FunctionalitiesCode.MULTIPLE_FILES_UPLOAD)
                {
                    UploadMultipleFiles(); return;
                }
                if (functionality == FunctionalitiesCode.PROPERTIES_FUNCTIONALITY)
                {
                    createProperties(); return;
                }
                if (functionality == FunctionalitiesCode.TRANSFORMATION_TREE_LOAD)
                {
                    LoadTransformationTrees(false); return;
                }
                if (functionality == FunctionalitiesCode.TRANSFORMATION_TREE_CLEAR)
                {
                    LoadTransformationTrees(true); return;
                }
                if (functionality == FunctionalitiesCode.FILE_SAVE)
                {
                    token.currentActiveFunctionality = ActivePage.FunctionalityCode;
                }
                if (functionality == FunctionalitiesCode.FILE_SAVE_AS)
                {
                    SaveFileAs(token); return;
                }
                if (functionality == FunctionalitiesCode.BACKUP_SIMPLE_FUNCTIONALITY || functionality == FunctionalitiesCode.BACKUP_AUTOMATIC_FUNCTIONALITY)
                {
                    bool isSimpleBackup = functionality == FunctionalitiesCode.BACKUP_SIMPLE_FUNCTIONALITY;
                    loadBackup(functionality, isSimpleBackup); return;
                }

                string            tag = token.GetTag();
                FunctionalityType functionalityType = token.FunctionalityType;
                ViewType          viewType          = token.ViewType;

                bool isMainFonctionality = functionalityType == FunctionalityType.MAIN_FONCTIONALITY;

                OperationState state = OperationState.CONTINUE;
                if (isMainFonctionality && !(ActivePage != null && ActivePage is FileController))
                {
                    string activefunctionality = ActivePage != null ? ActivePage.FunctionalityCode : null;
                    page = searchInOpenedPages(activefunctionality);
                    bool tryToSaveActivePage = page != null && activefunctionality != null && !activefunctionality.Equals(functionality);
                    state = tryToSaveActivePage ? page.Close() : OperationState.CONTINUE;

                    if (page != null && state == OperationState.CONTINUE)
                    {
                        OpenedPages.Remove(page);
                    }
                }
                else
                {
                }

                if (state == OperationState.CONTINUE)
                {
                    ApplicationManager.MainWindow.SetPogressBar1Visible(false);
                    ApplicationManager.MainWindow.SetPogressBar2Visible(false);
                    if (viewType == ViewType.LOGOUT)
                    {
                        tryToCloseApplication(); return;
                    }
                    else if (viewType == ViewType.EDITION)
                    {
                        this.openEditionPage(token);
                        if (!String.IsNullOrEmpty(InternalErrorMessage))
                        {
                            MessageDisplayer.DisplayError("Error", InternalErrorMessage);
                            InternalErrorMessage = null;
                        }
                    }
                    else
                    {
                        openSearchPage(token);
                    }
                }
            }
            catch (Exception e)
            {
                MessageDisplayer.DisplayError("Error", e.Message);
                return;
            }
            return;
        }
Пример #10
0
        /// <summary>
        /// Start server
        /// </summary>
        public bool StartServer()
        {
            logger.Info("Server starting...");
            try
            {
                bool serverAlive = ControllerFactory.ServiceFactory.GetFileService().IsServerAlive();
                if (serverAlive)
                {
                    return(true);
                }

                int heap = 0;
                if (string.IsNullOrWhiteSpace(ServerStartCmd))
                {
                    this.ServerStartCmd = DEFAULT_SERVER_START_CMD;
                }
                String[] args      = this.ServerStartCmd.Split(' ');
                String   java      = null;
                int      javaIndex = -1;
                for (int i = 0; i < args.Length; i++)
                {
                    if (!args[i].Contains("java.exe") && !args[i].Contains("javaw.exe"))
                    {
                        continue;
                    }
                    javaIndex = i;
                    java      = args[i];
                    break;
                }

                if (ServerStartCmd.Contains("-Xmx"))
                {
                    String ServerMaxHeap = null;
                    int    heapIndex     = -1;
                    for (int i = 0; i < args.Length; i++)
                    {
                        if (!args[i].Contains("-Xmx"))
                        {
                            continue;
                        }
                        heapIndex     = i;
                        ServerMaxHeap = args[i];
                        break;
                    }

                    if (!string.IsNullOrWhiteSpace(ServerMaxHeap))
                    {
                        ServerMaxHeap = ServerMaxHeap.Trim();
                        if (ServerMaxHeap.EndsWith("M", StringComparison.CurrentCultureIgnoreCase))
                        {
                            ServerMaxHeap = ServerMaxHeap.Remove(ServerMaxHeap.Length - 1);
                        }
                        if (ServerMaxHeap.StartsWith("-Xmx", StringComparison.CurrentCultureIgnoreCase))
                        {
                            ServerMaxHeap = ServerMaxHeap.Remove(0, 4);
                        }
                        if (!int.TryParse(ServerMaxHeap, out heap) || heap <= 0)
                        {
                            String error = "Parameter 'server_max_heap' has a wrong value!";
                            logger.Error(error);
                            MessageDisplayer.DisplayError("Unable to start Bcephal", error);
                            return(false);
                        }

                        int set = 50;
                        if (heap > 0)
                        {
                            for (int h = heap; h >= 100; h -= set)
                            {
                                args[javaIndex] = "";
                                args[heapIndex] = "-Xmx" + h + "M";
                                string arg = "";
                                for (int i = 0; i < args.Length; i++)
                                {
                                    arg += args[i] + " ";
                                }
                                arg         = arg.Trim();
                                serverAlive = startServerProcess(java, arg);
                                if (serverAlive)
                                {
                                    return(true);
                                }
                            }
                        }
                    }
                    MessageDisplayer.DisplayError("Unable to start Bcephal", "There is not enough free memory to run Bcephal.\nPlease close some applications and try again.");
                    logger.Debug("Server start fail!");
                    return(false);
                }
                else
                {
                    args[javaIndex] = "";
                    string arg = "";
                    for (int i = 0; i < args.Length; i++)
                    {
                        arg += args[i] + " ";
                    }
                    arg = arg.Trim();

                    serverAlive = startServerProcess(java, arg);
                    if (serverAlive)
                    {
                        return(true);
                    }
                    MessageDisplayer.DisplayError("Unable to start Bcephal", "Unable to start Bcephal!\nSee logs for more information.");
                    logger.Error("Unable to start Bcephal server!");
                    return(false);
                }
            }
            catch (Exception e)
            {
                MessageDisplayer.DisplayError("Unable to start Bcephal", "Unable to start Bcephal!\nSee logs for more information.");
                logger.Error("Unable to start Bcephal server!", e);
                return(false);
            }
        }