Esempio n. 1
0
        public AddBaseType(CsType type, string name)
        {
            Contract.Requires(type != null, "type is null");
            Contract.Requires(!string.IsNullOrEmpty(name), "name is null or empty");

            m_type = type;
            m_name = name;
        }
Esempio n. 2
0
        public ResolvedTarget(string typeName, CsType type, bool isInstance, bool isStatic)
        {
            Contract.Requires(!string.IsNullOrEmpty(typeName), "typeName is null or empty");
            Contract.Requires(isInstance || isStatic, "at least one of isInstance and isStatic should be true");

            TypeName = typeName;
            Type = type;
            IsInstance = isInstance;
            IsStatic = isStatic;
        }
 private object DoAddMember(CsType type, string text)
 {
     return new AddMember(type, text.Split('\n'));
 }
        private object DoHasMember(CsType type, string name, object[] inTypes)
        {
            string[] types = new string[inTypes.Length];
            for (int i = 0; i < inTypes.Length; ++i)
            {
                if (inTypes[i] == null)
                    throw new Exception(string.Format("Type #{0} is null.", i));

                string n = inTypes[i] as string;
                if (n == null)
                    throw new Exception(string.Format("Type #{0} is a {1}, but should be a String.", i, RefactorType.GetName(inTypes[i].GetType())));

                types[i] = n;
            }

            if (types.Length == 0)
                if (DoHasEnum(type.Enums, name) ||
                    DoHasEvent(type.Events, name) ||
                    DoHasField(type.Fields, name) ||
                    DoHasProperty(type.Properties, name))
                    return true;

            return DoHasDelegate(type.Delegates, name, types) ||
                DoHasIndexer(type.Indexers, name, types) ||
                DoHasMethod(type.Methods, name, types) ||
                DoHasOperator(type.Operators, name, types);
        }
 private object DoGetProperties(CsType type)
 {
     return type.Properties;
 }
 private object DoGetName(CsType type)
 {
     return type.Name;
 }
 private object DoGetMethods(CsType type)
 {
     return type.Methods;
 }
 private object DoGetIsStatic(CsType type)
 {
     return (type.Modifiers & MemberModifiers.Static) == MemberModifiers.Static;
 }
 private object DoGetFields(CsType type)
 {
     return type.Fields;
 }
Esempio n. 10
0
 private object DoGetEvents(CsType type)
 {
     return type.Events;
 }
Esempio n. 11
0
 private object DoGetDeclaringType(CsType type)
 {
     return type.DeclaringType;
 }
Esempio n. 12
0
 private object DoGetConstraints(CsType type)
 {
     return type.Constraints;
 }
Esempio n. 13
0
 private object DoGetBases(CsType type)
 {
     return type.Bases.Names;
 }
Esempio n. 14
0
 private object DoGetAttributes(CsType type)
 {
     return type.Attributes;
 }
Esempio n. 15
0
 private object DoGetAccess(CsType type)
 {
     return type.Access.ToString().ToLower();
 }
Esempio n. 16
0
 private object DoGetIsProtected(CsType type)
 {
     return (type.Modifiers & MemberModifiers.Protected) == MemberModifiers.Protected;
 }
Esempio n. 17
0
 private object DoGetIsSealed(CsType type)
 {
     if (type is CsStruct)
         return true;
     else
         return (type.Modifiers & MemberModifiers.Sealed) == MemberModifiers.Sealed;
 }
Esempio n. 18
0
 private object DoGetFullName(CsType type)
 {
     return type.FullName;
 }
Esempio n. 19
0
 private object DoGetMembers(CsType type)
 {
     return type.Members;
 }
Esempio n. 20
0
 private object DoGetGenericArguments(CsType type)
 {
     return type.GenericArguments;
 }
Esempio n. 21
0
 private object DoGetModifiers(CsType type)
 {
     return type.Modifiers.ToString().ToLower();
 }
Esempio n. 22
0
 private object DoGetIndexers(CsType type)
 {
     return type.Indexers;
 }
Esempio n. 23
0
 private object DoGetOperators(CsType type)
 {
     return type.Operators;
 }
Esempio n. 24
0
 private object DoGetIsAbstract(CsType type)
 {
     return (type.Modifiers & MemberModifiers.Abstract) == MemberModifiers.Abstract;
 }
Esempio n. 25
0
        private object DoGetUniqueName(CsType type, string inName)
        {
            string name = inName;
            for (int i = 2; i < 102; ++i)
            {
                if (!type.Members.Any(d => d.Name == name))	// TODO: might want to use the db to check base types
                    return name;

                name = inName + i;
            }

            throw new Exception("Couldn't find a unique name after 100 tries.");
        }
Esempio n. 26
0
 private object DoGetIsInternal(CsType type)
 {
     return (type.Modifiers & MemberModifiers.Internal) == MemberModifiers.Internal;
 }
Esempio n. 27
0
 public AddMember(CsType type, params string[] lines)
 {
     m_type = type;
     m_lines = DoMungeLines(lines);
 }
Esempio n. 28
0
 private object DoGetIsPartial(CsType type)
 {
     return (type.Modifiers & MemberModifiers.Partial) == MemberModifiers.Partial;
 }
Esempio n. 29
0
 private object DoGetIsPrivate(CsType type)
 {
     return (type.Modifiers & MemberModifiers.Private) == MemberModifiers.Private;
 }
Esempio n. 30
0
 private object DoAddBase(CsType type, string name)
 {
     return new AddBaseType(type, name);
 }