public FormRemoteFile(RemoteFile file, User user)
        {
            InitializeComponent();

            RemoteFile = file;
            User = user;

            labelTitleValue.Text = RemoteFile.Title;
            labelSizeValue.Text = Filesize.ConvertByteToMegaByte(RemoteFile.Size).ToString();
            labelCategoryValue.Text = RemoteFile.Category != null ? RemoteFile.Category.Title : "";
            labelRatingValue.Text = RemoteFile.Rating.ToString();
            try
            {
                labelUserValue.Text = RemoteFile.User.Username;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            textBoxDescriptionValue.Text = RemoteFile.Description;

            ReloadComments();
        }
        /// <summary>
        /// Gets the correct File from the database.
        /// Returns NULL when the file is not found.
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public static RemoteFile GetFileById(int id)
        {
            RemoteFile file = null;

            Database db = new Database();

            try
            {
                db.CreateCommand("SELECT * FROM files WHERE id = :id");
                db.AddParameter("id", id);

                db.OpenConnection();
                db.ExecuteCommand();

                OracleDataReader dr = db.DataReader;

                if (dr.HasRows)
                {
                    dr.Read();
                    file = new RemoteFile(dr.GetValueByColumn<int>("id"), dr.GetValueByColumn<string>("filename"),
                        dr.GetValueByColumn<string>("title"), dr.GetValueByColumn<long>("filesize"),
                        dr.GetValueByColumn<int>("files_categories_id"),
                        dr.GetValueByColumn<int>("active") > 0 ? true : false, dr.GetValueByColumn<int>("users_id"),
                        dr.GetValueByColumn<int>("private") > 0
                            ? ftp_db_poc.Privacy.@private
                            : ftp_db_poc.Privacy.@public);

                    file.Description = dr.GetValueByColumn<string>("description");
                }
            }
            finally
            {
                db.CloseConnection();
            }

            return file;
        }
        /// <summary>
        /// Extension class for the ListViewItem. Can hold an RemoteFile.
        /// </summary>
        public ListViewItemRemoteFile(RemoteFile file)
        {
            RemoteFile = file;

            Refresh();
        }
 /// <summary>
 /// Downloads the given file to the destination folder(settings).
 /// </summary>
 /// <param name="remoteFile"></param>
 public static void Download(RemoteFile remoteFile)
 {
     FtpDownload.remoteFile = remoteFile;
     backgroundWorker.RunWorkerAsync();
 }