當前位置: 首頁>>代碼示例>>C#>>正文


C# CloudFilesProvider.ListObjects方法代碼示例

本文整理匯總了C#中net.openstack.Providers.Rackspace.CloudFilesProvider.ListObjects方法的典型用法代碼示例。如果您正苦於以下問題:C# CloudFilesProvider.ListObjects方法的具體用法?C# CloudFilesProvider.ListObjects怎麽用?C# CloudFilesProvider.ListObjects使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.openstack.Providers.Rackspace.CloudFilesProvider的用法示例。


在下文中一共展示了CloudFilesProvider.ListObjects方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: CFProviderListContainerObjects

        protected void CFProviderListContainerObjects(string cfcontainername, string dcregion, bool dcsnet = true)
        {
            var identity = new RackspaceCloudIdentity() { Username = CFUsernameText.Text, APIKey = CFApiKeyText.Text };

            CloudIdentityProvider identityProvider = new net.openstack.Providers.Rackspace.CloudIdentityProvider(identity);
            CloudFilesProvider CloudFilesProvider = new net.openstack.Providers.Rackspace.CloudFilesProvider(identity);

            var Cfobjects = CloudFilesProvider.ListObjects(cfcontainername, null, null, null, dcregion, dcsnet);

            CFContainerContentsDDL.DataSource = Cfobjects;
            CFContainerContentsDDL.DataTextField = "Name";
            CFContainerContentsDDL.DataBind();
        }
開發者ID:ravikamachi,項目名稱:OpenStackDotNet-Test,代碼行數:13,代碼來源:CloudFiles.aspx.cs

示例2: ListContainer

        private IEnumerable<ContainerObject> ListContainer(CloudIdentity cloudIdentity, string container, int? limit = null, string prefix = null, string region = null, bool useInternalUrl = false) {
            var provider = new CloudFilesProvider(cloudIdentity);

            ContainerObject lastContainerObject = null;

            do {
                string marker = lastContainerObject != null ? lastContainerObject.Name : null;
                IEnumerable<ContainerObject> containerObjects = provider.ListObjects(container, limit, marker, null, prefix, region, useInternalUrl, cloudIdentity);
                lastContainerObject = null;
                foreach (ContainerObject containerObject in containerObjects) {
                    lastContainerObject = containerObject;
                    yield return containerObject;
                }
            } while (lastContainerObject != null);

        }
開發者ID:pjcunningham,項目名稱:SwiftClient.Net,代碼行數:16,代碼來源:Provider.cs

