private bool DoGetStubInfoMessage(long messageID, ExecCallback callback, Dictionary <string, object> jsonData) { if (!jsonData.ContainsKey("reference")) { callback(FormatError(messageID, -1001, "errUnknownObject", "object reference missing")); return(false); } string reference = (string)jsonData["reference"]; object destinationObject = this.GetDestinationObject(reference); if (destinationObject == null) { callback(FormatError(messageID, -1001, "errUnknownObject", "cannot find object with reference <" + reference + ">")); return(false); } List <MethodInfo> list = destinationObject.GetType().GetMethods(BindingFlags.Public | BindingFlags.Instance).ToList <MethodInfo>(); list.AddRange(destinationObject.GetType().GetMethods(BindingFlags.Public | BindingFlags.Static).ToList <MethodInfo>()); ArrayList list2 = new ArrayList(); foreach (MethodInfo info in list) { if ((Array.IndexOf <string>(s_IgnoredMethods, info.Name) < 0) && (!info.IsSpecialName || (!info.Name.StartsWith("set_") && !info.Name.StartsWith("get_")))) { System.Reflection.ParameterInfo[] parameters = info.GetParameters(); ArrayList list3 = new ArrayList(); foreach (System.Reflection.ParameterInfo info2 in parameters) { list3.Add(info2.Name); } JspmMethodInfo info3 = new JspmMethodInfo(info.Name, (string[])list3.ToArray(typeof(string))); list2.Add(info3); } } List <PropertyInfo> list4 = destinationObject.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly).ToList <PropertyInfo>(); ArrayList list5 = new ArrayList(); foreach (PropertyInfo info4 in list4) { list5.Add(new JspmPropertyInfo(info4.Name, info4.GetValue(destinationObject, null))); } List <System.Reflection.FieldInfo> list6 = destinationObject.GetType().GetFields(BindingFlags.Public | BindingFlags.Instance).ToList <System.Reflection.FieldInfo>(); foreach (System.Reflection.FieldInfo info5 in list6) { list5.Add(new JspmPropertyInfo(info5.Name, info5.GetValue(destinationObject))); } List <EventInfo> list7 = destinationObject.GetType().GetEvents(BindingFlags.Public | BindingFlags.Instance).ToList <EventInfo>(); ArrayList list8 = new ArrayList(); foreach (EventInfo info6 in list7) { list8.Add(info6.Name); } callback(new JspmStubInfoSuccess(messageID, reference, (JspmPropertyInfo[])list5.ToArray(typeof(JspmPropertyInfo)), (JspmMethodInfo[])list2.ToArray(typeof(JspmMethodInfo)), (string[])list8.ToArray(typeof(string)))); return(true); }
public JspmStubInfo(JspmPropertyInfo[] properties, JspmMethodInfo[] methods, string[] events) { this.methods = methods; this.properties = properties; this.events = events; }
private bool DoGetStubInfoMessage(long messageID, ExecCallback callback, Dictionary <string, object> jsonData) { if (!jsonData.ContainsKey("reference")) { callback(FormatError(messageID, kErrUnknownObject, "errUnknownObject", "object reference missing")); return(false); } string reference = (string)jsonData["reference"]; object destObject = GetDestinationObject(reference); if (destObject == null) { callback(FormatError(messageID, kErrUnknownObject, "errUnknownObject", "cannot find object with reference <" + reference + ">")); return(false); } //Add the public functions and static methods List <MethodInfo> methods = (destObject.GetType().GetMethods(BindingFlags.Instance | BindingFlags.Public)).ToList(); methods.AddRange((destObject.GetType().GetMethods(BindingFlags.Public | BindingFlags.Static)).ToList()); ArrayList methodList = new ArrayList(); foreach (MethodInfo method in methods) { if (Array.IndexOf(s_IgnoredMethods, method.Name) >= 0) { continue; } if (method.IsSpecialName && (method.Name.StartsWith("set_") || method.Name.StartsWith("get_"))) { continue; } ParameterInfo[] parameters = method.GetParameters(); ArrayList parameterList = new ArrayList(); foreach (ParameterInfo parameter in parameters) { parameterList.Add(parameter.Name); } JspmMethodInfo info = new JspmMethodInfo(method.Name, (string[])parameterList.ToArray(typeof(string))); methodList.Add(info); } List <PropertyInfo> properties = destObject.GetType().GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly).ToList(); ArrayList propertyList = new ArrayList(); foreach (PropertyInfo property in properties) { propertyList.Add(new JspmPropertyInfo(property.Name, property.GetValue(destObject, null))); } List <FieldInfo> fields = destObject.GetType().GetFields(BindingFlags.Instance | BindingFlags.Public).ToList(); foreach (FieldInfo field in fields) { propertyList.Add(new JspmPropertyInfo(field.Name, field.GetValue(destObject))); } List <EventInfo> events = destObject.GetType().GetEvents(BindingFlags.Instance | BindingFlags.Public).ToList(); ArrayList eventList = new ArrayList(); foreach (EventInfo evt in events) { eventList.Add(evt.Name); } callback(new JspmStubInfoSuccess(messageID, reference, (JspmPropertyInfo[])propertyList.ToArray(typeof(JspmPropertyInfo)), (JspmMethodInfo[])methodList.ToArray(typeof(JspmMethodInfo)), (string[])eventList.ToArray(typeof(string)))); return(true); }
private bool DoGetStubInfoMessage(long messageID, JSProxyMgr.ExecCallback callback, Dictionary <string, object> jsonData) { bool result; if (!jsonData.ContainsKey("reference")) { callback(JSProxyMgr.FormatError(messageID, -1001, "errUnknownObject", "object reference missing")); result = false; } else { string text = (string)jsonData["reference"]; object destinationObject = this.GetDestinationObject(text); if (destinationObject == null) { callback(JSProxyMgr.FormatError(messageID, -1001, "errUnknownObject", "cannot find object with reference <" + text + ">")); result = false; } else { List <MethodInfo> list = destinationObject.GetType().GetMethods(BindingFlags.Instance | BindingFlags.Public).ToList <MethodInfo>(); list.AddRange(destinationObject.GetType().GetMethods(BindingFlags.Static | BindingFlags.Public).ToList <MethodInfo>()); ArrayList arrayList = new ArrayList(); foreach (MethodInfo current in list) { if (Array.IndexOf <string>(JSProxyMgr.s_IgnoredMethods, current.Name) < 0) { if (!current.IsSpecialName || (!current.Name.StartsWith("set_") && !current.Name.StartsWith("get_"))) { ParameterInfo[] parameters = current.GetParameters(); ArrayList arrayList2 = new ArrayList(); ParameterInfo[] array = parameters; for (int i = 0; i < array.Length; i++) { ParameterInfo parameterInfo = array[i]; arrayList2.Add(parameterInfo.Name); } JspmMethodInfo value = new JspmMethodInfo(current.Name, (string[])arrayList2.ToArray(typeof(string))); arrayList.Add(value); } } } List <PropertyInfo> list2 = destinationObject.GetType().GetProperties(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public).ToList <PropertyInfo>(); ArrayList arrayList3 = new ArrayList(); foreach (PropertyInfo current2 in list2) { arrayList3.Add(new JspmPropertyInfo(current2.Name, current2.GetValue(destinationObject, null))); } List <FieldInfo> list3 = destinationObject.GetType().GetFields(BindingFlags.Instance | BindingFlags.Public).ToList <FieldInfo>(); foreach (FieldInfo current3 in list3) { arrayList3.Add(new JspmPropertyInfo(current3.Name, current3.GetValue(destinationObject))); } List <EventInfo> list4 = destinationObject.GetType().GetEvents(BindingFlags.Instance | BindingFlags.Public).ToList <EventInfo>(); ArrayList arrayList4 = new ArrayList(); foreach (EventInfo current4 in list4) { arrayList4.Add(current4.Name); } callback(new JspmStubInfoSuccess(messageID, text, (JspmPropertyInfo[])arrayList3.ToArray(typeof(JspmPropertyInfo)), (JspmMethodInfo[])arrayList.ToArray(typeof(JspmMethodInfo)), (string[])arrayList4.ToArray(typeof(string)))); result = true; } } return(result); }
private bool DoGetStubInfoMessage(long messageID, JSProxyMgr.ExecCallback callback, Dictionary<string, object> jsonData) { if (!jsonData.ContainsKey("reference")) { callback((object) JSProxyMgr.FormatError(messageID, -1001, "errUnknownObject", "object reference missing")); return false; } string reference = (string) jsonData["reference"]; object destinationObject = this.GetDestinationObject(reference); if (destinationObject == null) { callback((object) JSProxyMgr.FormatError(messageID, -1001, "errUnknownObject", "cannot find object with reference <" + reference + ">")); return false; } List<MethodInfo> list1 = ((IEnumerable<MethodInfo>) destinationObject.GetType().GetMethods(BindingFlags.Instance | BindingFlags.Public)).ToList<MethodInfo>(); list1.AddRange((IEnumerable<MethodInfo>) ((IEnumerable<MethodInfo>) destinationObject.GetType().GetMethods(BindingFlags.Static | BindingFlags.Public)).ToList<MethodInfo>()); ArrayList arrayList1 = new ArrayList(); using (List<MethodInfo>.Enumerator enumerator = list1.GetEnumerator()) { while (enumerator.MoveNext()) { MethodInfo current = enumerator.Current; if (Array.IndexOf<string>(JSProxyMgr.s_IgnoredMethods, current.Name) < 0 && (!current.IsSpecialName || !current.Name.StartsWith("set_") && !current.Name.StartsWith("get_"))) { System.Reflection.ParameterInfo[] parameters = current.GetParameters(); ArrayList arrayList2 = new ArrayList(); foreach (System.Reflection.ParameterInfo parameterInfo in parameters) arrayList2.Add((object) parameterInfo.Name); JspmMethodInfo jspmMethodInfo = new JspmMethodInfo(current.Name, (string[]) arrayList2.ToArray(typeof (string))); arrayList1.Add((object) jspmMethodInfo); } } } List<PropertyInfo> list2 = ((IEnumerable<PropertyInfo>) destinationObject.GetType().GetProperties(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public)).ToList<PropertyInfo>(); ArrayList arrayList3 = new ArrayList(); using (List<PropertyInfo>.Enumerator enumerator = list2.GetEnumerator()) { while (enumerator.MoveNext()) { PropertyInfo current = enumerator.Current; arrayList3.Add((object) new JspmPropertyInfo(current.Name, current.GetValue(destinationObject, (object[]) null))); } } using (List<System.Reflection.FieldInfo>.Enumerator enumerator = ((IEnumerable<System.Reflection.FieldInfo>) destinationObject.GetType().GetFields(BindingFlags.Instance | BindingFlags.Public)).ToList<System.Reflection.FieldInfo>().GetEnumerator()) { while (enumerator.MoveNext()) { System.Reflection.FieldInfo current = enumerator.Current; arrayList3.Add((object) new JspmPropertyInfo(current.Name, current.GetValue(destinationObject))); } } List<EventInfo> list3 = ((IEnumerable<EventInfo>) destinationObject.GetType().GetEvents(BindingFlags.Instance | BindingFlags.Public)).ToList<EventInfo>(); ArrayList arrayList4 = new ArrayList(); using (List<EventInfo>.Enumerator enumerator = list3.GetEnumerator()) { while (enumerator.MoveNext()) { EventInfo current = enumerator.Current; arrayList4.Add((object) current.Name); } } callback((object) new JspmStubInfoSuccess(messageID, reference, (JspmPropertyInfo[]) arrayList3.ToArray(typeof (JspmPropertyInfo)), (JspmMethodInfo[]) arrayList1.ToArray(typeof (JspmMethodInfo)), (string[]) arrayList4.ToArray(typeof (string)))); return true; }
public JspmStubInfoSuccess(long messageID, string reference, JspmPropertyInfo[] properties, JspmMethodInfo[] methods, string[] events) : base(messageID, new JspmStubInfo(properties, methods, events), "GETSTUBINFO") { this.reference = reference; }
private bool DoGetStubInfoMessage(long messageID, JSProxyMgr.ExecCallback callback, Dictionary <string, object> jsonData) { if (!jsonData.ContainsKey("reference")) { callback((object)JSProxyMgr.FormatError(messageID, -1001, "errUnknownObject", "object reference missing")); return(false); } string reference = (string)jsonData["reference"]; object destinationObject = this.GetDestinationObject(reference); if (destinationObject == null) { callback((object)JSProxyMgr.FormatError(messageID, -1001, "errUnknownObject", "cannot find object with reference <" + reference + ">")); return(false); } List <MethodInfo> list1 = ((IEnumerable <MethodInfo>)destinationObject.GetType().GetMethods(BindingFlags.Instance | BindingFlags.Public)).ToList <MethodInfo>(); list1.AddRange((IEnumerable <MethodInfo>)((IEnumerable <MethodInfo>)destinationObject.GetType().GetMethods(BindingFlags.Static | BindingFlags.Public)).ToList <MethodInfo>()); ArrayList arrayList1 = new ArrayList(); using (List <MethodInfo> .Enumerator enumerator = list1.GetEnumerator()) { while (enumerator.MoveNext()) { MethodInfo current = enumerator.Current; if (Array.IndexOf <string>(JSProxyMgr.s_IgnoredMethods, current.Name) < 0 && (!current.IsSpecialName || !current.Name.StartsWith("set_") && !current.Name.StartsWith("get_"))) { System.Reflection.ParameterInfo[] parameters = current.GetParameters(); ArrayList arrayList2 = new ArrayList(); foreach (System.Reflection.ParameterInfo parameterInfo in parameters) { arrayList2.Add((object)parameterInfo.Name); } JspmMethodInfo jspmMethodInfo = new JspmMethodInfo(current.Name, (string[])arrayList2.ToArray(typeof(string))); arrayList1.Add((object)jspmMethodInfo); } } } List <PropertyInfo> list2 = ((IEnumerable <PropertyInfo>)destinationObject.GetType().GetProperties(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public)).ToList <PropertyInfo>(); ArrayList arrayList3 = new ArrayList(); using (List <PropertyInfo> .Enumerator enumerator = list2.GetEnumerator()) { while (enumerator.MoveNext()) { PropertyInfo current = enumerator.Current; arrayList3.Add((object)new JspmPropertyInfo(current.Name, current.GetValue(destinationObject, (object[])null))); } } using (List <System.Reflection.FieldInfo> .Enumerator enumerator = ((IEnumerable <System.Reflection.FieldInfo>)destinationObject.GetType().GetFields(BindingFlags.Instance | BindingFlags.Public)).ToList <System.Reflection.FieldInfo>().GetEnumerator()) { while (enumerator.MoveNext()) { System.Reflection.FieldInfo current = enumerator.Current; arrayList3.Add((object)new JspmPropertyInfo(current.Name, current.GetValue(destinationObject))); } } List <EventInfo> list3 = ((IEnumerable <EventInfo>)destinationObject.GetType().GetEvents(BindingFlags.Instance | BindingFlags.Public)).ToList <EventInfo>(); ArrayList arrayList4 = new ArrayList(); using (List <EventInfo> .Enumerator enumerator = list3.GetEnumerator()) { while (enumerator.MoveNext()) { EventInfo current = enumerator.Current; arrayList4.Add((object)current.Name); } } callback((object)new JspmStubInfoSuccess(messageID, reference, (JspmPropertyInfo[])arrayList3.ToArray(typeof(JspmPropertyInfo)), (JspmMethodInfo[])arrayList1.ToArray(typeof(JspmMethodInfo)), (string[])arrayList4.ToArray(typeof(string)))); return(true); }