Free cookie consent management tool by TermsFeed Policy Generator

Changeset 4482


Ignore:
Timestamp:
09/24/10 10:24:20 (14 years ago)
Author:
gkronber
Message:

Preparations for next HL release. #1203

Location:
trunk/sources/HeuristicLab.PluginInfrastructure/3.3
Files:
2 deleted
25 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.PluginInfrastructure/3.3/Advanced/AvailablePluginsView.cs

    r4068 r4482  
    311311    }
    312312
    313     private bool IsNewerThan(IPluginDescription plugin1, IPluginDescription plugin2) {
     313    private static bool IsNewerThan(IPluginDescription plugin1, IPluginDescription plugin2) {
    314314      // newer: build version is higher, or if build version is the same revision is higher
    315315      if (plugin1.Version.Build < plugin2.Version.Build) return false;
  • trunk/sources/HeuristicLab.PluginInfrastructure/3.3/Advanced/BasicUpdateView.cs

    r4068 r4482  
    8787    }
    8888
    89     private bool IsNewerThan(IPluginDescription plugin1, IPluginDescription plugin2) {
     89    private static bool IsNewerThan(IPluginDescription plugin1, IPluginDescription plugin2) {
    9090      // newer: build version is higher, or if build version is the same revision is higher
    9191      if (plugin1.Version.Build < plugin2.Version.Build) return false;
  • trunk/sources/HeuristicLab.PluginInfrastructure/3.3/Advanced/DeploymentService/PluginDescription.cs

    r4068 r4482  
    6969    }
    7070
    71     [Obsolete]
    72     public DateTime BuildDate {
    73       get { throw new NotImplementedException(); }
    74     }
    75 
    7671    /// <summary>
    7772    /// Gets an enumerable of dependencies of the plugin
  • trunk/sources/HeuristicLab.PluginInfrastructure/3.3/Advanced/EditProductsView.cs

    r4068 r4482  
    257257
    258258        // populate plugins list view
    259         ListViewItem activeItem = (ListViewItem)productsListView.SelectedItems[0];
    260259        pluginListView.SuppressItemCheckedEvents = true;
    261260        foreach (var plugin in plugins.OfType<IPluginDescription>()) {
  • trunk/sources/HeuristicLab.PluginInfrastructure/3.3/Advanced/InstallationManager.cs

    r4068 r4482  
    179179      using (ZipInputStream s = new ZipInputStream(new MemoryStream(zippedPackage))) {
    180180        ZipEntry theEntry;
    181         string tmpEntry = String.Empty;
    182181        while ((theEntry = s.GetNextEntry()) != null) {
    183182          string directoryName = pluginDir;
    184183          string fileName = Path.GetFileName(theEntry.Name);
    185184          // create directory
    186           if (directoryName != "") {
     185          if (!string.IsNullOrEmpty(directoryName)) {
    187186            Directory.CreateDirectory(directoryName);
    188187          }
    189           if (fileName != String.Empty) {
     188          if (!string.IsNullOrEmpty(fileName)) {
    190189            string fullPath = Path.Combine(directoryName, fileName);
    191190            string fullDirPath = Path.GetDirectoryName(fullPath);
    192191            if (!Directory.Exists(fullDirPath)) Directory.CreateDirectory(fullDirPath);
    193             FileStream streamWriter = File.Create(fullPath);
    194             int size = 2048;
    195             byte[] data = new byte[2048];
    196             while (true) {
    197               size = s.Read(data, 0, data.Length);
    198               if (size > 0) {
    199                 streamWriter.Write(data, 0, size);
    200               } else {
    201                 break;
     192            using (FileStream streamWriter = File.Create(fullPath)) {
     193              int size = 2048;
     194              byte[] data = new byte[2048];
     195              while (true) {
     196                size = s.Read(data, 0, data.Length);
     197                if (size > 0) {
     198                  streamWriter.Write(data, 0, size);
     199                } else {
     200                  break;
     201                }
    202202              }
     203              streamWriter.Close();
    203204            }
    204             streamWriter.Close();
    205205          }
    206206        }
  • trunk/sources/HeuristicLab.PluginInfrastructure/3.3/Advanced/InstallationManagerException.cs

    r4068 r4482  
    2929    public InstallationManagerException(string msg) : base(msg) { }
    3030    public InstallationManagerException(string msg, Exception e) : base(msg, e) { }
    31     public InstallationManagerException(SerializationInfo info, StreamingContext context) : base(info, context) { }
     31    protected InstallationManagerException(SerializationInfo info, StreamingContext context) : base(info, context) { }
    3232  }
    3333}
  • trunk/sources/HeuristicLab.PluginInfrastructure/3.3/Advanced/InstallationManagerForm.cs

    r4068 r4482  
    3232  internal partial class InstallationManagerForm : Form, IStatusView {
    3333    private InstallationManager installationManager;
    34     private PluginManager pluginManager;
    3534    private string pluginDir;
    3635
     
    4039      FileVersionInfo pluginInfrastructureVersion = FileVersionInfo.GetVersionInfo(GetType().Assembly.Location);
    4140      Text = "HeuristicLab Plugin Manager " + pluginInfrastructureVersion.FileVersion;
    42 
    43       this.pluginManager = pluginManager;
    4441
    4542      pluginManager.PluginLoaded += pluginManager_PluginLoaded;
     
    142139    #region button events
    143140    private void connectionSettingsToolStripMenuItem_Click(object sender, EventArgs e) {
    144       new ConnectionSetupView().ShowDialog(this);
     141      using (var conSetupView = new ConnectionSetupView()) {
     142        conSetupView.ShowDialog(this);
     143      }
    145144    }
    146145    private void tabControl_SelectedIndexChanged(object sender, EventArgs e) {
     
    157156        }
    158157      }
    159       return (new ConfirmationDialog("Confirm Delete", "Do you want to delete following files?", strBuilder.ToString())).ShowDialog(this) == DialogResult.OK;
     158      using (var confirmationDialog = new ConfirmationDialog("Confirm Delete", "Do you want to delete following files?", strBuilder.ToString())) {
     159        return (confirmationDialog.ShowDialog(this)) == DialogResult.OK;
     160      }
    160161    }
    161162
     
    165166        strBuilder.AppendLine(plugin.ToString());
    166167      }
    167       return (new ConfirmationDialog("Confirm Update", "Do you want to update following plugins?", strBuilder.ToString())).ShowDialog(this) == DialogResult.OK;
     168      using (var confirmationDialog = new ConfirmationDialog("Confirm Update", "Do you want to update following plugins?", strBuilder.ToString())) {
     169        return (confirmationDialog.ShowDialog(this)) == DialogResult.OK;
     170      }
    168171    }
    169172
     
    171174      foreach (var plugin in plugins) {
    172175        if (!string.IsNullOrEmpty(plugin.LicenseText)) {
    173           var licenseConfirmationBox = new LicenseConfirmationDialog(plugin);
    174           if (licenseConfirmationBox.ShowDialog(this) != DialogResult.OK)
    175             return false;
     176          using (var licenseConfirmationBox = new LicenseConfirmationDialog(plugin)) {
     177            if (licenseConfirmationBox.ShowDialog(this) != DialogResult.OK)
     178              return false;
     179          }
    176180        }
    177181      }
     
    207211
    208212    public void ShowProgressIndicator(double percentProgress) {
    209       if (percentProgress < 0.0 || percentProgress > 1.0) throw new ArgumentException();
     213      if (percentProgress < 0.0 || percentProgress > 1.0) throw new ArgumentException("percentProgress");
    210214      toolStripProgressBar.Visible = true;
    211215      toolStripProgressBar.Style = ProgressBarStyle.Continuous;
     
    224228
    225229    public void ShowMessage(string message) {
    226       if (toolStripStatusLabel.Text == string.Empty)
     230      if (string.IsNullOrEmpty(toolStripStatusLabel.Text))
    227231        toolStripStatusLabel.Text = message;
    228232      else
  • trunk/sources/HeuristicLab.PluginInfrastructure/3.3/Advanced/InstalledPluginsView.cs

    r4068 r4482  
    120120    }
    121121
    122     private bool IsNewerThan(IPluginDescription plugin1, IPluginDescription plugin2) {
     122    private static bool IsNewerThan(IPluginDescription plugin1, IPluginDescription plugin2) {
    123123      // newer: build version is higher, or if build version is the same revision is higher
    124124      if (plugin1.Version.Build < plugin2.Version.Build) return false;
     
    153153    }
    154154
    155     private ListViewItem CreateListViewItem(PluginDescription plugin) {
     155    private static ListViewItem CreateListViewItem(PluginDescription plugin) {
    156156      ListViewItem item = new ListViewItem(new string[] { plugin.Name, plugin.Version.ToString(), plugin.Description });
    157157      item.Tag = plugin;
     
    190190        List<ListViewItem> modifiedItems = new List<ListViewItem>();
    191191        foreach (ListViewItem item in localPluginsListView.SelectedItems) {
    192           var plugin = (IPluginDescription)item.Tag;
    193192          modifiedItems.Add(item);
    194193        }
  • trunk/sources/HeuristicLab.PluginInfrastructure/3.3/Advanced/MultiSelectListView.cs

    r4068 r4482  
    2222using System.Linq;
    2323using System.Windows.Forms;
     24using System;
    2425
    2526namespace HeuristicLab.PluginInfrastructure.Advanced {
     
    4344    // and then one the item whose checkbox was clicked
    4445    protected override void OnItemCheck(ItemCheckEventArgs ice) {
     46      if (ice == null) throw new ArgumentNullException("ice");
    4547      // don't change the checked state of items that were not clicked directly
    4648      if (inhibitAutoCheck) {
  • trunk/sources/HeuristicLab.PluginInfrastructure/3.3/Advanced/UploadPluginsView.cs

    r4068 r4482  
    260260    }
    261261
    262     private byte[] CreateZipPackage(IPluginDescription plugin) {
     262    private static byte[] CreateZipPackage(IPluginDescription plugin) {
    263263      using (MemoryStream stream = new MemoryStream()) {
    264264        ZipFile zipFile = new ZipFile(stream);
  • trunk/sources/HeuristicLab.PluginInfrastructure/3.3/Attributes/PluginAttribute.cs

    r4068 r4482  
    5353    }
    5454
    55     [Obsolete]
    56     public PluginAttribute(string name) : this(name, "0.0.0.0") { }
    57 
    5855    /// <summary>
    5956    /// Initializes a new instance of <see cref="PluginAttribute"/>.
     
    7471      if (string.IsNullOrEmpty(name)) throw new ArgumentException("Plugin name is null or empty.");
    7572      if (description == null) throw new ArgumentNullException("description");
    76       if (string.IsNullOrEmpty(version)) new ArgumentException("Version string is null or empty.");
     73      if (string.IsNullOrEmpty(version)) throw new ArgumentException("Version string is null or empty.");
    7774      this.name = name;
    7875      this.description = description;
  • trunk/sources/HeuristicLab.PluginInfrastructure/3.3/Attributes/PluginDependencyAttribute.cs

    r4068 r4482  
    4646
    4747    /// <summary>
    48     /// Initializes a new instance of <see cref="PluginDependencyAttribute"/>.
    49     /// <param name="dependency">The name of the plugin that is needed to load a plugin.</param>
    50     /// </summary>
    51     [Obsolete]
    52     public PluginDependencyAttribute(string dependency)
    53       : this(dependency, "0.0.0.0") {
    54     }
    55 
    56     /// <summary>
    5748    /// Initializes a new instance of <see cref="PluginDependencyAttribute" />.
    5849    /// </summary>
  • trunk/sources/HeuristicLab.PluginInfrastructure/3.3/BaseClasses/PluginBase.cs

    r4068 r4482  
    2929    /// Initializes a new instance of <see cref="PluginBase"/>.
    3030    /// </summary>
    31     public PluginBase() { }
     31    protected PluginBase() { }
    3232
    3333    private PluginAttribute PluginAttribute {
  • trunk/sources/HeuristicLab.PluginInfrastructure/3.3/DefaultApplicationManager.cs

    r4068 r4482  
    310310    /// <returns>The description of the plugin that declares the given type or null if the type has not been declared by a known plugin.</returns>
    311311    public IPluginDescription GetDeclaringPlugin(Type type) {
     312      if (type == null) throw new ArgumentNullException("type");
    312313      foreach (PluginDescription info in Plugins) {
    313314        if (info.AssemblyLocations.Contains(Path.GetFullPath(type.Assembly.Location))) return info;
  • trunk/sources/HeuristicLab.PluginInfrastructure/3.3/ErrorHandling/ErrorHandling.cs

    r3758 r4482  
    5757    }
    5858    public static void ShowErrorDialog(Control owner, string message, Exception exception) {
     59      if (owner == null) throw new ArgumentNullException("owner");
    5960      if (owner.InvokeRequired) {
    6061        owner.Invoke(new Action<Control, string, Exception>(ShowErrorDialog), owner, message, exception);
  • trunk/sources/HeuristicLab.PluginInfrastructure/3.3/HeuristicLab.PluginInfrastructure-3.3.csproj

    r4065 r4482  
    178178    <Compile Include="Advanced\DeploymentService\DeploymentService.cs" />
    179179    <Compile Include="Advanced\DeploymentService\UpdateClientFactory.cs" />
    180     <Compile Include="Advanced\InstallationManagerConsole.cs" />
    181180    <Compile Include="Advanced\InstallationManager.cs" />
    182181    <Compile Include="Advanced\InstallationManagerForm.cs">
     
    212211    </Compile>
    213212    <Compile Include="Attributes\ApplicationAttribute.cs" />
    214     <Compile Include="Attributes\AssemblyBuildDateAttribute.cs" />
    215213    <Compile Include="Attributes\ContactInformationAttribute.cs" />
    216214    <Compile Include="Attributes\PluginAttribute.cs" />
  • trunk/sources/HeuristicLab.PluginInfrastructure/3.3/Interfaces/IPluginDescription.cs

    r2922 r4482  
    4141    string Description { get; }
    4242    /// <summary>
    43     /// Gets the build date of the plugin.
    44     /// </summary>
    45     [Obsolete]
    46     DateTime BuildDate { get; }
    47     /// <summary>
    4843    /// Gets the dependencies of the plugin.
    4944    /// </summary>
  • trunk/sources/HeuristicLab.PluginInfrastructure/3.3/LightweightApplicationManager.cs

    r4068 r4482  
    3333  /// </summary>
    3434  internal sealed class LightweightApplicationManager : IApplicationManager {
     35    internal LightweightApplicationManager() {
     36      AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve);
     37    }
     38
     39    Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args) {
     40      return null;
     41    }
     42
    3543
    3644    #region IApplicationManager Members
     
    102110    /// <returns>Enumerable of the discovered types.</returns>
    103111    private static IEnumerable<Type> GetTypes(Type type, Assembly assembly, bool onlyInstantiable) {
    104       return from t in assembly.GetTypes()
    105              where CheckTypeCompatibility(type, t)
    106              where onlyInstantiable == false || (!t.IsAbstract && !t.IsInterface && !t.HasElementType)
    107              select BuildType(t, type);
     112      try {
     113        var assemblyTypes = assembly.GetTypes();
     114
     115        return from t in assemblyTypes
     116               where CheckTypeCompatibility(type, t)
     117               where onlyInstantiable == false || (!t.IsAbstract && !t.IsInterface && !t.HasElementType)
     118               select BuildType(t, type);
     119      }
     120      catch (TypeLoadException) {
     121        return Enumerable.Empty<Type>();
     122      }
     123      catch (ReflectionTypeLoadException) {
     124        return Enumerable.Empty<Type>();
     125      }
    108126    }
    109127
  • trunk/sources/HeuristicLab.PluginInfrastructure/3.3/Manager/PluginDescription.cs

    r4068 r4482  
    5858      internal set { version = value; }
    5959    }
    60     [Obsolete]
    61     private DateTime buildDate;
    62     /// <summary>
    63     /// Gets the build date of the plugin.
    64     /// </summary>
    65     [Obsolete]
    66     public DateTime BuildDate {
    67       get { return buildDate; }
    68       internal set { buildDate = value; }
    69     }
    7060
    7161    private string contactName;
  • trunk/sources/HeuristicLab.PluginInfrastructure/3.3/Manager/PluginManager.cs

    r4414 r4482  
    2424using System.Linq;
    2525using System.Reflection;
     26using System.Security.Permissions;
    2627
    2728namespace HeuristicLab.PluginInfrastructure.Manager {
     
    204205    /// </summary>
    205206    /// <returns><c>null</c>.</returns>
     207    [SecurityPermission(SecurityAction.LinkDemand, Flags=SecurityPermissionFlag.Infrastructure)]
    206208    public override object InitializeLifetimeService() {
    207209      return null;
  • trunk/sources/HeuristicLab.PluginInfrastructure/3.3/Manager/PluginValidator.cs

    r4068 r4482  
    301301    }
    302302
    303     private string ReadLicenseFiles(IEnumerable<PluginFile> pluginFiles) {
     303    private static string ReadLicenseFiles(IEnumerable<PluginFile> pluginFiles) {
    304304      // combine the contents of all plugin files
    305305      var licenseFiles = from file in pluginFiles
     
    432432    /// <param name="requested">The requested version that must be matched.</param>
    433433    /// <returns></returns>
    434     private bool IsCompatiblePluginVersion(Version available, Version requested) {
     434    private static bool IsCompatiblePluginVersion(Version available, Version requested) {
    435435      // this condition must be removed after all plugins have been updated to declare plugin and dependency versions
    436436      if (
  • trunk/sources/HeuristicLab.PluginInfrastructure/3.3/Sandboxing/SandboxManager.cs

    r4414 r4482  
    3232namespace HeuristicLab.PluginInfrastructure.Sandboxing {
    3333  public class SandboxManager {
     34
     35    // static class
     36    private SandboxManager() { }
    3437
    3538    private static StrongName CreateStrongName(Assembly assembly) {
  • trunk/sources/HeuristicLab.PluginInfrastructure/3.3/Starter/AboutDialog.cs

    r4068 r4482  
    4040      var curAssembly = this.GetType().Assembly;
    4141      productTextBox.Text = GetProduct(curAssembly);
    42       versionTextBox.Text = GetVersion(curAssembly);
     42      versionTextBox.Text = GetVersion();
    4343      copyrightTextBox.Text = GetCopyright(curAssembly);
    4444      imageList.Images.Add(HeuristicLab.PluginInfrastructure.Resources.Plugin);
     
    7979    }
    8080
    81     private string GetVersion(Assembly asm) {
     81    private string GetVersion() {
    8282      FileVersionInfo pluginInfrastructureVersion = FileVersionInfo.GetVersionInfo(GetType().Assembly.Location);
    8383      return pluginInfrastructureVersion.FileVersion;
  • trunk/sources/HeuristicLab.PluginInfrastructure/3.3/Starter/SplashScreen.cs

    r4068 r4482  
    3232    private Timer fadeTimer;
    3333    private int initialInterval;
    34     private PluginManager manager;
    3534
    3635    internal SplashScreen() {
     
    4140      : this() {
    4241      this.initialInterval = initialInterval;
    43       this.manager = manager;
    4442
    4543      manager.ApplicationStarted += new EventHandler<PluginInfrastructureEventArgs>(manager_ApplicationStarted);
  • trunk/sources/HeuristicLab.PluginInfrastructure/3.3/Starter/StarterForm.cs

    r4068 r4482  
    9393            try {
    9494              Cursor = Cursors.AppStarting;
    95               InstallationManagerForm form = new InstallationManagerForm(pluginManager);
    96               form.ShowDialog(this);
     95              using (InstallationManagerForm form = new InstallationManagerForm(pluginManager)) {
     96                form.ShowDialog(this);
     97              }
    9798              UpdateApplicationsList();
    9899            }
     
    180181    private void aboutButton_Click(object sender, EventArgs e) {
    181182      List<IPluginDescription> plugins = new List<IPluginDescription>(pluginManager.Plugins.OfType<IPluginDescription>());
    182       var dialog = new AboutDialog(plugins);
    183       dialog.ShowDialog();
     183      using (var dialog = new AboutDialog(plugins)) {
     184        dialog.ShowDialog();
     185      }
    184186    }
    185187  }
Note: See TracChangeset for help on using the changeset viewer.