//Fang: How to deal the Enum
string ret = "";
- if (System.Type.Missing == valueObject)
- {
- ret += "yy ";
- }
- else if (null == valueObject)
+ if (null == valueObject)
{
ret += "zz ";
}
VariableDefinition vardef = new VariableDefinition(typeref);
Context.Variables[node] = vardef;
- var argumentList = GetCtorXArguments(node, factoryCtorInfo.Parameters.Count, true);
+ var argumentList = GetCtorXArguments(node, factoryCtorInfo.Parameters.Count);
Context.Values[node] = new EXamlCreateObject(Context, null, typedef, argumentList.ToArray());
return;
}
VariableDefinition vardef = new VariableDefinition(typeref);
Context.Variables[node] = vardef;
- var argumentList = GetCtorXArguments(node, factoryMethodInfo.Parameters.Count, false);
+ var argumentList = GetCtorXArguments(node, factoryMethodInfo.Parameters.Count);
Context.Values[node] = new EXamlCreateObject(Context, null, typedef, factoryMethodInfo, argumentList?.ToArray());
return;
}
return true;
}
- List<object> GetCtorXArguments(ElementNode enode, int paramsCount, bool isConstructor)
+ List<object> GetCtorXArguments(ElementNode enode, int paramsCount)
{
if (!enode.Properties.ContainsKey(XmlName.xArguments))
{
argumentList.Add(Context.Values[arguments[i]]);
}
- if (!isConstructor)
+ for (int i = arguments.Count; i < paramsCount; i++)
{
- for (int i = arguments.Count; i < paramsCount; i++)
- {
- argumentList.Add(Type.Missing);
- }
+ argumentList.Add(null);
}
return argumentList;
var realValue = context.Values[elementNode] as EXamlCreateObject;
if (null != realValue)
{
- var valueTypeRef = realValue.GetType();
- if (valueTypeRef.InheritsFromOrImplements(propertyType))
- {
- return true;
- }
-
- var realTypeFromMarkupExtension = valueTypeRef.GetRealTypeIfIsMarkupExtension();
-
- if (true == realTypeFromMarkupExtension?.InheritsFromOrImplements(propertyType))
+ if (realValue.GetType().InheritsFromOrImplements(propertyType))
{
return true;
}
else if (targetTypeRef.FullName == "System.UInt16")
yield return Instruction.Create(OpCodes.Ldc_I4, unchecked((int)UInt16.Parse(str, CultureInfo.InvariantCulture)));
else if (targetTypeRef.FullName == "System.UInt32")
- yield return Instruction.Create(OpCodes.Ldc_I4, unchecked((int)UInt32.Parse(str, CultureInfo.InvariantCulture)));
+ yield return Instruction.Create(OpCodes.Ldc_I8, unchecked((uint)UInt32.Parse(str, CultureInfo.InvariantCulture)));
else if (targetTypeRef.FullName == "System.UInt64")
yield return Instruction.Create(OpCodes.Ldc_I8, unchecked((long)UInt64.Parse(str, CultureInfo.InvariantCulture)));
else if (targetTypeRef.FullName == "System.Single")
{
- if (null != GetDPValueSubFix(str))
+ if (str.EndsWith("dp") || str.EndsWith("px"))
{
var insOfDPValue = GetDPValue(module, node, targetTypeRef, str);
return typeRef.InheritsFromOrImplements(baseClass);
}
- public static TypeReference GetRealTypeIfIsMarkupExtension(this TypeReference typeRef)
- {
- TypeReference ret = null;
-
- var typeDef = typeRef.ResolveCached();
-
- foreach (var @interface in typeDef.Interfaces)
- {
- if (@interface.InterfaceType is GenericInstanceType instanceType)
- {
- if ("Tizen.NUI.Xaml.IMarkupExtension`1" == instanceType.ElementType.FullName
- &&
- 1 == instanceType.GenericArguments.Count)
- {
- ret = instanceType.GenericArguments[0];
- break;
- }
- }
- }
-
- if (null == ret)
- {
- ret = typeDef.BaseType?.GetRealTypeIfIsMarkupExtension();
- }
-
- return ret;
- }
-
static CustomAttribute GetCustomAttribute(this TypeReference typeRef, TypeReference attribute)
{
var typeDef = typeRef.ResolveCached();
using Mono.Cecil;
+using Tizen.NUI.Xaml;
+using Mono.Cecil.Cil;
+using Mono.Cecil.Pdb;
+using Mono.Cecil.Mdb;
+
namespace Tizen.NUI.Xaml.Build.Tasks
{
[LoadInSeparateAppDomain]
Value = valueString[0];
break;
- case 'y':
- Value = Type.Missing;
- break;
-
case 'z':
Value = null;
break;
*/
using System;
using System.Collections.Generic;
-using System.Globalization;
using System.Reflection;
using System.Text;
using Tizen.NUI.BaseComponents;
if (null == xFactoryMethod)
{
- obj = Activator.CreateInstance(type, BindingFlags.CreateInstance | BindingFlags.Public | BindingFlags.Instance | BindingFlags.OptionalParamBinding, null, paramList.ToArray(), CultureInfo.CurrentCulture);
+ obj = Activator.CreateInstance(type, paramList.ToArray());
}
else
{