Пример #1
0
 /// <summary>
 /// 初始化默认管理器
 /// </summary>
 public void InitDefaultManagers()
 {
     _timerManager = new TimerManager();
     AddManager(_timerManager);
     _stageManager = new StageManager();
     AddManager(_stageManager);
     _pathManager = new PathManager();
     AddManager(_pathManager);
     _logManager = new LogManager();
     AddManager(_logManager);
     _langManager = new LangManager();
     AddManager(_langManager);
     _socketManager = new SocketManager();
     AddManager(_socketManager);
     _tableManager = new TableManager();
     AddManager(_tableManager);
     _objectPoolManager = new ObjectPoolManager();
     AddManager(_objectPoolManager);
     _fileManager = new FileManager();
     AddManager(_fileManager);
     _resourceManager = new ResourceManager();
     AddManager(_resourceManager);
     _assetManager = new AssetManager();
     AddManager(_assetManager);
     _audioManager = new AudioManager();
     AddManager(_audioManager);
     _sceneManager = new ScenesManager();
     AddManager(_sceneManager);
     _touchManager = new TouchManager();
     AddManager(_touchManager);
     _platformManager = new PlatformManager();
     AddManager(_platformManager);
 }
Пример #2
0
        public void loadModelData(String path)
        {
            IPlatformManager pm = Live2DFramework.getPlatformManager();


            if (debugMode)
            {
                pm.log("Load model : " + path);
            }

            live2DModel = pm.loadLive2DModel(path);
            live2DModel.saveParam();

            if (Live2D.getError() != Live2D.L2D_NO_ERROR)
            {
                pm.log("Error : Failed to loadModelData().");
                return;
            }

            var w = live2DModel.getCanvasWidth();
            var h = live2DModel.getCanvasHeight();

            modelMatrix = new L2DModelMatrix(w, h);

            if (w > h)
            {
                modelMatrix.setWidth(2);
            }
            else
            {
                modelMatrix.setHeight(2);
            }

            modelMatrix.setCenterPosition(0, 0);
        }
Пример #3
0
 public GameController(IGameManager gameManager, IGenreManager genreManager, IPlatformManager platformTypeManager, IPublisherManager publisherManager)
 {
     _gameManager      = gameManager;
     _genreManager     = genreManager;
     _platformManager  = platformTypeManager;
     _publisherManager = publisherManager;
 }
Пример #4
0
        public void loadExpression(String name, String path)
        {
            IPlatformManager pm = Live2DFramework.GetPlatformManager();
            if (debugMode) pm.log("Load Expression : " + path);

            expressions.Add(name, L2DExpressionMotion.loadJson(pm.loadBytes(path)));
        }
Пример #5
0
        public void loadTexture(int no, String path)
        {
            IPlatformManager pm = Live2DFramework.GetPlatformManager();
            if (debugMode) pm.log("Load Texture : " + path);

            pm.loadTexture(live2DModel, no, path);
        }
        public virtual MefCompositionContainerBuilder WithContainerBuilder(ILogManager logManager = null, IConfigurationManager configurationManager = null, IPlatformManager platformManager = null)
        {
            logManager = logManager ?? Mock.Create<ILogManager>();
            configurationManager = configurationManager ?? Mock.Create<IConfigurationManager>();
            platformManager = platformManager ?? Mock.Create<IPlatformManager>();

            return new MefCompositionContainerBuilder(logManager, configurationManager, platformManager);
        }
        public void Instantiate()
        {
            SetupMocks();

            PlatformManager.Terminate();

            Manager = PlatformManager.Instantiate(ApplicationManager.Object);
        }
Пример #8
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="platformDispatchManager"></param>
 /// <param name="platformManager"></param>
 /// <param name="documentStoreHolder"></param>
 public UserDataController(IPlatformDispatchManager platformDispatchManager, IPlatformManager platformManager,
                           IDocumentStore documentStoreHolder
                           )
 {
     _platformDispatchManager = platformDispatchManager;
     _platformManager         = platformManager;
     _documentStore           = documentStoreHolder;
 }
