Esempio n. 1
0
        public async Task HandleAsync(DomainCommandContext context, ConvertTextureCommand command)
        {
            Texture texture = null;

            try
            {
                texture = _textureService.Convert(
                    Path.Combine(command.SourceDirectoryPath, command.FileName),
                    command.Settings);
            }
            catch (Exception exception)
            {
                _logger.Log(LogLevel.Error, $"texture conversion failed; exception: {exception}");
            }

            if (texture?.Metadata == null)
            {
                await context.EmitAsync(new ErrorOccuredNotification());

                return;
            }

            var directory = await _directoryRepository.LoadAsync(command.DestinationDirectoryPath);

            directory.AddFile(command.FileName, texture.Buffer);

            await _directoryRepository.SaveAsync(directory);

            await context.EmitAsync(new ActionSucceededNotification());
        }
Esempio n. 2
0
        private async Task Inject(InjectableProxySettings injectProxySettings)
        {
            _logger.Log(LogLevel.Information, $"injection started for: {FilePath}...");
            await new SynchronizationContextRemover();

            var directory = await _directoryRepository.LoadAsync(injectProxySettings.GameProfile.ProxyDirectoryPath);

            directory.AddFile(_plugins.ProxySettingsFileName, injectProxySettings.Serialize());

            _logger.Log(LogLevel.Information, $"creating proxy settings file at: {FilePath}...");
            await _directoryRepository.SaveAsync(directory);

            _logger.Log(LogLevel.Information, $"attempting to inject proxy dll into: {FilePath}...");
            var status = _injectionService.Inject(_game.FilePath, _plugins.Proxy);

            if (status?.Status == 0)
            {
                _logger.Log(LogLevel.Information, $"proxy dll injected into: {FilePath}");
            }
            else
            {
                _logger.Log(LogLevel.Error, $"proxy dll could not be injected into: {FilePath}; failed with status: {status}");
            }
        }