예제 #1
0
 internal BoxFileMetaData(BoxItemInternal fileInfo, ItemCollectionInternal versions) : this(fileInfo ) {
     if (versions != null)
     {
         //TODO: convert the version info to the external objects here
         //this.Versions = versions.Entries.Select(  );
     }
 }
예제 #2
0
 internal BoxFileMetaData(BoxItemInternal fileInfo)
 {
     this.Id           = fileInfo.Id;
     this.Name         = fileInfo.Name;
     this.Size         = fileInfo.Size ?? 0;
     this.ModifiedDate = fileInfo.Modified_At;
     this.Path         = Utilities.GetPath(fileInfo);
     this.IsFolder     = false;
     this.IsDeleted    = Utilities.IsItemDeleted(fileInfo);
     this.Root         = "0";
     this.Version      = fileInfo.ETag;
 }
예제 #3
0
        internal BoxFolderMetaData(BoxItemInternal folderInfo)
        {
            this.Id        = folderInfo.Id;
            this.Name      = (this.Id != "0") ? folderInfo.Name : string.Empty;
            this.Size      = folderInfo.Size ?? 0;
            this.Path      = Utilities.GetPath(folderInfo);
            this.IsFolder  = true;
            this.IsDeleted = Utilities.IsItemDeleted(folderInfo);
            this.Root      = "0";

            string concat = this.Path != null && this.Path.EndsWith("/") ? "{0}{1}" : "{0}/{1}";

            if ((folderInfo.Item_Collection != null) && (folderInfo.Item_Collection.Entries != null))
            {
                var thisFiles   = new List <BoxFileMetaData>( );
                var thisFolders = new List <BoxFolderMetaData>( );

                foreach (var item in folderInfo.Item_Collection.Entries)
                {
                    if (item.Type.ToLowerInvariant( ) == "file")
                    {
                        var file = new BoxFileMetaData(item);
                        file.Path = string.Format(concat, this.Path, file.Name);
                        thisFiles.Add(file);
                    }
                    else
                    {
                        var folder = new BoxFolderMetaData(item);
                        folder.Path = string.Format(concat, this.Path, folder.Name);
                        thisFolders.Add(folder);
                    }
                }

                this.Files   = thisFiles.ConvertAll(x => (FileMetaDataBase)x);
                this.Folders = thisFolders.ConvertAll(x => (FolderMetaDataBase)x);
            }
            else
            {
                this.Folders = null;
                this.Files   = null;
            }
        }