コード例 #1
0
ファイル: AttributeData.cs プロジェクト: LongJohnCoder/stark
        internal void DecodeClassInterfaceAttribute(AttributeSyntax nodeOpt, DiagnosticBag diagnostics)
        {
            Debug.Assert(!this.HasErrors);

            TypedConstant ctorArgument = this.CommonConstructorArguments[0];

            Debug.Assert(ctorArgument.Kind == TypedConstantKind.Enum || ctorArgument.Kind == TypedConstantKind.Primitive);

            ClassInterfaceType interfaceType = ctorArgument.Kind == TypedConstantKind.Enum ?
                                               ctorArgument.DecodeValue <ClassInterfaceType>(SpecialType.System_Enum) :
                                               (ClassInterfaceType)ctorArgument.DecodeValue <short>(SpecialType.System_Int16);

            switch (interfaceType)
            {
            case ClassInterfaceType.None:
            case Cci.Constants.ClassInterfaceType_AutoDispatch:
            case Cci.Constants.ClassInterfaceType_AutoDual:
                break;

            default:
                // CS0591: Invalid value for argument to '{0}' attribute
                Location attributeArgumentSyntaxLocation = this.GetAttributeArgumentSyntaxLocation(0, nodeOpt);
                diagnostics.Add(ErrorCode.ERR_InvalidAttributeArgument, attributeArgumentSyntaxLocation, nodeOpt != null ? nodeOpt.GetErrorDisplayName() : "");
                break;
            }
        }
コード例 #2
0
 public FileInfo(string fileName, ClassInterfaceType classInterface, string classInterfaceName, int classInterfaceCount, string namespaceName, int codeLinesCount)
 {
     FileName           = fileName;
     ClassInterface     = classInterface;
     ClassInterfaceName = classInterfaceName;
     // if (classInterfaceCount > 1) throw new FileException("There can only be 1 class in a file.");
     ClassInterfaceCount = classInterfaceCount;
     NamespaceName       = namespaceName;
     CodeLinesCount      = codeLinesCount;
 }
コード例 #3
0
        public void CheckAssemblySCValidity(Assembly asm)
        {
            Type[]               types    = null;
            bool                 flag     = true;
            ArrayList            list     = null;
            RegistrationServices services = new RegistrationServices();

            try
            {
                types = asm.GetTypes();
            }
            catch (ReflectionTypeLoadException exception)
            {
                types = exception.Types;
            }
            foreach (Type type in types)
            {
                if (((null != type) && type.IsClass) && type.IsSubclassOf(typeof(ServicedComponent)))
                {
                    if (!services.TypeRequiresRegistration(type) && !type.IsAbstract)
                    {
                        flag = false;
                        if (list == null)
                        {
                            list = new ArrayList();
                        }
                        RegistrationErrorInfo info = new RegistrationErrorInfo(null, null, type.ToString(), -2147467259);
                        list.Add(info);
                    }
                    ClassInterfaceType classInterfaceType = ServicedComponentInfo.GetClassInterfaceType(type);
                    foreach (MethodInfo info2 in type.GetMethods())
                    {
                        if (ReflectionCache.ConvertToInterfaceMI(info2) == null)
                        {
                            if (ServicedComponentInfo.HasSpecialMethodAttributes(info2))
                            {
                                this.ReportWarning(Resource.FormatString("Reg_NoClassInterfaceSecure", type.FullName, info2.Name));
                            }
                            if ((classInterfaceType == ClassInterfaceType.AutoDispatch) && ServicedComponentInfo.IsMethodAutoDone(info2))
                            {
                                this.ReportWarning(Resource.FormatString("Reg_NoClassInterface", type.FullName, info2.Name));
                            }
                        }
                    }
                }
            }
            if (!flag)
            {
                RegistrationErrorInfo[] errorInfo = (RegistrationErrorInfo[])list.ToArray(typeof(RegistrationErrorInfo));
                throw new RegistrationException(Resource.FormatString("Reg_InvalidServicedComponents"), errorInfo);
            }
        }
