mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-21 18:52:36 +01:00
Work on plugin update check
This commit is contained in:
parent
5d3dabfd50
commit
24219eed8c
@ -542,6 +542,9 @@ We leverage the intrinsic rhythm of the image.</CreateSimpleChainingToolTip>
|
||||
<CheckingForUpdatesNewVersion>New version available!</CheckingForUpdatesNewVersion>
|
||||
<InstallUpdate>Go to download page</InstallUpdate>
|
||||
<NoUpdates>Don't update</NoUpdates>
|
||||
<XPluginsHasAnUpdate>{0} plugins have an updates -</XPluginsHasAnUpdate>
|
||||
<OnePluginsHasAnUpdate>One plugin has an update -</OnePluginsHasAnUpdate>
|
||||
<Update>update</Update>
|
||||
</CheckForUpdates>
|
||||
<ChooseAudioTrack>
|
||||
<Title>Choose audio track</Title>
|
||||
|
@ -3397,51 +3397,8 @@ $HorzAlign = Center
|
||||
var mergeLinesShorterThan = listNode.SelectSingleNode("MergeLinesShorterThan")?.InnerText;
|
||||
var minimumMillisecondsBetweenLines = listNode.SelectSingleNode("MinimumMillisecondsBetweenLines")?.InnerText;
|
||||
|
||||
var dialogStyle = DialogType.DashBothLinesWithSpace;
|
||||
if (listNode.SelectSingleNode("DialogStyle") == null || !Enum.IsDefined(typeof(DialogType), listNode.SelectSingleNode("DialogStyle").InnerText))
|
||||
{ //TODO: Remove after 2022
|
||||
if (listNode.SelectSingleNode("Name") != null)
|
||||
{
|
||||
var lookup = new List<RulesProfile>();
|
||||
GeneralSettings.AddExtraProfiles(lookup);
|
||||
var match = lookup.Find(LookupProfile => LookupProfile.Name == listNode.SelectSingleNode("Name").InnerText);
|
||||
if (match != null)
|
||||
{
|
||||
dialogStyle = match.DialogStyle; // update style when upgrading from 3.5.13 or below
|
||||
}
|
||||
else
|
||||
{
|
||||
dialogStyle = DialogType.DashBothLinesWithSpace;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dialogStyle = (DialogType)Enum.Parse(typeof(DialogType), listNode.SelectSingleNode("DialogStyle")?.InnerText);
|
||||
}
|
||||
|
||||
var continuationStyle = ContinuationStyle.NoneLeadingTrailingDots;
|
||||
if (listNode.SelectSingleNode("ContinuationStyle") == null || !Enum.IsDefined(typeof(ContinuationStyle), listNode.SelectSingleNode("ContinuationStyle").InnerText))
|
||||
{ //TODO: Remove after 2022
|
||||
if (listNode.SelectSingleNode("Name") != null)
|
||||
{
|
||||
var lookup = new List<RulesProfile>();
|
||||
GeneralSettings.AddExtraProfiles(lookup);
|
||||
var match = lookup.Find(LookupProfile => LookupProfile.Name == listNode.SelectSingleNode("Name").InnerText);
|
||||
if (match != null)
|
||||
{
|
||||
continuationStyle = match.ContinuationStyle; // update style when upgrading from 3.5.13 or below
|
||||
}
|
||||
else
|
||||
{
|
||||
continuationStyle = ContinuationStyle.NoneLeadingTrailingDots;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
continuationStyle = (ContinuationStyle)Enum.Parse(typeof(ContinuationStyle), listNode.SelectSingleNode("ContinuationStyle")?.InnerText);
|
||||
}
|
||||
var dialogStyle = (DialogType)Enum.Parse(typeof(DialogType), listNode.SelectSingleNode("DialogStyle")?.InnerText);
|
||||
var continuationStyle = (ContinuationStyle)Enum.Parse(typeof(ContinuationStyle), listNode.SelectSingleNode("ContinuationStyle")?.InnerText);
|
||||
|
||||
settings.General.Profiles.Add(new RulesProfile
|
||||
{
|
||||
|
79
src/ui/Forms/CheckForUpdates.Designer.cs
generated
79
src/ui/Forms/CheckForUpdates.Designer.cs
generated
@ -32,13 +32,13 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
this.labelStatus = new System.Windows.Forms.Label();
|
||||
this.textBoxChangeLog = new Nikse.SubtitleEdit.Controls.NikseTextBox();
|
||||
this.buttonOK = new System.Windows.Forms.Button();
|
||||
this.buttonDownloadAndInstall = new System.Windows.Forms.Button();
|
||||
this.timerCheckForUpdates = new System.Windows.Forms.Timer(this.components);
|
||||
this.buttonDontCheckUpdates = new System.Windows.Forms.Button();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.linkLabel1 = new System.Windows.Forms.LinkLabel();
|
||||
this.linkLabelUpdatePlugins = new System.Windows.Forms.LinkLabel();
|
||||
this.labelPluginsHaveUpdates = new System.Windows.Forms.Label();
|
||||
this.textBoxChangeLog = new Nikse.SubtitleEdit.Controls.NikseTextBox();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// labelStatus
|
||||
@ -47,23 +47,9 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
this.labelStatus.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.labelStatus.Location = new System.Drawing.Point(10, 15);
|
||||
this.labelStatus.Name = "labelStatus";
|
||||
this.labelStatus.Size = new System.Drawing.Size(41, 13);
|
||||
this.labelStatus.Size = new System.Drawing.Size(70, 13);
|
||||
this.labelStatus.TabIndex = 3;
|
||||
this.labelStatus.Text = "label1";
|
||||
//
|
||||
// textBoxChangeLog
|
||||
//
|
||||
this.textBoxChangeLog.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.textBoxChangeLog.FocusedColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(120)))), ((int)(((byte)(215)))));
|
||||
this.textBoxChangeLog.Location = new System.Drawing.Point(13, 31);
|
||||
this.textBoxChangeLog.Multiline = true;
|
||||
this.textBoxChangeLog.Name = "textBoxChangeLog";
|
||||
this.textBoxChangeLog.ReadOnly = true;
|
||||
this.textBoxChangeLog.ScrollBars = System.Windows.Forms.ScrollBars.Both;
|
||||
this.textBoxChangeLog.Size = new System.Drawing.Size(618, 106);
|
||||
this.textBoxChangeLog.TabIndex = 4;
|
||||
this.labelStatus.Text = "labelStatus";
|
||||
//
|
||||
// buttonOK
|
||||
//
|
||||
@ -105,32 +91,49 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
this.buttonDontCheckUpdates.UseVisualStyleBackColor = true;
|
||||
this.buttonDontCheckUpdates.Click += new System.EventHandler(this.buttonDontCheckUpdates_Click);
|
||||
//
|
||||
// label1
|
||||
// linkLabelUpdatePlugins
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(13, 144);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(35, 13);
|
||||
this.label1.TabIndex = 5;
|
||||
this.label1.Text = "label1";
|
||||
this.linkLabelUpdatePlugins.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.linkLabelUpdatePlugins.AutoSize = true;
|
||||
this.linkLabelUpdatePlugins.Location = new System.Drawing.Point(182, 150);
|
||||
this.linkLabelUpdatePlugins.Name = "linkLabelUpdatePlugins";
|
||||
this.linkLabelUpdatePlugins.Size = new System.Drawing.Size(63, 13);
|
||||
this.linkLabelUpdatePlugins.TabIndex = 6;
|
||||
this.linkLabelUpdatePlugins.TabStop = true;
|
||||
this.linkLabelUpdatePlugins.Text = "update now";
|
||||
this.linkLabelUpdatePlugins.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabelUpdatePlugins_LinkClicked);
|
||||
//
|
||||
// linkLabel1
|
||||
// labelPluginsHaveUpdates
|
||||
//
|
||||
this.linkLabel1.AutoSize = true;
|
||||
this.linkLabel1.Location = new System.Drawing.Point(55, 143);
|
||||
this.linkLabel1.Name = "linkLabel1";
|
||||
this.linkLabel1.Size = new System.Drawing.Size(55, 13);
|
||||
this.linkLabel1.TabIndex = 6;
|
||||
this.linkLabel1.TabStop = true;
|
||||
this.linkLabel1.Text = "linkLabel1";
|
||||
this.labelPluginsHaveUpdates.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.labelPluginsHaveUpdates.AutoSize = true;
|
||||
this.labelPluginsHaveUpdates.Location = new System.Drawing.Point(13, 150);
|
||||
this.labelPluginsHaveUpdates.Name = "labelPluginsHaveUpdates";
|
||||
this.labelPluginsHaveUpdates.Size = new System.Drawing.Size(169, 13);
|
||||
this.labelPluginsHaveUpdates.TabIndex = 5;
|
||||
this.labelPluginsHaveUpdates.Text = "X plugins have updates available -";
|
||||
//
|
||||
// textBoxChangeLog
|
||||
//
|
||||
this.textBoxChangeLog.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.textBoxChangeLog.FocusedColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(120)))), ((int)(((byte)(215)))));
|
||||
this.textBoxChangeLog.Location = new System.Drawing.Point(13, 32);
|
||||
this.textBoxChangeLog.Multiline = true;
|
||||
this.textBoxChangeLog.Name = "textBoxChangeLog";
|
||||
this.textBoxChangeLog.ReadOnly = true;
|
||||
this.textBoxChangeLog.ScrollBars = System.Windows.Forms.ScrollBars.Both;
|
||||
this.textBoxChangeLog.Size = new System.Drawing.Size(618, 106);
|
||||
this.textBoxChangeLog.TabIndex = 4;
|
||||
//
|
||||
// CheckForUpdates
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(643, 201);
|
||||
this.Controls.Add(this.linkLabel1);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Controls.Add(this.linkLabelUpdatePlugins);
|
||||
this.Controls.Add(this.labelPluginsHaveUpdates);
|
||||
this.Controls.Add(this.buttonDontCheckUpdates);
|
||||
this.Controls.Add(this.buttonOK);
|
||||
this.Controls.Add(this.buttonDownloadAndInstall);
|
||||
@ -157,7 +160,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
private System.Windows.Forms.Button buttonDownloadAndInstall;
|
||||
private System.Windows.Forms.Timer timerCheckForUpdates;
|
||||
private System.Windows.Forms.Button buttonDontCheckUpdates;
|
||||
private Label label1;
|
||||
private LinkLabel linkLabel1;
|
||||
private LinkLabel linkLabelUpdatePlugins;
|
||||
private Label labelPluginsHaveUpdates;
|
||||
}
|
||||
}
|
@ -13,6 +13,8 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
private readonly bool _performCheckOnShown = true;
|
||||
private readonly Main _mainForm;
|
||||
|
||||
public bool UpdatePlugins { get; set; }
|
||||
|
||||
public CheckForUpdates(Main mainForm)
|
||||
{
|
||||
UiUtil.PreInitialize(this);
|
||||
@ -36,6 +38,9 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
buttonDontCheckUpdates.Text = LanguageSettings.Current.CheckForUpdates.NoUpdates;
|
||||
buttonDontCheckUpdates.Visible = false;
|
||||
|
||||
labelPluginsHaveUpdates.Visible = false;
|
||||
linkLabelUpdatePlugins.Visible = false;
|
||||
|
||||
Location = new System.Drawing.Point(_mainForm.Location.X + (_mainForm.Width / 2) - (Width / 2), _mainForm.Location.Y + (_mainForm.Height / 2) - (Height / 2) - 200);
|
||||
}
|
||||
|
||||
@ -48,7 +53,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
_mainForm = mainForm;
|
||||
_updatesHelper = checkForUpdatesHelper;
|
||||
InitLanguage();
|
||||
ShowAvailableUpdate(true);
|
||||
ShowAvailableUpdate();
|
||||
_performCheckOnShown = false;
|
||||
UiUtil.FixLargeFonts(this, buttonOK);
|
||||
}
|
||||
@ -72,7 +77,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
_updatesHelper = new CheckForUpdatesHelper();
|
||||
Application.DoEvents();
|
||||
Refresh();
|
||||
_updatesHelper.CheckForUpdates();
|
||||
_updatesHelper.CheckForUpdates(true);
|
||||
timerCheckForUpdates.Start();
|
||||
|
||||
buttonOK.Focus();
|
||||
@ -96,19 +101,9 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
else if (_updatesHelper.Done)
|
||||
{
|
||||
timerCheckForUpdates.Stop();
|
||||
if (_updatesHelper.IsUpdateAvailable())
|
||||
{
|
||||
ShowAvailableUpdate(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
labelStatus.Text = LanguageSettings.Current.CheckForUpdates.CheckingForUpdatesNoneAvailable;
|
||||
SetLargeSize();
|
||||
textBoxChangeLog.Text = _updatesHelper.LatestChangeLog;
|
||||
textBoxChangeLog.Visible = true;
|
||||
buttonOK.Visible = true;
|
||||
}
|
||||
ShowAvailableUpdate();
|
||||
}
|
||||
|
||||
_seconds += timerCheckForUpdates.Interval / TimeCode.BaseUnit;
|
||||
|
||||
if (buttonDownloadAndInstall.Visible)
|
||||
@ -121,28 +116,81 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
}
|
||||
}
|
||||
|
||||
private void SetLargeSize()
|
||||
private void ShowAvailableUpdate()
|
||||
{
|
||||
Height = 600;
|
||||
MinimumSize = new System.Drawing.Size(500, 400);
|
||||
}
|
||||
//TODO: clean this method a little up
|
||||
|
||||
private void ShowAvailableUpdate(bool fromAutoCheck)
|
||||
{
|
||||
SetLargeSize();
|
||||
textBoxChangeLog.Text = _updatesHelper.LatestChangeLog;
|
||||
textBoxChangeLog.Visible = true;
|
||||
labelStatus.Text = LanguageSettings.Current.CheckForUpdates.CheckingForUpdatesNewVersion;
|
||||
buttonDownloadAndInstall.Visible = true;
|
||||
buttonOK.Visible = true;
|
||||
if (Configuration.Settings.General.CheckForUpdates && fromAutoCheck)
|
||||
var hideChangeLog = !_updatesHelper.ManualCheck;
|
||||
if (_updatesHelper.IsNewSubtitleEditAvailable())
|
||||
{
|
||||
buttonDontCheckUpdates.Visible = true;
|
||||
hideChangeLog = false;
|
||||
}
|
||||
|
||||
if (_updatesHelper.PluginUpdates > 0)
|
||||
{
|
||||
if (_updatesHelper.PluginUpdates == 1)
|
||||
{
|
||||
labelPluginsHaveUpdates.Text = LanguageSettings.Current.CheckForUpdates.OnePluginsHasAnUpdate;
|
||||
}
|
||||
else
|
||||
{
|
||||
labelPluginsHaveUpdates.Text = string.Format(LanguageSettings.Current.CheckForUpdates.XPluginsHasAnUpdate, _updatesHelper.PluginUpdates);
|
||||
}
|
||||
|
||||
linkLabelUpdatePlugins.Text = LanguageSettings.Current.CheckForUpdates.Update;
|
||||
labelPluginsHaveUpdates.Visible = true;
|
||||
linkLabelUpdatePlugins.Visible = true;
|
||||
|
||||
if (hideChangeLog)
|
||||
{
|
||||
MinimizeBox = false;
|
||||
MaximizeBox = false;
|
||||
FormBorderStyle = FormBorderStyle.FixedDialog;
|
||||
labelStatus.Visible = false;
|
||||
var w = linkLabelUpdatePlugins.Right + 75;
|
||||
var h = 120;
|
||||
MinimumSize = new System.Drawing.Size(w, h);
|
||||
Height = h;
|
||||
Width = w;
|
||||
}
|
||||
|
||||
linkLabelUpdatePlugins.Left = labelPluginsHaveUpdates.Right - 2;
|
||||
linkLabelUpdatePlugins.BringToFront();
|
||||
}
|
||||
else
|
||||
{
|
||||
buttonDontCheckUpdates.Visible = false;
|
||||
buttonDownloadAndInstall.Left = buttonOK.Left - 6 - buttonDownloadAndInstall.Width;
|
||||
labelPluginsHaveUpdates.Visible = false;
|
||||
linkLabelUpdatePlugins.Visible = false;
|
||||
textBoxChangeLog.Height += 14;
|
||||
}
|
||||
|
||||
if (!hideChangeLog)
|
||||
{
|
||||
Height = 600;
|
||||
MinimumSize = new System.Drawing.Size(500, 400);
|
||||
}
|
||||
|
||||
buttonDownloadAndInstall.Visible = _updatesHelper.IsNewSubtitleEditAvailable();
|
||||
|
||||
if (_updatesHelper.IsNewSubtitleEditAvailable() || _updatesHelper.ManualCheck)
|
||||
{
|
||||
textBoxChangeLog.Text = _updatesHelper.LatestChangeLog;
|
||||
textBoxChangeLog.Visible = true;
|
||||
labelStatus.Text = LanguageSettings.Current.CheckForUpdates.CheckingForUpdatesNewVersion;
|
||||
buttonOK.Visible = true;
|
||||
if (_updatesHelper.IsNewSubtitleEditAvailable())
|
||||
{
|
||||
buttonDontCheckUpdates.Visible = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
buttonDontCheckUpdates.Visible = false;
|
||||
buttonDownloadAndInstall.Left = buttonOK.Left - 6 - buttonDownloadAndInstall.Width;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
textBoxChangeLog.Visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -157,5 +205,10 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
DialogResult = DialogResult.Cancel;
|
||||
}
|
||||
|
||||
private void linkLabelUpdatePlugins_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
|
||||
{
|
||||
UpdatePlugins = true;
|
||||
DialogResult = DialogResult.OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
using Nikse.SubtitleEdit.Controls;
|
||||
using Nikse.SubtitleEdit.Core.AudioToText;
|
||||
using Nikse.SubtitleEdit.Core.BluRaySup;
|
||||
using Nikse.SubtitleEdit.Core.Common;
|
||||
using Nikse.SubtitleEdit.Core.ContainerFormats;
|
||||
@ -15,6 +16,7 @@ using Nikse.SubtitleEdit.Core.SpellCheck;
|
||||
using Nikse.SubtitleEdit.Core.SubtitleFormats;
|
||||
using Nikse.SubtitleEdit.Core.VobSub;
|
||||
using Nikse.SubtitleEdit.Forms.Assa;
|
||||
using Nikse.SubtitleEdit.Forms.AudioToText;
|
||||
using Nikse.SubtitleEdit.Forms.FormatProperties;
|
||||
using Nikse.SubtitleEdit.Forms.Networking;
|
||||
using Nikse.SubtitleEdit.Forms.Ocr;
|
||||
@ -23,6 +25,7 @@ using Nikse.SubtitleEdit.Forms.SeJobs;
|
||||
using Nikse.SubtitleEdit.Forms.ShotChanges;
|
||||
using Nikse.SubtitleEdit.Forms.Styles;
|
||||
using Nikse.SubtitleEdit.Forms.Translate;
|
||||
using Nikse.SubtitleEdit.Forms.VTT;
|
||||
using Nikse.SubtitleEdit.Logic;
|
||||
using Nikse.SubtitleEdit.Logic.CommandLineConvert;
|
||||
using Nikse.SubtitleEdit.Logic.Networking;
|
||||
@ -43,13 +46,9 @@ using System.Text.RegularExpressions;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using Nikse.SubtitleEdit.Core.AudioToText;
|
||||
using Nikse.SubtitleEdit.Forms.AudioToText;
|
||||
using Nikse.SubtitleEdit.Forms.VTT;
|
||||
using Nikse.SubtitleEdit.Logic.Plugins;
|
||||
using CheckForUpdatesHelper = Nikse.SubtitleEdit.Logic.CheckForUpdatesHelper;
|
||||
using Timer = System.Windows.Forms.Timer;
|
||||
using MessageBox = Nikse.SubtitleEdit.Forms.SeMsgBox.MessageBox;
|
||||
using Timer = System.Windows.Forms.Timer;
|
||||
|
||||
namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
@ -25315,7 +25314,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
else if (Configuration.Settings.General.CheckForUpdates && Configuration.Settings.General.LastCheckForUpdates < DateTime.Now.AddDays(-5))
|
||||
{
|
||||
_checkForUpdatesHelper = new CheckForUpdatesHelper();
|
||||
_checkForUpdatesHelper.CheckForUpdates();
|
||||
_checkForUpdatesHelper.CheckForUpdates(false);
|
||||
_timerCheckForUpdates = new Timer();
|
||||
_timerCheckForUpdates.Interval = 7000;
|
||||
_timerCheckForUpdates.Tick += TimerCheckForUpdatesTick;
|
||||
@ -25713,10 +25712,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
_timerCheckForUpdates.Stop();
|
||||
if (_checkForUpdatesHelper.IsUpdateAvailable())
|
||||
{
|
||||
using (var form = new CheckForUpdates(this, _checkForUpdatesHelper))
|
||||
{
|
||||
form.ShowDialog(this);
|
||||
}
|
||||
ShowCheckForUpdates();
|
||||
}
|
||||
|
||||
_checkForUpdatesHelper = null;
|
||||
@ -33130,12 +33126,26 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
// ignore
|
||||
}
|
||||
|
||||
ShowCheckForUpdates();
|
||||
|
||||
Configuration.Settings.General.LastCheckForUpdates = DateTime.Now;
|
||||
}
|
||||
|
||||
private void ShowCheckForUpdates()
|
||||
{
|
||||
using (var form = new CheckForUpdates(this))
|
||||
{
|
||||
form.ShowDialog(this);
|
||||
}
|
||||
if (form.UpdatePlugins)
|
||||
{
|
||||
using (var formGetPlugins = new PluginsGet())
|
||||
{
|
||||
formGetPlugins.UpdateAll = true;
|
||||
formGetPlugins.ShowDialog(this);
|
||||
}
|
||||
|
||||
Configuration.Settings.General.LastCheckForUpdates = DateTime.Now;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void setVideoOffsetToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
|
@ -60,10 +60,8 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
_cancellationTokenSource = new CancellationTokenSource();
|
||||
}
|
||||
|
||||
private static string GetPluginXmlFileUrl()
|
||||
{
|
||||
return "https://raw.github.com/SubtitleEdit/plugins/master/Plugins4.xml";
|
||||
}
|
||||
public static string PluginXmlFileUrl = "https://raw.github.com/SubtitleEdit/plugins/master/Plugins4.xml";
|
||||
public bool UpdateAll { get; set; }
|
||||
|
||||
private static string GetPluginFolder()
|
||||
{
|
||||
@ -111,7 +109,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
_downloadList = new List<PluginInfoItem>();
|
||||
listViewGetPlugins.BeginUpdate();
|
||||
_updateAllListUrls = new List<string>();
|
||||
var onlinePluginInfo = new OnlinePluginMetadataProvider(GetPluginXmlFileUrl());
|
||||
var onlinePluginInfo = new OnlinePluginMetadataProvider(PluginXmlFileUrl);
|
||||
_downloadList = onlinePluginInfo.GetPlugins().ToList();
|
||||
LoadAvailablePlugins(installedPlugins, _downloadList);
|
||||
ShowAvailablePlugins();
|
||||
@ -349,6 +347,12 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
GetAndShowAllPluginInfo();
|
||||
PluginsGet_ResizeEnd(sender, e);
|
||||
|
||||
if (UpdateAll)
|
||||
{
|
||||
buttonUpdateAll.Visible = false;
|
||||
buttonUpdateAll_Click(sender, e);
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonRemove_Click(object sender, EventArgs e)
|
||||
|
@ -5,6 +5,8 @@ using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using Nikse.SubtitleEdit.Core.Common;
|
||||
using Nikse.SubtitleEdit.Core.Http;
|
||||
using Nikse.SubtitleEdit.Forms;
|
||||
using Nikse.SubtitleEdit.Logic.Plugins;
|
||||
|
||||
namespace Nikse.SubtitleEdit.Logic
|
||||
{
|
||||
@ -19,8 +21,10 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
private int _successCount;
|
||||
|
||||
public string Error { get; set; }
|
||||
public int PluginUpdates { get; set; }
|
||||
|
||||
public bool Done => _successCount == 1;
|
||||
public bool ManualCheck { get; set; }
|
||||
|
||||
public string LatestVersionNumber { get; set; }
|
||||
public string LatestChangeLog { get; set; }
|
||||
@ -89,8 +93,10 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
public void CheckForUpdates()
|
||||
public void CheckForUpdates(bool manualCheck)
|
||||
{
|
||||
ManualCheck = manualCheck;
|
||||
|
||||
try
|
||||
{
|
||||
using (var httpClient = DownloaderFactory.MakeHttpClient())
|
||||
@ -98,6 +104,14 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
_changeLog = httpClient.GetStringAsync(ChangeLogUrl).Result;
|
||||
}
|
||||
|
||||
var installedPlugins = new InstalledPluginMetadataProvider().GetPlugins();
|
||||
if (installedPlugins.Count > 0)
|
||||
{
|
||||
var onlinePlugins = new OnlinePluginMetadataProvider(PluginsGet.PluginXmlFileUrl).GetPlugins();
|
||||
var updates = PluginUpdateChecker.GetAvailableUpdates(installedPlugins, onlinePlugins.ToArray());
|
||||
PluginUpdates = updates.Count;
|
||||
}
|
||||
|
||||
LatestChangeLog = GetLatestChangeLog(_changeLog);
|
||||
LatestVersionNumber = GetLatestVersionNumber(LatestChangeLog);
|
||||
_successCount = 1;
|
||||
@ -120,13 +134,23 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
|
||||
try
|
||||
{
|
||||
//string[] currentVersionInfo = "3.3.14".Split('.'); // for testing...
|
||||
return Version.Parse(LatestVersionNumber) > Version.Parse(Utilities.AssemblyVersion);
|
||||
if (PluginUpdates > 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return IsNewSubtitleEditAvailable();
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsNewSubtitleEditAvailable()
|
||||
{
|
||||
//string[] currentVersionInfo = "3.3.14".Split('.'); // for testing...
|
||||
return Version.Parse(LatestVersionNumber) > Version.Parse(Utilities.AssemblyVersion);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -744,6 +744,9 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
CheckingForUpdatesNewVersion = "New version available!",
|
||||
InstallUpdate = "Go to download page",
|
||||
NoUpdates = "Don't update",
|
||||
OnePluginsHasAnUpdate = "One plugin has an update -",
|
||||
XPluginsHasAnUpdate = "{0} plugins have an updates -",
|
||||
Update = "update",
|
||||
};
|
||||
|
||||
ChooseAudioTrack = new LanguageStructure.ChooseAudioTrack
|
||||
|
@ -1420,6 +1420,15 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
case "CheckForUpdates/NoUpdates":
|
||||
language.CheckForUpdates.NoUpdates = reader.Value;
|
||||
break;
|
||||
case "CheckForUpdates/XPluginsHasAnUpdate":
|
||||
language.CheckForUpdates.XPluginsHasAnUpdate = reader.Value;
|
||||
break;
|
||||
case "CheckForUpdates/OnePluginsHasAnUpdate":
|
||||
language.CheckForUpdates.OnePluginsHasAnUpdate = reader.Value;
|
||||
break;
|
||||
case "CheckForUpdates/Update":
|
||||
language.CheckForUpdates.Update = reader.Value;
|
||||
break;
|
||||
case "ChooseAudioTrack/Title":
|
||||
language.ChooseAudioTrack.Title = reader.Value;
|
||||
break;
|
||||
|
@ -567,6 +567,9 @@
|
||||
public string CheckingForUpdatesNewVersion { get; set; }
|
||||
public string InstallUpdate { get; set; }
|
||||
public string NoUpdates { get; set; }
|
||||
public string XPluginsHasAnUpdate { get; set; }
|
||||
public string OnePluginsHasAnUpdate { get; set; }
|
||||
public string Update { get; set; }
|
||||
}
|
||||
|
||||
public class ChooseAudioTrack
|
||||
|
Loading…
Reference in New Issue
Block a user