本文整理汇总了C#中Mono.Cecil.AssemblyDefinition.SelectMany方法的典型用法代码示例。如果您正苦于以下问题:C# AssemblyDefinition.SelectMany方法的具体用法?C# AssemblyDefinition.SelectMany怎么用?C# AssemblyDefinition.SelectMany使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mono.Cecil.AssemblyDefinition
的用法示例。
在下文中一共展示了AssemblyDefinition.SelectMany方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Create
public static NamespaceInfo[] Create(AssemblyDefinition[] targetAssemblies)
{
var garbageTypeList = new[]
{
"AVPlayerItemLegibleOutputPushDelegate"
// NB: Aparrently this used to break "build on device because of reasons". We don't know what these reasons are and this may not be needed anymore.
};
var publicDelegateTypes = targetAssemblies
.SelectMany(x => SafeTypes.GetSafeTypes(x))
.Where(x => x.IsPublic && !x.IsInterface && !x.HasGenericParameters && IsCocoaDelegateName(x.Name))
.Where(x => x.BaseType == null || !x.BaseType.FullName.Contains("MulticastDelegate"))
.Where(x => !garbageTypeList.Any(y => x.FullName.Contains(y)))
.Select(x => new {Type = x, Delegates = GetPublicDelegateMethods(x)})
.Where(x => x.Delegates.Length > 0)
.ToArray();
var namespaceData = publicDelegateTypes
.GroupBy(x => x.Type.Namespace)
//.Where(x => !garbageNamespaceList.Contains(x.Key)) // NB: We don't know why this is disabled.
.Select(x => new NamespaceInfo
{
Name = x.Key,
Types = x.Select(y => new PublicTypeInfo
{
Name = y.Type.Name,
Type = y.Type,
Abstract = y.Type.IsAbstract ? "abstract" : "",
ZeroParameterMethods =
y.Delegates.Where(z => z.Parameters.Count == 0).Select(z => new ParentInfo
{
Name = z.Name
}).ToArray(),
SingleParameterMethods =
y.Delegates.Where(z => z.Parameters.Count == 1).Select(z => new SingleParameterMethod
{
Name = z.Name,
ParameterType = z.Parameters[0].ParameterType.FullName,
ParameterName = z.Parameters[0].Name
}).ToArray(),
MultiParameterMethods =
y.Delegates.Where(z => z.Parameters.Count > 1).Select(z => new MultiParameterMethod
{
Name = z.Name,
ParameterList =
string.Join(", ",
z.Parameters.Select(
a => string.Format("{0} {1}", a.ParameterType.FullName, a.Name))),
ParameterTypeList =
string.Join(", ", z.Parameters.Select(a => a.ParameterType.FullName)),
ParameterNameList = string.Join(", ", z.Parameters.Select(a => a.Name))
}).ToArray()
}).ToArray()
}).ToArray();
return namespaceData;
}
示例2: CreateEventTemplateInformation
public static NamespaceInfo[] CreateEventTemplateInformation(AssemblyDefinition[] targetAssemblies)
{
var publicTypesWithEvents = targetAssemblies
.SelectMany(x => SafeGetTypes(x))
.Where(x => x.IsPublic && !x.HasGenericParameters)
.Select(x => new { Type = x, Events = GetPublicEvents(x) })
.Where(x => x.Events.Length > 0)
.ToArray();
var garbageNamespaceList = new[] {
"Windows.UI.Xaml.Data",
"Windows.UI.Xaml.Interop",
"Windows.UI.Xaml.Input",
"MonoTouch.AudioToolbox",
"MonoMac.AudioToolbox",
"ReactiveUI.Events",
};
var namespaceData = publicTypesWithEvents
.GroupBy(x => x.Type.Namespace)
.Where(x => !garbageNamespaceList.Contains(x.Key))
.Select(x => new NamespaceInfo() {
Name = x.Key,
Types = x.Select(y => new PublicTypeInfo() {
Name = y.Type.Name,
Type = y.Type,
Events = y.Events.Select(z => new PublicEventInfo() {
Name = z.Name,
EventHandlerType = GetRealTypeName(z.EventType),
EventArgsType = GetEventArgsTypeForEvent(z),
}).ToArray(),
}).ToArray()
}).ToArray();
foreach (var type in namespaceData.SelectMany(x => x.Types)) {
var parentWithEvents = GetParents(type.Type).FirstOrDefault(x => GetPublicEvents(x).Any());
if (parentWithEvents == null) continue;
type.Parent = new ParentInfo() { Name = parentWithEvents.FullName };
}
return namespaceData;
}
示例3: CreateDelegateTemplateInformation
public static NamespaceInfo[] CreateDelegateTemplateInformation(AssemblyDefinition[] targetAssemblies)
{
var garbageTypeList = new[] {
"AVPlayerItemLegibleOutputPushDelegate", // NB: Breaks build on device because reasons.
};
var publicDelegateTypes = targetAssemblies
.SelectMany(x => SafeGetTypes(x))
.Where(x => x.IsPublic && !x.IsInterface && !x.HasGenericParameters && isCocoaDelegateName(x.Name))
.Where(x => x.BaseType == null || !x.BaseType.FullName.Contains("MulticastDelegate"))
.Where(x => !garbageTypeList.Any(y => x.FullName.Contains(y)))
.Select(x => new { Type = x, Delegates = GetPublicDelegateMethods(x) })
.Where(x => x.Delegates.Length > 0)
.ToArray();
var namespaceData = publicDelegateTypes
.GroupBy(x => x.Type.Namespace)
//.Where(x => !garbageNamespaceList.Contains(x.Key))
.Select(x => new NamespaceInfo() {
Name = x.Key,
Types = x.Select(y => new PublicTypeInfo() {
Name = y.Type.Name,
Type = y.Type,
Abstract = y.Type.IsAbstract ? "abstract" : "",
ZeroParameterMethods = y.Delegates.Where(z => z.Parameters.Count == 0).Select(z => new ParentInfo() {
Name = z.Name,
}).ToArray(),
SingleParameterMethods = y.Delegates.Where(z => z.Parameters.Count == 1).Select(z => new SingleParameterMethod() {
Name = z.Name,
ParameterType = z.Parameters[0].ParameterType.FullName,
ParameterName = z.Parameters[0].Name,
}).ToArray(),
MultiParameterMethods = y.Delegates.Where(z => z.Parameters.Count > 1).Select(z => new MultiParameterMethod() {
Name = z.Name,
ParameterList = String.Join(", ", z.Parameters.Select(a => String.Format("{0} {1}", a.ParameterType.FullName, a.Name))),
ParameterTypeList = String.Join(", ", z.Parameters.Select(a => a.ParameterType.FullName)),
ParameterNameList = String.Join(", ", z.Parameters.Select(a => a.Name)),
}).ToArray(),
}).ToArray()
}).ToArray();
return namespaceData;
}