Пример #9
0
 public PlatformDataFetcherTriggerHandler(IPlatformManager platformManager, IDocumentStore documentStore,
                                          IBus bus, IMessageContext messageContext, ILogger <PlatformDataFetcherTriggerHandler> logger)
 {
     _platformManager = platformManager;
     _documentStore   = documentStore;
     _bus             = bus;
     _messageContext  = messageContext;
     _logger          = logger;
 }
Пример #10
0
        /// <summary>
        ///     Instantiates and/or returns the PluginManager instance.
        /// </summary>
        /// <remarks>
        ///     Invoked via reflection from ApplicationManager. The parameters are used to build an array of IManager parameters
        ///     which are then passed to this method. To specify additional dependencies simply insert them into the parameter list
        ///     for the method and they will be injected when the method is invoked.
        /// </remarks>
        /// <param name="manager">The ApplicationManager instance for the application.</param>
        /// <param name="platformManager">The PlatformManager instance for the application.</param>
        /// <param name="configurationManager">The ConfigurationManager instance for the application.</param>
        /// <returns>The Singleton instance of PluginManager.</returns>
        private static PluginManager Instantiate(IApplicationManager manager, IPlatformManager platformManager, IConfigurationManager configurationManager)
        {
            if (instance == null)
            {
                instance = new PluginManager(manager, platformManager, configurationManager);
            }

            return(instance);
        }
Пример #11
0
        /// <summary>
        ///     Instantiates and/or returns the PlatformManager instance.
        /// </summary>
        /// <remarks>
        ///     Invoked via reflection from ApplicationManager. The parameters are used to build an array of IManager parameters
        ///     which are then passed to this method. To specify additional dependencies simply insert them into the parameter list
        ///     for the method and they will be injected when the method is invoked.
        /// </remarks>
        /// <param name="manager">The ApplicationManager instance for the application.</param>
        /// <returns>The Singleton instance of PlatformManager.</returns>
        public static IPlatformManager Instantiate(IApplicationManager manager)
        {
            if (instance == null)
            {
                instance = new PlatformManager(manager);
            }

            return(instance);
        }
Пример #12
0
        /// <summary>
        ///     Instantiates and/or returns the ConfigurationManager instance.
        /// </summary>
        /// <remarks>
        ///     Invoked via reflection from ApplicationManager. The parameters are used to build an array of IManager parameters
        ///     which are then passed to this method. To specify additional dependencies simply insert them into the parameter list
        ///     for the method and they will be injected when the method is invoked.
        /// </remarks>
        /// <param name="manager">The ApplicationManager instance for the application.</param>
        /// <param name="platformManager">The PlatformManager instance for the application.</param>
        /// <returns>The Singleton instance of the ConfigurationManager.</returns>
        public static IConfigurationManager Instantiate(IApplicationManager manager, IPlatformManager platformManager)
        {
            if (instance == null)
            {
                instance = new ConfigurationManager(manager, platformManager);
            }

            return(instance);
        }
Пример #13
0
        public void loadPose(String path)
        {
            IPlatformManager pm = Live2DFramework.getPlatformManager();

            if (debugMode)
            {
                pm.log("Load Pose : " + path);
            }
            pose = L2DPose.load(pm.loadBytes(path));
        }
Пример #14
0
 public PlatformsController(
     [FromServices] IPlatformManager platformManager,
     [FromServices] IFileUploader imageUploader,
     [FromServices] UnitOfWorkManager unitOfWorkManager
     )
 {
     _platformManager   = platformManager;
     _fileUploader      = imageUploader;
     _unitOfWorkManager = unitOfWorkManager;
 }
Пример #15
0
        public void loadPhysics(String path)
        {
            IPlatformManager pm = Live2DFramework.getPlatformManager();

            if (debugMode)
            {
                pm.log("Load Physics : " + path);
            }
            physics = L2DPhysics.load(pm.loadBytes(path));
        }
 public PlatformController(IPlatformHttpClient platformHttpClient, IPlatformManager platformManager, IMapper mapper,
                           IDocumentStore documentStoreHolder,
                           ILogger <PlatformController> logger)
 {
     _platformHttpClient = platformHttpClient;
     _platformManager    = platformManager;
     _mapper             = mapper;
     _documentStore      = documentStoreHolder;
     _logger             = logger;
 }
