Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/07/14 16:31:17 (11 years ago)
Author:
abeham
Message:

#2136:

  • Made Variables class public (could be used in other scripts as well)
  • Renamed ItemName to "C# Script"
Location:
trunk/sources/HeuristicLab.Scripting/3.3
Files:
1 added
3 edited

Legend:

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

    r10506 r10566  
    8585  </ItemGroup>
    8686  <ItemGroup>
     87    <Compile Include="Variables.cs" />
    8788    <Compile Include="VariableStore.cs" />
    8889    <None Include="Plugin.cs.frame" />
  • trunk/sources/HeuristicLab.Scripting/3.3/Script.cs

    r10506 r10566  
    3838
    3939namespace HeuristicLab.Scripting {
    40   [Item("Script", "An empty C# script.")]
     40  [Item("C# Script", "An empty C# script.")]
    4141  [Creatable("Scripts")]
    4242  [StorableClass]
  • trunk/sources/HeuristicLab.Scripting/3.3/UserScriptBase.cs

    r10512 r10566  
    5252      var handler = ConsoleOutputChanged;
    5353      if (handler != null) handler(null, new EventArgs<string>(args));
    54     }
    55 
    56     protected class Variables : DynamicObject, IEnumerable<KeyValuePair<string, object>> {
    57       private readonly VariableStore variableStore;
    58 
    59       public ICollection<string> Keys {
    60         get { return variableStore.Keys; }
    61       }
    62 
    63       public ICollection<object> Values {
    64         get { return variableStore.Values; }
    65       }
    66 
    67       public Variables(VariableStore variableStore) {
    68         this.variableStore = variableStore;
    69       }
    70 
    71       public override bool TryGetMember(GetMemberBinder binder, out object result) {
    72         return variableStore.TryGetValue(binder.Name, out result);
    73       }
    74 
    75       public override bool TrySetMember(SetMemberBinder binder, object value) {
    76         variableStore[binder.Name] = value;
    77         return true;
    78       }
    79 
    80       public bool Contains(string variableName) {
    81         return variableStore.ContainsKey(variableName);
    82       }
    83 
    84       public IEnumerator<KeyValuePair<string, object>> GetEnumerator() {
    85         return variableStore.GetEnumerator();
    86       }
    87 
    88       IEnumerator IEnumerable.GetEnumerator() {
    89         return GetEnumerator();
    90       }
    9154    }
    9255
Note: See TracChangeset for help on using the changeset viewer.