static int Main(string[] args) { OpenEngSBConnectionManager.initInstance(xlinkServerURL, domainId, programname, hostIp, classNameOfOpenEngSBModel, openengsbContext); openengsbConnectionManager = OpenEngSBConnectionManager.getInstance(); directoryBrowser = new DirectoryBrowser(); if (args.Length < 1) { exitProgramWithError("Missing Parameter\nUsage: " + programname + " {workingDirectory}"); } if (!directoryBrowser.setWorkingDirectory(args[0])) { exitProgramWithError("Supplied Path \"" + args[0] + "\" is not a directory."); } openengsbContext = args[1]; printWelcomeInformation(); connectToOpenEngSBAndRegisterForXLink(); outputLine("Insert your command:"); String line; while ((line = Console.ReadLine()) != null) { if (line.StartsWith("changeWD")) { string[] lineParams = line.Split(' '); if (lineParams.Length < 2) { outputLine("changeWD <directoryPath> - directoryPath is missing"); continue; } string param = lineParams[1]; if (directoryBrowser.setWorkingDirectory(param)) { outputLine("WorkingDirectory changed."); directoryBrowser.reloadListOfWorkingDirectoryFiles(); } } else if (line.Equals("displayWD")) { directoryBrowser.displayWorkingDirectory(); } else if (line.Equals("help")) { processHelp(); } else if (line.StartsWith("changeFT")) { string[] lineParams = line.Split(' '); if (lineParams.Length < 2) { outputLine("changeFT <filetype> - filetype is missing"); continue; } directoryBrowser.changeFileType(lineParams[1]); } else if (line.Equals("displayFT")) { directoryBrowser.displaySupportedFileTypes(); } else if (line.Equals("displaySupportedFT")) { directoryBrowser.displaySupportedFileTypes(); } else if (line.Equals("list")) { directoryBrowser.displayListOfWorkingDirectoryFiles(); } else if (line.Equals("reload")) { directoryBrowser.reloadListOfWorkingDirectoryFiles(); } else if (line.StartsWith("open")) { string[] lineParams = line.Split(' '); if (lineParams.Length < 2) { outputLine("open <filename> - filename is missing"); continue; } directoryBrowser.openFile(lineParams[1]); } else if (line.StartsWith("exit")) { break; } else if (line.StartsWith("xlink")) { if (!openengsbConnectionManager.isConnected()) { outputLine("No connection to the OpenEngSB."); continue; } string[] lineParams = line.Split(' '); if (lineParams.Length < 2) { outputLine("xlink <filename> - filename is missing"); continue; } directoryBrowser.createXLinkFromFileString(lineParams[1]); } else if (line.Equals("listLocalSwitch")) { if (!openengsbConnectionManager.isConnected()) { outputLine("No connection to the OpenEngSB."); continue; } openengsbConnectionManager.listOtherLocalInstalledSoftwareTools(); } else if (line.StartsWith("localSwitch")) { if (!openengsbConnectionManager.isConnected()) { outputLine("No connection to the OpenEngSB."); continue; } string[] lineParams = line.Split(' '); if (lineParams.Length < 4) { outputLine("missin parameters. Insert 'help' for usage."); continue; } openengsbConnectionManager.triggerLocalSwitch(lineParams[1], lineParams[2], lineParams[3]); } else { outputLine("Unknown command \"" + line + "\".\nType \"help\" to list all commands."); } outputLine("\nInsert your command:"); } exitProgramWithSucces(); return(0); }