Пример #17
0
 private SignalExecutor()
 {
     serverProxy = ProxyBuilder.Instance.MakeImplementer<IPlatformManager>(true);
     schedules = new[]
         {
             new Schedule(CheckStaleOrders, AppConfig.GetIntParam("StaleOrdersCheck.Interval", 1000*5)),
             new Schedule(ProcessTradeSignalsPending, AppConfig.GetIntParam("TradeSignalsProcessing.Interval", 1000)),
             new DailySchedule(passedValue => PortfolioBalancer.Instance.UpdatePortfolios(),
                 1000 * 10, null, 0, 0, 0, 1, "Обновление портфелей")
         };
 }
Пример #18
0
 public SearchController(
     [FromServices] IPlatformManager platformManager,
     [FromServices] IProjectManager projectManager,
     [FromServices] IIdeationManager ideationManager,
     [FromServices] IHostingEnvironment hostingEnvironment
     )
 {
     _platformManager = platformManager;
     _projectManager  = projectManager;
     _ideationManager = ideationManager;
 }
Пример #19
0
 public ConnectionManager(IDocumentStore documentStore,
                          IPlatformHttpClient httpClient,
                          IPlatformManager platformManager,
                          IConnectionUserManager connectionUserManager)
 {
     _documentStore         = documentStore;
     _platformManager       = platformManager;
     _httpClient            = httpClient;
     _platformManager       = platformManager;
     _connectionUserManager = connectionUserManager;
 }
Пример #20
0
 public PlatformController(
     [FromServices] IPlatformManager platformManager,
     [FromServices] IActivityManager activityManager,
     UserManager <User> userManager,
     IHttpContextAccessor httpContextAccessor
     )
 {
     _platformManager = platformManager;
     _activityManager = activityManager;
     _userManager     = userManager;
     _subdomain       = GetSubdomain(httpContextAccessor.HttpContext.Request.Host.ToString());
 }
Пример #21
0
 public PlatformRequestController(
     IPlatformRequestManager platformRequestManager,
     UserManager <User> userManager,
     [FromServices] UnitOfWorkManager unitOfWorkManager,
     [FromServices] IFileUploader imageUploader,
     [FromServices] IPlatformManager platformManager)
 {
     _platformRequestManager = platformRequestManager;
     _userManager            = userManager;
     _unitOfWorkManager      = unitOfWorkManager;
     _fileUploader           = imageUploader;
     _platformManager        = platformManager;
 }
Пример #22
0
        static void Main(string[] args)
        {
            elementManager   = new ElementManager();
            postManager      = new PostManager();
            dashboardManager = new DashboardManager();
            platformManager  = new PlatformManager();
            Console.WriteLine("Politieke Barometer");
            bool afsluiten = false;

            while (!afsluiten)
            {
                showMenu();
            }
        }
Пример #23
0
 public ProjectController(
     UserManager <User> userManager,
     [FromServices] IProjectManager projectManager,
     [FromServices] IPlatformManager platformManager,
     [FromServices] IFileUploader fileUploader,
     [FromServices] UnitOfWorkManager unitOfWorkManager
     )
 {
     _userManager       = userManager;
     _projectManager    = projectManager;
     _platformManager   = platformManager;
     _fileUploader      = fileUploader;
     _unitOfWorkManager = unitOfWorkManager;
 }
 public PlatformUserController(IDocumentStore documentStore, IHttpContextAccessor httpContextAccessor,
                               IPlatformConnectionManager platformConnectionManager, IAppNotificationManager appNotificationManager,
                               IPlatformManager platformManager, IUserManager userManager, IAppManager appManager, IBus bus,
                               IOptions <EmailVerificationConfiguration> emailVerificationOptions)
 {
     _documentStore             = documentStore;
     _httpContextAccessor       = httpContextAccessor;
     _platformConnectionManager = platformConnectionManager;
     _appNotificationManager    = appNotificationManager;
     _platformManager           = platformManager;
     _userManager = userManager;
     _appManager  = appManager;
     _bus         = bus;
     _emailVerificationConfiguration = emailVerificationOptions.Value;
 }
