コード例 #1
0
            /// <summary>
            /// Build a class from my data.
            /// </summary>
            private ClassFile BuildClass(IClassLoader loader, out List <DexImportField> fields, out List <DexImportMethod> methods)
            {
                // Build class
                var cf = new ClassFile(null, loader)
                {
                    IsCreatedByLoader = true
                };

                cf.ClassName        = className;
                cf.ClassAccessFlags = (ClassAccessFlags)GetAccessFlags();
                cf.SuperClass       = GetSuperClassName();
                cf.SetSignature(GetSignature());

                // Add fields
                fields = types.SelectMany(x => x.Fields).Where(x => x.GetDexOrJavaImportAttribute() != null).Select(x => new DexImportField(x)).ToList();
                cf.Fields.AddRange(fields.Select(x => x.Resolve(cf)));

                // Add methods
                methods = types.SelectMany(x => x.Methods).Where(x => x.GetDexOrJavaImportAttribute() != null).Select(x => new DexImportMethod(x, x.GetDexOrJavaImportAttribute())).ToList();
                cf.Methods.AddRange(methods.Select(x => x.Resolve(cf)));

                return(cf);
            }