diff --git a/test.xaml b/test.xaml
index 75a1af7..791465f 100644
--- a/test.xaml
+++ b/test.xaml
@@ -13,6 +13,7 @@ Title="test" Height="450" Width="800">
+
diff --git a/test.xaml.cs b/test.xaml.cs
index d3d1b7d..6a89660 100644
--- a/test.xaml.cs
+++ b/test.xaml.cs
@@ -19,6 +19,9 @@ using Minio.DataModel.Encryption;
using Microsoft.WindowsAPICodePack.Dialogs;
using System.IO;
using System.Diagnostics;
+using Minio.Exceptions;
+using System.Threading;
+using System.Security.AccessControl;
namespace Hopetry
{
///
@@ -30,6 +33,7 @@ namespace Hopetry
public test()
{
InitializeComponent();
+
// 配置 MinIO 客户端
client = new Minio.MinioClient()
.WithEndpoint("123.132.248.154:9107") // MinIO 服务器地址
@@ -215,6 +219,51 @@ namespace Hopetry
{
}
+
+ private async void Button_Click_1(object sender, RoutedEventArgs e)
+ {
+ try
+ {
+ string bucketName = "test";
+
+ // 检查存储桶是否存在,如果不存在则创建
+ var beArgs = new BucketExistsArgs().WithBucket(bucketName);
+ // Check whether 'mybucket' exist or not.
+ bool found = await client.BucketExistsAsync(beArgs).ConfigureAwait(false);
+ if (found)
+ {
+ // List all incomplete multipart upload of objects in 'mybucket'
+ ListIncompleteUploadsArgs listArgs = new ListIncompleteUploadsArgs()
+ .WithBucket("test")
+ .WithRecursive(true);
+ IAsyncEnumerable observable = client.ListIncompleteUploadsEnumAsync(listArgs);
+ //IDisposable subscription = observable.Subscribe(
+ // item => Console.WriteLine("OnNext: {0}", item.Key),
+ // ex => Console.WriteLine("OnError: {0}", ex.Message),
+ // () => Console.WriteLine("OnComplete: {0}"));
+
+ await foreach (var upload in observable)
+ {
+ // 在这里查看每个 Upload 对象
+ Console.WriteLine($"Upload ID: {upload.UploadId}, Object Name: {upload.Key}");
+ var statObjectArgs = new StatObjectArgs()
+ .WithBucket(bucketName)
+ .WithObject(upload.Key);
+
+ // Get object metadata if it exists
+ var objectStat = await client.StatObjectAsync(statObjectArgs);
+ }
+ }
+ else
+ {
+ Console.WriteLine("mybucket does not exist");
+ }
+ }
+ catch (MinioException ex)
+ {
+ Console.WriteLine("Error occurred: " + ex);
+ }
+ }
}
}
\ No newline at end of file