Пример #25
0
        void Start()
        {
            var updateManagerObject = new GameObject("UpdateManager");

            _updateManager = updateManagerObject.AddComponent <UpdateManager>();

            _objectStorage = new ObjectStorage(Constants.platformCount);
            _objectStorage.Initialization(Constants.playerPrefabName, Constants.platformPrefabName);
            _controlManager = new ControlManager(_updateManager, _objectStorage);

            _platformManager = new PlatformManager(_updateManager, _objectStorage);

            _UIManager = new UIManager(_updateManager, _controlManager, _platformManager, _objectStorage);
            _UIManager.ShowMainMenu();
        }
Пример #26
0
        public void InstantiateTwice()
        {
            ApplicationManager = new Mock <IApplicationManager>();
            ApplicationManager.Setup(a => a.State).Returns(State.Running);
            ApplicationManager.Setup(a => a.IsInState(State.Starting, State.Running)).Returns(true);
            ApplicationManager.Setup(a => a.Settings).Returns(new Core.ApplicationSettings());

            PlatformManager.Terminate();

            Manager = PlatformManager.Instantiate(ApplicationManager.Object);

            IPlatformManager manager2 = PlatformManager.Instantiate(ApplicationManager.Object);

            Assert.Equal(Manager, manager2);
        }
Пример #27
0
 public VoteController(
     IIoTManager ioTManager,
     IIdeationManager ideationManager,
     IFormManager formManager,
     IPlatformManager platformManager,
     IActivityManager activityManager,
     UnitOfWorkManager unitOfWorkManager
     )
 {
     _ioTManager        = ioTManager;
     _ideationManager   = ideationManager;
     _formManager       = formManager;
     _platformManager   = platformManager;
     _activityManager   = activityManager;
     _unitOfWorkManager = unitOfWorkManager;
 }
Пример #28
0
 private PlatformManager(IPlatformManager proxyOrStub = null)
 {
     if (proxyOrStub != null)
     {
         proxy = proxyOrStub;
         return;
     }
     try
     {
         proxy = ProxyBuilder.Instance.GetImplementer<IPlatformManager>();
     }
     catch (Exception ex)
     {
         Logger.Error("PlatformManager ctor", ex);
     }
 }
Пример #29
0
 private PlatformManager(IPlatformManager proxyOrStub = null)
 {
     if (proxyOrStub != null)
     {
         proxy = proxyOrStub;
         return;
     }
     try
     {
         proxy = ProxyBuilder.Instance.GetImplementer <IPlatformManager>();
     }
     catch (Exception ex)
     {
         Logger.Error("PlatformManager ctor", ex);
     }
 }
Пример #30
0
        public AMotion loadMotion(String name, String path)
        {
            IPlatformManager pm = Live2DFramework.GetPlatformManager();
            if (debugMode) pm.log("Load Motion : " + path);

            Live2DMotion motion = null;

            byte[] buf = pm.loadBytes(path);
            motion = Live2DMotion.loadMotion(buf);

            if (name != null)
            {
                motions.Add(name, motion);
            }

            return motion;
        }
Пример #31
0
        // GET
        public IActionResult Dashboard(
            [FromServices] IPlatformManager platformManager,
            [FromServices] IProjectManager projectManager,
            [FromServices] IIdeationManager ideationManager,
            [FromServices] UserManager <User> userManager
            )
        {
            ViewBag.TotalPlatforms = platformManager.GetPlatforms().Count();
            ViewBag.TotalProjects  = projectManager.GetProjects().Count();
            ViewBag.TotalIdeations = ideationManager.GetIdeations().Count();

            ViewBag.TotalVotes         = ideationManager.GetTotalVoteCount();
            ViewBag.TotalUsers         = userManager.Users.Count();
            ViewBag.TotalOrganisations = userManager.GetUsersForClaimAsync(new Claim("Organisation", "Organisation")).Result.Count;

            return(View());
        }
