Пример #1
0
        public bool SearchObject(string ContainerName, string ObjectName, string ContentType = null)
        {
            if (string.IsNullOrEmpty(ContainerName))
            {
                throw new System.ArgumentException("ContainerName cannot be empty.");
            }

            if (string.IsNullOrEmpty(ObjectName))
            {
                throw new System.ArgumentException("ObjectName cannot be empty.");
            }

            bool Result = false;

            IEnumerable <ConoHaNet.Objects.ContainerObject> ObjectList = ConoHa.ListObjects(ContainerName);

            if ((ObjectList != null) && ObjectList.Count() > 0)
            {
                foreach (var entry in ObjectList)
                {
                    if (ObjectName == entry.Name)
                    {
                        Result = true;
                        break;
                    }
                }
            }

            return(Result);
        }
Пример #2
0
        public System.Collections.Generic.IEnumerable <MyApplication.Objects.ContainerObject> GetContainerObjects(string ContainerName, int?limit = null)
        {
            System.Collections.Generic.IEnumerable <ConoHaNet.Objects.ContainerObject> ObjectList = ConoHa.ListObjects(ContainerName, limit);

            List <MyApplication.Objects.ContainerObject> Result = null;

            if ((ObjectList != null) && ObjectList.Count() > 0)
            {
                Result = new List <MyApplication.Objects.ContainerObject>(ObjectList.Count());

                foreach (var entry in ObjectList)
                {
                    Result.Add(new Objects.ContainerObject(entry.Name, entry.Bytes, entry.Hash, entry.ContentType, entry.LastModified));
                }
            }

            return(Result);
        }