Пример #1
0
        internal DiskInformation ToDiskInformation()
        {
            var result = new DiskInformation {
                index        = this.Index.ToString(),
                type         = this.Type,
                state        = this.State,
                content_type = this.ContentType,
                available    = this.Available,
                name         = this.Name,
                content      = new List <ContentInformation> ()
            };

            foreach (var content_item in this.Content)
            {
                var content = new ContentInformation {
                    name     = content_item.Name,
                    backward = content_item.HasPrev()
                                                                        ? new LinkedLinkInformation {
                        index =
                            content_item
                            .Prev.Disk.
                            Index.
                            ToString(),
                        name =
                            content_item
                            .Prev.Name
                    }
                                                                        : null,
                    forward = content_item.HasNext()
                                                                       ? new LinkedLinkInformation {
                        index =
                            content_item.
                            Next.Disk.
                            Index.
                            ToString(),
                        name =
                            content_item.
                            Next.Name
                    }
                                                                       : null,
                    file_links = new List <LinkInformation> ()
                };

                foreach (var file_link in content_item)
                {
                    content.file_links.Add(new LinkInformation {
                        reference = file_link.Path
                    });
                }

                result.content.Add(content);
            }

            if (this.FileTree != null)
            {
                result.files = new FolderInformation();
                this.SaveFolderInformation(result.files, this.FileTree.Root as IFolder);
            }

            return(result);
        }
Пример #2
0
        internal DiskInformation ToDiskInformation () {
            var result = new DiskInformation {
                                                 index = this.Index.ToString (),
                                                 type = this.Type,
                                                 state = this.State,
                                                 content_type = this.ContentType,
                                                 available = this.Available,
                                                 name = this.Name,
                                                 content = new List <ContentInformation> ()
                                             };

            foreach (var content_item in this.Content) {
                var content = new ContentInformation {
                                                         name = content_item.Name,
                                                         backward = content_item.HasPrev ()
                                                                        ? new LinkedLinkInformation {
                                                                                                        index =
                                                                                                            content_item
                                                                                                            .Prev.Disk.
                                                                                                            Index.
                                                                                                            ToString (),
                                                                                                        name =
                                                                                                            content_item
                                                                                                            .Prev.Name
                                                                                                    }
                                                                        : null,
                                                         forward = content_item.HasNext ()
                                                                       ? new LinkedLinkInformation {
                                                                                                       index =
                                                                                                           content_item.
                                                                                                           Next.Disk.
                                                                                                           Index.
                                                                                                           ToString (),
                                                                                                       name =
                                                                                                           content_item.
                                                                                                           Next.Name
                                                                                                   }
                                                                       : null,
                                                         file_links = new List <LinkInformation> ()
                                                     };

                foreach (var file_link in content_item)
                    content.file_links.Add (new LinkInformation { reference = file_link.Path });

                result.content.Add (content);
            }

            if (this.FileTree != null) {
                result.files = new FolderInformation ();
                this.SaveFolderInformation (result.files, this.FileTree.Root as IFolder);
            }

            return result;
        }