Пример #32
0
        public HydrantWikiApp(
            IPlatformManager _platformManager)
        {
            m_PlatformManager = _platformManager;

            DataFolder  = m_PlatformManager.DataFolder;
            ImageFolder = m_PlatformManager.ImageFolder;

            HWManager manager = HWManager.GetInstance();

            manager.PlatformManager = m_PlatformManager;

            User = manager.SettingManager.GetUser();

            // The root page of your application
            MainPage = new MainForm(this);
        }
Пример #33
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="PluginManager"/> class.
        /// </summary>
        /// <param name="manager">The ApplicationManager instance for the application.</param>
        /// <param name="platformManager">The PlatformManager instance for the application.</param>
        /// <param name="configurationManager">The ConfigurationManager instance for the application.</param>
        private PluginManager(IApplicationManager manager, IPlatformManager platformManager, IConfigurationManager configurationManager)
        {
            base.logger = logger;
            logger.EnterMethod();

            ManagerName = "Plugin Manager";

            RegisterDependency <IApplicationManager>(manager);
            RegisterDependency <IPlatformManager>(platformManager);
            RegisterDependency <IConfigurationManager>(configurationManager);

            PluginAssemblies = new List <IPluginAssembly>();
            PluginInstances  = new List <IPluginInstance>();

            ChangeState(State.Initialized);

            logger.ExitMethod();
        }
        /// <summary>
        /// Sets the platform manager to the ambient services.
        /// </summary>
        /// <param name="platformManager">The platform manager.</param>
        /// <returns>
        /// The ambient services builder.
        /// </returns>
        public AmbientServicesBuilder WithPlatformManager(IPlatformManager platformManager)
        {
            Contract.Requires(platformManager != null);

            this.AmbientServices.PlatformManager = platformManager;

            return this;
        }
Пример #35
0
 public static void setPlatformManager(IPlatformManager platformManager)
 {
     Live2DFramework.platformManager = platformManager;
 }
Пример #36
0
		/// <summary>
		///     Internal constructor.  This class cannot be instantiated externally.
		/// </summary>
		internal PlatformManager()
		{
			// First look in current Executing assembly for a PlatformManager
			if ( instance == null )
			{
				DynamicLoader platformMgr = new DynamicLoader();
				IList<ObjectCreator> platforms = platformMgr.Find( typeof( IPlatformManager ) );
				if ( platforms.Count != 0 )
				{
					instance = platformMgr.Find( typeof( IPlatformManager ) )[ 0 ].CreateInstance<IPlatformManager>();
				}
			}

#if !( XBOX || XBOX360 )
			// Then look in loaded assemblies
			if ( instance == null )
			{
				Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
				for ( int index = 0; index < assemblies.Length && instance == null; index++ )
				{
					//TODO: NRSC Added: Deal with Dynamic Assemblies not having a Location
                    //if (assemblies[index].IsDynamic)
                    //    continue;
					try {
					DynamicLoader platformMgr = new DynamicLoader( assemblies[ index ].Location );
					IList<ObjectCreator> platforms = platformMgr.Find( typeof( IPlatformManager ) );
					if ( platforms.Count != 0 )
					{
						instance = platformMgr.Find( typeof( IPlatformManager ) )[ 0 ].CreateInstance<IPlatformManager>();
					}
					} catch (Exception)
					{
					    System.Diagnostics.Debug.WriteLine( String.Format( "Failed to load assembly: {0}.", assemblies[index].FullName ) );	
					}
				}
			}
#endif

			// Then look in external assemblies
			if ( instance == null )
			{
				// find and load a platform manager assembly
				string[] files = Directory.GetFiles( ".", "Axiom.Platforms.*.dll" );
				string file = "";

				// make sure there is 1 platform manager available
				if ( files.Length == 0 )
				{
					throw new PluginException( "A PlatformManager was not found in the execution path, and is required." );
				}
				else
				{
					bool isWindows = IsWindowsOS;
					string platform = IsWindowsOS ? "Win32" : "OpenTK";

					if ( files.Length == 1 )
					{
						file = files[ 0 ];
					}
					else
					{
						for ( int i = 0; i < files.Length; i++ )
						{
							if ( ( files[ i ].IndexOf( platform ) != -1 ) == true )
							{
								file = files[ i ];
							}
						}
					}

					System.Diagnostics.Debug.WriteLine( String.Format( "Selected the PlatformManager contained in {0}.", file ) );
				}

				string path = Path.Combine( System.IO.Directory.GetCurrentDirectory(), file );

				DynamicLoader platformMgr = new DynamicLoader( path );
				IList<ObjectCreator> platforms = platformMgr.Find( typeof( IPlatformManager ) );
				if ( platforms.Count != 0 )
				{
					instance = platformMgr.Find( typeof( IPlatformManager ) )[ 0 ].CreateInstance<IPlatformManager>();
				}

			}

			// All else fails, yell loudly
			if ( instance == null )
				throw new PluginException( "The available Platform assembly did not contain any subclasses of PlatformManager, which is required." );
		}
