Exemplo n.º 1
0
		/// <summary>
		/// Initializes the singleton intances of the mod manager.
		/// </summary>
		/// <param name="p_gmdGameMode">The current game mode.</param>
		/// <param name="p_eifEnvironmentInfo">The application's envrionment info.</param>
		/// <param name="p_mrpModRepository">The mod repository from which to get mods and mod metadata.</param>
		/// <param name="p_dmrMonitor">The download monitor to use to track task progress.</param>
		/// <param name="p_frgFormatRegistry">The <see cref="IModFormatRegistry"/> that contains the list
		/// of supported <see cref="IModFormat"/>s.</param>
		/// <param name="p_mrgModRegistry">The <see cref="ModRegistry"/> that contains the list
		/// of managed <see cref="IMod"/>s.</param>
		/// <param name="p_futFileUtility">The file utility class.</param>
		/// <param name="p_scxUIContext">The <see cref="SynchronizationContext"/> to use to marshall UI interactions to the UI thread.</param>
		/// <param name="p_ilgInstallLog">The install log tracking mod activations for the current game mode.</param>
		/// <param name="p_pmgPluginManager">The plugin manager to use to work with plugins.</param>
		/// <returns>The initialized mod manager.</returns>
		/// <exception cref="InvalidOperationException">Thrown if the mod manager has already
		/// been initialized.</exception>
        public static ModManager Initialize(IGameMode p_gmdGameMode, IEnvironmentInfo p_eifEnvironmentInfo, IModRepository p_mrpModRepository, DownloadMonitor p_dmrMonitor, ActivateModsMonitor p_ammMonitor, IModFormatRegistry p_frgFormatRegistry, ModRegistry p_mrgModRegistry, FileUtil p_futFileUtility, SynchronizationContext p_scxUIContext, IInstallLog p_ilgInstallLog, IPluginManager p_pmgPluginManager)	
		{
			if (m_mmgCurrent != null)
				throw new InvalidOperationException("The Mod Manager has already been initialized.");
            m_mmgCurrent = new ModManager(p_gmdGameMode, p_eifEnvironmentInfo, p_mrpModRepository, p_dmrMonitor, p_ammMonitor, p_frgFormatRegistry, p_mrgModRegistry, p_futFileUtility, p_scxUIContext, p_ilgInstallLog, p_pmgPluginManager);
			return m_mmgCurrent;
		}
 private IEnumerable<IFileProvider> GetPluginFileProviders(IPluginManager pluginManager, string subfolder)
 {
     foreach (var pluginInfo in pluginManager.LoadedPlugins)
     {
         yield return new PluginFileProvider(pluginInfo, subfolder, null);
     }
 }
Exemplo n.º 3
0
 public SettingsManager(IApplicationState state, IPluginManager pluginManager, IApplicationConfig config, ApplicationSettingsBase settings)
 {
     _settings = settings;
     _state = state;
     _pluginManager = pluginManager;
     _config = config;
 }
        public void Init(HttpApplication context)
        {
            context.PreRequestHandlerExecute += ContextOnBeginRequest;
            _pluginManager = Services.Get<IPluginManager>();

            _pluginManager.AfterConfigurationChanged += PluginManagerAfterConfigurationChanged;
        }
 public PluginCompositeFileProvider(IPluginManager pluginManager, IFileProvider defaultFileProvider, string subfolder=null)
 {
     var pluginsFileProviders = new List<IFileProvider>(pluginManager.LoadedPlugins.Count()+1);
     pluginsFileProviders.Add(defaultFileProvider);
     pluginsFileProviders.AddRange(GetPluginFileProviders(pluginManager, subfolder));
     _fileProvider = new CompositeFileProvider(pluginsFileProviders);
 }
		/// <summary>
		/// A simple constructor that initializes the object with its dependencies.
		/// </summary>
		/// <param name="p_gmiGameModeInfo">The environment info of the current game mode.</param>
		/// <param name="p_modMod">The mod being installed.</param>
		/// <param name="p_ilgInstallLog">The install log to use to log file installations.</param>
		/// <param name="p_pmgPluginManager">The plugin manager.</param>
		/// <param name="p_dfuDataFileUtility">The utility class to use to work with data files.</param>
		/// <param name="p_tfmFileManager">The transactional file manager to use to interact with the file system.</param>
		/// <param name="p_dlgOverwriteConfirmationDelegate">The method to call in order to confirm an overwrite.</param>
        /// <param name="p_UsesPlugins">Game using plugin or mods (True for plugins).</param>
		public ModFileUpgradeInstaller(IGameModeEnvironmentInfo p_gmiGameModeInfo, IMod p_modMod, IInstallLog p_ilgInstallLog, IPluginManager p_pmgPluginManager, IDataFileUtil p_dfuDataFileUtility, TxFileManager p_tfmFileManager, ConfirmItemOverwriteDelegate p_dlgOverwriteConfirmationDelegate, bool p_UsesPlugins)
            : base(p_gmiGameModeInfo, p_modMod, p_ilgInstallLog, p_pmgPluginManager, p_dfuDataFileUtility, p_tfmFileManager, p_dlgOverwriteConfirmationDelegate, p_UsesPlugins, null)
		{
			OriginallyInstalledFiles = new Set<string>(StringComparer.OrdinalIgnoreCase);
			foreach (string strFile in InstallLog.GetInstalledModFiles(Mod))
				OriginallyInstalledFiles.Add(strFile.Replace(Path.AltDirectorySeparatorChar, Path.DirectorySeparatorChar));
		}
