Пример #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 bool SearchContainer(string ContainerName)
        {
            if (string.IsNullOrEmpty(ContainerName))
            {
                throw new System.ArgumentException("ContainerName cannot be empty.");
            }

            bool Result = false;

            IEnumerable <ConoHaNet.Objects.Container> ContainerList = ConoHa.ListContainers();

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

            return(Result);
        }
Пример #3
0
        public bool DeleteObject(string ContainerName, string ObjectName)
        {
            ConoHa.DeleteObject(ContainerName, ObjectName);

            // update container info.
            ConoHa.CreateContainer(ContainerName);

            return(true);
        }
Пример #4
0
        public System.Collections.Generic.IEnumerable <MyApplication.Objects.Container> GetContainers()
        {
            IEnumerable <ConoHaNet.Objects.Container> ContainerList = ConoHa.ListContainers();

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

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

                foreach (var entry in ContainerList)
                {
                    Result.Add(new MyApplication.Objects.Container(entry.Name, entry.Count, entry.Bytes));
                }
            }

            return(Result);
        }
Пример #5
0
        public bool CreateObject(string ContainerName, string ObjectName, Stream Data, eContentType Type)
        {
            ConoHa.CreateObject(ContainerName, Data, ObjectName, this.ContentTypeToString(Type));

            return(true);
        }
Пример #6
0
        public bool DeleteContainer(string ContainerName, bool IsDeleteInObjects = false)
        {
            ConoHa.DeleteContainer(ContainerName, IsDeleteInObjects);

            return(true);
        }
Пример #7
0
 public bool CreateContainer(string ContainerName)
 {
     return((ConoHa.CreateContainer(ContainerName) == ObjectStore.ContainerCreated) ? true : false);
 }
Пример #8
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);
        }