Пример #37
0
        public DownloadManager(IPlatformManager platformManager, IJobManager jobManager, IVpdbClient vpdbClient, 
			ISettingsManager settingsManager, IMessageManager messageManager, IDatabaseManager databaseManager,
			ILogger logger, CrashManager crashManager)
        {
            _platformManager = platformManager;
            _jobManager = jobManager;
            _vpdbClient = vpdbClient;
            _settingsManager = settingsManager;
            _messageManager = messageManager;
            _databaseManager = databaseManager;
            _logger = logger;
            _crashManager = crashManager;

            // setup download callbacks
            jobManager.WhenDownloaded.Subscribe(OnDownloadCompleted);

            // setup flavor matchers as soon as settings are available.
            _settingsManager.Settings.WhenAny(
                s => s.DownloadOrientation,
                s => s.DownloadOrientationFallback,
                s => s.DownloadLighting,
                s => s.DownloadLightingFallback,
                (a, b, c, d) => Unit.Default).Subscribe(_ =>
            {
                _logger.Info("Setting up flavor matchers.");
                _flavorMatchers.Clear();
                _flavorMatchers.Add(new OrientationMatcher(_settingsManager.Settings));
                _flavorMatchers.Add(new LightingMatcher(_settingsManager.Settings));
            });
        }