Exemplo n.º 7
0
        public MenuViewModel(IApplicationState state, IPluginManager pluginManager, IApplicationConfig config, IPresetsManager presetManager)
        {
            _pluginManager = pluginManager;
            _state = state;
            _config = config;
            _presetsManager = presetManager;

            //Commands
            _openCommand = new DelegateCommand(Open);
            _openFileCommand = new DelegateCommand(OpenFile);
            _openStreamCommand = new DelegateCommand(OpenStream);
            _openDiscCommand = new DelegateCommand(OpenDisc);
            _openDeviceCommand = new DelegateCommand(OpenDevice);
            _openProcessCommand = new DelegateCommand(OpenProcess);
            _browseSamplesCommand = new DelegateCommand(BrowseSamples);
            _exitCommand = new DelegateCommand(Exit);
            _changeFormatCommand = new DelegateCommand(SetStereoInput);
            _changeProjectionCommand = new DelegateCommand(SetProjection);
            _changeEffectCommand = new DelegateCommand(SetEffect);
            _changeLayoutCommand = new DelegateCommand(SetStereoOutput);
            _changeDistortionCommand = new DelegateCommand(SetDistortion);
            _changeTrackerCommand = new DelegateCommand(SetTracker);
            _saveMediaPresetCommand = new DelegateCommand(SaveMediaPreset);
            _saveDevicePresetCommand = new DelegateCommand(SaveDevicePreset);
            _saveAllPresetCommand = new DelegateCommand(SaveAllPreset);
            _loadMediaPresetCommand = new DelegateCommand(LoadMediaPreset);
            _resetPresetCommand = new DelegateCommand(ResetPreset);
            _settingsCommand = new DelegateCommand(ShowSettings);
            _launchWebBrowserCommand = new DelegateCommand(LaunchWebBrowser);
            _aboutCommand = new DelegateCommand(ShowAbout);
        }
Exemplo n.º 8
0
        /// <summary>
        /// Performs all the operations needed to init the plugin/App
        /// </summary>
        /// <param name="user">singleton instance of UserPlugin</param>
        /// <param name="rootPath">path where the config files can be found</param>
        /// <returns>true if the user is already logged in; false if still logged out</returns>
        public static bool InitApp(UserClient user, string rootPath, IPluginManager pluginManager)
        {
            if (user == null)
                return false;

            // initialize the config file
            Snip2Code.Utils.AppConfig.Current.Initialize(rootPath);
            log = LogManager.GetLogger("ClientUtils");
 
            // login the user
            bool res = user.RetrieveUserPreferences();
            bool loggedIn = false;
            if (res && ((!BaseWS.Username.IsNullOrWhiteSpaceOrEOF()) || (!BaseWS.IdentToken.IsNullOrWhiteSpaceOrEOF())))
            {
                LoginPoller poller = new LoginPoller(BaseWS.Username, BaseWS.Password, BaseWS.IdentToken, BaseWS.UseOneAll,
                                                        pluginManager);
                LoginTimer = new System.Threading.Timer(poller.RecallLogin, null, 0, AppConfig.Current.LoginRefreshTimeSec * 1000);
                loggedIn = true;
            }

            System.Threading.ThreadPool.QueueUserWorkItem(delegate
            {
                user.LoadSearchHistoryFromFile();
            }, null);

            //set the empty profile picture for search list results:
            PictureManager.SetEmptyProfilePic(rootPath);

            return loggedIn;
        }
Exemplo n.º 9
0
        public ZvsEngine(IFeedback<LogEntry> feedback, IAdapterManager adapterManager, IPluginManager pluginManager,
            IEntityContextConnection entityContextConnection, TriggerRunner triggerRunner, ScheduledTaskRunner scheduledTaskRunner)
        {
            if (entityContextConnection == null)
                throw new ArgumentNullException("entityContextConnection");

            if (feedback == null)
                throw new ArgumentNullException("feedback");

            if (adapterManager == null)
                throw new ArgumentNullException("adapterManager");

            if (pluginManager == null)
                throw new ArgumentNullException("pluginManager");

            if (triggerRunner == null)
                throw new ArgumentNullException("triggerRunner");

            if (scheduledTaskRunner == null)
                throw new ArgumentNullException("scheduledTaskRunner");

            EntityContextConnection = entityContextConnection;
            Log = feedback;
            AdapterManager = adapterManager;
            PluginManager = pluginManager;
            TriggerRunner = triggerRunner;
            ScheduledTaskRunner = scheduledTaskRunner;
            Log.Source = "Zvs Engine";


            AppDomain.CurrentDomain.SetData("DataDirectory", Utils.AppDataPath);
        }
Exemplo n.º 10
0
		/// <summary>
		/// Initializes the singleton intances of the mod manager.
		/// </summary>
		/// <param name="p_gmdGameMode">The current game mode.</param>
		/// <param name="p_mprManagedPluginRegistry">The <see cref="PluginRegistry"/> that contains the list
		/// of managed <see cref="Plugin"/>s.</param>
		/// <param name="p_aplPluginLog">The <see cref="ActivePluginLog"/> tracking plugin activations for the
		/// current game mode.</param>
		/// <param name="p_polOrderLog">The <see cref="IPluginOrderLog"/> tracking plugin order for the
		/// current game mode.</param>
		/// <param name="p_povOrderValidator">The object that validates plugin order.</param>
		/// <exception cref="InvalidOperationException">Thrown if the plugin manager has already
		/// been initialized.</exception>
		public static IPluginManager Initialize(IGameMode p_gmdGameMode, PluginRegistry p_mprManagedPluginRegistry, ActivePluginLog p_aplPluginLog, IPluginOrderLog p_polOrderLog, IPluginOrderValidator p_povOrderValidator)
		{
			if (m_pmgCurrent != null)
				throw new InvalidOperationException("The Plugin Manager has already been initialized.");
			m_pmgCurrent = new PluginManager(p_gmdGameMode, p_mprManagedPluginRegistry, p_aplPluginLog, p_polOrderLog, p_povOrderValidator);
			return m_pmgCurrent;
		}
Exemplo n.º 11
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Game"/> class.
        /// </summary>
        /// <param name="application">The photon application instance the game belongs to.</param>
        /// <param name="gameId">The game id.</param>
        /// <param name="roomCache">The room cache the game belongs to.</param>
        /// <param name="pluginManager">plugin creator</param>
        /// <param name="pluginName">Plugin name which client expects to be loaded</param>
        /// <param name="environment">different environment parameters</param>
        /// <param name="executionFiber">Fiber which will execute all rooms actions</param>
        public Game(
            GameApplication application,
            string gameId,
            Hive.Caching.RoomCacheBase roomCache = null,
            IPluginManager pluginManager = null,
            string pluginName = "",
            Dictionary<string, object> environment = null,
            ExtendedPoolFiber executionFiber = null
            )
            : base(gameId,
                roomCache,
                null,
                GameServerSettings.Default.MaxEmptyRoomTTL,
                pluginManager,
                pluginName,
                environment,
                GameServerSettings.Default.LastTouchSecondsDisconnect * 1000,
                GameServerSettings.Default.LastTouchCheckIntervalSeconds * 1000,
                DefaultHttpRequestQueueOptions,
                executionFiber)
        {
            this.Application = application;

            if (this.Application.AppStatsPublisher != null)
            {
                this.Application.AppStatsPublisher.IncrementGameCount();
            }

            this.HttpForwardedOperationsLimit = GameServerSettings.Default.HttpForwardLimit;
        }
Exemplo n.º 12
0
 public void Initialize(IPluginManager pluginManager)
 {
     foreach (var instance in pluginManager.Plugins<IBaseAjaxNamespace>().Select(ajaxNamespace => ajaxNamespace.Value))
     {
         this.RegisterNamespace(instance.PluginInfo["namespace"], instance);
     }
 }
Exemplo n.º 13
0
 public TestGame(string roomId, Caching.RoomCacheBase parent, int emptyRoomTTL, IPluginManager eManager, string pluginName)
     : base(roomId, parent, new TestGameStateFactory(), emptyRoomTTL, eManager, pluginName)
 {
     //this.IsOpen = true;
     //this.IsVisible = true;
     //this.EventCache.SetGameAppCounters(NullHiveGameAppCounters.Instance);
     //this.EventCache.AddSlice(0);
 }
Exemplo n.º 14
0
 public LoginPoller(string username, string password, string identToken, bool useOneAll, IPluginManager pluginManager) 
 {
     this.username = username;
     this.password = password;
     this.identToken = identToken;
     this.useOneAll = useOneAll;
     this.pluginManager = pluginManager;
 }
Exemplo n.º 15
0
		/// <summary>
		/// A sinmple constructor that initializes the object with the given values.
		/// </summary>
		/// <param name="p_dfuDataFileUtility">The utility class to use to work with data files.</param>
		/// <param name="p_mfiFileInstaller">The installer to use to install files.</param>
		/// <param name="p_iniIniInstaller">The installer to use to install INI values.</param>
		/// <param name="p_gviGameSpecificValueInstaller">The installer to use to install game specific values.</param>
		/// <param name="p_pmgPluginManager">The manager to use to manage plugins.</param>
		public InstallerGroup(IDataFileUtil p_dfuDataFileUtility, IModFileInstaller p_mfiFileInstaller, IIniInstaller p_iniIniInstaller, IGameSpecificValueInstaller p_gviGameSpecificValueInstaller, IPluginManager p_pmgPluginManager)
		{
			DataFileUtility = p_dfuDataFileUtility;
			FileInstaller = p_mfiFileInstaller;
			IniInstaller = p_iniIniInstaller;
			GameSpecificValueInstaller = p_gviGameSpecificValueInstaller;
			PluginManager = p_pmgPluginManager;
		}
Exemplo n.º 16
0
        public SettingsWindowViewModel(IApplicationState state, IApplicationConfig config, IPluginManager pluginManager)
        {
            _state = state;
            _config = config;
            _pluginManager = pluginManager;

            _changeSamplePathCommand = new DelegateCommand(ChangeSamplePath);
        }
Exemplo n.º 17
0
 public ViewModelFactory(IApplicationConfig config, IPluginManager pluginManager, IApplicationState state, IPresetsManager presetsManager, IMediaService mediaService)
 {
     _config = config;
     _pluginManager = pluginManager;
     _state = state;
     _presetsManager = presetsManager;
     _mediaService = mediaService;
 }
Exemplo n.º 18
0
 public StebsHub(IConstants constants, IMpm mpm, IProcessorManager manager, IFileManager fileManager, IPluginManager pluginManager)
 {
     this.Constants = constants;
     this.Mpm = mpm;
     this.Manager = manager;
     this.FileManager = fileManager;
     this.PluginManager = pluginManager;
 }
Exemplo n.º 19
0
		/// <summary>
		/// A simple constructor that initializes the object with the given values.
		/// </summary>
		/// <param name="p_modMod">The mod being installed.</param>
		/// <param name="p_gmdGameMode">The the current game mode.</param>
		/// <param name="p_mfiFileInstaller">The file installer to use.</param>
		/// <param name="p_pmgPluginManager">The plugin manager.</param>
		/// <param name="p_booSkipReadme">Whether to skip the installation of readme files.</param>
		/// <param name="p_rolActiveMods">The list of active mods.</param>
		public BasicInstallTask(IMod p_modMod, IGameMode p_gmdGameMode, IModFileInstaller p_mfiFileInstaller, IPluginManager p_pmgPluginManager, bool p_booSkipReadme, ReadOnlyObservableList<IMod> p_rolActiveMods)
		{
			Mod = p_modMod;
			GameMode = p_gmdGameMode;
			FileInstaller = p_mfiFileInstaller;
			PluginManager = p_pmgPluginManager;
			SkipReadme = p_booSkipReadme;
			ActiveMods = p_rolActiveMods;
		}
Exemplo n.º 20
0
 public DevelopmentManager(IEventManager eventManager, IPluginManager pluginManager)
 {
     // Create the logged in user's specific instance of the user manager proxy.
     // The actual implementation class could be changed in configuration
     // or using dependency injection (if we want to implement that)...
     _eventManager = eventManager;
     _pluginManager = pluginManager;
     _commonManagerProxy = new CommonManagerProxy(this);
 }
Exemplo n.º 21
0
 private async Task Work(IMacroEngine Macro, IPluginManager Plugins)
 {
     foreach (var c in Enumerable.Range(0, this.Loop))
     {
         await this.SendAndWait(Macro, this.Word, 50);
         Macro.Display(c.ToString());
     }
     Macro.Display("completed");
 }
 public static RazorViewEngineOptions ConfigurePluginsView( this RazorViewEngineOptions options, IPluginManager pluginManager)
 {
     options.ViewLocationExpanders.Insert(0, new PluginViewLocationExtender());
     foreach (var pluginInfo in pluginManager.LoadedPlugins)
     {
         options.FileProviders.Add(new PluginFileProvider(pluginInfo, "Views", "Views"));
     }
     return options;
 }
Exemplo n.º 23
0
        public HiveHostGame(
            string gameName,
            RoomCacheBase roomCache,
            IGameStateFactory gameStateFactory = null,
            int maxEmptyRoomTTL = 0,
            IPluginManager pluginManager = null,
            string pluginName = "",
            Dictionary<string, object> environment = null,
            int lastTouchLimitMilliseconds = 0,
            int lastTouchCheckIntervalMilliseconds = 0,
            HttpRequestQueueOptions httpRequestQueueOptions = null,
            ExtendedPoolFiber executionFiber = null
            )
            : base(gameName, roomCache, gameStateFactory, maxEmptyRoomTTL, lastTouchLimitMilliseconds, lastTouchCheckIntervalMilliseconds, executionFiber)
        {
            this.pluginManager = pluginManager;

            if (httpRequestQueueOptions == null)
            {
                httpRequestQueueOptions = new HttpRequestQueueOptions();
            }

            this.httpRequestQueue.MaxErrorRequests = httpRequestQueueOptions.HttpQueueMaxTimeouts;
            this.httpRequestQueue.MaxTimedOutRequests = httpRequestQueueOptions.HttpQueueMaxErrors;
            this.httpRequestQueue.ReconnectInterval = TimeSpan.FromMilliseconds(httpRequestQueueOptions.HttpQueueReconnectInterval);
            this.httpRequestQueue.QueueTimeout = TimeSpan.FromMilliseconds(httpRequestQueueOptions.HttpQueueQueueTimeout);
            this.httpRequestQueue.MaxQueuedRequests = httpRequestQueueOptions.HttpQueueMaxQueuedRequests;
            this.httpRequestQueue.MaxBackoffInMilliseconds = httpRequestQueueOptions.HttpQueueMaxBackoffTime;
            this.httpRequestQueue.MaxConcurrentRequests = httpRequestQueueOptions.HttpQueueMaxConcurrentRequests;

            this.httpQueueRequestTimeout = httpRequestQueueOptions.HttpQueueRequestTimeout;

            this.httpRequestQueue.SetCounters(this);

            this.Environment = environment ?? new Dictionary<string, object>
                                       {
                                           {"AppId", GetHwId()},
                                           {"AppVersion", ""},
                                           {"Region", ""},
                                           {"Cloud", ""},
                                       };
            this.InitPlugin(pluginName);
            if (this.Plugin == null)
            {
                throw new Exception(string.Format("Failed to craete plugin '{0}'", pluginName));
            }

            var errorPlugin = this.Plugin as ErrorPlugin;
            if (errorPlugin != null)
            {
                Log.ErrorFormat("Game {0} is created with ErrorPlugin. message:{1}", this.Name, errorPlugin.Message);
            }

            this.customTypeCache.TypeMapper = this;
            this.callEnv = new CallEnv(this.Plugin, this.Name);
        }
Exemplo n.º 24
0
		/// <summary>
		/// A simple constructor that initializes the factory with the required dependencies.
		/// </summary>
		/// <param name="p_gmdGameMode">The game mode for which the created installer will be installing mods.</param>
		/// <param name="p_eifEnvironmentInfo">The application's envrionment info.</param>
		/// <param name="p_futFileUtility">The file utility class.</param>
		/// <param name="p_scxUIContext">The <see cref="SynchronizationContext"/> to use to marshall UI interactions to the UI thread.</param>
		/// <param name="p_ilgInstallLog">The install log that tracks mod install info
		/// for the current game mode.</param>
		/// <param name="p_pmgPluginManager">The plugin manager to use to work with plugins.</param>
        public ModInstallerFactory(IGameMode p_gmdGameMode, IEnvironmentInfo p_eifEnvironmentInfo, FileUtil p_futFileUtility, SynchronizationContext p_scxUIContext, IInstallLog p_ilgInstallLog, IPluginManager p_pmgPluginManager, ModManager p_mmModManager)
		{
			m_gmdGameMode = p_gmdGameMode;
			m_eifEnvironmentInfo = p_eifEnvironmentInfo;
			m_futFileUtility = p_futFileUtility;
			m_scxUIContext = p_scxUIContext;
			m_ilgInstallLog = p_ilgInstallLog;
			m_pmgPluginManager = p_pmgPluginManager;
            m_mmModManager = p_mmModManager;
		}
Exemplo n.º 25
0
 /// <summary>
 /// Constructor to initialize all stuff
 /// </summary>
 /// <param name="aConfiguration">Reference to the the Configuration object</param>
 public Settings(Configuration aConfiguration, IPluginManager aPluginManager)
 {
     _myConfiguration = aConfiguration;
     _myConfiguration.AddObserver(this);
     _pluginManager = aPluginManager;
     _converter = new System.Windows.Forms.KeysConverter();
     _cultConvert = new CultureInfoConverter();
     InitializeComponent();
     WriteThanks();
 }
 /// <summary>
 /// A simple constructor that initializes the object with its dependencies.
 /// </summary>
 /// <param name="p_gmiGameModeInfo">The environment info of the current game mode.</param>
 /// <param name="p_modMod">The mod being installed.</param>
 /// <param name="p_ilgInstallLog">The install log to use to log file installations.</param>
 /// <param name="p_pmgPluginManager">The plugin manager.</param>
 /// <param name="p_dfuDataFileUtility">The utility class to use to work with data files.</param>
 /// <param name="p_tfmFileManager">The transactional file manager to use to interact with the file system.</param>
 /// <param name="p_dlgOverwriteConfirmationDelegate">The method to call in order to confirm an overwrite.</param>
 /// <param name="p_UsesPlugins">Whether the file is a mod or a plugin.</param>
 public ModFileInstaller(IGameModeEnvironmentInfo p_gmiGameModeInfo, IMod p_modMod, IInstallLog p_ilgInstallLog, IPluginManager p_pmgPluginManager, IDataFileUtil p_dfuDataFileUtility, TxFileManager p_tfmFileManager, ConfirmItemOverwriteDelegate p_dlgOverwriteConfirmationDelegate, bool p_UsesPlugins)
 {
     GameModeInfo = p_gmiGameModeInfo;
     Mod = p_modMod;
     InstallLog = p_ilgInstallLog;
     PluginManager = p_pmgPluginManager;
     DataFileUtility = p_dfuDataFileUtility;
     TransactionalFileManager = p_tfmFileManager;
     m_dlgOverwriteConfirmationDelegate = p_dlgOverwriteConfirmationDelegate ?? ((s, b, m) => OverwriteResult.No);
     IsPlugin = p_UsesPlugins;
 }
