internal string GetRelativeClassName(WrapperClassInfo wci) { if (!TypeIsWrapped(wci.WrappedType)) throw new InvalidOperationException(); return GetRelativeClassName(wci.WrappedType); }
public bool GenerateForAllUsedIncomplete() { var allAssemblyTypes = new Dictionary<string, Type>(); foreach (Type t in TargetAssembly.GetTypes().Where(t => t.IsPublic)) { if (!allAssemblyTypes.ContainsKey(t.Name)) allAssemblyTypes.Add(t.Name, t); } bool added = false; foreach (Type type in UsedTypes.ToArray()) { if (!TypeIsWrapped(type)) throw new InvalidOperationException(); if (!CompleteTypes.ContainsKey(type)) { var wci = new WrapperClassInfo(type, this); CompleteTypes.Add(type, wci); foreach ( Type inheritedType in allAssemblyTypes.Values.Where(t => t.IsSubclassOf(wci.WrappedType) && t.IsPublic) .Where(TypeIsWrapped)) { if (inheritedType.GetCustomAttributes(typeof(ObsoleteAttribute), true).Count() == 0 && !UsedTypes.Contains(inheritedType)) UsedTypes.Add(inheritedType); } var sb = new StringBuilder(); if (wci.IsInterface) wci.GenerateInterfaceCode(sb); else wci.GenerateClassCode(sb); if (wci.FilePathBase.IndexOfAny(new[] { '\\', '/' }) != -1) Directory.CreateDirectory(Path.GetDirectoryName(wci.FilePathBase)); WriteTextToFile(wci.FilePathBase + ".cs", sb.ToString(), true); wci.GenerateUserClassFile(); added = true; } } return added; }
public WrapperStaticPublicField(WrapperClassInfo wrapperClassInfo, FieldInfo targetFieldInfo) { this.targetFieldInfo = targetFieldInfo; this.classInfo = wrapperClassInfo; }
public WrapperConstructorInfo(WrapperClassInfo classInfo, ConstructorInfo targetConstructorInfo) { this.targetConstructorInfo = targetConstructorInfo; this.classInfo = classInfo; }
public WrapperPropInfo(WrapperClassInfo wci, string propName, WrapperRepository wrapperRepository) { Name = propName; this.classInfo = wci; this.repository = wrapperRepository; }
public WrapperMethodInfo(WrapperClassInfo classInfo, MethodInfo targetMethodInfo) { this.targetMethodInfo = targetMethodInfo; this.classInfo = classInfo; }
internal string GetTargetFullName(WrapperClassInfo wrapperClassInfo) { return(WrapperNamespace + "." + wrapperClassInfo.RelativeClassName); }
public WrapperPropInfo(WrapperClassInfo wci, string propName, WrapperRepository wrapperRepository) { this.name = propName; this.classInfo = wci; this.repository = wrapperRepository; }
internal string GetTargetFullName(WrapperClassInfo wrapperClassInfo) { return WrapperNamespace + "." + wrapperClassInfo.RelativeClassName; }