GetFileBytes() публичный Метод

public GetFileBytes ( string domain, string key, int timeoutMilliseconds ) : byte[]
domain string
key string
timeoutMilliseconds int
Результат byte[]
Пример #1
0
        public void Can_upload_file_screenshot()
        {
            var uri = new Uri("mogile://*****:*****@"C:\mogile_test_screenshot_larger.jpg", FileMode.Open))
            {
                arr = new byte[filestream.Length];
                Primelabs.Twingly.MogileFsApi.Utils.ByteReader.ReadWholeArray(filestream, arr);
            }

            var d = "screenshots";
            var key = "test_1";
            var client = new MogileFsClient(new Uri[] { uri });
            var paths = client.GetPaths(d, key, true);
            if (paths != null && paths.Count > 0)
                client.Delete(d, key);

            using (var filestream = new FileStream(@"C:\mogile_test_screenshot_larger.jpg", FileMode.Open)) {
                client.StoreFile(d, key, "original", filestream, 100000);
            }
            paths = client.GetPaths(d, key, true);
            Assert.AreEqual(2, paths.Count);

            byte[] arr2 = client.GetFileBytes(d, key, 10000);
            Assert.AreEqual(arr.Length, arr2.Length, "arr lengths not ok");
            for (int i = 0; i < arr2.Length; i++)
                Assert.AreEqual(arr[i], arr2[i], "contents do not match..");
        }
Пример #2
0
        public void Can_download_file()
        {
            var uri = new Uri("mogile://*****:*****@"C:\mogile_test_small_avatar.jpg", FileMode.Create)) {
                file.Write(arr, 0, arr.Length);
                file.Flush();
            }
        }
Пример #3
0
        public void Can_download_file_screenshot()
        {
            var uri = new Uri("mogile://*****:*****@"C:\mogile_test_screenshot_larger.jpg", FileMode.Create))
            {
                file.Write(arr, 0, arr.Length);
                file.Flush();
            }
        }