GetNames() public static method

public static GetNames ( string nsname ) : StringCollection
nsname string
return System.Collections.Specialized.StringCollection
Example #1
0
        //===================================================================
        // Preloads all currently-known names for the module namespace. This
        // can be called multiple times, to add names from assemblies that
        // may have been loaded since the last call to the method.
        //===================================================================

        public void LoadNames()
        {
            ManagedType m = null;

            foreach (string name in AssemblyManager.GetNames(_namespace))
            {
                this.cache.TryGetValue(name, out m);
                if (m == null)
                {
                    ManagedType attr = this.GetAttribute(name, true);
                    if (Runtime.wrap_exceptions)
                    {
                        if (attr is ExceptionClassObject)
                        {
                            ExceptionClassObject c = attr as ExceptionClassObject;
                            if (c != null)
                            {
                                IntPtr p = attr.pyHandle;
                                IntPtr r = Exceptions.GetExceptionClassWrapper(p);
                                Runtime.PyDict_SetItemString(dict, name, r);
                                Runtime.Incref(r);
                            }
                        }
                    }
                }
            }
        }
Example #2
0
 /// <summary>
 /// Preloads all currently-known names for the module namespace. This
 /// can be called multiple times, to add names from assemblies that
 /// may have been loaded since the last call to the method.
 /// </summary>
 public void LoadNames()
 {
     foreach (var name in AssemblyManager.GetNames(_namespace))
     {
         var attr = GetAttribute(name, true);
     }
 }
Example #3
0
        /// <summary>
        /// Preloads all currently-known names for the module namespace. This
        /// can be called multiple times, to add names from assemblies that
        /// may have been loaded since the last call to the method.
        /// </summary>
        public void LoadNames()
        {
            ManagedType m = null;

            foreach (string name in AssemblyManager.GetNames(_namespace))
            {
                cache.TryGetValue(name, out m);
                if (m == null)
                {
                    ManagedType attr = GetAttribute(name, true);
                }
            }
        }
Example #4
0
        /// <summary>
        /// Preloads all currently-known names for the module namespace. This
        /// can be called multiple times, to add names from assemblies that
        /// may have been loaded since the last call to the method.
        /// </summary>
        public void LoadNames()
        {
            ManagedType m = null;

            foreach (string name in AssemblyManager.GetNames(_namespace))
            {
                cache.TryGetValue(name, out m);
                if (m != null)
                {
                    continue;
                }
                IntPtr attr = Runtime.PyDict_GetItemString(dict, name);
                // If __dict__ has already set a custom property, skip it.
                if (attr != IntPtr.Zero)
                {
                    continue;
                }
                GetAttribute(name, true);
            }
        }
Example #5
0
        /// <summary>
        /// Preloads all currently-known names for the module namespace. This
        /// can be called multiple times, to add names from assemblies that
        /// may have been loaded since the last call to the method.
        /// </summary>
        public void LoadNames()
        {
            ManagedType m = null;

            foreach (string name in AssemblyManager.GetNames(_namespace))
            {
                cache.TryGetValue(name, out m);
                if (m != null)
                {
                    continue;
                }
                BorrowedReference attr = Runtime.PyDict_GetItemString(DictRef, name);
                // If __dict__ has already set a custom property, skip it.
                if (!attr.IsNull)
                {
                    continue;
                }
                GetAttribute(name, true);
            }
        }
Example #6
0
        //===================================================================
        // Preloads all currently-known names for the module namespace. This
        // can be called multiple times, to add names from assemblies that
        // may have been loaded since the last call to the method.
        //===================================================================

        public void LoadNames()
        {
            foreach (string name in AssemblyManager.GetNames(_namespace))
            {
                if (!this.cache.ContainsKey(name))
                {
                    ManagedType attr = this.GetAttribute(name);
                    if (Runtime.wrap_exceptions)
                    {
                        if (attr is ClassBase)
                        {
                            ClassBase c = attr as ClassBase;
                            if (c.is_exception)
                            {
                                IntPtr p = attr.pyHandle;
                                IntPtr r = Exceptions.GetExceptionClassWrapper(p);
                                Runtime.PyDict_SetItemString(dict, name, r);
                                Runtime.Incref(r);
                            }
                        }
                    }
                }
            }
        }
Example #7
0
        /// <summary>
        /// Preloads all currently-known names for the module namespace. This
        /// can be called multiple times, to add names from assemblies that
        /// may have been loaded since the last call to the method.
        /// </summary>
        public void LoadNames()
        {
            ManagedType m = null;

            foreach (string name in AssemblyManager.GetNames(_namespace))
            {
                cache.TryGetValue(name, out m);
                if (m != null)
                {
                    continue;
                }
                BorrowedReference attr = Runtime.PyDict_GetItemString(DictRef, name);
                // If __dict__ has already set a custom property, skip it.
                if (!attr.IsNull)
                {
                    continue;
                }

                if (GetAttribute(name, true) != null)
                {
                    // if it's a valid attribute, add it to __all__
                    var pyname = Runtime.PyString_FromString(name);
                    try
                    {
                        if (Runtime.PyList_Append(new BorrowedReference(__all__), new BorrowedReference(pyname)) != 0)
                        {
                            throw PythonException.ThrowLastAsClrException();
                        }
                    }
                    finally
                    {
                        Runtime.XDecref(pyname);
                    }
                }
            }
        }