Index: trunk/abdev/BasicCompiler_Common/src/Class.cpp
===================================================================
--- trunk/abdev/BasicCompiler_Common/src/Class.cpp	(revision 324)
+++ trunk/abdev/BasicCompiler_Common/src/Class.cpp	(revision 325)
@@ -589,4 +589,21 @@
 
 	return 0;
+}
+
+const ::Delegate &CClass::GetDelegate() const
+{
+	const ::Delegate *dg = compiler.GetObjectModule().meta.GetDelegates().GetHashArrayElement( GetName().c_str() );
+	while( dg )
+	{
+		if( dg->IsEqualSymbol( GetNamespaceScopes(), GetName() ) ){
+			//名前空間とクラス名が一致した
+			return *dg;
+		}
+		dg = dg->GetChainNext();
+	}
+
+	Jenga::Throw( "CClass::GetDelegateメソッドに失敗" );
+	static ::Delegate dummy;
+	return dummy;
 }
 
Index: trunk/abdev/BasicCompiler_Common/src/Delegate.cpp
===================================================================
--- trunk/abdev/BasicCompiler_Common/src/Delegate.cpp	(revision 324)
+++ trunk/abdev/BasicCompiler_Common/src/Delegate.cpp	(revision 325)
@@ -120,7 +120,73 @@
 
 		std::map<std::string,std::string> values;
-		values.insert( std::map<std::string,std::string>::value_type( "name", dg.GetName() ) );
-		values.insert( std::map<std::string,std::string>::value_type( "params", "" ) );
+
+		if( dg.GetNamespaceScopes().size() )
+		{
+			std::string namespaceScopesCommandStr = "";
+			std::string endNamespaceScopesCommandStr = "";
+			BOOST_FOREACH( const std::string &namespaceStr, dg.GetNamespaceScopes() )
+			{
+				if( namespaceScopesCommandStr.size() )
+				{
+					namespaceScopesCommandStr += ":";
+					endNamespaceScopesCommandStr += ":";
+				}
+				namespaceScopesCommandStr += "Namespace " + namespaceStr;
+				endNamespaceScopesCommandStr += "End Namespace";
+			}
+
+			values.insert( std::map<std::string,std::string>::value_type(
+				"#namespace_begin#",
+				namespaceScopesCommandStr
+			) );
+			values.insert( std::map<std::string,std::string>::value_type(
+				"#namespace_end#",
+				endNamespaceScopesCommandStr
+			) );
+		}
+		else
+		{
+			values.insert( std::map<std::string,std::string>::value_type( "#namespace_begin#", "" ) );
+			values.insert( std::map<std::string,std::string>::value_type( "#namespace_end#", "" ) );
+		}
+
+		values.insert( std::map<std::string,std::string>::value_type( "#name#", dg.GetName() ) );
+
+		std::string paramsStr = dg.Params().GetString();
+
+		if( dg.IsFunction() )
+		{
+			values.insert( std::map<std::string,std::string>::value_type(
+				"#call_method_begin#",
+				(string)"Function Call(" + paramsStr + ") As " + compiler.TypeToString( dg.ReturnType() )
+			) );
+
+			values.insert( std::map<std::string,std::string>::value_type(
+				"#call_method_end#",
+				"End Function"
+			) );
+
+			values.insert( std::map<std::string,std::string>::value_type( "#result#", "Call=" ) );
+		}
+		else
+		{
+			values.insert( std::map<std::string,std::string>::value_type(
+				"#call_method_begin#",
+				(string)"Sub Call(" + paramsStr + ")"
+			) );
+
+			values.insert( std::map<std::string,std::string>::value_type(
+				"#call_method_end#",
+				"End Sub"
+			) );
+
+			values.insert( std::map<std::string,std::string>::value_type( "#result#", "" ) );
+		}
+
+		values.insert( std::map<std::string,std::string>::value_type( "#params#", paramsStr ) );
+
 		destSource += sourceTemplate.GetResult( values );
 	}
+
+	ts( destSource.c_str() );
 }
Index: trunk/abdev/BasicCompiler_Common/src/Parameter.cpp
===================================================================
--- trunk/abdev/BasicCompiler_Common/src/Parameter.cpp	(revision 324)
+++ trunk/abdev/BasicCompiler_Common/src/Parameter.cpp	(revision 325)
@@ -159,2 +159,19 @@
 	return true;
 }
+
+std::string Parameters::GetString() const
+{
+	std::string result;
+
+	const Parameters &params = *this;
+	BOOST_FOREACH( const Parameter *pParam, params )
+	{
+		if( result.size() )
+		{
+			result += ",";
+		}
+
+		result += pParam->GetVarName() + " As " + compiler.TypeToString( *pParam );
+	}
+	return result;
+}
Index: trunk/abdev/BasicCompiler_Common/src/Source.cpp
===================================================================
--- trunk/abdev/BasicCompiler_Common/src/Source.cpp	(revision 324)
+++ trunk/abdev/BasicCompiler_Common/src/Source.cpp	(revision 325)
@@ -1048,5 +1048,5 @@
 		while( true )
 		{
-			std::string::size_type index = result.find( "#" + it->first + "#" );
+			std::string::size_type index = result.find( it->first );
 			if( index == std::string::npos )
 			{
@@ -1054,5 +1054,5 @@
 			}
 
-			result = result.substr( 0, index ) + it->second + result.substr( index + it->first.length() + 2 );
+			result = result.substr( 0, index ) + it->second + result.substr( index + it->first.length() );
 		}
 		it++;
