mirror of
https://github.com/Maassoft/ColorControl.git
synced 2026-10-21 16:12:18 -05:00
add firmware downgrade functionality
This commit is contained in:
1 parent
f83869da04
commit
74cefc00f7
9 files changed
+91
-23
No files matched your search
@@ -27,7 +27,7 @@
|
||||
<ProductName>ColorControl</ProductName>
|
||||
<PublisherName>Maassoft</PublisherName>
|
||||
<ApplicationRevision>0</ApplicationRevision>
|
||||
<ApplicationVersion>4.3.0.0</ApplicationVersion>
|
||||
<ApplicationVersion>4.4.0.0</ApplicationVersion>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<PublishWizardCompleted>true</PublishWizardCompleted>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
|
||||
@@ -289,7 +289,8 @@ namespace ColorControl
|
||||
_lgTvApi = null;
|
||||
}
|
||||
}
|
||||
public async Task<bool> ExecutePreset(LgPreset preset, bool reconnect = false)
|
||||
|
||||
public async Task<bool> ExecutePreset(LgPreset preset, bool reconnect, LgServiceConfig config)
|
||||
{
|
||||
var hasApp = !string.IsNullOrEmpty(preset.appId);
|
||||
|
||||
@@ -315,7 +316,12 @@ namespace ColorControl
|
||||
{
|
||||
try
|
||||
{
|
||||
await _lgTvApi.LaunchApp(preset.appId);
|
||||
dynamic @params = null;
|
||||
if (config.AllowFirmwareDowngrade && preset.appId.Equals("com.webos.app.softwareupdate"))
|
||||
{
|
||||
@params = new { mode = "user", flagUpdate = true };
|
||||
}
|
||||
await _lgTvApi.LaunchApp(preset.appId, @params);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
@@ -350,7 +350,7 @@ namespace ColorControl
|
||||
return false;
|
||||
}
|
||||
|
||||
var result = await device.ExecutePreset(preset, reconnect);
|
||||
var result = await device.ExecutePreset(preset, reconnect, Config);
|
||||
|
||||
_lastAppliedPreset = preset;
|
||||
|
||||
|
||||
@@ -20,6 +20,8 @@ namespace ColorControl
|
||||
|
||||
public bool ShowRemoteControl { get; set; }
|
||||
|
||||
public bool AllowFirmwareDowngrade { get; set; }
|
||||
|
||||
public LgServiceConfig()
|
||||
{
|
||||
PowerOnDelayAfterResume = 5000;
|
||||
|
||||
Generated
+29
-14
@@ -178,6 +178,7 @@
|
||||
this.edtDelayDisplaySettings = new System.Windows.Forms.NumericUpDown();
|
||||
this.label6 = new System.Windows.Forms.Label();
|
||||
this.grpGeneralOptions = new System.Windows.Forms.GroupBox();
|
||||
this.chkCheckForUpdates = new System.Windows.Forms.CheckBox();
|
||||
this.chkMinimizeToSystemTray = new System.Windows.Forms.CheckBox();
|
||||
this.chkMinimizeOnClose = new System.Windows.Forms.CheckBox();
|
||||
this.chkStartMinimized = new System.Windows.Forms.CheckBox();
|
||||
@@ -193,7 +194,7 @@
|
||||
this.lbPlugins = new System.Windows.Forms.ListBox();
|
||||
this.label7 = new System.Windows.Forms.Label();
|
||||
this.lblInfo = new System.Windows.Forms.Label();
|
||||
this.chkCheckForUpdates = new System.Windows.Forms.CheckBox();
|
||||
this.chkLgAllowDowngrade = new System.Windows.Forms.CheckBox();
|
||||
this.tcMain.SuspendLayout();
|
||||
this.tabNVIDIA.SuspendLayout();
|
||||
this.mnuNvPresets.SuspendLayout();
|
||||
@@ -1610,7 +1611,7 @@
|
||||
this.grpMiscellaneousOptions.Controls.Add(this.edtBlankScreenSaverShortcut);
|
||||
this.grpMiscellaneousOptions.Controls.Add(this.lblFixChromeFontsDescription);
|
||||
this.grpMiscellaneousOptions.Controls.Add(this.chkFixChromeFonts);
|
||||
this.grpMiscellaneousOptions.Location = new System.Drawing.Point(6, 309);
|
||||
this.grpMiscellaneousOptions.Location = new System.Drawing.Point(6, 253);
|
||||
this.grpMiscellaneousOptions.Name = "grpMiscellaneousOptions";
|
||||
this.grpMiscellaneousOptions.Size = new System.Drawing.Size(400, 130);
|
||||
this.grpMiscellaneousOptions.TabIndex = 5;
|
||||
@@ -1668,14 +1669,15 @@
|
||||
//
|
||||
// grpLGOptions
|
||||
//
|
||||
this.grpLGOptions.Controls.Add(this.chkLgAllowDowngrade);
|
||||
this.grpLGOptions.Controls.Add(this.chkLgOldWolMechanism);
|
||||
this.grpLGOptions.Controls.Add(this.btnLGTestPower);
|
||||
this.grpLGOptions.Controls.Add(this.lblLgMaxPowerOnRetriesDescription);
|
||||
this.grpLGOptions.Controls.Add(this.edtLgMaxPowerOnRetries);
|
||||
this.grpLGOptions.Controls.Add(this.lblLgMaxPowerOnRetries);
|
||||
this.grpLGOptions.Location = new System.Drawing.Point(6, 196);
|
||||
this.grpLGOptions.Location = new System.Drawing.Point(6, 118);
|
||||
this.grpLGOptions.Name = "grpLGOptions";
|
||||
this.grpLGOptions.Size = new System.Drawing.Size(403, 107);
|
||||
this.grpLGOptions.Size = new System.Drawing.Size(403, 129);
|
||||
this.grpLGOptions.TabIndex = 4;
|
||||
this.grpLGOptions.TabStop = false;
|
||||
this.grpLGOptions.Text = "LG controller";
|
||||
@@ -1739,12 +1741,13 @@
|
||||
//
|
||||
this.grpHDROptions.Controls.Add(this.edtDelayDisplaySettings);
|
||||
this.grpHDROptions.Controls.Add(this.label6);
|
||||
this.grpHDROptions.Location = new System.Drawing.Point(6, 118);
|
||||
this.grpHDROptions.Location = new System.Drawing.Point(412, 316);
|
||||
this.grpHDROptions.Name = "grpHDROptions";
|
||||
this.grpHDROptions.Size = new System.Drawing.Size(400, 72);
|
||||
this.grpHDROptions.TabIndex = 3;
|
||||
this.grpHDROptions.TabStop = false;
|
||||
this.grpHDROptions.Text = "HDR";
|
||||
this.grpHDROptions.Visible = false;
|
||||
//
|
||||
// edtDelayDisplaySettings
|
||||
//
|
||||
@@ -1789,6 +1792,17 @@
|
||||
this.grpGeneralOptions.TabStop = false;
|
||||
this.grpGeneralOptions.Text = "General";
|
||||
//
|
||||
// chkCheckForUpdates
|
||||
//
|
||||
this.chkCheckForUpdates.AutoSize = true;
|
||||
this.chkCheckForUpdates.Location = new System.Drawing.Point(204, 42);
|
||||
this.chkCheckForUpdates.Name = "chkCheckForUpdates";
|
||||
this.chkCheckForUpdates.Size = new System.Drawing.Size(177, 17);
|
||||
this.chkCheckForUpdates.TabIndex = 6;
|
||||
this.chkCheckForUpdates.Text = "Automatically check for updates";
|
||||
this.chkCheckForUpdates.UseVisualStyleBackColor = true;
|
||||
this.chkCheckForUpdates.CheckedChanged += new System.EventHandler(this.chkCheckForUpdates_CheckedChanged);
|
||||
//
|
||||
// chkMinimizeToSystemTray
|
||||
//
|
||||
this.chkMinimizeToSystemTray.AutoSize = true;
|
||||
@@ -1954,16 +1968,16 @@
|
||||
this.lblInfo.TabIndex = 1;
|
||||
this.lblInfo.Text = "Info";
|
||||
//
|
||||
// chkCheckForUpdates
|
||||
// chkLgAllowDowngrade
|
||||
//
|
||||
this.chkCheckForUpdates.AutoSize = true;
|
||||
this.chkCheckForUpdates.Location = new System.Drawing.Point(204, 42);
|
||||
this.chkCheckForUpdates.Name = "chkCheckForUpdates";
|
||||
this.chkCheckForUpdates.Size = new System.Drawing.Size(177, 17);
|
||||
this.chkCheckForUpdates.TabIndex = 6;
|
||||
this.chkCheckForUpdates.Text = "Automatically check for updates";
|
||||
this.chkCheckForUpdates.UseVisualStyleBackColor = true;
|
||||
this.chkCheckForUpdates.CheckedChanged += new System.EventHandler(this.chkCheckForUpdates_CheckedChanged);
|
||||
this.chkLgAllowDowngrade.AutoSize = true;
|
||||
this.chkLgAllowDowngrade.Location = new System.Drawing.Point(9, 97);
|
||||
this.chkLgAllowDowngrade.Name = "chkLgAllowDowngrade";
|
||||
this.chkLgAllowDowngrade.Size = new System.Drawing.Size(275, 17);
|
||||
this.chkLgAllowDowngrade.TabIndex = 8;
|
||||
this.chkLgAllowDowngrade.Text = "Allow firmware downgrade with Software Update-app";
|
||||
this.chkLgAllowDowngrade.UseVisualStyleBackColor = true;
|
||||
this.chkLgAllowDowngrade.CheckedChanged += new System.EventHandler(this.chkLgAllowDowngrade_CheckedChanged);
|
||||
//
|
||||
// MainForm
|
||||
//
|
||||
@@ -2186,6 +2200,7 @@
|
||||
private System.Windows.Forms.Button btnLgPresetEditTriggerConditions;
|
||||
private System.Windows.Forms.TextBox edtLgPresetTriggerConditions;
|
||||
private System.Windows.Forms.CheckBox chkCheckForUpdates;
|
||||
private System.Windows.Forms.CheckBox chkLgAllowDowngrade;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -178,6 +178,7 @@ namespace ColorControl
|
||||
edtLgMaxPowerOnRetries.Value = _lgService.Config.PowerOnRetries;
|
||||
edtLgDeviceFilter.Text = _lgService.Config.DeviceSearchKey;
|
||||
chkLgOldWolMechanism.Checked = _lgService.Config.UseOldNpcapWol;
|
||||
chkLgAllowDowngrade.Checked = _lgService.Config.AllowFirmwareDowngrade;
|
||||
|
||||
var values = Enum.GetValues(typeof(ButtonType));
|
||||
foreach (var button in values)
|
||||
@@ -2816,5 +2817,32 @@ Do you want to continue?"
|
||||
_config.CheckForUpdates = chkCheckForUpdates.Checked;
|
||||
}
|
||||
}
|
||||
|
||||
private void chkLgAllowDowngrade_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (!_initialized)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (chkLgAllowDowngrade.Checked)
|
||||
{
|
||||
if (MessageForms.QuestionYesNo(
|
||||
@"Are you sure you want to enable firmware downgrade functionality with the Software Update-app?
|
||||
This may cause irreversible damage to your tv and will void your warranty.
|
||||
This app and its creator are in no way accountable for any damages it may cause to your tv."
|
||||
) != DialogResult.Yes)
|
||||
{
|
||||
chkLgAllowDowngrade.Checked = false;
|
||||
return;
|
||||
}
|
||||
MessageForms.InfoOk(
|
||||
@"Firmware downgrade functionality activated.
|
||||
In order to use it, you must create and execute a preset on the LG controller tab that starts the app Software Update (com.webos.app.softwareupdate)."
|
||||
);
|
||||
}
|
||||
|
||||
_lgService.Config.AllowFirmwareDowngrade = chkLgAllowDowngrade.Checked;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -40,7 +40,14 @@ namespace ColorControl
|
||||
|
||||
public static void InfoOk(string text, string title = null, string url = null)
|
||||
{
|
||||
MessageBox.Show(text, title ?? MainForm?.Text, MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, 0, url);
|
||||
if (url != null)
|
||||
{
|
||||
MessageBox.Show(text, title ?? MainForm?.Text, MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, 0, url);
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show(text, title ?? MainForm?.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
}
|
||||
|
||||
public static DialogResult QuestionYesNo(string text)
|
||||
|
||||
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("4.3.0.0")]
|
||||
[assembly: AssemblyFileVersion("4.3.0.0")]
|
||||
[assembly: AssemblyVersion("4.4.0.0")]
|
||||
[assembly: AssemblyFileVersion("4.4.0.0")]
|
||||
@@ -447,9 +447,19 @@ namespace LgTv
|
||||
return appList.OrderBy(e => e.title);
|
||||
}
|
||||
|
||||
public async Task<string> LaunchApp(string appId)
|
||||
public async Task<string> LaunchApp(string appId, dynamic @params = null)
|
||||
{
|
||||
var requestMessage = new RequestMessage("ssap://system.launcher/launch", new { id = appId });
|
||||
dynamic payload;
|
||||
if (@params != null)
|
||||
{
|
||||
payload = new { id = appId, @params = @params };
|
||||
}
|
||||
else
|
||||
{
|
||||
payload = new { id = appId };
|
||||
}
|
||||
|
||||
var requestMessage = new RequestMessage("ssap://system.launcher/launch", payload);
|
||||
var response = await _connection.SendCommandAsync(requestMessage);
|
||||
return (string)response.sessionId;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user