Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/05/15 10:51:29 (9 years ago)
Author:
jkarder
Message:

#2211: merged r11450, r11466, r11483, r11514, r11515 and r11890 into stable
#2234: merged r11308, r11309, r11326, r11337, r11340, r11339, r11342, r11361, r11427, r11447, r11464, r11542, r11544, r11545, r11547, r11548 into stable
#2239: merged r11437, r11439 and r11472 into stable
#2262: merged r11436, r11440, r11471, r11474, r11477, r11479, r11480, r11605, r11657, r11721, r11734, r11735, r11787, r11788, r11789 and r11826 into stable

Location:
stable
Files:
2 deleted
4 edited
1 copied

Legend:

Unmodified
Added
Removed
  • stable

  • stable/HeuristicLab.Scripting/3.3/HeuristicLab.Scripting-3.3.csproj

    r11129 r11907  
    8585  </ItemGroup>
    8686  <ItemGroup>
    87     <Compile Include="CSharpScript.cs" />
     87    <Compile Include="Scripts\CSharp\CSharpScript.cs" />
     88    <Compile Include="Scripts\Templates\CSharpScriptTemplate.cs" />
     89    <Compile Include="Scripts\Templates\ScriptTemplates.Designer.cs">
     90      <AutoGen>True</AutoGen>
     91      <DesignTime>True</DesignTime>
     92      <DependentUpon>ScriptTemplates.resx</DependentUpon>
     93    </Compile>
    8894    <Compile Include="Variables.cs" />
    8995    <Compile Include="VariableStore.cs" />
    9096    <None Include="Plugin.cs.frame" />
    9197    <Compile Include="Script.cs" />
    92     <Compile Include="CSharpScriptBase.cs" />
     98    <Compile Include="Scripts\CSharp\CSharpScriptBase.cs" />
    9399    <Compile Include="Plugin.cs" />
    94100    <Compile Include="Properties\AssemblyInfo.cs" />
     
    130136    </ProjectReference>
    131137  </ItemGroup>
     138  <ItemGroup>
     139    <EmbeddedResource Include="Scripts\Templates\ScriptTemplates.resx">
     140      <Generator>ResXFileCodeGenerator</Generator>
     141      <LastGenOutput>ScriptTemplates.Designer.cs</LastGenOutput>
     142      <CustomToolNamespace>HeuristicLab.Scripting</CustomToolNamespace>
     143    </EmbeddedResource>
     144  </ItemGroup>
    132145  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
    133146   <PropertyGroup>
  • stable/HeuristicLab.Scripting/3.3/Script.cs

    r10892 r11907  
    7979    public Script()
    8080      : base("Script", "An empty script.") {
    81       code = string.Empty;
     81      code = CodeTemplate;
    8282    }
    8383    public Script(string code)
     
    108108        WarningLevel = 4
    109109      };
     110
    110111      parameters.ReferencedAssemblies.AddRange(
    111112        GetAssemblies()
    112113        .Select(a => a.Location)
    113114        .ToArray());
    114       var unit = CreateCompilationUnit();
    115       var writer = new StringWriter();
    116       CodeProvider.GenerateCodeFromCompileUnit(
    117         unit,
    118         writer,
    119         new CodeGeneratorOptions {
    120           ElseOnClosing = true,
    121           IndentString = "  ",
    122         });
    123       return CodeProvider.CompileAssemblyFromDom(parameters, unit);
     115
     116      return CodeProvider.CompileAssemblyFromSource(parameters, code);
    124117    }
    125118
     
    134127            .AppendLine(error.ErrorText);
    135128        }
    136         throw new Exception(string.Format("Compilation of \"{0}\" failed:{1}{2}",
     129        throw new InvalidOperationException(string.Format("Compilation of \"{0}\" failed:{1}{2}",
    137130          Name, Environment.NewLine, sb.ToString()));
    138131      } else {
     
    142135
    143136    public virtual IEnumerable<Assembly> GetAssemblies() {
    144       var assemblies = new List<Assembly>();
    145       foreach (var a in AppDomain.CurrentDomain.GetAssemblies()) {
    146         try {
    147           if (File.Exists(a.Location)) assemblies.Add(a);
    148         } catch (NotSupportedException) {
    149           // NotSupportedException is thrown while accessing
    150           // the Location property of the anonymously hosted
    151           // dynamic methods assembly, which is related to
    152           // LINQ queries
    153         }
    154       }
     137      var assemblies = AppDomain.CurrentDomain.GetAssemblies().Where(a => !a.IsDynamic && File.Exists(a.Location)).ToList();
    155138      assemblies.Add(typeof(Microsoft.CSharp.RuntimeBinder.Binder).Assembly); // for dlr functionality
    156139      return assemblies;
  • stable/HeuristicLab.Scripting/3.3/VariableStore.cs

    r11090 r11907  
    2121
    2222using System;
     23using System.Drawing;
    2324using System.IO;
    2425using HeuristicLab.Collections;
    2526using HeuristicLab.Common;
     27using HeuristicLab.Common.Resources;
    2628using HeuristicLab.Core;
    2729using HeuristicLab.Persistence.Core;
     
    3234  [Item("VariableStore", "Represents a variable store.")]
    3335  [StorableClass]
    34   public class VariableStore : ObservableDictionary<string, object>, IContent, IDeepCloneable {
     36  public class VariableStore : ObservableDictionary<string, object>, IItem {
     37    #region Properties
     38    public virtual string ItemName {
     39      get { return ItemAttribute.GetName(GetType()); }
     40    }
     41    public virtual string ItemDescription {
     42      get { return ItemAttribute.GetDescription(GetType()); }
     43    }
     44    public Version ItemVersion {
     45      get { return ItemAttribute.GetVersion(GetType()); }
     46    }
     47    public static Image StaticItemImage {
     48      get { return VSImageLibrary.Class; }
     49    }
     50    public virtual Image ItemImage {
     51      get { return ItemAttribute.GetImage(GetType()); }
     52    }
     53    #endregion
     54
     55    #region Constructors & Cloning
    3556    [StorableConstructor]
    3657    protected VariableStore(bool deserializing) : base(deserializing) { }
     
    6889      }
    6990    }
     91    #endregion
     92
     93    #region Overrides
     94    public override string ToString() {
     95      return ItemName;
     96    }
     97    #endregion
     98
     99    #region Events
     100    public event EventHandler ItemImageChanged;
     101    protected virtual void OnItemImageChanged() {
     102      var handler = ItemImageChanged;
     103      if (handler != null) handler(this, EventArgs.Empty);
     104    }
     105    public event EventHandler ToStringChanged;
     106    protected virtual void OnToStringChanged() {
     107      var handler = ToStringChanged;
     108      if (handler != null) handler(this, EventArgs.Empty);
     109    }
     110    #endregion
    70111  }
    71112}
Note: See TracChangeset for help on using the changeset viewer.