static bool CanAddToDictionary(EXamlCreateObject parent, TypeReference collectionType, IElementNode node, IXmlLineInfo lineInfo, EXamlContext context)
{
+ if ("Tizen.NUI.Xaml.Build.Tasks.ArrayExtension" == collectionType.FullName)
+ {
+ return false;
+ }
+
var typeOfDictionary = collectionType.GetRealTypeOfDictionary();
if (null != typeOfDictionary)
var typeref = parentContext.Module.ImportReference(rootnode.XmlType.GetTypeReference(XmlTypeExtensions.ModeOfGetType.Both, parentContext.Module, rootnode));
var visitorContext = new EXamlContext(typeref.ResolveCached(), typeref.Module, parentContext.EmbeddedResourceNameSpace);
+ foreach (var pair in parentContext.resourceDictionary)
+ {
+ visitorContext.resourceDictionary.Add(pair.Key, pair.Value);
+ }
+
rootnode.Accept(new XamlNodeVisitor((node, parent) => node.Parent = parent), null);
rootnode.Accept(new EXamlExpandMarkupsVisitor(visitorContext), null);
rootnode.Accept(new PruneIgnoredNodesVisitor(), null);
ReadSymbols = NeedDebug,
};
+ if (UseInjection)
+ {
+ XamlOptimization = 1;
+ }
+
+ LoggingHelper.LogWarning($"XamlOptimization is {XamlOptimization}.");
+
using (var assemblyDefinition = AssemblyDefinition.ReadAssembly(System.IO.Path.GetFullPath(Assembly), readerParameters))
{
if (null != XamlFilePath)
bool currentRetOfType = false;
IList<Exception> currentExceptionsOfType = null;
- if (UseInjection)
- {
- XamlOptimization = 1;
- }
-
- LoggingHelper.LogWarning($"XamlOptimization is {XamlOptimization}.");
-
if (0 == XamlOptimization)
{
currentRetOfType = true;
var operation = new CreateDPObject(globalDataList, opInfo);
globalDataList.Operations.Add(operation);
};
+
+ createOperations[(int)EXamlOperationType.AddToDictionary] = (GlobalDataList globalDataList, List<object> opInfo) =>
+ {
+ var operation = new AddToDictionary(globalDataList, opInfo);
+ globalDataList.Operations.Add(operation);
+ };
+
+ createOperations[(int)EXamlOperationType.CreateResourceDictionary] = (GlobalDataList globalDataList, List<object> opInfo) =>
+ {
+ var operation = new CreateResourceDictionary(globalDataList, opInfo);
+ globalDataList.Operations.Add(operation);
+ };
}
}
}
--- /dev/null
+/*
+ * Copyright(c) 2021 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Binding;
+using Tizen.NUI.Binding.Internals;
+
+namespace Tizen.NUI.EXaml
+{
+ internal class AddToDictionary : Operation
+ {
+ public AddToDictionary(GlobalDataList globalDataList, List<object> operationInfo)
+ {
+ parentIndex = (int)operationInfo[0];
+ key = operationInfo[1];
+ value = operationInfo[2];
+ this.globalDataList = globalDataList;
+ }
+
+ private GlobalDataList globalDataList;
+
+ public void Do()
+ {
+ object dict = globalDataList.GatheredInstances[parentIndex];
+
+ var type = dict.GetType();
+ var method = type.GetMethods().FirstOrDefault(m => m.Name == "Add");
+
+ method.Invoke(dict, new object[] { key, value });
+ }
+
+ private int parentIndex;
+ private object key;
+ private object value;
+ }
+}
--- /dev/null
+/*
+ * Copyright(c) 2022 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+using Tizen.NUI.Binding;
+
+namespace Tizen.NUI.EXaml
+{
+ class CreateResourceDictionary : Operation
+ {
+ public CreateResourceDictionary(GlobalDataList globalDataList, List<object> operationInfo)
+ {
+ typeIndex = (int)operationInfo[0];
+ indexRangeOfContent = ((int)operationInfo[1], (int)operationInfo[2]);
+ this.globalDataList = globalDataList;
+ }
+
+ private GlobalDataList globalDataList;
+ private int typeIndex;
+ private (int, int) indexRangeOfContent;
+
+ public void Do()
+ {
+ var content = globalDataList.LongStrings.Substring(indexRangeOfContent.Item1, indexRangeOfContent.Item2 - indexRangeOfContent.Item1 + 1);
+ var resourceDictionary = EXamlExtensions.CreateObjectFromEXaml(content) as ResourceDictionary;
+
+ globalDataList.GatheredInstances.Add(resourceDictionary);
+
+ if (null == globalDataList.Root)
+ {
+ globalDataList.Root = resourceDictionary;
+ }
+ }
+ }
+}
RegisterXName,
GetLongString,
CreateDPObject,
+ AddToDictionary,
+ CreateResourceDictionary,
MAX
}
}