public FileListViewItem(JsonObject file, ImageList img, int index, JsonArray wanted, JsonArray priorities)
            : base()
        {
            for (int i = 0; i < 6; i++)
            {
                base.SubItems.Add("");
            }
            string name = (string)file[ProtocolConstants.FIELD_NAME];

            this.FileName        = Toolbox.TrimPath(name);
            base.SubItems[0].Tag = name;
            this.FileIndex       = index;
            string[] split = this.Name.Split('.');
            if (split.Length > 1)
            {
                this.Extension = split[split.Length - 1].ToLower();
                if (Program.Form.fileIconImageList.Images.ContainsKey(this.Extension) || IconReader.AddToImgList(this.Extension, Program.Form.fileIconImageList))
                {
                    this.TypeName = IconReader.GetTypeName(this.Extension);
                    base.ImageKey = this.Extension;
                }
                else
                {
                    this.TypeName = this.Extension;
                }
            }
            this.FileSize = Toolbox.ToLong(file[ProtocolConstants.FIELD_LENGTH]);
            this.Update(file, wanted, priorities);
        }
        private void TorrentLoadBackgroundWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            try
            {
                List <ListViewItem> items = new List <ListViewItem>();
                torrent = MonoTorrent.Common.Torrent.Load(new FileStream(path, FileMode.Open, FileAccess.Read));
                foreach (MonoTorrent.Common.TorrentFile file in torrent.Files)
                {
                    ListViewItem item = new ListViewItem(file.Path);
#if !MONO
                    string[] split = file.Path.Split('.');
                    if (split.Length > 1)
                    {
                        string extension = split[split.Length - 1].ToLower();
                        if (filesListView.SmallImageList.Images.ContainsKey(extension) || IconReader.AddToImgList(extension, filesListView.SmallImageList))
                        {
                            item.ImageKey = extension;
                            item.SubItems.Add(IconReader.GetTypeName(extension));
                        }
                        else
                        {
                            item.SubItems.Add("");
                        }
                    }
                    else
                    {
                        item.SubItems.Add("");
                    }
#else
                    item.SubItems.Add("");
#endif
                    item.SubItems.Add(Toolbox.GetFileSize(file.Length)).Tag = file.Length;
                    item.SubItems.Add(OtherStrings.Normal);
                    item.Checked = true;
                    items.Add(item);
                }
                e.Result = items;
            }
            catch (Exception ex)
            {
                e.Result = ex;
            }
        }