@@ -48,31 +48,16 @@ void MonoScriptManager::initialize(const Node& owner) {
}
-void MonoScriptManager::addAssembly(AssemblyMap::mapped_type assembly,
- AssemblyMap::key_type name) {
- //\todo read lock for multithreading
- assemblies.insert(make_pair(name, assembly));
-}
-
-MonoAssembly* MonoScriptManager::getAssembly(AssemblyMap::key_type name) {
- //\todo read lock for multithreading
- AssemblyMap::iterator assembly = assemblies.find(name);
- if (assembly == assemblies.end()) {
- throw runtime_error((string("Assembly not found: ") + name).c_str());
- }
- return assembly->second;
-}
+MonoAssembly* MonoScriptManager::getAssembly(string imageName) {
+ MonoImage* image = mono_image_loaded(imageName.c_str());
-void MonoScriptManager::removeAssembly(AssemblyMap::key_type name) {
- //\todo write lock for multithreading
- AssemblyMap::iterator assembly = assemblies.find(name);
- if (assembly == assemblies.end()) {
- throw runtime_error((string("Assembly not found: ") + name).c_str());
+ if (!image) {
+ throw runtime_error((string("Image not loaded: ") + imageName).c_str());
}
- assemblies.erase(assembly);
-}
+ return mono_image_get_assembly(image);
+}
MonoScriptManager::RootDomain::RootDomain() {
-/*
-Copyright 2007, JD Marble <
[email protected]>
-
-This file is part of MidoriGraph.
-
-MidoriGraph is free software; you can redistribute it and/or modify it under the
-terms of the GNU General Public License as published by the Free Software
-Foundation; either version 2 of the License, or (at your option) any later
-version.
-
-MidoriGraph is distributed in the hope that it will be useful, but WITHOUT ANY
-WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-PARTICULAR PURPOSE. See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License along with
-MidoriGraph; if not, write to the Free Software Foundation, Inc.,
-51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-*/
-
-#include <boost/test/auto_unit_test.hpp>
-
-#include "Node.hpp"
-#include "MonoScriptManager.hpp"
-
-using namespace MidoriGraph;
-using namespace std;
-
-
-BOOST_AUTO_TEST_CASE (MonoScriptManager_initialize) {
-
- Node root = Node::makeRoot();
- root.addProperty(new MonoScriptManager());
-}
-
-
-BOOST_AUTO_TEST_CASE (MonoScriptManager_addAssembly) {
-
- Node root = Node::makeRoot();
- root.addProperty(new MonoScriptManager());
-
- root.getProperty<MonoScriptManager>()->
- addAssembly((MonoAssembly*)(0), "foo");
-}
-
-
-BOOST_AUTO_TEST_CASE (MonoScriptManager_getAssembly) {
-
- Node root = Node::makeRoot();
- root.addProperty(new MonoScriptManager());
-
- root.getProperty<MonoScriptManager>()->
- addAssembly((MonoAssembly*)(42), "foo");
-
- MonoAssembly* assembly;
- BOOST_REQUIRE_NO_THROW(
- assembly = root.getProperty<MonoScriptManager>()->getAssembly("foo"));
-
- BOOST_CHECK_EQUAL(int(assembly), 42);
-}
-
-
-BOOST_AUTO_TEST_CASE (MonoScriptManager_getAssembly_fail) {
-
- Node root = Node::makeRoot();
- root.addProperty(new MonoScriptManager());
-
- BOOST_CHECK_THROW(root.getProperty<MonoScriptManager>()->getAssembly("foo"),
- runtime_error);
-
-}
-
-
-BOOST_AUTO_TEST_CASE (MonoScriptManager_removeAssembly) {
-
- Node root = Node::makeRoot();
- root.addProperty(new MonoScriptManager());
-
- root.getProperty<MonoScriptManager>()->
- addAssembly((MonoAssembly*)(42), "foo");
-
- MonoAssembly* assembly;
- BOOST_REQUIRE_NO_THROW(
- root.getProperty<MonoScriptManager>()->removeAssembly("foo"));
-
- BOOST_CHECK_THROW(root.getProperty<MonoScriptManager>()->getAssembly("foo"),
- runtime_error);
-}
-
-
-BOOST_AUTO_TEST_CASE (MonoScriptManager_removeAssembly_fail) {
-
- Node root = Node::makeRoot();
- root.addProperty(new MonoScriptManager());
-
- BOOST_CHECK_THROW(
- root.getProperty<MonoScriptManager>()->removeAssembly("foo"),
- runtime_error);
-}
+/*
+Copyright 2007, JD Marble <
[email protected]>
+
+This file is part of MidoriGraph.
+
+MidoriGraph is free software; you can redistribute it and/or modify it under the
+terms of the GNU General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+MidoriGraph is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+PARTICULAR PURPOSE. See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+MidoriGraph; if not, write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#include <boost/test/auto_unit_test.hpp>
+
+#include "Node.hpp"
+#include "MonoScriptManager.hpp"
+
+using namespace MidoriGraph;
+using namespace std;
+
+
+BOOST_AUTO_TEST_CASE (MonoScriptManager_initialize) {
+
+ Node root = Node::makeRoot();
+ root.addProperty(new MonoScriptManager());
+}
+
+