|
@@ -42,23 +42,7 @@ public class RoomFileMinio : MonoSingleton<RoomFileMinio>
|
|
{
|
|
{
|
|
while (true)
|
|
while (true)
|
|
{
|
|
{
|
|
- if (minio == null)
|
|
+ Debug.Log(" DGJ getFile DoSomeWork Update");
|
|
- {
|
|
|
|
- }
|
|
|
|
- else
|
|
|
|
- {
|
|
|
|
- if (Nowfd != null && !isUpdate)
|
|
|
|
- {
|
|
|
|
- isUpdate = true;
|
|
|
|
- Run().Wait();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if(NowPfd!=null && !isUpload)
|
|
|
|
- {
|
|
|
|
- isUpload = true;
|
|
|
|
- UploadFile().Wait();
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
Thread.Sleep(1000);
|
|
Thread.Sleep(1000);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -71,8 +55,9 @@ public class RoomFileMinio : MonoSingleton<RoomFileMinio>
|
|
}
|
|
}
|
|
Queue<RoomFileDataBack> backQueue = new Queue<RoomFileDataBack>();
|
|
Queue<RoomFileDataBack> backQueue = new Queue<RoomFileDataBack>();
|
|
|
|
|
|
- private async Task Run()
|
|
+ private IEnumerator Run()
|
|
{
|
|
{
|
|
|
|
+ Debug.Log(" DGJ getFile DoSomeWork Run");
|
|
|
|
|
|
StatObjectArgs statObjectArgs = new StatObjectArgs()
|
|
StatObjectArgs statObjectArgs = new StatObjectArgs()
|
|
.WithBucket(Nowfd.bucket)
|
|
.WithBucket(Nowfd.bucket)
|
|
@@ -89,44 +74,60 @@ public class RoomFileMinio : MonoSingleton<RoomFileMinio>
|
|
rfdb.rfd = rfd;
|
|
rfdb.rfd = rfd;
|
|
rfdb.Nowfd = Nowfd;
|
|
rfdb.Nowfd = Nowfd;
|
|
backQueue.Enqueue(rfdb);*/
|
|
backQueue.Enqueue(rfdb);*/
|
|
|
|
+ RoomFileData rfd = new RoomFileData();
|
|
StatObjectArgs statObjectArgs = new StatObjectArgs()
|
|
StatObjectArgs statObjectArgs = new StatObjectArgs()
|
|
.WithBucket(Nowfd.bucket)
|
|
.WithBucket(Nowfd.bucket)
|
|
.WithObject(Nowfd.objectName);
|
|
.WithObject(Nowfd.objectName);
|
|
- await minio.StatObjectAsync(statObjectArgs);
|
|
+ yield return minio.StatObjectAsync(statObjectArgs);
|
|
|
|
|
|
|
|
+ Debug.Log(" miniominiominiominiominiominiominiominiominiominio");
|
|
|
|
|
|
GetObjectArgs getObjectArgs = new GetObjectArgs()
|
|
GetObjectArgs getObjectArgs = new GetObjectArgs()
|
|
.WithBucket(Nowfd.bucket)
|
|
.WithBucket(Nowfd.bucket)
|
|
.WithObject(Nowfd.objectName)
|
|
.WithObject(Nowfd.objectName)
|
|
- .WithCallbackStream(async (stream) =>
|
|
+ .WithCallbackStream((stream) =>
|
|
{
|
|
{
|
|
- PresignedGetObjectArgs args = new PresignedGetObjectArgs()
|
|
+ Debug.Log(" WithCallbackStreamWithCallbackStreamWithCallbackStreamWithCallbackStreamWithCallbackStream");
|
|
- .WithBucket(Nowfd.bucket)
|
|
+ rfd.bytes= StreamToBytes(stream);
|
|
- .WithObject(Nowfd.objectName)
|
|
+
|
|
- .WithExpiry(60 * 60 * 24);
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
|
- string url = await minio.PresignedGetObjectAsync(args);
|
|
|
|
- RoomFileData rfd = new RoomFileData();
|
|
|
|
- rfd.url = url;
|
|
|
|
- rfd.bytes = StreamToBytes(stream);
|
|
|
|
|
|
|
|
|
|
+ });
|
|
|
|
|
|
- RoomFileDataBack rfdb = new RoomFileDataBack();
|
|
+ yield return minio.GetObjectAsync(getObjectArgs);
|
|
- rfdb.rfd = rfd;
|
|
|
|
- rfdb.Nowfd = Nowfd;
|
|
|
|
- backQueue.Enqueue(rfdb);
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
|
|
|
|
|
- });
|
|
+ Debug.Log(" DGJ getFile DoSomeWork RunBack");
|
|
|
|
+ PresignedGetObjectArgs args = new PresignedGetObjectArgs()
|
|
|
|
+ .WithBucket(Nowfd.bucket)
|
|
|
|
+ .WithObject(Nowfd.objectName)
|
|
|
|
+ .WithExpiry(60 * 60 * 24);
|
|
|
|
+ Task<string> tk = minio.PresignedGetObjectAsync(args);
|
|
|
|
+
|
|
|
|
+ Debug.Log(" DGJ getFile DoSomeWork RunBack");
|
|
|
|
+ while (tk.Result == null || tk.Result == ""|| rfd.bytes==null)
|
|
|
|
+ {
|
|
|
|
+ yield return null;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ Debug.Log(" DGJ getFile DoSomeWork rfdb" + tk.Result);
|
|
|
|
+ string url = tk.Result;
|
|
|
|
+ rfd.url = url;
|
|
|
|
+
|
|
|
|
+ Debug.Log(" DGJ getFile DoSomeWork rfdb");
|
|
|
|
+
|
|
|
|
+ RoomFileDataBack rfdb = new RoomFileDataBack();
|
|
|
|
+ rfdb.rfd = rfd;
|
|
|
|
+ rfdb.Nowfd = Nowfd;
|
|
|
|
+ backQueue.Enqueue(rfdb);
|
|
|
|
|
|
- await minio.GetObjectAsync(getObjectArgs);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
- private async Task UploadFile()
|
|
+ private IEnumerator UploadFile()
|
|
{
|
|
{
|
|
|
|
|
|
|
|
|
|
@@ -140,9 +141,9 @@ public class RoomFileMinio : MonoSingleton<RoomFileMinio>
|
|
.WithContentType("application/octet-stream")
|
|
.WithContentType("application/octet-stream")
|
|
.WithObjectSize(NowPfd.fileSize)
|
|
.WithObjectSize(NowPfd.fileSize)
|
|
.WithHeaders(dicheaders);
|
|
.WithHeaders(dicheaders);
|
|
-
|
|
|
|
|
|
|
|
- await minio.PutObjectAsync(putObjectArgs).ConfigureAwait(false);
|
|
+
|
|
|
|
+ yield return minio.PutObjectAsync(putObjectArgs).ConfigureAwait(false);
|
|
|
|
|
|
|
|
|
|
NowPfd.callBack?.Invoke(NowPfd.objectName);
|
|
NowPfd.callBack?.Invoke(NowPfd.objectName);
|
|
@@ -163,9 +164,10 @@ public class RoomFileMinio : MonoSingleton<RoomFileMinio>
|
|
|
|
|
|
void initMinIo(Action<bool> callBack)
|
|
void initMinIo(Action<bool> callBack)
|
|
{
|
|
{
|
|
-
|
|
+
|
|
|
|
+ Debug.Log("DGJ ===> initMinIo ");
|
|
|
|
|
|
- StartCoroutine(HttpTool.Instance.SendHttp(HttpEdustryAction.storage_projectCredential, "", async (string str) =>
|
|
+ StartCoroutine(HttpTool.Instance.SendHttp(HttpEdustryAction.storage_projectCredential, "", (string str) =>
|
|
{
|
|
{
|
|
Debug.Log("DGJ ===> initMinIo " + str);
|
|
Debug.Log("DGJ ===> initMinIo " + str);
|
|
try
|
|
try
|
|
@@ -185,6 +187,7 @@ public class RoomFileMinio : MonoSingleton<RoomFileMinio>
|
|
var secretKey = tmpSecretKey;
|
|
var secretKey = tmpSecretKey;
|
|
Debug.Log("endpoint===>" + endpoint + " isHttps==>" + isHttps);
|
|
Debug.Log("endpoint===>" + endpoint + " isHttps==>" + isHttps);
|
|
|
|
|
|
|
|
+
|
|
if (d["data"]["region"] != null && !string.IsNullOrEmpty(d["data"]["region"].ToString()) && d["data"]["region"].ToString() != "null")
|
|
if (d["data"]["region"] != null && !string.IsNullOrEmpty(d["data"]["region"].ToString()) && d["data"]["region"].ToString() != "null")
|
|
{
|
|
{
|
|
region = d["data"]["region"].ToString();
|
|
region = d["data"]["region"].ToString();
|
|
@@ -282,6 +285,8 @@ public class RoomFileMinio : MonoSingleton<RoomFileMinio>
|
|
{
|
|
{
|
|
NowPfd = pdQueue.Dequeue();
|
|
NowPfd = pdQueue.Dequeue();
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+
|
|
if (minio == null)
|
|
if (minio == null)
|
|
{
|
|
{
|
|
if (islogin&&!isminioUpdate)
|
|
if (islogin&&!isminioUpdate)
|
|
@@ -294,6 +299,20 @@ public class RoomFileMinio : MonoSingleton<RoomFileMinio>
|
|
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ if (Nowfd != null && !isUpdate)
|
|
|
|
+ {
|
|
|
|
+ isUpdate = true;
|
|
|
|
+ StartCoroutine( Run());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (NowPfd != null && !isUpload)
|
|
|
|
+ {
|
|
|
|
+ isUpload = true;
|
|
|
|
+ StartCoroutine(UploadFile());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
if (backQueue.Count > 0)
|
|
if (backQueue.Count > 0)
|
|
{
|
|
{
|
|
RoomFileDataBack rfdb = backQueue.Dequeue();
|
|
RoomFileDataBack rfdb = backQueue.Dequeue();
|