SOURCES: last-exit-trunk_and_translation.patch (NEW) - adds PL tra...

deejay1 deejay1 at pld-linux.org
Tue Apr 17 17:27:29 CEST 2007


Author: deejay1                      Date: Tue Apr 17 15:27:29 2007 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- adds PL translation and updates others
- backports changes from trunk

---- Files affected:
SOURCES:
   last-exit-trunk_and_translation.patch (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: SOURCES/last-exit-trunk_and_translation.patch
diff -u /dev/null SOURCES/last-exit-trunk_and_translation.patch:1.1
--- /dev/null	Tue Apr 17 17:27:29 2007
+++ SOURCES/last-exit-trunk_and_translation.patch	Tue Apr 17 17:27:24 2007
@@ -0,0 +1,5004 @@
+diff -Nur last-exit-5/ChangeLog last-exit-5-patched/ChangeLog
+--- last-exit-5/ChangeLog	2007-04-11 23:12:03.000000000 +0200
++++ last-exit-5-patched/ChangeLog	2007-04-15 04:46:45.000000000 +0200
+@@ -1,3 +1,15 @@
++2007-04-14  Brandon Hale  <brandon at brandonhale.us>
++
++	* dbus-sharp/:
++	Update to dbus-sharp 0.4.2
++
++	* src/TagView.cs, src/TagSelector.cs, po/POTFILES.in:
++	One more l10n patch from Lukasz on bug #428933.
++
++2007-04-12  Brandon Hale  <brandon at brandonhale.us>
++	
++	Reduce libsexy requirement to 0.1.5 for SLED.
++
+ 2007-04-10  Brandon Hale  <brandon at brandonhale.us>
+ 
+ 	* src/PlayerWindow.cs:
+diff -Nur last-exit-5/configure.ac last-exit-5-patched/configure.ac
+--- last-exit-5/configure.ac	2007-04-13 00:13:55.000000000 +0200
++++ last-exit-5-patched/configure.ac	2007-04-17 17:17:07.000000000 +0200
+@@ -28,7 +28,7 @@
+ 		  gstreamer-0.10 >= $GSTREAMER_REQUIRED \
+ 		  gstreamer-base-0.10			\
+ 		  gstreamer-plugins-base-0.10 >= $GSTREAMER_REQUIRED \
+-		  libsexy >= 0.1.7 \
++		  libsexy >= 0.1.5 \
+ 		  dbus-1 >= 0.60 \
+ 		  dbus-glib-1 >= 0.60)
+ AC_SUBST(LASTEXIT_CFLAGS)
+@@ -80,7 +80,7 @@
+ GETTEXT_PACKAGE="last-exit"
+ AC_SUBST(GETTEXT_PACKAGE)
+ 
+-ALL_LINGUAS="de sv tr"
++ALL_LINGUAS="ar de pl sv tr"
+ AM_GLIB_GNU_GETTEXT
+ 
+ AC_OUTPUT([
+diff -Nur last-exit-5/data/.cvsignore last-exit-5-patched/data/.cvsignore
+--- last-exit-5/data/.cvsignore	1970-01-01 01:00:00.000000000 +0100
++++ last-exit-5-patched/data/.cvsignore	2006-07-26 23:36:47.000000000 +0200
+@@ -0,0 +1,5 @@
++Makefile
++Makefile.in
++last-exit.schemas
++lastfm.schemas
++last-exit.desktop
+diff -Nur last-exit-5/data/glade/.cvsignore last-exit-5-patched/data/glade/.cvsignore
+--- last-exit-5/data/glade/.cvsignore	1970-01-01 01:00:00.000000000 +0100
++++ last-exit-5-patched/data/glade/.cvsignore	2006-03-23 13:49:38.000000000 +0100
+@@ -0,0 +1,2 @@
++Makefile
++Makefile.in
+diff -Nur last-exit-5/data/icons/.cvsignore last-exit-5-patched/data/icons/.cvsignore
+--- last-exit-5/data/icons/.cvsignore	1970-01-01 01:00:00.000000000 +0100
++++ last-exit-5-patched/data/icons/.cvsignore	2006-03-23 13:49:38.000000000 +0100
+@@ -0,0 +1,2 @@
++Makefile
++Makefile.in
+Pliki last-exit-5/data/icons/show-info-16.png i last-exit-5-patched/data/icons/show-info-16.png różnią się
+diff -Nur last-exit-5/data/ui/.cvsignore last-exit-5-patched/data/ui/.cvsignore
+--- last-exit-5/data/ui/.cvsignore	1970-01-01 01:00:00.000000000 +0100
++++ last-exit-5-patched/data/ui/.cvsignore	2006-03-23 13:49:38.000000000 +0100
+@@ -0,0 +1,2 @@
++Makefile
++Makefile.in
+diff -Nur last-exit-5/dbus-sharp/dbus-sharp/BusObject.cs last-exit-5-patched/dbus-sharp/dbus-sharp/BusObject.cs
+--- last-exit-5/dbus-sharp/dbus-sharp/BusObject.cs	2007-02-10 03:04:12.000000000 +0100
++++ last-exit-5-patched/dbus-sharp/dbus-sharp/BusObject.cs	2007-04-15 04:41:04.000000000 +0200
+@@ -5,6 +5,7 @@
+ using System;
+ using System.Reflection;
+ using System.Reflection.Emit;
++using System.Collections.Generic;
+ 
+ namespace NDesk.DBus
+ {
+@@ -12,7 +13,7 @@
+ 	//it probably needs to be made into a base and import/export subclasses
+ 	internal class BusObject
+ 	{
+-		Connection conn;
++		protected Connection conn;
+ 		string bus_name;
+ 		ObjectPath object_path;
+ 
+@@ -94,20 +95,25 @@
+ 				string[] parts = methodName.Split (new char[]{'_'}, 2);
+ 				string ename = parts[1];
+ 				Delegate dlg = (Delegate)inArgs[0];
+-				string matchRule = MessageFilter.CreateMatchRule (MessageType.Signal, object_path, Mapper.GetInterfaceName (mi), ename);
++
++				MatchRule rule = new MatchRule ();
++				rule.MessageType = MessageType.Signal;
++				rule.Interface = Mapper.GetInterfaceName (mi);
++				rule.Member = ename;
++				rule.Path = object_path;
+ 
+ 				if (parts[0] == "add") {
+-					if (conn.Handlers.ContainsKey (matchRule))
+-						conn.Handlers[matchRule] = Delegate.Combine (conn.Handlers[matchRule], dlg);
++					if (conn.Handlers.ContainsKey (rule))
++						conn.Handlers[rule] = Delegate.Combine (conn.Handlers[rule], dlg);
+ 					else {
+-						conn.Handlers[matchRule] = dlg;
+-						conn.AddMatch (matchRule);
++						conn.Handlers[rule] = dlg;
++						conn.AddMatch (rule.ToString ());
+ 					}
+ 				} else if (parts[0] == "remove") {
+-					conn.Handlers[matchRule] = Delegate.Remove (conn.Handlers[matchRule], dlg);
+-					if (conn.Handlers[matchRule] == null) {
+-						conn.RemoveMatch (matchRule);
+-						conn.Handlers.Remove (matchRule);
++					conn.Handlers[rule] = Delegate.Remove (conn.Handlers[rule], dlg);
++					if (conn.Handlers[rule] == null) {
++						conn.RemoveMatch (rule.ToString ());
++						conn.Handlers.Remove (rule);
+ 					}
+ 				}
+ 				return;
+@@ -283,16 +289,28 @@
+ 
+ 		public Delegate GetHookupDelegate (EventInfo ei)
+ 		{
++			DynamicMethod hookupMethod = GetHookupMethod (ei);
++			Delegate d = hookupMethod.CreateDelegate (ei.EventHandlerType, this);
++			return d;
++		}
++
++		static Dictionary<EventInfo,DynamicMethod> hookup_methods = new Dictionary<EventInfo,DynamicMethod> ();
++		public static DynamicMethod GetHookupMethod (EventInfo ei)
++		{
++			DynamicMethod hookupMethod;
++			if (hookup_methods.TryGetValue (ei, out hookupMethod))
++				return hookupMethod;
++
+ 			if (ei.EventHandlerType.IsAssignableFrom (typeof (System.EventHandler)))
+ 				Console.Error.WriteLine ("Warning: Cannot yet fully expose EventHandler and its subclasses: " + ei.EventHandlerType);
+ 
+ 			MethodInfo declMethod = ei.EventHandlerType.GetMethod ("Invoke");
+ 
+-			DynamicMethod hookupMethod = GetHookupMethod (declMethod, sendSignalMethod, Mapper.GetInterfaceName (ei), ei.Name);
++			hookupMethod = GetHookupMethod (declMethod, sendSignalMethod, Mapper.GetInterfaceName (ei), ei.Name);
+ 
+-			Delegate d = hookupMethod.CreateDelegate (ei.EventHandlerType, this);
++			hookup_methods[ei] = hookupMethod;
+ 
+-			return d;
++			return hookupMethod;
+ 		}
+ 
+ 		public static DynamicMethod GetHookupMethod (MethodInfo declMethod, MethodInfo invokeMethod, string @interface, string member)
+@@ -312,6 +330,8 @@
+ 			return hookupMethod;
+ 		}
+ 
++		static MethodInfo getMethodFromHandleMethod = typeof (MethodBase).GetMethod ("GetMethodFromHandle", new Type[] {typeof (RuntimeMethodHandle)});
++
+ 		public static void GenHookupMethod (ILGenerator ilg, MethodInfo declMethod, MethodInfo invokeMethod, string @interface, string member, Type[] hookupParms)
+ 		{
+ 			Type retType = declMethod.ReturnType;
+@@ -321,7 +341,7 @@
+ 
+ 			//MethodInfo
+ 			ilg.Emit (OpCodes.Ldtoken, declMethod);
+-			ilg.Emit (OpCodes.Call, typeof (MethodBase).GetMethod ("GetMethodFromHandle"));
++			ilg.Emit (OpCodes.Call, getMethodFromHandleMethod);
+ 
+ 			//interface
+ 			ilg.Emit (OpCodes.Ldstr, @interface);
+diff -Nur last-exit-5/dbus-sharp/dbus-sharp/Connection.cs last-exit-5-patched/dbus-sharp/dbus-sharp/Connection.cs
+--- last-exit-5/dbus-sharp/dbus-sharp/Connection.cs	2007-02-10 03:04:12.000000000 +0100
++++ last-exit-5-patched/dbus-sharp/dbus-sharp/Connection.cs	2007-04-15 04:41:04.000000000 +0200
+@@ -363,10 +363,15 @@
+ 		{
+ 			Signal signal = new Signal (msg);
+ 
+-			string matchRule = MessageFilter.CreateMatchRule (MessageType.Signal, signal.Path, signal.Interface, signal.Member);
++			//TODO: this is a hack, not necessary when MatchRule is complete
++			MatchRule rule = new MatchRule ();
++			rule.MessageType = MessageType.Signal;
++			rule.Interface = signal.Interface;
++			rule.Member = signal.Member;
++			rule.Path = signal.Path;
+ 
+-			if (Handlers.ContainsKey (matchRule)) {
+-				Delegate dlg = Handlers[matchRule];
++			Delegate dlg;
++			if (Handlers.TryGetValue (rule, out dlg)) {
+ 				//dlg.DynamicInvoke (GetDynamicValues (msg));
+ 
+ 				MethodInfo mi = dlg.Method;
+@@ -380,36 +385,14 @@
+ 			}
+ 		}
+ 
+-		internal Dictionary<string,Delegate> Handlers = new Dictionary<string,Delegate> ();
++		internal Dictionary<MatchRule,Delegate> Handlers = new Dictionary<MatchRule,Delegate> ();
+ 
+ 		//very messy
+-		void MaybeSendUnknownMethodError (MethodCall method_call)
++		internal void MaybeSendUnknownMethodError (MethodCall method_call)
+ 		{
+-			string errMsg = String.Format ("Method \"{0}\" with signature \"{1}\" on interface \"{2}\" doesn't exist", method_call.Member, method_call.Signature.Value, method_call.Interface);
+-
+-			if (!method_call.message.ReplyExpected) {
+-				if (!Protocol.Verbose)
+-					return;
+-
+-				Console.Error.WriteLine ();
+-				Console.Error.WriteLine ("Warning: Not sending Error message (" + errMsg + ") as reply because no reply was expected");
+-				Console.Error.WriteLine ();
+-				return;
+-			}
+-
+-			Error error = new Error ("org.freedesktop.DBus.Error.UnknownMethod", method_call.message.Header.Serial);
+-			error.message.Signature = new Signature (DType.String);
+-
+-			MessageWriter writer = new MessageWriter (Connection.NativeEndianness);
+-			writer.connection = this;
+-			writer.Write (errMsg);
+-			error.message.Body = writer.ToArray ();
+-
+-			//TODO: we should be more strict here, but this fallback was added as a quick fix for p2p
+-			if (method_call.Sender != null)
+-				error.message.Header.Fields[FieldCode.Destination] = method_call.Sender;
+-
+-			Send (error.message);
++			Message msg = MessageHelper.CreateUnknownMethodError (method_call);
++			if (msg != null)
++				Send (msg);
+ 		}
+ 
+ 		//not particularly efficient and needs to be generalized
+@@ -417,6 +400,7 @@
+ 		{
+ 			//TODO: Ping and Introspect need to be abstracted and moved somewhere more appropriate once message filter infrastructure is complete
+ 
++			//FIXME: these special cases are slightly broken for the case where the member but not the interface is specified in the message
+ 			if (method_call.Interface == "org.freedesktop.DBus.Peer" && method_call.Member == "Ping") {
+ 				object[] pingRet = new object[0];
+ 				Message reply = MessageHelper.ConstructReplyFor (method_call, pingRet);
+@@ -435,9 +419,10 @@
+ 				int depth = method_call.Path.Decomposed.Length;
+ 				foreach (ObjectPath pth in RegisteredObjects.Keys) {
+ 					if (pth.Value == (method_call.Path.Value)) {
+-						intro.WriteType (RegisteredObjects[pth].GetType ());
++						ExportObject exo = (ExportObject)RegisteredObjects[pth];
++						intro.WriteType (exo.obj.GetType ());
+ 					} else {
+-						for (ObjectPath cur = pth ; cur.Value != null ; cur = cur.Parent) {
++						for (ObjectPath cur = pth ; cur != null ; cur = cur.Parent) {
+ 							if (cur.Value == method_call.Path.Value) {
+ 								string linkNode = pth.Decomposed[depth];
+ 								if (!linkNodes.Contains (linkNode)) {
+@@ -458,76 +443,16 @@
+ 				return;
+ 			}
+ 
+-			if (!RegisteredObjects.ContainsKey (method_call.Path)) {
+-				MaybeSendUnknownMethodError (method_call);
+-				return;
+-			}
+-
+-			object obj = RegisteredObjects[method_call.Path];
+-			Type type = obj.GetType ();
+-			//object retObj = type.InvokeMember (msg.Member, BindingFlags.InvokeMethod, null, obj, MessageHelper.GetDynamicValues (msg));
+-
+-			//TODO: there is no member name mapping for properties etc. yet
+-			MethodInfo mi = Mapper.GetMethod (type, method_call);
+-
+-			if (mi == null) {
++			BusObject bo;
++			if (RegisteredObjects.TryGetValue (method_call.Path, out bo)) {
++				ExportObject eo = (ExportObject)bo;
++				eo.HandleMethodCall (method_call);
++			} else {
+ 				MaybeSendUnknownMethodError (method_call);
+-				return;
+-			}
+-
+-			object retObj = null;
+-			try {
+-				object[] inArgs = MessageHelper.GetDynamicValues (method_call.message, mi.GetParameters ());
+-				retObj = mi.Invoke (obj, inArgs);
+-			} catch (TargetInvocationException e) {
+-				Exception ie = e.InnerException;
+-				//TODO: complete exception sending support
+-
+-				if (!method_call.message.ReplyExpected) {
+-					if (!Protocol.Verbose)
+-						return;
+-
+-					Console.Error.WriteLine ();
+-					Console.Error.WriteLine ("Warning: Not sending Error message (" + ie.GetType ().Name + ") as reply because no reply was expected by call to '" + (method_call.Interface + "." + method_call.Member) + "'");
+-					Console.Error.WriteLine ();
+-					return;
+-				}
+-
+-				Error error = new Error (Mapper.GetInterfaceName (ie.GetType ()), method_call.message.Header.Serial);
+-				error.message.Signature = new Signature (DType.String);
+-
+-				MessageWriter writer = new MessageWriter (Connection.NativeEndianness);
+-				writer.connection = this;
+-				writer.Write (ie.Message);
+-				error.message.Body = writer.ToArray ();
+-
+-				//TODO: we should be more strict here, but this fallback was added as a quick fix for p2p
+-				if (method_call.Sender != null)
+-					error.message.Header.Fields[FieldCode.Destination] = method_call.Sender;
+-
+-				Send (error.message);
+-				return;
+-			}
+-
+-			if (method_call.message.ReplyExpected) {
+-				/*
+-				object[] retObjs;
+-
+-				if (retObj == null) {
+-					retObjs = new object[0];
+-				} else {
+-					retObjs = new object[1];
+-					retObjs[0] = retObj;
+-				}
+-
+-				Message reply = ConstructReplyFor (method_call, retObjs);
+-				*/
+-				Message reply = MessageHelper.ConstructReplyFor (method_call, mi.ReturnType, retObj);
+-				Send (reply);
+ 			}
+ 		}
+ 
+-		Dictionary<ObjectPath,object> RegisteredObjects = new Dictionary<ObjectPath,object> ();
++		Dictionary<ObjectPath,BusObject> RegisteredObjects = new Dictionary<ObjectPath,BusObject> ();
+ 
+ 		//FIXME: this shouldn't be part of the core API
+ 		//that also applies to much of the other object mapping code
+@@ -558,37 +483,28 @@
+ 
+ 		public void Register (string bus_name, ObjectPath path, object obj)
+ 		{
+-			Type type = obj.GetType ();
+-
+-			BusObject busObject = new BusObject (this, bus_name, path);
+-
+-			foreach (MemberInfo mi in Mapper.GetPublicMembers (type)) {
+-				EventInfo ei = mi as EventInfo;
+-
+-				if (ei == null)
+-					continue;
+-
+-				Delegate dlg = busObject.GetHookupDelegate (ei);
+-				ei.AddEventHandler (obj, dlg);
+-			}
++			ExportObject eo = new ExportObject (this, bus_name, path, obj);
++			eo.Registered = true;
+ 
+ 			//TODO: implement some kind of tree data structure or internal object hierarchy. right now we are ignoring the name and putting all object paths in one namespace, which is bad
+-			RegisteredObjects[path] = obj;
++			RegisteredObjects[path] = eo;
+ 		}
+ 
+ 		public object Unregister (string bus_name, ObjectPath path)
+ 		{
+ 			//TODO: make use of bus_name
+ 
+-			if (!RegisteredObjects.ContainsKey (path))
++			BusObject bo;
++
++			if (!RegisteredObjects.TryGetValue (path, out bo))
+ 				throw new Exception ("Cannot unregister " + path + " as it isn't registered");
+-			object obj = RegisteredObjects[path];
+ 
+ 			RegisteredObjects.Remove (path);
+ 
+-			//FIXME: complete unregistering including the handlers we added etc.
++			ExportObject eo = (ExportObject)bo;
++			eo.Registered = false;
+ 
+-			return obj;
++			return eo.obj;
+ 		}
+ 
+ 		//these look out of place, but are useful
+diff -Nur last-exit-5/dbus-sharp/dbus-sharp/ExportObject.cs last-exit-5-patched/dbus-sharp/dbus-sharp/ExportObject.cs
+--- last-exit-5/dbus-sharp/dbus-sharp/ExportObject.cs	2007-02-10 03:04:12.000000000 +0100
++++ last-exit-5-patched/dbus-sharp/dbus-sharp/ExportObject.cs	2007-04-15 04:41:04.000000000 +0200
+@@ -10,8 +10,97 @@
+ 
+ namespace NDesk.DBus
+ {
+-	internal class ExportObject : BusObject, Peer
++	internal class ExportObject : BusObject //, Peer
+ 	{
++		public readonly object obj;
++
++		public ExportObject (Connection conn, string bus_name, ObjectPath object_path, object obj) : base (conn, bus_name, object_path)
++		{
++			this.obj = obj;
++		}
++
++		//maybe add checks to make sure this is not called more than once
++		//it's a bit silly as a property
++		public bool Registered
++		{
++			set {
++				Type type = obj.GetType ();
++
++				foreach (MemberInfo mi in Mapper.GetPublicMembers (type)) {
++					EventInfo ei = mi as EventInfo;
++
++					if (ei == null)
++						continue;
++
++					Delegate dlg = GetHookupDelegate (ei);
++
++					if (value)
++						ei.AddEventHandler (obj, dlg);
++					else
++						ei.RemoveEventHandler (obj, dlg);
++				}
++			}
++		}
++
++		public void HandleMethodCall (MethodCall method_call)
++		{
++			Type type = obj.GetType ();
++			//object retObj = type.InvokeMember (msg.Member, BindingFlags.InvokeMethod, null, obj, MessageHelper.GetDynamicValues (msg));
++
++			//TODO: there is no member name mapping for properties etc. yet
++			MethodInfo mi = Mapper.GetMethod (type, method_call);
++
++			if (mi == null) {
++				conn.MaybeSendUnknownMethodError (method_call);
++				return;
++			}
++
++			object retObj = null;
++			try {
++				object[] inArgs = MessageHelper.GetDynamicValues (method_call.message, mi.GetParameters ());
++				retObj = mi.Invoke (obj, inArgs);
++			} catch (TargetInvocationException e) {
++				if (!method_call.message.ReplyExpected)
++					return;
++
++				Exception ie = e.InnerException;
++				//TODO: complete exception sending support
++
++				Error error = new Error (Mapper.GetInterfaceName (ie.GetType ()), method_call.message.Header.Serial);
++				error.message.Signature = new Signature (DType.String);
++
++				MessageWriter writer = new MessageWriter (Connection.NativeEndianness);
++				writer.connection = conn;
++				writer.Write (ie.Message);
++				error.message.Body = writer.ToArray ();
++
++				//TODO: we should be more strict here, but this fallback was added as a quick fix for p2p
++				if (method_call.Sender != null)
++					error.message.Header.Fields[FieldCode.Destination] = method_call.Sender;
++
++				conn.Send (error.message);
++				return;
++			}
++
++			if (method_call.message.ReplyExpected) {
++				/*
++				object[] retObjs;
++
++				if (retObj == null) {
++					retObjs = new object[0];
++				} else {
++					retObjs = new object[1];
++					retObjs[0] = retObj;
++				}
++
++				Message reply = ConstructReplyFor (method_call, retObjs);
++				*/
++				Message reply = MessageHelper.ConstructReplyFor (method_call, mi.ReturnType, retObj);
++				conn.Send (reply);
++			}
++		}
++
++		/*
+ 		public void Ping ()
+ 		{
+ 		}
+@@ -21,5 +110,6 @@
+ 			//TODO: implement this
+ 			return String.Empty;
+ 		}
++		*/
+ 	}
+ }
+diff -Nur last-exit-5/dbus-sharp/dbus-sharp/Mapper.cs last-exit-5-patched/dbus-sharp/dbus-sharp/Mapper.cs
+--- last-exit-5/dbus-sharp/dbus-sharp/Mapper.cs	2007-02-10 03:04:12.000000000 +0100
++++ last-exit-5-patched/dbus-sharp/dbus-sharp/Mapper.cs	2007-04-15 04:41:04.000000000 +0200
+@@ -32,40 +32,68 @@
+ 			return argName;
+ 		}
+ 
+-		//this will be inefficient for larger interfaces, could be easily rewritten
+-		public static MemberInfo[] GetPublicMembers (Type type)
++		//TODO: these two methods are quite messy and need review
++		public static IEnumerable<MemberInfo> GetPublicMembers (Type type)
+ 		{
+-			List<MemberInfo> mis = new List<MemberInfo> ();
+-
++			//note that Type.GetInterfaces() returns all interfaces with flattened hierarchy
+ 			foreach (Type ifType in type.GetInterfaces ())
+-				mis.AddRange (GetPublicMembers (ifType));
++				foreach (MemberInfo mi in GetDeclaredPublicMembers (ifType))
++					yield return mi;
+ 
+-			//TODO: will DeclaredOnly for inherited members? inheritance support isn't widely used or tested in other places though
+ 			if (IsPublic (type))
+-				foreach (MemberInfo mi in type.GetMembers (BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly))
+-					mis.Add (mi);
++				foreach (MemberInfo mi in GetDeclaredPublicMembers (type))
++					yield return mi;
++		}
+ 
+-			return mis.ToArray ();
++		static IEnumerable<MemberInfo> GetDeclaredPublicMembers (Type type)
++		{
++			if (IsPublic (type))
++				foreach (MemberInfo mi in type.GetMembers (BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly))
++					yield return mi;
+ 		}
+ 
+ 		//this method walks the interface tree in an undefined manner and returns the first match, or if no matches are found, null
++		//the logic needs review and cleanup
++		//TODO: unify member name mapping as is already done with interfaces and args
+ 		public static MethodInfo GetMethod (Type type, MethodCall method_call)
+ 		{
+ 			foreach (MemberInfo member in Mapper.GetPublicMembers (type)) {
+-				MethodInfo meth = member as MethodInfo;
++				//this could be made more efficient by using the given interface name earlier and avoiding walking through all public interfaces
++				if (method_call.Interface != null)
++					if (GetInterfaceName (member) != method_call.Interface)
++						continue;
+ 
+-				if (meth == null)
+-					continue;
++				MethodInfo meth = null;
++				Type[] inTypes = null;
+ 
+-				if (meth.Name != method_call.Member)
+-					continue;
++				if (member is PropertyInfo) {
++					PropertyInfo prop = member as PropertyInfo;
+ 
+-				//this could be made more efficient by using the given interface name earlier and avoiding walking through all public interfaces
+-				if (method_call.Interface != null)
+-					if (GetInterfaceName (meth) != method_call.Interface)
++					MethodInfo getter = prop.GetGetMethod (false);
++					MethodInfo setter = prop.GetSetMethod (false);
++
++					if (getter != null && "Get" + prop.Name == method_call.Member) {
++						meth = getter;
++						inTypes = Type.EmptyTypes;
++					} else if (setter != null && "Set" + prop.Name == method_call.Member) {
++						meth = setter;
++						inTypes = new Type[] {prop.PropertyType};
++					}
++				} else {
++					meth = member as MethodInfo;
++
++					if (meth == null)
+ 						continue;
+ 
+-				Type[] inTypes = Mapper.GetTypes (ArgDirection.In, meth.GetParameters ());
++					if (meth.Name != method_call.Member)
++						continue;
++
++					inTypes = Mapper.GetTypes (ArgDirection.In, meth.GetParameters ());
++				}
++
++				if (meth == null || inTypes == null)
++					continue;
++
+ 				Signature inSig = Signature.GetSig (inTypes);
+ 
+ 				if (inSig != method_call.Signature)
+@@ -145,11 +173,65 @@
+ 		{
+ 			return attrProvider.IsDefined (typeof (ObsoleteAttribute), true);
+ 		}
<<Diff was trimmed, longer than 597 lines>>


More information about the pld-cvs-commit mailing list