private void SetDefault(Directory directory, DirectoryInfo directoryInfo)
        {
            labelName.Text = directory.Name;
            labelType.Text = "File folder";
            icon.Image     = new Icon(Properties.Resources.Folder, new Size(64, 64)).ToBitmap();
            StringBuilder sb = new StringBuilder();

            if (UserSettings.Mode != Mode.BASIC)
            {
                sb.AppendLine($"Path: {directory.Path}");
            }
            if (directoryInfo != null)
            {
                if (directoryInfo.ItemCount > 0)
                {
                    sb.AppendLine($"Items: {directoryInfo.ItemCount}");
                }
                if (directoryInfo.TotalByteSize > 0)
                {
                    if (UserSettings.Mode == Mode.BASIC)
                    {
                        sb.AppendLine($"Size: {DirectoryContent.ToFileSize(directoryInfo.TotalByteSize)}");
                    }
                    else
                    {
                        sb.AppendLine($"Size: {DirectoryContent.ToByteFileSize(directoryInfo.TotalByteSize)}");
                    }
                }
            }
            textBoxInfo.Text = sb.ToString();
        }
 public void Set(DirectoryInfo info)
 {
     if (info.TotalByteSize == 0)
     {
         toolStripLabel.Text = $"{info.ItemCount} items";
     }
     else
     {
         toolStripLabel.Text = $"{info.ItemCount} items ({DirectoryContent.ToFileSize(info.TotalByteSize)})";
     }
 }
        public async Task Set(File file)
        {
            Clear();

            labelName.Text = file.FileName;
            labelType.Text = DirectoryContent.ToString(file.Type);
            string additionalInfo = null;

            switch (file.Type)
            {
            case FileType.TextFile:
            {
                icon.Image             = new Icon(Properties.Resources.Rtf, new Size(64, 64)).ToBitmap();
                previewContent.Text    = await((TextFile)file).DownloadAsString();
                previewContent.Visible = true;
                break;
            }

            case FileType.SoundFile:
            {
                icon.Image = new Icon(Properties.Resources.Rsf, new Size(64, 64)).ToBitmap();
                break;
            }

            case FileType.GraphicFile:
            {
                icon.Image = new Icon(Properties.Resources.Rgf, new Size(64, 64)).ToBitmap();
                byte[] data = await file.Download();

                Bitmap bitmap = FileConverter.RGFtoBitmap(data, Color.FromArgb(73, 74, 75));
                int    width  = data[0];
                int    height = data[1];
                previewImage.Image   = bitmap;
                additionalInfo       = $"Dimension: {width} x {height} px";
                previewImage.Visible = true;
                break;
            }

            default:
            {
                icon.Image = new Icon(Properties.Resources.File, new Size(64, 64)).ToBitmap();
                break;
            }
            }

            StringBuilder sb = new StringBuilder();

            if (UserSettings.Mode == Mode.BASIC)
            {
                sb.AppendLine($"Size: {DirectoryContent.ToFileSize(file.Size)}");
            }
            else
            {
                sb.AppendLine($"Path: {file.Path}");
                sb.AppendLine($"Size: {DirectoryContent.ToByteFileSize(file.Size)}");
                sb.AppendLine($"Md5sum: {file.MD5SUM}");
            }
            if (additionalInfo != null)
            {
                sb.Append(additionalInfo);
            }
            textBoxInfo.Text = sb.ToString();
        }
        public void Set(DirectoryContent content)
        {
            listView.BeginUpdate();
            listView.Items.Clear();

            if (UserSettings.Mode == Mode.BASIC && content.Path == BrickExplorer.ROOT_PATH)
            {
                foreach (Directory directory in content.Directories)
                {
                    switch (directory.Path)
                    {
                    case BrickExplorer.PROJECTS_PATH:
                    {
                        ListViewItem item = new ListViewItem("Drive")
                        {
                            Tag        = directory,
                            ImageIndex = 1
                        };
                        item.SubItems.Add("Drive");
                        item.SubItems.Add("");
                        listView.Items.Add(item);
                        break;
                    }

                    case BrickExplorer.SDCARD_PATH:
                    {
                        ListViewItem item = new ListViewItem("SD Card")
                        {
                            Tag        = directory,
                            ImageIndex = 2
                        };
                        item.SubItems.Add("SD Card");
                        item.SubItems.Add("");
                        listView.Items.Add(item);
                        break;
                    }
                    }
                }
            }
            else
            {
                if (content.Directories != null)
                {
                    foreach (Directory directory in content.Directories)
                    {
                        ListViewItem item = new ListViewItem(directory.Name)
                        {
                            Tag        = directory,
                            ImageIndex = 0
                        };
                        item.SubItems.Add("File folder");
                        item.SubItems.Add("");
                        listView.Items.Add(item);
                    }
                }
                if (content.Files != null)
                {
                    foreach (File file in content.Files)
                    {
                        //if (UseFilter && !file.Name.EndsWith(FilterValue)) continue;

                        ListViewItem item = new ListViewItem(file.FileName);
                        item.Tag = file;
                        switch (file.Type)
                        {
                        case FileType.TextFile:
                        {
                            item.ImageIndex = 6;
                            break;
                        }

                        case FileType.GraphicFile:
                        {
                            item.ImageIndex = 5;
                            break;
                        }

                        case FileType.SoundFile:
                        {
                            item.ImageIndex = 4;
                            break;
                        }

                        default:
                        {
                            item.ImageIndex = 3;
                            break;
                        }
                        }

                        item.SubItems.Add(DirectoryContent.ToString(file.Type));
                        item.SubItems.Add(DirectoryContent.ToFileSize(file.Size));
                        listView.Items.Add(item);
                    }
                }
            }

            listView.EndUpdate();
        }