From a42ad439ecc9eccae64404ae8124d17308ce2c96 Mon Sep 17 00:00:00 2001 From: Lars Op den Kamp Date: Tue, 28 Feb 2012 02:23:58 +0100 Subject: [PATCH] LibCecSharp: more cosmetics --- src/CecSharpTester/CecSharpClient.cs | 53 +++++++++---------- src/cec-config-gui/AsyncForm.cs | 16 +++--- src/cec-config-gui/CecButtonConfig.cs | 4 +- src/cec-config-gui/DeviceInformation.cs | 9 +--- src/cec-config-gui/Program.cs | 1 - src/cec-config-gui/actions/RescanDevices.cs | 1 - .../actions/SendActivateSource.cs | 5 +- src/cec-config-gui/actions/SendImageViewOn.cs | 5 +- src/cec-config-gui/actions/SendStandby.cs | 5 +- src/cec-config-gui/actions/ShowDeviceInfo.cs | 5 +- .../actions/UpdateConnectedDevice.cs | 5 +- .../actions/UpdateDeviceInfo.cs | 5 +- src/cec-config-gui/actions/UpdateEvent.cs | 8 +-- .../actions/UpdatePhysicalAddress.cs | 5 +- 14 files changed, 45 insertions(+), 82 deletions(-) diff --git a/src/CecSharpTester/CecSharpClient.cs b/src/CecSharpTester/CecSharpClient.cs index 006c83a..2f49776 100644 --- a/src/CecSharpTester/CecSharpClient.cs +++ b/src/CecSharpTester/CecSharpClient.cs @@ -31,7 +31,6 @@ */ using System; -using System.Collections.Generic; using System.Text; using CecSharp; @@ -168,31 +167,31 @@ namespace CecSharpClient void ShowConsoleHelp() { Console.WriteLine( - "================================================================================" + System.Environment.NewLine + - "Available commands:" + System.Environment.NewLine + - System.Environment.NewLine + - "[tx] {bytes} transfer bytes over the CEC line." + System.Environment.NewLine + - "[txn] {bytes} transfer bytes but don't wait for transmission ACK." + System.Environment.NewLine + - "[on] {address} power on the device with the given logical address." + System.Environment.NewLine + - "[standby] {address} put the device with the given address in standby mode." + System.Environment.NewLine + - "[la] {logical_address} change the logical address of the CEC adapter." + System.Environment.NewLine + - "[pa] {physical_address} change the physical address of the CEC adapter." + System.Environment.NewLine + - "[osd] {addr} {string} set OSD message on the specified device." + System.Environment.NewLine + - "[ver] {addr} get the CEC version of the specified device." + System.Environment.NewLine + - "[ven] {addr} get the vendor ID of the specified device." + System.Environment.NewLine + - "[lang] {addr} get the menu language of the specified device." + System.Environment.NewLine + - "[pow] {addr} get the power status of the specified device." + System.Environment.NewLine + - "[poll] {addr} poll the specified device." + System.Environment.NewLine + - "[scan] scan the CEC bus and display device info" + System.Environment.NewLine + - "[mon] {1|0} enable or disable CEC bus monitoring." + System.Environment.NewLine + - "[log] {1 - 31} change the log level. see cectypes.h for values." + System.Environment.NewLine + - "[ping] send a ping command to the CEC adapter." + System.Environment.NewLine + - "[bl] to let the adapter enter the bootloader, to upgrade" + System.Environment.NewLine + - " the flash rom." + System.Environment.NewLine + - "[r] reconnect to the CEC adapter." + System.Environment.NewLine + - "[h] or [help] show this help." + System.Environment.NewLine + - "[q] or [quit] to quit the CEC test client and switch off all" + System.Environment.NewLine + - " connected CEC devices." + System.Environment.NewLine + + "================================================================================" + Environment.NewLine + + "Available commands:" + Environment.NewLine + + Environment.NewLine + + "[tx] {bytes} transfer bytes over the CEC line." + Environment.NewLine + + "[txn] {bytes} transfer bytes but don't wait for transmission ACK." + Environment.NewLine + + "[on] {address} power on the device with the given logical address." + Environment.NewLine + + "[standby] {address} put the device with the given address in standby mode." + Environment.NewLine + + "[la] {logical_address} change the logical address of the CEC adapter." + Environment.NewLine + + "[pa] {physical_address} change the physical address of the CEC adapter." + Environment.NewLine + + "[osd] {addr} {string} set OSD message on the specified device." + Environment.NewLine + + "[ver] {addr} get the CEC version of the specified device." + Environment.NewLine + + "[ven] {addr} get the vendor ID of the specified device." + Environment.NewLine + + "[lang] {addr} get the menu language of the specified device." + Environment.NewLine + + "[pow] {addr} get the power status of the specified device." + Environment.NewLine + + "[poll] {addr} poll the specified device." + Environment.NewLine + + "[scan] scan the CEC bus and display device info" + Environment.NewLine + + "[mon] {1|0} enable or disable CEC bus monitoring." + Environment.NewLine + + "[log] {1 - 31} change the log level. see cectypes.h for values." + Environment.NewLine + + "[ping] send a ping command to the CEC adapter." + Environment.NewLine + + "[bl] to let the adapter enter the bootloader, to upgrade" + Environment.NewLine + + " the flash rom." + Environment.NewLine + + "[r] reconnect to the CEC adapter." + Environment.NewLine + + "[h] or [help] show this help." + Environment.NewLine + + "[q] or [quit] to quit the CEC test client and switch off all" + Environment.NewLine + + " connected CEC devices." + Environment.NewLine + "================================================================================"); } @@ -205,7 +204,7 @@ namespace CecSharpClient Console.WriteLine("waiting for input"); command = Console.ReadLine(); - if (command.Length == 0) + if (command != null && command.Length == 0) continue; string[] splitCommand = command.Split(' '); if (splitCommand[0] == "tx" || splitCommand[0] == "txn") diff --git a/src/cec-config-gui/AsyncForm.cs b/src/cec-config-gui/AsyncForm.cs index c0aca4a..c4d02bf 100644 --- a/src/cec-config-gui/AsyncForm.cs +++ b/src/cec-config-gui/AsyncForm.cs @@ -10,7 +10,7 @@ namespace CecConfigGui { if (control.InvokeRequired) { - SetControlEnabledCallback d = new SetControlEnabledCallback(SetControlEnabled); + SetControlEnabledCallback d = SetControlEnabled; try { Invoke(d, new object[] { control, val }); @@ -28,7 +28,7 @@ namespace CecConfigGui { if (control.InvokeRequired) { - SetControlTextCallback d = new SetControlTextCallback(SetControlText); + SetControlTextCallback d = SetControlText; try { Invoke(d, new object[] { control, val }); @@ -46,7 +46,7 @@ namespace CecConfigGui { if (control.InvokeRequired) { - SetCheckboxCheckedCallback d = new SetCheckboxCheckedCallback(SetCheckboxChecked); + SetCheckboxCheckedCallback d = SetCheckboxChecked; try { Invoke(d, new object[] { control, val }); @@ -64,7 +64,7 @@ namespace CecConfigGui { if (control.InvokeRequired) { - SetCheckboxItemCheckedCallback d = new SetCheckboxItemCheckedCallback(SetCheckboxItemChecked); + SetCheckboxItemCheckedCallback d = SetCheckboxItemChecked; try { Invoke(d, new object[] { control, index, val }); @@ -82,7 +82,7 @@ namespace CecConfigGui { if (control.InvokeRequired) { - SetProgressValueCallback d = new SetProgressValueCallback(SetProgressValue); + SetProgressValueCallback d = SetProgressValue; try { Invoke(d, new object[] { control, val }); @@ -100,7 +100,7 @@ namespace CecConfigGui { if (control.InvokeRequired) { - SetComboBoxItemsCallback d = new SetComboBoxItemsCallback(SetComboBoxItems); + SetComboBoxItemsCallback d = SetComboBoxItems; try { Invoke(d, new object[] { control, selectedText, val }); @@ -120,7 +120,7 @@ namespace CecConfigGui { if (control.InvokeRequired) { - SetControlVisibleCallback d = new SetControlVisibleCallback(SetControlVisible); + SetControlVisibleCallback d = SetControlVisible; try { Invoke(d, new object[] { control, val }); @@ -138,7 +138,7 @@ namespace CecConfigGui { if (InvokeRequired) { - DisplayDialogCallback d = new DisplayDialogCallback(DisplayDialog); + DisplayDialogCallback d = DisplayDialog; try { Invoke(d, new object[] { control, modal }); diff --git a/src/cec-config-gui/CecButtonConfig.cs b/src/cec-config-gui/CecButtonConfig.cs index 1c2cc81..1fb070d 100644 --- a/src/cec-config-gui/CecButtonConfig.cs +++ b/src/cec-config-gui/CecButtonConfig.cs @@ -1,6 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; +using System.Collections.Generic; namespace CecConfigGui { diff --git a/src/cec-config-gui/DeviceInformation.cs b/src/cec-config-gui/DeviceInformation.cs index 0743e9e..f7992e3 100644 --- a/src/cec-config-gui/DeviceInformation.cs +++ b/src/cec-config-gui/DeviceInformation.cs @@ -1,9 +1,4 @@ using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Text; using System.Windows.Forms; using CecSharp; @@ -19,8 +14,8 @@ namespace CecConfigGui Lib = lib; Address = address; InitializeComponent(); - this.lDevice.Text = lib.ToString(address); - this.lLogicalAddress.Text = String.Format("{0,1:X}", (int)address); + lDevice.Text = lib.ToString(address); + lLogicalAddress.Text = String.Format("{0,1:X}", (int)address); Update(devicePresent, vendor, isActiveSource, physicalAddress, version, power, osdName, menuLanguage); } diff --git a/src/cec-config-gui/Program.cs b/src/cec-config-gui/Program.cs index 0bc424c..25dbf33 100644 --- a/src/cec-config-gui/Program.cs +++ b/src/cec-config-gui/Program.cs @@ -1,5 +1,4 @@ using System; -using System.Collections.Generic; using System.Windows.Forms; namespace CecConfigGui diff --git a/src/cec-config-gui/actions/RescanDevices.cs b/src/cec-config-gui/actions/RescanDevices.cs index c81538d..33c6be9 100644 --- a/src/cec-config-gui/actions/RescanDevices.cs +++ b/src/cec-config-gui/actions/RescanDevices.cs @@ -1,5 +1,4 @@ using CecSharp; -using System.Windows.Forms; namespace CecConfigGui.actions { diff --git a/src/cec-config-gui/actions/SendActivateSource.cs b/src/cec-config-gui/actions/SendActivateSource.cs index 17154d6..1470c19 100644 --- a/src/cec-config-gui/actions/SendActivateSource.cs +++ b/src/cec-config-gui/actions/SendActivateSource.cs @@ -1,7 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; -using CecSharp; +using CecSharp; namespace CecConfigGui.actions { diff --git a/src/cec-config-gui/actions/SendImageViewOn.cs b/src/cec-config-gui/actions/SendImageViewOn.cs index 29e261e..6757073 100644 --- a/src/cec-config-gui/actions/SendImageViewOn.cs +++ b/src/cec-config-gui/actions/SendImageViewOn.cs @@ -1,7 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; -using CecSharp; +using CecSharp; namespace CecConfigGui.actions { diff --git a/src/cec-config-gui/actions/SendStandby.cs b/src/cec-config-gui/actions/SendStandby.cs index f2b587e..99bd023 100644 --- a/src/cec-config-gui/actions/SendStandby.cs +++ b/src/cec-config-gui/actions/SendStandby.cs @@ -1,7 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; -using CecSharp; +using CecSharp; namespace CecConfigGui.actions { diff --git a/src/cec-config-gui/actions/ShowDeviceInfo.cs b/src/cec-config-gui/actions/ShowDeviceInfo.cs index 628d4a9..8e6a48d 100644 --- a/src/cec-config-gui/actions/ShowDeviceInfo.cs +++ b/src/cec-config-gui/actions/ShowDeviceInfo.cs @@ -1,7 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; -using CecSharp; +using CecSharp; namespace CecConfigGui.actions { diff --git a/src/cec-config-gui/actions/UpdateConnectedDevice.cs b/src/cec-config-gui/actions/UpdateConnectedDevice.cs index c91358e..3fb635b 100644 --- a/src/cec-config-gui/actions/UpdateConnectedDevice.cs +++ b/src/cec-config-gui/actions/UpdateConnectedDevice.cs @@ -1,7 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; -using CecSharp; +using CecSharp; namespace CecConfigGui.actions { diff --git a/src/cec-config-gui/actions/UpdateDeviceInfo.cs b/src/cec-config-gui/actions/UpdateDeviceInfo.cs index 3cbde24..4fbf393 100644 --- a/src/cec-config-gui/actions/UpdateDeviceInfo.cs +++ b/src/cec-config-gui/actions/UpdateDeviceInfo.cs @@ -1,7 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; -using CecSharp; +using CecSharp; namespace CecConfigGui.actions { diff --git a/src/cec-config-gui/actions/UpdateEvent.cs b/src/cec-config-gui/actions/UpdateEvent.cs index dae21bf..a7e2df6 100644 --- a/src/cec-config-gui/actions/UpdateEvent.cs +++ b/src/cec-config-gui/actions/UpdateEvent.cs @@ -1,6 +1,4 @@ using System; -using System.Collections.Generic; -using System.Text; using CecSharp; namespace CecConfigGui @@ -62,11 +60,7 @@ namespace CecConfigGui public abstract class UpdateProcess { - public UpdateProcess() - { - } - - public void SendEvent(UpdateEventType type) + public void SendEvent(UpdateEventType type) { EventHandler temp = EventHandler; if (temp != null) diff --git a/src/cec-config-gui/actions/UpdatePhysicalAddress.cs b/src/cec-config-gui/actions/UpdatePhysicalAddress.cs index 1ed32ce..fab7304 100644 --- a/src/cec-config-gui/actions/UpdatePhysicalAddress.cs +++ b/src/cec-config-gui/actions/UpdatePhysicalAddress.cs @@ -1,7 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; -using CecSharp; +using CecSharp; namespace CecConfigGui.actions { -- 2.34.1