Changeset 11787


Ignore:
Timestamp:
01/16/15 11:23:17 (5 years ago)
Author:
jkarder
Message:

#2262: refactored code template loading

Location:
trunk/sources/HeuristicLab.Scripting/3.3
Files:
5 added
2 edited
3 moved

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Scripting/3.3/HeuristicLab.Scripting-3.3.csproj

    r11721 r11787  
    9191  </ItemGroup>
    9292  <ItemGroup>
    93     <Compile Include="CSharpScript.cs" />
    94     <EmbeddedResource Include="CSharpScriptCode.cs" />
     93    <Compile Include="Scripts\CSharp\CSharpScript.cs" />
     94    <Compile Include="Scripts\Templates\CSharpScriptTemplate.cs" />
     95    <Compile Include="Scripts\Templates\ScriptTemplates.Designer.cs">
     96      <AutoGen>True</AutoGen>
     97      <DesignTime>True</DesignTime>
     98      <DependentUpon>ScriptTemplates.resx</DependentUpon>
     99    </Compile>
    95100    <Compile Include="Variables.cs" />
    96101    <Compile Include="VariableStore.cs" />
    97102    <None Include="Plugin.cs.frame" />
    98103    <Compile Include="Script.cs" />
    99     <Compile Include="CSharpScriptBase.cs" />
     104    <Compile Include="Scripts\CSharp\CSharpScriptBase.cs" />
    100105    <Compile Include="Plugin.cs" />
    101106    <Compile Include="Properties\AssemblyInfo.cs" />
     
    137142    </ProjectReference>
    138143  </ItemGroup>
     144  <ItemGroup>
     145    <EmbeddedResource Include="Scripts\Templates\ScriptTemplates.resx">
     146      <Generator>ResXFileCodeGenerator</Generator>
     147      <LastGenOutput>ScriptTemplates.Designer.cs</LastGenOutput>
     148    </EmbeddedResource>
     149  </ItemGroup>
    139150  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
    140151  <PropertyGroup>
  • trunk/sources/HeuristicLab.Scripting/3.3/Script.cs

    r11721 r11787  
    157157      if (handler != null) handler(this, EventArgs.Empty);
    158158    }
    159 
    160     #region Helpers
    161     protected virtual string ReadCodeTemplate(string templateName) {
    162       using (var stream = Assembly.GetAssembly(this.GetType()).GetManifestResourceStream(templateName))
    163       using (var reader = new StreamReader(stream)) {
    164         return reader.ReadToEnd();
    165       }
    166     }
    167     #endregion
    168159  }
    169160}
  • trunk/sources/HeuristicLab.Scripting/3.3/Scripts/CSharp/CSharpScript.cs

    r11747 r11787  
    3535    #region Constants
    3636    protected const string ExecuteMethodName = "Execute";
    37     protected override string CodeTemplate { get { return ReadCodeTemplate("HeuristicLab.Scripting.CSharpScriptCode.cs"); } }
     37    protected override string CodeTemplate { get { return ScriptTemplates.CSharpScriptTemplate; } }
    3838    #endregion
    3939
  • trunk/sources/HeuristicLab.Scripting/3.3/Scripts/Templates/CSharpScriptTemplate.cs

    r11747 r11787  
    99using System.Linq;
    1010using System.Collections.Generic;
     11
     12using HeuristicLab.Core;
    1113using HeuristicLab.Common;
    12 using HeuristicLab.Core;
    13 using HeuristicLab.Data;
     14//using HeuristicLab.Collections;
     15//using HeuristicLab.Data;
    1416
    1517public class MyScript : HeuristicLab.Scripting.CSharpScriptBase {
Note: See TracChangeset for help on using the changeset viewer.