Free cookie consent management tool by TermsFeed Policy Generator

Changeset 2513


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
Files:
2 added
7 edited

Legend:

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

    r2507 r2513  
    8686  </ItemGroup>
    8787  <ItemGroup>
     88    <Compile Include="Advanced\InstallationManager.cs" />
    8889    <Compile Include="Attributes\ApplicationAttribute.cs" />
    8990    <Compile Include="Attributes\AssemblyBuildDateAttribute.cs" />
  • branches/PluginInfrastructure Refactoring/HeuristicLab.PluginInfrastructure/Manager/PluginDescription.cs

    r2504 r2513  
    4040      get { return name; }
    4141      internal set { name = value; }
     42    }
     43
     44    private string description;
     45    /// <summary>
     46    /// Gets or sets the description of the plugin.
     47    /// </summary>
     48    public string Description {
     49      get { return description; }
     50      internal set { description = value; }
    4251    }
    4352    private Version version;
  • branches/PluginInfrastructure Refactoring/HeuristicLab.PluginInfrastructure/Manager/PluginManager.cs

    r2504 r2513  
    4444
    4545    private List<PluginDescription> plugins;
     46    /// <summary>
     47    /// Gets all installed plugins.
     48    /// </summary>
     49    internal IEnumerable<PluginDescription> Plugins {
     50      get { return plugins; }
     51    }
    4652
    4753    private List<ApplicationDescription> applications;
  • branches/PluginInfrastructure Refactoring/HeuristicLab.PluginInfrastructure/Manager/PluginValidator.cs

    r2504 r2513  
    193193      List<string> pluginFiles = new List<string>();
    194194      string pluginName = null;
     195      string pluginDescription = null;
    195196      // iterate through all custom attributes and search for attributed that we are interested in
    196197      foreach (CustomAttributeData attributeData in attributes) {
    197198        if (IsAttributeDataForType(attributeData, typeof(PluginAttribute))) {
    198199          pluginName = (string)attributeData.ConstructorArguments[0].Value;
     200          if (attributeData.ConstructorArguments.Count() == 2) {
     201            pluginDescription = (string)attributeData.ConstructorArguments[1].Value;
     202          } else pluginDescription = pluginName;
    199203        } else if (IsAttributeDataForType(attributeData, typeof(PluginDependencyAttribute))) {
    200204          pluginDependencies.Add((string)attributeData.ConstructorArguments[0].Value);
     
    214218
    215219      // minimal sanity check of the attribute values
    216       if (!string.IsNullOrEmpty(pluginName) &&
     220      if (!string.IsNullOrEmpty(pluginName) && !string.IsNullOrEmpty(pluginDescription) &&
    217221          pluginFiles.Count > 0 &&
    218222          pluginAssemblies.Count > 0 &&
     
    221225        PluginDescription info = new PluginDescription();
    222226        info.Name = pluginName;
     227        info.Description = pluginDescription;
    223228        info.Version = pluginType.Assembly.GetName().Version;
    224229        info.BuildDate = DateTime.Parse(buildDates.Single(), System.Globalization.CultureInfo.InvariantCulture);
  • branches/PluginInfrastructure Refactoring/HeuristicLab.PluginInfrastructure/Starter/StarterForm.cs

    r2507 r2513  
    7171        applicationsListView.Items.Add(item);
    7272      }
    73 
    74 
    75       this.Enabled = true;
    76       this.Visible = true;
    7773    }
    7874
  • 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.