コード例 #4
0
        /// <summary>
        /// Analyze CSFile and make FIleInfo object
        /// </summary>
        /// <param name="path"></param>
        /// <returns></returns>
        public static FileInfo CreateFileObject(string path)
        {
            string[] result = Extensions.readLines(path);

            ClassInterfaceType classInterface     = ClassInterfaceType.Geen;
            string             classInterfaceName = "";
            string             namespaceName      = "";
            int codeLinesCount = 0;
            int classCount     = 0;

            for (int index = 0; index < result.Length; index++)
            {
                if (result[index].Trim() != "")
                {
                    codeLinesCount++;
                    if (!result[index].Contains("//") && !result[index].Contains("///") && !result[index].Contains("#"))
                    {
                        if (result[index].Contains("namespace"))
                        {
                            string[] x = result[index].Split("namespace ");
                            namespaceName = x[1].Trim();
                        }
                        if (result[index].Contains("class"))
                        {
                            classCount++;
                            string[] x = result[index].Split("class ");
                            classInterfaceName = x[1].Trim();
                            classInterface     = ClassInterfaceType.Class;
                        }
                        if (result[index].Contains("interface"))
                        {
                            classCount++;
                            string[] x = result[index].Split("interface ");
                            classInterfaceName = x[1].Trim();
                            classInterface     = ClassInterfaceType.Interface;
                        }
                    }
                }
            }
            if (classInterface.Equals(ClassInterfaceType.Geen))
            {
                return(null);
            }
            string   fileName = Path.GetFileName(path);
            FileInfo file     = new FileInfo(fileName, classInterface, classInterfaceName, classCount, namespaceName, codeLinesCount);

            return(file);
        }
 public ClassInterfaceAttribute(ClassInterfaceType classInterfaceType)
 {
 }
コード例 #6
0
		public ClassInterfaceAttribute ( ClassInterfaceType classInterfaceType ) {
			ciType = classInterfaceType;
		}
コード例 #7
0
 public ClassInterfaceAttribute(ClassInterfaceType classInterfaceType)
 {
     Value = classInterfaceType;
 }
コード例 #8
0
 public ClassInterfaceAttribute(short classInterfaceType)
 {
     ciType = (ClassInterfaceType)classInterfaceType;
 }
コード例 #9
0
ファイル: attributes.cs プロジェクト: SixGodZhang/Source
 public ClassInterfaceAttribute(ClassInterfaceType classInterfaceType)
 {
     _val = classInterfaceType;
 }
コード例 #10
0
 public ClassInterfaceAttribute(ClassInterfaceType classInterfaceType)
 {
 }
コード例 #11
0
 internal ClassInterfaceAttribute(short classInterfaceType)
 {
     _val = (ClassInterfaceType)classInterfaceType;
 }
コード例 #12
0
 internal ClassInterfaceAttribute(ClassInterfaceType classInterfaceType)
 {
     _val = classInterfaceType;
 }
コード例 #13
0
 public ClassInterfaceAttribute(short classInterfaceType)
 {
     this._val = (ClassInterfaceType)classInterfaceType;
 }
コード例 #14
0
        public static CustomAttributeBuilder GetBuilderForClassInterface(ClassInterfaceType classInterfaceType)
        {
            ConstructorInfo ctorClassInterface = typeof(ClassInterfaceAttribute).GetConstructor(new Type[] { typeof(ClassInterfaceType) });

            return(new CustomAttributeBuilder(ctorClassInterface, new Object[] { classInterfaceType }));
        }
コード例 #15
0
ファイル: attributes.cs プロジェクト: razzfazz/mono
        public ClassInterfaceAttribute(ClassInterfaceType classInterfaceType)
        {
            _val = classInterfaceType;

        }
コード例 #16
0
ファイル: attributes.cs プロジェクト: razzfazz/mono
 public ClassInterfaceAttribute(short classInterfaceType)
 {
     _val = (ClassInterfaceType)classInterfaceType;
 }
コード例 #17
0
        public void Ctor_ClassInterfaceType(ClassInterfaceType classInterfaceType)
        {
            var attribute = new ClassInterfaceAttribute(classInterfaceType);

            Assert.Equal(classInterfaceType, attribute.Value);
        }
コード例 #18
0
	// Constructors.
	public ClassInterfaceAttribute(ClassInterfaceType classInterfaceType)
			{
				value = classInterfaceType;
			}
コード例 #19
0
 public static CustomAttributeBuilder GetBuilderForClassInterface(ClassInterfaceType classInterfaceType)
 {
     ConstructorInfo ctorClassInterface = typeof(ClassInterfaceAttribute).GetConstructor(new Type[] { typeof(ClassInterfaceType) });
     return new CustomAttributeBuilder(ctorClassInterface, new Object[] { classInterfaceType });
 }
コード例 #20
0
 public ClassInterfaceAttribute(ClassInterfaceType classInterfaceType)
 {
     ciType = classInterfaceType;
 }
コード例 #21
0
 /// <summary>Initializes a new instance of the <see cref="T:System.Runtime.InteropServices.ClassInterfaceAttribute" /> class with the specified <see cref="T:System.Runtime.InteropServices.ClassInterfaceType" /> enumeration member.</summary><param name="classInterfaceType">One of the <see cref="T:System.Runtime.InteropServices.ClassInterfaceType" /> values that describes the type of interface that is generated for a class. </param>
 public ClassInterfaceAttribute(ClassInterfaceType classInterfaceType)
 {
     throw new NotImplementedException();
 }