 0c87e84f25
			
		
	
	0c87e84f25
	
	
	
		
			
			* move stuff out into file transfer manager * obnoxious unsupported version text, adjustments to filetransfermanager * add back file upload transfer progress * restructure code * cleanup some more stuff I guess * downloadids by playername * individual anim/sound bs * fix migration stuff, finalize impl of individual sound/anim pause * fixes with logging stuff * move download manager to transient * rework dl ui first iteration * some refactoring and cleanup * more code cleanup * refactoring * switch to hostbuilder * some more rework I guess * more refactoring * clean up mediator calls and disposal * fun code cleanup * push error message when log level is set to anything but information in non-debug builds * remove notificationservice * move message to after login * add download bars to gameworld * fixes download progress bar * set gpose ui min and max size * remove unnecessary usings * adjustments to reconnection logic * add options to set visible/offline groups visibility * add impl of uploading display, transfer list in settings ui * attempt to fix issues with server selection * add back download status to compact ui * make dl bar fixed size based * some fixes for upload/download handling * adjust text from Syncing back to Uploading --------- Co-authored-by: rootdarkarchon <root.darkarchon@outlook.com> Co-authored-by: Stanley Dimant <stanley.dimant@varian.com>
		
			
				
	
	
		
			97 lines
		
	
	
		
			3.6 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			97 lines
		
	
	
		
			3.6 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
| using Dalamud.Game.Command;
 | |
| using MareSynchronos.FileCache;
 | |
| using MareSynchronos.Services.Mediator;
 | |
| using MareSynchronos.Services.ServerConfiguration;
 | |
| using MareSynchronos.UI;
 | |
| using MareSynchronos.WebAPI;
 | |
| 
 | |
| namespace MareSynchronos.Services;
 | |
| 
 | |
| public sealed class CommandManagerService : IDisposable
 | |
| {
 | |
|     private const string _commandName = "/mare";
 | |
| 
 | |
|     private readonly ApiController _apiController;
 | |
|     private readonly CommandManager _commandManager;
 | |
|     private readonly MareMediator _mediator;
 | |
|     private readonly PerformanceCollectorService _performanceCollectorService;
 | |
|     private readonly PeriodicFileScanner _periodicFileScanner;
 | |
|     private readonly ServerConfigurationManager _serverConfigurationManager;
 | |
|     private readonly UiService _uiService;
 | |
| 
 | |
|     public CommandManagerService(CommandManager commandManager, PerformanceCollectorService performanceCollectorService,
 | |
|         UiService uiService, ServerConfigurationManager serverConfigurationManager, PeriodicFileScanner periodicFileScanner,
 | |
|         ApiController apiController, MareMediator mediator)
 | |
|     {
 | |
|         _commandManager = commandManager;
 | |
|         _performanceCollectorService = performanceCollectorService;
 | |
|         _uiService = uiService;
 | |
|         _serverConfigurationManager = serverConfigurationManager;
 | |
|         _periodicFileScanner = periodicFileScanner;
 | |
|         _apiController = apiController;
 | |
|         _mediator = mediator;
 | |
| 
 | |
|         _commandManager.AddHandler(_commandName, new CommandInfo(OnCommand)
 | |
|         {
 | |
|             HelpMessage = "Opens the Mare Synchronos UI"
 | |
|         });
 | |
|     }
 | |
| 
 | |
|     public void Dispose()
 | |
|     {
 | |
|         _commandManager.RemoveHandler(_commandName);
 | |
|     }
 | |
| 
 | |
|     private void OnCommand(string command, string args)
 | |
|     {
 | |
|         var splitArgs = args.ToLowerInvariant().Trim().Split(" ", StringSplitOptions.RemoveEmptyEntries);
 | |
| 
 | |
|         if (splitArgs == null || splitArgs.Length == 0)
 | |
|         {
 | |
|             // Interpret this as toggling the UI
 | |
|             _uiService.ToggleUi();
 | |
|             return;
 | |
|         }
 | |
| 
 | |
|         if (string.Equals(splitArgs[0], "toggle", StringComparison.OrdinalIgnoreCase))
 | |
|         {
 | |
|             if (_serverConfigurationManager.CurrentServer == null) return;
 | |
|             var fullPause = splitArgs.Length > 1 ? splitArgs[1] switch
 | |
|             {
 | |
|                 "on" => false,
 | |
|                 "off" => true,
 | |
|                 _ => !_serverConfigurationManager.CurrentServer.FullPause,
 | |
|             } : !_serverConfigurationManager.CurrentServer.FullPause;
 | |
| 
 | |
|             if (fullPause != _serverConfigurationManager.CurrentServer.FullPause)
 | |
|             {
 | |
|                 _serverConfigurationManager.CurrentServer.FullPause = fullPause;
 | |
|                 _serverConfigurationManager.Save();
 | |
|                 _ = _apiController.CreateConnections();
 | |
|             }
 | |
|         }
 | |
|         else if (string.Equals(splitArgs[0], "gpose", StringComparison.OrdinalIgnoreCase))
 | |
|         {
 | |
|             _mediator.Publish(new UiToggleMessage(typeof(GposeUi)));
 | |
|         }
 | |
|         else if (string.Equals(splitArgs[0], "rescan", StringComparison.OrdinalIgnoreCase))
 | |
|         {
 | |
|             _periodicFileScanner.InvokeScan(forced: true);
 | |
|         }
 | |
|         else if (string.Equals(splitArgs[0], "perf", StringComparison.OrdinalIgnoreCase))
 | |
|         {
 | |
|             if (splitArgs.Length > 1 && int.TryParse(splitArgs[1], out var limitBySeconds))
 | |
|             {
 | |
|                 _performanceCollectorService.PrintPerformanceStats(limitBySeconds);
 | |
|             }
 | |
|             else
 | |
|             {
 | |
|                 _performanceCollectorService.PrintPerformanceStats();
 | |
|             }
 | |
|         }
 | |
|         else if (string.Equals(splitArgs[0], "medi", StringComparison.OrdinalIgnoreCase))
 | |
|         {
 | |
|             _mediator.PrintSubscriberInfo();
 | |
|         }
 | |
|     }
 | |
| } |