Exemplo n.º 1
0
 //Cast the value-string to the proper type and assign it
 private void assignVal(HookObj hookobj, string value)
 {
     try
     {
         if (hookobj.theType == typeof(string))
         {
             hookobj.SetValue(value);
         }
         else if (hookobj.theType == typeof(int))
         {
             hookobj.SetValue(Int32.Parse(value));
         }
         else if (hookobj.theType == typeof(float))
         {
             hookobj.SetValue(float.Parse(value));
         }
         else
         {
             throw new NotImplementedException();
         }
     }
     catch (RuntimeBinderException ex) { throw new NotImplementedException("", ex); }
     catch (System.FormatException ex) { throw new NotImplementedException("", ex); }
 }
 //Cast the value-string to the proper type and assign it
 private void assignVal(HookObj hookobj, string value)
 {
     hookobj.SetValue(value);
 }
Exemplo n.º 3
0
    protected void newHookAndAdd <T>(Action <T> setter, Func <T> getter, string name)
    {
        HookObj hook = new HookObj <T>(setter, getter);

        dict.Add(name, hook);
    }