Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public AppBuilder UsePlatformDetect()
- {
- OperatingSystemType os = this.RuntimePlatform.GetRuntimeInfo().OperatingSystem;
- this.LoadAssembliesInDirectory();
- Assembly[] loadedAssemblies1 = this.RuntimePlatform.GetLoadedAssemblies();
- Func<Assembly, IEnumerable<ExportWindowingSubsystemAttribute>> func1 = (Func<Assembly, IEnumerable<ExportWindowingSubsystemAttribute>>) (assembly => assembly.GetCustomAttributes<ExportWindowingSubsystemAttribute>());
- Func<Assembly, IEnumerable<ExportWindowingSubsystemAttribute>> collectionSelector1;
- ExportWindowingSubsystemAttribute windowingSubsystemAttribute = ((IEnumerable<Assembly>) loadedAssemblies1).SelectMany(collectionSelector1, (assembly, attribute) => new
- {
- assembly = assembly,
- attribute = attribute
- }).Where(_param1 =>
- {
- if (_param1.attribute.RequiredOS == os)
- return this.CheckEnvironment(_param1.attribute.EnvironmentChecker);
- return false;
- }).OrderBy(_param1 => _param1.attribute.Priority).Select(_param1 => _param1.attribute).FirstOrDefault<ExportWindowingSubsystemAttribute>();
- if (windowingSubsystemAttribute == null)
- throw new InvalidOperationException("No windowing subsystem found. Are you missing assembly references?");
- Assembly[] loadedAssemblies2 = this.RuntimePlatform.GetLoadedAssemblies();
- Func<Assembly, IEnumerable<ExportRenderingSubsystemAttribute>> func2 = (Func<Assembly, IEnumerable<ExportRenderingSubsystemAttribute>>) (assembly => assembly.GetCustomAttributes<ExportRenderingSubsystemAttribute>());
- Func<Assembly, IEnumerable<ExportRenderingSubsystemAttribute>> collectionSelector2;
- ExportRenderingSubsystemAttribute renderingSubsystemAttribute = ((IEnumerable<Assembly>) loadedAssemblies2).SelectMany(collectionSelector2, (assembly, attribute) => new
- {
- assembly = assembly,
- attribute = attribute
- }).Where(_param1 =>
- {
- if (_param1.attribute.RequiredOS == os)
- return this.CheckEnvironment(_param1.attribute.EnvironmentChecker);
- return false;
- }).Where(_param1 =>
- {
- if (_param1.attribute.RequiresWindowingSubsystem != null)
- return _param1.attribute.RequiresWindowingSubsystem == windowingSubsystemAttribute.Name;
- return true;
- }).OrderBy(_param1 => _param1.attribute.Priority).Select(_param1 => _param1.attribute).FirstOrDefault<ExportRenderingSubsystemAttribute>();
- if (renderingSubsystemAttribute == null)
- throw new InvalidOperationException("No rendering subsystem found. Are you missing assembly references?");
- this.UseWindowingSubsystem((Action) (() => windowingSubsystemAttribute.InitializationType.GetRuntimeMethod(windowingSubsystemAttribute.InitializationMethod, Type.EmptyTypes).Invoke((object) null, (object[]) null)), windowingSubsystemAttribute.Name);
- this.UseRenderingSubsystem((Action) (() => renderingSubsystemAttribute.InitializationType.GetRuntimeMethod(renderingSubsystemAttribute.InitializationMethod, Type.EmptyTypes).Invoke((object) null, (object[]) null)), renderingSubsystemAttribute.Name);
- return this;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement