Example #1
0
        public void Initialize(ApplicationStartupHandler handler, IDIContext container)
        {
            _container     = container ?? throw new ArgumentNullException(nameof(container));
            _configManager = _container.Resolve <IConfigManager>();
            _memoryManager = _container.Resolve <IMemoryReaderManager>();
            var actorManager = _container.Resolve <IActorManager>();

            var resourceBundle        = _container.Resolve <ILocaleManager>().GetResourceBundle("autotranslate");
            var autotranslateProvider = new AutotranslateProvider(resourceBundle);

            _chatManager = new ChatManager(autotranslateProvider, actorManager);

            _configManager.AddPropertyChangeListener("behaviour.chat.updateInterval", true, true, ConfigManager_UpdateChatInterval);
            _configManager.AddPropertyChangeListener("behaviour.channel", true, true, ConfigManager_UpdateChannelProperties);
            _configManager.AddPropertyChangeListener("behaviour.segment", true, true, ConfigManager_UpdateFormaterProperties);
            _configManager.AddPropertyChangeListener("behaviour.groups", true, true, ConfigManager_UpdateTriggerGroupProperties);
            _configManager.AddPropertyChangeListener("behaviour.mentions", true, true, ConfigManager_UpdateMentions);
            _configManager.AddPropertyChangeListener("behaviour.chat.autodetectEmoteInSay", true, true, ConfigManager_UpdateAutodetectProperties);
            _configManager.AddPropertyChangeListener("behaviour.language", true, true, ConfigManager_UpdateLanguage);
            _configManager.AddPropertyChangeListener("behaviour.rangefilter", true, true, ConfigManager_UpdateRangeFilter);
            _configManager.AddPropertyChangeListener("behaviour.mentions.userCanTriggerMention", true, true, ConfigManager_UpdateUserMentionProperties);

            _configManager.AddPropertyChangeListener("behaviour.chattabs.data", true, true, ConfigManager_UpdateVisibleChannel);
            _configManager.AddPropertyChangeListener("behaviour.chattabs.data", true, true, ConfigManager_UpdateUpdateRangeFilterActive);

            _container.Register <IChatManager>((c, p) => _chatManager);

            _updater = new IndependendBackgroundWorker();
            _updater.Start(UpdateJob);
        }
Example #2
0
        public void Dispose()
        {
            _worker.Dispose();
            _worker = null;

            var synchronizer = _container.Resolve <IUISynchronizer>();

            synchronizer.RunSync(() => _memoryReader.Dispose());

            _memoryReader = null;
            _container    = null;
        }
        public void Dispose()
        {
            _configManager.RemovePropertyChangeListener(ConfigManager_UpdateChatInterval);
            _configManager.RemovePropertyChangeListener(ConfigManager_UpdateRangeFilter);

            _updater.Dispose();

            _updater       = null;
            _actorManager  = null;
            _container     = null;
            _configManager = null;
            _memoryManager = null;
        }
        public void Initialize(ApplicationStartupHandler handler, IDIContext container)
        {
            _container     = container ?? throw new ArgumentNullException(nameof(container));
            _configManager = _container.Resolve <IConfigManager>();
            _memoryManager = _container.Resolve <IMemoryReaderManager>();

            _actorManager = new ActorManager();
            _updater      = new IndependendBackgroundWorker();

            _configManager.AddPropertyChangeListener("behaviour.actor.updateInterval", true, true, ConfigManager_UpdateChatInterval);
            _configManager.AddPropertyChangeListener("behaviour.actor.active", true, true, ConfigManager_UpdateRangeFilter);

            _container.Register <IActorManager>((c, p) => _actorManager);
        }
Example #5
0
        public FFXIVMemoryManager(IDIContext container)
        {
            _container = container ?? throw new ArgumentNullException(nameof(container));
            _worker    = new IndependendBackgroundWorker();

            var sharlayanResourceFolder = System.IO.Path.Combine(GobchatContext.ResourceLocation, @"sharlayan");

            System.IO.Directory.CreateDirectory(sharlayanResourceFolder);

            //needs to be done on the same thread as dispose, anchore it to ui thread, because that one never changes
            var synchronizer = container.Resolve <IUISynchronizer>();

            _memoryReader = synchronizer.RunSync(() => new FFXIVMemoryReader());
            _memoryReader.LocalCacheDirectory = sharlayanResourceFolder;
            _memoryReader.Initialize();

            _memoryReader.OnProcessChanged     += MemoryReader_OnProcessChanged;
            _memoryReader.OnWindowFocusChanged += MemoryReader_OnWindowFocusChanged;
            _worker.Start(Task_ConnectMemoryReader);
        }
Example #6
0
        public void Dispose()
        {
            _configManager.RemovePropertyChangeListener(ConfigManager_UpdateChannelProperties);
            _configManager.RemovePropertyChangeListener(ConfigManager_UpdateAutodetectProperties);
            _configManager.RemovePropertyChangeListener(ConfigManager_UpdateUserMentionProperties);
            _configManager.RemovePropertyChangeListener(ConfigManager_UpdateTriggerGroupProperties);
            _configManager.RemovePropertyChangeListener(ConfigManager_UpdateFormaterProperties);
            _configManager.RemovePropertyChangeListener(ConfigManager_UpdateChatInterval);
            _configManager.RemovePropertyChangeListener(ConfigManager_UpdateLanguage);
            _configManager.RemovePropertyChangeListener(ConfigManager_UpdateRangeFilter);

            _configManager.RemovePropertyChangeListener(ConfigManager_UpdateVisibleChannel);
            _configManager.RemovePropertyChangeListener(ConfigManager_UpdateUpdateRangeFilterActive);

            _updater.Dispose();

            _updater       = null;
            _chatManager   = null;
            _container     = null;
            _configManager = null;
            _memoryManager = null;
        }