mirror of
https://github.com/chylex/TweetDuck.git
synced 2025-09-14 19:32:10 +02:00
Compare commits
30 Commits
Author | SHA1 | Date | |
---|---|---|---|
4c31e72d29 | |||
e3b2ff7f0e | |||
4c5f5e2cce | |||
39ae9b8ba0 | |||
5c7eb0535d | |||
235718390b | |||
5d4b72f224 | |||
dc76ae9d1f | |||
e44f4bb003 | |||
1fc1370d41 | |||
80a669c989 | |||
801c9eba2d | |||
f9704d2836 | |||
39687171e9 | |||
1d73691ef4 | |||
f8678d2515 | |||
fb108ea18d | |||
a7229a0677 | |||
d0dd112b98 | |||
1e07120eb5 | |||
fcd1f76cff | |||
e400d86d75 | |||
dca3410a5b | |||
9b314e2953 | |||
5635daf66d | |||
7e2e1645e9 | |||
4990afcdbb | |||
c11f36dfef | |||
abddf61c88 | |||
37fec7e952 |
@@ -14,7 +14,7 @@ namespace TweetDck.Configuration{
|
|||||||
sealed class UserConfig{
|
sealed class UserConfig{
|
||||||
private static readonly IFormatter Formatter = new BinaryFormatter();
|
private static readonly IFormatter Formatter = new BinaryFormatter();
|
||||||
|
|
||||||
private const int CurrentFileVersion = 8;
|
private const int CurrentFileVersion = 9;
|
||||||
|
|
||||||
// START OF CONFIGURATION
|
// START OF CONFIGURATION
|
||||||
|
|
||||||
@@ -34,84 +34,57 @@ namespace TweetDck.Configuration{
|
|||||||
|
|
||||||
public bool EnableSpellCheck { get; set; }
|
public bool EnableSpellCheck { get; set; }
|
||||||
public bool ExpandLinksOnHover { get; set; }
|
public bool ExpandLinksOnHover { get; set; }
|
||||||
|
public bool SwitchAccountSelectors { get; set; }
|
||||||
public bool EnableTrayHighlight { get; set; }
|
public bool EnableTrayHighlight { get; set; }
|
||||||
|
|
||||||
public bool EnableUpdateCheck { get; set; }
|
public bool EnableUpdateCheck { get; set; }
|
||||||
public string DismissedUpdate { get; set; }
|
public string DismissedUpdate { get; set; }
|
||||||
|
|
||||||
public PluginConfig Plugins { get; private set; }
|
[Obsolete] public PluginConfig Plugins { get; set; } // TODO remove eventually
|
||||||
public WindowState PluginsWindow { get; set; }
|
public WindowState PluginsWindow { get; set; }
|
||||||
|
|
||||||
public string CustomCefArgs { get; set; }
|
public string CustomCefArgs { get; set; }
|
||||||
public string CustomBrowserCSS { get; set; }
|
public string CustomBrowserCSS { get; set; }
|
||||||
public string CustomNotificationCSS { get; set; }
|
public string CustomNotificationCSS { get; set; }
|
||||||
|
|
||||||
public bool IsCustomNotificationPositionSet{
|
public bool IsCustomNotificationPositionSet => CustomNotificationPosition != ControlExtensions.InvisibleLocation;
|
||||||
get{
|
|
||||||
return CustomNotificationPosition != ControlExtensions.InvisibleLocation;
|
public string NotificationSoundPath{
|
||||||
}
|
get => string.IsNullOrEmpty(notificationSoundPath) ? string.Empty : notificationSoundPath;
|
||||||
|
set => notificationSoundPath = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool MuteNotifications{
|
public bool MuteNotifications{
|
||||||
get{
|
get => muteNotifications;
|
||||||
return muteNotifications;
|
|
||||||
}
|
|
||||||
|
|
||||||
set{
|
set{
|
||||||
if (muteNotifications == value)return;
|
if (muteNotifications != value){
|
||||||
|
|
||||||
muteNotifications = value;
|
muteNotifications = value;
|
||||||
|
MuteToggled?.Invoke(this, new EventArgs());
|
||||||
if (MuteToggled != null){
|
|
||||||
MuteToggled(this, new EventArgs());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int ZoomLevel{
|
public int ZoomLevel{
|
||||||
get{
|
get => zoomLevel;
|
||||||
return zoomLevel;
|
|
||||||
}
|
|
||||||
|
|
||||||
set{
|
set{
|
||||||
if (zoomLevel == value)return;
|
if (zoomLevel != value){
|
||||||
|
|
||||||
zoomLevel = value;
|
zoomLevel = value;
|
||||||
|
ZoomLevelChanged?.Invoke(this, new EventArgs());
|
||||||
if (ZoomLevelChanged != null){
|
|
||||||
ZoomLevelChanged(this, new EventArgs());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public double ZoomMultiplier{
|
public double ZoomMultiplier => zoomLevel/100.0;
|
||||||
get{
|
|
||||||
return zoomLevel/100.0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public string NotificationSoundPath{
|
|
||||||
get{
|
|
||||||
return string.IsNullOrEmpty(notificationSoundPath) ? string.Empty : notificationSoundPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
set{
|
|
||||||
notificationSoundPath = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public TrayIcon.Behavior TrayBehavior{
|
public TrayIcon.Behavior TrayBehavior{
|
||||||
get{
|
get => trayBehavior;
|
||||||
return trayBehavior;
|
|
||||||
}
|
|
||||||
|
|
||||||
set{
|
set{
|
||||||
if (trayBehavior == value)return;
|
if (trayBehavior != value){
|
||||||
|
|
||||||
trayBehavior = value;
|
trayBehavior = value;
|
||||||
|
TrayBehaviorChanged?.Invoke(this, new EventArgs());
|
||||||
if (TrayBehaviorChanged != null){
|
|
||||||
TrayBehaviorChanged(this, new EventArgs());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -149,12 +122,9 @@ namespace TweetDck.Configuration{
|
|||||||
NotificationDurationValue = 25;
|
NotificationDurationValue = 25;
|
||||||
EnableUpdateCheck = true;
|
EnableUpdateCheck = true;
|
||||||
ExpandLinksOnHover = true;
|
ExpandLinksOnHover = true;
|
||||||
|
SwitchAccountSelectors = true;
|
||||||
EnableTrayHighlight = true;
|
EnableTrayHighlight = true;
|
||||||
Plugins = new PluginConfig();
|
|
||||||
PluginsWindow = new WindowState();
|
PluginsWindow = new WindowState();
|
||||||
|
|
||||||
Plugins.DisableOfficialFromConfig("clear-columns");
|
|
||||||
Plugins.DisableOfficialFromConfig("reply-account");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpgradeFile(){
|
private void UpgradeFile(){
|
||||||
@@ -176,7 +146,6 @@ namespace TweetDck.Configuration{
|
|||||||
|
|
||||||
if (fileVersion == 2){
|
if (fileVersion == 2){
|
||||||
BrowserWindow = new WindowState();
|
BrowserWindow = new WindowState();
|
||||||
Plugins = new PluginConfig();
|
|
||||||
PluginsWindow = new WindowState();
|
PluginsWindow = new WindowState();
|
||||||
++fileVersion;
|
++fileVersion;
|
||||||
}
|
}
|
||||||
@@ -188,8 +157,6 @@ namespace TweetDck.Configuration{
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (fileVersion == 4){
|
if (fileVersion == 4){
|
||||||
Plugins.DisableOfficialFromConfig("clear-columns");
|
|
||||||
Plugins.DisableOfficialFromConfig("reply-account");
|
|
||||||
++fileVersion;
|
++fileVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -207,6 +174,11 @@ namespace TweetDck.Configuration{
|
|||||||
++fileVersion;
|
++fileVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (fileVersion == 8){
|
||||||
|
SwitchAccountSelectors = true;
|
||||||
|
++fileVersion;
|
||||||
|
}
|
||||||
|
|
||||||
// update the version
|
// update the version
|
||||||
fileVersion = CurrentFileVersion;
|
fileVersion = CurrentFileVersion;
|
||||||
Save();
|
Save();
|
||||||
@@ -248,10 +220,7 @@ namespace TweetDck.Configuration{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config != null){
|
config?.UpgradeFile();
|
||||||
config.UpgradeFile();
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}catch(FileNotFoundException){
|
}catch(FileNotFoundException){
|
||||||
}catch(DirectoryNotFoundException){
|
}catch(DirectoryNotFoundException){
|
||||||
|
@@ -9,7 +9,8 @@ namespace TweetDck.Core.Bridge{
|
|||||||
MuteNotifications = 2,
|
MuteNotifications = 2,
|
||||||
HasCustomNotificationSound = 4,
|
HasCustomNotificationSound = 4,
|
||||||
SkipOnLinkClick = 8,
|
SkipOnLinkClick = 8,
|
||||||
AllBrowser = ExpandLinksOnHover | MuteNotifications | HasCustomNotificationSound,
|
SwitchAccountSelectors = 16,
|
||||||
|
AllBrowser = ExpandLinksOnHover | SwitchAccountSelectors | MuteNotifications | HasCustomNotificationSound,
|
||||||
AllNotification = ExpandLinksOnHover | SkipOnLinkClick
|
AllNotification = ExpandLinksOnHover | SkipOnLinkClick
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -21,6 +22,10 @@ namespace TweetDck.Core.Bridge{
|
|||||||
build.Append("c.expandLinksOnHover=").Append(Program.UserConfig.ExpandLinksOnHover ? "true;" : "false;");
|
build.Append("c.expandLinksOnHover=").Append(Program.UserConfig.ExpandLinksOnHover ? "true;" : "false;");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (properties.HasFlag(Properties.SwitchAccountSelectors)){
|
||||||
|
build.Append("c.switchAccountSelectors=").Append(Program.UserConfig.SwitchAccountSelectors ? "true;" : "false;");
|
||||||
|
}
|
||||||
|
|
||||||
if (properties.HasFlag(Properties.MuteNotifications)){
|
if (properties.HasFlag(Properties.MuteNotifications)){
|
||||||
build.Append("c.muteNotifications=").Append(Program.UserConfig.MuteNotifications ? "true;" : "false;");
|
build.Append("c.muteNotifications=").Append(Program.UserConfig.MuteNotifications ? "true;" : "false;");
|
||||||
}
|
}
|
||||||
|
@@ -83,6 +83,10 @@ namespace TweetDck.Core.Bridge{
|
|||||||
form.InvokeAsyncSafe(WindowsUtils.ClipboardStripHtmlStyles);
|
form.InvokeAsyncSafe(WindowsUtils.ClipboardStripHtmlStyles);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int GetIdleSeconds(){
|
||||||
|
return NativeMethods.GetIdleSeconds();
|
||||||
|
}
|
||||||
|
|
||||||
public void OpenBrowser(string url){
|
public void OpenBrowser(string url){
|
||||||
BrowserUtils.OpenExternalBrowser(url);
|
BrowserUtils.OpenExternalBrowser(url);
|
||||||
}
|
}
|
||||||
|
@@ -3,11 +3,7 @@ using System.Windows.Forms;
|
|||||||
|
|
||||||
namespace TweetDck.Core.Controls{
|
namespace TweetDck.Core.Controls{
|
||||||
class FlatButton : Button{
|
class FlatButton : Button{
|
||||||
protected override bool ShowFocusCues{
|
protected override bool ShowFocusCues => false;
|
||||||
get{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public FlatButton(){
|
public FlatButton(){
|
||||||
GotFocus += FlatButton_GotFocus;
|
GotFocus += FlatButton_GotFocus;
|
||||||
|
@@ -6,21 +6,11 @@ using System.Windows.Forms;
|
|||||||
|
|
||||||
namespace TweetDck.Core.Controls{
|
namespace TweetDck.Core.Controls{
|
||||||
sealed partial class TabPanel : UserControl{
|
sealed partial class TabPanel : UserControl{
|
||||||
public IEnumerable<TabButton> Buttons{
|
public Panel Content => panelContent;
|
||||||
get{
|
public IEnumerable<TabButton> Buttons => panelButtons.Controls.Cast<TabButton>();
|
||||||
return panelButtons.Controls.Cast<TabButton>();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public TabButton ActiveButton { get; private set; }
|
public TabButton ActiveButton { get; private set; }
|
||||||
|
|
||||||
// ReSharper disable once ConvertToAutoPropertyWithPrivateSetter
|
|
||||||
public Panel Content{
|
|
||||||
get{
|
|
||||||
return panelContent;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private int btnWidth;
|
private int btnWidth;
|
||||||
|
|
||||||
public TabPanel(){
|
public TabPanel(){
|
||||||
|
@@ -1,33 +1,29 @@
|
|||||||
using System;
|
using CefSharp;
|
||||||
using System.Windows.Forms;
|
|
||||||
using CefSharp;
|
|
||||||
using CefSharp.WinForms;
|
using CefSharp.WinForms;
|
||||||
using TweetDck.Configuration;
|
using System;
|
||||||
using TweetDck.Core.Handling;
|
using System.Diagnostics;
|
||||||
using TweetDck.Core.Other;
|
|
||||||
using TweetDck.Resources;
|
|
||||||
using TweetDck.Core.Controls;
|
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using TweetDck.Configuration;
|
||||||
|
using TweetDck.Core.Bridge;
|
||||||
|
using TweetDck.Core.Controls;
|
||||||
|
using TweetDck.Core.Handling;
|
||||||
|
using TweetDck.Core.Notification;
|
||||||
|
using TweetDck.Core.Notification.Screenshot;
|
||||||
|
using TweetDck.Core.Notification.Sound;
|
||||||
|
using TweetDck.Core.Other;
|
||||||
using TweetDck.Core.Utils;
|
using TweetDck.Core.Utils;
|
||||||
using TweetDck.Updates;
|
|
||||||
using TweetDck.Plugins;
|
using TweetDck.Plugins;
|
||||||
using TweetDck.Plugins.Enums;
|
using TweetDck.Plugins.Enums;
|
||||||
using TweetDck.Plugins.Events;
|
using TweetDck.Plugins.Events;
|
||||||
using TweetDck.Core.Bridge;
|
using TweetDck.Resources;
|
||||||
using TweetDck.Core.Notification;
|
using TweetDck.Updates;
|
||||||
using TweetDck.Core.Notification.Screenshot;
|
|
||||||
using TweetDck.Updates.Events;
|
using TweetDck.Updates.Events;
|
||||||
using System.Diagnostics;
|
|
||||||
using System.Linq;
|
|
||||||
using TweetDck.Core.Notification.Sound;
|
|
||||||
|
|
||||||
namespace TweetDck.Core{
|
namespace TweetDck.Core{
|
||||||
sealed partial class FormBrowser : Form{
|
sealed partial class FormBrowser : Form{
|
||||||
private static UserConfig Config{
|
private static UserConfig Config => Program.UserConfig;
|
||||||
get{
|
|
||||||
return Program.UserConfig;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public string UpdateInstallerPath { get; private set; }
|
public string UpdateInstallerPath { get; private set; }
|
||||||
|
|
||||||
@@ -93,13 +89,8 @@ namespace TweetDck.Core{
|
|||||||
browser.Dispose();
|
browser.Dispose();
|
||||||
contextMenu.Dispose();
|
contextMenu.Dispose();
|
||||||
|
|
||||||
if (notificationScreenshotManager != null){
|
notificationScreenshotManager?.Dispose();
|
||||||
notificationScreenshotManager.Dispose();
|
soundNotification?.Dispose();
|
||||||
}
|
|
||||||
|
|
||||||
if (soundNotification != null){
|
|
||||||
soundNotification.Dispose();
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
this.trayIcon.ClickRestore += trayIcon_ClickRestore;
|
this.trayIcon.ClickRestore += trayIcon_ClickRestore;
|
||||||
@@ -285,10 +276,15 @@ namespace TweetDck.Core{
|
|||||||
|
|
||||||
private void plugins_PluginChangedState(object sender, PluginChangedStateEventArgs e){
|
private void plugins_PluginChangedState(object sender, PluginChangedStateEventArgs e){
|
||||||
browser.ExecuteScriptAsync("window.TDPF_setPluginState", e.Plugin, e.IsEnabled);
|
browser.ExecuteScriptAsync("window.TDPF_setPluginState", e.Plugin, e.IsEnabled);
|
||||||
Config.Save();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updates_UpdateAccepted(object sender, UpdateAcceptedEventArgs e){
|
private void updates_UpdateAccepted(object sender, UpdateAcceptedEventArgs e){
|
||||||
|
foreach(Form form in Application.OpenForms.Cast<Form>().Reverse()){
|
||||||
|
if (form is FormSettings || form is FormPlugins || form is FormAbout){
|
||||||
|
form.Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Hide();
|
Hide();
|
||||||
|
|
||||||
FormUpdateDownload downloadForm = new FormUpdateDownload(e.UpdateInfo);
|
FormUpdateDownload downloadForm = new FormUpdateDownload(e.UpdateInfo);
|
||||||
@@ -365,7 +361,7 @@ namespace TweetDck.Core{
|
|||||||
// javascript calls
|
// javascript calls
|
||||||
|
|
||||||
public void ReinjectCustomCSS(string css){
|
public void ReinjectCustomCSS(string css){
|
||||||
browser.ExecuteScriptAsync("TDGF_reinjectCustomCSS", css == null ? string.Empty : css.Replace(Environment.NewLine, " "));
|
browser.ExecuteScriptAsync("TDGF_reinjectCustomCSS", css?.Replace(Environment.NewLine, " ") ?? string.Empty);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateProperties(PropertyBridge.Properties properties){
|
public void UpdateProperties(PropertyBridge.Properties properties){
|
||||||
@@ -402,7 +398,7 @@ namespace TweetDck.Core{
|
|||||||
trayIcon.HasNotifications = false;
|
trayIcon.HasNotifications = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateProperties(PropertyBridge.Properties.ExpandLinksOnHover | PropertyBridge.Properties.HasCustomNotificationSound);
|
UpdateProperties(PropertyBridge.Properties.ExpandLinksOnHover | PropertyBridge.Properties.SwitchAccountSelectors | PropertyBridge.Properties.HasCustomNotificationSound);
|
||||||
form.Dispose();
|
form.Dispose();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -5,8 +5,7 @@ namespace TweetDck.Core.Handling{
|
|||||||
class BrowserProcessHandler : IBrowserProcessHandler{
|
class BrowserProcessHandler : IBrowserProcessHandler{
|
||||||
void IBrowserProcessHandler.OnContextInitialized(){
|
void IBrowserProcessHandler.OnContextInitialized(){
|
||||||
using(IRequestContext ctx = Cef.GetGlobalRequestContext()){
|
using(IRequestContext ctx = Cef.GetGlobalRequestContext()){
|
||||||
string err;
|
ctx.SetPreference("browser.enable_spellchecking", Program.UserConfig.EnableSpellCheck, out string _);
|
||||||
ctx.SetPreference("browser.enable_spellchecking", Program.UserConfig.EnableSpellCheck, out err);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
using System.Windows.Forms;
|
using CefSharp;
|
||||||
using CefSharp;
|
using System.Windows.Forms;
|
||||||
using TweetDck.Core.Bridge;
|
using TweetDck.Core.Bridge;
|
||||||
using TweetDck.Core.Controls;
|
using TweetDck.Core.Controls;
|
||||||
using TweetDck.Core.Utils;
|
using TweetDck.Core.Utils;
|
||||||
|
@@ -9,10 +9,7 @@ namespace TweetDck.Core.Handling{
|
|||||||
private MemoryStream dataIn;
|
private MemoryStream dataIn;
|
||||||
|
|
||||||
public void SetHTML(string html){
|
public void SetHTML(string html){
|
||||||
if (dataIn != null){
|
dataIn?.Dispose();
|
||||||
dataIn.Dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
dataIn = ResourceHandler.GetMemoryStream(html, Encoding.UTF8);
|
dataIn = ResourceHandler.GetMemoryStream(html, Encoding.UTF8);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -35,7 +32,7 @@ namespace TweetDck.Core.Handling{
|
|||||||
response.StatusCode = 200;
|
response.StatusCode = 200;
|
||||||
response.StatusText = "OK";
|
response.StatusText = "OK";
|
||||||
response.ResponseHeaders = headers;
|
response.ResponseHeaders = headers;
|
||||||
responseLength = dataIn != null ? dataIn.Length : -1;
|
responseLength = dataIn?.Length ?? -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IResourceHandler.ReadResponse(Stream dataOut, out int bytesRead, ICallback callback){
|
bool IResourceHandler.ReadResponse(Stream dataOut, out int bytesRead, ICallback callback){
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
using System;
|
using CefSharp;
|
||||||
|
using CefSharp.WinForms;
|
||||||
|
using System;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using CefSharp;
|
|
||||||
using CefSharp.WinForms;
|
|
||||||
using TweetDck.Configuration;
|
using TweetDck.Configuration;
|
||||||
using TweetDck.Core.Controls;
|
using TweetDck.Core.Controls;
|
||||||
using TweetDck.Core.Handling;
|
using TweetDck.Core.Handling;
|
||||||
@@ -50,23 +50,22 @@ namespace TweetDck.Core.Notification{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsNotificationVisible{
|
public bool IsNotificationVisible => Location != ControlExtensions.InvisibleLocation;
|
||||||
get{
|
|
||||||
return Location != ControlExtensions.InvisibleLocation;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public new Point Location{
|
public new Point Location{
|
||||||
get{
|
get => base.Location;
|
||||||
return base.Location;
|
|
||||||
}
|
|
||||||
|
|
||||||
set{
|
set{
|
||||||
Visible = (base.Location = value) != ControlExtensions.InvisibleLocation;
|
Visible = (base.Location = value) != ControlExtensions.InvisibleLocation;
|
||||||
|
|
||||||
|
if (WindowsUtils.ShouldAvoidToolWindow){
|
||||||
|
FormBorderStyle = Visible ? FormBorderStyle.FixedSingle : FormBorderStyle.FixedToolWindow; // workaround for alt+tab
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Func<bool> CanMoveWindow = () => true;
|
public Func<bool> CanMoveWindow = () => true;
|
||||||
|
protected override bool ShowWithoutActivation => true;
|
||||||
|
|
||||||
protected readonly Form owner;
|
protected readonly Form owner;
|
||||||
protected readonly ChromiumWebBrowser browser;
|
protected readonly ChromiumWebBrowser browser;
|
||||||
@@ -76,17 +75,7 @@ namespace TweetDck.Core.Notification{
|
|||||||
private string currentColumn;
|
private string currentColumn;
|
||||||
private int pauseCounter;
|
private int pauseCounter;
|
||||||
|
|
||||||
public bool IsPaused{
|
public bool IsPaused => pauseCounter > 0;
|
||||||
get{
|
|
||||||
return pauseCounter > 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override bool ShowWithoutActivation{
|
|
||||||
get{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool FreezeTimer { get; set; }
|
public bool FreezeTimer { get; set; }
|
||||||
public bool ContextMenuOpen { get; set; }
|
public bool ContextMenuOpen { get; set; }
|
||||||
@@ -143,8 +132,8 @@ namespace TweetDck.Core.Notification{
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void Browser_IsBrowserInitializedChanged(object sender, IsBrowserInitializedChangedEventArgs e){
|
private void Browser_IsBrowserInitializedChanged(object sender, IsBrowserInitializedChangedEventArgs e){
|
||||||
if (e.IsBrowserInitialized && Initialized != null){
|
if (e.IsBrowserInitialized){
|
||||||
Initialized(this, new EventArgs());
|
Initialized?.Invoke(this, new EventArgs());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
using System;
|
using CefSharp;
|
||||||
|
using System;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using CefSharp;
|
|
||||||
using TweetDck.Core.Bridge;
|
using TweetDck.Core.Bridge;
|
||||||
using TweetDck.Core.Controls;
|
using TweetDck.Core.Controls;
|
||||||
using TweetDck.Core.Utils;
|
using TweetDck.Core.Utils;
|
||||||
|
@@ -1,9 +1,3 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace TweetDck.Core.Notification {
|
namespace TweetDck.Core.Notification {
|
||||||
partial class FormNotificationTweet {
|
partial class FormNotificationTweet {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@@ -10,11 +10,7 @@ namespace TweetDck.Core.Notification{
|
|||||||
private const int NonIntrusiveIdleLimit = 30;
|
private const int NonIntrusiveIdleLimit = 30;
|
||||||
private const int TrimMinimum = 32;
|
private const int TrimMinimum = 32;
|
||||||
|
|
||||||
private bool IsCursorOverNotificationArea{
|
private bool IsCursorOverNotificationArea => new Rectangle(PrimaryLocation, Size).Contains(Cursor.Position);
|
||||||
get{
|
|
||||||
return new Rectangle(PrimaryLocation, Size).Contains(Cursor.Position);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private readonly Queue<TweetNotification> tweetQueue = new Queue<TweetNotification>(4);
|
private readonly Queue<TweetNotification> tweetQueue = new Queue<TweetNotification>(4);
|
||||||
private bool needsTrim;
|
private bool needsTrim;
|
||||||
|
@@ -1,10 +1,10 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Windows.Forms;
|
|
||||||
using TweetDck.Core.Bridge;
|
|
||||||
using TweetDck.Resources;
|
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Drawing.Imaging;
|
using System.Drawing.Imaging;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using TweetDck.Core.Bridge;
|
||||||
using TweetDck.Core.Utils;
|
using TweetDck.Core.Utils;
|
||||||
|
using TweetDck.Resources;
|
||||||
|
|
||||||
namespace TweetDck.Core.Notification.Screenshot{
|
namespace TweetDck.Core.Notification.Screenshot{
|
||||||
sealed class FormNotificationScreenshotable : FormNotificationBase{
|
sealed class FormNotificationScreenshotable : FormNotificationBase{
|
||||||
|
@@ -69,10 +69,7 @@ namespace TweetDck.Core.Notification.Screenshot{
|
|||||||
public void Dispose(){
|
public void Dispose(){
|
||||||
timeout.Dispose();
|
timeout.Dispose();
|
||||||
disposer.Dispose();
|
disposer.Dispose();
|
||||||
|
screenshot?.Dispose();
|
||||||
if (screenshot != null){
|
|
||||||
screenshot.Dispose();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -2,7 +2,7 @@ using System;
|
|||||||
|
|
||||||
namespace TweetDck.Core.Notification.Sound{
|
namespace TweetDck.Core.Notification.Sound{
|
||||||
sealed class PlaybackErrorEventArgs : EventArgs{
|
sealed class PlaybackErrorEventArgs : EventArgs{
|
||||||
public string Message { get; private set; }
|
public string Message { get; }
|
||||||
public bool Ignore { get; set; }
|
public bool Ignore { get; set; }
|
||||||
|
|
||||||
public PlaybackErrorEventArgs(string message){
|
public PlaybackErrorEventArgs(string message){
|
||||||
|
@@ -4,11 +4,7 @@ using System.Media;
|
|||||||
|
|
||||||
namespace TweetDck.Core.Notification.Sound{
|
namespace TweetDck.Core.Notification.Sound{
|
||||||
sealed class SoundPlayerImplFallback : ISoundNotificationPlayer{
|
sealed class SoundPlayerImplFallback : ISoundNotificationPlayer{
|
||||||
string ISoundNotificationPlayer.SupportedFormats{
|
string ISoundNotificationPlayer.SupportedFormats => "*.wav";
|
||||||
get{
|
|
||||||
return "*.wav";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public event EventHandler<PlaybackErrorEventArgs> PlaybackError;
|
public event EventHandler<PlaybackErrorEventArgs> PlaybackError;
|
||||||
|
|
||||||
|
@@ -5,11 +5,7 @@ using WMPLib;
|
|||||||
|
|
||||||
namespace TweetDck.Core.Notification.Sound{
|
namespace TweetDck.Core.Notification.Sound{
|
||||||
sealed class SoundPlayerImplWMP : ISoundNotificationPlayer{
|
sealed class SoundPlayerImplWMP : ISoundNotificationPlayer{
|
||||||
string ISoundNotificationPlayer.SupportedFormats{
|
string ISoundNotificationPlayer.SupportedFormats => "*.wav;*.mp3;*.mp2;*.m4a;*.mid;*.midi;*.rmi;*.wma;*.aif;*.aifc;*.aiff;*.snd;*.au";
|
||||||
get{
|
|
||||||
return "*.wav;*.mp3;*.mp2;*.m4a;*.mid;*.midi;*.rmi;*.wma;*.aif;*.aifc;*.aiff;*.snd;*.au";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public event EventHandler<PlaybackErrorEventArgs> PlaybackError;
|
public event EventHandler<PlaybackErrorEventArgs> PlaybackError;
|
||||||
|
|
||||||
|
@@ -8,7 +8,7 @@ namespace TweetDck.Core.Notification{
|
|||||||
private static string HeadTag { get; set; }
|
private static string HeadTag { get; set; }
|
||||||
|
|
||||||
private const string DefaultFontSizeClass = "medium";
|
private const string DefaultFontSizeClass = "medium";
|
||||||
private const string DefaultHeadTag = @"<meta charset='utf-8'><meta http-equiv='X-UA-Compatible' content='chrome=1'><link rel='stylesheet' href='https://ton.twimg.com/tweetdeck-web/web/css/font.5ef884f9f9.css'><link rel='stylesheet' href='https://ton.twimg.com/tweetdeck-web/web/css/app-dark.5631e0dd42.css'>";
|
private const string DefaultHeadTag = @"<meta charset='utf-8'><meta http-equiv='X-UA-Compatible' content='chrome=1'><link rel='stylesheet' href='https://ton.twimg.com/tweetdeck-web/web/css/font.5ef884f9f9.css'><link rel='stylesheet' href='https://ton.twimg.com/tweetdeck-web/web/css/app-dark.5631e0dd42.css'><style type='text/css'>body{background:#222426}</style>";
|
||||||
private const string CustomCSS = @"body:before{content:none}body{overflow-y:auto}.scroll-styled-v::-webkit-scrollbar{width:7px}.scroll-styled-v::-webkit-scrollbar-thumb{border-radius:0}.scroll-styled-v::-webkit-scrollbar-track{border-left:0}#td-skip{opacity:0;cursor:pointer;transition:opacity 0.15s ease}.td-hover #td-skip{opacity:0.75}#td-skip:hover{opacity:1}";
|
private const string CustomCSS = @"body:before{content:none}body{overflow-y:auto}.scroll-styled-v::-webkit-scrollbar{width:7px}.scroll-styled-v::-webkit-scrollbar-thumb{border-radius:0}.scroll-styled-v::-webkit-scrollbar-track{border-left:0}#td-skip{opacity:0;cursor:pointer;transition:opacity 0.15s ease}.td-hover #td-skip{opacity:0.75}#td-skip:hover{opacity:1}";
|
||||||
|
|
||||||
public static int FontSizeLevel{
|
public static int FontSizeLevel{
|
||||||
@@ -51,23 +51,9 @@ namespace TweetDck.Core.Notification{
|
|||||||
TopLeft, TopRight, BottomLeft, BottomRight, Custom
|
TopLeft, TopRight, BottomLeft, BottomRight, Custom
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Column{
|
public string Column => column;
|
||||||
get{
|
public string TweetUrl => tweetUrl;
|
||||||
return column;
|
public string QuoteUrl => quoteUrl;
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public string TweetUrl{
|
|
||||||
get{
|
|
||||||
return tweetUrl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public string QuoteUrl{
|
|
||||||
get{
|
|
||||||
return quoteUrl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private readonly string column;
|
private readonly string column;
|
||||||
private readonly string html;
|
private readonly string html;
|
||||||
|
2
Core/Other/FormAbout.Designer.cs
generated
2
Core/Other/FormAbout.Designer.cs
generated
@@ -1,5 +1,3 @@
|
|||||||
using TweetDck.Core.Controls;
|
|
||||||
|
|
||||||
namespace TweetDck.Core.Other {
|
namespace TweetDck.Core.Other {
|
||||||
sealed partial class FormAbout {
|
sealed partial class FormAbout {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@@ -6,20 +6,11 @@ namespace TweetDck.Core.Other{
|
|||||||
sealed partial class FormMessage : Form{
|
sealed partial class FormMessage : Form{
|
||||||
public Button ClickedButton { get; private set; }
|
public Button ClickedButton { get; private set; }
|
||||||
|
|
||||||
public int ActionPanelY{
|
public int ActionPanelY => panelActions.Location.Y;
|
||||||
get{
|
|
||||||
return panelActions.Location.Y;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private int ClientWidth{
|
private int ClientWidth{
|
||||||
get{
|
get => ClientSize.Width;
|
||||||
return ClientSize.Width;
|
set => ClientSize = new Size(value, ClientSize.Height);
|
||||||
}
|
|
||||||
|
|
||||||
set{
|
|
||||||
ClientSize = new Size(value, ClientSize.Height);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private readonly Icon icon;
|
private readonly Icon icon;
|
||||||
|
@@ -31,9 +31,7 @@ namespace TweetDck.Core.Other{
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void SelectTab<T>(Func<T> constructor) where T : BaseTabSettings{
|
private void SelectTab<T>(Func<T> constructor) where T : BaseTabSettings{
|
||||||
BaseTabSettings control;
|
if (tabs.TryGetValue(typeof(T), out BaseTabSettings control)){
|
||||||
|
|
||||||
if (tabs.TryGetValue(typeof(T), out control)){
|
|
||||||
tabPanel.ReplaceContent(control);
|
tabPanel.ReplaceContent(control);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
@@ -3,11 +3,7 @@ using TweetDck.Configuration;
|
|||||||
|
|
||||||
namespace TweetDck.Core.Other.Settings{
|
namespace TweetDck.Core.Other.Settings{
|
||||||
class BaseTabSettings : UserControl{
|
class BaseTabSettings : UserControl{
|
||||||
protected static UserConfig Config{
|
protected static UserConfig Config => Program.UserConfig;
|
||||||
get{
|
|
||||||
return Program.UserConfig;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public BaseTabSettings(){
|
public BaseTabSettings(){
|
||||||
Padding = new Padding(6);
|
Padding = new Padding(6);
|
||||||
|
@@ -5,17 +5,8 @@ using TweetDck.Core.Utils;
|
|||||||
|
|
||||||
namespace TweetDck.Core.Other.Settings.Dialogs{
|
namespace TweetDck.Core.Other.Settings.Dialogs{
|
||||||
sealed partial class DialogSettingsCSS : Form{
|
sealed partial class DialogSettingsCSS : Form{
|
||||||
public string BrowserCSS{
|
public string BrowserCSS => textBoxBrowserCSS.Text;
|
||||||
get{
|
public string NotificationCSS => textBoxNotificationCSS.Text;
|
||||||
return textBoxBrowserCSS.Text;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public string NotificationCSS{
|
|
||||||
get{
|
|
||||||
return textBoxNotificationCSS.Text;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private readonly Action<string> reinjectBrowserCSS;
|
private readonly Action<string> reinjectBrowserCSS;
|
||||||
|
|
||||||
|
@@ -5,11 +5,7 @@ using TweetDck.Core.Utils;
|
|||||||
|
|
||||||
namespace TweetDck.Core.Other.Settings.Dialogs{
|
namespace TweetDck.Core.Other.Settings.Dialogs{
|
||||||
sealed partial class DialogSettingsCefArgs : Form{
|
sealed partial class DialogSettingsCefArgs : Form{
|
||||||
public string CefArgs{
|
public string CefArgs => textBoxArgs.Text;
|
||||||
get{
|
|
||||||
return textBoxArgs.Text;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public DialogSettingsCefArgs(){
|
public DialogSettingsCefArgs(){
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
@@ -13,9 +13,7 @@ namespace TweetDck.Core.Other.Settings.Dialogs{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ExportFileFlags Flags{
|
public ExportFileFlags Flags{
|
||||||
get{
|
get => selectedFlags;
|
||||||
return selectedFlags;
|
|
||||||
}
|
|
||||||
|
|
||||||
set{
|
set{
|
||||||
// this will call events and SetFlag, which also updates the UI
|
// this will call events and SetFlag, which also updates the UI
|
||||||
|
@@ -92,7 +92,7 @@ namespace TweetDck.Core.Other.Settings.Export{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public class Entry{
|
public class Entry{
|
||||||
public string Identifier { get; private set; }
|
public string Identifier { get; }
|
||||||
|
|
||||||
public string KeyName{
|
public string KeyName{
|
||||||
get{
|
get{
|
||||||
|
@@ -31,6 +31,8 @@ namespace TweetDck.Core.Other.Settings.Export{
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (flags.HasFlag(ExportFileFlags.PluginData)){
|
if (flags.HasFlag(ExportFileFlags.PluginData)){
|
||||||
|
stream.WriteFile("plugin.config", Program.PluginConfigFilePath);
|
||||||
|
|
||||||
foreach(Plugin plugin in plugins.Plugins){
|
foreach(Plugin plugin in plugins.Plugins){
|
||||||
foreach(PathInfo path in EnumerateFilesRelative(plugin.GetPluginFolder(PluginFolder.Data))){
|
foreach(PathInfo path in EnumerateFilesRelative(plugin.GetPluginFolder(PluginFolder.Data))){
|
||||||
try{
|
try{
|
||||||
@@ -69,6 +71,7 @@ namespace TweetDck.Core.Other.Settings.Export{
|
|||||||
flags |= ExportFileFlags.Config;
|
flags |= ExportFileFlags.Config;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case "plugin.config":
|
||||||
case "plugin.data":
|
case "plugin.data":
|
||||||
flags |= ExportFileFlags.PluginData;
|
flags |= ExportFileFlags.PluginData;
|
||||||
break;
|
break;
|
||||||
@@ -103,6 +106,13 @@ namespace TweetDck.Core.Other.Settings.Export{
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case "plugin.config":
|
||||||
|
if (flags.HasFlag(ExportFileFlags.PluginData)){
|
||||||
|
entry.WriteToFile(Program.PluginConfigFilePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
case "plugin.data":
|
case "plugin.data":
|
||||||
if (flags.HasFlag(ExportFileFlags.PluginData)){
|
if (flags.HasFlag(ExportFileFlags.PluginData)){
|
||||||
string[] value = entry.KeyValue;
|
string[] value = entry.KeyValue;
|
||||||
|
@@ -180,7 +180,7 @@ namespace TweetDck.Core.Other.Settings{
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void btnReset_Click(object sender, EventArgs e){
|
private void btnReset_Click(object sender, EventArgs e){
|
||||||
if (MessageBox.Show("This will reset all of your settings, including disabled plugins. Do you want to proceed?", "Reset "+Program.BrandName+" Settings", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2) == DialogResult.Yes){
|
if (MessageBox.Show("This will reset all of your program settings. Plugins will not be affected. Do you want to proceed?", "Reset "+Program.BrandName+" Settings", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2) == DialogResult.Yes){
|
||||||
Program.ResetConfig();
|
Program.ResetConfig();
|
||||||
((FormSettings)ParentForm).ReloadUI();
|
((FormSettings)ParentForm).ReloadUI();
|
||||||
}
|
}
|
||||||
|
64
Core/Other/Settings/TabSettingsGeneral.Designer.cs
generated
64
Core/Other/Settings/TabSettingsGeneral.Designer.cs
generated
@@ -31,10 +31,11 @@
|
|||||||
this.checkSpellCheck = new System.Windows.Forms.CheckBox();
|
this.checkSpellCheck = new System.Windows.Forms.CheckBox();
|
||||||
this.checkUpdateNotifications = new System.Windows.Forms.CheckBox();
|
this.checkUpdateNotifications = new System.Windows.Forms.CheckBox();
|
||||||
this.btnCheckUpdates = new System.Windows.Forms.Button();
|
this.btnCheckUpdates = new System.Windows.Forms.Button();
|
||||||
|
this.labelZoomValue = new System.Windows.Forms.Label();
|
||||||
|
this.checkSwitchAccountSelectors = new System.Windows.Forms.CheckBox();
|
||||||
this.groupTray = new System.Windows.Forms.GroupBox();
|
this.groupTray = new System.Windows.Forms.GroupBox();
|
||||||
this.labelTrayIcon = new System.Windows.Forms.Label();
|
this.labelTrayIcon = new System.Windows.Forms.Label();
|
||||||
this.groupInterface = new System.Windows.Forms.GroupBox();
|
this.groupInterface = new System.Windows.Forms.GroupBox();
|
||||||
this.labelZoomValue = new System.Windows.Forms.Label();
|
|
||||||
this.trackBarZoom = new System.Windows.Forms.TrackBar();
|
this.trackBarZoom = new System.Windows.Forms.TrackBar();
|
||||||
this.labelZoom = new System.Windows.Forms.Label();
|
this.labelZoom = new System.Windows.Forms.Label();
|
||||||
this.groupUpdates = new System.Windows.Forms.GroupBox();
|
this.groupUpdates = new System.Windows.Forms.GroupBox();
|
||||||
@@ -84,11 +85,11 @@
|
|||||||
// checkSpellCheck
|
// checkSpellCheck
|
||||||
//
|
//
|
||||||
this.checkSpellCheck.AutoSize = true;
|
this.checkSpellCheck.AutoSize = true;
|
||||||
this.checkSpellCheck.Location = new System.Drawing.Point(9, 44);
|
this.checkSpellCheck.Location = new System.Drawing.Point(9, 67);
|
||||||
this.checkSpellCheck.Margin = new System.Windows.Forms.Padding(6, 3, 3, 3);
|
this.checkSpellCheck.Margin = new System.Windows.Forms.Padding(6, 3, 3, 3);
|
||||||
this.checkSpellCheck.Name = "checkSpellCheck";
|
this.checkSpellCheck.Name = "checkSpellCheck";
|
||||||
this.checkSpellCheck.Size = new System.Drawing.Size(119, 17);
|
this.checkSpellCheck.Size = new System.Drawing.Size(119, 17);
|
||||||
this.checkSpellCheck.TabIndex = 1;
|
this.checkSpellCheck.TabIndex = 2;
|
||||||
this.checkSpellCheck.Text = "Enable Spell Check";
|
this.checkSpellCheck.Text = "Enable Spell Check";
|
||||||
this.toolTip.SetToolTip(this.checkSpellCheck, "Underlines words that are spelled incorrectly.");
|
this.toolTip.SetToolTip(this.checkSpellCheck, "Underlines words that are spelled incorrectly.");
|
||||||
this.checkSpellCheck.UseVisualStyleBackColor = true;
|
this.checkSpellCheck.UseVisualStyleBackColor = true;
|
||||||
@@ -116,12 +117,38 @@
|
|||||||
this.toolTip.SetToolTip(this.btnCheckUpdates, "Forces an update check, even for updates that had been dismissed.");
|
this.toolTip.SetToolTip(this.btnCheckUpdates, "Forces an update check, even for updates that had been dismissed.");
|
||||||
this.btnCheckUpdates.UseVisualStyleBackColor = true;
|
this.btnCheckUpdates.UseVisualStyleBackColor = true;
|
||||||
//
|
//
|
||||||
|
// labelZoomValue
|
||||||
|
//
|
||||||
|
this.labelZoomValue.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
|
this.labelZoomValue.BackColor = System.Drawing.Color.Transparent;
|
||||||
|
this.labelZoomValue.Location = new System.Drawing.Point(139, 116);
|
||||||
|
this.labelZoomValue.Margin = new System.Windows.Forms.Padding(0, 0, 3, 0);
|
||||||
|
this.labelZoomValue.Name = "labelZoomValue";
|
||||||
|
this.labelZoomValue.Size = new System.Drawing.Size(38, 13);
|
||||||
|
this.labelZoomValue.TabIndex = 5;
|
||||||
|
this.labelZoomValue.Text = "100%";
|
||||||
|
this.labelZoomValue.TextAlign = System.Drawing.ContentAlignment.TopRight;
|
||||||
|
this.toolTip.SetToolTip(this.labelZoomValue, "Changes the zoom level.\r\nAlso affects notifications and screenshots.");
|
||||||
|
//
|
||||||
|
// checkSwitchAccountSelectors
|
||||||
|
//
|
||||||
|
this.checkSwitchAccountSelectors.AutoSize = true;
|
||||||
|
this.checkSwitchAccountSelectors.Location = new System.Drawing.Point(9, 44);
|
||||||
|
this.checkSwitchAccountSelectors.Margin = new System.Windows.Forms.Padding(6, 3, 3, 3);
|
||||||
|
this.checkSwitchAccountSelectors.Name = "checkSwitchAccountSelectors";
|
||||||
|
this.checkSwitchAccountSelectors.Size = new System.Drawing.Size(172, 17);
|
||||||
|
this.checkSwitchAccountSelectors.TabIndex = 1;
|
||||||
|
this.checkSwitchAccountSelectors.Text = "Shift Selects Multiple Accounts";
|
||||||
|
this.toolTip.SetToolTip(this.checkSwitchAccountSelectors, "When (re)tweeting, click to select a single account or hold Shift to\r\nselect mult" +
|
||||||
|
"iple accounts, instead of TweetDeck\'s default behavior.");
|
||||||
|
this.checkSwitchAccountSelectors.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
// groupTray
|
// groupTray
|
||||||
//
|
//
|
||||||
this.groupTray.Controls.Add(this.checkTrayHighlight);
|
this.groupTray.Controls.Add(this.checkTrayHighlight);
|
||||||
this.groupTray.Controls.Add(this.labelTrayIcon);
|
this.groupTray.Controls.Add(this.labelTrayIcon);
|
||||||
this.groupTray.Controls.Add(this.comboBoxTrayType);
|
this.groupTray.Controls.Add(this.comboBoxTrayType);
|
||||||
this.groupTray.Location = new System.Drawing.Point(9, 145);
|
this.groupTray.Location = new System.Drawing.Point(9, 168);
|
||||||
this.groupTray.Name = "groupTray";
|
this.groupTray.Name = "groupTray";
|
||||||
this.groupTray.Size = new System.Drawing.Size(183, 93);
|
this.groupTray.Size = new System.Drawing.Size(183, 93);
|
||||||
this.groupTray.TabIndex = 1;
|
this.groupTray.TabIndex = 1;
|
||||||
@@ -140,6 +167,7 @@
|
|||||||
//
|
//
|
||||||
// groupInterface
|
// groupInterface
|
||||||
//
|
//
|
||||||
|
this.groupInterface.Controls.Add(this.checkSwitchAccountSelectors);
|
||||||
this.groupInterface.Controls.Add(this.labelZoomValue);
|
this.groupInterface.Controls.Add(this.labelZoomValue);
|
||||||
this.groupInterface.Controls.Add(this.trackBarZoom);
|
this.groupInterface.Controls.Add(this.trackBarZoom);
|
||||||
this.groupInterface.Controls.Add(this.labelZoom);
|
this.groupInterface.Controls.Add(this.labelZoom);
|
||||||
@@ -147,48 +175,37 @@
|
|||||||
this.groupInterface.Controls.Add(this.checkExpandLinks);
|
this.groupInterface.Controls.Add(this.checkExpandLinks);
|
||||||
this.groupInterface.Location = new System.Drawing.Point(9, 9);
|
this.groupInterface.Location = new System.Drawing.Point(9, 9);
|
||||||
this.groupInterface.Name = "groupInterface";
|
this.groupInterface.Name = "groupInterface";
|
||||||
this.groupInterface.Size = new System.Drawing.Size(183, 130);
|
this.groupInterface.Size = new System.Drawing.Size(183, 153);
|
||||||
this.groupInterface.TabIndex = 0;
|
this.groupInterface.TabIndex = 0;
|
||||||
this.groupInterface.TabStop = false;
|
this.groupInterface.TabStop = false;
|
||||||
this.groupInterface.Text = "User Interface";
|
this.groupInterface.Text = "User Interface";
|
||||||
//
|
//
|
||||||
// labelZoomValue
|
|
||||||
//
|
|
||||||
this.labelZoomValue.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
|
||||||
this.labelZoomValue.BackColor = System.Drawing.Color.Transparent;
|
|
||||||
this.labelZoomValue.Location = new System.Drawing.Point(139, 93);
|
|
||||||
this.labelZoomValue.Margin = new System.Windows.Forms.Padding(0, 0, 3, 0);
|
|
||||||
this.labelZoomValue.Name = "labelZoomValue";
|
|
||||||
this.labelZoomValue.Size = new System.Drawing.Size(38, 13);
|
|
||||||
this.labelZoomValue.TabIndex = 4;
|
|
||||||
this.labelZoomValue.Text = "100%";
|
|
||||||
this.labelZoomValue.TextAlign = System.Drawing.ContentAlignment.TopRight;
|
|
||||||
this.toolTip.SetToolTip(this.labelZoomValue, "Changes the zoom level.\r\nAlso affects notifications and screenshots.");
|
|
||||||
//
|
|
||||||
// trackBarZoom
|
// trackBarZoom
|
||||||
//
|
//
|
||||||
this.trackBarZoom.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
this.trackBarZoom.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
|
||||||
| System.Windows.Forms.AnchorStyles.Right)));
|
| System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.trackBarZoom.AutoSize = false;
|
this.trackBarZoom.AutoSize = false;
|
||||||
this.trackBarZoom.LargeChange = 25;
|
this.trackBarZoom.LargeChange = 25;
|
||||||
this.trackBarZoom.Location = new System.Drawing.Point(6, 92);
|
this.trackBarZoom.Location = new System.Drawing.Point(6, 115);
|
||||||
this.trackBarZoom.Maximum = 200;
|
this.trackBarZoom.Maximum = 200;
|
||||||
this.trackBarZoom.Minimum = 50;
|
this.trackBarZoom.Minimum = 50;
|
||||||
this.trackBarZoom.Name = "trackBarZoom";
|
this.trackBarZoom.Name = "trackBarZoom";
|
||||||
this.trackBarZoom.Size = new System.Drawing.Size(141, 30);
|
this.trackBarZoom.Size = new System.Drawing.Size(141, 30);
|
||||||
this.trackBarZoom.SmallChange = 5;
|
this.trackBarZoom.SmallChange = 5;
|
||||||
this.trackBarZoom.TabIndex = 3;
|
this.trackBarZoom.TabIndex = 4;
|
||||||
this.trackBarZoom.TickFrequency = 25;
|
this.trackBarZoom.TickFrequency = 25;
|
||||||
this.trackBarZoom.Value = 100;
|
this.trackBarZoom.Value = 100;
|
||||||
//
|
//
|
||||||
// labelZoom
|
// labelZoom
|
||||||
//
|
//
|
||||||
|
this.labelZoom.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
|
||||||
|
| System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.labelZoom.AutoSize = true;
|
this.labelZoom.AutoSize = true;
|
||||||
this.labelZoom.Location = new System.Drawing.Point(5, 76);
|
this.labelZoom.Location = new System.Drawing.Point(5, 99);
|
||||||
this.labelZoom.Margin = new System.Windows.Forms.Padding(3, 12, 3, 0);
|
this.labelZoom.Margin = new System.Windows.Forms.Padding(3, 12, 3, 0);
|
||||||
this.labelZoom.Name = "labelZoom";
|
this.labelZoom.Name = "labelZoom";
|
||||||
this.labelZoom.Size = new System.Drawing.Size(34, 13);
|
this.labelZoom.Size = new System.Drawing.Size(34, 13);
|
||||||
this.labelZoom.TabIndex = 2;
|
this.labelZoom.TabIndex = 3;
|
||||||
this.labelZoom.Text = "Zoom";
|
this.labelZoom.Text = "Zoom";
|
||||||
//
|
//
|
||||||
// groupUpdates
|
// groupUpdates
|
||||||
@@ -244,5 +261,6 @@
|
|||||||
private System.Windows.Forms.Label labelZoomValue;
|
private System.Windows.Forms.Label labelZoomValue;
|
||||||
private System.Windows.Forms.TrackBar trackBarZoom;
|
private System.Windows.Forms.TrackBar trackBarZoom;
|
||||||
private System.Windows.Forms.Timer zoomUpdateTimer;
|
private System.Windows.Forms.Timer zoomUpdateTimer;
|
||||||
|
private System.Windows.Forms.CheckBox checkSwitchAccountSelectors;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -28,6 +28,7 @@ namespace TweetDck.Core.Other.Settings{
|
|||||||
labelZoomValue.Text = trackBarZoom.Value+"%";
|
labelZoomValue.Text = trackBarZoom.Value+"%";
|
||||||
|
|
||||||
checkExpandLinks.Checked = Config.ExpandLinksOnHover;
|
checkExpandLinks.Checked = Config.ExpandLinksOnHover;
|
||||||
|
checkSwitchAccountSelectors.Checked = Config.SwitchAccountSelectors;
|
||||||
checkSpellCheck.Checked = Config.EnableSpellCheck;
|
checkSpellCheck.Checked = Config.EnableSpellCheck;
|
||||||
checkTrayHighlight.Checked = Config.EnableTrayHighlight;
|
checkTrayHighlight.Checked = Config.EnableTrayHighlight;
|
||||||
|
|
||||||
@@ -36,6 +37,7 @@ namespace TweetDck.Core.Other.Settings{
|
|||||||
|
|
||||||
public override void OnReady(){
|
public override void OnReady(){
|
||||||
checkExpandLinks.CheckedChanged += checkExpandLinks_CheckedChanged;
|
checkExpandLinks.CheckedChanged += checkExpandLinks_CheckedChanged;
|
||||||
|
checkSwitchAccountSelectors.CheckedChanged += checkSwitchAccountSelectors_CheckedChanged;
|
||||||
checkSpellCheck.CheckedChanged += checkSpellCheck_CheckedChanged;
|
checkSpellCheck.CheckedChanged += checkSpellCheck_CheckedChanged;
|
||||||
trackBarZoom.ValueChanged += trackBarZoom_ValueChanged;
|
trackBarZoom.ValueChanged += trackBarZoom_ValueChanged;
|
||||||
|
|
||||||
@@ -54,6 +56,10 @@ namespace TweetDck.Core.Other.Settings{
|
|||||||
Config.ExpandLinksOnHover = checkExpandLinks.Checked;
|
Config.ExpandLinksOnHover = checkExpandLinks.Checked;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void checkSwitchAccountSelectors_CheckedChanged(object sender, EventArgs e){
|
||||||
|
Config.SwitchAccountSelectors = checkSwitchAccountSelectors.Checked;
|
||||||
|
}
|
||||||
|
|
||||||
private void checkSpellCheck_CheckedChanged(object sender, EventArgs e){
|
private void checkSpellCheck_CheckedChanged(object sender, EventArgs e){
|
||||||
Config.EnableSpellCheck = checkSpellCheck.Checked;
|
Config.EnableSpellCheck = checkSpellCheck.Checked;
|
||||||
PromptRestart();
|
PromptRestart();
|
||||||
|
@@ -12,9 +12,7 @@ namespace TweetDck.Core{
|
|||||||
public event EventHandler ClickClose;
|
public event EventHandler ClickClose;
|
||||||
|
|
||||||
public bool Visible{
|
public bool Visible{
|
||||||
get{
|
get => notifyIcon.Visible;
|
||||||
return notifyIcon.Visible;
|
|
||||||
}
|
|
||||||
|
|
||||||
set{
|
set{
|
||||||
if (value){
|
if (value){
|
||||||
@@ -72,9 +70,7 @@ namespace TweetDck.Core{
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void menuItemRestore_Click(object sender, EventArgs e){
|
private void menuItemRestore_Click(object sender, EventArgs e){
|
||||||
if (ClickRestore != null){
|
ClickRestore?.Invoke(this, e);
|
||||||
ClickRestore(this, e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void menuItemMuteNotifications_Click(object sender, EventArgs e){
|
private void menuItemMuteNotifications_Click(object sender, EventArgs e){
|
||||||
@@ -83,9 +79,7 @@ namespace TweetDck.Core{
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void menuItemClose_Click(object sender, EventArgs e){
|
private void menuItemClose_Click(object sender, EventArgs e){
|
||||||
if (ClickClose != null){
|
ClickClose?.Invoke(this, e);
|
||||||
ClickClose(this, e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,12 +1,12 @@
|
|||||||
using System;
|
using CefSharp;
|
||||||
|
using System;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
using System.Drawing;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Windows.Forms;
|
|
||||||
using CefSharp;
|
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Drawing;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace TweetDck.Core.Utils{
|
namespace TweetDck.Core.Utils{
|
||||||
static class BrowserUtils{
|
static class BrowserUtils{
|
||||||
@@ -23,11 +23,7 @@ namespace TweetDck.Core.Utils{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string HeaderUserAgent{
|
public static string HeaderUserAgent => Program.BrandName+" "+Application.ProductVersion;
|
||||||
get{
|
|
||||||
return Program.BrandName+" "+Application.ProductVersion;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static readonly Color BackgroundColor = Color.FromArgb(28, 99, 153);
|
public static readonly Color BackgroundColor = Color.FromArgb(28, 99, 153);
|
||||||
public const string BackgroundColorFix = "let e=document.createElement('style');document.head.appendChild(e);e.innerHTML='body::before{background:#1c6399!important}'";
|
public const string BackgroundColorFix = "let e=document.createElement('style');document.head.appendChild(e);e.innerHTML='body::before{background:#1c6399!important}'";
|
||||||
@@ -37,9 +33,7 @@ namespace TweetDck.Core.Utils{
|
|||||||
};
|
};
|
||||||
|
|
||||||
public static bool IsValidUrl(string url){
|
public static bool IsValidUrl(string url){
|
||||||
Uri uri;
|
if (Uri.TryCreate(url, UriKind.Absolute, out Uri uri)){
|
||||||
|
|
||||||
if (Uri.TryCreate(url, UriKind.Absolute, out uri)){
|
|
||||||
string scheme = uri.Scheme;
|
string scheme = uri.Scheme;
|
||||||
return scheme == Uri.UriSchemeHttp || scheme == Uri.UriSchemeHttps || scheme == Uri.UriSchemeFtp || scheme == Uri.UriSchemeMailto;
|
return scheme == Uri.UriSchemeHttp || scheme == Uri.UriSchemeHttps || scheme == Uri.UriSchemeFtp || scheme == Uri.UriSchemeMailto;
|
||||||
}
|
}
|
||||||
|
@@ -35,11 +35,7 @@ namespace TweetDck.Core.Utils{
|
|||||||
private readonly HashSet<string> flags = new HashSet<string>();
|
private readonly HashSet<string> flags = new HashSet<string>();
|
||||||
private readonly Dictionary<string, string> values = new Dictionary<string, string>();
|
private readonly Dictionary<string, string> values = new Dictionary<string, string>();
|
||||||
|
|
||||||
public int Count{
|
public int Count => flags.Count+values.Count;
|
||||||
get{
|
|
||||||
return flags.Count+values.Count;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void AddFlag(string flag){
|
public void AddFlag(string flag){
|
||||||
flags.Add(flag.ToLowerInvariant());
|
flags.Add(flag.ToLowerInvariant());
|
||||||
@@ -62,8 +58,7 @@ namespace TweetDck.Core.Utils{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public string GetValue(string key, string defaultValue){
|
public string GetValue(string key, string defaultValue){
|
||||||
string val;
|
return values.TryGetValue(key.ToLowerInvariant(), out string val) ? val : defaultValue;
|
||||||
return values.TryGetValue(key.ToLowerInvariant(), out val) ? val : defaultValue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RemoveValue(string key){
|
public void RemoveValue(string key){
|
||||||
|
@@ -4,11 +4,7 @@ namespace TweetDck.Core.Utils{
|
|||||||
static class CommandLineArgsParser{
|
static class CommandLineArgsParser{
|
||||||
private static Regex splitRegex;
|
private static Regex splitRegex;
|
||||||
|
|
||||||
private static Regex SplitRegex{
|
private static Regex SplitRegex => splitRegex ?? (splitRegex = new Regex(@"([^=\s]+(?:=(?:[^ ]*""[^""]*?""[^ ]*|[^ ]*))?)", RegexOptions.Compiled));
|
||||||
get{
|
|
||||||
return splitRegex ?? (splitRegex = new Regex(@"([^=\s]+(?:=(?:[^ ]*""[^""]*?""[^ ]*|[^ ]*))?)", RegexOptions.Compiled));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static CommandLineArgs ReadCefArguments(string argumentString){
|
public static CommandLineArgs ReadCefArguments(string argumentString){
|
||||||
CommandLineArgs args = new CommandLineArgs();
|
CommandLineArgs args = new CommandLineArgs();
|
||||||
|
@@ -9,17 +9,8 @@ namespace TweetDck.Core.Utils{
|
|||||||
private static readonly string DisabledLibEGL = LibEGL+".bak";
|
private static readonly string DisabledLibEGL = LibEGL+".bak";
|
||||||
private static readonly string DisabledLibGLES = LibGLES+".bak";
|
private static readonly string DisabledLibGLES = LibGLES+".bak";
|
||||||
|
|
||||||
public static bool IsEnabled{
|
public static bool IsEnabled => File.Exists(LibEGL) && File.Exists(LibGLES);
|
||||||
get{
|
public static bool CanEnable => File.Exists(DisabledLibEGL) && File.Exists(DisabledLibGLES);
|
||||||
return File.Exists(LibEGL) && File.Exists(LibGLES);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static bool CanEnable{
|
|
||||||
get{
|
|
||||||
return File.Exists(DisabledLibEGL) && File.Exists(DisabledLibGLES);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static bool Enable(){
|
public static bool Enable(){
|
||||||
if (IsEnabled)return false;
|
if (IsEnabled)return false;
|
||||||
|
@@ -21,9 +21,7 @@ namespace TweetDck.Core.Utils{
|
|||||||
}
|
}
|
||||||
|
|
||||||
set{
|
set{
|
||||||
Dictionary<K2, V> innerDict;
|
if (!dict.TryGetValue(outerKey, out Dictionary<K2, V> innerDict)){
|
||||||
|
|
||||||
if (!dict.TryGetValue(outerKey, out innerDict)){
|
|
||||||
dict.Add(outerKey, innerDict = new Dictionary<K2, V>(innerCapacity));
|
dict.Add(outerKey, innerDict = new Dictionary<K2, V>(innerCapacity));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -44,9 +42,7 @@ namespace TweetDck.Core.Utils{
|
|||||||
// Members
|
// Members
|
||||||
|
|
||||||
public void Add(K1 outerKey, K2 innerKey, V value){ // throws on duplicate
|
public void Add(K1 outerKey, K2 innerKey, V value){ // throws on duplicate
|
||||||
Dictionary<K2, V> innerDict;
|
if (!dict.TryGetValue(outerKey, out Dictionary<K2, V> innerDict)){
|
||||||
|
|
||||||
if (!dict.TryGetValue(outerKey, out innerDict)){
|
|
||||||
dict.Add(outerKey, innerDict = new Dictionary<K2, V>(innerCapacity));
|
dict.Add(outerKey, innerDict = new Dictionary<K2, V>(innerCapacity));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -54,7 +50,7 @@ namespace TweetDck.Core.Utils{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void Clear(){
|
public void Clear(){
|
||||||
this.dict.Clear();
|
dict.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Clear(K1 outerKey){ // throws on missing key, but keeps the key unlike Remove(K1)
|
public void Clear(K1 outerKey){ // throws on missing key, but keeps the key unlike Remove(K1)
|
||||||
@@ -83,9 +79,7 @@ namespace TweetDck.Core.Utils{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public bool Remove(K1 outerKey, K2 innerKey){
|
public bool Remove(K1 outerKey, K2 innerKey){
|
||||||
Dictionary<K2, V> innerDict;
|
if (dict.TryGetValue(outerKey, out Dictionary<K2, V> innerDict) && innerDict.Remove(innerKey)){
|
||||||
|
|
||||||
if (dict.TryGetValue(outerKey, out innerDict) && innerDict.Remove(innerKey)){
|
|
||||||
if (innerDict.Count == 0) {
|
if (innerDict.Count == 0) {
|
||||||
dict.Remove(outerKey);
|
dict.Remove(outerKey);
|
||||||
}
|
}
|
||||||
@@ -96,9 +90,7 @@ namespace TweetDck.Core.Utils{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public bool TryGetValue(K1 outerKey, K2 innerKey, out V value){
|
public bool TryGetValue(K1 outerKey, K2 innerKey, out V value){
|
||||||
Dictionary<K2, V> innerDict;
|
if (dict.TryGetValue(outerKey, out Dictionary<K2, V> innerDict)){
|
||||||
|
|
||||||
if (dict.TryGetValue(outerKey, out innerDict)){
|
|
||||||
return innerDict.TryGetValue(innerKey, out value);
|
return innerDict.TryGetValue(innerKey, out value);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
@@ -8,6 +8,13 @@ using System.Windows.Forms;
|
|||||||
|
|
||||||
namespace TweetDck.Core.Utils{
|
namespace TweetDck.Core.Utils{
|
||||||
static class WindowsUtils{
|
static class WindowsUtils{
|
||||||
|
public static bool ShouldAvoidToolWindow { get; }
|
||||||
|
|
||||||
|
static WindowsUtils(){
|
||||||
|
Version ver = Environment.OSVersion.Version;
|
||||||
|
ShouldAvoidToolWindow = ver.Major == 6 && ver.Minor == 2; // windows 8/10
|
||||||
|
}
|
||||||
|
|
||||||
public static bool CheckFolderWritePermission(string path){
|
public static bool CheckFolderWritePermission(string path){
|
||||||
string testFile = Path.Combine(path, ".test");
|
string testFile = Path.Combine(path, ".test");
|
||||||
|
|
||||||
|
@@ -61,7 +61,7 @@ namespace TweetDck.Plugins.Controls{
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void UpdatePluginState(){
|
private void UpdatePluginState(){
|
||||||
bool isEnabled = plugin.CanRun && pluginManager.Config.IsEnabled(plugin);
|
bool isEnabled = pluginManager.Config.IsEnabled(plugin) && plugin.CanRun;
|
||||||
Color textColor = isEnabled ? Color.Black : Color.FromArgb(90, 90, 90);
|
Color textColor = isEnabled ? Color.Black : Color.FromArgb(90, 90, 90);
|
||||||
|
|
||||||
labelVersion.ForeColor = textColor;
|
labelVersion.ForeColor = textColor;
|
||||||
|
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
namespace TweetDck.Plugins.Events{
|
namespace TweetDck.Plugins.Events{
|
||||||
class PluginChangedStateEventArgs : EventArgs{
|
class PluginChangedStateEventArgs : EventArgs{
|
||||||
public Plugin Plugin { get; private set; }
|
public Plugin Plugin { get; }
|
||||||
public bool IsEnabled { get; private set; }
|
public bool IsEnabled { get; }
|
||||||
|
|
||||||
public PluginChangedStateEventArgs(Plugin plugin, bool isEnabled){
|
public PluginChangedStateEventArgs(Plugin plugin, bool isEnabled){
|
||||||
this.Plugin = plugin;
|
this.Plugin = plugin;
|
||||||
|
@@ -3,11 +3,7 @@ using System.Collections.Generic;
|
|||||||
|
|
||||||
namespace TweetDck.Plugins.Events{
|
namespace TweetDck.Plugins.Events{
|
||||||
class PluginErrorEventArgs : EventArgs{
|
class PluginErrorEventArgs : EventArgs{
|
||||||
public bool HasErrors{
|
public bool HasErrors => Errors.Count > 0;
|
||||||
get{
|
|
||||||
return Errors.Count > 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public IList<string> Errors;
|
public IList<string> Errors;
|
||||||
|
|
||||||
|
@@ -7,51 +7,41 @@ using TweetDck.Plugins.Enums;
|
|||||||
|
|
||||||
namespace TweetDck.Plugins{
|
namespace TweetDck.Plugins{
|
||||||
class Plugin{
|
class Plugin{
|
||||||
public string Identifier { get { return identifier; } }
|
public string Identifier { get; }
|
||||||
public string Name { get { return metadata["NAME"]; } }
|
public PluginGroup Group { get; }
|
||||||
public string Description { get { return metadata["DESCRIPTION"]; } }
|
|
||||||
public string Author { get { return metadata["AUTHOR"]; } }
|
|
||||||
public string Version { get { return metadata["VERSION"]; } }
|
|
||||||
public string Website { get { return metadata["WEBSITE"]; } }
|
|
||||||
public string ConfigFile { get { return metadata["CONFIGFILE"]; } }
|
|
||||||
public string ConfigDefault { get { return metadata["CONFIGDEFAULT"]; } }
|
|
||||||
public string RequiredVersion { get { return metadata["REQUIRES"]; } }
|
|
||||||
public PluginGroup Group { get; private set; }
|
|
||||||
public PluginEnvironment Environments { get; private set; }
|
public PluginEnvironment Environments { get; private set; }
|
||||||
|
|
||||||
|
public string Name => metadata["NAME"];
|
||||||
|
public string Description => metadata["DESCRIPTION"];
|
||||||
|
public string Author => metadata["AUTHOR"];
|
||||||
|
public string Version => metadata["VERSION"];
|
||||||
|
public string Website => metadata["WEBSITE"];
|
||||||
|
public string ConfigFile => metadata["CONFIGFILE"];
|
||||||
|
public string ConfigDefault => metadata["CONFIGDEFAULT"];
|
||||||
|
public string RequiredVersion => metadata["REQUIRES"];
|
||||||
|
|
||||||
public bool CanRun{
|
public bool CanRun{
|
||||||
get{
|
get => canRun ?? (canRun = CheckRequiredVersion(RequiredVersion)).Value;
|
||||||
return canRun ?? (canRun = CheckRequiredVersion(RequiredVersion)).Value;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool HasConfig{
|
public bool HasConfig{
|
||||||
get{
|
get => ConfigFile.Length > 0 && GetFullPathIfSafe(PluginFolder.Data, ConfigFile).Length > 0;
|
||||||
return ConfigFile.Length > 0 && GetFullPathIfSafe(PluginFolder.Data, ConfigFile).Length > 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public string ConfigPath{
|
public string ConfigPath{
|
||||||
get{
|
get => HasConfig ? Path.Combine(GetPluginFolder(PluginFolder.Data), ConfigFile) : string.Empty;
|
||||||
return HasConfig ? Path.Combine(GetPluginFolder(PluginFolder.Data), ConfigFile) : string.Empty;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool HasDefaultConfig{
|
public bool HasDefaultConfig{
|
||||||
get{
|
get => ConfigDefault.Length > 0 && GetFullPathIfSafe(PluginFolder.Root, ConfigDefault).Length > 0;
|
||||||
return ConfigDefault.Length > 0 && GetFullPathIfSafe(PluginFolder.Root, ConfigDefault).Length > 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public string DefaultConfigPath{
|
public string DefaultConfigPath{
|
||||||
get{
|
get => HasDefaultConfig ? Path.Combine(GetPluginFolder(PluginFolder.Root), ConfigDefault) : string.Empty;
|
||||||
return HasDefaultConfig ? Path.Combine(GetPluginFolder(PluginFolder.Root), ConfigDefault) : string.Empty;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private readonly string pathRoot;
|
private readonly string pathRoot;
|
||||||
private readonly string pathData;
|
private readonly string pathData;
|
||||||
private readonly string identifier;
|
|
||||||
private readonly Dictionary<string, string> metadata = new Dictionary<string, string>(4){
|
private readonly Dictionary<string, string> metadata = new Dictionary<string, string>(4){
|
||||||
{ "NAME", "" },
|
{ "NAME", "" },
|
||||||
{ "DESCRIPTION", "" },
|
{ "DESCRIPTION", "" },
|
||||||
@@ -72,7 +62,7 @@ namespace TweetDck.Plugins{
|
|||||||
this.pathRoot = path;
|
this.pathRoot = path;
|
||||||
this.pathData = Path.Combine(Program.PluginDataPath, group.GetIdentifierPrefix(), name);
|
this.pathData = Path.Combine(Program.PluginDataPath, group.GetIdentifierPrefix(), name);
|
||||||
|
|
||||||
this.identifier = group.GetIdentifierPrefix()+name;
|
this.Identifier = group.GetIdentifierPrefix()+name;
|
||||||
this.Group = group;
|
this.Group = group;
|
||||||
this.Environments = PluginEnvironment.None;
|
this.Environments = PluginEnvironment.None;
|
||||||
}
|
}
|
||||||
@@ -103,7 +93,7 @@ namespace TweetDck.Plugins{
|
|||||||
Directory.CreateDirectory(dataFolder);
|
Directory.CreateDirectory(dataFolder);
|
||||||
File.Copy(defaultConfigPath, configPath, false);
|
File.Copy(defaultConfigPath, configPath, false);
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
Program.Reporter.HandleException("Plugin Loading Error", "Could not generate a configuration file for '"+identifier+"' plugin.", true, e);
|
Program.Reporter.HandleException("Plugin Loading Error", "Could not generate a configuration file for '"+Identifier+"' plugin.", true, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -154,12 +144,12 @@ namespace TweetDck.Plugins{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public override int GetHashCode(){
|
public override int GetHashCode(){
|
||||||
return identifier.GetHashCode();
|
return Identifier.GetHashCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool Equals(object obj){
|
public override bool Equals(object obj){
|
||||||
Plugin plugin = obj as Plugin;
|
Plugin plugin = obj as Plugin;
|
||||||
return plugin != null && plugin.identifier.Equals(identifier);
|
return plugin != null && plugin.Identifier.Equals(Identifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Plugin CreateFromFolder(string path, PluginGroup group, out string error){
|
public static Plugin CreateFromFolder(string path, PluginGroup group, out string error){
|
||||||
@@ -236,9 +226,7 @@ namespace TweetDck.Plugins{
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Version ver;
|
if (plugin.RequiredVersion.Length == 0 || !(plugin.RequiredVersion.Equals("*") || System.Version.TryParse(plugin.RequiredVersion, out Version _))){
|
||||||
|
|
||||||
if (plugin.RequiredVersion.Length == 0 || !(plugin.RequiredVersion.Equals("*") || System.Version.TryParse(plugin.RequiredVersion, out ver))){
|
|
||||||
error = "Plugin contains invalid version: "+plugin.RequiredVersion;
|
error = "Plugin contains invalid version: "+plugin.RequiredVersion;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@@ -16,11 +16,7 @@ namespace TweetDck.Plugins{
|
|||||||
private readonly TwoKeyDictionary<int, string, string> fileCache = new TwoKeyDictionary<int, string, string>(4, 2);
|
private readonly TwoKeyDictionary<int, string, string> fileCache = new TwoKeyDictionary<int, string, string>(4, 2);
|
||||||
private readonly TwoKeyDictionary<int, string, InjectedHTML> notificationInjections = new TwoKeyDictionary<int,string,InjectedHTML>(4, 1);
|
private readonly TwoKeyDictionary<int, string, InjectedHTML> notificationInjections = new TwoKeyDictionary<int,string,InjectedHTML>(4, 1);
|
||||||
|
|
||||||
public IEnumerable<InjectedHTML> NotificationInjections{
|
public IEnumerable<InjectedHTML> NotificationInjections => notificationInjections.InnerValues;
|
||||||
get{
|
|
||||||
return notificationInjections.InnerValues;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public PluginBridge(PluginManager manager){
|
public PluginBridge(PluginManager manager){
|
||||||
this.manager = manager;
|
this.manager = manager;
|
||||||
@@ -64,9 +60,7 @@ namespace TweetDck.Plugins{
|
|||||||
private string ReadFileUnsafe(int token, string cacheKey, string fullPath, bool readCached){
|
private string ReadFileUnsafe(int token, string cacheKey, string fullPath, bool readCached){
|
||||||
cacheKey = SanitizeCacheKey(cacheKey);
|
cacheKey = SanitizeCacheKey(cacheKey);
|
||||||
|
|
||||||
string cachedContents;
|
if (readCached && fileCache.TryGetValue(token, cacheKey, out string cachedContents)){
|
||||||
|
|
||||||
if (readCached && fileCache.TryGetValue(token, cacheKey, out cachedContents)){
|
|
||||||
return cachedContents;
|
return cachedContents;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,5 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Text;
|
||||||
using TweetDck.Plugins.Events;
|
using TweetDck.Plugins.Events;
|
||||||
|
|
||||||
namespace TweetDck.Plugins{
|
namespace TweetDck.Plugins{
|
||||||
@@ -8,34 +10,66 @@ namespace TweetDck.Plugins{
|
|||||||
[field:NonSerialized]
|
[field:NonSerialized]
|
||||||
public event EventHandler<PluginChangedStateEventArgs> InternalPluginChangedState; // should only be accessed from PluginManager
|
public event EventHandler<PluginChangedStateEventArgs> InternalPluginChangedState; // should only be accessed from PluginManager
|
||||||
|
|
||||||
public IEnumerable<string> DisabledPlugins{
|
public IEnumerable<string> DisabledPlugins => Disabled;
|
||||||
get{
|
public bool AnyDisabled => Disabled.Count > 0;
|
||||||
return Disabled;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool AnyDisabled{
|
private readonly HashSet<string> Disabled = new HashSet<string>{
|
||||||
get{
|
"official/clear-columns",
|
||||||
return Disabled.Count > 0;
|
"official/reply-account"
|
||||||
}
|
};
|
||||||
}
|
|
||||||
|
|
||||||
private readonly HashSet<string> Disabled = new HashSet<string>();
|
public void ImportLegacy(PluginConfig config){
|
||||||
|
Disabled.Clear();
|
||||||
|
|
||||||
|
foreach(string plugin in config.Disabled){
|
||||||
|
Disabled.Add(plugin);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void SetEnabled(Plugin plugin, bool enabled){
|
public void SetEnabled(Plugin plugin, bool enabled){
|
||||||
if ((enabled && Disabled.Remove(plugin.Identifier)) || (!enabled && Disabled.Add(plugin.Identifier))){
|
if ((enabled && Disabled.Remove(plugin.Identifier)) || (!enabled && Disabled.Add(plugin.Identifier))){
|
||||||
if (InternalPluginChangedState != null){
|
InternalPluginChangedState?.Invoke(this, new PluginChangedStateEventArgs(plugin, enabled));
|
||||||
InternalPluginChangedState(this, new PluginChangedStateEventArgs(plugin, enabled));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsEnabled(Plugin plugin){
|
public bool IsEnabled(Plugin plugin){
|
||||||
return !Disabled.Contains(plugin.Identifier) && plugin.CanRun;
|
return !Disabled.Contains(plugin.Identifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DisableOfficialFromConfig(string pluginName){
|
public void Load(string file){
|
||||||
Disabled.Add("official/"+pluginName);
|
try{
|
||||||
|
using(FileStream stream = new FileStream(file, FileMode.Open, FileAccess.Read, FileShare.Read))
|
||||||
|
using(StreamReader reader = new StreamReader(stream, Encoding.UTF8)){
|
||||||
|
string line = reader.ReadLine();
|
||||||
|
|
||||||
|
if (line == "#Disabled"){
|
||||||
|
Disabled.Clear();
|
||||||
|
|
||||||
|
while((line = reader.ReadLine()) != null){
|
||||||
|
Disabled.Add(line);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}catch(FileNotFoundException){
|
||||||
|
}catch(DirectoryNotFoundException){
|
||||||
|
}catch(Exception e){
|
||||||
|
Program.Reporter.HandleException("Plugin Configuration Error", "Could not read the plugin configuration file. If you continue, the list of disabled plugins will be reset to default.", true, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Save(string file){
|
||||||
|
try{
|
||||||
|
using(FileStream stream = new FileStream(file, FileMode.Create, FileAccess.Write, FileShare.None))
|
||||||
|
using(StreamWriter writer = new StreamWriter(stream, Encoding.UTF8)){
|
||||||
|
writer.WriteLine("#Disabled");
|
||||||
|
|
||||||
|
foreach(string disabled in Disabled){
|
||||||
|
writer.WriteLine(disabled);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}catch(Exception e){
|
||||||
|
Program.Reporter.HandleException("Plugin Configuration Error", "Could not save the plugin configuration file.", true, e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
using System;
|
using CefSharp;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using CefSharp;
|
|
||||||
using TweetDck.Plugins.Enums;
|
using TweetDck.Plugins.Enums;
|
||||||
using TweetDck.Plugins.Events;
|
using TweetDck.Plugins.Events;
|
||||||
using TweetDck.Resources;
|
using TweetDck.Resources;
|
||||||
@@ -15,50 +15,62 @@ namespace TweetDck.Plugins{
|
|||||||
|
|
||||||
private const int InvalidToken = 0;
|
private const int InvalidToken = 0;
|
||||||
|
|
||||||
public string PathOfficialPlugins { get { return Path.Combine(rootPath, "official"); } }
|
public string PathOfficialPlugins => Path.Combine(rootPath, "official");
|
||||||
public string PathCustomPlugins { get { return Path.Combine(rootPath, "user"); } }
|
public string PathCustomPlugins => Path.Combine(rootPath, "user");
|
||||||
|
|
||||||
public IEnumerable<Plugin> Plugins { get { return plugins; } }
|
public IEnumerable<Plugin> Plugins => plugins;
|
||||||
public PluginConfig Config { get; private set; }
|
public PluginConfig Config { get; }
|
||||||
public PluginBridge Bridge { get; private set; }
|
public PluginBridge Bridge { get; }
|
||||||
|
|
||||||
public event EventHandler<PluginErrorEventArgs> Reloaded;
|
public event EventHandler<PluginErrorEventArgs> Reloaded;
|
||||||
public event EventHandler<PluginErrorEventArgs> Executed;
|
public event EventHandler<PluginErrorEventArgs> Executed;
|
||||||
public event EventHandler<PluginChangedStateEventArgs> PluginChangedState;
|
public event EventHandler<PluginChangedStateEventArgs> PluginChangedState;
|
||||||
|
|
||||||
private readonly string rootPath;
|
private readonly string rootPath;
|
||||||
|
private readonly string configPath;
|
||||||
|
|
||||||
private readonly HashSet<Plugin> plugins = new HashSet<Plugin>();
|
private readonly HashSet<Plugin> plugins = new HashSet<Plugin>();
|
||||||
private readonly Dictionary<int, Plugin> tokens = new Dictionary<int, Plugin>();
|
private readonly Dictionary<int, Plugin> tokens = new Dictionary<int, Plugin>();
|
||||||
private readonly Random rand = new Random();
|
private readonly Random rand = new Random();
|
||||||
|
|
||||||
private List<string> loadErrors;
|
private List<string> loadErrors;
|
||||||
|
|
||||||
public PluginManager(string path, PluginConfig config){
|
public PluginManager(string rootPath, string configPath){
|
||||||
this.rootPath = path;
|
this.rootPath = rootPath;
|
||||||
this.SetConfig(config);
|
this.configPath = configPath;
|
||||||
|
|
||||||
|
this.Config = new PluginConfig();
|
||||||
this.Bridge = new PluginBridge(this);
|
this.Bridge = new PluginBridge(this);
|
||||||
|
|
||||||
|
LoadConfig();
|
||||||
|
|
||||||
|
Config.InternalPluginChangedState += Config_InternalPluginChangedState;
|
||||||
Program.UserConfigReplaced += Program_UserConfigReplaced;
|
Program.UserConfigReplaced += Program_UserConfigReplaced;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void LoadConfig(){
|
||||||
|
#pragma warning disable 612
|
||||||
|
if (Program.UserConfig.Plugins != null){
|
||||||
|
Config.ImportLegacy(Program.UserConfig.Plugins);
|
||||||
|
Config.Save(configPath);
|
||||||
|
|
||||||
|
Program.UserConfig.Plugins = null;
|
||||||
|
Program.UserConfig.Save();
|
||||||
|
}
|
||||||
|
#pragma warning restore 612
|
||||||
|
else{
|
||||||
|
Config.Load(configPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void Program_UserConfigReplaced(object sender, EventArgs e){
|
private void Program_UserConfigReplaced(object sender, EventArgs e){
|
||||||
SetConfig(Program.UserConfig.Plugins);
|
LoadConfig();
|
||||||
Reload();
|
Reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Config_InternalPluginChangedState(object sender, PluginChangedStateEventArgs e){
|
private void Config_InternalPluginChangedState(object sender, PluginChangedStateEventArgs e){
|
||||||
if (PluginChangedState != null){
|
PluginChangedState?.Invoke(this, e);
|
||||||
PluginChangedState(this, e);
|
Config.Save(configPath);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void SetConfig(PluginConfig config){
|
|
||||||
if (this.Config != null){
|
|
||||||
this.Config.InternalPluginChangedState -= Config_InternalPluginChangedState;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.Config = config;
|
|
||||||
this.Config.InternalPluginChangedState += Config_InternalPluginChangedState;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsPluginInstalled(string identifier){
|
public bool IsPluginInstalled(string identifier){
|
||||||
@@ -88,8 +100,7 @@ namespace TweetDck.Plugins{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Plugin GetPluginFromToken(int token){
|
public Plugin GetPluginFromToken(int token){
|
||||||
Plugin plugin;
|
return tokens.TryGetValue(token, out Plugin plugin) ? plugin : null;
|
||||||
return tokens.TryGetValue(token, out plugin) ? plugin : null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Reload(){
|
public void Reload(){
|
||||||
@@ -106,9 +117,7 @@ namespace TweetDck.Plugins{
|
|||||||
plugins.Add(plugin);
|
plugins.Add(plugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Reloaded != null){
|
Reloaded?.Invoke(this, new PluginErrorEventArgs(loadErrors));
|
||||||
Reloaded(this, new PluginErrorEventArgs(loadErrors));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ExecutePlugins(IFrame frame, PluginEnvironment environment, bool includeDisabled){
|
public void ExecutePlugins(IFrame frame, PluginEnvironment environment, bool includeDisabled){
|
||||||
@@ -120,7 +129,7 @@ namespace TweetDck.Plugins{
|
|||||||
|
|
||||||
foreach(Plugin plugin in Plugins){
|
foreach(Plugin plugin in Plugins){
|
||||||
string path = plugin.GetScriptPath(environment);
|
string path = plugin.GetScriptPath(environment);
|
||||||
if (string.IsNullOrEmpty(path) || !plugin.CanRun || (!includeDisabled && !Config.IsEnabled(plugin)))continue;
|
if (string.IsNullOrEmpty(path) || (!includeDisabled && !Config.IsEnabled(plugin)) || !plugin.CanRun)continue;
|
||||||
|
|
||||||
string script;
|
string script;
|
||||||
|
|
||||||
@@ -144,9 +153,7 @@ namespace TweetDck.Plugins{
|
|||||||
ScriptLoader.ExecuteScript(frame, PluginScriptGenerator.GeneratePlugin(plugin.Identifier, script, token, environment), "plugin:"+plugin);
|
ScriptLoader.ExecuteScript(frame, PluginScriptGenerator.GeneratePlugin(plugin.Identifier, script, token, environment), "plugin:"+plugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Executed != null){
|
Executed?.Invoke(this, new PluginErrorEventArgs(failedPlugins));
|
||||||
Executed(this, new PluginErrorEventArgs(failedPlugins));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private IEnumerable<Plugin> LoadPluginsFrom(string path, PluginGroup group){
|
private IEnumerable<Plugin> LoadPluginsFrom(string path, PluginGroup group){
|
||||||
@@ -155,8 +162,7 @@ namespace TweetDck.Plugins{
|
|||||||
}
|
}
|
||||||
|
|
||||||
foreach(string fullDir in Directory.EnumerateDirectories(path, "*", SearchOption.TopDirectoryOnly)){
|
foreach(string fullDir in Directory.EnumerateDirectories(path, "*", SearchOption.TopDirectoryOnly)){
|
||||||
string error;
|
Plugin plugin = Plugin.CreateFromFolder(fullDir, group, out string error);
|
||||||
Plugin plugin = Plugin.CreateFromFolder(fullDir, group, out error);
|
|
||||||
|
|
||||||
if (plugin == null){
|
if (plugin == null){
|
||||||
loadErrors.Add(group.GetIdentifierPrefix()+Path.GetFileName(fullDir)+": "+error);
|
loadErrors.Add(group.GetIdentifierPrefix()+Path.GetFileName(fullDir)+": "+error);
|
||||||
|
32
Program.cs
32
Program.cs
@@ -1,18 +1,18 @@
|
|||||||
using System;
|
using CefSharp;
|
||||||
|
using System;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Windows.Forms;
|
|
||||||
using CefSharp;
|
|
||||||
using TweetDck.Configuration;
|
|
||||||
using TweetDck.Core;
|
|
||||||
using TweetDck.Core.Utils;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using TweetDck.Plugins;
|
using System.Windows.Forms;
|
||||||
using TweetDck.Plugins.Events;
|
using TweetDck.Configuration;
|
||||||
using TweetDck.Core.Other.Settings.Export;
|
using TweetDck.Core;
|
||||||
using TweetDck.Core.Handling;
|
using TweetDck.Core.Handling;
|
||||||
using TweetDck.Core.Other;
|
using TweetDck.Core.Other;
|
||||||
|
using TweetDck.Core.Other.Settings.Export;
|
||||||
|
using TweetDck.Core.Utils;
|
||||||
|
using TweetDck.Plugins;
|
||||||
|
using TweetDck.Plugins.Events;
|
||||||
using TweetDck.Updates;
|
using TweetDck.Updates;
|
||||||
|
|
||||||
namespace TweetDck{
|
namespace TweetDck{
|
||||||
@@ -20,8 +20,8 @@ namespace TweetDck{
|
|||||||
public const string BrandName = "TweetDuck";
|
public const string BrandName = "TweetDuck";
|
||||||
public const string Website = "https://tweetduck.chylex.com";
|
public const string Website = "https://tweetduck.chylex.com";
|
||||||
|
|
||||||
public const string VersionTag = "1.7.2";
|
public const string VersionTag = "1.7.5";
|
||||||
public const string VersionFull = "1.7.2.0";
|
public const string VersionFull = "1.7.5.0";
|
||||||
|
|
||||||
public static readonly Version Version = new Version(VersionTag);
|
public static readonly Version Version = new Version(VersionTag);
|
||||||
public static readonly bool IsPortable = File.Exists("makeportable");
|
public static readonly bool IsPortable = File.Exists("makeportable");
|
||||||
@@ -29,8 +29,9 @@ namespace TweetDck{
|
|||||||
public static readonly string ProgramPath = AppDomain.CurrentDomain.BaseDirectory;
|
public static readonly string ProgramPath = AppDomain.CurrentDomain.BaseDirectory;
|
||||||
public static readonly string StoragePath = IsPortable ? Path.Combine(ProgramPath, "portable", "storage") : GetDataStoragePath();
|
public static readonly string StoragePath = IsPortable ? Path.Combine(ProgramPath, "portable", "storage") : GetDataStoragePath();
|
||||||
|
|
||||||
public static readonly string PluginDataPath = Path.Combine(StoragePath, "TD_Plugins");
|
|
||||||
public static readonly string ConfigFilePath = Path.Combine(StoragePath, "TD_UserConfig.cfg");
|
public static readonly string ConfigFilePath = Path.Combine(StoragePath, "TD_UserConfig.cfg");
|
||||||
|
public static readonly string PluginDataPath = Path.Combine(StoragePath, "TD_Plugins");
|
||||||
|
public static readonly string PluginConfigFilePath = Path.Combine(StoragePath, "TD_PluginConfig.cfg");
|
||||||
private static readonly string ErrorLogFilePath = Path.Combine(StoragePath, "TD_Log.txt");
|
private static readonly string ErrorLogFilePath = Path.Combine(StoragePath, "TD_Log.txt");
|
||||||
private static readonly string ConsoleLogFilePath = Path.Combine(StoragePath, "TD_Console.txt");
|
private static readonly string ConsoleLogFilePath = Path.Combine(StoragePath, "TD_Console.txt");
|
||||||
|
|
||||||
@@ -155,7 +156,7 @@ namespace TweetDck{
|
|||||||
|
|
||||||
Application.ApplicationExit += (sender, args) => ExitCleanup();
|
Application.ApplicationExit += (sender, args) => ExitCleanup();
|
||||||
|
|
||||||
PluginManager plugins = new PluginManager(PluginPath, UserConfig.Plugins);
|
PluginManager plugins = new PluginManager(PluginPath, PluginConfigFilePath);
|
||||||
plugins.Reloaded += plugins_Reloaded;
|
plugins.Reloaded += plugins_Reloaded;
|
||||||
plugins.Executed += plugins_Executed;
|
plugins.Executed += plugins_Executed;
|
||||||
plugins.Reload();
|
plugins.Reload();
|
||||||
@@ -213,10 +214,7 @@ namespace TweetDck{
|
|||||||
|
|
||||||
public static void ReloadConfig(){
|
public static void ReloadConfig(){
|
||||||
UserConfig = UserConfig.Load(ConfigFilePath);
|
UserConfig = UserConfig.Load(ConfigFilePath);
|
||||||
|
UserConfigReplaced?.Invoke(UserConfig, new EventArgs());
|
||||||
if (UserConfigReplaced != null){
|
|
||||||
UserConfigReplaced(UserConfig, new EventArgs());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void ResetConfig(){
|
public static void ResetConfig(){
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using System.Resources;
|
using System.Resources;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
using TweetDck;
|
using TweetDck;
|
||||||
|
|
||||||
// General Information about an assembly is controlled through the following
|
// General Information about an assembly is controlled through the following
|
||||||
|
1
Properties/Resources.Designer.cs
generated
1
Properties/Resources.Designer.cs
generated
@@ -9,7 +9,6 @@
|
|||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
namespace TweetDck.Properties {
|
namespace TweetDck.Properties {
|
||||||
using System;
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
# Build Instructions
|
# Build Instructions
|
||||||
|
|
||||||
The program was build using Visual Studio 2013. After opening the solution, make sure you have **CefSharp.WinForms** and **Microsoft.VC120.CRT.JetBrains** included - if not, download them using NuGet.
|
The program was built using Visual Studio 2017. After opening the solution, make sure you have **CefSharp.WinForms** and **Microsoft.VC120.CRT.JetBrains** included - if not, download them using NuGet.
|
||||||
```
|
```
|
||||||
PM> Install-Package CefSharp.WinForms -Version 57.0.0-pre01
|
PM> Install-Package CefSharp.WinForms -Version 57.0.0
|
||||||
PM> Install-Package Microsoft.VC120.CRT.JetBrains
|
PM> Install-Package Microsoft.VC120.CRT.JetBrains
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@@ -16,6 +16,7 @@ enabled(){
|
|||||||
hideTweetActions: true,
|
hideTweetActions: true,
|
||||||
moveTweetActionsToRight: true,
|
moveTweetActionsToRight: true,
|
||||||
revertReplies: false,
|
revertReplies: false,
|
||||||
|
themeColorTweaks: true,
|
||||||
roundedScrollBars: false,
|
roundedScrollBars: false,
|
||||||
smallComposeTextSize: false,
|
smallComposeTextSize: false,
|
||||||
optimizeAnimations: true,
|
optimizeAnimations: true,
|
||||||
@@ -54,6 +55,7 @@ enabled(){
|
|||||||
$TDP.checkFileExists(this.$token, configFile).then(exists => {
|
$TDP.checkFileExists(this.$token, configFile).then(exists => {
|
||||||
if (!exists){
|
if (!exists){
|
||||||
loadConfigObject(null);
|
loadConfigObject(null);
|
||||||
|
$TDP.writeFile(this.$token, configFile, JSON.stringify(this.defaultConfig));
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$TDP.readFile(this.$token, configFile, true).then(contents => {
|
$TDP.readFile(this.$token, configFile, true).then(contents => {
|
||||||
@@ -199,6 +201,7 @@ enabled(){
|
|||||||
setTimeout(function(){
|
setTimeout(function(){
|
||||||
TD.settings.setTheme($(this).attr("data-td-theme"));
|
TD.settings.setTheme($(this).attr("data-td-theme"));
|
||||||
$(document).trigger("uiToggleTheme");
|
$(document).trigger("uiToggleTheme");
|
||||||
|
me.reinjectAll();
|
||||||
}, 1);
|
}, 1);
|
||||||
});
|
});
|
||||||
}).methods({
|
}).methods({
|
||||||
@@ -227,6 +230,70 @@ enabled(){
|
|||||||
this.$pluginSettings.requiresPageReload = enable;
|
this.$pluginSettings.requiresPageReload = enable;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// animation optimization
|
||||||
|
this.optimizations = null;
|
||||||
|
this.optimizationTimer = null;
|
||||||
|
|
||||||
|
let clearOptimizationTimer = () => {
|
||||||
|
if (this.optimizationTimer){
|
||||||
|
window.clearTimeout(this.optimizationTimer);
|
||||||
|
this.optimizationTimer = null;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
let runOptimizationTimer = timeout => {
|
||||||
|
if (!this.optimizationTimer){
|
||||||
|
this.optimizationTimer = window.setTimeout(optimizationTimerFunc, timeout);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
let optimizationTimerFunc = () => {
|
||||||
|
this.optimizationTimer = null;
|
||||||
|
|
||||||
|
if (this.config.optimizeAnimations){
|
||||||
|
$TD.getIdleSeconds().then(s => {
|
||||||
|
if (s >= 16){
|
||||||
|
disableOptimizations();
|
||||||
|
runOptimizationTimer(2500);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
injectOptimizations();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
let injectOptimizations = force => {
|
||||||
|
if (!this.optimizations && (force || document.hasFocus())){
|
||||||
|
this.optimizations = window.TDPF_createCustomStyle(this);
|
||||||
|
this.optimizations.insert(".app-content { will-change: transform }");
|
||||||
|
this.optimizations.insert(".column-holder { will-change: transform }");
|
||||||
|
}
|
||||||
|
|
||||||
|
clearOptimizationTimer();
|
||||||
|
runOptimizationTimer(10000);
|
||||||
|
};
|
||||||
|
|
||||||
|
let disableOptimizations = () => {
|
||||||
|
if (this.optimizations){
|
||||||
|
this.optimizations.remove();
|
||||||
|
this.optimizations = null;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
this.onWindowFocusEvent = () => {
|
||||||
|
if (this.config.optimizeAnimations){
|
||||||
|
injectOptimizations(true);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
this.onWindowBlurEvent = () => {
|
||||||
|
if (this.config.optimizeAnimations){
|
||||||
|
disableOptimizations();
|
||||||
|
clearOptimizationTimer();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// css and layout injection
|
// css and layout injection
|
||||||
this.resetDesign = () => {
|
this.resetDesign = () => {
|
||||||
if (this.css){
|
if (this.css){
|
||||||
@@ -239,12 +306,36 @@ enabled(){
|
|||||||
this.reinjectAll = () => {
|
this.reinjectAll = () => {
|
||||||
this.resetDesign();
|
this.resetDesign();
|
||||||
|
|
||||||
|
clearOptimizationTimer();
|
||||||
|
|
||||||
|
if (this.config.optimizeAnimations){
|
||||||
|
injectOptimizations();
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
disableOptimizations();
|
||||||
|
}
|
||||||
|
|
||||||
this.css.insert("#general_settings .cf { display: none !important }");
|
this.css.insert("#general_settings .cf { display: none !important }");
|
||||||
this.css.insert("#general_settings .divider-bar::after { display: inline-block; padding-top: 10px; line-height: 17px; content: 'Use the new | Edit layout & design | option in the Settings to modify TweetDeck theme, column width, font size, and other features.' }");
|
this.css.insert("#general_settings .divider-bar::after { display: inline-block; padding-top: 10px; line-height: 17px; content: 'Use the new | Edit layout & design | option in the Settings to modify TweetDeck theme, column width, font size, and other features.' }");
|
||||||
|
|
||||||
this.css.insert(".txt-base-smallest:not(.icon), .txt-base-largest:not(.icon) { font-size: "+this.config.fontSize+" !important }");
|
this.css.insert(".txt-base-smallest:not(.icon), .txt-base-largest:not(.icon) { font-size: "+this.config.fontSize+" !important }");
|
||||||
this.css.insert(".avatar { border-radius: "+this.config.avatarRadius+"% !important }");
|
this.css.insert(".avatar { border-radius: "+this.config.avatarRadius+"% !important }");
|
||||||
|
|
||||||
|
if (this.config.themeColorTweaks){
|
||||||
|
switch(TD.settings.getTheme()){
|
||||||
|
case "dark":
|
||||||
|
this.css.insert(".app-content, .app-columns-container { background-color: #444448 }");
|
||||||
|
this.css.insert(".column-drag-handle { opacity: 0.5 }");
|
||||||
|
this.css.insert(".column-drag-handle:hover { opacity: 1 }");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "light":
|
||||||
|
this.css.insert(".scroll-styled-v::-webkit-scrollbar-thumb, .scroll-styled-h::-webkit-scrollbar-thumb { background-color: #d2d6da }");
|
||||||
|
this.css.insert(".app-columns-container.scroll-styled-h::-webkit-scrollbar-thumb:not(:hover) { background-color: #a5aeb5 }");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (this.config.hideTweetActions){
|
if (this.config.hideTweetActions){
|
||||||
this.css.insert(".tweet-action { opacity: 0; }");
|
this.css.insert(".tweet-action { opacity: 0; }");
|
||||||
this.css.insert(".is-favorite .tweet-action, .is-retweet .tweet-action { opacity: 0.5; visibility: visible !important }");
|
this.css.insert(".is-favorite .tweet-action, .is-retweet .tweet-action { opacity: 0.5; visibility: visible !important }");
|
||||||
@@ -268,11 +359,12 @@ enabled(){
|
|||||||
this.css.insert(".antiscroll-scrollbar { border-radius: 0 }");
|
this.css.insert(".antiscroll-scrollbar { border-radius: 0 }");
|
||||||
this.css.insert(".antiscroll-scrollbar-vertical { margin-top: 0 }");
|
this.css.insert(".antiscroll-scrollbar-vertical { margin-top: 0 }");
|
||||||
this.css.insert(".antiscroll-scrollbar-horizontal { margin-left: 0 }");
|
this.css.insert(".antiscroll-scrollbar-horizontal { margin-left: 0 }");
|
||||||
|
this.css.insert(".app-columns-container::-webkit-scrollbar { height: 9px !important }");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.config.optimizeAnimations){
|
if (this.config.revertReplies){
|
||||||
this.css.insert(".app-content { will-change: transform }");
|
this.css.insert(".activity-header + .tweet .tweet-context { margin-left: -35px }");
|
||||||
this.css.insert(".column-holder { will-change: transform }");
|
this.css.insert(".activity-header + .tweet .tweet-context .obj-left { margin-right: 5px }");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.config.columnWidth[0] === '/'){
|
if (this.config.columnWidth[0] === '/'){
|
||||||
@@ -311,6 +403,7 @@ enabled(){
|
|||||||
"<style type='text/css'>",
|
"<style type='text/css'>",
|
||||||
".txt-base-smallest:not(.icon), .txt-base-largest:not(.icon) { font-size: "+this.config.fontSize+" !important }",
|
".txt-base-smallest:not(.icon), .txt-base-largest:not(.icon) { font-size: "+this.config.fontSize+" !important }",
|
||||||
".avatar { border-radius: "+this.config.avatarRadius+"% !important }",
|
".avatar { border-radius: "+this.config.avatarRadius+"% !important }",
|
||||||
|
(this.config.revertReplies ? ".activity-header + .tweet .tweet-context { margin-left: -35px } .activity-header + .tweet .tweet-context .obj-left { margin-right: 5px }" : ""),
|
||||||
"</style>"
|
"</style>"
|
||||||
].join(""));
|
].join(""));
|
||||||
};
|
};
|
||||||
@@ -338,6 +431,10 @@ ready(){
|
|||||||
|
|
||||||
this.onAppReady();
|
this.onAppReady();
|
||||||
|
|
||||||
|
// optimization events
|
||||||
|
$(window).on("focus", this.onWindowFocusEvent);
|
||||||
|
$(window).on("blur", this.onWindowBlurEvent);
|
||||||
|
|
||||||
// layout events
|
// layout events
|
||||||
$(document).on("uiShowActionsMenu", this.uiShowActionsMenuEvent);
|
$(document).on("uiShowActionsMenu", this.uiShowActionsMenuEvent);
|
||||||
|
|
||||||
@@ -351,7 +448,17 @@ disabled(){
|
|||||||
this.css.remove();
|
this.css.remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.optimizations){
|
||||||
|
this.optimizations.remove();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.optimizationTimer){
|
||||||
|
window.clearTimeout(this.optimizationTimer);
|
||||||
|
}
|
||||||
|
|
||||||
$(document).off("uiShowActionsMenu", this.uiShowActionsMenuEvent);
|
$(document).off("uiShowActionsMenu", this.uiShowActionsMenuEvent);
|
||||||
|
$(window).off("focus", this.onWindowFocusEvent);
|
||||||
|
$(window).off("blur", this.onWindowBlurEvent);
|
||||||
|
|
||||||
$("[data-action='settings-menu']").off("click", this.onSettingsMenuClickedEvent);
|
$("[data-action='settings-menu']").off("click", this.onSettingsMenuClickedEvent);
|
||||||
$("#td-design-plugin-modal").remove();
|
$("#td-design-plugin-modal").remove();
|
||||||
|
@@ -61,6 +61,16 @@
|
|||||||
<option value="16px">Largest (16px)</option>
|
<option value="16px">Largest (16px)</option>
|
||||||
<option value="custom">Custom</option>
|
<option value="custom">Custom</option>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<!-- ADVANCED -->
|
||||||
|
|
||||||
|
<label class="txt-uppercase touch-larger-label">
|
||||||
|
<b>Advanced</b>
|
||||||
|
</label>
|
||||||
|
<label class="checkbox">
|
||||||
|
<input data-td-key="optimizeAnimations" class="js-theme-checkbox touch-larger-label" type="checkbox">
|
||||||
|
Use more memory for smoother animations
|
||||||
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="l-column mdl-column">
|
<div class="l-column mdl-column">
|
||||||
@@ -88,6 +98,10 @@
|
|||||||
<label class="txt-uppercase touch-larger-label">
|
<label class="txt-uppercase touch-larger-label">
|
||||||
<b>Design</b>
|
<b>Design</b>
|
||||||
</label>
|
</label>
|
||||||
|
<label class="checkbox">
|
||||||
|
<input data-td-key="themeColorTweaks" class="js-theme-checkbox touch-larger-label" type="checkbox">
|
||||||
|
Theme color tweaks
|
||||||
|
</label>
|
||||||
<label class="checkbox">
|
<label class="checkbox">
|
||||||
<input data-td-key="roundedScrollBars" class="js-theme-checkbox touch-larger-label" type="checkbox">
|
<input data-td-key="roundedScrollBars" class="js-theme-checkbox touch-larger-label" type="checkbox">
|
||||||
Rounded scroll bars
|
Rounded scroll bars
|
||||||
@@ -96,16 +110,6 @@
|
|||||||
<input data-td-key="smallComposeTextSize" class="js-theme-checkbox touch-larger-label" type="checkbox">
|
<input data-td-key="smallComposeTextSize" class="js-theme-checkbox touch-larger-label" type="checkbox">
|
||||||
Small compose tweet font size
|
Small compose tweet font size
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<!-- ADVANCED -->
|
|
||||||
|
|
||||||
<label class="txt-uppercase touch-larger-label">
|
|
||||||
<b>Advanced</b>
|
|
||||||
</label>
|
|
||||||
<label class="checkbox">
|
|
||||||
<input data-td-key="optimizeAnimations" class="js-theme-checkbox touch-larger-label" type="checkbox">
|
|
||||||
Optimize animations (uses more memory for smoother animations)
|
|
||||||
</label>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="l-column mdl-column">
|
<div class="l-column mdl-column">
|
||||||
@@ -153,7 +157,7 @@
|
|||||||
|
|
||||||
.td-modal-panel {
|
.td-modal-panel {
|
||||||
width: 693px;
|
width: 693px;
|
||||||
height: 374px;
|
height: 380px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.td-modal-inner-cols {
|
.td-modal-inner-cols {
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
using System;
|
using CefSharp;
|
||||||
|
using CefSharp.WinForms;
|
||||||
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using CefSharp;
|
|
||||||
using CefSharp.WinForms;
|
|
||||||
|
|
||||||
namespace TweetDck.Resources{
|
namespace TweetDck.Resources{
|
||||||
static class ScriptLoader{
|
static class ScriptLoader{
|
||||||
|
@@ -80,7 +80,39 @@
|
|||||||
//
|
//
|
||||||
// Function: Event callback for a new tweet.
|
// Function: Event callback for a new tweet.
|
||||||
//
|
//
|
||||||
var onNewTweet = function(column, tweet){
|
var onNewTweet = (function(){
|
||||||
|
let recentTweets = new Set();
|
||||||
|
let recentTweetTimer = null;
|
||||||
|
|
||||||
|
let startRecentTweetTimer = () => {
|
||||||
|
if (recentTweetTimer){
|
||||||
|
window.clearTimeout(recentTweetTimer);
|
||||||
|
}
|
||||||
|
|
||||||
|
recentTweetTimer = window.setTimeout(() => {
|
||||||
|
recentTweetTimer = null;
|
||||||
|
recentTweets.clear();
|
||||||
|
}, 10000);
|
||||||
|
};
|
||||||
|
|
||||||
|
let checkRecentTweet = id => {
|
||||||
|
if (recentTweets.size > 50){
|
||||||
|
recentTweets.clear();
|
||||||
|
}
|
||||||
|
else if (recentTweets.has(id)){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
recentTweets.add(id);
|
||||||
|
startRecentTweetTimer();
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
return function(column, tweet){
|
||||||
|
if (checkRecentTweet(tweet.id)){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (column.model.getHasNotification()){
|
if (column.model.getHasNotification()){
|
||||||
let html = $(tweet.render({
|
let html = $(tweet.render({
|
||||||
withFooter: false,
|
withFooter: false,
|
||||||
@@ -100,6 +132,11 @@
|
|||||||
this.outerHTML = this.innerHTML;
|
this.outerHTML = this.innerHTML;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (tweet.getChirpType().includes("list_member")){
|
||||||
|
html.find(".activity-header").first().css("margin-top", "2px");
|
||||||
|
html.find(".avatar").first().css("margin-bottom", "0");
|
||||||
|
}
|
||||||
|
|
||||||
let source = tweet.getRelatedTweet();
|
let source = tweet.getRelatedTweet();
|
||||||
let duration = source ? source.text.length+(source.quotedTweet ? source.quotedTweet.text.length : 0) : tweet.text.length;
|
let duration = source ? source.text.length+(source.quotedTweet ? source.quotedTweet.text.length : 0) : tweet.text.length;
|
||||||
let tweetUrl = source ? source.getChirpURL() : "";
|
let tweetUrl = source ? source.getChirpURL() : "";
|
||||||
@@ -112,6 +149,7 @@
|
|||||||
$TD.onTweetSound();
|
$TD.onTweetSound();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
})();
|
||||||
|
|
||||||
//
|
//
|
||||||
// Function: Retrieves the tags to be put into <head> for notification HTML code.
|
// Function: Retrieves the tags to be put into <head> for notification HTML code.
|
||||||
@@ -124,9 +162,11 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
tags.push("<style type='text/css'>");
|
tags.push("<style type='text/css'>");
|
||||||
tags.push("body { background-color: "+getClassStyleProperty("column", "background-color")+" }"); // set background color
|
tags.push("body { background: "+getClassStyleProperty("column", "background-color")+" }"); // set background color
|
||||||
tags.push("a[data-full-url] { word-break: break-all }"); // break long urls
|
tags.push("a[data-full-url] { word-break: break-all }"); // break long urls
|
||||||
tags.push(".txt-base-smallest .badge-verified:before { height: 13px !important }"); // fix cut off badge icon
|
tags.push(".txt-base-smallest .badge-verified:before { height: 13px !important }"); // fix cut off badge icon
|
||||||
|
tags.push(".activity-header { align-items: center !important; margin-bottom: 4px }"); // tweak alignment of avatar and text in notifications
|
||||||
|
tags.push(".activity-header .tweet-timestamp { line-height: unset }"); // fix timestamp position in notifications
|
||||||
tags.push("</style>");
|
tags.push("</style>");
|
||||||
|
|
||||||
return tags.join("");
|
return tags.join("");
|
||||||
@@ -513,17 +553,18 @@
|
|||||||
// Block: Swap shift key functionality for selecting accounts.
|
// Block: Swap shift key functionality for selecting accounts.
|
||||||
//
|
//
|
||||||
onAppReady.push(function(){
|
onAppReady.push(function(){
|
||||||
$(".js-drawer[data-drawer='compose']").delegate(".js-account-list > .js-account-item", "click", function(e){
|
var toggleEventShiftKey = function(e){
|
||||||
|
if ($TDX.switchAccountSelectors){
|
||||||
e.shiftKey = !e.shiftKey;
|
e.shiftKey = !e.shiftKey;
|
||||||
});
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
$(".js-drawer[data-drawer='compose']").delegate(".js-account-list > .js-account-item", "click", toggleEventShiftKey);
|
||||||
|
|
||||||
TD.components.AccountSelector.prototype.refreshPostingAccounts = appendToFunction(TD.components.AccountSelector.prototype.refreshPostingAccounts, function(){
|
TD.components.AccountSelector.prototype.refreshPostingAccounts = appendToFunction(TD.components.AccountSelector.prototype.refreshPostingAccounts, function(){
|
||||||
if (!this.$node.attr("td-account-selector-hook")){
|
if (!this.$node.attr("td-account-selector-hook")){
|
||||||
this.$node.attr("td-account-selector-hook", "1");
|
this.$node.attr("td-account-selector-hook", "1");
|
||||||
|
this.$node.delegate(".js-account-item", "click", toggleEventShiftKey);
|
||||||
this.$node.delegate(".js-account-item", "click", function(e){
|
|
||||||
e.shiftKey = !e.shiftKey;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -547,12 +588,14 @@
|
|||||||
styleOfficial.sheet.insertRule(".txt-base-smallest .sprite-verified-mini { width: 13px !important; height: 13px !important; background-position: -223px -99px !important; }", 0); // fix cut off badge icon when zoomed in
|
styleOfficial.sheet.insertRule(".txt-base-smallest .sprite-verified-mini { width: 13px !important; height: 13px !important; background-position: -223px -99px !important; }", 0); // fix cut off badge icon when zoomed in
|
||||||
styleOfficial.sheet.insertRule(".keyboard-shortcut-list { vertical-align: top; }", 0); // fix keyboard navigation alignment
|
styleOfficial.sheet.insertRule(".keyboard-shortcut-list { vertical-align: top; }", 0); // fix keyboard navigation alignment
|
||||||
styleOfficial.sheet.insertRule(".sprite-logo { background-position: -5px -46px !important; }", 0); // fix TweetDeck logo on certain zoom levels
|
styleOfficial.sheet.insertRule(".sprite-logo { background-position: -5px -46px !important; }", 0); // fix TweetDeck logo on certain zoom levels
|
||||||
styleOfficial.sheet.insertRule(".app-columns-container::-webkit-scrollbar-track { border-left: 0 }", 0); // remove weird border in the column container scrollbar
|
styleOfficial.sheet.insertRule(".app-navigator .tooltip { display: none !important; }", 0); // hide broken tooltips in the menu
|
||||||
styleOfficial.sheet.insertRule(".app-navigator .tooltip { display: none !important }", 0); // hide broken tooltips in the menu
|
styleOfficial.sheet.insertRule(".account-inline .username { vertical-align: 10%; }", 0); // move usernames a bit higher
|
||||||
styleOfficial.sheet.insertRule(".account-inline .username { vertical-align: 10% }", 0); // move usernames a bit higher
|
|
||||||
|
|
||||||
styleOfficial.sheet.insertRule(".js-accounts-column-holder { bottom: 4px; }", 0); // fix white bar on the bottom
|
styleOfficial.sheet.insertRule(".activity-header { align-items: center !important; margin-bottom: 4px; }", 0); // tweak alignment of avatar and text in notifications
|
||||||
styleOfficial.sheet.insertRule(".drawer[data-drawer='accountSettings'] { background-color: #ccd6dd; }", 0); // fix white bar on the bottom
|
styleOfficial.sheet.insertRule(".activity-header .tweet-timestamp { line-height: unset }", 0); // fix timestamp position in notifications
|
||||||
|
|
||||||
|
styleOfficial.sheet.insertRule(".app-columns-container::-webkit-scrollbar-track { border-left: 0; }", 0); // remove weird border in the column container scrollbar
|
||||||
|
styleOfficial.sheet.insertRule(".app-columns-container { bottom: 0 !important; }", 0); // move column container scrollbar to bottom to fit updated style
|
||||||
|
|
||||||
styleOfficial.sheet.insertRule(".is-video a:not([href*='youtu']), .is-gif .js-media-gif-container { cursor: alias; }", 0); // change cursor on unsupported videos
|
styleOfficial.sheet.insertRule(".is-video a:not([href*='youtu']), .is-gif .js-media-gif-container { cursor: alias; }", 0); // change cursor on unsupported videos
|
||||||
styleOfficial.sheet.insertRule(".is-video a:not([href*='youtu']) .icon-bg-dot, .is-gif .icon-bg-dot { color: #bd3d37; }", 0); // change play icon color on unsupported videos
|
styleOfficial.sheet.insertRule(".is-video a:not([href*='youtu']) .icon-bg-dot, .is-gif .icon-bg-dot { color: #bd3d37; }", 0); // change play icon color on unsupported videos
|
||||||
@@ -618,6 +661,17 @@
|
|||||||
}, 100);
|
}, 100);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//
|
||||||
|
// Block: Fix DM notifications not showing if the conversation is open.
|
||||||
|
//
|
||||||
|
(function(prevFunc){
|
||||||
|
TD.services.TwitterConversation.prototype.getUnreadChirps = function(e){
|
||||||
|
return (e && e.sortIndex && !e.id && !this.notificationsDisabled)
|
||||||
|
? this.messages.filter(t => t.chirpType === TD.services.ChirpBase.MESSAGE && !t.isOwnChirp() && !t.read && !t.belongsBelow(e)) // changed from belongsAbove
|
||||||
|
: prevFunc.apply(this, arguments);
|
||||||
|
};
|
||||||
|
})(TD.services.TwitterConversation.prototype.getUnreadChirps);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Block: Disable TweetDeck metrics.
|
// Block: Disable TweetDeck metrics.
|
||||||
//
|
//
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<Import Project="packages\CefSharp.WinForms.57.0.0-pre01\build\CefSharp.WinForms.props" Condition="Exists('packages\CefSharp.WinForms.57.0.0-pre01\build\CefSharp.WinForms.props')" />
|
<Import Project="packages\CefSharp.WinForms.57.0.0\build\CefSharp.WinForms.props" Condition="Exists('packages\CefSharp.WinForms.57.0.0\build\CefSharp.WinForms.props')" />
|
||||||
<Import Project="packages\CefSharp.Common.57.0.0-pre01\build\CefSharp.Common.props" Condition="Exists('packages\CefSharp.Common.57.0.0-pre01\build\CefSharp.Common.props')" />
|
<Import Project="packages\CefSharp.Common.57.0.0\build\CefSharp.Common.props" Condition="Exists('packages\CefSharp.Common.57.0.0\build\CefSharp.Common.props')" />
|
||||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
@@ -13,7 +13,8 @@
|
|||||||
<AssemblyName>TweetDuck</AssemblyName>
|
<AssemblyName>TweetDuck</AssemblyName>
|
||||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||||
<FileAlignment>512</FileAlignment>
|
<FileAlignment>512</FileAlignment>
|
||||||
<NuGetPackageImportStamp>9e936308</NuGetPackageImportStamp>
|
<NuGetPackageImportStamp>
|
||||||
|
</NuGetPackageImportStamp>
|
||||||
<TargetFrameworkProfile>
|
<TargetFrameworkProfile>
|
||||||
</TargetFrameworkProfile>
|
</TargetFrameworkProfile>
|
||||||
<PublishUrl>publish\</PublishUrl>
|
<PublishUrl>publish\</PublishUrl>
|
||||||
@@ -42,6 +43,7 @@
|
|||||||
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
||||||
<Prefer32Bit>false</Prefer32Bit>
|
<Prefer32Bit>false</Prefer32Bit>
|
||||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||||
|
<LangVersion>7</LangVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<ApplicationIcon>Resources\icon.ico</ApplicationIcon>
|
<ApplicationIcon>Resources\icon.ico</ApplicationIcon>
|
||||||
@@ -373,21 +375,21 @@ if $(ConfigurationName) == Debug (
|
|||||||
xcopy "$(ProjectDir)Resources\Plugins\.debug\*" "$(TargetDir)plugins\user\.debug\" /E /Y
|
xcopy "$(ProjectDir)Resources\Plugins\.debug\*" "$(TargetDir)plugins\user\.debug\" /E /Y
|
||||||
)</PostBuildEvent>
|
)</PostBuildEvent>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="packages\cef.redist.x86.3.2987.1597\build\cef.redist.x86.targets" Condition="Exists('packages\cef.redist.x86.3.2987.1597\build\cef.redist.x86.targets')" />
|
<Import Project="packages\cef.redist.x64.3.2987.1601\build\cef.redist.x64.targets" Condition="Exists('packages\cef.redist.x64.3.2987.1601\build\cef.redist.x64.targets')" />
|
||||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Error Condition="!Exists('packages\cef.redist.x86.3.2987.1597\build\cef.redist.x86.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\cef.redist.x86.3.2987.1597\build\cef.redist.x86.targets'))" />
|
<Error Condition="!Exists('packages\cef.redist.x64.3.2987.1601\build\cef.redist.x64.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\cef.redist.x64.3.2987.1601\build\cef.redist.x64.targets'))" />
|
||||||
<Error Condition="!Exists('packages\cef.redist.x64.3.2987.1597\build\cef.redist.x64.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\cef.redist.x64.3.2987.1597\build\cef.redist.x64.targets'))" />
|
<Error Condition="!Exists('packages\cef.redist.x86.3.2987.1601\build\cef.redist.x86.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\cef.redist.x86.3.2987.1601\build\cef.redist.x86.targets'))" />
|
||||||
<Error Condition="!Exists('packages\CefSharp.Common.57.0.0-pre01\build\CefSharp.Common.props')" Text="$([System.String]::Format('$(ErrorText)', 'packages\CefSharp.Common.57.0.0-pre01\build\CefSharp.Common.props'))" />
|
<Error Condition="!Exists('packages\CefSharp.Common.57.0.0\build\CefSharp.Common.props')" Text="$([System.String]::Format('$(ErrorText)', 'packages\CefSharp.Common.57.0.0\build\CefSharp.Common.props'))" />
|
||||||
<Error Condition="!Exists('packages\CefSharp.Common.57.0.0-pre01\build\CefSharp.Common.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\CefSharp.Common.57.0.0-pre01\build\CefSharp.Common.targets'))" />
|
<Error Condition="!Exists('packages\CefSharp.Common.57.0.0\build\CefSharp.Common.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\CefSharp.Common.57.0.0\build\CefSharp.Common.targets'))" />
|
||||||
<Error Condition="!Exists('packages\CefSharp.WinForms.57.0.0-pre01\build\CefSharp.WinForms.props')" Text="$([System.String]::Format('$(ErrorText)', 'packages\CefSharp.WinForms.57.0.0-pre01\build\CefSharp.WinForms.props'))" />
|
<Error Condition="!Exists('packages\CefSharp.WinForms.57.0.0\build\CefSharp.WinForms.props')" Text="$([System.String]::Format('$(ErrorText)', 'packages\CefSharp.WinForms.57.0.0\build\CefSharp.WinForms.props'))" />
|
||||||
<Error Condition="!Exists('packages\CefSharp.WinForms.57.0.0-pre01\build\CefSharp.WinForms.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\CefSharp.WinForms.57.0.0-pre01\build\CefSharp.WinForms.targets'))" />
|
<Error Condition="!Exists('packages\CefSharp.WinForms.57.0.0\build\CefSharp.WinForms.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\CefSharp.WinForms.57.0.0\build\CefSharp.WinForms.targets'))" />
|
||||||
</Target>
|
</Target>
|
||||||
<Import Project="packages\cef.redist.x64.3.2987.1597\build\cef.redist.x64.targets" Condition="Exists('packages\cef.redist.x64.3.2987.1597\build\cef.redist.x64.targets')" />
|
<Import Project="packages\cef.redist.x86.3.2987.1601\build\cef.redist.x86.targets" Condition="Exists('packages\cef.redist.x86.3.2987.1601\build\cef.redist.x86.targets')" />
|
||||||
<Import Project="packages\CefSharp.Common.57.0.0-pre01\build\CefSharp.Common.targets" Condition="Exists('packages\CefSharp.Common.57.0.0-pre01\build\CefSharp.Common.targets')" />
|
<Import Project="packages\CefSharp.Common.57.0.0\build\CefSharp.Common.targets" Condition="Exists('packages\CefSharp.Common.57.0.0\build\CefSharp.Common.targets')" />
|
||||||
<Import Project="packages\CefSharp.WinForms.57.0.0-pre01\build\CefSharp.WinForms.targets" Condition="Exists('packages\CefSharp.WinForms.57.0.0-pre01\build\CefSharp.WinForms.targets')" />
|
<Import Project="packages\CefSharp.WinForms.57.0.0\build\CefSharp.WinForms.targets" Condition="Exists('packages\CefSharp.WinForms.57.0.0\build\CefSharp.WinForms.targets')" />
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
Other similar extension points exist, see Microsoft.Common.targets.
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
<Target Name="BeforeBuild">
|
<Target Name="BeforeBuild">
|
||||||
|
@@ -2,9 +2,9 @@ using System;
|
|||||||
|
|
||||||
namespace TweetDck.Updates.Events{
|
namespace TweetDck.Updates.Events{
|
||||||
class UpdateCheckEventArgs : EventArgs{
|
class UpdateCheckEventArgs : EventArgs{
|
||||||
public int EventId { get; private set; }
|
public int EventId { get; }
|
||||||
public bool UpdateAvailable { get; private set; }
|
public bool UpdateAvailable { get; }
|
||||||
public string LatestVersion { get; private set; }
|
public string LatestVersion { get; }
|
||||||
|
|
||||||
public UpdateCheckEventArgs(int eventId, bool updateAvailable, string latestVersion){
|
public UpdateCheckEventArgs(int eventId, bool updateAvailable, string latestVersion){
|
||||||
EventId = eventId;
|
EventId = eventId;
|
||||||
|
@@ -10,11 +10,7 @@ namespace TweetDck.Updates{
|
|||||||
sealed partial class FormUpdateDownload : Form{
|
sealed partial class FormUpdateDownload : Form{
|
||||||
private const double BytesToKB = 1024.0;
|
private const double BytesToKB = 1024.0;
|
||||||
|
|
||||||
public string InstallerPath{
|
public string InstallerPath => Path.Combine(Path.GetTempPath(), updateInfo.FileName);
|
||||||
get{
|
|
||||||
return Path.Combine(Path.GetTempPath(), updateInfo.FileName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum Status{
|
public enum Status{
|
||||||
Waiting, Failed, Cancelled, Manual, Succeeded
|
Waiting, Failed, Cancelled, Manual, Succeeded
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
using System;
|
using CefSharp;
|
||||||
using CefSharp;
|
|
||||||
using CefSharp.WinForms;
|
using CefSharp.WinForms;
|
||||||
|
using System;
|
||||||
using TweetDck.Core;
|
using TweetDck.Core;
|
||||||
using TweetDck.Core.Controls;
|
using TweetDck.Core.Controls;
|
||||||
using TweetDck.Core.Utils;
|
using TweetDck.Core.Utils;
|
||||||
@@ -9,11 +9,7 @@ using TweetDck.Updates.Events;
|
|||||||
|
|
||||||
namespace TweetDck.Updates{
|
namespace TweetDck.Updates{
|
||||||
sealed class UpdateHandler{
|
sealed class UpdateHandler{
|
||||||
private static bool IsSystemSupported{
|
private static bool IsSystemSupported => true; // Environment.OSVersion.Version >= new Version("6.1"); // 6.1 NT version = Windows 7
|
||||||
get{
|
|
||||||
return true; // Environment.OSVersion.Version >= new Version("6.1"); // 6.1 NT version = Windows 7
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private readonly ChromiumWebBrowser browser;
|
private readonly ChromiumWebBrowser browser;
|
||||||
private readonly FormBrowser form;
|
private readonly FormBrowser form;
|
||||||
@@ -61,10 +57,7 @@ namespace TweetDck.Updates{
|
|||||||
|
|
||||||
public void DismissUpdate(string tag){
|
public void DismissUpdate(string tag){
|
||||||
settings.DismissedUpdate = tag;
|
settings.DismissedUpdate = tag;
|
||||||
|
UpdateDismissed?.Invoke(this, new UpdateDismissedEventArgs(tag));
|
||||||
if (UpdateDismissed != null){
|
|
||||||
UpdateDismissed(this, new UpdateDismissedEventArgs(tag));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void TriggerUpdateAcceptedEvent(UpdateAcceptedEventArgs args){
|
private void TriggerUpdateAcceptedEvent(UpdateAcceptedEventArgs args){
|
||||||
@@ -76,10 +69,7 @@ namespace TweetDck.Updates{
|
|||||||
private void TriggerUpdateDismissedEvent(UpdateDismissedEventArgs args){
|
private void TriggerUpdateDismissedEvent(UpdateDismissedEventArgs args){
|
||||||
form.InvokeAsyncSafe(() => {
|
form.InvokeAsyncSafe(() => {
|
||||||
settings.DismissedUpdate = args.VersionTag;
|
settings.DismissedUpdate = args.VersionTag;
|
||||||
|
UpdateDismissed?.Invoke(this, args);
|
||||||
if (UpdateDismissed != null){
|
|
||||||
UpdateDismissed(this, args);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -5,11 +5,7 @@ namespace TweetDck.Updates{
|
|||||||
public readonly string VersionTag;
|
public readonly string VersionTag;
|
||||||
public readonly string DownloadUrl;
|
public readonly string DownloadUrl;
|
||||||
|
|
||||||
public string FileName{
|
public string FileName => BrowserUtils.GetFileNameFromUrl(DownloadUrl) ?? Program.BrandName+".Update.exe";
|
||||||
get{
|
|
||||||
return BrowserUtils.GetFileNameFromUrl(DownloadUrl) ?? Program.BrandName+".Update.exe";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public UpdateInfo(string versionTag, string downloadUrl){
|
public UpdateInfo(string versionTag, string downloadUrl){
|
||||||
this.VersionTag = versionTag;
|
this.VersionTag = versionTag;
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<packages xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
|
<packages>
|
||||||
<package id="cef.redist.x64" version="3.2987.1597" targetFramework="net452" xmlns="" />
|
<package id="cef.redist.x64" version="3.2987.1601" targetFramework="net452" xmlns="" />
|
||||||
<package id="cef.redist.x86" version="3.2987.1597" targetFramework="net452" xmlns="" />
|
<package id="cef.redist.x86" version="3.2987.1601" targetFramework="net452" xmlns="" />
|
||||||
<package id="CefSharp.Common" version="57.0.0-pre01" targetFramework="net452" xmlns="" />
|
<package id="CefSharp.Common" version="57.0.0" targetFramework="net452" xmlns="" />
|
||||||
<package id="CefSharp.WinForms" version="57.0.0-pre01" targetFramework="net452" xmlns="" />
|
<package id="CefSharp.WinForms" version="57.0.0" targetFramework="net452" xmlns="" />
|
||||||
<package id="Microsoft.VC120.CRT.JetBrains" version="12.0.21005.2" targetFramework="net452" xmlns="" />
|
<package id="Microsoft.VC120.CRT.JetBrains" version="12.0.21005.2" targetFramework="net452" xmlns="" />
|
||||||
</packages>
|
</packages>
|
@@ -7,11 +7,7 @@ using TweetDck.Core.Utils;
|
|||||||
namespace UnitTests.Core.Utils{
|
namespace UnitTests.Core.Utils{
|
||||||
[TestClass]
|
[TestClass]
|
||||||
public class TestInjectedHTML{
|
public class TestInjectedHTML{
|
||||||
private static IEnumerable<InjectedHTML.Position> Positions{
|
private static IEnumerable<InjectedHTML.Position> Positions => Enum.GetValues(typeof(InjectedHTML.Position)).Cast<InjectedHTML.Position>();
|
||||||
get{
|
|
||||||
return Enum.GetValues(typeof(InjectedHTML.Position)).Cast<InjectedHTML.Position>();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void TestFailedMatches(){
|
public void TestFailedMatches(){
|
||||||
|
Reference in New Issue
Block a user