[Kde-bindings] KDE/kdebindings/csharp

Arno Rehn kde at arnorehn.de
Tue Dec 23 14:08:59 UTC 2008


SVN commit 900748 by arnorehn:

* Add support for on-the-fly compilation of dataengines.

CCMAIL: kde-bindings at kde.org



 M  +16 -3     plasma/src/PlasmaScriptengineKimono_DataEngine.cs  
 M  +1 -0      qyoto/ChangeLog  


--- trunk/KDE/kdebindings/csharp/plasma/src/PlasmaScriptengineKimono_DataEngine.cs #900747:900748
@@ -40,17 +40,30 @@
         public override bool Init() {
             QFileInfo program = new QFileInfo(MainScript());
 
-            dataEngineAssembly = Assembly.LoadFile(program.AbsoluteFilePath());
+            Console.WriteLine(MainScript());
+
+            KMimeType mime = KMimeType.FindByFileContent(program.AbsoluteFilePath());
+            try {
+                if (mime.Name().StartsWith("text/")) {
+                    Compiler c = new Compiler(program);
+                    dataEngineAssembly = c.GetAssembly();
+                } else {
+                    dataEngineAssembly = Assembly.LoadFile(program.AbsoluteFilePath());
+                }
+            } catch (Exception e) {
+                Console.WriteLine(e);
+                return false;
+            }
             
-            // the newly loaded assembly might contain reference other bindings that need to be initialized
+            // the newly loaded assembly might reference other bindings that need to be initialized
             foreach (AssemblyName an in dataEngineAssembly.GetReferencedAssemblies()) {
-                // if the binding has already been initialized (e.g. in SmokeInvocation.InitRuntime()), continue.
                 Assembly a = null;
                 try {
                     a = Assembly.Load(an);
                 } catch (FileNotFoundException e) {
                     a = Assembly.LoadFile(Path.Combine(Path.GetDirectoryName(dataEngineAssembly.Location), an.Name + ".dll"));
                 }
+                // if the binding has already been initialized (e.g. in SmokeInvocation.InitRuntime()), continue.
                 if (SmokeInvocation.InitializedAssemblies.Contains(a)) continue;
                 AssemblySmokeInitializer attr = (AssemblySmokeInitializer) Attribute.GetCustomAttribute(a, typeof(AssemblySmokeInitializer));
                 if (attr != null) attr.CallInitSmoke();
--- trunk/KDE/kdebindings/csharp/qyoto/ChangeLog #900747:900748
@@ -2,6 +2,7 @@
 
 	* Add a QList<const char*> marshaller. For the moment it only works in the
 	  'ToObject' direction.
+	* Add support for on-the-fly compilation of dataengines.
 
 2008-12-20  Arno Rehn  <arno at arnorehn.de>
 



More information about the Kde-bindings mailing list