 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>
		
			
				
	
	
		
			90 lines
		
	
	
		
			3.0 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			90 lines
		
	
	
		
			3.0 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
| using MareSynchronos.API.Data;
 | |
| using MareSynchronos.API.Dto.User;
 | |
| using Microsoft.AspNetCore.SignalR.Client;
 | |
| using Microsoft.Extensions.Logging;
 | |
| using System.Text;
 | |
| 
 | |
| namespace MareSynchronos.WebAPI;
 | |
| 
 | |
| public partial class ApiController
 | |
| {
 | |
|     public async Task PushCharacterData(CharacterData data, List<UserData> visibleCharacters)
 | |
|     {
 | |
|         if (!IsConnected) return;
 | |
| 
 | |
|         try
 | |
|         {
 | |
|             await PushCharacterDataInternal(data, visibleCharacters.ToList()).ConfigureAwait(false);
 | |
|         }
 | |
|         catch (OperationCanceledException)
 | |
|         {
 | |
|             Logger.LogDebug("Upload operation was cancelled");
 | |
|         }
 | |
|         catch (Exception ex)
 | |
|         {
 | |
|             Logger.LogWarning(ex, "Error during upload of files");
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     public async Task UserAddPair(UserDto user)
 | |
|     {
 | |
|         if (!IsConnected) return;
 | |
|         await _mareHub!.SendAsync(nameof(UserAddPair), user).ConfigureAwait(false);
 | |
|     }
 | |
| 
 | |
|     public async Task UserDelete()
 | |
|     {
 | |
|         CheckConnection();
 | |
|         await _mareHub!.SendAsync(nameof(UserDelete)).ConfigureAwait(false);
 | |
|         await CreateConnections().ConfigureAwait(false);
 | |
|     }
 | |
| 
 | |
|     public async Task<List<OnlineUserIdentDto>> UserGetOnlinePairs()
 | |
|     {
 | |
|         return await _mareHub!.InvokeAsync<List<OnlineUserIdentDto>>(nameof(UserGetOnlinePairs)).ConfigureAwait(false);
 | |
|     }
 | |
| 
 | |
|     public async Task<List<UserPairDto>> UserGetPairedClients()
 | |
|     {
 | |
|         return await _mareHub!.InvokeAsync<List<UserPairDto>>(nameof(UserGetPairedClients)).ConfigureAwait(false);
 | |
|     }
 | |
| 
 | |
|     public async Task UserPushData(UserCharaDataMessageDto dto)
 | |
|     {
 | |
|         try
 | |
|         {
 | |
|             await _mareHub!.InvokeAsync(nameof(UserPushData), dto).ConfigureAwait(false);
 | |
|         }
 | |
|         catch (Exception ex)
 | |
|         {
 | |
|             Logger.LogWarning(ex, "Failed to Push character data");
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     public async Task UserRemovePair(UserDto userDto)
 | |
|     {
 | |
|         if (!IsConnected) return;
 | |
|         await _mareHub!.SendAsync(nameof(UserRemovePair), userDto).ConfigureAwait(false);
 | |
|     }
 | |
| 
 | |
|     public async Task UserSetPairPermissions(UserPermissionsDto userPermissions)
 | |
|     {
 | |
|         await _mareHub!.SendAsync(nameof(UserSetPairPermissions), userPermissions).ConfigureAwait(false);
 | |
|     }
 | |
| 
 | |
|     private async Task PushCharacterDataInternal(CharacterData character, List<UserData> visibleCharacters)
 | |
|     {
 | |
|         Logger.LogInformation("Pushing character data for {hash} to {charas}", character.DataHash.Value, string.Join(", ", visibleCharacters.Select(c => c.AliasOrUID)));
 | |
|         StringBuilder sb = new();
 | |
|         foreach (var kvp in character.FileReplacements.ToList())
 | |
|         {
 | |
|             sb.AppendLine($"FileReplacements for {kvp.Key}: {kvp.Value.Count}");
 | |
|         }
 | |
|         foreach (var item in character.GlamourerData)
 | |
|         {
 | |
|             sb.AppendLine($"GlamourerData for {item.Key}: {!string.IsNullOrEmpty(item.Value)}");
 | |
|         }
 | |
|         Logger.LogDebug("Chara data contained: {nl} {data}", Environment.NewLine, sb.ToString());
 | |
|         await UserPushData(new(visibleCharacters, character)).ConfigureAwait(false);
 | |
|     }
 | |
| } |