Пример #1
0
        /// <summary>
        /// Show details/info for a WebFile
        /// </summary>
        /// <param name="File">WebFile object</param>
        /// <param name="createNewInstance">Whether to create a new instance</param>
        public void ShowFileDetails(WebFile File, DataGridView parentDataGrid, bool isLocal = false, bool createNewInstance = true)
        {
            Program.log.Info("Showing file details dialog : " + File.URL);

            if (createNewInstance)
            {
                FrmFileDetails = new FileDetailsWindow();
            }

            FrmFileDetails.IsLocalFile    = isLocal;
            FrmFileDetails.ParentDataGrid = parentDataGrid;
            FrmFileDetails.CurrentFile    = File;

            FrmFileDetails.LabelFileName.Text      = File.Name;
            FrmFileDetails.LabelValueName.Text     = File.Name;
            FrmFileDetails.LabelValueRefferer.Text = File.Host;
            FrmFileDetails.LabelValueType.Text     = File.Type;
            FrmFileDetails.InfoFileURL.Text        = Uri.UnescapeDataString(File.URL);

            // Builds parts of the URL into a better presented string, simply replaces '/' with '>' and no filename
            var url         = new Uri(File.URL);
            var directories = new StringBuilder();

            if (!File.URL.StartsWith(@"C:\"))
            {
                directories.Append(File.Host);
            }
            else
            {
                FrmFileDetails.LabelValueRefferer.Text = "Local";
            }                                                                                                                               // Appends the Host at the start if not Local, else it will be named 'Local'
            foreach (string path in url.LocalPath.Split('/', '\\'))
            {
                if (!Path.HasExtension(path))
                {
                    directories.Append(path + "> ");
                }
            }
            FrmFileDetails.LabelValueDirectory.Text = directories.ToString();

            FrmFileDetails.LabelValueSize.Text = StringExtensions.BytesToPrefix(File.Size);
            FrmFileDetails.LabelValueAge.Text  = StringExtensions.TimeSpanAge(File.DateUploaded);

            if (!createNewInstance)
            {
                FrmFileDetails.CheckFileEvents();
            }
            else
            {
                FrmFileDetails.ShowDialog(this);
            }

            Program.log.Info("Successfully loaded file details dialog");
        }
Пример #2
0
        /// <summary>
        /// Show details/info for a WebFile
        /// </summary>
        /// <param name="File">WebFile object</param>
        /// <param name="createNewInstance">Whether to create a new instance</param>
        public void ShowFileDetails(WebFile File, bool createNewInstance = true)
        {
            Program.log.Info("Showing file details dialog : " + File.URL);

            if (createNewInstance)
            {
                FrmFileDetails = new FileDetails();
            }

            FrmFileDetails.currentFile       = File;
            FrmFileDetails.infoFileName.Text = File.Name;
            FrmFileDetails.infoName.Text     = File.Name;
            FrmFileDetails.infoReferrer.Text = File.Host;
            FrmFileDetails.infoType.Text     = File.Type;
            FrmFileDetails.infoFileURL.Text  = Uri.UnescapeDataString(File.URL);

            // Builds parts of the URL into a better presented string, simply replaces '/' with '>' and no filename
            var url         = new Uri(File.URL);
            var directories = new StringBuilder();

            if (!File.URL.StartsWith(LocalExtensions.userDownloadsDirectory))
            {
                directories.Append(File.Host);
            }
            else
            {
                FrmFileDetails.infoReferrer.Text = "Local";
            }                                                                                                                                                        // Appends the Host at the start if not Local, else it will be named 'Local'
            foreach (string path in url.LocalPath.Split('/', '\\'))
            {
                if (!Path.HasExtension(path))
                {
                    directories.Append(path + "> ");
                }
            }
            FrmFileDetails.infoDirectory.Text = directories.ToString();

            FrmFileDetails.infoSize.Text = TextExtensions.BytesToString(File.Size);
            FrmFileDetails.infoAge.Text  = TextExtensions.GetTimeAgo(File.DateUploaded);

            FrmFileDetails.Dock = DockStyle.Fill;
            if (!createNewInstance)
            {
                FrmFileDetails.CheckFileEvents();
            }
            if (createNewInstance)
            {
                tabBlank.Controls.Clear(); tabBlank.Controls.Add(FrmFileDetails);
            }
            tab.SelectedTab = tabBlank;

            Program.log.Info("Successfully loaded file details dialog");
        }
Пример #3
0
        /// <summary>
        /// Show file details for a WebFile
        /// </summary>
        /// <param name="file">WebFile object</param>
        /// <param name="createNewInstance">Whether to create a new instance</param>
        public void ShowFileDetails(WebFile file, bool createNewInstance = true)
        {
            Program.log.Info("Showing file details dialog : " + file.URL);

            if (createNewInstance)
            {
                FrmFileDetails = new FileDetails();
            }

            FrmFileDetails.currentFile       = file;
            FrmFileDetails.infoFileName.Text = file.Name;
            FrmFileDetails.infoName.Text     = file.Name;
            FrmFileDetails.infoReferrer.Text = file.Host;
            FrmFileDetails.infoType.Text     = file.Type;
            FrmFileDetails.infoFileURL.Text  = Uri.UnescapeDataString(file.URL);

            // Build all parts of the URL into a better presented string
            var url         = new Uri(file.URL);
            var directories = new StringBuilder(file.Host);

            foreach (string path in url.LocalPath.Split('/'))
            {
                if (!Path.HasExtension(path))
                {
                    directories.Append(path + "> ");
                }
            }
            FrmFileDetails.infoDirectory.Text = directories.ToString();

            FrmFileDetails.infoSize.Text = TextExtensions.BytesToString(file.Size);
            FrmFileDetails.infoAge.Text  = TextExtensions.GetTimeAgo(file.DateUploaded);

            FrmFileDetails.Dock = DockStyle.Fill;
            if (!createNewInstance)
            {
                FrmFileDetails.CheckFileEvents();
            }
            if (createNewInstance)
            {
                tabBlank.Controls.Clear(); tabBlank.Controls.Add(FrmFileDetails);
            }
            tab.SelectedTab = tabBlank;

            Program.log.Info("Successfully loaded file details dialog");
        }