Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/16/13 13:13:41 (12 years ago)
Author:
spimming
Message:

#1888:

  • Merged revisions from trunk
Location:
branches/OaaS
Files:
17 edited
2 copied

Legend:

Unmodified
Added
Removed
  • branches/OaaS

  • branches/OaaS/HeuristicLab.PluginInfrastructure/3.3/Advanced/DeploymentService/DeploymentServerCertificateValidator.cs

    r4068 r9363  
    1 using System;
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     4 *
     5 * This file is part of HeuristicLab.
     6 *
     7 * HeuristicLab is free software: you can redistribute it and/or modify
     8 * it under the terms of the GNU General Public License as published by
     9 * the Free Software Foundation, either version 3 of the License, or
     10 * (at your option) any later version.
     11 *
     12 * HeuristicLab is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU General Public License
     18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
     19 */
     20#endregion
     21
     22using System;
    223using System.IdentityModel.Selectors;
    324using System.IdentityModel.Tokens;
  • branches/OaaS/HeuristicLab.PluginInfrastructure/3.3/BaseClasses/ApplicationBase.cs

    r7259 r9363  
    6767    /// Runs the application.
    6868    /// </summary>
    69     public abstract void Run();
     69    public abstract void Run(ICommandLineArgument[] args);
    7070
    7171    #endregion
  • branches/OaaS/HeuristicLab.PluginInfrastructure/3.3/ErrorHandling/ErrorHandling.cs

    r7259 r9363  
    2121
    2222using System;
     23using System.Diagnostics;
    2324using System.Windows.Forms;
    2425
     
    2930        return string.Empty;
    3031      } else {
    31         string message = exception.GetType().Name + ": " + exception.Message + Environment.NewLine +
     32        string message =
     33          "HeuristicLab version: " + FileVersionInfo.GetVersionInfo(typeof(ErrorHandling).Assembly.Location).FileVersion + Environment.NewLine +
     34          exception.GetType().Name + ": " + exception.Message + Environment.NewLine +
    3235                         exception.StackTrace;
    3336
  • branches/OaaS/HeuristicLab.PluginInfrastructure/3.3/ErrorHandling/FrameworkVersionErrorDialog.Designer.cs

    r7967 r9363  
    4949      this.linkLabel = new System.Windows.Forms.LinkLabel();
    5050      this.label = new System.Windows.Forms.Label();
     51      this.linkLabelMono = new System.Windows.Forms.LinkLabel();
    5152      this.SuspendLayout();
    5253      //
    5354      // iconLabel
    5455      //
    55       this.iconLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    56                   | System.Windows.Forms.AnchorStyles.Left)));
     56      this.iconLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
     57            | System.Windows.Forms.AnchorStyles.Left)));
    5758      this.iconLabel.Image = global::HeuristicLab.PluginInfrastructure.Resources.Error;
    5859      this.iconLabel.ImageAlign = System.Drawing.ContentAlignment.TopLeft;
    5960      this.iconLabel.Location = new System.Drawing.Point(12, 9);
    6061      this.iconLabel.Name = "iconLabel";
    61       this.iconLabel.Size = new System.Drawing.Size(50, 98);
     62      this.iconLabel.Size = new System.Drawing.Size(50, 121);
    6263      this.iconLabel.TabIndex = 0;
    6364      //
     
    6667      this.closeButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
    6768      this.closeButton.DialogResult = System.Windows.Forms.DialogResult.OK;
    68       this.closeButton.Location = new System.Drawing.Point(294, 81);
     69      this.closeButton.Location = new System.Drawing.Point(294, 104);
    6970      this.closeButton.Name = "closeButton";
    7071      this.closeButton.Size = new System.Drawing.Size(75, 23);
     
    7677      // linkLabel
    7778      //
    78       this.linkLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    79                   | System.Windows.Forms.AnchorStyles.Left)
    80                   | System.Windows.Forms.AnchorStyles.Right)));
     79      this.linkLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
     80            | System.Windows.Forms.AnchorStyles.Left)
     81            | System.Windows.Forms.AnchorStyles.Right)));
    8182      this.linkLabel.Location = new System.Drawing.Point(68, 52);
    8283      this.linkLabel.Name = "linkLabel";
    83       this.linkLabel.Size = new System.Drawing.Size(301, 26);
     84      this.linkLabel.Size = new System.Drawing.Size(301, 49);
    8485      this.linkLabel.TabIndex = 2;
    8586      this.linkLabel.TabStop = true;
     
    8990      // label
    9091      //
    91       this.label.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    92                   | System.Windows.Forms.AnchorStyles.Right)));
     92      this.label.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
     93            | System.Windows.Forms.AnchorStyles.Right)));
    9394      this.label.Location = new System.Drawing.Point(68, 9);
    9495      this.label.Name = "label";
    9596      this.label.Size = new System.Drawing.Size(301, 43);
    9697      this.label.TabIndex = 1;
    97       this.label.Text = "The Microsoft .NET Framework 4 (Full Profile) is not properly installed on your s" +
    98           "ystem. Please download and install it.";
     98      this.label.Text = "To run HeuristicLab you need at least the Microsoft .NET Framework 4 (Full Profil" +
     99    "e) or Mono version 2.11.4 or higher. Please download and install it.";
     100      //
     101      // linkLabelMono
     102      //
     103      this.linkLabelMono.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     104            | System.Windows.Forms.AnchorStyles.Left)
     105            | System.Windows.Forms.AnchorStyles.Right)));
     106      this.linkLabelMono.Location = new System.Drawing.Point(68, 72);
     107      this.linkLabelMono.Name = "linkLabelMono";
     108      this.linkLabelMono.Size = new System.Drawing.Size(301, 16);
     109      this.linkLabelMono.TabIndex = 4;
     110      this.linkLabelMono.TabStop = true;
     111      this.linkLabelMono.Text = "Download Mono";
     112      this.linkLabelMono.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabelMono_LinkClicked);
    99113      //
    100114      // FrameworkVersionErrorDialog
    101115      //
    102116      this.AcceptButton = this.closeButton;
    103       this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    104117      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
    105118      this.CancelButton = this.closeButton;
    106       this.ClientSize = new System.Drawing.Size(381, 116);
     119      this.ClientSize = new System.Drawing.Size(381, 139);
     120      this.Controls.Add(this.linkLabelMono);
    107121      this.Controls.Add(this.label);
    108122      this.Controls.Add(this.linkLabel);
     
    127141    private System.Windows.Forms.LinkLabel linkLabel;
    128142    private System.Windows.Forms.Label label;
     143    private System.Windows.Forms.LinkLabel linkLabelMono;
    129144  }
    130145}
  • branches/OaaS/HeuristicLab.PluginInfrastructure/3.3/ErrorHandling/FrameworkVersionErrorDialog.cs

    r7259 r9363  
    88 * it under the terms of the GNU General Public License as published by
    99 * the Free Software Foundation, either version 3 of the License, or
    10   * (at your option) any later version.
    11   *
    12   * HeuristicLab is distributed in the hope that it will be useful,
    13   * but WITHOUT ANY WARRANTY; without even the implied warranty of
    14   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    15   * GNU General Public License for more details.
    16   *
    17   * You should have received a copy of the GNU General Public License
    18   * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
    19   */
     10  * (at your option) any later version.
     11  *
     12  * HeuristicLab is distributed in the hope that it will be useful,
     13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15  * GNU General Public License for more details.
     16  *
     17  * You should have received a copy of the GNU General Public License
     18  * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
     19  */
    2020#endregion
    2121
    2222using System;
     23using System.Reflection;
    2324using System.Windows.Forms;
    2425
     
    2627  public partial class FrameworkVersionErrorDialog : Form {
    2728    public static bool NET4FullProfileInstalled {
    28       get { return Microsoft.Win32.Registry.LocalMachine.OpenSubKey("Software\\Microsoft\\NET Framework Setup\\NDP\\v4\\Full") != null; }
     29      get {
     30        try {
     31          return Microsoft.Win32.Registry.LocalMachine.OpenSubKey("Software\\Microsoft\\NET Framework Setup\\NDP\\v4\\Full") != null;
     32        }
     33        catch (System.Security.SecurityException) {
     34          return false;
     35        }
     36      }
     37    }
     38
     39    public static bool MonoInstalled {
     40      get { return Type.GetType("Mono.Runtime") != null; }
     41    }
     42
     43    public static bool MonoCorrectVersionInstalled {
     44      get {
     45        var monoVersion = MonoVersion;
     46        var minRequiredVersion = new Version(2, 11, 4);
     47                                                                     
     48        //we need at least mono version 2.11.4
     49        if (monoVersion != null && monoVersion >= minRequiredVersion) {
     50          return true;
     51        } else {
     52          return false;
     53        }
     54      }
     55    }
     56
     57    public static Version MonoVersion {
     58      get {
     59        Type type = Type.GetType("Mono.Runtime");
     60        if (type != null) {
     61          MethodInfo dispalayName = type.GetMethod("GetDisplayName", BindingFlags.NonPublic | BindingFlags.Static);
     62          if (dispalayName != null) {
     63            string versionString = dispalayName.Invoke(null, null) as string;
     64            if (versionString != null) {
     65              // the version string looks something like: 2.11.4 (master/99d5e54 Thu Sep  6 15:55:44 CEST 2012)
     66              var subVerStrings = versionString.Split(' ');
     67              if (subVerStrings.Length > 0) {
     68                try {
     69                  return Version.Parse(subVerStrings[0]);
     70                }
     71                catch { }
     72              }
     73            }
     74          }
     75        }
     76        return null;
     77      }
    2978    }
    3079
     
    4493      Application.Exit();
    4594    }
     95
     96    private void linkLabelMono_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) {
     97      try {
     98        System.Diagnostics.Process.Start("http://www.mono-project.org");
     99        linkLabelMono.LinkVisited = true;
     100      }
     101      catch (Exception) { }
     102    }
    46103  }
    47104}
  • branches/OaaS/HeuristicLab.PluginInfrastructure/3.3/HeuristicLab.PluginInfrastructure-3.3.csproj

    r8506 r9363  
    102102  </PropertyGroup>
    103103  <ItemGroup>
    104     <Reference Include="ICSharpCode.SharpZipLib, Version=0.85.4.369, Culture=neutral, PublicKeyToken=1b03e6acf1164f73, processorArchitecture=MSIL">
    105       <Private>False</Private>
    106     </Reference>
    107104    <Reference Include="System" />
    108     <Reference Include="System.Core">
    109       <RequiredTargetFramework>3.5</RequiredTargetFramework>
    110     </Reference>
     105    <Reference Include="System.Core" />
    111106    <Reference Include="System.Data" />
    112107    <Reference Include="System.Deployment" />
    113108    <Reference Include="System.Drawing" />
    114     <Reference Include="System.IdentityModel">
    115       <RequiredTargetFramework>3.0</RequiredTargetFramework>
    116     </Reference>
    117     <Reference Include="System.Runtime.Serialization">
    118       <RequiredTargetFramework>3.0</RequiredTargetFramework>
    119     </Reference>
    120     <Reference Include="System.ServiceModel">
    121       <RequiredTargetFramework>3.0</RequiredTargetFramework>
    122     </Reference>
     109    <Reference Include="System.IdentityModel" />
     110    <Reference Include="System.Runtime.Serialization" />
     111    <Reference Include="System.ServiceModel" />
    123112    <Reference Include="System.Windows.Forms" />
    124113    <Reference Include="System.Xml" />
     114    <Reference Include="ICSharpCode.SharpZipLib">
     115      <HintPath>ICSharpCode.SharpZipLib.dll</HintPath>
     116    </Reference>
    125117  </ItemGroup>
    126118  <ItemGroup>
     
    223215      <DependentUpon>PluginView.cs</DependentUpon>
    224216    </Compile>
     217    <Compile Include="CommandLineArgumentHandling\Arguments\OpenArgument.cs" />
     218    <Compile Include="CommandLineArgumentHandling\Arguments\HideStarterArgument.cs" />
     219    <Compile Include="CommandLineArgumentHandling\Arguments\StartArgument.cs" />
     220    <Compile Include="CommandLineArgumentHandling\CommandLineArgument.cs" />
     221    <Compile Include="CommandLineArgumentHandling\CommandLineArgumentHandling.cs" />
     222    <Compile Include="CommandLineArgumentHandling\ICommandLineArgument.cs" />
    225223    <Compile Include="Attributes\ApplicationAttribute.cs" />
    226224    <Compile Include="Attributes\ContactInformationAttribute.cs" />
     
    270268    <Compile Include="Main.cs" />
    271269    <Compile Include="Properties\AssemblyInfo.cs" />
     270    <Compile Include="TypeExtensions.cs" />
    272271    <None Include="Advanced\DeploymentService\GenerateServiceClients.cmd" />
    273272    <None Include="app.config">
     
    374373  -->
    375374  <PropertyGroup>
    376     <PreBuildEvent>set Path=%25Path%25;$(ProjectDir);$(SolutionDir)
     375    <PreBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">set Path=%25Path%25;$(ProjectDir);$(SolutionDir)
    377376set ProjectDir=$(ProjectDir)
    378377set SolutionDir=$(SolutionDir)
     
    380379
    381380call PreBuildEvent.cmd</PreBuildEvent>
     381    <PreBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
     382export ProjectDir=$(ProjectDir)
     383export SolutionDir=$(SolutionDir)
     384
     385$SolutionDir/PreBuildEvent.sh
     386</PreBuildEvent>
    382387  </PropertyGroup>
    383388</Project>
  • branches/OaaS/HeuristicLab.PluginInfrastructure/3.3/Interfaces/IApplication.cs

    r7259 r9363  
    3737    /// Main entry point for the application.
    3838    /// </summary>
    39     void Run();
     39    void Run(ICommandLineArgument[] args);
    4040  }
    4141}
  • branches/OaaS/HeuristicLab.PluginInfrastructure/3.3/LightweightApplicationManager.cs

    r7662 r9363  
    7575      foreach (Type t in GetTypes(type)) {
    7676        object instance = null;
    77         try { instance = Activator.CreateInstance(t); } catch { }
     77        try { instance = Activator.CreateInstance(t); }
     78        catch { }
    7879        if (instance != null) instances.Add(instance);
    7980      }
     
    127128        var assemblyTypes = assembly.GetTypes();
    128129
    129         var buildTypes = from t in assembly.GetTypes()
    130                          where CheckTypeCompatibility(type, t)
    131                          where !IsNonDiscoverableType(t)
    132                          where onlyInstantiable == false ||
    133                                (!t.IsAbstract && !t.IsInterface && !t.HasElementType)
    134                          select BuildType(t, type);
     130        var matchingTypes = from assemblyType in assembly.GetTypes()
     131                            let t = assemblyType.BuildType(type)
     132                            where t != null
     133                            where t.IsSubTypeOf(type)
     134                            where !t.IsNonDiscoverableType()
     135                            where onlyInstantiable == false || (!t.IsAbstract && !t.IsInterface && !t.HasElementType)
     136                            where includeGenericTypeDefinitions || !t.IsGenericTypeDefinition
     137                            select t;
    135138
    136         return from t in buildTypes
    137                where includeGenericTypeDefinitions || !t.IsGenericTypeDefinition
    138                select t;
    139       } catch (TypeLoadException) {
    140         return Enumerable.Empty<Type>();
    141       } catch (ReflectionTypeLoadException) {
     139        return matchingTypes;
     140      }
     141      catch (TypeLoadException) {
    142142        return Enumerable.Empty<Type>();
    143143      }
    144     }
    145 
    146     private static bool IsNonDiscoverableType(Type t) {
    147       return t.GetCustomAttributes(typeof(NonDiscoverableTypeAttribute), false).Any();
    148     }
    149 
    150     private static bool CheckTypeCompatibility(Type type, Type other) {
    151       if (type.IsAssignableFrom(other))
    152         return true;
    153       if (type.IsGenericType && other.IsGenericType) {
    154         var otherGenericArguments = other.GetGenericArguments();
    155         var typeGenericArguments = type.GetGenericArguments();
    156 
    157         //check type arguments count
    158         if (otherGenericArguments.Length != typeGenericArguments.Length)
    159           return false;
    160 
    161         //check type arguments & constraints
    162         int i = 0;
    163         foreach (var genericArgument in typeGenericArguments) {
    164           if (otherGenericArguments[i].IsGenericParameter) {
    165             foreach (var constraint in otherGenericArguments[i].GetGenericParameterConstraints())
    166               if (!constraint.IsAssignableFrom(genericArgument)) return false;
    167           } else if (genericArgument != otherGenericArguments[i]) return false;
    168           i++;
    169         }
    170         //check types
    171         try {
    172           var otherGenericTypeDefinition = other.GetGenericTypeDefinition();
    173           if (type.IsAssignableFrom(otherGenericTypeDefinition.MakeGenericType(typeGenericArguments)))
    174             return true;
    175         } catch (Exception) { }
     144      catch (ReflectionTypeLoadException) {
     145        return Enumerable.Empty<Type>();
    176146      }
    177       return false;
    178     }
    179     private static Type BuildType(Type type, Type protoType) {
    180       if (type.IsGenericType && protoType.IsGenericType)
    181         return type.GetGenericTypeDefinition().MakeGenericType(protoType.GetGenericArguments());
    182       else
    183         return type;
    184147    }
    185148
  • branches/OaaS/HeuristicLab.PluginInfrastructure/3.3/Main.cs

    r7259 r9363  
    3434    /// <param name="args">Command line arguments</param>
    3535    public static void Run(string[] args) {
    36       if (!FrameworkVersionErrorDialog.NET4FullProfileInstalled) {
     36      if ((!FrameworkVersionErrorDialog.NET4FullProfileInstalled && !FrameworkVersionErrorDialog.MonoInstalled)
     37        || (FrameworkVersionErrorDialog.MonoInstalled && !FrameworkVersionErrorDialog.MonoCorrectVersionInstalled)) {
    3738        Application.EnableVisualStyles();
    3839        Application.SetCompatibleTextRenderingDefault(false);
     
    4243          Application.EnableVisualStyles();
    4344          Application.SetCompatibleTextRenderingDefault(false);
    44           Application.Run(new StarterForm());
     45          Application.Run(new StarterForm(args));
    4546        }
    4647        catch (Exception ex) {
  • branches/OaaS/HeuristicLab.PluginInfrastructure/3.3/Manager/PluginManager.cs

    r7259 r9363  
    110110    /// </summary>
    111111    /// <param name="appInfo">application to run</param>
    112     public void Run(ApplicationDescription appInfo) {
     112    public void Run(ApplicationDescription appInfo, ICommandLineArgument[] args) {
    113113      if (!initialized) throw new InvalidOperationException("PluginManager is not initialized. DiscoverAndCheckPlugins() must be called before Run()");
    114114      // create a separate AppDomain for the application
     
    129129        applicationManager.PrepareApplicationDomain(applications, plugins);
    130130        OnApplicationStarted(new PluginInfrastructureEventArgs(appInfo));
    131         applicationManager.Run(appInfo);
     131        applicationManager.Run(appInfo, args);
    132132      }
    133133      finally {
  • branches/OaaS/HeuristicLab.PluginInfrastructure/3.3/Properties/AssemblyInfo.cs.frame

    r7259 r9363  
    5656//
    5757[assembly: AssemblyVersion("3.3.0.0")]
    58 [assembly: AssemblyFileVersion("3.3.6.$WCREV$")]
     58[assembly: AssemblyFileVersion("3.3.7.$WCREV$")]
  • branches/OaaS/HeuristicLab.PluginInfrastructure/3.3/Resources.resx

    r6413 r9363  
    123123  </data>
    124124  <data name="ArrowUp" type="System.Resources.ResXFileRef, System.Windows.Forms">
    125     <value>Resources\vs2008imagelibrary_commonelements_objects_arrow_up.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
     125    <value>Resources\VS2008ImageLibrary_CommonElements_Objects_Arrow_Up.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
    126126  </data>
    127127  <data name="Assembly" type="System.Resources.ResXFileRef, System.Windows.Forms">
    128     <value>Resources\vs2008imagelibrary_objects_assembly.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
     128    <value>Resources\VS2008ImageLibrary_Objects_Assembly.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
    129129  </data>
    130130  <data name="Document" type="System.Resources.ResXFileRef, System.Windows.Forms">
     
    150150  </data>
    151151  <data name="Install" type="System.Resources.ResXFileRef, System.Windows.Forms">
    152     <value>Resources\vs2008imagelibrary_objects_install.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
     152    <value>Resources\VS2008ImageLibrary_Objects_Install.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
    153153  </data>
    154154  <data name="Internet" type="System.Resources.ResXFileRef, System.Windows.Forms">
     
    195195  </data>
    196196  <data name="UpdateAvailable" type="System.Resources.ResXFileRef, System.Windows.Forms">
    197     <value>resources\updateavailable.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
     197    <value>Resources\UpdateAvailable.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
    198198  </data>
    199199</root>
  • branches/OaaS/HeuristicLab.PluginInfrastructure/3.3/SandboxApplicationManager.cs

    r7586 r9363  
    115115    /// </summary>
    116116    /// <param name="appInfo">Description of the application to run</param>
    117     internal void Run(ApplicationDescription appInfo) {
     117    internal void Run(ApplicationDescription appInfo, ICommandLineArgument[] args) {
    118118      IApplication runnablePlugin = (IApplication)Activator.CreateInstance(appInfo.DeclaringAssemblyName, appInfo.DeclaringTypeName).Unwrap();
    119119      try {
    120         runnablePlugin.Run();
     120        runnablePlugin.Run(args);
    121121      }
    122122      finally {
     
    261261    /// <returns>Enumerable of the discovered types.</returns>
    262262    private static IEnumerable<Type> GetTypes(Type type, Assembly assembly, bool onlyInstantiable, bool includeGenericTypeDefinitions) {
    263       var buildTypes = from t in assembly.GetTypes()
    264                        where CheckTypeCompatibility(type, t)
    265                        where !IsNonDiscoverableType(t)
    266                        where onlyInstantiable == false ||
    267                              (!t.IsAbstract && !t.IsInterface && !t.HasElementType)
    268                        select BuildType(t, type);
    269 
    270       return from t in buildTypes
    271              where includeGenericTypeDefinitions || !t.IsGenericTypeDefinition
    272              select t;
    273     }
    274 
    275 
    276     private static bool IsNonDiscoverableType(Type t) {
    277       return t.GetCustomAttributes(typeof(NonDiscoverableTypeAttribute), false).Any();
    278     }
    279 
    280     private static bool CheckTypeCompatibility(Type type, Type other) {
    281       if (type.IsAssignableFrom(other))
    282         return true;
    283       if (type.IsGenericType && other.IsGenericType) {
    284         var otherGenericArguments = other.GetGenericArguments();
    285         var typeGenericArguments = type.GetGenericArguments();
    286 
    287         //check type arguments count
    288         if (otherGenericArguments.Length != typeGenericArguments.Length)
    289           return false;
    290 
    291         //check type arguments & constraints
    292         int i = 0;
    293         foreach (var genericArgument in typeGenericArguments) {
    294           if (otherGenericArguments[i].IsGenericParameter) {
    295             foreach (var constraint in otherGenericArguments[i].GetGenericParameterConstraints())
    296               if (!constraint.IsAssignableFrom(genericArgument)) return false;
    297           } else if (genericArgument != otherGenericArguments[i]) return false;
    298           i++;
    299         }
    300         //check types
    301         try {
    302           var otherGenericTypeDefinition = other.GetGenericTypeDefinition();
    303           if (type.IsAssignableFrom(otherGenericTypeDefinition.MakeGenericType(typeGenericArguments)))
    304             return true;
    305         }
    306         catch (Exception) { }
    307       }
    308       return false;
    309     }
    310     private static Type BuildType(Type type, Type protoType) {
    311       if (type.IsGenericType && protoType.IsGenericType)
    312         return type.GetGenericTypeDefinition().MakeGenericType(protoType.GetGenericArguments());
    313       else
    314         return type;
     263      var matchingTypes = from assemblyType in assembly.GetTypes()
     264                          let t = assemblyType.BuildType(type)
     265                          where t != null
     266                          where t.IsSubTypeOf(type)
     267                          where !t.IsNonDiscoverableType()
     268                          where onlyInstantiable == false || (!t.IsAbstract && !t.IsInterface && !t.HasElementType)
     269                          where includeGenericTypeDefinitions || !t.IsGenericTypeDefinition
     270                          select t;
     271
     272      return matchingTypes;
    315273    }
    316274
  • branches/OaaS/HeuristicLab.PluginInfrastructure/3.3/Starter/StarterForm.Designer.cs

    r7967 r9363  
    181181      this.Name = "StarterForm";
    182182      this.Text = "HeuristicLab Starter";
    183       this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.MainForm_FormClosing);
     183      this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.StarterForm_FormClosing);
     184      this.Load += new System.EventHandler(this.StarterForm_Load);
    184185      this.ResumeLayout(false);
    185186
  • branches/OaaS/HeuristicLab.PluginInfrastructure/3.3/Starter/StarterForm.cs

    r7259 r9363  
    2626using System.Linq;
    2727using System.Threading;
     28using System.Threading.Tasks;
    2829using System.Windows.Forms;
    2930using HeuristicLab.PluginInfrastructure.Advanced;
    3031using HeuristicLab.PluginInfrastructure.Manager;
    31 using System.Threading.Tasks;
    3232
    3333namespace HeuristicLab.PluginInfrastructure.Starter {
     
    3939    private const string pluginManagerItemName = "Plugin Manager";
    4040    private const string updatePluginsItemName = "Updates Available";
    41 
     41    private const string optimizerItemName = "Optimizer";
     42
     43    private readonly ICommandLineArgument[] arguments;
    4244
    4345    private ListViewItem pluginManagerListViewItem;
     
    4648    private SplashScreen splashScreen;
    4749    private bool updatesAvailable = false;
     50
    4851    /// <summary>
    4952    /// Initializes an instance of the starter form.
     
    6366      pluginManager = new PluginManager(pluginPath);
    6467      splashScreen = new SplashScreen(pluginManager, 1000);
     68      splashScreen.VisibleChanged += new EventHandler(splashScreen_VisibleChanged);
    6569      splashScreen.Show(this, "Loading HeuristicLab...");
    6670
     
    6973
    7074      CheckUpdatesAvailableAsync();
     75    }
     76
     77    /// <summary>
     78    /// Creates a new StarterForm and passes the arguments in <paramref name="args"/>.
     79    /// </summary>
     80    /// <param name="args">The arguments that should be processed</param>
     81    public StarterForm(string[] args)
     82      : this() {
     83      arguments = CommandLineArgumentHandling.GetArguments(args);
     84    }
     85
     86    protected override void SetVisibleCore(bool value) {
     87      value &= !(arguments.OfType<HideStarterArgument>().Any() || arguments.OfType<OpenArgument>().Any());
     88      if (!value) HandleArguments();
     89      base.SetVisibleCore(value);
     90    }
     91
     92    #region Events
     93    private void StarterForm_Load(object sender, EventArgs e) {
     94      HandleArguments();
     95    }
     96
     97    private void StarterForm_FormClosing(object sender, FormClosingEventArgs e) {
     98      splashScreen.Close();
     99      abortRequested = true;
     100    }
     101
     102    private void applicationsListView_SelectedIndexChanged(object sender, EventArgs e) {
     103      startButton.Enabled = applicationsListView.SelectedItems.Count > 0;
     104    }
     105
     106    private void applicationsListView_ItemActivate(object sender, EventArgs e) {
     107      if (applicationsListView.SelectedItems.Count > 0) {
     108        ListViewItem selected = applicationsListView.SelectedItems[0];
     109        if (selected.Text == pluginManagerItemName) {
     110          if (pluginManager.Plugins.Any(x => x.PluginState == PluginState.Loaded)) {
     111            MessageBox.Show("Installation Manager cannot be started while another HeuristicLab application is active." + Environment.NewLine +
     112              "Please stop all active HeuristicLab applications and try again.", "Plugin Manager",
     113              MessageBoxButtons.OK, MessageBoxIcon.Information);
     114          } else {
     115            try {
     116              Cursor = Cursors.AppStarting;
     117              using (InstallationManagerForm form = new InstallationManagerForm(pluginManager)) {
     118                form.ShowDialog(this);
     119              }
     120              UpdateApplicationsList();
     121            }
     122            finally {
     123              Cursor = Cursors.Arrow;
     124            }
     125          }
     126        } else if (selected.Text == updatePluginsItemName) {
     127          if (pluginManager.Plugins.Any(x => x.PluginState == PluginState.Loaded)) {
     128            MessageBox.Show("Updating is not possible while another HeuristicLab application is active." + Environment.NewLine +
     129              "Please stop all active HeuristicLab applications and try again.", "Update plugins",
     130              MessageBoxButtons.OK, MessageBoxIcon.Information);
     131          } else {
     132            try {
     133              Cursor = Cursors.AppStarting;
     134              using (PluginUpdaterForm form = new PluginUpdaterForm(pluginManager)) {
     135                form.ShowDialog(this);
     136              }
     137              updatesAvailable = false;
     138              CheckUpdatesAvailableAsync();
     139              UpdateApplicationsList();
     140            }
     141            finally {
     142              Cursor = Cursors.Arrow;
     143            }
     144          }
     145        } else {
     146          ApplicationDescription app = (ApplicationDescription)applicationsListView.SelectedItems[0].Tag;
     147          StartApplication(app, arguments);
     148        }
     149      }
     150    }
     151
     152    private void largeIconsButton_Click(object sender, EventArgs e) {
     153      applicationsListView.View = View.LargeIcon;
     154    }
     155
     156    private void detailsButton_Click(object sender, EventArgs e) {
     157      applicationsListView.View = View.Details;
     158      foreach (ColumnHeader column in applicationsListView.Columns) {
     159        if (applicationsListView.Items.Count > 0)
     160          column.AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent);
     161        else column.AutoResize(ColumnHeaderAutoResizeStyle.HeaderSize);
     162      }
     163    }
     164
     165    private void aboutButton_Click(object sender, EventArgs e) {
     166      List<IPluginDescription> plugins = new List<IPluginDescription>(pluginManager.Plugins.OfType<IPluginDescription>());
     167      using (var dialog = new AboutDialog(plugins)) {
     168        dialog.ShowDialog();
     169      }
     170    }
     171
     172    private void splashScreen_VisibleChanged(object sender, EventArgs e) {
     173      // close hidden starter form
     174      if (!splashScreen.Visible && arguments != null &&
     175           (arguments.OfType<HideStarterArgument>().Any() || arguments.OfType<OpenArgument>().Any()))
     176        Close();
     177    }
     178    #endregion
     179
     180    #region Helpers
     181    private void UpdateApplicationsList() {
     182      if (InvokeRequired) Invoke((Action)UpdateApplicationsList);
     183      else {
     184        applicationsListView.Items.Clear();
     185        AddPluginManagerItem();
     186        AddUpdatePluginsItem();
     187
     188        foreach (ApplicationDescription info in pluginManager.Applications) {
     189          ListViewItem item = new ListViewItem(info.Name, 0);
     190          item.Tag = info;
     191          item.Group = applicationsListView.Groups["Applications"];
     192          item.SubItems.Add(new ListViewItem.ListViewSubItem(item, info.Version.ToString()));
     193          item.SubItems.Add(new ListViewItem.ListViewSubItem(item, info.Description));
     194          item.ToolTipText = info.Description;
     195          applicationsListView.Items.Add(item);
     196        }
     197        foreach (ColumnHeader column in applicationsListView.Columns) {
     198          if (applicationsListView.Items.Count > 0)
     199            column.AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent);
     200          else column.AutoResize(ColumnHeaderAutoResizeStyle.HeaderSize);
     201        }
     202      }
     203    }
     204
     205    private void AddPluginManagerItem() {
     206      FileVersionInfo pluginInfrastructureVersion = FileVersionInfo.GetVersionInfo(GetType().Assembly.Location);
     207      pluginManagerListViewItem = new ListViewItem(pluginManagerItemName, 0);
     208      pluginManagerListViewItem.Group = applicationsListView.Groups["Plugin Management"];
     209      pluginManagerListViewItem.SubItems.Add(new ListViewItem.ListViewSubItem(pluginManagerListViewItem, pluginInfrastructureVersion.FileVersion));
     210      pluginManagerListViewItem.SubItems.Add(new ListViewItem.ListViewSubItem(pluginManagerListViewItem, "Install, upgrade or delete plugins"));
     211      pluginManagerListViewItem.ToolTipText = "Install, upgrade or delete plugins";
     212
     213      applicationsListView.Items.Add(pluginManagerListViewItem);
     214    }
     215
     216    private void AddUpdatePluginsItem() {
     217      if (updatesAvailable) {
     218        var updateListViewItem = new ListViewItem(updatePluginsItemName, 1);
     219        updateListViewItem.Group = applicationsListView.Groups["Plugin Management"];
     220        updateListViewItem.SubItems.Add(new ListViewItem.ListViewSubItem(updateListViewItem, ""));
     221        updateListViewItem.SubItems.Add(new ListViewItem.ListViewSubItem(updateListViewItem, "Download and install updates"));
     222        updateListViewItem.ToolTipText = "Download and install updates";
     223
     224        applicationsListView.Items.Add(updateListViewItem);
     225      }
    71226    }
    72227
     
    108263    }
    109264
    110     /// <summary>
    111     /// Creates a new StarterForm and tries to start application with <paramref name="appName"/> immediately.
    112     /// </summary>
    113     /// <param name="appName">Name of the application</param>
    114     public StarterForm(string appName)
    115       : this() {
     265    private void HandleArguments() {
     266      try {
     267        if (arguments.OfType<OpenArgument>().Any() && !arguments.OfType<StartArgument>().Any()) {
     268          InitiateApplicationStart(optimizerItemName);
     269        }
     270        foreach (var argument in arguments) {
     271          if (argument is StartArgument) {
     272            var arg = (StartArgument)argument;
     273            InitiateApplicationStart(arg.Value);
     274          }
     275        }
     276      }
     277      catch (AggregateException ex) {
     278        ErrorHandling.ShowErrorDialog(this, "One or more errors occurred while initializing the application.", ex);
     279      }
     280    }
     281
     282    private void InitiateApplicationStart(string appName) {
    116283      var appDesc = (from desc in pluginManager.Applications
    117                      where desc.Name == appName
     284                     where desc.Name.Equals(appName)
    118285                     select desc).SingleOrDefault();
    119286      if (appDesc != null) {
    120         StartApplication(appDesc);
     287        StartApplication(appDesc, arguments);
    121288      } else {
    122289        MessageBox.Show("Cannot start application " + appName + ".",
     
    127294    }
    128295
    129     private void applicationsListView_ItemActivate(object sender, EventArgs e) {
    130       if (applicationsListView.SelectedItems.Count > 0) {
    131         ListViewItem selected = applicationsListView.SelectedItems[0];
    132         if (selected.Text == pluginManagerItemName) {
    133           if (pluginManager.Plugins.Any(x => x.PluginState == PluginState.Loaded)) {
    134             MessageBox.Show("Installation Manager cannot be started while another HeuristicLab application is active." + Environment.NewLine +
    135               "Please stop all active HeuristicLab applications and try again.", "Plugin Manager",
    136               MessageBoxButtons.OK, MessageBoxIcon.Information);
    137           } else {
    138             try {
    139               Cursor = Cursors.AppStarting;
    140               using (InstallationManagerForm form = new InstallationManagerForm(pluginManager)) {
    141                 form.ShowDialog(this);
    142               }
    143               UpdateApplicationsList();
    144             }
    145             finally {
    146               Cursor = Cursors.Arrow;
    147             }
    148           }
    149         } else if (selected.Text == updatePluginsItemName) {
    150           if (pluginManager.Plugins.Any(x => x.PluginState == PluginState.Loaded)) {
    151             MessageBox.Show("Updating is not possible while another HeuristicLab application is active." + Environment.NewLine +
    152               "Please stop all active HeuristicLab applications and try again.", "Update plugins",
    153               MessageBoxButtons.OK, MessageBoxIcon.Information);
    154           } else {
    155             try {
    156               Cursor = Cursors.AppStarting;
    157               using (PluginUpdaterForm form = new PluginUpdaterForm(pluginManager)) {
    158                 form.ShowDialog(this);
    159               }
    160               updatesAvailable = false;
    161               CheckUpdatesAvailableAsync();
    162               UpdateApplicationsList();
    163             }
    164             finally {
    165               Cursor = Cursors.Arrow;
    166             }
    167           }
    168         } else {
    169           ApplicationDescription app = (ApplicationDescription)applicationsListView.SelectedItems[0].Tag;
    170           StartApplication(app);
    171         }
    172       }
    173     }
    174 
    175     private void UpdateApplicationsList() {
    176       if (InvokeRequired) Invoke((Action)UpdateApplicationsList);
    177       else {
    178         applicationsListView.Items.Clear();
    179         AddPluginManagerItem();
    180         AddUpdatePluginsItem();
    181 
    182         foreach (ApplicationDescription info in pluginManager.Applications) {
    183           ListViewItem item = new ListViewItem(info.Name, 0);
    184           item.Tag = info;
    185           item.Group = applicationsListView.Groups["Applications"];
    186           item.SubItems.Add(new ListViewItem.ListViewSubItem(item, info.Version.ToString()));
    187           item.SubItems.Add(new ListViewItem.ListViewSubItem(item, info.Description));
    188           item.ToolTipText = info.Description;
    189           applicationsListView.Items.Add(item);
    190         }
    191         foreach (ColumnHeader column in applicationsListView.Columns) {
    192           if (applicationsListView.Items.Count > 0)
    193             column.AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent);
    194           else column.AutoResize(ColumnHeaderAutoResizeStyle.HeaderSize);
    195         }
    196       }
    197     }
    198 
    199     private void AddPluginManagerItem() {
    200       FileVersionInfo pluginInfrastructureVersion = FileVersionInfo.GetVersionInfo(GetType().Assembly.Location);
    201       pluginManagerListViewItem = new ListViewItem(pluginManagerItemName, 0);
    202       pluginManagerListViewItem.Group = applicationsListView.Groups["Plugin Management"];
    203       pluginManagerListViewItem.SubItems.Add(new ListViewItem.ListViewSubItem(pluginManagerListViewItem, pluginInfrastructureVersion.FileVersion));
    204       pluginManagerListViewItem.SubItems.Add(new ListViewItem.ListViewSubItem(pluginManagerListViewItem, "Install, upgrade or delete plugins"));
    205       pluginManagerListViewItem.ToolTipText = "Install, upgrade or delete plugins";
    206 
    207       applicationsListView.Items.Add(pluginManagerListViewItem);
    208     }
    209 
    210     private void AddUpdatePluginsItem() {
    211       if (updatesAvailable) {
    212         var updateListViewItem = new ListViewItem(updatePluginsItemName, 1);
    213         updateListViewItem.Group = applicationsListView.Groups["Plugin Management"];
    214         updateListViewItem.SubItems.Add(new ListViewItem.ListViewSubItem(updateListViewItem, ""));
    215         updateListViewItem.SubItems.Add(new ListViewItem.ListViewSubItem(updateListViewItem, "Download and install updates"));
    216         updateListViewItem.ToolTipText = "Download and install updates";
    217 
    218         applicationsListView.Items.Add(updateListViewItem);
    219       }
    220     }
    221 
    222     private void StartApplication(ApplicationDescription app) {
     296    private void StartApplication(ApplicationDescription app, ICommandLineArgument[] args) {
    223297      splashScreen.Show("Loading " + app.Name);
    224298      Thread t = new Thread(delegate() {
     
    227301          try {
    228302            if (!abortRequested) {
    229               pluginManager.Run(app);
     303              pluginManager.Run(app, args);
    230304            }
    231305            stopped = true;
     
    241315      t.Start();
    242316    }
    243 
    244     private void applicationsListView_SelectedIndexChanged(object sender, EventArgs e) {
    245       startButton.Enabled = applicationsListView.SelectedItems.Count > 0;
    246     }
    247 
    248     private void largeIconsButton_Click(object sender, EventArgs e) {
    249       applicationsListView.View = View.LargeIcon;
    250     }
    251 
    252     private void detailsButton_Click(object sender, EventArgs e) {
    253       applicationsListView.View = View.Details;
    254       foreach (ColumnHeader column in applicationsListView.Columns) {
    255         if (applicationsListView.Items.Count > 0)
    256           column.AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent);
    257         else column.AutoResize(ColumnHeaderAutoResizeStyle.HeaderSize);
    258       }
    259     }
    260 
    261     private void MainForm_FormClosing(object sender, FormClosingEventArgs e) {
    262       splashScreen.Close();
    263       abortRequested = true;
    264     }
    265 
    266     private void aboutButton_Click(object sender, EventArgs e) {
    267       List<IPluginDescription> plugins = new List<IPluginDescription>(pluginManager.Plugins.OfType<IPluginDescription>());
    268       using (var dialog = new AboutDialog(plugins)) {
    269         dialog.ShowDialog();
    270       }
    271     }
     317    #endregion
    272318  }
    273319}
  • branches/OaaS/HeuristicLab.PluginInfrastructure/3.3/WebApplicationManager.cs

    r8958 r9363  
    2525using System.Linq;
    2626using System.Reflection;
     27using System.Text;
    2728using HeuristicLab.PluginInfrastructure.Manager;
    28 using System.Text;
    2929
    3030namespace HeuristicLab.PluginInfrastructure {
     
    3838  internal class WebApplicationManager : MarshalByRefObject, IApplicationManager {
    3939    // private class to store plugin dependency declarations while reflecting over plugins
    40     private class PluginDependency
    41     {
     40    private class PluginDependency {
    4241      public string Name { get; private set; }
    4342      public Version Version { get; private set; }
    4443
    45       public PluginDependency(string name, Version version)
    46       {
     44      public PluginDependency(string name, Version version) {
    4745        this.Name = name;
    4846        this.Version = version;
     
    9997    // the dependencies in the plugin descriptions are not yet set correctly because we need to create
    10098    // the full list of all plugin descriptions first
    101     private List<PluginDescription> GatherPluginDescriptions()
    102     {
     99    private List<PluginDescription> GatherPluginDescriptions() {
    103100      /*List<PluginDescription> pluginDescriptions = new List<PluginDescription>();
    104101
     
    167164    /// </summary>
    168165    /// <param name="pluginType"></param>
    169     private PluginDescription GetPluginDescription(Type pluginType)
    170     {
     166    private PluginDescription GetPluginDescription(Type pluginType) {
    171167
    172168      string pluginName, pluginDescription, pluginVersion;
     
    180176      if (!string.IsNullOrEmpty(pluginName) &&
    181177          pluginFiles.Count() > 0 &&                                 // at least one file
    182           pluginFiles.Any(f => f.Type == PluginFileType.Assembly))
    183       { // at least one assembly
     178          pluginFiles.Any(f => f.Type == PluginFileType.Assembly)) { // at least one assembly
    184179        // create a temporary PluginDescription that contains the attribute values
    185180        PluginDescription info = new PluginDescription();
     
    194189        //this.pluginDependencies[info] = pluginDependencies;
    195190        return info;
    196       }
    197       else
    198       {
     191      } else {
    199192        throw new InvalidPluginException("Invalid metadata in plugin " + pluginType.ToString());
    200193      }
    201194    }
    202195
    203     private static string ReadLicenseFiles(IEnumerable<PluginFile> pluginFiles)
    204     {
     196    private static string ReadLicenseFiles(IEnumerable<PluginFile> pluginFiles) {
    205197      // combine the contents of all plugin files
    206198      var licenseFiles = from file in pluginFiles
     
    210202      StringBuilder licenseTextBuilder = new StringBuilder();
    211203      licenseTextBuilder.AppendLine(File.ReadAllText(licenseFiles.First().Name));
    212       foreach (var licenseFile in licenseFiles.Skip(1))
    213       {
     204      foreach (var licenseFile in licenseFiles.Skip(1)) {
    214205        licenseTextBuilder.AppendLine().AppendLine(); // leave some empty space between multiple license files
    215206        licenseTextBuilder.AppendLine(File.ReadAllText(licenseFile.Name));
     
    218209    }
    219210
    220     private static IEnumerable<PluginDependency> GetPluginDependencyMetaData(Type pluginType)
    221     {
     211    private static IEnumerable<PluginDependency> GetPluginDependencyMetaData(Type pluginType) {
    222212      // get all attributes of type PluginDependency
    223213      var dependencyAttributes = from attr in CustomAttributeData.GetCustomAttributes(pluginType)
     
    225215                                 select attr;
    226216
    227       foreach (var dependencyAttr in dependencyAttributes)
    228       {
     217      foreach (var dependencyAttr in dependencyAttributes) {
    229218        string name = (string)dependencyAttr.ConstructorArguments[0].Value;
    230219        Version version = new Version("0.0.0.0"); // default version
     
    232221        // later when the constructor of PluginDependencyAttribute with only one argument has been removed
    233222        // this conditional can be removed as well
    234         if (dependencyAttr.ConstructorArguments.Count > 1)
    235         {
    236           try
    237           {
     223        if (dependencyAttr.ConstructorArguments.Count > 1) {
     224          try {
    238225            version = new Version((string)dependencyAttr.ConstructorArguments[1].Value); // might throw FormatException
    239226          }
    240           catch (FormatException ex)
    241           {
     227          catch (FormatException ex) {
    242228            throw new InvalidPluginException("Invalid version format of dependency " + name + " in plugin " + pluginType.ToString(), ex);
    243229          }
     
    247233    }
    248234
    249     private static bool IsAttributeDataForType(CustomAttributeData attributeData, Type attributeType)
    250     {
     235    private static bool IsAttributeDataForType(CustomAttributeData attributeData, Type attributeType) {
    251236      return attributeData.Constructor.DeclaringType.AssemblyQualifiedName == attributeType.AssemblyQualifiedName;
    252237    }
    253238
    254     private static void GetPluginContactMetaData(Type pluginType, out string contactName, out string contactAddress)
    255     {
     239    private static void GetPluginContactMetaData(Type pluginType, out string contactName, out string contactAddress) {
    256240      // get attribute of type ContactInformation if there is any
    257241      var contactInfoAttribute = (from attr in CustomAttributeData.GetCustomAttributes(pluginType)
     
    259243                                  select attr).SingleOrDefault();
    260244
    261       if (contactInfoAttribute != null)
    262       {
     245      if (contactInfoAttribute != null) {
    263246        contactName = (string)contactInfoAttribute.ConstructorArguments[0].Value;
    264247        contactAddress = (string)contactInfoAttribute.ConstructorArguments[1].Value;
    265       }
    266       else
    267       {
     248      } else {
    268249        contactName = string.Empty;
    269250        contactAddress = string.Empty;
     
    272253
    273254    // not static because we need the PluginDir property
    274     private IEnumerable<PluginFile> GetPluginFilesMetaData(Type pluginType)
    275     {
     255    private IEnumerable<PluginFile> GetPluginFilesMetaData(Type pluginType) {
    276256      // get all attributes of type PluginFileAttribute
    277257      var pluginFileAttributes = from attr in CustomAttributeData.GetCustomAttributes(pluginType)
    278258                                 where IsAttributeDataForType(attr, typeof(PluginFileAttribute))
    279259                                 select attr;
    280       foreach (var pluginFileAttribute in pluginFileAttributes)
    281       {
     260      foreach (var pluginFileAttribute in pluginFileAttributes) {
    282261        string pluginFileName = (string)pluginFileAttribute.ConstructorArguments[0].Value;
    283262        PluginFileType fileType = (PluginFileType)pluginFileAttribute.ConstructorArguments[1].Value;
     
    286265    }
    287266
    288     private static void GetPluginMetaData(Type pluginType, out string pluginName, out string pluginDescription, out string pluginVersion)
    289     {
     267    private static void GetPluginMetaData(Type pluginType, out string pluginName, out string pluginDescription, out string pluginVersion) {
    290268      // there must be a single attribute of type PluginAttribute
    291269      var pluginMetaDataAttr = (from attr in CustomAttributeData.GetCustomAttributes(pluginType)
     
    298276      pluginVersion = "0.0.0.0";
    299277      pluginDescription = string.Empty;
    300       if (pluginMetaDataAttr.ConstructorArguments.Count() == 2)
    301       {
     278      if (pluginMetaDataAttr.ConstructorArguments.Count() == 2) {
    302279        // if two arguments are given the second argument is the version
    303280        pluginVersion = (string)pluginMetaDataAttr.ConstructorArguments[1].Value;
    304       }
    305       else if (pluginMetaDataAttr.ConstructorArguments.Count() == 3)
    306       {
     281      } else if (pluginMetaDataAttr.ConstructorArguments.Count() == 3) {
    307282        // if three arguments are given the second argument is the description and the third is the version
    308283        pluginDescription = (string)pluginMetaDataAttr.ConstructorArguments[1].Value;
     
    353328    /// </summary>
    354329    /// <param name="appInfo">Description of the application to run</param>
    355     internal void Run(ApplicationDescription appInfo) {
     330    internal void Run(ApplicationDescription appInfo, ICommandLineArgument[] args) {
    356331      IApplication runnablePlugin = (IApplication)Activator.CreateInstance(appInfo.DeclaringAssemblyName, appInfo.DeclaringTypeName).Unwrap();
    357332      try {
    358         runnablePlugin.Run();
     333        runnablePlugin.Run(args);
    359334      }
    360335      finally {
Note: See TracChangeset for help on using the changeset viewer.