[Tizen S] Integrate app types(dotnet, dotnet-nui)
[platform/core/dotnet/launcher.git] / Managed / Tizen.Runtime / Preloader.cs
index afb614d..ea0737b 100644 (file)
@@ -19,6 +19,7 @@ using System.IO;
 using System.Reflection;
 using System.Runtime.Loader;
 using System.Globalization;
+using System.Runtime.CompilerServices;
 
 namespace Tizen.Runtime
 {
@@ -30,9 +31,16 @@ namespace Tizen.Runtime
         // than calling out to the OS for culture-aware casing.
         // However, in certain languages, the following function may be significantly slowed down.
         // To avoid that kind situation, call it in advance on the candidate process.
+        [MethodImpl(MethodImplOptions.NoOptimization | MethodImplOptions.NoInlining)]
         private static void CheckAsciiCasing()
         {
             _ = CultureInfo.CurrentCulture.CompareInfo.Compare("abcdefghijklmnopqrstuvwxyz", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", CompareOptions.IgnoreCase);
+            _ = "abc".ToUpper().ToLower();
+        }
+
+        public static void CoreclrPreload()
+        {
+            CheckAsciiCasing();
         }
 
         public static void Preload()
@@ -42,6 +50,11 @@ namespace Tizen.Runtime
             if (!Directory.Exists(preloadPath))
                 return;
 
+            // If TIZEN_UIFW is not set or NUI, do not preload UI related dll
+            string uifw = System.Environment.GetEnvironmentVariable("TIZEN_UIFW");
+            if (uifw == null || uifw != "NUI")
+                return;
+
             string[] paths = Directory.GetFiles(preloadPath, "*.preload");
             Array.Sort(paths);
             foreach (string path in paths)
@@ -60,18 +73,13 @@ namespace Tizen.Runtime
                 if (fileName.IndexOf('.') != 2)
                     continue;
 
-                string value = System.Environment.GetEnvironmentVariable("TIZEN_UIFW");
-                // if TIZEN_UIFW is not set, do not preload UI related dll
-                if (value == null && (fileName.Contains("NUI") || fileName.Contains("ElmSharp") || fileName.Contains("XSF") ))
-                    continue;
-                else if (value == "ElmSharp" && fileName.Contains("NUI"))
-                    continue;
-                else if (value == "NUI" && (fileName.Contains("ElmSharp") || fileName.Contains("XSF")))
+                // TIZEN_UIFW only set NUI
+                if (fileName.Contains("ElmSharp") || fileName.Contains("XSF"))
                     continue;
 
                 try
                 {
-                    Console.WriteLine("Start preload : " + fileName);
+                    Console.WriteLine("UIFW: " + uifw + " Start preload : " + fileName);
                     BindingFlags bindingFlag = BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic;
                     foreach (string line in File.ReadLines(path))
                     {