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; } }
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; }
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); } }
/// <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) { }
public ClassInterfaceAttribute ( ClassInterfaceType classInterfaceType ) { ciType = classInterfaceType; }
public ClassInterfaceAttribute(ClassInterfaceType classInterfaceType) { Value = classInterfaceType; }
public ClassInterfaceAttribute(short classInterfaceType) { ciType = (ClassInterfaceType)classInterfaceType; }
public ClassInterfaceAttribute(ClassInterfaceType classInterfaceType) { _val = classInterfaceType; }
internal ClassInterfaceAttribute(short classInterfaceType) { _val = (ClassInterfaceType)classInterfaceType; }
internal ClassInterfaceAttribute(ClassInterfaceType classInterfaceType) { _val = classInterfaceType; }
public ClassInterfaceAttribute(short classInterfaceType) { this._val = (ClassInterfaceType)classInterfaceType; }
public static CustomAttributeBuilder GetBuilderForClassInterface(ClassInterfaceType classInterfaceType) { ConstructorInfo ctorClassInterface = typeof(ClassInterfaceAttribute).GetConstructor(new Type[] { typeof(ClassInterfaceType) }); return(new CustomAttributeBuilder(ctorClassInterface, new Object[] { classInterfaceType })); }
public ClassInterfaceAttribute(short classInterfaceType) { _val = (ClassInterfaceType)classInterfaceType; }
public void Ctor_ClassInterfaceType(ClassInterfaceType classInterfaceType) { var attribute = new ClassInterfaceAttribute(classInterfaceType); Assert.Equal(classInterfaceType, attribute.Value); }
// Constructors. public ClassInterfaceAttribute(ClassInterfaceType classInterfaceType) { value = classInterfaceType; }
public static CustomAttributeBuilder GetBuilderForClassInterface(ClassInterfaceType classInterfaceType) { ConstructorInfo ctorClassInterface = typeof(ClassInterfaceAttribute).GetConstructor(new Type[] { typeof(ClassInterfaceType) }); return new CustomAttributeBuilder(ctorClassInterface, new Object[] { classInterfaceType }); }
public ClassInterfaceAttribute(ClassInterfaceType classInterfaceType) { ciType = classInterfaceType; }
/// <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(); }