Пример #38
0
		/// <summary>
		///     Internal constructor.  This class cannot be instantiated externally.
		/// </summary>
		internal PlatformManager()
		{
			// First look in current Executing assembly for a PlatformManager
			if ( instance == null )
			{
				var platformMgr = new DynamicLoader();
				var platforms = platformMgr.Find( typeof ( IPlatformManager ) );
				if ( platforms.Count != 0 )
				{
					instance = platformMgr.Find( typeof ( IPlatformManager ) )[ 0 ].CreateInstance<IPlatformManager>();
				}
			}

#if NET_40 && !( XBOX || XBOX360 || WINDOWS_PHONE )
			if (instance == null)
			{
				this.SatisfyImports(".");
				if (platforms != null && platforms.Count() != 0)
				{
					instance = platforms.First();
					System.Diagnostics.Debug.WriteLine(String.Format("MEF IPlatformManager: {0}.", instance));
				}
			}
#endif

#if !( SILVERLIGHT || WINDOWS_PHONE || XBOX || XBOX360 || NETFX_CORE)
			// Then look in loaded assemblies
			if ( instance == null )
			{
				var assemblies = AppDomain.CurrentDomain.GetAssemblies();
				for ( var index = 0; index < assemblies.Length && instance == null; index++ )
				{
					//TODO: NRSC Added: Deal with Dynamic Assemblies not having a Location
					//if (assemblies[index].IsDynamic)
					//    continue;
					try
					{
						var platformMgr = new DynamicLoader( assemblies[ index ] );
						var platforms = platformMgr.Find( typeof ( IPlatformManager ) );
						if ( platforms.Count != 0 )
						{
							instance = platformMgr.Find( typeof ( IPlatformManager ) )[ 0 ].CreateInstance<IPlatformManager>();
						}
					}
					catch ( Exception )
					{
						System.Diagnostics.Debug.WriteLine( String.Format( "Failed to load assembly: {0}.", assemblies[ index ].FullName ) );
					}
				}
			}

			// Then look in external assemblies
			if ( instance == null )
			{
				// find and load a platform manager assembly
				var cwd = Assembly.GetExecutingAssembly().CodeBase;
				var uri = new Uri( cwd );
				if ( uri.IsFile )
					cwd = Path.GetDirectoryName(uri.LocalPath);
				var files = Directory.GetFiles( cwd, "Axiom.Platforms.*.dll" ).ToArray();
				var file = "";

				// make sure there is 1 platform manager available
				if ( files.Length == 0 )
				{
					throw new PluginException( "A PlatformManager was not found in the execution path, and is required." );
				}
				else
				{
					var isWindows = IsWindowsOS;
					var platform = IsWindowsOS ? "Windows" : "Linux";

					if ( files.Length == 1 )
					{
						file = files[ 0 ];
					}
					else
					{
						for ( var i = 0; i < files.Length; i++ )
						{
							if ( ( files[ i ].IndexOf( platform ) != -1 ) == true )
							{
								file = files[ i ];
							}
						}
					}

					System.Diagnostics.Debug.WriteLine( String.Format( "Selected the PlatformManager contained in {0}.", file ) );
				}

				var path = Path.Combine( System.IO.Directory.GetCurrentDirectory(), file );

				var platformMgr = new DynamicLoader( path );
				var platforms = platformMgr.Find( typeof ( IPlatformManager ) );
				if ( platforms.Count != 0 )
				{
					instance = platformMgr.Find( typeof ( IPlatformManager ) )[ 0 ].CreateInstance<IPlatformManager>();
				}
			}
#endif

			// All else fails, yell loudly
			if ( instance == null )
			{
				throw new PluginException( "The available Platform assembly did not contain any subclasses of PlatformManager, which is required." );
			}
		}
Пример #39
0
 public static void Initialize(IPlatformManager proxyOrStub)
 {
     instance = new PlatformManager(proxyOrStub);
 }
Пример #40
0
        public GamesViewModel(IDependencyResolver resolver)
        {
            _platformManager = resolver.GetService<IPlatformManager>();
            var gameManager = resolver.GetService<IGameManager>();

            // setup init listener
            gameManager.Initialized.Subscribe(_ => SetupTracking());

            // create platforms, filtered and sorted
            Platforms = _platformManager.Platforms.CreateDerivedCollection(
                platform => platform,
                platform => platform.IsEnabled,
                (x, y) => string.Compare(x.Name, y.Name, StringComparison.Ordinal)
            );

            // push all games into AllGames as view models and sorted
            _allGames = gameManager.Games.CreateDerivedCollection(
                game => new GameItemViewModel(game, resolver) { IsVisible = IsGameVisible(game) },
                gameViewModel => true,
                (x, y) => string.Compare(x.Game.Id, y.Game.Id, StringComparison.Ordinal)
            );

            // push filtered game view models into Games
            Games = _allGames.CreateDerivedCollection(
                gameViewModel => gameViewModel,
                gameViewModel => gameViewModel.IsVisible);

            // todo check if we can simplify this.
            IdentifyAll.Subscribe(_ => {

                /*
                Games
                    .ToObservable()
                    .Where(g => g.ShowIdentifyButton)
                    .StepInterval(TimeSpan.FromMilliseconds(200)) // don't DOS the server...
                    .Select(g => Observable.DeferAsync(async token =>
                        Observable.Return(await System.Windows.Application.Current. // must be on main thread
                            Dispatcher.Invoke(async () => new { game = g, result = await g.IdentifyRelease.ExecuteAsyncTask() }))))
                    .Merge(1)
                    .Subscribe(x => {
                        if (x.result.Count == 0) {
                            System.Windows.Application.Current.Dispatcher.Invoke(delegate {
                                x.game.CloseResults.Execute(null);
                            });
                        }
                    });*/

                Games
                    .ToObservable()
                    .Where(g => !g.HasExecuted && !g.Game.HasRelease && !g.IsExecuting)
                    .StepInterval(TimeSpan.FromMilliseconds(200)) // don't DOS the server...
                    .Subscribe(g => {
                        System.Windows.Application.Current.Dispatcher.Invoke(async () => {
                            var result = await g.IdentifyRelease.ExecuteAsyncTask();
                            if (result.Count == 0) {
                                g.CloseResults.Execute(null);
                            }
                        });
                    });
            });
        }
