diff options
| author | jpbruyere <jp.bruyere@hotmail.com> | 2016-02-10 22:11:01 +0100 |
|---|---|---|
| committer | jpbruyere <jp.bruyere@hotmail.com> | 2016-02-10 22:11:01 +0100 |
| commit | 304127f03323f63ea55ff50e61236983d8aba271 (patch) | |
| tree | e27d24d17c9acf77bf68a9a828ac45fb7ab9e3e6 /src/GraphicObjects/GraphicObject.cs | |
| parent | 639e2fe0b213d85110e102679157a8ecf90f2523 (diff) | |
handle parsing of string value in defaultLoader
Diffstat (limited to 'src/GraphicObjects/GraphicObject.cs')
| -rw-r--r-- | src/GraphicObjects/GraphicObject.cs | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/src/GraphicObjects/GraphicObject.cs b/src/GraphicObjects/GraphicObject.cs index 85ccfe73..90d850b5 100644 --- a/src/GraphicObjects/GraphicObject.cs +++ b/src/GraphicObjects/GraphicObject.cs @@ -453,11 +453,11 @@ namespace Crow il.Emit(OpCodes.Nop); - + int cpt = 0; foreach (PropertyInfo pi in thisType.GetProperties(BindingFlags.Public | BindingFlags.Instance)) { string name = ""; - + cpt++; #region retrieve custom attributes if (pi.GetSetMethod () == null) continue; @@ -537,7 +537,11 @@ namespace Crow il.Emit (OpCodes.Pop); continue; } - } else { + } else if (dvType.FullName == "System.String") { + il.Emit (OpCodes.Ldstr, Convert.ToString (defaultValue)); +// il.Emit (OpCodes.Pop); +// continue; + }else{ if (!dvType.IsEnum) { il.Emit (OpCodes.Pop); continue; @@ -549,15 +553,19 @@ namespace Crow MethodInfo miParse = pi.PropertyType.GetMethod ("Parse", BindingFlags.Static | BindingFlags.Public); if (miParse != null) { il.Emit (OpCodes.Callvirt, miParse); - } + if (miParse.ReturnType != pi.PropertyType) + il.Emit(OpCodes.Unbox_Any, pi.PropertyType); +// il.Emit(OpCodes.Castclass, pi.PropertyType); + + } else + Debugger.Break (); } } il.Emit (OpCodes.Callvirt, pi.GetSetMethod ()); - + } - - //il.Emit(OpCodes.Pop); + il.Emit(OpCodes.Ret); Interface.DefaultValuesLoader[thisType.FullName] = (Interface.loadDefaultInvoker)dm.CreateDelegate(typeof(Interface.loadDefaultInvoker)); |