Exemplo n.º 27
0
Arquivo: Bot.cs Projeto: Gohla/Veda
        public Bot(IClient client, IStorageManager storage, ICommandManager command, IPluginManager plugin,
            IAuthenticationManager authentication, IPermissionManager permission)
        {
            _client = client;
            _storage = storage;
            _command = command;
            _plugin = plugin;
            _authentication = authentication;
            _permission = permission;

            _data = storage.Global().GetOrCreate<BotData>(_storageIdentifier);

            _replyHandler = new ReplyHandler(this, _data);
            _messsageHandler = new MessageHandler(this, _replyHandler, _data);
        }
Exemplo n.º 28
0
        /////////////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Creates a new AddSnippet Form and precompiles this form with the selected text
        /// </summary>
        /// <param name="pluginManager"></param>
        public static IManageSnippetForm PrepareAddNewSnippetForm(IPluginManager pluginManager)
        {
            if (pluginManager == null)
                return null;

            // Manage editor selection
            string selText = pluginManager.RetrieveSelectedText();

            // Open "Add Snippet" Window
            pluginManager.ClosePublishSnippetWindow();
            IManageSnippetForm addSnipForm = pluginManager.CreateAddSnippetForm();
            if (addSnipForm != null)
                addSnipForm.PrepareAddNewSnippet(selText);

            return addSnipForm;
        }
Exemplo n.º 29
0
        public SystemsManager( IPluginManager pluginManager, ILogManager logManager, INGinCore core, IMainLoopManager mainLoopManager )
        {
            this.LogManager = logManager;

            foreach ( SystemAttribute plugin in pluginManager.GetPluginsForType( typeof( SystemAttribute ) ) )
            {
                // create and store system
                //ConstructorInfo constructor = plugin.SystemType.GetConstructor( plugin.ConstructorParameterTypes );
                //ISystem system = plugin.SystemType.InvokeMember( plugin.SystemType.Name, global::System.Reflection.BindingFlags.CreateInstance, null, null, new object[] { this.LogManager } ) as ISystem;
                ISystem system = core.GetService( plugin.SystemType ) as ISystem;

                lock ( this.registeredSystemsLock )
                {
                    this.registeredSystems.Add( system.Name, system );
                }
            }
        }
Exemplo n.º 30
0
        public SettingsViewModel(
            ISettingsProvider settingsService,
            IWindowManager windowManager,
            IEventAggregator eventAggregator,
            Func<BlogSettingsViewModel> blogSettingsCreator,
            IPluginManager pluginManager,
            Func<IPlugin, PluginViewModel> pluginViewModelCreator,
            ISpellingService spellingService)
        {
            this.settingsService = settingsService;
            this.windowManager = windowManager;
            this.eventAggregator = eventAggregator;
            this.blogSettingsCreator = blogSettingsCreator;
            this.pluginManager = pluginManager;
            this.pluginViewModelCreator = pluginViewModelCreator;
            this.spellingService = spellingService;

            this.pluginManager.Container.ComposeParts(this);
        }
Exemplo n.º 31
0
 public AlbumDownloadEvent(IPluginManager pluginManager, IConfigurationManager configMgr)
 {
     _pluginManager = pluginManager;
     _configMgr     = configMgr;
 }
Exemplo n.º 32
0
 public IPluginState CreatePluginState(IPluginManager pluginManager)
 {
     return(new NcchState());
 }
Exemplo n.º 33
0
 public ConfigController(IHostApplicationLifetime hostApplicationLifetime, IAuthManager authManager, IPluginManager pluginManager, ISiteRepository siteRepository, IChannelRepository channelRepository)
 {
     _hostApplicationLifetime = hostApplicationLifetime;
     _authManager             = authManager;
     _pluginManager           = pluginManager;
     _siteRepository          = siteRepository;
     _channelRepository       = channelRepository;
 }
Exemplo n.º 34
0
 public AddLayerUploadController(IHostApplicationLifetime hostApplicationLifetime, ISettingsManager settingsManager, IAuthManager authManager, IPathManager pathManager, IPluginManager pluginManager)
 {
     _hostApplicationLifetime = hostApplicationLifetime;
     _settingsManager         = settingsManager;
     _authManager             = authManager;
     _pathManager             = pathManager;
     _pluginManager           = pluginManager;
 }
Exemplo n.º 35
0
 public IPluginState CreatePluginState(IPluginManager pluginManager)
 {
     return(new AAPackState());
 }
Exemplo n.º 36
0
 /// <summary>
 /// Plugin constructor.
 /// </summary>
 /// <param name="pluginManager">PluginManager object</param>
 protected Plugin(IPluginManager pluginManager)
 {
     PluginManager = pluginManager;
 }
 /// <summary>
 /// A simple constructor that initializes the object with its dependencies.
 /// </summary>
 /// <param name="p_gmiGameModeInfo">The environment info of the current game mode.</param>
 /// <param name="p_modMod">The mod being installed.</param>
 /// <param name="p_ilgInstallLog">The install log to use to log file installations.</param>
 /// <param name="p_pmgPluginManager">The plugin manager.</param>
 /// <param name="p_dfuDataFileUtility">The utility class to use to work with data files.</param>
 /// <param name="p_tfmFileManager">The transactional file manager to use to interact with the file system.</param>
 /// <param name="p_dlgOverwriteConfirmationDelegate">The method to call in order to confirm an overwrite.</param>
 /// <param name="p_UsesPlugins">Whether the file is a mod or a plugin.</param>
 public ModFileInstaller(IGameModeEnvironmentInfo p_gmiGameModeInfo, IMod p_modMod, IInstallLog p_ilgInstallLog, IPluginManager p_pmgPluginManager, IDataFileUtil p_dfuDataFileUtility, TxFileManager p_tfmFileManager, ConfirmItemOverwriteDelegate p_dlgOverwriteConfirmationDelegate, bool p_UsesPlugins, ModManager p_mmModManager)
 {
     GameModeInfo                       = p_gmiGameModeInfo;
     Mod                                = p_modMod;
     InstallLog                         = p_ilgInstallLog;
     PluginManager                      = p_pmgPluginManager;
     DataFileUtility                    = p_dfuDataFileUtility;
     TransactionalFileManager           = p_tfmFileManager;
     m_dlgOverwriteConfirmationDelegate = p_dlgOverwriteConfirmationDelegate ?? ((s, b, m) => OverwriteResult.No);
     IsPlugin                           = p_UsesPlugins;
     m_mmModManager                     = p_mmModManager;
 }
Exemplo n.º 38
0
 public void Initialize(IPluginManager loader, IPlugin[] plugins)
 {
     this.config = loader.GetPluginSetting <UserDefinedFilterConfig>(this.Name);
     Reload();
 }
Exemplo n.º 39
0
        private Action CreateInvoker(IPluginManager pluginManager, int browserId, long frameId, int contextId,
                                     string methodName, IJavaScriptParameters parameters, IJavaScriptPluginCallback callback)
        {
            ThrowIfDisposed();

            if (parameters == null)
            {
                throw new ArgumentNullException("parameters");
            }

            MethodInfo method;

            if (!_methods.TryGetValue(methodName, out method))
            {
                if (callback != null)
                {
                    var msg = string.Format("Error executing {0} on plugin {1} - method not found", methodName, _pluginId);
                    InvokeReturnCallback(callback, null, 0, msg);
                }
            }

            var nativeObject = NativeObject;

            if (nativeObject == null)
            {
                if (callback != null)
                {
                    var msg = string.Format("Error executing {0} on plugin {1} - plugin object has been disposed", methodName, _pluginId);
                    InvokeReturnCallback(callback, null, 0, msg);
                }
            }

            object[] arguments;
            var      hasCallbackParameter = HasCallbackParameter(method);
            var      methodParams         = method.GetParameters();

            var parameterDefinitions = hasCallbackParameter
                ? methodParams.Take(methodParams.Length - 1).ToArray()
                : methodParams;

            try
            {
                arguments = parameters.GetConvertedParameters(parameterDefinitions, pluginManager);

                if (hasCallbackParameter)
                {
                    // Create a new args array with length + 1 so we can add the callback param to it.
                    var args = new object[arguments.Length + 1];
                    Array.Copy(arguments, args, arguments.Length);

                    // Extract the callback and wrap it.
                    JavaScriptPluginCallback callbackParam = null;
                    if (callback != null)
                    {
                        var parameterCallback = callback.GetParameterCallback();
                        if (parameterCallback != null)
                        {
                            callbackParam = parameterCallback.Invoke;
                        }
                    }

                    // Add the wrapped callback to the args list.
                    args[args.Length - 1] = callbackParam;
                    arguments             = args;
                }
            }
            catch (Exception ex)
            {
                Logger.Error("Error converting plugin invocation parameters: " + ex);
                if (callback != null)
                {
                    InvokeReturnCallback(callback, null, -1, ex.Message);
                }
                return(null);
            }

            var invoke = new Action(
                () =>
            {
                using (PluginExecutionContext.Create(browserId, contextId, frameId))
                {
                    object result = null;
                    var errorCode = 0;
                    var error     = string.Empty;

                    try
                    {
                        result = method.Invoke(nativeObject, arguments);
                    }
                    catch (Exception e)
                    {
                        while (e is TargetInvocationException)
                        {
                            e = e.InnerException;
                        }

                        errorCode = -1;
                        error     = e.Message;
                        Logger.Error("Error executing plugin method: " + e);
                    }

                    if (callback != null)
                    {
                        InvokeReturnCallback(callback, result, errorCode, error);
                    }
                }
            });

            return(invoke);
        }
Exemplo n.º 40
0
 public Main(IPluginManager pluginManager)
     : base(pluginManager)
 {
     entities = new List <IEntity>();
 }
Exemplo n.º 41
0
 public MonitoringLogic(IConfigurationRepository configDb, IPluginManager pluginManager)
 {
     _configDb      = configDb;
     _pluginManager = pluginManager;
     _logger        = Serilog.Log.Logger;
 }
Exemplo n.º 42
0
 public PluginActionDescriptorCollectionProvider(IServiceProvider serviceProvider, IPluginManager pluginManager)
 {
     _serviceProvider  = serviceProvider;
     _pluginManager    = pluginManager;
     _activePluginHash = -1;
 }
Exemplo n.º 43
0
 public PluginManagerViewModel(IPluginManager pluginManager)
 {
     pluginManager.PluginsLoaded += PluginManager_PluginsLoaded;
 }
Exemplo n.º 44
0
 protected PluginEvent(IPluginManager pluginManager, IPlugin plugin, bool global = true) : base(global)
 {
     PluginManager = pluginManager;
     Plugin        = plugin;
 }
Exemplo n.º 45
0
 protected PluginEvent(IPluginManager pluginManager, IPlugin plugin) : this(pluginManager, plugin, true)
 {
 }
Exemplo n.º 46
0
 public IPluginState CreatePluginState(IPluginManager pluginManager)
 {
     return(new HpiHpbState());
 }
Exemplo n.º 47
0
        /// <summary>
        /// The main entry point for the MP 2 client application.
        /// </summary>
        private static void Main(params string[] args)
        {
            Thread.CurrentThread.Name = "Main";

#if !DEBUG
            SplashScreen splashScreen = CreateSplashScreen();
            splashScreen.ShowSplashScreen();
#endif

            // Parse Command Line options
            CommandLineOptions mpArgs = new CommandLineOptions();
            ICommandLineParser parser = new CommandLineParser(new CommandLineParserSettings(Console.Error));
            if (!parser.ParseArguments(args, mpArgs, Console.Out))
            {
                Environment.Exit(1);
            }

#if !DEBUG
            string logPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), @"Team MediaPortal\MP2-Client\Log");
#endif

            SystemStateService systemStateService = new SystemStateService();
            ServiceRegistration.Set <ISystemStateService>(systemStateService);
            systemStateService.SwitchSystemState(SystemState.Initializing, false);

            try
            {
                ILogger logger = null;
                try
                {
                    // Check if user wants to override the default Application Data location.
                    ApplicationCore.RegisterCoreServices(mpArgs.DataDirectory);

                    logger = ServiceRegistration.Get <ILogger>();

#if !DEBUG
                    IPathManager pathManager = ServiceRegistration.Get <IPathManager>();
                    logPath = pathManager.GetPath("<LOG>");
#endif

                    UiExtension.RegisterUiServices();
                }
                catch (Exception e)
                {
                    if (logger != null)
                    {
                        logger.Critical("Error starting application", e);
                    }
                    systemStateService.SwitchSystemState(SystemState.ShuttingDown, true);
                    ServiceRegistration.IsShuttingDown = true;

                    UiExtension.DisposeUiServices();
                    ApplicationCore.DisposeCoreServices();

                    throw;
                }

                // Start the core
                logger.Debug("ApplicationLauncher: Starting application");

                try
                {
                    IPluginManager pluginManager = ServiceRegistration.Get <IPluginManager>();
                    pluginManager.Initialize();
                    pluginManager.Startup(false);
                    ApplicationCore.StartCoreServices();

                    ISkinEngine            skinEngine            = ServiceRegistration.Get <ISkinEngine>();
                    IWorkflowManager       workflowManager       = ServiceRegistration.Get <IWorkflowManager>();
                    IMediaAccessor         mediaAccessor         = ServiceRegistration.Get <IMediaAccessor>();
                    ILocalSharesManagement localSharesManagement = ServiceRegistration.Get <ILocalSharesManagement>();

                    // We have to handle some dependencies here in the start order:
                    // 1) After all plugins are loaded, the SkinEngine can initialize (=load all skin resources)
                    // 2) After the skin resources are loaded, the workflow manager can initialize (=load its states and actions)
                    // 3) Before the main window is shown, the splash screen should be hidden
                    // 4) After the workflow states and actions are loaded, the main window can be shown
                    // 5) After the skinengine triggers the first workflow state/startup screen, the default shortcuts can be registered
                    mediaAccessor.Initialize();         // Independent from other services
                    localSharesManagement.Initialize(); // After media accessor was initialized
                    skinEngine.Initialize();            // 1)
                    workflowManager.Initialize();       // 2)

#if !DEBUG
                    splashScreen.CloseSplashScreen(); // 3)
#endif

                    skinEngine.Startup();                                  // 4)
                    UiExtension.Startup();                                 // 5)

                    ApplicationCore.RegisterDefaultMediaItemAspectTypes(); // To be done after UI services are running

                    systemStateService.SwitchSystemState(SystemState.Running, true);

                    Application.Run();

                    systemStateService.SwitchSystemState(SystemState.ShuttingDown, true);
                    ServiceRegistration.IsShuttingDown = true; // Block ServiceRegistration from trying to load new services in shutdown phase

                    // 1) Stop UI extensions (Releases all active players, must be done before shutting down SE)
                    // 2) Shutdown SkinEngine (Closes all screens, uninstalls background manager, stops render thread)
                    // 3) Shutdown WorkflowManager (Disposes all models)
                    // 4) Shutdown PluginManager (Shuts down all plugins)
                    // 5) Remove all services
                    UiExtension.StopUiServices();
                    skinEngine.Shutdown();
                    workflowManager.Shutdown();
                    pluginManager.Shutdown();
                    mediaAccessor.Shutdown();
                    localSharesManagement.Shutdown();
                    ApplicationCore.StopCoreServices();
                }
                catch (Exception e)
                {
                    logger.Critical("Error executing application", e);
                    systemStateService.SwitchSystemState(SystemState.ShuttingDown, true);
                    ServiceRegistration.IsShuttingDown = true;
                }
                finally
                {
                    UiExtension.DisposeUiServices();
                    ApplicationCore.DisposeCoreServices();

                    systemStateService.SwitchSystemState(SystemState.Ending, false);
                }
            }
            catch (Exception ex)
            {
#if DEBUG
                ConsoleLogger log = new ConsoleLogger(LogLevel.All, false);
                log.Error(ex);
#else
                UiCrashLogger crash = new UiCrashLogger(logPath);
                crash.CreateLog(ex);
#endif
                systemStateService.SwitchSystemState(SystemState.Ending, false);
                Application.Exit();
            }
        }
Exemplo n.º 48
0
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ISettingsManager settingsManager, IPluginManager pluginManager, IErrorLogRepository errorLogRepository, IOptions <SenparcSetting> senparcSetting)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseExceptionHandler(a => a.Run(async context =>
            {
                var exceptionHandlerPathFeature = context.Features.Get <IExceptionHandlerPathFeature>();
                var exception = exceptionHandlerPathFeature.Error;

                string result;
                if (env.IsDevelopment())
                {
                    result = TranslateUtils.JsonSerialize(new
                    {
                        exception.Message,
                        exception.StackTrace,
                        AddDate = DateTime.Now
                    });
                }
                else
                {
                    result = TranslateUtils.JsonSerialize(new
                    {
                        exception.Message,
                        AddDate = DateTime.Now
                    });
                }
                context.Response.ContentType = "application/json";
                await context.Response.WriteAsync(result);
            }));

            app.UseCors(CorsPolicy);

            app.UseForwardedHeaders(new ForwardedHeadersOptions
            {
                ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto
            });

            //app.UseHttpsRedirection();

            var options = new DefaultFilesOptions();

            options.DefaultFileNames.Clear();
            options.DefaultFileNames.Add("index.html");
            app.UseDefaultFiles(options);

            if (settingsManager.Containerized)
            {
                app.Map($"/{DirectoryUtils.SiteFiles.DirectoryName}/assets", assets =>
                {
                    assets.UseStaticFiles(new StaticFileOptions
                    {
                        FileProvider = new PhysicalFileProvider(PathUtils.Combine(settingsManager.ContentRootPath, "assets"))
                    });
                });
            }

            app.UseStaticFiles();

            var supportedCultures = new[]
            {
                new CultureInfo("en-US"),
                new CultureInfo("zh-CN")
            };

            app.UseRequestLocalization(new RequestLocalizationOptions
            {
                DefaultRequestCulture = new RequestCulture("zh-CN"),
                // Formatting numbers, dates, etc.
                SupportedCultures = supportedCultures,
                // UI strings that we have localized.
                SupportedUICultures = supportedCultures
            });

            app.UseRouting();

            app.UseAuthentication();
            app.UseAuthorization();

            app.UsePluginsAsync(settingsManager, pluginManager, errorLogRepository).GetAwaiter().GetResult();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapHealthChecks("/healthz");

                endpoints.MapControllers();
                endpoints.MapRazorPages();
            });
            //api.UseEndpoints(endpoints => { endpoints.MapControllerRoute("default", "{controller}/{action}/{id?}"); });

            app.UseRequestLocalization();

            RegisterService.Start(senparcSetting.Value)
            //自动扫描自定义扩展缓存(二选一)
            .UseSenparcGlobal(true)
            //指定自定义扩展缓存(二选一)
            //.UseSenparcGlobal(false, () => GetExCacheStrategies(senparcSetting.Value))
            ;

            app.UseOpenApi();
            app.UseSwaggerUi3();
            app.UseReDoc(settings =>
            {
                settings.Path         = "/api/docs";
                settings.DocumentPath = "/swagger/v1/swagger.json";
            });
        }
Exemplo n.º 49
0
 /// <summary>
 /// Initializes a new <see cref="WorkflowScheduler"/>
 /// </summary>
 /// <param name="serviceProvider">The current <see cref="IServiceProvider"/></param>
 /// <param name="logger">The service used to perform logging</param>
 /// <param name="pluginManager">The service used to manage <see cref="IPlugin"/>s</param>
 public WorkflowScheduler(IServiceProvider serviceProvider, ILogger <WorkflowScheduler> logger, IPluginManager pluginManager)
 {
     this.ServiceProvider = serviceProvider;
     this.Logger          = logger;
     this.PluginManager   = pluginManager;
 }
Exemplo n.º 50
0
 public PluginApplicationModelProvider(IPluginManager pluginManager)
 {
     _pluginManager = pluginManager ?? throw new ArgumentNullException(nameof(pluginManager));
 }
Exemplo n.º 51
0
 public void Initialize(IPluginManager loader, IPlugin[] plugins)
 {
     this.config = loader.GetPluginSetting <AddNameFilterConfig>(this.Name);
 }
 public TerminalSettingsSerializer(IPluginManager pm)
 {
     _serializeService = (ISerializeService)pm.FindPlugin("org.poderosa.core.serializing", typeof(ISerializeService));
 }
Exemplo n.º 53
0
        /// <summary>
        /// Loads a <see cref="HomeEditorRegistration"/> for the specified <paramref name="itemMetadata"/>.
        /// </summary>
        /// <param name="itemMetadata"></param>
        /// <param name="pluginManager"></param>
        /// <returns></returns>
        protected HomeEditorRegistration GetSkinRegistration(PluginItemMetadata itemMetadata, IPluginManager pluginManager)
        {
            try
            {
                HomeEditorRegistration providerRegistration = pluginManager.RequestPluginItem <HomeEditorRegistration>(
                    HomeEditorRegistrationBuilder.HOME_EDITOR_PROVIDER_PATH, itemMetadata.Id, _pluginItemStateTracker);

                if (providerRegistration != null)
                {
                    ServiceRegistration.Get <ILogger>().Info("Successfully added Home Editor skin registration for skin '{0}' (Id '{1}')",
                                                             itemMetadata.Attributes["SkinName"], itemMetadata.Id);
                    return(providerRegistration);
                }

                ServiceRegistration.Get <ILogger>().Warn("Could not instantiate Home Editor skin registration with id '{0}'", itemMetadata.Id);
            }
            catch (PluginInvalidStateException e)
            {
                ServiceRegistration.Get <ILogger>().Warn("Cannot add Home Editor skin registration with id '{0}'", e, itemMetadata.Id);
            }
            return(null);
        }
Exemplo n.º 54
0
 /// <inheritdoc />
 public TestTask(IProjectService projectService, IExternalServiceService externalServiceService, IExternalServiceTypeService externalServiceTypeService, IProviderService providerService, IPluginManager pluginManager, ILogger <TestTask> logger)
     : base(projectService, externalServiceService, externalServiceTypeService, providerService, pluginManager, logger)
 {
 }
Exemplo n.º 55
0
        internal static void DefineExtensionPoint(IPluginManager pm)
        {
            IExtensionPoint pt = pm.CreateExtensionPoint("org.poderosa.window.aboutbox", typeof(IPoderosaAboutBoxFactory), WindowManagerPlugin.Instance);

            pt.RegisterExtension(new DefaultAboutBoxFactory());
        }
Exemplo n.º 56
0
 internal PluginsCommand(IPluginManager pluginManager)
 {
     _pluginManager = pluginManager;
 }
Exemplo n.º 57
0
 public SystemController(ISystemManager systemManager, IPluginManager pluginManager, IDbConnectionFactory dbConnectionFactory)
 {
     _systemManager       = systemManager;
     _pluginManager       = pluginManager;
     _dbConnectionFactory = dbConnectionFactory;
 }
Exemplo n.º 58
0
 public LogsErrorController(IAuthManager authManager, IPluginManager pluginManager, IErrorLogRepository errorLogRepository)
 {
     _authManager        = authManager;
     _pluginManager      = pluginManager;
     _errorLogRepository = errorLogRepository;
 }
Exemplo n.º 59
0
 public IPluginState CreatePluginState(IPluginManager pluginManager)
 {
     return(new NonaryMainState());
 }
Exemplo n.º 60
0
 public override void Initialize(IPluginManager loader, IPlugin[] plugins)
 {
 }