ScreenToGif/Windows/Other/DownloadDialog.xaml.cs

(开头部分) 4KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Diagnostics;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Net;
using System.Windows;
using System.Xml.Linq;
using System.Xml.XPath;
using ScreenToGif.FileWriters;
using ScreenToGif.Util;

namespace ScreenToGif.Windows.Other
{
    public partial class DownloadDialog : Window
    {
        public XElement Element { get; set; }

        public DownloadDialog()
        {
            InitializeComponent();
        }

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            #region Validation

            if (Element == null)
            {
                WhatsNewParagraph.Inlines.Add("Something wrong happened.");
                return;
            }

            #endregion

            try
            {
                VersionRun.Text = "Version " + Element.XPathSelectElement("tag_name").Value;
                SizeRun.Text = Humanizer.BytesToString(Convert.ToInt32(Element.XPathSelectElement("assets").FirstNode.XPathSelectElement("size").Value));

                var body = Element.XPathSelectElement("body").Value;

                var splited = body.Split(new[] { '#' }, StringSplitOptions.RemoveEmptyEntries);

                WhatsNewParagraph.Inlines.Add(splited[0].Replace(" What's new?\r\n\r\n", ""));

                FixesParagraph.Inlines.Add(splited[1].Replace(" Bug fixes:\r\n\r\n", ""));
            }
            catch (Exception ex)
            {
                LogWriter.Log(ex, "Loading download informations");

                WhatsNewParagraph.Inlines.Add("Something wrong happened.");
            }
        }

        private async void DownloadButton_Click(object sender, RoutedEventArgs e)
        {
            #region Save as

后面还有 108 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。