AWSSDK.IntegrationTests.S3.S3TestUtils.GetFileHelper C# (CSharp) Метод

GetFileHelper() публичный статический Метод

public static GetFileHelper ( string fileName ) : string
fileName string
Результат string
        public static string GetFileHelper(string fileName)
        {
            string filePath = null;
            AutoResetEvent ars = new AutoResetEvent(false);
            Amazon.Runtime.Internal.UnityRequestQueue.Instance.ExecuteOnMainThread(() =>
            {
                filePath = Application.persistentDataPath + Path.DirectorySeparatorChar + fileName;
                if (!File.Exists(filePath))
                {
                    var streamReader = File.CreateText(Application.persistentDataPath + Path.DirectorySeparatorChar + fileName);
                    streamReader.WriteLine("This is a file uploaded from unity s3 tests");
                    streamReader.Close();
                }
                ars.Set();
            });
            ars.WaitOne();
            return filePath;
        }

Usage Example

Пример #1
0
        public void Initialize()
        {
            relativeFilePath = S3TestUtils.GetFileHelper("PutObjectFile.txt");

            using (StreamWriter writer = File.CreateText(relativeFilePath))
            {
                writer.Write("This is some sample text.!!");
                writer.Close();
            }
            bucketName = "unity-test-bucket" + DateTime.Now.Ticks;

            AutoResetEvent ars       = new AutoResetEvent(false);
            Exception      exception = null;

            Client.PutBucketAsync(bucketName, (result) =>
            {
                if (result.Exception != null)
                {
                    exception = result.Exception;
                }

                ars.Set();
            });

            ars.WaitOne();
            if (exception != null)
            {
                throw exception;
            }
        }
All Usage Examples Of AWSSDK.IntegrationTests.S3.S3TestUtils::GetFileHelper