Skip to content

Commit

Permalink
[Core] Minor code refactor towards OperationLogic.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
Linwenxuan04 committed Sep 9, 2024
1 parent dbb259c commit 391909f
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 21 deletions.
2 changes: 1 addition & 1 deletion Lagrange.Core/Common/Entity/IBotFSEntry.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace Lagrange.Core.Common.Entity;

/// <summary>
/// Indicate that it is a element in BotFileSystem
/// Indicate that it is an element in BotFileSystem
/// </summary>
public interface IBotFSEntry { }
10 changes: 5 additions & 5 deletions Lagrange.Core/Common/Interface/Api/GroupExt.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,19 +104,19 @@ public static Task<List<IBotFSEntry>> FetchGroupFSList(this BotContext bot, uint
public static Task<string> FetchGroupFSDownload(this BotContext bot, uint groupUin, string fileId)
=> bot.ContextCollection.Business.OperationLogic.FetchGroupFSDownload(groupUin, fileId);

public static Task<(int, string)> GroupFSMove(this BotContext bot, uint groupUin, string fileId, string parentDirectory, string targetDirectory)
public static Task<(int RetCode, string RetMsg)> GroupFSMove(this BotContext bot, uint groupUin, string fileId, string parentDirectory, string targetDirectory)
=> bot.ContextCollection.Business.OperationLogic.GroupFSMove(groupUin, fileId, parentDirectory, targetDirectory);

public static Task<(int, string)> GroupFSDelete(this BotContext bot, uint groupUin, string fileId)
public static Task<(int RetCode, string RetMsg)> GroupFSDelete(this BotContext bot, uint groupUin, string fileId)
=> bot.ContextCollection.Business.OperationLogic.GroupFSDelete(groupUin, fileId);

public static Task<(int, string)> GroupFSCreateFolder(this BotContext bot, uint groupUin, string name)
public static Task<(int RetCode, string RetMsg)> GroupFSCreateFolder(this BotContext bot, uint groupUin, string name)
=> bot.ContextCollection.Business.OperationLogic.GroupFSCreateFolder(groupUin, name);

public static Task<(int, string)> GroupFSDeleteFolder(this BotContext bot, uint groupUin, string folderId)
public static Task<(int RetCode, string RetMsg)> GroupFSDeleteFolder(this BotContext bot, uint groupUin, string folderId)
=> bot.ContextCollection.Business.OperationLogic.GroupFSDeleteFolder(groupUin, folderId);

public static Task<(int, string)> GroupFSRenameFolder(this BotContext bot, uint groupUin, string folderId, string newFolderName)
public static Task<(int RetCode, string RetMsg)> GroupFSRenameFolder(this BotContext bot, uint groupUin, string folderId, string newFolderName)
=> bot.ContextCollection.Business.OperationLogic.GroupFSRenameFolder(groupUin, folderId, newFolderName);

public static Task<bool> GroupFSUpload(this BotContext bot, uint groupUin, FileEntity fileEntity, string targetDirectory = "/")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,45 +170,45 @@ public async Task<string> FetchGroupFSDownload(uint groupUin, string fileId)
{
var groupFSMoveEvent = GroupFSMoveEvent.Create(groupUin, fileId, parentDirectory, targetDirectory);
var events = await Collection.Business.SendEvent(groupFSMoveEvent);
var retCode = events.Count > 0 ? ((GroupFSMoveEvent)events[0]).ResultCode : -1;
var retMsg = events.Count > 0 ? ((GroupFSMoveEvent)events[0]).RetMsg : "";
return new(retCode, retMsg);
int retCode = events.Count > 0 ? ((GroupFSMoveEvent)events[0]).ResultCode : -1;
string retMsg = events.Count > 0 ? ((GroupFSMoveEvent)events[0]).RetMsg : string.Empty;
return (retCode, retMsg);
}

public async Task<(int, string)> GroupFSDelete(uint groupUin, string fileId)
{
var groupFSDeleteEvent = GroupFSDeleteEvent.Create(groupUin, fileId);
var events = await Collection.Business.SendEvent(groupFSDeleteEvent);
var retCode = events.Count > 0 ? ((GroupFSDeleteEvent)events[0]).ResultCode : -1;
var retMsg = events.Count > 0 ? ((GroupFSDeleteEvent)events[0]).RetMsg : "";
return new(retCode, retMsg);
int retCode = events.Count > 0 ? ((GroupFSDeleteEvent)events[0]).ResultCode : -1;
string retMsg = events.Count > 0 ? ((GroupFSDeleteEvent)events[0]).RetMsg : string.Empty;
return (retCode, retMsg);
}

public async Task<(int, string)> GroupFSCreateFolder(uint groupUin, string name)
{
var groupFSCreateFolderEvent = GroupFSCreateFolderEvent.Create(groupUin, name);
var events = await Collection.Business.SendEvent(groupFSCreateFolderEvent);
var retCode = events.Count > 0 ? ((GroupFSCreateFolderEvent)events[0]).ResultCode : -1;
var retMsg = events.Count > 0 ? ((GroupFSCreateFolderEvent)events[0]).RetMsg : "";
return new(retCode, retMsg);
int retCode = events.Count > 0 ? ((GroupFSCreateFolderEvent)events[0]).ResultCode : -1;
string retMsg = events.Count > 0 ? ((GroupFSCreateFolderEvent)events[0]).RetMsg : string.Empty;
return (retCode, retMsg);
}

public async Task<(int, string)> GroupFSDeleteFolder(uint groupUin, string folderId)
{
var groupFSDeleteFolderEvent = GroupFSDeleteFolderEvent.Create(groupUin, folderId);
var events = await Collection.Business.SendEvent(groupFSDeleteFolderEvent);
var retCode = events.Count > 0 ? ((GroupFSDeleteFolderEvent)events[0]).ResultCode : -1;
var retMsg = events.Count > 0 ? ((GroupFSDeleteFolderEvent)events[0]).RetMsg : "";
return new(retCode, retMsg);
int retCode = events.Count > 0 ? ((GroupFSDeleteFolderEvent)events[0]).ResultCode : -1;
string retMsg = events.Count > 0 ? ((GroupFSDeleteFolderEvent)events[0]).RetMsg : string.Empty;
return (retCode, retMsg);
}

public async Task<(int, string)> GroupFSRenameFolder(uint groupUin, string folderId, string newFolderName)
{
var groupFSDeleteFolderEvent = GroupFSRenameFolderEvent.Create(groupUin, folderId, newFolderName);
var events = await Collection.Business.SendEvent(groupFSDeleteFolderEvent);
var retCode = events.Count > 0 ? ((GroupFSRenameFolderEvent)events[0]).ResultCode : -1;
var retMsg = events.Count > 0 ? ((GroupFSRenameFolderEvent)events[0]).RetMsg : "";
return new(retCode, retMsg);
int retCode = events.Count > 0 ? ((GroupFSRenameFolderEvent)events[0]).ResultCode : -1;
string retMsg = events.Count > 0 ? ((GroupFSRenameFolderEvent)events[0]).RetMsg : "";
return (retCode, retMsg);
}

public Task<bool> GroupFSUpload(uint groupUin, FileEntity fileEntity, string targetDirectory)
Expand Down

0 comments on commit 391909f

Please sign in to comment.