Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/19/09 17:47:13 (15 years ago)
Author:
gkronber
Message:

Worked on command line interface for plugin management. #799

Location:
branches/PluginInfrastructure Refactoring/HeuristicLab
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/PluginInfrastructure Refactoring/HeuristicLab/HeuristicLab.csproj

    r2504 r2513  
    66    <SchemaVersion>2.0</SchemaVersion>
    77    <ProjectGuid>{623FB817-8371-4A9A-A491-4DECC87B2BBB}</ProjectGuid>
    8     <OutputType>WinExe</OutputType>
     8    <OutputType>Exe</OutputType>
    99    <AppDesignerFolder>Properties</AppDesignerFolder>
    1010    <RootNamespace>HeuristicLab</RootNamespace>
     
    2020    <RunPostBuildEvent>Always</RunPostBuildEvent>
    2121    <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
     22    <StartupObject>
     23    </StartupObject>
    2224  </PropertyGroup>
    2325  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
  • branches/PluginInfrastructure Refactoring/HeuristicLab/Program.cs

    r2508 r2513  
    2626using System.Threading;
    2727using System.Text;
     28using System.Linq;
    2829using HeuristicLab.PluginInfrastructure;
     30using HeuristicLab.PluginInfrastructure.Advanced;
    2931
    3032namespace HeuristicLab {
     
    3234    [STAThread]
    3335    static void Main(string[] args) {
    34       try {
    35         if (args.Length == 0) {  // normal mode
     36      if (args.Length == 0) {  // normal mode
     37        try {
    3638          Application.EnableVisualStyles();
    3739          Application.SetCompatibleTextRenderingDefault(false);
    3840          Application.Run(new StarterForm());
    39         } else if (args[0].ToUpperInvariant() == "START") {  // start specific application
    40           if (args.Length != 2) {
    41             Console.WriteLine("Usage: HeuristicLab.exe start <application name>");
    42           } else {
    43             Application.EnableVisualStyles();
    44             Application.SetCompatibleTextRenderingDefault(false);
    45             Application.Run(new StarterForm(args[1]));
    46           }
     41        }
     42        catch (Exception ex) {
     43          ShowErrorMessageBox(ex);
     44        }
     45
     46      } else {
     47        var cmd = args[0].ToUpperInvariant();
     48        switch (cmd) {
     49          case "START": {
     50              if (args.Length != 2) {
     51                PrintUsage();
     52              } else {
     53                Application.EnableVisualStyles();
     54                Application.SetCompatibleTextRenderingDefault(false);
     55                Application.Run(new StarterForm(args[1]));
     56              }
     57              break;
     58            }
     59          case "SHOW": {
     60              InstallationManager manager = new InstallationManager();
     61              foreach (string info in manager.Show(args.Skip(1))) {
     62                Console.WriteLine(info);
     63              }
     64              break;
     65            }
     66          case "INSTALL": {
     67              InstallationManager manager = new InstallationManager();
     68              manager.Install(args.Skip(1));
     69              break;
     70            }
     71          case "UPDATE": {
     72              InstallationManager manager = new InstallationManager();
     73              manager.Update(args.Skip(1));
     74              break;
     75            }
     76          case "REMOVE": {
     77              InstallationManager manager = new InstallationManager();
     78              manager.Remove(args.Skip(1));
     79              break;
     80            }
     81          default: PrintUsage(); break;
    4782        }
    4883      }
    49       catch (Exception ex) {
    50         ShowErrorMessageBox(ex);
    51       }
     84    }
     85
     86    private static void PrintUsage() {
     87      Console.WriteLine("Usage: HeuristicLab.exe <command> <args>");
     88      Console.WriteLine("Commands:");
     89      Console.WriteLine("\tstart <application name>");
     90      Console.WriteLine("\tshow <plugin name(s)>");
     91      Console.WriteLine("\tupdate <plugin name(s)>");
     92      Console.WriteLine("\tremove <plugin name(s)>");
     93      Console.WriteLine("\tinstall <plugin name(s)>");
    5294    }
    5395
Note: See TracChangeset for help on using the changeset viewer.