예제 #1
0
 public UpdateDialog(GarUpdateInfo info, bool enable_release, bool enable_formats)
 {
     InitializeComponent();
     this.ReleasePane.Visibility = enable_release ? Visibility.Visible : Visibility.Collapsed;
     this.FormatsPane.Visibility = enable_formats ? Visibility.Visible : Visibility.Collapsed;
     if (string.IsNullOrEmpty(info.ReleaseNotes))
     {
         this.ReleaseNotes.Visibility = Visibility.Collapsed;
     }
     this.DataContext = info;
     this.Closed     += (s, e) => IsClosed = true;
 }
예제 #2
0
        GarUpdateInfo Check(Uri version_url)
        {
            var request = WebRequest.Create(version_url);

            request.Timeout = RequestTimeout;
            var response = (HttpWebResponse)request.GetResponse();

            using (var input = response.GetResponseStream())
            {
                var xml = new XmlDocument();
                xml.Load(input);
                return(GarUpdateInfo.Parse(xml));
            }
        }
예제 #3
0
        private void ShowUpdateResult(GarUpdateInfo result)
        {
            var  app_version    = Assembly.GetExecutingAssembly().GetName().Version;
            var  db_version     = FormatCatalog.Instance.CurrentSchemeVersion;
            bool has_app_update = app_version < result.ReleaseVersion;
            bool has_db_update  = db_version < result.FormatsVersion && CheckAssemblies(result.Assemblies);

            if (!has_app_update && !has_db_update)
            {
                m_main.SetStatusText(guiStrings.MsgUpToDate);
                return;
            }
            m_formats_url  = result.FormatsUrl;
            m_dialog       = new UpdateDialog(result, has_app_update, has_db_update);
            m_dialog.Owner = m_main;
            m_dialog.FormatsDownload.Click += StartFormatsDownload;
            m_dialog.ShowDialog();
        }
예제 #4
0
파일: GarUpdate.cs 프로젝트: zxc120/GARbro
        private void ShowUpdateResult(GarUpdateInfo result)
        {
            var  app_version    = Assembly.GetExecutingAssembly().GetName().Version;
            bool has_app_update = app_version < result.ReleaseVersion;

            var loaded_assemblies = AppDomain.CurrentDomain.GetAssemblies();

            m_formats_db = result.FindMatchingFormatsData(FormatCatalog.Instance.CurrentSchemeVersion, loaded_assemblies);
            bool has_db_update = m_formats_db != null;

            if (!has_app_update && !has_db_update)
            {
                m_main.SetStatusText(guiStrings.MsgUpToDate);
                return;
            }
            m_dialog       = new UpdateDialog(result, has_app_update, has_db_update);
            m_dialog.Owner = m_main;
            m_dialog.FormatsDownload.Click += StartFormatsDownload;
            m_dialog.ShowDialog();
        }
예제 #5
0
        public static GarUpdateInfo Parse(XmlDocument xml)
        {
            var root = xml.DocumentElement.SelectSingleNode("/GARbro");

            if (null == root)
            {
                return(null);
            }
            var info = new GarUpdateInfo
            {
                ReleaseVersion = Version.Parse(GetInnerText(root.SelectSingleNode("Release/Version"))),
                ReleaseUrl     = new Uri(GetInnerText(root.SelectSingleNode("Release/Url"))),
                ReleaseNotes   = GetInnerText(root.SelectSingleNode("Release/Notes")),

                FormatsVersion = Int32.Parse(GetInnerText(root.SelectSingleNode("FormatsData/FileVersion"))),
                FormatsUrl     = new Uri(GetInnerText(root.SelectSingleNode("FormatsData/Url"))),
                Assemblies     = ParseAssemblies(root.SelectNodes("FormatsData/Requires/Assembly")),
            };

            return(info);
        }