示例3: DownloadFromRackSpaceCloudFiles

        public bool DownloadFromRackSpaceCloudFiles()
        {
            bool syncSucceeded = true;
            try
            {
                var cloudIdentity = new CloudIdentity() { APIKey = this.apiKey, Username = this.username };
                var cloudFilesProvider = new CloudFilesProvider(cloudIdentity);
                IEnumerable<ContainerObject> containerObjectList = cloudFilesProvider.ListObjects(container);

                foreach (ContainerObject containerObject in containerObjectList)
                {
                    cloudFilesProvider.GetObjectSaveToFile(container, localSource, containerObject.Name, containerObject.Name);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception in downloading from rackspace: " + e);
                syncSucceeded = false;
            }
            return syncSucceeded;
        }
開發者ID:smosgin,項目名稱:labofthings,代碼行數:21,代碼來源:RackspaceCloudFilesSynchronizer.cs

示例4: Should_Create_Object_From_File_Without_Headers

        public void Should_Create_Object_From_File_Without_Headers()
        {
            string filePath = Path.Combine(Directory.GetCurrentDirectory(), objectName);
            string fileName = Path.GetFileName(filePath);
            var headers = new Dictionary<string, string>();
            var provider = new CloudFilesProvider(_testIdentity);
            provider.CreateObjectFromFile(containerName, filePath, fileName, 65536, headers, identity: _testIdentity);

            var containerGetObjectsResponse = provider.ListObjects(containerName, identity: _testIdentity);
            Assert.AreEqual(fileName, containerGetObjectsResponse.Where(x => x.Name.Equals(fileName, StringComparison.InvariantCultureIgnoreCase)).FirstOrDefault().Name);
        }
開發者ID:Dan-Pallone-II,項目名稱:openstack.net,代碼行數:11,代碼來源:CloudFilesTests.cs

示例5: Should_Create_Object_From_File_With_Headers

        public void Should_Create_Object_From_File_With_Headers()
        {
            string filePath = Path.Combine(Directory.GetCurrentDirectory(), objectName);
            string fileName = Path.GetFileName(filePath);
            Stream stream = System.IO.File.OpenRead(filePath);
            var etag = GetMD5Hash(filePath);
            stream.Position = 0;
            var headers = new Dictionary<string, string>();
            headers.Add("ETag", etag);
            int cnt = 0;
            var info = new FileInfo(filePath);
            var totalBytest = info.Length;
            var provider = new CloudFilesProvider(_testIdentity);
            provider.CreateObjectFromFile(containerName, filePath, fileName, 65536, headers, null, (bytesWritten) =>
            {
                cnt = cnt + 1;
                if (cnt % 10 != 0)
                    return;

                var x = (float)bytesWritten / (float)totalBytest;
                var percentCompleted = (float)x * 100.00;

                Console.WriteLine(string.Format("{0:0.00} % Completed (Writen: {1} of {2})", percentCompleted, bytesWritten, totalBytest));
            });

            var containerGetObjectsResponse = provider.ListObjects(containerName, identity: _testIdentity);
            Assert.AreEqual(fileName, containerGetObjectsResponse.Where(x => x.Name.Equals(fileName, StringComparison.InvariantCultureIgnoreCase)).FirstOrDefault().Name);

            var objectHeadersResponse = provider.GetObjectHeaders(containerName, fileName, identity: _testIdentity);

            Assert.IsNotNull(objectHeadersResponse);
            Assert.AreEqual(etag, objectHeadersResponse.Where(x => x.Key.Equals("ETag", StringComparison.InvariantCultureIgnoreCase)).FirstOrDefault().Value);
        }
開發者ID:Dan-Pallone-II,項目名稱:openstack.net,代碼行數:33,代碼來源:CloudFilesTests.cs

示例6: Should_Create_Object_From_Stream_Without_Headers

        public void Should_Create_Object_From_Stream_Without_Headers()
        {
            string fileName = objectName;
            Stream stream = System.IO.File.OpenRead(objectName);
            stream.Position = 0;

            var headers = new Dictionary<string, string>();
            var provider = new CloudFilesProvider(_testIdentity);
            provider.CreateObject(containerName, stream, fileName, 65536, headers);

            var containerGetObjectsResponse = provider.ListObjects(containerName, identity: _testIdentity);
            Assert.AreEqual(fileName, containerGetObjectsResponse.Where(x => x.Name.Equals(fileName, StringComparison.InvariantCultureIgnoreCase)).FirstOrDefault().Name);

        }
開發者ID:Dan-Pallone-II,項目名稱:openstack.net,代碼行數:14,代碼來源:CloudFilesTests.cs

示例7: Should_Throw_An_Exception_When_Calling_Get_Objects_From_Container_And_Objects_Does_Not_Exist

 public void Should_Throw_An_Exception_When_Calling_Get_Objects_From_Container_And_Objects_Does_Not_Exist()
 {
     var provider = new CloudFilesProvider();
     var containerGetObjectsResponse = provider.ListObjects(containerName, identity: _testIdentity);
     Assert.Fail("Expected exception was not thrown.");
 }
開發者ID:Dan-Pallone-II,項目名稱:openstack.net,代碼行數:6,代碼來源:CloudFilesTests.cs

示例8: Should_Get_Objects_From_Container

        public void Should_Get_Objects_From_Container()
        {
            var provider = new CloudFilesProvider();
            var containerGetObjectsResponse = provider.ListObjects(containerName, identity: _testIdentity);

            Assert.IsNotNull(containerGetObjectsResponse);
        }
開發者ID:Dan-Pallone-II,項目名稱:openstack.net,代碼行數:7,代碼來源:CloudFilesTests.cs

示例9: Should_Bulk_Delete_All_Objects

        public void Should_Bulk_Delete_All_Objects()
        {
            var provider = new CloudFilesProvider(_testIdentity);

            provider.BulkDelete(provider.ListObjects(containerName2).Select(o => string.Format("{0}/{1}", containerName2, o.Name)));

            var objects = provider.ListObjects(containerName2).ToArray();

            Assert.AreEqual(0, objects.Count());
        }
開發者ID:jonwalton,項目名稱:openstack.net,代碼行數:10,代碼來源:CloudFilesTests.cs

示例10: Should_Delete_Object_But_Not_The_Segments

        public void Should_Delete_Object_But_Not_The_Segments()
        {
            var provider = new CloudFilesProvider(_testIdentity);

            provider.DeleteObject(containerName2, objectName, deleteSegments: false);

            var objects = provider.ListObjects(containerName2).ToArray();

            Assert.AreEqual(11, objects.Count());
            Assert.IsFalse(objects.Any(o => o.Name.Equals(objectName)));
            for (int i = 0; i < 11; i++)
            {
                Assert.IsTrue(objects.Any(o => o.Name.Equals(string.Format("{0}.seg{1}", objectName, i.ToString("0000")))));
            }
        }
開發者ID:jonwalton,項目名稱:openstack.net,代碼行數:15,代碼來源:CloudFilesTests.cs

示例11: Should_Upload_File_In_Segments

        public void Should_Upload_File_In_Segments()
        {
            var provider = new CloudFilesProvider(_testIdentity);

            string filePath = Path.Combine(Directory.GetCurrentDirectory(), objectName);

            provider.CreateObjectFromFile(containerName2, filePath);

            var objects = provider.ListObjects(containerName2).ToArray();

            Assert.AreEqual(12, objects.Count());
            Assert.IsTrue(objects.Any(o => o.Name.Equals(objectName)));
            for (int i = 0; i < 11; i++)
            {
                Assert.IsTrue(objects.Any(o => o.Name.Equals(string.Format("{0}.seg{1}", objectName, i.ToString("0000")))));
            }
        }
開發者ID:jonwalton,項目名稱:openstack.net,代碼行數:17,代碼來源:CloudFilesTests.cs

示例12: Should_Create_Object_From_File_With_Headers

        public void Should_Create_Object_From_File_With_Headers()
        {
            string filePath = Path.Combine(Directory.GetCurrentDirectory(), objectName);
            var etag = GetMD5Hash(filePath);
            var headers = new Dictionary<string, string> {{"ETag", etag}};
            var provider = new CloudFilesProvider(_testIdentity);
            provider.CreateObjectFromFile(containerName, filePath, objectName, headers: headers);

            var containerGetObjectsResponse = provider.ListObjects(containerName, identity: _testIdentity);
            Assert.AreEqual(objectName, containerGetObjectsResponse.Where(x => x.Name.Equals(objectName, StringComparison.InvariantCultureIgnoreCase)).FirstOrDefault().Name);

            var objectHeadersResponse = provider.GetObjectHeaders(containerName, objectName, identity: _testIdentity);

            Assert.IsNotNull(objectHeadersResponse);
            Assert.AreEqual(etag, objectHeadersResponse.Where(x => x.Key.Equals("ETag", StringComparison.InvariantCultureIgnoreCase)).FirstOrDefault().Value);
        }
開發者ID:brendanseabrook,項目名稱:openstack.net,代碼行數:16,代碼來源:CloudFilesTests.cs

示例13: Should_Create_Object_From_Stream_With_Headers

        public void Should_Create_Object_From_Stream_With_Headers()
        {
            var etag = GetMD5Hash(objectName);
            var headers = new Dictionary<string, string> {{"ETag", etag}};
            var provider = new CloudFilesProvider(_testIdentity);
            using (var stream = File.OpenRead(objectName))
            {
                provider.CreateObject(containerName, stream, objectName, headers: headers);
            }

            var containerGetObjectsResponse = provider.ListObjects(containerName, identity: _testIdentity);
            Assert.AreEqual(objectName, containerGetObjectsResponse.Where(x => x.Name.Equals(objectName, StringComparison.InvariantCultureIgnoreCase)).FirstOrDefault().Name);

            var objectHeadersResponse = provider.GetObjectHeaders(containerName, objectName, identity: _testIdentity);

            Assert.IsNotNull(objectHeadersResponse);
            Assert.AreEqual(etag, objectHeadersResponse.Where(x => x.Key.Equals("ETag", StringComparison.InvariantCultureIgnoreCase)).FirstOrDefault().Value);
        }
開發者ID:brendanseabrook,項目名稱:openstack.net,代碼行數:18,代碼來源:CloudFilesTests.cs

示例14: Should_Bulk_Delete_All_Objects

        public void Should_Bulk_Delete_All_Objects()
        {
            var provider = new CloudFilesProvider(_testIdentity);
            provider.LargeFileBatchThreshold = 81920;

            provider.BulkDelete(provider.ListObjects(containerName2).Select(o => new KeyValuePair<string, string>(containerName2, o.Name)));

            var objects = provider.ListObjects(containerName2).ToArray();

            Assert.AreEqual(0, objects.Count());
        }
開發者ID:charlyraffellini,項目名稱:openstack.net,代碼行數:11,代碼來源:CloudFilesTests.cs

示例15: Should_Delete_Object_And_All_Segments

        public void Should_Delete_Object_And_All_Segments()
        {
            var provider = new CloudFilesProvider(_testIdentity);
            provider.LargeFileBatchThreshold = 81920;

            provider.DeleteObject(containerName2, objectName, deleteSegments: true);

            var objects = provider.ListObjects(containerName2).ToArray();

            Assert.AreEqual(0, objects.Count());
            Assert.IsFalse(objects.Any(o => o.Name.Equals(objectName)));
            for (int i = 0; i < 11; i++)
            {
                Assert.IsFalse(objects.Any(o => o.Name.Equals(string.Format("{0}.seg{1}", objectName, i.ToString("0000")))));
            }
        }
開發者ID:charlyraffellini,項目名稱:openstack.net,代碼行數:16,代碼來源:CloudFilesTests.cs


注:本文中的net.openstack.Providers.Rackspace.CloudFilesProvider.ListObjects方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。