mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-11-05 02:47:21 +00:00
Moved all extension methods into extension blocks (#1155)
This commit is contained in:
1 parent
acc7d09fa2
commit
c0a75f39ac
138 files changed
+5884
-4954
No files matched your search
@@ -2,20 +2,23 @@ namespace AIStudio.Chat;
|
||||
|
||||
public static class SetFileAttachmentExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Attaches a file in place of the attachment of the same file the set held before.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The attachments differ by more than their files: one of a message being edited holds the
|
||||
/// entry of the text it was sent with, and the size of the file may have changed since. Both
|
||||
/// would stay in the set, and the message would go with the old and the new text of the file.
|
||||
/// Attaching a file again means the file as it is now.
|
||||
/// </remarks>
|
||||
/// <param name="attachments">The attachments of a message.</param>
|
||||
/// <param name="attachment">The attachment of the file just attached.</param>
|
||||
public static void AttachInPlaceOfSameFile(this HashSet<FileAttachment> attachments, FileAttachment attachment)
|
||||
extension(HashSet<FileAttachment> attachments)
|
||||
{
|
||||
attachments.RemoveWhere(existing => string.Equals(existing.FilePath, attachment.FilePath, StringComparison.Ordinal));
|
||||
attachments.Add(attachment);
|
||||
/// <summary>
|
||||
/// Attaches a file in place of the attachment of the same file the set held before.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The attachments differ by more than their files: one of a message being edited holds the
|
||||
/// entry of the text it was sent with, and the size of the file may have changed since. Both
|
||||
/// would stay in the set, and the message would go with the old and the new text of the file.
|
||||
/// Attaching a file again means the file as it is now.
|
||||
/// </remarks>
|
||||
/// <param name="attachment">The attachment of the file just attached.</param>
|
||||
public void AttachInPlaceOfSameFile(FileAttachment attachment)
|
||||
{
|
||||
attachments.RemoveWhere(existing => string.Equals(existing.FilePath, attachment.FilePath, StringComparison.Ordinal));
|
||||
attachments.Add(attachment);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user