Пример #1
0
    stringList GetMethodModifiers(MetaDataMethod m)
    {
        stringList mods = new stringList();

        switch (m.Flags & (int)(MethodAttributes.MemberAccessMask))
        {
        case (int)MethodAttributes.Private: mods.Add("private"); break;

        case (int)MethodAttributes.FamORAssem:
            mods.Add("protected"); mods.Add("internal"); break;

        case (int)MethodAttributes.Assem:  mods.Add("internal"); break;

        case (int)MethodAttributes.Family: mods.Add("protected"); break;

        case (int)MethodAttributes.Public: mods.Add("public"); break;
        }
        if ((m.Flags & (int)MethodAttributes.Final) != 0)
        {
            mods.Add("sealed");
        }
        if ((m.Flags & (int)MethodAttributes.Virtual) != 0)
        {
            mods.Add("virtual");
        }
        if ((m.Flags & (int)MethodAttributes.Static) != 0)
        {
            mods.Add("static");
        }
        if ((m.Flags & (int)MethodAttributes.Abstract) != 0)
        {
            mods.Add("abstract");
        }
        return(mods);
    }
Пример #2
0
    stringList GetTypeModifiers(System.Type type)
    {
        stringList mods = new stringList();

        if (type.IsNestedPrivate || type.IsNotPublic)
        {
            mods.Add("private");
        }
        else if (type.IsNestedFamORAssem)
        {
            mods.Add("protected"); mods.Add("internal");
        }
        else if (type.IsNestedAssembly)
        {
            mods.Add("internal");
        }
        else if (type.IsNestedFamily)
        {
            mods.Add("protected");
        }
        else if (type.IsPublic || type.IsNestedPublic)
        {
            mods.Add("public");
        }
        if (type.IsSealed)
        {
            mods.Add("sealed");
        }
        if (type.IsAbstract)
        {
            mods.Add("abstract");
        }
        return(mods);
    }
Пример #3
0
    stringList GetTypeModifiers(MetaDataTypeDefinition d)
    {
        stringList mods = new stringList();

        switch ((int)d.Flags & (int)(TypeAttributes.VisibilityMask))
        {
        case (int)TypeAttributes.NotPublic:
        case (int)TypeAttributes.NestedPrivate:
            mods.Add("private"); break;

        case (int)TypeAttributes.NestedFamORAssem:
            mods.Add("protected"); mods.Add("internal"); break;

        case (int)TypeAttributes.NestedAssembly: mods.Add("internal"); break;

        case (int)TypeAttributes.NestedFamily:   mods.Add("protected"); break;

        case (int)TypeAttributes.Public:
        case (int)TypeAttributes.NestedPublic:
            mods.Add("public"); break;
        }
        if (((int)d.Flags & (int)TypeAttributes.Sealed) != 0)
        {
            mods.Add("sealed");
        }
        if (((int)d.Flags & (int)TypeAttributes.Abstract) != 0)
        {
            mods.Add("abstract");
        }
        return(mods);
    }
Пример #4
0
 public void Add(string dir)
 {
     if (!libdirs.Contains(dir))
     {
         libdirs.Add(dir);
     }
 }
Пример #5
0
 public bool Load(string path)
 {
     if (path.StartsWith("./") || path.StartsWith(".\\"))
     {
         path = path.Substring(2);
     }
     if (!loaded.Contains(path))
     {
         try {
             PELoader pe   = new PELoader(path);
             long     time = Debug.Clock;
             metaData.Add(MetaData.loadMetaData(path, pe, false, false));
             // Debug.Report("inhaling " + path, Debug.Clock - time);
             loaded.Add(path);
         } catch {
             return(false);
         }
     }
     // Add top-level namespaces to global namespace
     foreach (MetaData m in metaData)
     {
         foreach (MetaDataTypeDefinition d in m.TypeDefs)
         {
             if (d.Namespace != "")
             {
                 GetNameSpace(d.Namespace);
             }
         }
     }
     return(true);
 }
Пример #6
0
    stringList GetFieldModifiers(FieldInfo info)
    {
        stringList mods = new stringList();

        if (info.IsPrivate)
        {
            mods.Add("private");
        }
        else if (info.IsFamilyOrAssembly)
        {
            mods.Add("protected"); mods.Add("internal");
        }
        else if (info.IsAssembly)
        {
            mods.Add("internal");
        }
        else if (info.IsFamily)
        {
            mods.Add("protected");
        }
        else if (info.IsPublic)
        {
            mods.Add("public");
        }
        if (info.IsStatic)
        {
            mods.Add("static");
        }
        return(mods);
    }
Пример #7
0
    stringList GetMethodModifiers(MethodBase info)
    {
        stringList mods = new stringList();

        if (info.IsPrivate)
        {
            mods.Add("private");
        }
        else if (info.IsFamilyOrAssembly)
        {
            mods.Add("protected"); mods.Add("internal");
        }
        else if (info.IsAssembly)
        {
            mods.Add("internal");
        }
        else if (info.IsFamily)
        {
            mods.Add("protected");
        }
        else if (info.IsPublic)
        {
            mods.Add("public");
        }
        if (info.IsFinal)
        {
            mods.Add("sealed");
        }
        if (info.IsVirtual)
        {
            mods.Add("virtual");
        }
        if (info.IsStatic)
        {
            mods.Add("static");
        }
        if (info.IsAbstract)
        {
            mods.Add("abstract");
        }
        return(mods);
    }
Пример #8
0
    stringList GetFieldModifiers(MetaDataField f)
    {
        stringList mods = new stringList();

        switch (f.Flags & (int)(FieldAttributes.FieldAccessMask))
        {
        case (int)FieldAttributes.Private: mods.Add("private"); break;

        case (int)FieldAttributes.FamORAssem:
            mods.Add("protected"); mods.Add("internal"); break;

        case (int)FieldAttributes.Assembly: mods.Add("internal"); break;

        case (int)FieldAttributes.Family: mods.Add("protected"); break;

        case (int)FieldAttributes.Public: mods.Add("public"); break;
        }
        if ((f.Flags & (int)FieldAttributes.Static) != 0)
        {
            mods.Add("static");
        }
        return(mods);
    }