Exemplo n.º 1
0
        public ClrNamespace(string name, ClrNamespace parent = null)
        {
            Pointer = Type.Create();
            instances.Add(Pointer, this);
            ObjectManager.Register(this, Pointer);

            Parent = parent;
            Name   = name;
        }
Exemplo n.º 2
0
        private static PythonObject __getattr__(PythonObject self, PythonTuple args)
        {
            ClrNamespace me = instances[self];

            string name     = (args[0] as PythonString).ToString();
            string fullName = me.ToIdentifier() + "." + name;

            Type type = AppDomain.CurrentDomain.GetAssemblies()
                        .Select(a => a.GetType(fullName))
                        .FirstOrDefault(t => t != null);

            if (type == null)
            {
                return(new ClrNamespace(name, me));
            }
            else
            {
                return(TypeManager.ToPython(type));
            }
        }
Exemplo n.º 3
0
        private static PythonObject __str__(PythonObject self, PythonTuple args)
        {
            ClrNamespace me = instances[self];

            return(me.ToString());
        }