Пример #41
0
        public GameManager(IMenuManager menuManager, IVpdbClient vpdbClient, ISettingsManager 
			settingsManager, IDownloadManager downloadManager, IDatabaseManager databaseManager,
			IVersionManager versionManager, IPlatformManager platformManager, IMessageManager messageManager,
			IRealtimeManager realtimeManager, IVisualPinballManager visualPinballManager, IThreadManager threadManager, ILogger logger)
        {
            _menuManager = menuManager;
            _vpdbClient = vpdbClient;
            _settingsManager = settingsManager;
            _downloadManager = downloadManager;
            _databaseManager = databaseManager;
            _versionManager = versionManager;
            _platformManager = platformManager;
            _messageManager = messageManager;
            _realtimeManager = realtimeManager;
            _visualPinballManager = visualPinballManager;
            _threadManager = threadManager;
            _logger = logger;

            // setup game change listener once all games are fetched.
            _menuManager.Initialized.Subscribe(_ => SetupGameChanges());

            // update releases from VPDB on the first run, but delay it a bit so it
            // doesn't do all that shit at the same time!
            _settingsManager.ApiAuthenticated
                .Where(user => user != null)
                .Take(1)
                .Delay(TimeSpan.FromSeconds(2))
                .Subscribe(_ => UpdateReleaseData());

            // subscribe to downloaded releases
            _downloadManager.WhenReleaseDownloaded.Subscribe(OnReleaseDownloaded);

            // link games if new games are added
            Games.Changed.Subscribe(_ => CheckGameLinks());

            // setup handlers for table file changes
            _menuManager.TableFileChanged.Subscribe(OnTableFileChanged);
            _menuManager.TableFileRemoved.Subscribe(OnTableFileRemoved);

            // when game is linked or unlinked, update profile with channel info
            IDisposable gameLinked = null;
            Games.Changed.Subscribe(_ => {
                gameLinked?.Dispose();
                gameLinked = Games
                    .Select(g => g.Changed.Where(x => x.PropertyName == "ReleaseId"))
                    .Merge()
                    .Subscribe(__ => UpdateChannelConfig());
            });

            // setup pusher messages
            SetupRealtime();
        }
        internal static void LoadInstance()
        {
            if (instance == null)
            {
                Assembly platformManagerAssembly = GetPlatformManagerAssembly();

                // look for the type in the loaded assembly that implements IPlatformManager
                foreach (Type type in platformManagerAssembly.GetTypes())
                {
                    if (type.GetInterface("IPlatformManager") != null)
                    {
                        instance = (IPlatformManager)platformManagerAssembly.CreateInstance(type.FullName);
                        return;
                    }
                }

                throw new PluginException( String.Format(
                    "The PlatformManager assembly '{0}' does not implement the required 'IPlatformManager' interface",
                    platformManagerAssembly.FullName ) );
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ModelAssemblyRegistry"/> class.
        /// </summary>
        /// <param name="platformManager">The platform manager.</param>
        public ModelAssemblyRegistry(IPlatformManager platformManager)
        {
            Contract.Requires(platformManager != null);

            this.platformManager = platformManager;
        }