mirror of
https://github.com/chylex/TweetDuck.git
synced 2025-04-09 06:15:49 +02:00
Address code analysis and remove unused code
This commit is contained in:
parent
d691bef1fb
commit
59c9801437
Configuration
Core
Controls
Notification
Other/Settings
Utils
Plugins/Events
Resources
lib/TweetLib.Communication
@ -5,9 +5,7 @@
|
||||
|
||||
namespace TweetDuck.Configuration{
|
||||
sealed class SystemConfig{
|
||||
private static readonly FileSerializer<SystemConfig> Serializer = new FileSerializer<SystemConfig>{
|
||||
// HandleUnknownProperties = (obj, data) => {}
|
||||
};
|
||||
private static readonly FileSerializer<SystemConfig> Serializer = new FileSerializer<SystemConfig>();
|
||||
|
||||
public static readonly bool IsHardwareAccelerationSupported = File.Exists(Path.Combine(Program.ProgramPath, "libEGL.dll")) &&
|
||||
File.Exists(Path.Combine(Program.ProgramPath, "libGLESv2.dll"));
|
||||
|
@ -2,8 +2,6 @@
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
using TweetDuck.Core.Utils;
|
||||
using TweetLib.Communication;
|
||||
|
||||
namespace TweetDuck.Core.Controls{
|
||||
static class ControlExtensions{
|
||||
@ -68,12 +66,6 @@ public static bool AlignValueToTick(this TrackBar trackBar){
|
||||
else return true;
|
||||
}
|
||||
|
||||
public static void SetElevated(this Button button){
|
||||
button.Text = " "+button.Text;
|
||||
button.FlatStyle = FlatStyle.System;
|
||||
Comms.SendMessage(button.Handle, NativeMethods.BCM_SETSHIELD, 0, 1);
|
||||
}
|
||||
|
||||
public static void EnableMultilineShortcuts(this TextBox textBox){
|
||||
textBox.KeyDown += (sender, args) => {
|
||||
if (args.Control && args.KeyCode == Keys.A){
|
||||
|
@ -91,7 +91,7 @@ public bool CanResizeWindow{
|
||||
|
||||
public event EventHandler Initialized;
|
||||
|
||||
public FormNotificationBase(FormBrowser owner, bool enableContextMenu){
|
||||
protected FormNotificationBase(FormBrowser owner, bool enableContextMenu){
|
||||
InitializeComponent();
|
||||
|
||||
this.owner = owner;
|
||||
@ -190,10 +190,6 @@ protected virtual void SetNotificationSize(int width, int height){
|
||||
browser.ClientSize = ClientSize = new Size(BrowserUtils.Scale(width, SizeScale), BrowserUtils.Scale(height, SizeScale));
|
||||
}
|
||||
|
||||
protected virtual void OnNotificationReady(){
|
||||
MoveToVisibleLocation();
|
||||
}
|
||||
|
||||
protected virtual void UpdateTitle(){
|
||||
string title = currentNotification?.ColumnTitle;
|
||||
Text = string.IsNullOrEmpty(title) || !Program.UserConfig.DisplayNotificationColumn ? Program.BrandName : Program.BrandName+" - "+title;
|
||||
|
@ -279,7 +279,7 @@ private void PrepareAndDisplayWindow(){
|
||||
StartMouseHook();
|
||||
}
|
||||
|
||||
protected override void OnNotificationReady(){
|
||||
protected virtual void OnNotificationReady(){
|
||||
PrepareAndDisplayWindow();
|
||||
timerProgress.Start();
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ public IEnumerable<Control> InteractiveControls{
|
||||
}
|
||||
}
|
||||
|
||||
public BaseTabSettings(){
|
||||
protected BaseTabSettings(){
|
||||
Padding = new Padding(6);
|
||||
}
|
||||
|
||||
|
@ -16,7 +16,6 @@ static class NativeMethods{
|
||||
public const int GWL_STYLE = -16;
|
||||
|
||||
public const int SB_HORZ = 0;
|
||||
public const int BCM_SETSHIELD = 0x160C;
|
||||
|
||||
public const int WM_MOUSE_LL = 14;
|
||||
public const int WM_MOUSEWHEEL = 0x020A;
|
||||
|
@ -5,7 +5,7 @@ namespace TweetDuck.Plugins.Events{
|
||||
class PluginErrorEventArgs : EventArgs{
|
||||
public bool HasErrors => Errors.Count > 0;
|
||||
|
||||
public IList<string> Errors;
|
||||
public IList<string> Errors { get; }
|
||||
|
||||
public PluginErrorEventArgs(IList<string> errors){
|
||||
this.Errors = errors;
|
||||
|
@ -1,5 +1,4 @@
|
||||
using CefSharp;
|
||||
using CefSharp.WinForms;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
@ -21,28 +20,16 @@ public static string LoadResource(string name, bool silent = false){
|
||||
}
|
||||
}
|
||||
|
||||
public static void ExecuteFile(ChromiumWebBrowser browser, string file){
|
||||
ExecuteScript(browser, LoadResource(file), GetRootIdentifier(file));
|
||||
}
|
||||
|
||||
public static void ExecuteFile(IFrame frame, string file){
|
||||
ExecuteScript(frame, LoadResource(file), GetRootIdentifier(file));
|
||||
}
|
||||
|
||||
public static void ExecuteScript(ChromiumWebBrowser browser, string script, string identifier){
|
||||
if (script == null)return;
|
||||
|
||||
using(IFrame frame = browser.GetMainFrame()){
|
||||
public static void ExecuteScript(IFrame frame, string script, string identifier){
|
||||
if (script != null){
|
||||
frame.ExecuteJavaScriptAsync(script, UrlPrefix+identifier, 1);
|
||||
}
|
||||
}
|
||||
|
||||
public static void ExecuteScript(IFrame frame, string script, string identifier){
|
||||
if (script == null)return;
|
||||
|
||||
frame.ExecuteJavaScriptAsync(script, UrlPrefix+identifier, 1);
|
||||
}
|
||||
|
||||
public static string GetRootIdentifier(string file){
|
||||
return "root:"+Path.GetFileNameWithoutExtension(file);
|
||||
}
|
||||
|
@ -208,6 +208,9 @@
|
||||
};
|
||||
})();
|
||||
|
||||
//
|
||||
// Function: Shows tweet detail, used in notification context menu.
|
||||
//
|
||||
window.TDGF_showTweetDetail = function(columnKey, tweetId){
|
||||
let column = TD.controller.columnManager.get(columnKey);
|
||||
return 1 if !column; // column no longer exists
|
||||
|
@ -3,30 +3,10 @@
|
||||
|
||||
namespace TweetLib.Communication{
|
||||
public static class Comms{
|
||||
public static void SendMessage(IntPtr hWnd, uint msg, uint wParam, int lParam){
|
||||
NativeMethods.SendMessage(hWnd, msg, new UIntPtr(wParam), new IntPtr(lParam));
|
||||
}
|
||||
|
||||
public static void SendMessage(IntPtr hWnd, uint msg, UIntPtr wParam, IntPtr lParam){
|
||||
NativeMethods.SendMessage(hWnd, msg, wParam, lParam);
|
||||
}
|
||||
|
||||
public static void PostMessage(IntPtr hWnd, uint msg, uint wParam, int lParam){
|
||||
NativeMethods.PostMessage(hWnd, msg, new UIntPtr(wParam), new IntPtr(lParam));
|
||||
}
|
||||
|
||||
public static void PostMessage(IntPtr hWnd, uint msg, UIntPtr wParam, IntPtr lParam){
|
||||
NativeMethods.PostMessage(hWnd, msg, wParam, lParam);
|
||||
}
|
||||
|
||||
public static void BroadcastMessage(uint msg, uint wParam, int lParam){
|
||||
NativeMethods.PostMessage(NativeMethods.HWND_BROADCAST, msg, new UIntPtr(wParam), new IntPtr(lParam));
|
||||
}
|
||||
|
||||
public static void BroadcastMessage(uint msg, UIntPtr wParam, IntPtr lParam){
|
||||
NativeMethods.PostMessage(NativeMethods.HWND_BROADCAST, msg, wParam, lParam);
|
||||
}
|
||||
|
||||
public static uint RegisterMessage(string name){
|
||||
return NativeMethods.RegisterWindowMessage(name);
|
||||
}
|
||||
|
@ -4,9 +4,6 @@
|
||||
namespace TweetLib.Communication.Utils{
|
||||
static class NativeMethods{
|
||||
public static readonly IntPtr HWND_BROADCAST = new IntPtr(0xFFFF);
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
public static extern IntPtr SendMessage(IntPtr hWnd, uint msg, UIntPtr wParam, IntPtr lParam);
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
public static extern bool PostMessage(IntPtr hWnd, uint msg, UIntPtr wParam, IntPtr lParam);
|
||||
|
Loading…
Reference in New Issue
Block a user