public static void Initialize()
        {
            ContainerModule.Initialize();
            CoreModule.Initialize();
            MathModule.Initialize();
            EngineModule.Initialize();
            InputModule.Initialize();
            IOModule.Initialize();
            ResourceModule.Initialize();
            AudioModule.Initialize();
            GraphicsModule.Initialize();
            SceneModule.Initialize();
            Atomic2DModule.Initialize();
            Atomic3DModule.Initialize();
            NavigationModule.Initialize();
            NetworkModule.Initialize();
            PhysicsModule.Initialize();
            EnvironmentModule.Initialize();
            UIModule.Initialize();

            AtomicPlayer.PlayerModule.Initialize();

            AtomicInterop.Initialize();

            atomicsharp_initialize();

            initSubsystems();
        }
示例#2
0
        /// <summary>
        /// Initializes the module.
        /// </summary>
        public static void Initialize()
        {
#if NET
            try
            {
                bool isWebContext = false;

                var httpContextType = TypeCache.GetTypeWithoutAssembly("System.Web.HttpContext");
                if (httpContextType != null)
                {
                    var currentPropertyInfo = httpContextType.GetProperty("Current", BindingFlags.Public | BindingFlags.Static);
                    if (currentPropertyInfo != null)
                    {
                        isWebContext = (currentPropertyInfo.GetValue(null, null) != null);
                    }
                }

                Configuration config = null;
                if (isWebContext)
                {
                    Log.Debug("Application is living in a web context, loading web configuration");

                    // All via reflection because we are support .NET 4.0 client profile, reflection equals this call:
                    //   config = Configuration.WebConfigurationManager.OpenWebConfiguration("~");
                    var webConfigurationManagerType    = TypeCache.GetTypeWithoutAssembly("System.Web.Configuration.WebConfigurationManager");
                    var openWebConfigurationMethodInfo = webConfigurationManagerType.GetMethodEx("OpenWebConfiguration", new [] { typeof(string) }, allowStaticMembers: true);
                    config = (Configuration)openWebConfigurationMethodInfo.Invoke(null, new [] { "~" });
                }
                else
                {
                    Log.Debug("Application is living in an application context, loading application configuration");

                    config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
                }

                if (config != null)
                {
                    var configurationSection = config.GetSection <LoggingConfigurationSection>("logging", "catel");
                    if (configurationSection != null)
                    {
                        var logListeners = configurationSection.GetLogListeners();
                        foreach (var logListener in logListeners)
                        {
                            LogManager.AddListener(logListener);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Log.Error(ex, "Failed to load log listeners from the configuration file");
            }
#endif

            var serviceLocator = ServiceLocator.Default;
            var module         = new CoreModule();
            module.Initialize(serviceLocator);
        }
示例#3
0
        public static void Initialize()
        {
            // Atomic Modules
            CoreModule.Initialize();
            MathModule.Initialize();
            EngineModule.Initialize();
            InputModule.Initialize();
            IOModule.Initialize();
            ResourceModule.Initialize();
            AudioModule.Initialize();
            GraphicsModule.Initialize();
            SceneModule.Initialize();
            Atomic2DModule.Initialize();
            NavigationModule.Initialize();
            NetworkModule.Initialize();
            PhysicsModule.Initialize();
            EnvironmentModule.Initialize();
            UIModule.Initialize();

#if ATOMIC_DESKTOP
            IPCModule.Initialize();
#endif

            AtomicAppModule.Initialize();
            ScriptModule.Initialize();

            AtomicNETScriptModule.Initialize();
            AtomicNETNativeModule.Initialize();

            PlayerModule.Initialize();

            coreDelegates = new CoreDelegates();
            coreDelegates.eventDispatch  = NativeCore.EventDispatch;
            coreDelegates.updateDispatch = NativeCore.UpdateDispatch;

            IntPtr coreptr = csi_Atomic_NETCore_Initialize(ref coreDelegates);

            NETCore core = (coreptr == IntPtr.Zero ? null : NativeCore.WrapNative <NETCore>(coreptr));

            if (core != null)
            {
                AtomicNET.RegisterSubsystem("NETCore", core);
            }

            context = core.Context;

            NativeCore.Initialize();
            CSComponentCore.Initialize();

#if ATOMIC_DESKTOP
            string[] arguments = Environment.GetCommandLineArgs();
            foreach (string arg in arguments)
            {
                AppBase.AddArgument(arg);
            }
#endif
        }
示例#4
0
        public void CoreModule()
        {
            var container = new DryIoc.Container();

            var module = new CoreModule(container);

            module.Initialize();

            container.Dispose();
        }
        protected void Application_Start()
        {
            GlobalConfiguration.Configure(WebApiConfig.Register);

            RepositoryModule.Initialize();
            CoreModule.Initialize();
            Net.Framework.Entity.IocInstaller.Init();
            //Net.General.Dependency.MVC.WindsorControllerFactory.Register(Assembly.GetExecutingAssembly());

            GlobalConfiguration.Configuration.Formatters.XmlFormatter.SupportedMediaTypes.Clear();
        }
示例#6
0
        /// <summary>
        /// TODO: Добавить DI.
        /// </summary>
        static void Main(string[] args)
        {
            IConnectionStateManager connectionStateManager = new ConnectionStateManager();
            IFileManager            fileManager            = new FileManager(new FileSystemService());
            var apiController   = new ApiController();
            var settingsManager = new SettingsManager();

            ISyncTableDataBase syncDb = new SyncTableDataBase();
            IUserTableDataBase userDb = new UserTableDataBase();
            var telegramService       = new TelegramService(settingsManager.Settings.Token, settingsManager.Settings.Telegram_id);

            telegramService.Configure("/clean_folders", "clean empty folders", () =>
            {
                var ls          = userDb.GetAvailableFolders();
                var removedList = fileManager.RemoveEmptyDirectories(ls);
                var sb          = new StringBuilder();
                sb.AppendLine("Removed dictionaries:");
                sb.AppendJoin(Environment.NewLine, removedList);
                SendToTelegram(sb.ToString());
            });

            var syncModule = new CoreModule(fileManager, syncDb, connectionStateManager, userDb);

            syncModule.Initialize(apiController);
            syncModule.SendMessage += (o, s) => SendToTelegram(s);

            var attachModule = new FilesApi(new FilesService(connectionStateManager, syncDb), connectionStateManager);

            attachModule.Initialize(apiController);
            attachModule.SendMessage += (o, s) => SendToTelegram(s);

            var configModule = new ConfigurationModule(userDb, syncDb);

            configModule.Initialize(apiController);
            configModule.SendMessage += (o, s) => SendToTelegram(s);

            var ws = new WsService(connectionStateManager, apiController, IPAddress.Parse(settingsManager.Settings.IpAddress), settingsManager.Settings.HttpPort, settingsManager.Settings.HttpsPort);

            ws.Start();

            void SendToTelegram(string message)
            {
                telegramService.SendTextMessageAsync(message);
            }

            // TODO: Добавить CancellationToken
            Console.ReadKey(true);

            ws.Stop();
        }
示例#7
0
        public static void Initialize()
        {
            // Atomic Modules
            CoreModule.Initialize();
            MathModule.Initialize();
            EngineModule.Initialize();
            InputModule.Initialize();
            IOModule.Initialize();
            ResourceModule.Initialize();
            AudioModule.Initialize();
            GraphicsModule.Initialize();
            SceneModule.Initialize();
            Atomic2DModule.Initialize();
            Atomic3DModule.Initialize();
            NavigationModule.Initialize();
            NetworkModule.Initialize();
            PhysicsModule.Initialize();
            EnvironmentModule.Initialize();
            UIModule.Initialize();
            IPCModule.Initialize();
            AtomicAppModule.Initialize();
            ScriptModule.Initialize();

            AtomicNETScriptModule.Initialize();
            AtomicNETNativeModule.Initialize();

            PlayerModule.Initialize();

            coreDelegates = new CoreDelegates();
            coreDelegates.eventDispatch  = NativeCore.EventDispatch;
            coreDelegates.updateDispatch = NativeCore.UpdateDispatch;

            IntPtr coreptr = csb_Atomic_NETCore_Initialize(ref coreDelegates);

            NETCore core = (coreptr == IntPtr.Zero ? null : NativeCore.WrapNative <NETCore>(coreptr));

            if (core != null)
            {
                AtomicNET.RegisterSubsystem("NETCore", core);
            }

            context = core.Context;

            NativeCore.Initialize();
            CSComponentCore.Initialize();
        }
示例#8
0
        /// <summary>
        /// Initializes the module.
        /// </summary>
        public static void Initialize()
        {
#if NET
            try
            {
                var configurations = new List <Configuration>();

                var exeConfig = GetExeConfiguration();
                if (exeConfig != null)
                {
                    configurations.Add(exeConfig);
                }

                var dllConfig = GetDllConfiguration();
                if (dllConfig != null)
                {
                    configurations.Add(dllConfig);
                }

                var configFilesHandled = new List <string>();
                foreach (var configuration in configurations)
                {
                    var configPath = configuration.FilePath.ToLower();
                    if (configFilesHandled.Contains(configPath))
                    {
                        continue;
                    }

                    configFilesHandled.Add(configPath);

                    LogManager.LoadListenersFromConfiguration(configuration);
                }
            }
            catch (Exception ex)
            {
                Log.Error(ex, "Failed to load log listeners from the configuration file");
            }
#endif

            var serviceLocator = ServiceLocator.Default;
            var module         = new CoreModule();
            module.Initialize(serviceLocator);
        }
示例#9
0
        /// <summary>
        /// Initializes the module.
        /// </summary>
        public static void Initialize()
        {
#if NET
            try
            {
                var configurations = new List<Configuration>();

                var exeConfig = GetExeConfiguration();
                if (exeConfig != null)
                {
                    configurations.Add(exeConfig);
                }

                var dllConfig = GetDllConfiguration();
                if (dllConfig != null)
                {
                    configurations.Add(dllConfig);
                }

                var configFilesHandled = new List<string>();
                foreach (var configuration in configurations)
                {
                    var configPath = configuration.FilePath.ToLower();
                    if (configFilesHandled.Contains(configPath))
                    {
                        continue;
                    }

                    configFilesHandled.Add(configPath);

                    LogManager.LoadListenersFromConfiguration(configuration);
                }
            }
            catch (Exception ex)
            {
                Log.Error(ex, "Failed to load log listeners from the configuration file");
            }
#endif

            var serviceLocator = ServiceLocator.Default;
            var module = new CoreModule();
            module.Initialize(serviceLocator);
        }
示例#10
0
 static public void Initialize()
 {
     ContainerModule.Initialize();
     CoreModule.Initialize();
     MathModule.Initialize();
     EngineModule.Initialize();
     InputModule.Initialize();
     IOModule.Initialize();
     ResourceModule.Initialize();
     AudioModule.Initialize();
     GraphicsModule.Initialize();
     SceneModule.Initialize();
     Atomic2DModule.Initialize();
     Atomic3DModule.Initialize();
     NavigationModule.Initialize();
     NetworkModule.Initialize();
     PhysicsModule.Initialize();
     EnvironmentModule.Initialize();
     UIModule.Initialize();
     NETCoreModule.Initialize();
     NETScriptModule.Initialize();
     AtomicPlayer.PlayerModule.Initialize();
 }
示例#11
0
        public void Setup(string className)
        {
            Core.Core.UseDispatcher = false;

            LogManager.AddDebugListener(false);
            var module2 = new CoreModule();

            module2.Initialize(_serviceLocator);
            var module = new MVVMModule();

            module.Initialize(_serviceLocator);
            RegisterOrchestraTypes();

            ApplicationDatabaseContext.DefaultDatabasePath = Path.Combine(Directory.GetCurrentDirectory(),
                                                                          $@"TestData\{className}\LegacyDatabases\LegacyDb.sqlite3");
            DataPersisterService.DefaultDataStoragePath =
                Path.Combine(Directory.GetCurrentDirectory(), $@"TestData\");

            PresetDataPersisterService.DefaultDatabaseFile = Path.Combine(Directory.GetCurrentDirectory(),
                                                                          $@"TestData\{className}\PresetData.sqlite3");

            Directory.CreateDirectory(DataPersisterService.DefaultPluginStoragePath);
            Directory.CreateDirectory(Path.GetDirectoryName(ApplicationDatabaseContext.DefaultDatabasePath));
            Directory.CreateDirectory(Path.GetDirectoryName(PresetDataPersisterService.DefaultDatabaseFile));


            File.Delete(ApplicationDatabaseContext.DefaultDatabasePath);
            File.Copy(@"Resources\PresetMagician.test.sqlite3", ApplicationDatabaseContext.DefaultDatabasePath);

            FrontendInitializer.RegisterTypes(_serviceLocator);
            FrontendInitializer.Initialize(_serviceLocator);

            var frontendService = _serviceLocator.ResolveType <FrontendService>();

            frontendService.InitializeCommands();
        }
示例#12
0
        /// <summary>
        /// Initializes the module.
        /// </summary>
        public static void Initialize()
        {
#if NET
            try
            {
                bool isWebContext = false;

                var httpContextType = TypeCache.GetTypeWithoutAssembly("System.Web.HttpContext");
                if (httpContextType != null)
                {
                    var currentPropertyInfo = httpContextType.GetProperty("Current", BindingFlags.Public | BindingFlags.Static);
                    if (currentPropertyInfo != null)
                    {
                        isWebContext = (currentPropertyInfo.GetValue(null, null) != null);
                    }
                }

                Configuration config = null;
                if (isWebContext)
                {
                    Log.Debug("Application is living in a web context, loading web configuration");

                    // All via reflection because we are support .NET 4.0 client profile, reflection equals this call:
                    //   config = Configuration.WebConfigurationManager.OpenWebConfiguration("~");
                    var webConfigurationManagerType = TypeCache.GetTypeWithoutAssembly("System.Web.Configuration.WebConfigurationManager");
                    var openWebConfigurationMethodInfo = webConfigurationManagerType.GetMethodEx("OpenWebConfiguration", new [] { typeof(string) }, allowStaticMembers: true);
                    config = (Configuration) openWebConfigurationMethodInfo.Invoke(null, new []{ "~" });
                }
                else
                {
                    Log.Debug("Application is living in an application context, loading application configuration");

                    config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
                }

                if (config != null)
                {
                    var configurationSection = config.GetSection<LoggingConfigurationSection>("logging", "catel");
                    if (configurationSection != null)
                    {
                        var logListeners = configurationSection.GetLogListeners();
                        foreach (var logListener in logListeners)
                        {
                            LogManager.AddListener(logListener);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Log.Error(ex, "Failed to load log listeners from the configuration file");
            }
#endif

            var serviceLocator = ServiceLocator.Default;
            var module = new CoreModule();
            module.Initialize(serviceLocator);
        }