Exemplo n.º 1
0
        public static void ShowSeletectedItemProperties()
        {
            DownloadItemBase?ent = null;

            if (ApplicationContext.MainWindow.IsInProgressViewSelected)
            {
                var rows = ApplicationContext.MainWindow.SelectedInProgressRows;
                if (rows.Count > 0)
                {
                    ent = rows[0].DownloadEntry;
                }
            }
            else
            {
                var rows = ApplicationContext.MainWindow.SelectedFinishedRows;
                if (rows.Count > 0)
                {
                    ent = rows[0].DownloadEntry;
                }
            }
            if (ent == null)
            {
                return;
            }

            ShortState?state = null;

            try
            {
                switch (ent.DownloadType)
                {
                case "Http":
                    var s = DownloadStateIO.LoadSingleSourceHTTPDownloaderState(ent.Id);
                    state = new()
                    {
                        Headers = s.Headers,
                        Cookies = s.Cookies
                    };
                    break;

                case "Dash":
                    var d = DownloadStateIO.LoadDualSourceHTTPDownloaderState(ent.Id);
                    state = new()
                    {
                        Headers1 = d.Headers1,
                        Headers2 = d.Headers2,
                        Cookies2 = d.Cookies2,
                        Cookies1 = d.Cookies1
                    };
                    break;

                case "Hls":
                    var h = DownloadStateIO.LoadMultiSourceHLSDownloadState(ent.Id);
                    state = new()
                    {
                        Headers = h.Headers,
                        Cookies = h.Cookies
                    };
                    break;

                case "Mpd-Dash":
                    var m = DownloadStateIO.LoadMultiSourceDASHDownloadState(ent.Id);
                    state = new()
                    {
                        Headers = m.Headers,
                        Cookies = m.Cookies
                    };
                    break;
                }
            }
            catch { }
            ApplicationContext.PlatformUIService.ShowPropertiesDialog(ent, state);
        }