static Descriptor ProcessDescriptor(string value, ClassFactory factory) { Descriptor descriptor = new Descriptor(); string t = GetTypeForDescriptor(value); if (ARRAY_TYPE.Equals(t)) { descriptor.Component = ProcessDescriptor(value.Substring(1), factory); descriptor.IsArrayType = true; } else if (OBJECT_TYPE.Equals(t)) { string des = GetTypeForObjectType(value); descriptor.Class = factory.LoadClass(des); descriptor.IsObjectType = true; } else { descriptor.Class = factory.LoadClass(t); descriptor.IsBasicType = true; } return descriptor; }
Type GetType(Descriptor arg) { int rank = arg.GetArrayRank(); Class eType = arg.GetElementType(); Type t = GetType(eType); if (rank > 0) { if (t == null) { return null; } string suffix = ""; for (int i = 0; i < rank; i++) { suffix += "[]"; } Type temp = Type.GetType(t.AssemblyQualifiedName); if (temp == null) { Console.WriteLine("ERROR: type not found {0}", t.AssemblyQualifiedName); } t = Type.GetType(t.AssemblyQualifiedName + suffix); } if (t == null) { Console.WriteLine("Type not found {0}, class {1}, rank {2}", arg, eType, rank); } return t; }
public void AddArgument(Descriptor des) { arguments.Add(des); }