11using System ;
22using System . Reflection ;
33
4-
54namespace AtomicEngine
65{
7- public partial class PlayerApp : AppBase
8- {
9- protected static void ExecuteAtomicMain ( string [ ] args )
10- {
11- var file = AtomicNET . Cache . GetFile ( "AtomicProject.dll" ) ;
12-
13- if ( file == null )
14- return ;
15-
16- Assembly assembly = Assembly . LoadFrom ( file . FullPath ) ;
17-
18- if ( assembly == null )
19- return ;
20-
21- Type atomicMainType = null ;
22- Type [ ] assemblyTypes = assembly . GetTypes ( ) ;
23-
24- for ( int j = 0 ; j < assemblyTypes . Length ; j ++ )
25- {
26- if ( assemblyTypes [ j ] . Name == "AtomicMain" )
27- {
28- atomicMainType = assemblyTypes [ j ] ;
29- break ;
30- }
31- }
32-
33- if ( atomicMainType == null )
34- return ;
35-
36- Type [ ] mainParms = new Type [ 1 ] { typeof ( string [ ] ) } ;
37-
38- var method = atomicMainType . GetMethod ( "Main" , BindingFlags . Static | BindingFlags . Public | BindingFlags . NonPublic , Type . DefaultBinder , mainParms , null ) ;
39-
40- if ( method == null )
41- return ;
42-
43- Object [ ] parms = new Object [ 1 ] { args } ;
44- method . Invoke ( null , parms ) ;
45-
46- }
47-
48- }
49-
506 public partial class NETIPCPlayerApp : IPCPlayerApp
517 {
52-
8+ /// <summary>
9+ /// IPC Player App used with the Atomic Editor
10+ /// </summary>
11+ /// <param name="args"></param>
12+ /// <param name="headless"></param>
13+ /// <returns></returns>
5314 public static NETIPCPlayerApp Create ( string [ ] args , bool headless = false )
5415 {
5516 // Initialize AtomicNET
@@ -59,18 +20,8 @@ public static NETIPCPlayerApp Create(string[] args, bool headless = false)
5920
6021 app . Initialize ( ) ;
6122
62- // TODO: Refactor these registrations
63- AtomicNET . RegisterSubsystem ( "FileSystem" ) ;
64-
65- AtomicNET . RegisterSubsystem ( "Graphics" ) ;
66- AtomicNET . RegisterSubsystem ( "Player" ) ;
67-
68- AtomicNET . RegisterSubsystem ( "Input" ) ;
69- AtomicNET . RegisterSubsystem ( "Renderer" ) ;
70-
71- AtomicNET . RegisterSubsystem ( "ResourceCache" ) ;
72- AtomicNET . Cache = AtomicNET . GetSubsystem < ResourceCache > ( ) ;
73-
23+ RegisterSubsystems ( ) ;
24+
7425 ExecuteAtomicMain ( args ) ;
7526
7627 return app ;
0 commit comments