Free cookie consent management tool by TermsFeed Policy Generator

Changeset 3728 for trunk


Ignore:
Timestamp:
05/09/10 01:43:38 (15 years ago)
Author:
swagner
Message:

Added Version property for items (#1003)

Location:
trunk/sources
Files:
21 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Core/3.3/Attributes/ItemAttribute.cs

    r2931 r3728  
    2121
    2222using System;
     23using System.Linq;
     24using System.Reflection;
    2325using HeuristicLab.Common;
    2426
     
    5658      else return string.Empty;
    5759    }
     60    public static Version GetVersion(Type type) {
     61      Assembly assembly = Assembly.GetAssembly(type);
     62      AssemblyFileVersionAttribute version = assembly.GetCustomAttributes(typeof(AssemblyFileVersionAttribute), true).
     63                                             Cast<AssemblyFileVersionAttribute>().FirstOrDefault();
     64      if (version != null) {
     65        return new Version(version.Version);
     66      } else {
     67        return assembly.GetName().Version;
     68      }
     69    }
    5870  }
    5971}
  • trunk/sources/HeuristicLab.Core/3.3/Collections/ItemArray.cs

    r3560 r3728  
    5454      get { return ItemAttribute.GetDescription(this.GetType()); }
    5555    }
     56    public Version ItemVersion {
     57      get { return ItemAttribute.GetVersion(this.GetType()); }
     58    }
    5659    public virtual Image ItemImage {
    5760      get { return VS2008ImageLibrary.Class; }
  • trunk/sources/HeuristicLab.Core/3.3/Collections/ItemCollection.cs

    r3560 r3728  
    5151      get { return ItemAttribute.GetDescription(this.GetType()); }
    5252    }
     53    public Version ItemVersion {
     54      get { return ItemAttribute.GetVersion(this.GetType()); }
     55    }
    5356    public virtual Image ItemImage {
    5457      get { return VS2008ImageLibrary.Class; }
  • trunk/sources/HeuristicLab.Core/3.3/Collections/ItemDictionary.cs

    r3560 r3728  
    5151      get { return ItemAttribute.GetDescription(this.GetType()); }
    5252    }
     53    public Version ItemVersion {
     54      get { return ItemAttribute.GetVersion(this.GetType()); }
     55    }
    5356    public virtual Image ItemImage {
    5457      get { return VS2008ImageLibrary.Class; }
  • trunk/sources/HeuristicLab.Core/3.3/Collections/ItemList.cs

    r3560 r3728  
    5454      get { return ItemAttribute.GetDescription(this.GetType()); }
    5555    }
     56    public Version ItemVersion {
     57      get { return ItemAttribute.GetVersion(this.GetType()); }
     58    }
    5659    public virtual Image ItemImage {
    5760      get { return VS2008ImageLibrary.Class; }
  • trunk/sources/HeuristicLab.Core/3.3/Collections/ItemSet.cs

    r3560 r3728  
    5454      get { return ItemAttribute.GetDescription(this.GetType()); }
    5555    }
     56    public Version ItemVersion {
     57      get { return ItemAttribute.GetVersion(this.GetType()); }
     58    }
    5659    public virtual Image ItemImage {
    5760      get { return VS2008ImageLibrary.Class; }
  • trunk/sources/HeuristicLab.Core/3.3/Collections/KeyedItemCollection.cs

    r3560 r3728  
    5050      get { return ItemAttribute.GetDescription(this.GetType()); }
    5151    }
     52    public Version ItemVersion {
     53      get { return ItemAttribute.GetVersion(this.GetType()); }
     54    }
    5255    public virtual Image ItemImage {
    5356      get { return HeuristicLab.Common.Resources.VS2008ImageLibrary.Class; }
  • trunk/sources/HeuristicLab.Core/3.3/Collections/ReadOnlyItemArray.cs

    r3560 r3728  
    5151      get { return ItemAttribute.GetDescription(this.GetType()); }
    5252    }
     53    public Version ItemVersion {
     54      get { return ItemAttribute.GetVersion(this.GetType()); }
     55    }
    5356    public virtual Image ItemImage {
    5457      get { return VS2008ImageLibrary.Class; }
  • trunk/sources/HeuristicLab.Core/3.3/Collections/ReadOnlyItemCollection.cs

    r3560 r3728  
    5151      get { return ItemAttribute.GetDescription(this.GetType()); }
    5252    }
     53    public Version ItemVersion {
     54      get { return ItemAttribute.GetVersion(this.GetType()); }
     55    }
    5356    public virtual Image ItemImage {
    5457      get { return VS2008ImageLibrary.Class; }
  • trunk/sources/HeuristicLab.Core/3.3/Collections/ReadOnlyItemDictionary.cs

    r3560 r3728  
    5151      get { return ItemAttribute.GetDescription(this.GetType()); }
    5252    }
     53    public Version ItemVersion {
     54      get { return ItemAttribute.GetVersion(this.GetType()); }
     55    }
    5356    public virtual Image ItemImage {
    5457      get { return VS2008ImageLibrary.Class; }
  • trunk/sources/HeuristicLab.Core/3.3/Collections/ReadOnlyItemList.cs

    r3560 r3728  
    5151      get { return ItemAttribute.GetDescription(this.GetType()); }
    5252    }
     53    public Version ItemVersion {
     54      get { return ItemAttribute.GetVersion(this.GetType()); }
     55    }
    5356    public virtual Image ItemImage {
    5457      get { return VS2008ImageLibrary.Class; }
  • trunk/sources/HeuristicLab.Core/3.3/Collections/ReadOnlyItemSet.cs

    r3560 r3728  
    5151      get { return ItemAttribute.GetDescription(this.GetType()); }
    5252    }
     53    public Version ItemVersion {
     54      get { return ItemAttribute.GetVersion(this.GetType()); }
     55    }
    5356    public virtual Image ItemImage {
    5457      get { return VS2008ImageLibrary.Class; }
  • trunk/sources/HeuristicLab.Core/3.3/Collections/ReadOnlyKeyedItemCollection.cs

    r3560 r3728  
    5151      get { return ItemAttribute.GetDescription(this.GetType()); }
    5252    }
     53    public Version ItemVersion {
     54      get { return ItemAttribute.GetVersion(this.GetType()); }
     55    }
    5356    public virtual Image ItemImage {
    5457      get { return VS2008ImageLibrary.Class; }
  • trunk/sources/HeuristicLab.Core/3.3/Interfaces/IItem.cs

    r3500 r3728  
    3131    string ItemName { get; }
    3232    string ItemDescription { get; }
     33    Version ItemVersion { get; }
    3334    Image ItemImage { get; }
    3435
  • trunk/sources/HeuristicLab.Core/3.3/Item.cs

    r3550 r3728  
    5050      get { return ItemAttribute.GetDescription(this.GetType()); }
    5151    }
     52    public Version ItemVersion {
     53      get { return ItemAttribute.GetVersion(this.GetType()); }
     54    }
    5255    public virtual Image ItemImage {
    5356      get { return HeuristicLab.Common.Resources.VS2008ImageLibrary.Class; }
  • trunk/sources/HeuristicLab.Encodings.BinaryVectorEncoding/3.3/Tests/TestRandom.cs

    r3483 r3728  
    109109    }
    110110
     111    public Version ItemVersion {
     112      get { throw new NotImplementedException(); }
     113    }
     114
    111115    public System.Drawing.Image ItemImage {
    112116      get { throw new NotImplementedException(); }
  • trunk/sources/HeuristicLab.Encodings.IntegerVectorEncoding/3.3/Tests/TestRandom.cs

    r3483 r3728  
    109109    }
    110110
     111    public Version ItemVersion {
     112      get { throw new NotImplementedException(); }
     113    }
     114
    111115    public System.Drawing.Image ItemImage {
    112116      get { throw new NotImplementedException(); }
  • trunk/sources/HeuristicLab.Encodings.PermutationEncoding/3.3/Tests/Random.cs

    r3483 r3728  
    109109    }
    110110
     111    public Version ItemVersion {
     112      get { throw new NotImplementedException(); }
     113    }
     114
    111115    public System.Drawing.Image ItemImage {
    112116      get { throw new NotImplementedException(); }
  • trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/Tests/TestRandom.cs

    r3483 r3728  
    109109    }
    110110
     111    public Version ItemVersion {
     112      get { throw new NotImplementedException(); }
     113    }
     114
    111115    public System.Drawing.Image ItemImage {
    112116      get { throw new NotImplementedException(); }
  • trunk/sources/HeuristicLab.Optimizer/3.3/NewItemDialog.Designer.cs

    r3202 r3728  
    5252      this.descriptioncolumnHeader = new System.Windows.Forms.ColumnHeader();
    5353      this.toolTip = new System.Windows.Forms.ToolTip(this.components);
     54      this.versionColumnHeader = new System.Windows.Forms.ColumnHeader();
    5455      this.SuspendLayout();
    5556      //
     
    8586      this.itemsListView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
    8687            this.nameColumnHeader,
     88            this.versionColumnHeader,
    8789            this.descriptioncolumnHeader});
    8890      this.itemsListView.FullRowSelect = true;
     
    100102      // nameColumnHeader
    101103      //
     104      this.nameColumnHeader.DisplayIndex = 0;
    102105      this.nameColumnHeader.Text = "Name";
    103106      this.nameColumnHeader.Width = 91;
     
    105108      // descriptioncolumnHeader
    106109      //
     110      this.descriptioncolumnHeader.DisplayIndex = 2;
    107111      this.descriptioncolumnHeader.Text = "Description";
    108112      this.descriptioncolumnHeader.Width = 190;
     113      //
     114      // versionColumnHeader
     115      //
     116      this.versionColumnHeader.DisplayIndex = 1;
     117      this.versionColumnHeader.Text = "Version";
    109118      //
    110119      // NewItemDialog
     
    140149    private System.Windows.Forms.ColumnHeader nameColumnHeader;
    141150    private System.Windows.Forms.ColumnHeader descriptioncolumnHeader;
     151    private System.Windows.Forms.ColumnHeader versionColumnHeader;
    142152  }
    143153}
  • trunk/sources/HeuristicLab.Optimizer/3.3/NewItemDialog.cs

    r3376 r3728  
    4949        var categories = from t in ApplicationManager.Manager.GetTypes(typeof(IItem))
    5050                         where CreatableAttribute.IsCreatable(t)
    51                          orderby CreatableAttribute.GetCategory(t), ItemAttribute.GetName(t) ascending
     51                         orderby CreatableAttribute.GetCategory(t), ItemAttribute.GetName(t), ItemAttribute.GetVersion(t) ascending
    5252                         group t by CreatableAttribute.GetCategory(t) into c
    5353                         select c;
     
    6060            IItem i = (IItem)Activator.CreateInstance(creatable);
    6161            items.Add(i);
    62             ListViewItem item = new ListViewItem(new string[] { i.ItemName, i.ItemDescription}, group);
     62            ListViewItem item = new ListViewItem(new string[] { i.ItemName, i.ItemVersion.ToString(), i.ItemDescription}, group);
    6363            itemsListView.SmallImageList.Images.Add(i.ItemImage);
    6464            item.ImageIndex = itemsListView.SmallImageList.Images.Count - 1;
Note: See TracChangeset for help on using the changeset viewer.