Beispiel #1
0
        public void loadManyTypes(string types)
        {
            string[] array = types.Split(new string[]
            {
                "-"
            }, StringSplitOptions.RemoveEmptyEntries);
            StringBuilder stringBuilder = new StringBuilder();

            typeDescriptor.addUsingsStatements(stringBuilder);
            Dictionary <Type, type_1> dictionary = new Dictionary <Type, type_1>();

            string[] array2 = array;
            for (int i = 0; i < array2.Length; i++)
            {
                string         typeName          = array2[i];
                Type           typeOrGenericType = this.getTypeOrGenericType(typeName);
                typeDescriptor typeDescriptor    = new typeDescriptor(typeOrGenericType, typeName, false);
                if (!typeDescriptor.isCompiled())
                {
                    string staticClass   = "";
                    string instanceClass = "";
                    typeDescriptor.precompile(stringBuilder, ref staticClass, ref instanceClass);
                    dictionary[typeOrGenericType] = new type_1
                    {
                        td            = typeDescriptor,
                        staticClass   = staticClass,
                        instanceClass = instanceClass,
                        t             = typeOrGenericType
                    };
                }
            }
            stringBuilder.AppendLine("class program{public static void main(){}}");
            csharplanguage csharplanguage = (csharplanguage)language.defaultLanguage.create();

            if (dictionary.Count > 0)
            {
                csharplanguage.runScript(stringBuilder.ToString(), typeDescriptor.generateInMemory);
            }
            foreach (KeyValuePair <Type, type_1> current in dictionary)
            {
                type_1          value       = current.Value;
                Type            type        = csharplanguage.getCompiledAssembly().GetType("jxshell.dotnet4." + value.staticClass);
                ConstructorInfo constructor = type.GetConstructor(new Type[]
                {
                    typeof(Type),
                    typeof(typeDescriptor)
                });
                value.td.setCompiledWrapper((wrapperStatic)constructor.Invoke(new object[]
                {
                    value.t,
                    value.td
                }));
            }
        }
Beispiel #2
0
        public static wrapperStatic loadFromType(Type t)
        {
            wrapperStatic wrapperStatic;

            if (!wrapperStatic.wrappersStatic.TryGetValue(t, out wrapperStatic))
            {
                typeDescriptor typeDescriptor = typeDescriptor.loadFromType(t);
                wrapperStatic = typeDescriptor.compile();
                wrapperStatic.wrappersStatic[t] = wrapperStatic;
            }
            return(wrapperStatic);
        }
Beispiel #3
0
        public static typeDescriptor loadFromType(Type t, string typeName, bool compile = true)
        {
            typeDescriptor typeDescriptor;
            typeDescriptor result;

            if (!typeDescriptor.loadedTypes.TryGetValue(t, out typeDescriptor))
            {
                result = new typeDescriptor(t, typeName, compile);
            }
            else
            {
                result = typeDescriptor;
            }
            return(result);
        }
Beispiel #4
0
        public static typeDescriptor loadFromType(Type t)
        {
            typeDescriptor typeDescriptor;
            typeDescriptor result;

            if (!typeDescriptor.loadedTypes.TryGetValue(t, out typeDescriptor))
            {
                result = new typeDescriptor(t);
            }
            else
            {
                result = typeDescriptor;
            }
            return(result);
        }
Beispiel #5
0
        public wrapper getObjectAsType(object o, object xt)
        {
            Type type;

            if (xt is wrapper)
            {
                wrapper wrapper = (wrapper)xt;
                type = (Type)wrapper.wrappedObject;
            }
            else
            {
                type = this.getTypeOrGenericType(xt.ToString());
            }
            object         o2 = Convert.ChangeType(o, type);
            typeDescriptor td = typeDescriptor.loadFromType(type);

            return(wrapper.createWrapper(o2, td));
        }
Beispiel #6
0
 public VFPHelper vfpHelper(typeDescriptor typeD)
 {
     return(new VFPHelper(typeD));
 }
Beispiel #7
0
 public delegateWrapper(object o, typeDescriptor td) : base(o, td)
 {
 }
Beispiel #8
0
 public wrapperStatic(Type t, typeDescriptor td)
 {
     this.wrappedObject = t;
     this.wrappedType   = t;
     this.typeD         = td;
 }
 public delegateWrapperStatic(Type t, typeDescriptor td) : base(t, td)
 {
 }
Beispiel #10
0
 public VFPHelper(typeDescriptor typeD)
 {
     this.typeD = typeD;
 }
Beispiel #11
0
 public static wrapper createWrapper(object o, typeDescriptor td)
 {
     return(td.compile().getWrapper(o));
 }
Beispiel #12
0
 public wrapper(object o, typeDescriptor td)
 {
     this.wrappedObject = o;
     this.wrappedType   = o.GetType();
     this.typeD         = td;
 }
Beispiel #13
0
        public static wrapper createWrapper(object o)
        {
            typeDescriptor typeDescriptor = typeDescriptor.loadFromType(o.GetType());

            return(typeDescriptor.compile().getWrapper(o));
        }
Beispiel #14
0
 public enumWrapper(object o, typeDescriptor td) : base(o, td)
 {
 }