mirror of
https://github.com/chylex/TweetDuck.git
synced 2025-09-14 01:32:10 +02:00
Compare commits
29 Commits
Author | SHA1 | Date | |
---|---|---|---|
c741767b11 | |||
4a09358e14 | |||
3f4ea1af08 | |||
35bb196832 | |||
cb5b50dd42 | |||
8652272526 | |||
0f32504fde | |||
4735c21fc0 | |||
ecbcbcaed4 | |||
1677b73ff8 | |||
5929067a3d | |||
d06834617b | |||
9d048efe06 | |||
6a379bc2cd | |||
9f415b11b5 | |||
b9b9193222 | |||
867c2d1632 | |||
5447afc3f5 | |||
b5e58db242 | |||
8ab99619d6 | |||
4c7660ee65 | |||
c1b9bde7b0 | |||
0e8c6c066f | |||
9e44a86be0 | |||
b61479f84f | |||
e3c709b005 | |||
b2b3dba504 | |||
4d05441aa8 | |||
419b3ee850 |
@@ -1,7 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using TweetDck.Core.Utils;
|
using TweetDuck.Core.Utils;
|
||||||
|
|
||||||
namespace TweetDck.Configuration{
|
namespace TweetDuck.Configuration{
|
||||||
static class Arguments{
|
static class Arguments{
|
||||||
// public args
|
// public args
|
||||||
public const string ArgDataFolder = "-datafolder";
|
public const string ArgDataFolder = "-datafolder";
|
||||||
@@ -12,6 +12,7 @@ namespace TweetDck.Configuration{
|
|||||||
// internal args
|
// internal args
|
||||||
public const string ArgRestart = "-restart";
|
public const string ArgRestart = "-restart";
|
||||||
public const string ArgImportCookies = "-importcookies";
|
public const string ArgImportCookies = "-importcookies";
|
||||||
|
public const string ArgUpdated = "-updated";
|
||||||
|
|
||||||
// class data and methods
|
// class data and methods
|
||||||
private static readonly CommandLineArgs Current = CommandLineArgs.FromStringArray('-', Environment.GetCommandLineArgs());
|
private static readonly CommandLineArgs Current = CommandLineArgs.FromStringArray('-', Environment.GetCommandLineArgs());
|
||||||
@@ -28,7 +29,18 @@ namespace TweetDck.Configuration{
|
|||||||
CommandLineArgs args = Current.Clone();
|
CommandLineArgs args = Current.Clone();
|
||||||
args.RemoveFlag(ArgRestart);
|
args.RemoveFlag(ArgRestart);
|
||||||
args.RemoveFlag(ArgImportCookies);
|
args.RemoveFlag(ArgImportCookies);
|
||||||
|
args.RemoveFlag(ArgUpdated);
|
||||||
return args;
|
return args;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static CommandLineArgs GetCurrentForInstaller(){
|
||||||
|
CommandLineArgs args = GetCurrentClean();
|
||||||
|
args.AddFlag(ArgUpdated);
|
||||||
|
return args;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string GetCurrentForInstallerCmd(){
|
||||||
|
return GetCurrentForInstaller().ToString().Replace("\"", "::");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -2,9 +2,9 @@
|
|||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using TweetDck.Core.Utils;
|
using TweetDuck.Core.Utils;
|
||||||
|
|
||||||
namespace TweetDck.Configuration{
|
namespace TweetDuck.Configuration{
|
||||||
sealed class LockManager{
|
sealed class LockManager{
|
||||||
public enum Result{
|
public enum Result{
|
||||||
Success, HasProcess, Fail
|
Success, HasProcess, Fail
|
||||||
|
66
Configuration/SystemConfig.cs
Normal file
66
Configuration/SystemConfig.cs
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
|
namespace TweetDuck.Configuration{
|
||||||
|
sealed class SystemConfig{
|
||||||
|
public static readonly bool IsHardwareAccelerationSupported = File.Exists(Path.Combine(Program.ProgramPath, "libEGL.dll")) &&
|
||||||
|
File.Exists(Path.Combine(Program.ProgramPath, "libGLESv2.dll"));
|
||||||
|
|
||||||
|
public bool HardwareAcceleration{
|
||||||
|
get => hardwareAcceleration && IsHardwareAccelerationSupported;
|
||||||
|
set => hardwareAcceleration = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
private readonly string file;
|
||||||
|
|
||||||
|
private bool hardwareAcceleration;
|
||||||
|
|
||||||
|
private SystemConfig(string file){
|
||||||
|
this.file = file;
|
||||||
|
|
||||||
|
HardwareAcceleration = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void WriteToStream(Stream stream){
|
||||||
|
stream.WriteByte((byte)(HardwareAcceleration ? 1 : 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ReadFromStream(Stream stream){
|
||||||
|
HardwareAcceleration = stream.ReadByte() > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Save(){
|
||||||
|
try{
|
||||||
|
string directory = Path.GetDirectoryName(file);
|
||||||
|
if (directory == null)return false;
|
||||||
|
|
||||||
|
Directory.CreateDirectory(directory);
|
||||||
|
|
||||||
|
using(Stream stream = new FileStream(file, FileMode.Create, FileAccess.Write, FileShare.None)){
|
||||||
|
WriteToStream(stream);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}catch(Exception e){
|
||||||
|
Program.Reporter.HandleException("Configuration Error", "Could not save the system configuration file.", true, e);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static SystemConfig Load(string file){
|
||||||
|
SystemConfig config = new SystemConfig(file);
|
||||||
|
|
||||||
|
try{
|
||||||
|
using(Stream stream = new FileStream(file, FileMode.Open, FileAccess.Read, FileShare.Read)){
|
||||||
|
config.ReadFromStream(stream);
|
||||||
|
}
|
||||||
|
}catch(FileNotFoundException){
|
||||||
|
}catch(DirectoryNotFoundException){
|
||||||
|
}catch(Exception e){
|
||||||
|
Program.Reporter.HandleException("Configuration Error", "Could not open the system configuration file. If you continue, you will lose system specific configuration such as Hardware Acceleration.", true, e);
|
||||||
|
}
|
||||||
|
|
||||||
|
return config;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -3,16 +3,22 @@ using System.Drawing;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Runtime.Serialization;
|
using System.Runtime.Serialization;
|
||||||
using System.Runtime.Serialization.Formatters.Binary;
|
using System.Runtime.Serialization.Formatters.Binary;
|
||||||
using TweetDck.Core;
|
using TweetDuck.Core;
|
||||||
using TweetDck.Core.Controls;
|
using TweetDuck.Core.Controls;
|
||||||
using TweetDck.Core.Notification;
|
using TweetDuck.Core.Notification;
|
||||||
using TweetDck.Core.Utils;
|
using TweetDuck.Core.Utils;
|
||||||
using TweetDck.Plugins;
|
using TweetDuck.Plugins;
|
||||||
|
|
||||||
namespace TweetDck.Configuration{
|
namespace TweetDuck.Configuration{
|
||||||
[Serializable]
|
[Serializable]
|
||||||
sealed class UserConfig{
|
sealed class UserConfig{
|
||||||
private static readonly IFormatter Formatter = new BinaryFormatter();
|
private static readonly IFormatter Formatter = new BinaryFormatter{ Binder = new LegacyBinder() };
|
||||||
|
|
||||||
|
private class LegacyBinder : SerializationBinder{
|
||||||
|
public override Type BindToType(string assemblyName, string typeName){
|
||||||
|
return Type.GetType(string.Format("{0}, {1}", typeName.Replace("TweetDck", "TweetDuck"), assemblyName.Replace("TweetDck", "TweetDuck")));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private const int CurrentFileVersion = 9;
|
private const int CurrentFileVersion = 9;
|
||||||
|
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using TweetDck.Core.Controls;
|
using TweetDuck.Core.Controls;
|
||||||
|
|
||||||
namespace TweetDck.Core.Bridge{
|
namespace TweetDuck.Core.Bridge{
|
||||||
sealed class CallbackBridge{
|
sealed class CallbackBridge{
|
||||||
private readonly Control owner;
|
private readonly Control owner;
|
||||||
private readonly Action safeCallback;
|
private readonly Action safeCallback;
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace TweetDck.Core.Bridge{
|
namespace TweetDuck.Core.Bridge{
|
||||||
static class PropertyBridge{
|
static class PropertyBridge{
|
||||||
[Flags]
|
[Flags]
|
||||||
public enum Properties{
|
public enum Properties{
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using TweetDck.Core.Controls;
|
using TweetDuck.Core.Controls;
|
||||||
using TweetDck.Core.Notification;
|
using TweetDuck.Core.Notification;
|
||||||
using TweetDck.Core.Utils;
|
using TweetDuck.Core.Utils;
|
||||||
|
|
||||||
namespace TweetDck.Core.Bridge{
|
namespace TweetDuck.Core.Bridge{
|
||||||
sealed class TweetDeckBridge{
|
sealed class TweetDeckBridge{
|
||||||
public static string LastRightClickedLink = string.Empty;
|
public static string LastRightClickedLink = string.Empty;
|
||||||
public static string LastHighlightedTweet = string.Empty;
|
public static string LastHighlightedTweet = string.Empty;
|
||||||
@@ -104,6 +104,13 @@ namespace TweetDck.Core.Bridge{
|
|||||||
MessageBox.Show(contents, Program.BrandName+" Browser Message", MessageBoxButtons.OK, icon);
|
MessageBox.Show(contents, Program.BrandName+" Browser Message", MessageBoxButtons.OK, icon);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void CrashDebug(string message){
|
||||||
|
#if DEBUG
|
||||||
|
Log(message);
|
||||||
|
System.Diagnostics.Debugger.Break();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
public void Log(string data){
|
public void Log(string data){
|
||||||
System.Diagnostics.Debug.WriteLine(data);
|
System.Diagnostics.Debug.WriteLine(data);
|
||||||
}
|
}
|
||||||
|
@@ -2,9 +2,9 @@
|
|||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using TweetDck.Core.Utils;
|
using TweetDuck.Core.Utils;
|
||||||
|
|
||||||
namespace TweetDck.Core.Controls{
|
namespace TweetDuck.Core.Controls{
|
||||||
static class ControlExtensions{
|
static class ControlExtensions{
|
||||||
public static readonly Point InvisibleLocation = new Point(-32000, -32000);
|
public static readonly Point InvisibleLocation = new Point(-32000, -32000);
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace TweetDck.Core.Controls{
|
namespace TweetDuck.Core.Controls{
|
||||||
class FlatButton : Button{
|
class FlatButton : Button{
|
||||||
protected override bool ShowFocusCues => false;
|
protected override bool ShowFocusCues => false;
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace TweetDck.Core.Controls{
|
namespace TweetDuck.Core.Controls{
|
||||||
sealed class FlatProgressBar : ProgressBar{
|
sealed class FlatProgressBar : ProgressBar{
|
||||||
private readonly SolidBrush brush;
|
private readonly SolidBrush brush;
|
||||||
|
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace TweetDck.Core.Controls{
|
namespace TweetDuck.Core.Controls{
|
||||||
sealed class TabButton : FlatButton{
|
sealed class TabButton : FlatButton{
|
||||||
public Action Callback { get; private set; }
|
public Action Callback { get; private set; }
|
||||||
|
|
||||||
|
2
Core/Controls/TabPanel.Designer.cs
generated
2
Core/Controls/TabPanel.Designer.cs
generated
@@ -1,4 +1,4 @@
|
|||||||
namespace TweetDck.Core.Controls {
|
namespace TweetDuck.Core.Controls {
|
||||||
partial class TabPanel {
|
partial class TabPanel {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Required designer variable.
|
/// Required designer variable.
|
||||||
|
@@ -4,7 +4,7 @@ using System.Drawing;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace TweetDck.Core.Controls{
|
namespace TweetDuck.Core.Controls{
|
||||||
sealed partial class TabPanel : UserControl{
|
sealed partial class TabPanel : UserControl{
|
||||||
public Panel Content => panelContent;
|
public Panel Content => panelContent;
|
||||||
public IEnumerable<TabButton> Buttons => panelButtons.Controls.Cast<TabButton>();
|
public IEnumerable<TabButton> Buttons => panelButtons.Controls.Cast<TabButton>();
|
||||||
|
9
Core/FormBrowser.Designer.cs
generated
9
Core/FormBrowser.Designer.cs
generated
@@ -1,4 +1,4 @@
|
|||||||
namespace TweetDck.Core {
|
namespace TweetDuck.Core {
|
||||||
sealed partial class FormBrowser {
|
sealed partial class FormBrowser {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Required designer variable.
|
/// Required designer variable.
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void InitializeComponent() {
|
private void InitializeComponent() {
|
||||||
this.components = new System.ComponentModel.Container();
|
this.components = new System.ComponentModel.Container();
|
||||||
this.trayIcon = new TweetDck.Core.TrayIcon(this.components);
|
this.trayIcon = new TweetDuck.Core.TrayIcon(this.components);
|
||||||
this.toolTip = new System.Windows.Forms.ToolTip(this.components);
|
this.toolTip = new System.Windows.Forms.ToolTip(this.components);
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
@@ -32,15 +32,16 @@
|
|||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
this.BackColor = TweetDck.Core.Utils.BrowserUtils.BackgroundColor;
|
this.BackColor = TweetDuck.Core.Utils.BrowserUtils.BackgroundColor;
|
||||||
this.ClientSize = new System.Drawing.Size(324, 386);
|
this.ClientSize = new System.Drawing.Size(324, 386);
|
||||||
this.Icon = Properties.Resources.icon;
|
this.Icon = Properties.Resources.icon;
|
||||||
this.Location = TweetDck.Core.Controls.ControlExtensions.InvisibleLocation;
|
this.Location = TweetDuck.Core.Controls.ControlExtensions.InvisibleLocation;
|
||||||
this.MinimumSize = new System.Drawing.Size(340, 424);
|
this.MinimumSize = new System.Drawing.Size(340, 424);
|
||||||
this.Name = "FormBrowser";
|
this.Name = "FormBrowser";
|
||||||
this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
|
this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
|
||||||
this.Activated += new System.EventHandler(this.FormBrowser_Activated);
|
this.Activated += new System.EventHandler(this.FormBrowser_Activated);
|
||||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FormBrowser_FormClosing);
|
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FormBrowser_FormClosing);
|
||||||
|
this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.FormBrowser_FormClosed);
|
||||||
this.ResizeEnd += new System.EventHandler(this.FormBrowser_ResizeEnd);
|
this.ResizeEnd += new System.EventHandler(this.FormBrowser_ResizeEnd);
|
||||||
this.Resize += new System.EventHandler(this.FormBrowser_Resize);
|
this.Resize += new System.EventHandler(this.FormBrowser_Resize);
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
|
@@ -5,23 +5,23 @@ using System.Diagnostics;
|
|||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using TweetDck.Configuration;
|
using TweetDuck.Configuration;
|
||||||
using TweetDck.Core.Bridge;
|
using TweetDuck.Core.Bridge;
|
||||||
using TweetDck.Core.Controls;
|
using TweetDuck.Core.Controls;
|
||||||
using TweetDck.Core.Handling;
|
using TweetDuck.Core.Handling;
|
||||||
using TweetDck.Core.Notification;
|
using TweetDuck.Core.Notification;
|
||||||
using TweetDck.Core.Notification.Screenshot;
|
using TweetDuck.Core.Notification.Screenshot;
|
||||||
using TweetDck.Core.Notification.Sound;
|
using TweetDuck.Core.Notification.Sound;
|
||||||
using TweetDck.Core.Other;
|
using TweetDuck.Core.Other;
|
||||||
using TweetDck.Core.Utils;
|
using TweetDuck.Core.Utils;
|
||||||
using TweetDck.Plugins;
|
using TweetDuck.Plugins;
|
||||||
using TweetDck.Plugins.Enums;
|
using TweetDuck.Plugins.Enums;
|
||||||
using TweetDck.Plugins.Events;
|
using TweetDuck.Plugins.Events;
|
||||||
using TweetDck.Resources;
|
using TweetDuck.Resources;
|
||||||
using TweetDck.Updates;
|
using TweetDuck.Updates;
|
||||||
using TweetDck.Updates.Events;
|
using TweetDuck.Updates.Events;
|
||||||
|
|
||||||
namespace TweetDck.Core{
|
namespace TweetDuck.Core{
|
||||||
sealed partial class FormBrowser : Form{
|
sealed partial class FormBrowser : Form{
|
||||||
private static UserConfig Config => Program.UserConfig;
|
private static UserConfig Config => Program.UserConfig;
|
||||||
|
|
||||||
@@ -64,7 +64,8 @@ namespace TweetDck.Core{
|
|||||||
this.browser = new ChromiumWebBrowser("https://tweetdeck.twitter.com/"){
|
this.browser = new ChromiumWebBrowser("https://tweetdeck.twitter.com/"){
|
||||||
MenuHandler = new ContextMenuBrowser(this),
|
MenuHandler = new ContextMenuBrowser(this),
|
||||||
JsDialogHandler = new JavaScriptDialogHandler(),
|
JsDialogHandler = new JavaScriptDialogHandler(),
|
||||||
LifeSpanHandler = new LifeSpanHandler()
|
LifeSpanHandler = new LifeSpanHandler(),
|
||||||
|
RequestHandler = new RequestHandlerBrowser()
|
||||||
};
|
};
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
@@ -247,6 +248,12 @@ namespace TweetDck.Core{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void FormBrowser_FormClosed(object sender, FormClosedEventArgs e){
|
||||||
|
if (isLoaded && UpdateInstallerPath == null){
|
||||||
|
updates.CleanupDownload();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void Config_MuteToggled(object sender, EventArgs e){
|
private void Config_MuteToggled(object sender, EventArgs e){
|
||||||
UpdateProperties(PropertyBridge.Properties.MuteNotifications);
|
UpdateProperties(PropertyBridge.Properties.MuteNotifications);
|
||||||
}
|
}
|
||||||
@@ -285,23 +292,13 @@ namespace TweetDck.Core{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Hide();
|
updates.BeginUpdateDownload(this, e.UpdateInfo, update => {
|
||||||
|
if (update.DownloadStatus == UpdateDownloadStatus.Done){
|
||||||
|
UpdateInstallerPath = update.InstallerPath;
|
||||||
|
}
|
||||||
|
|
||||||
FormUpdateDownload downloadForm = new FormUpdateDownload(e.UpdateInfo);
|
|
||||||
downloadForm.MoveToCenter(this);
|
|
||||||
downloadForm.ShowDialog();
|
|
||||||
downloadForm.Dispose();
|
|
||||||
|
|
||||||
if (downloadForm.UpdateStatus == FormUpdateDownload.Status.Succeeded){
|
|
||||||
UpdateInstallerPath = downloadForm.InstallerPath;
|
|
||||||
ForceClose();
|
ForceClose();
|
||||||
}
|
});
|
||||||
else if (downloadForm.UpdateStatus == FormUpdateDownload.Status.Manual){
|
|
||||||
ForceClose();
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
Show();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updates_UpdateDismissed(object sender, UpdateDismissedEventArgs e){
|
private void updates_UpdateDismissed(object sender, UpdateDismissedEventArgs e){
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
using CefSharp;
|
using CefSharp;
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace TweetDck.Core.Handling{
|
namespace TweetDuck.Core.Handling{
|
||||||
class BrowserProcessHandler : IBrowserProcessHandler{
|
class BrowserProcessHandler : IBrowserProcessHandler{
|
||||||
void IBrowserProcessHandler.OnContextInitialized(){
|
void IBrowserProcessHandler.OnContextInitialized(){
|
||||||
using(IRequestContext ctx = Cef.GetGlobalRequestContext()){
|
using(IRequestContext ctx = Cef.GetGlobalRequestContext()){
|
||||||
|
@@ -3,13 +3,14 @@ using System;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using TweetDck.Core.Bridge;
|
using TweetDuck.Core.Bridge;
|
||||||
using TweetDck.Core.Controls;
|
using TweetDuck.Core.Controls;
|
||||||
using TweetDck.Core.Utils;
|
using TweetDuck.Core.Utils;
|
||||||
|
|
||||||
namespace TweetDck.Core.Handling{
|
namespace TweetDuck.Core.Handling{
|
||||||
abstract class ContextMenuBase : IContextMenuHandler{
|
abstract class ContextMenuBase : IContextMenuHandler{
|
||||||
private static readonly Regex RegexTwitterAccount = new Regex(@"^https?://twitter\.com/([^/]+)/?$", RegexOptions.Compiled);
|
private static readonly Lazy<Regex> RegexTwitterAccount = new Lazy<Regex>(() => new Regex(@"^https?://twitter\.com/([^/]+)/?$", RegexOptions.Compiled), false);
|
||||||
|
protected static readonly bool HasDevTools = File.Exists(Path.Combine(Program.ProgramPath, "devtools_resources.pak"));
|
||||||
|
|
||||||
private const int MenuOpenLinkUrl = 26500;
|
private const int MenuOpenLinkUrl = 26500;
|
||||||
private const int MenuCopyLinkUrl = 26501;
|
private const int MenuCopyLinkUrl = 26501;
|
||||||
@@ -17,15 +18,8 @@ namespace TweetDck.Core.Handling{
|
|||||||
private const int MenuOpenImage = 26503;
|
private const int MenuOpenImage = 26503;
|
||||||
private const int MenuSaveImage = 26504;
|
private const int MenuSaveImage = 26504;
|
||||||
private const int MenuCopyImageUrl = 26505;
|
private const int MenuCopyImageUrl = 26505;
|
||||||
|
|
||||||
#if DEBUG
|
|
||||||
private const int MenuOpenDevTools = 26599;
|
private const int MenuOpenDevTools = 26599;
|
||||||
|
|
||||||
protected void AddDebugMenuItems(IMenuModel model){
|
|
||||||
model.AddItem((CefMenuCommand)MenuOpenDevTools, "Open dev tools");
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
private readonly Form form;
|
private readonly Form form;
|
||||||
|
|
||||||
protected ContextMenuBase(Form form){
|
protected ContextMenuBase(Form form){
|
||||||
@@ -34,7 +28,7 @@ namespace TweetDck.Core.Handling{
|
|||||||
|
|
||||||
public virtual void OnBeforeContextMenu(IWebBrowser browserControl, IBrowser browser, IFrame frame, IContextMenuParams parameters, IMenuModel model){
|
public virtual void OnBeforeContextMenu(IWebBrowser browserControl, IBrowser browser, IFrame frame, IContextMenuParams parameters, IMenuModel model){
|
||||||
if (parameters.TypeFlags.HasFlag(ContextMenuType.Link) && !parameters.UnfilteredLinkUrl.EndsWith("tweetdeck.twitter.com/#", StringComparison.Ordinal)){
|
if (parameters.TypeFlags.HasFlag(ContextMenuType.Link) && !parameters.UnfilteredLinkUrl.EndsWith("tweetdeck.twitter.com/#", StringComparison.Ordinal)){
|
||||||
if (RegexTwitterAccount.IsMatch(parameters.UnfilteredLinkUrl)){
|
if (RegexTwitterAccount.Value.IsMatch(parameters.UnfilteredLinkUrl)){
|
||||||
model.AddItem((CefMenuCommand)MenuOpenLinkUrl, "Open account in browser");
|
model.AddItem((CefMenuCommand)MenuOpenLinkUrl, "Open account in browser");
|
||||||
model.AddItem((CefMenuCommand)MenuCopyLinkUrl, "Copy account address");
|
model.AddItem((CefMenuCommand)MenuCopyLinkUrl, "Copy account address");
|
||||||
model.AddItem((CefMenuCommand)MenuCopyUsername, "Copy account username");
|
model.AddItem((CefMenuCommand)MenuCopyUsername, "Copy account username");
|
||||||
@@ -85,7 +79,7 @@ namespace TweetDck.Core.Handling{
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (saveTarget != null){
|
if (saveTarget != null){
|
||||||
BrowserUtils.DownloadFileAsync(parameters.SourceUrl, saveTarget, ex => {
|
BrowserUtils.DownloadFileAsync(parameters.SourceUrl, saveTarget, null, ex => {
|
||||||
MessageBox.Show("An error occurred while downloading the image: "+ex.Message, Program.BrandName+" Has Failed :(", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
MessageBox.Show("An error occurred while downloading the image: "+ex.Message, Program.BrandName+" Has Failed :(", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -97,15 +91,13 @@ namespace TweetDck.Core.Handling{
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case MenuCopyUsername:
|
case MenuCopyUsername:
|
||||||
Match match = RegexTwitterAccount.Match(parameters.UnfilteredLinkUrl);
|
Match match = RegexTwitterAccount.Value.Match(parameters.UnfilteredLinkUrl);
|
||||||
SetClipboardText(match.Success ? match.Groups[1].Value : parameters.UnfilteredLinkUrl);
|
SetClipboardText(match.Success ? match.Groups[1].Value : parameters.UnfilteredLinkUrl);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#if DEBUG
|
|
||||||
case MenuOpenDevTools:
|
case MenuOpenDevTools:
|
||||||
browserControl.ShowDevTools();
|
browserControl.ShowDevTools();
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@@ -121,6 +113,10 @@ namespace TweetDck.Core.Handling{
|
|||||||
form.InvokeAsyncSafe(() => WindowsUtils.SetClipboard(text, TextDataFormat.UnicodeText));
|
form.InvokeAsyncSafe(() => WindowsUtils.SetClipboard(text, TextDataFormat.UnicodeText));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void AddDebugMenuItems(IMenuModel model){
|
||||||
|
model.AddItem((CefMenuCommand)MenuOpenDevTools, "Open dev tools");
|
||||||
|
}
|
||||||
|
|
||||||
protected static void RemoveSeparatorIfLast(IMenuModel model){
|
protected static void RemoveSeparatorIfLast(IMenuModel model){
|
||||||
if (model.Count > 0 && model.GetTypeAt(model.Count-1) == MenuItemType.Separator){
|
if (model.Count > 0 && model.GetTypeAt(model.Count-1) == MenuItemType.Separator){
|
||||||
model.RemoveAt(model.Count-1);
|
model.RemoveAt(model.Count-1);
|
||||||
|
@@ -1,10 +1,10 @@
|
|||||||
using CefSharp;
|
using CefSharp;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using TweetDck.Core.Bridge;
|
using TweetDuck.Core.Bridge;
|
||||||
using TweetDck.Core.Controls;
|
using TweetDuck.Core.Controls;
|
||||||
using TweetDck.Core.Utils;
|
using TweetDuck.Core.Utils;
|
||||||
|
|
||||||
namespace TweetDck.Core.Handling{
|
namespace TweetDuck.Core.Handling{
|
||||||
class ContextMenuBrowser : ContextMenuBase{
|
class ContextMenuBrowser : ContextMenuBase{
|
||||||
private const int MenuGlobal = 26600;
|
private const int MenuGlobal = 26600;
|
||||||
private const int MenuMute = 26601;
|
private const int MenuMute = 26601;
|
||||||
@@ -82,10 +82,10 @@ namespace TweetDck.Core.Handling{
|
|||||||
globalMenu.AddItem((CefMenuCommand)MenuPlugins, TitlePlugins);
|
globalMenu.AddItem((CefMenuCommand)MenuPlugins, TitlePlugins);
|
||||||
globalMenu.AddItem((CefMenuCommand)MenuAbout, TitleAboutProgram);
|
globalMenu.AddItem((CefMenuCommand)MenuAbout, TitleAboutProgram);
|
||||||
|
|
||||||
#if DEBUG
|
if (HasDevTools){
|
||||||
globalMenu.AddSeparator();
|
globalMenu.AddSeparator();
|
||||||
AddDebugMenuItems(globalMenu);
|
AddDebugMenuItems(globalMenu);
|
||||||
#endif
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RemoveSeparatorIfLast(model);
|
RemoveSeparatorIfLast(model);
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
using CefSharp;
|
using CefSharp;
|
||||||
using TweetDck.Core.Controls;
|
using TweetDuck.Core.Controls;
|
||||||
using TweetDck.Core.Notification;
|
using TweetDuck.Core.Notification;
|
||||||
|
|
||||||
namespace TweetDck.Core.Handling{
|
namespace TweetDuck.Core.Handling{
|
||||||
class ContextMenuNotification : ContextMenuBase{
|
class ContextMenuNotification : ContextMenuBase{
|
||||||
private const int MenuSkipTweet = 26600;
|
private const int MenuSkipTweet = 26600;
|
||||||
private const int MenuFreeze = 26601;
|
private const int MenuFreeze = 26601;
|
||||||
@@ -44,9 +44,9 @@ namespace TweetDck.Core.Handling{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if DEBUG
|
if (HasDevTools){
|
||||||
AddDebugMenuItems(model);
|
AddDebugMenuItems(model);
|
||||||
#endif
|
}
|
||||||
|
|
||||||
RemoveSeparatorIfLast(model);
|
RemoveSeparatorIfLast(model);
|
||||||
|
|
||||||
|
@@ -2,10 +2,10 @@
|
|||||||
using CefSharp.WinForms;
|
using CefSharp.WinForms;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using TweetDck.Core.Controls;
|
using TweetDuck.Core.Controls;
|
||||||
using TweetDck.Core.Other;
|
using TweetDuck.Core.Other;
|
||||||
|
|
||||||
namespace TweetDck.Core.Handling {
|
namespace TweetDuck.Core.Handling {
|
||||||
class JavaScriptDialogHandler : IJsDialogHandler{
|
class JavaScriptDialogHandler : IJsDialogHandler{
|
||||||
bool IJsDialogHandler.OnJSDialog(IWebBrowser browserControl, IBrowser browser, string originUrl, CefJsDialogType dialogType, string messageText, string defaultPromptText, IJsDialogCallback callback, ref bool suppressMessage){
|
bool IJsDialogHandler.OnJSDialog(IWebBrowser browserControl, IBrowser browser, string originUrl, CefJsDialogType dialogType, string messageText, string defaultPromptText, IJsDialogCallback callback, ref bool suppressMessage){
|
||||||
((ChromiumWebBrowser)browserControl).InvokeSafe(() => {
|
((ChromiumWebBrowser)browserControl).InvokeSafe(() => {
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
using CefSharp;
|
using CefSharp;
|
||||||
using TweetDck.Core.Utils;
|
using TweetDuck.Core.Utils;
|
||||||
|
|
||||||
namespace TweetDck.Core.Handling{
|
namespace TweetDuck.Core.Handling{
|
||||||
class LifeSpanHandler : ILifeSpanHandler{
|
class LifeSpanHandler : ILifeSpanHandler{
|
||||||
public bool OnBeforePopup(IWebBrowser browserControl, IBrowser browser, IFrame frame, string targetUrl, string targetFrameName, WindowOpenDisposition targetDisposition, bool userGesture, IPopupFeatures popupFeatures, IWindowInfo windowInfo, IBrowserSettings browserSettings, ref bool noJavascriptAccess, out IWebBrowser newBrowser){
|
public bool OnBeforePopup(IWebBrowser browserControl, IBrowser browser, IFrame frame, string targetUrl, string targetFrameName, WindowOpenDisposition targetDisposition, bool userGesture, IPopupFeatures popupFeatures, IWindowInfo windowInfo, IBrowserSettings browserSettings, ref bool noJavascriptAccess, out IWebBrowser newBrowser){
|
||||||
newBrowser = null;
|
newBrowser = null;
|
||||||
|
68
Core/Handling/RequestHandler.cs
Normal file
68
Core/Handling/RequestHandler.cs
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
using System.Security.Cryptography.X509Certificates;
|
||||||
|
using CefSharp;
|
||||||
|
|
||||||
|
namespace TweetDuck.Core.Handling{
|
||||||
|
abstract class RequestHandler : IRequestHandler{
|
||||||
|
// Browser
|
||||||
|
|
||||||
|
public virtual void OnRenderViewReady(IWebBrowser browserControl, IBrowser browser){}
|
||||||
|
|
||||||
|
public virtual void OnRenderProcessTerminated(IWebBrowser browserControl, IBrowser browser, CefTerminationStatus status){}
|
||||||
|
|
||||||
|
public virtual bool OnBeforeBrowse(IWebBrowser browserControl, IBrowser browser, IFrame frame, IRequest request, bool isRedirect){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual bool OnOpenUrlFromTab(IWebBrowser browserControl, IBrowser browser, IFrame frame, string targetUrl, WindowOpenDisposition targetDisposition, bool userGesture){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual bool OnProtocolExecution(IWebBrowser browserControl, IBrowser browser, string url){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Resources
|
||||||
|
|
||||||
|
public virtual CefReturnValue OnBeforeResourceLoad(IWebBrowser browserControl, IBrowser browser, IFrame frame, IRequest request, IRequestCallback callback){
|
||||||
|
return CefReturnValue.Continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual void OnResourceRedirect(IWebBrowser browserControl, IBrowser browser, IFrame frame, IRequest request, IResponse response, ref string newUrl){}
|
||||||
|
|
||||||
|
public virtual bool OnResourceResponse(IWebBrowser browserControl, IBrowser browser, IFrame frame, IRequest request, IResponse response){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual IResponseFilter GetResourceResponseFilter(IWebBrowser browserControl, IBrowser browser, IFrame frame, IRequest request, IResponse response){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual void OnResourceLoadComplete(IWebBrowser browserControl, IBrowser browser, IFrame frame, IRequest request, IResponse response, UrlRequestStatus status, long receivedContentLength){}
|
||||||
|
|
||||||
|
// JavaScript & Plugins
|
||||||
|
|
||||||
|
public virtual bool OnQuotaRequest(IWebBrowser browserControl, IBrowser browser, string originUrl, long newSize, IRequestCallback callback){
|
||||||
|
callback.Dispose();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual void OnPluginCrashed(IWebBrowser browserControl, IBrowser browser, string pluginPath){}
|
||||||
|
|
||||||
|
// Auth
|
||||||
|
|
||||||
|
public virtual bool GetAuthCredentials(IWebBrowser browserControl, IBrowser browser, IFrame frame, bool isProxy, string host, int port, string realm, string scheme, IAuthCallback callback){
|
||||||
|
callback.Dispose();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual bool OnSelectClientCertificate(IWebBrowser browserControl, IBrowser browser, bool isProxy, string host, int port, X509Certificate2Collection certificates, ISelectClientCertificateCallback callback){
|
||||||
|
callback.Dispose();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual bool OnCertificateError(IWebBrowser browserControl, IBrowser browser, CefErrorCode errorCode, string requestUrl, ISslInfo sslInfo, IRequestCallback callback){
|
||||||
|
callback.Dispose();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
9
Core/Handling/RequestHandlerBrowser.cs
Normal file
9
Core/Handling/RequestHandlerBrowser.cs
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
using CefSharp;
|
||||||
|
|
||||||
|
namespace TweetDuck.Core.Handling{
|
||||||
|
class RequestHandlerBrowser : RequestHandler{
|
||||||
|
public override void OnRenderProcessTerminated(IWebBrowser browserControl, IBrowser browser, CefTerminationStatus status){
|
||||||
|
browser.Reload();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -3,7 +3,7 @@ using System.Collections.Specialized;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace TweetDck.Core.Handling{
|
namespace TweetDuck.Core.Handling{
|
||||||
class ResourceHandlerNotification : IResourceHandler{
|
class ResourceHandlerNotification : IResourceHandler{
|
||||||
private readonly NameValueCollection headers = new NameValueCollection(0);
|
private readonly NameValueCollection headers = new NameValueCollection(0);
|
||||||
private MemoryStream dataIn;
|
private MemoryStream dataIn;
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
namespace TweetDck.Core.Notification {
|
namespace TweetDuck.Core.Notification {
|
||||||
partial class FormNotificationBase {
|
partial class FormNotificationBase {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Required designer variable.
|
/// Required designer variable.
|
||||||
@@ -34,7 +34,7 @@
|
|||||||
this.BackColor = System.Drawing.SystemColors.Control;
|
this.BackColor = System.Drawing.SystemColors.Control;
|
||||||
this.ClientSize = new System.Drawing.Size(284, 122);
|
this.ClientSize = new System.Drawing.Size(284, 122);
|
||||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
|
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
|
||||||
this.Location = TweetDck.Core.Controls.ControlExtensions.InvisibleLocation;
|
this.Location = TweetDuck.Core.Controls.ControlExtensions.InvisibleLocation;
|
||||||
this.MaximizeBox = false;
|
this.MaximizeBox = false;
|
||||||
this.MinimizeBox = false;
|
this.MinimizeBox = false;
|
||||||
this.Name = "FormNotification";
|
this.Name = "FormNotification";
|
||||||
|
@@ -3,12 +3,12 @@ using CefSharp.WinForms;
|
|||||||
using System;
|
using System;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using TweetDck.Configuration;
|
using TweetDuck.Configuration;
|
||||||
using TweetDck.Core.Controls;
|
using TweetDuck.Core.Controls;
|
||||||
using TweetDck.Core.Handling;
|
using TweetDuck.Core.Handling;
|
||||||
using TweetDck.Core.Utils;
|
using TweetDuck.Core.Utils;
|
||||||
|
|
||||||
namespace TweetDck.Core.Notification{
|
namespace TweetDuck.Core.Notification{
|
||||||
partial class FormNotificationBase : Form{
|
partial class FormNotificationBase : Form{
|
||||||
protected Point PrimaryLocation{
|
protected Point PrimaryLocation{
|
||||||
get{
|
get{
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
namespace TweetDck.Core.Notification {
|
namespace TweetDuck.Core.Notification {
|
||||||
partial class FormNotificationMain {
|
partial class FormNotificationMain {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Required designer variable.
|
/// Required designer variable.
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
this.components = new System.ComponentModel.Container();
|
this.components = new System.ComponentModel.Container();
|
||||||
this.timerDisplayDelay = new System.Windows.Forms.Timer(this.components);
|
this.timerDisplayDelay = new System.Windows.Forms.Timer(this.components);
|
||||||
this.timerProgress = new System.Windows.Forms.Timer(this.components);
|
this.timerProgress = new System.Windows.Forms.Timer(this.components);
|
||||||
this.progressBarTimer = new TweetDck.Core.Controls.FlatProgressBar();
|
this.progressBarTimer = new TweetDuck.Core.Controls.FlatProgressBar();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
// timerDisplayDelay
|
// timerDisplayDelay
|
||||||
|
@@ -2,14 +2,14 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using TweetDck.Core.Bridge;
|
using TweetDuck.Core.Bridge;
|
||||||
using TweetDck.Core.Controls;
|
using TweetDuck.Core.Controls;
|
||||||
using TweetDck.Core.Utils;
|
using TweetDuck.Core.Utils;
|
||||||
using TweetDck.Plugins;
|
using TweetDuck.Plugins;
|
||||||
using TweetDck.Plugins.Enums;
|
using TweetDuck.Plugins.Enums;
|
||||||
using TweetDck.Resources;
|
using TweetDuck.Resources;
|
||||||
|
|
||||||
namespace TweetDck.Core.Notification{
|
namespace TweetDuck.Core.Notification{
|
||||||
partial class FormNotificationMain : FormNotificationBase{
|
partial class FormNotificationMain : FormNotificationBase{
|
||||||
private const string NotificationScriptFile = "notification.js";
|
private const string NotificationScriptFile = "notification.js";
|
||||||
|
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
namespace TweetDck.Core.Notification {
|
namespace TweetDuck.Core.Notification {
|
||||||
partial class FormNotificationTweet {
|
partial class FormNotificationTweet {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Required designer variable.
|
/// Required designer variable.
|
||||||
|
@@ -1,11 +1,11 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using TweetDck.Plugins;
|
using TweetDuck.Plugins;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using TweetDck.Core.Utils;
|
using TweetDuck.Core.Utils;
|
||||||
|
|
||||||
namespace TweetDck.Core.Notification{
|
namespace TweetDuck.Core.Notification{
|
||||||
sealed partial class FormNotificationTweet : FormNotificationMain{
|
sealed partial class FormNotificationTweet : FormNotificationMain{
|
||||||
private const int NonIntrusiveIdleLimit = 30;
|
private const int NonIntrusiveIdleLimit = 30;
|
||||||
private const int TrimMinimum = 32;
|
private const int TrimMinimum = 32;
|
||||||
|
@@ -2,11 +2,11 @@
|
|||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Drawing.Imaging;
|
using System.Drawing.Imaging;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using TweetDck.Core.Bridge;
|
using TweetDuck.Core.Bridge;
|
||||||
using TweetDck.Core.Utils;
|
using TweetDuck.Core.Utils;
|
||||||
using TweetDck.Resources;
|
using TweetDuck.Resources;
|
||||||
|
|
||||||
namespace TweetDck.Core.Notification.Screenshot{
|
namespace TweetDuck.Core.Notification.Screenshot{
|
||||||
sealed class FormNotificationScreenshotable : FormNotificationBase{
|
sealed class FormNotificationScreenshotable : FormNotificationBase{
|
||||||
public FormNotificationScreenshotable(Action callback, Form owner) : base(owner, false){
|
public FormNotificationScreenshotable(Action callback, Form owner) : base(owner, false){
|
||||||
browser.RegisterAsyncJsObject("$TD_NotificationScreenshot", new CallbackBridge(this, callback));
|
browser.RegisterAsyncJsObject("$TD_NotificationScreenshot", new CallbackBridge(this, callback));
|
||||||
|
@@ -3,9 +3,9 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using TweetDck.Core.Controls;
|
using TweetDuck.Core.Controls;
|
||||||
|
|
||||||
namespace TweetDck.Core.Notification.Screenshot{
|
namespace TweetDuck.Core.Notification.Screenshot{
|
||||||
sealed class TweetScreenshotManager : IDisposable{
|
sealed class TweetScreenshotManager : IDisposable{
|
||||||
private readonly Form owner;
|
private readonly Form owner;
|
||||||
private readonly Timer timeout;
|
private readonly Timer timeout;
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace TweetDck.Core.Notification.Sound{
|
namespace TweetDuck.Core.Notification.Sound{
|
||||||
interface ISoundNotificationPlayer : IDisposable{
|
interface ISoundNotificationPlayer : IDisposable{
|
||||||
string SupportedFormats { get; }
|
string SupportedFormats { get; }
|
||||||
|
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace TweetDck.Core.Notification.Sound{
|
namespace TweetDuck.Core.Notification.Sound{
|
||||||
sealed class PlaybackErrorEventArgs : EventArgs{
|
sealed class PlaybackErrorEventArgs : EventArgs{
|
||||||
public string Message { get; }
|
public string Message { get; }
|
||||||
public bool Ignore { get; set; }
|
public bool Ignore { get; set; }
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Media;
|
using System.Media;
|
||||||
|
|
||||||
namespace TweetDck.Core.Notification.Sound{
|
namespace TweetDuck.Core.Notification.Sound{
|
||||||
sealed class SoundPlayerImplFallback : ISoundNotificationPlayer{
|
sealed class SoundPlayerImplFallback : ISoundNotificationPlayer{
|
||||||
string ISoundNotificationPlayer.SupportedFormats => "*.wav";
|
string ISoundNotificationPlayer.SupportedFormats => "*.wav";
|
||||||
|
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using TweetDck.Core.Utils;
|
using TweetDuck.Core.Utils;
|
||||||
using WMPLib;
|
using WMPLib;
|
||||||
|
|
||||||
namespace TweetDck.Core.Notification.Sound{
|
namespace TweetDuck.Core.Notification.Sound{
|
||||||
sealed class SoundPlayerImplWMP : ISoundNotificationPlayer{
|
sealed class SoundPlayerImplWMP : ISoundNotificationPlayer{
|
||||||
string ISoundNotificationPlayer.SupportedFormats => "*.wav;*.mp3;*.mp2;*.m4a;*.mid;*.midi;*.rmi;*.wma;*.aif;*.aifc;*.aiff;*.snd;*.au";
|
string ISoundNotificationPlayer.SupportedFormats => "*.wav;*.mp3;*.mp2;*.m4a;*.mid;*.midi;*.rmi;*.wma;*.aif;*.aifc;*.aiff;*.snd;*.au";
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using TweetDck.Core.Notification.Sound;
|
using TweetDuck.Core.Notification.Sound;
|
||||||
|
|
||||||
namespace TweetDck.Core.Notification{
|
namespace TweetDuck.Core.Notification{
|
||||||
static class SoundNotification{
|
static class SoundNotification{
|
||||||
private static bool? IsWMPAvailable;
|
private static bool? IsWMPAvailable;
|
||||||
|
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using TweetDck.Resources;
|
using TweetDuck.Resources;
|
||||||
|
|
||||||
namespace TweetDck.Core.Notification{
|
namespace TweetDuck.Core.Notification{
|
||||||
sealed class TweetNotification{
|
sealed class TweetNotification{
|
||||||
private static string FontSizeClass { get; set; }
|
private static string FontSizeClass { get; set; }
|
||||||
private static string HeadTag { get; set; }
|
private static string HeadTag { get; set; }
|
||||||
@@ -51,24 +51,22 @@ namespace TweetDck.Core.Notification{
|
|||||||
TopLeft, TopRight, BottomLeft, BottomRight, Custom
|
TopLeft, TopRight, BottomLeft, BottomRight, Custom
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Column => column;
|
public string Column { get; }
|
||||||
public string TweetUrl => tweetUrl;
|
public string TweetUrl { get; }
|
||||||
public string QuoteUrl => quoteUrl;
|
public string QuoteUrl { get; }
|
||||||
|
|
||||||
private readonly string column;
|
|
||||||
private readonly string html;
|
private readonly string html;
|
||||||
private readonly int characters;
|
private readonly int characters;
|
||||||
private readonly string tweetUrl;
|
|
||||||
private readonly string quoteUrl;
|
|
||||||
private readonly bool isExample;
|
private readonly bool isExample;
|
||||||
|
|
||||||
public TweetNotification(string column, string html, int characters, string tweetUrl, string quoteUrl) : this(column, html, characters, tweetUrl, quoteUrl, false){}
|
public TweetNotification(string column, string html, int characters, string tweetUrl, string quoteUrl) : this(column, html, characters, tweetUrl, quoteUrl, false){}
|
||||||
|
|
||||||
private TweetNotification(string column, string html, int characters, string tweetUrl, string quoteUrl, bool isExample){
|
private TweetNotification(string column, string html, int characters, string tweetUrl, string quoteUrl, bool isExample){
|
||||||
this.column = column;
|
this.Column = column;
|
||||||
|
this.TweetUrl = tweetUrl;
|
||||||
|
this.QuoteUrl = quoteUrl;
|
||||||
|
|
||||||
this.html = html;
|
this.html = html;
|
||||||
this.tweetUrl = tweetUrl;
|
|
||||||
this.quoteUrl = quoteUrl;
|
|
||||||
this.characters = characters;
|
this.characters = characters;
|
||||||
this.isExample = isExample;
|
this.isExample = isExample;
|
||||||
}
|
}
|
||||||
|
2
Core/Other/FormAbout.Designer.cs
generated
2
Core/Other/FormAbout.Designer.cs
generated
@@ -1,4 +1,4 @@
|
|||||||
namespace TweetDck.Core.Other {
|
namespace TweetDuck.Core.Other {
|
||||||
sealed partial class FormAbout {
|
sealed partial class FormAbout {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Required designer variable.
|
/// Required designer variable.
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using TweetDck.Core.Utils;
|
using TweetDuck.Core.Utils;
|
||||||
|
|
||||||
namespace TweetDck.Core.Other{
|
namespace TweetDuck.Core.Other{
|
||||||
sealed partial class FormAbout : Form{
|
sealed partial class FormAbout : Form{
|
||||||
private const string TipsLink = "https://github.com/chylex/TweetDuck/wiki";
|
private const string TipsLink = "https://github.com/chylex/TweetDuck/wiki";
|
||||||
private const string IssuesLink = "https://github.com/chylex/TweetDuck/issues";
|
private const string IssuesLink = "https://github.com/chylex/TweetDuck/issues";
|
||||||
|
2
Core/Other/FormMessage.Designer.cs
generated
2
Core/Other/FormMessage.Designer.cs
generated
@@ -1,4 +1,4 @@
|
|||||||
namespace TweetDck.Core.Other {
|
namespace TweetDuck.Core.Other {
|
||||||
partial class FormMessage {
|
partial class FormMessage {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Required designer variable.
|
/// Required designer variable.
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace TweetDck.Core.Other{
|
namespace TweetDuck.Core.Other{
|
||||||
sealed partial class FormMessage : Form{
|
sealed partial class FormMessage : Form{
|
||||||
public Button ClickedButton { get; private set; }
|
public Button ClickedButton { get; private set; }
|
||||||
|
|
||||||
|
8
Core/Other/FormPlugins.Designer.cs
generated
8
Core/Other/FormPlugins.Designer.cs
generated
@@ -1,4 +1,4 @@
|
|||||||
namespace TweetDck.Core.Other {
|
namespace TweetDuck.Core.Other {
|
||||||
partial class FormPlugins {
|
partial class FormPlugins {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Required designer variable.
|
/// Required designer variable.
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
this.btnClose = new System.Windows.Forms.Button();
|
this.btnClose = new System.Windows.Forms.Button();
|
||||||
this.btnReload = new System.Windows.Forms.Button();
|
this.btnReload = new System.Windows.Forms.Button();
|
||||||
this.btnOpenFolder = new System.Windows.Forms.Button();
|
this.btnOpenFolder = new System.Windows.Forms.Button();
|
||||||
this.tabPanelPlugins = new TweetDck.Core.Controls.TabPanel();
|
this.tabPanelPlugins = new TweetDuck.Core.Controls.TabPanel();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
// btnClose
|
// btnClose
|
||||||
@@ -87,7 +87,7 @@
|
|||||||
this.Controls.Add(this.btnOpenFolder);
|
this.Controls.Add(this.btnOpenFolder);
|
||||||
this.Controls.Add(this.btnReload);
|
this.Controls.Add(this.btnReload);
|
||||||
this.Controls.Add(this.btnClose);
|
this.Controls.Add(this.btnClose);
|
||||||
this.Icon = global::TweetDck.Properties.Resources.icon;
|
this.Icon = global::TweetDuck.Properties.Resources.icon;
|
||||||
this.MinimumSize = new System.Drawing.Size(480, 320);
|
this.MinimumSize = new System.Drawing.Size(480, 320);
|
||||||
this.Name = "FormPlugins";
|
this.Name = "FormPlugins";
|
||||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||||
@@ -101,6 +101,6 @@
|
|||||||
private System.Windows.Forms.Button btnClose;
|
private System.Windows.Forms.Button btnClose;
|
||||||
private System.Windows.Forms.Button btnReload;
|
private System.Windows.Forms.Button btnReload;
|
||||||
private System.Windows.Forms.Button btnOpenFolder;
|
private System.Windows.Forms.Button btnOpenFolder;
|
||||||
private TweetDck.Core.Controls.TabPanel tabPanelPlugins;
|
private TweetDuck.Core.Controls.TabPanel tabPanelPlugins;
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -3,13 +3,13 @@ using System.Diagnostics;
|
|||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using TweetDck.Core.Controls;
|
using TweetDuck.Core.Controls;
|
||||||
using TweetDck.Plugins;
|
using TweetDuck.Plugins;
|
||||||
using TweetDck.Plugins.Controls;
|
using TweetDuck.Plugins.Controls;
|
||||||
using TweetDck.Plugins.Enums;
|
using TweetDuck.Plugins.Enums;
|
||||||
using TweetDck.Plugins.Events;
|
using TweetDuck.Plugins.Events;
|
||||||
|
|
||||||
namespace TweetDck.Core.Other{
|
namespace TweetDuck.Core.Other{
|
||||||
sealed partial class FormPlugins : Form{
|
sealed partial class FormPlugins : Form{
|
||||||
private readonly PluginManager pluginManager;
|
private readonly PluginManager pluginManager;
|
||||||
private readonly TabButton tabBtnOfficial, tabBtnCustom;
|
private readonly TabButton tabBtnOfficial, tabBtnCustom;
|
||||||
|
6
Core/Other/FormSettings.Designer.cs
generated
6
Core/Other/FormSettings.Designer.cs
generated
@@ -1,4 +1,4 @@
|
|||||||
namespace TweetDck.Core.Other {
|
namespace TweetDuck.Core.Other {
|
||||||
sealed partial class FormSettings {
|
sealed partial class FormSettings {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Required designer variable.
|
/// Required designer variable.
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
private void InitializeComponent() {
|
private void InitializeComponent() {
|
||||||
this.btnClose = new System.Windows.Forms.Button();
|
this.btnClose = new System.Windows.Forms.Button();
|
||||||
this.labelTip = new System.Windows.Forms.Label();
|
this.labelTip = new System.Windows.Forms.Label();
|
||||||
this.tabPanel = new TweetDck.Core.Controls.TabPanel();
|
this.tabPanel = new TweetDuck.Core.Controls.TabPanel();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
// btnClose
|
// btnClose
|
||||||
@@ -70,7 +70,7 @@
|
|||||||
this.Controls.Add(this.btnClose);
|
this.Controls.Add(this.btnClose);
|
||||||
this.Controls.Add(this.tabPanel);
|
this.Controls.Add(this.tabPanel);
|
||||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
|
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
|
||||||
this.Icon = global::TweetDck.Properties.Resources.icon;
|
this.Icon = global::TweetDuck.Properties.Resources.icon;
|
||||||
this.MaximizeBox = false;
|
this.MaximizeBox = false;
|
||||||
this.MinimizeBox = false;
|
this.MinimizeBox = false;
|
||||||
this.Name = "FormSettings";
|
this.Name = "FormSettings";
|
||||||
|
@@ -2,11 +2,11 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using TweetDck.Core.Other.Settings;
|
using TweetDuck.Core.Other.Settings;
|
||||||
using TweetDck.Plugins;
|
using TweetDuck.Plugins;
|
||||||
using TweetDck.Updates;
|
using TweetDuck.Updates;
|
||||||
|
|
||||||
namespace TweetDck.Core.Other{
|
namespace TweetDuck.Core.Other{
|
||||||
sealed partial class FormSettings : Form{
|
sealed partial class FormSettings : Form{
|
||||||
public const int TabIndexNotification = 1;
|
public const int TabIndexNotification = 1;
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using TweetDck.Configuration;
|
using TweetDuck.Configuration;
|
||||||
|
|
||||||
namespace TweetDck.Core.Other.Settings{
|
namespace TweetDuck.Core.Other.Settings{
|
||||||
class BaseTabSettings : UserControl{
|
class BaseTabSettings : UserControl{
|
||||||
protected static UserConfig Config => Program.UserConfig;
|
protected static UserConfig Config => Program.UserConfig;
|
||||||
|
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
namespace TweetDck.Core.Other.Settings.Dialogs {
|
namespace TweetDuck.Core.Other.Settings.Dialogs {
|
||||||
partial class DialogSettingsCSS {
|
partial class DialogSettingsCSS {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Required designer variable.
|
/// Required designer variable.
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using TweetDck.Core.Controls;
|
using TweetDuck.Core.Controls;
|
||||||
using TweetDck.Core.Utils;
|
using TweetDuck.Core.Utils;
|
||||||
|
|
||||||
namespace TweetDck.Core.Other.Settings.Dialogs{
|
namespace TweetDuck.Core.Other.Settings.Dialogs{
|
||||||
sealed partial class DialogSettingsCSS : Form{
|
sealed partial class DialogSettingsCSS : Form{
|
||||||
public string BrowserCSS => textBoxBrowserCSS.Text;
|
public string BrowserCSS => textBoxBrowserCSS.Text;
|
||||||
public string NotificationCSS => textBoxNotificationCSS.Text;
|
public string NotificationCSS => textBoxNotificationCSS.Text;
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
namespace TweetDck.Core.Other.Settings.Dialogs {
|
namespace TweetDuck.Core.Other.Settings.Dialogs {
|
||||||
partial class DialogSettingsCefArgs {
|
partial class DialogSettingsCefArgs {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Required designer variable.
|
/// Required designer variable.
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using TweetDck.Core.Controls;
|
using TweetDuck.Core.Controls;
|
||||||
using TweetDck.Core.Utils;
|
using TweetDuck.Core.Utils;
|
||||||
|
|
||||||
namespace TweetDck.Core.Other.Settings.Dialogs{
|
namespace TweetDuck.Core.Other.Settings.Dialogs{
|
||||||
sealed partial class DialogSettingsCefArgs : Form{
|
sealed partial class DialogSettingsCefArgs : Form{
|
||||||
public string CefArgs => textBoxArgs.Text;
|
public string CefArgs => textBoxArgs.Text;
|
||||||
|
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
namespace TweetDck.Core.Other.Settings.Dialogs {
|
namespace TweetDuck.Core.Other.Settings.Dialogs {
|
||||||
partial class DialogSettingsExport {
|
partial class DialogSettingsExport {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Required designer variable.
|
/// Required designer variable.
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using TweetDck.Core.Other.Settings.Export;
|
using TweetDuck.Core.Other.Settings.Export;
|
||||||
|
|
||||||
namespace TweetDck.Core.Other.Settings.Dialogs{
|
namespace TweetDuck.Core.Other.Settings.Dialogs{
|
||||||
sealed partial class DialogSettingsExport : Form{
|
sealed partial class DialogSettingsExport : Form{
|
||||||
public static DialogSettingsExport Import(ExportFileFlags flags){
|
public static DialogSettingsExport Import(ExportFileFlags flags){
|
||||||
return new DialogSettingsExport(flags);
|
return new DialogSettingsExport(flags);
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
namespace TweetDck.Core.Other.Settings.Dialogs {
|
namespace TweetDuck.Core.Other.Settings.Dialogs {
|
||||||
partial class DialogSettingsRestart {
|
partial class DialogSettingsRestart {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Required designer variable.
|
/// Required designer variable.
|
||||||
|
@@ -2,10 +2,10 @@
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using TweetDck.Configuration;
|
using TweetDuck.Configuration;
|
||||||
using TweetDck.Core.Utils;
|
using TweetDuck.Core.Utils;
|
||||||
|
|
||||||
namespace TweetDck.Core.Other.Settings.Dialogs{
|
namespace TweetDuck.Core.Other.Settings.Dialogs{
|
||||||
sealed partial class DialogSettingsRestart : Form{
|
sealed partial class DialogSettingsRestart : Form{
|
||||||
private const string DefaultLocale = "en-US";
|
private const string DefaultLocale = "en-US";
|
||||||
|
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace TweetDck.Core.Other.Settings.Export{
|
namespace TweetDuck.Core.Other.Settings.Export{
|
||||||
class CombinedFileStream : IDisposable{
|
class CombinedFileStream : IDisposable{
|
||||||
public const char KeySeparator = '|';
|
public const char KeySeparator = '|';
|
||||||
|
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace TweetDck.Core.Other.Settings.Export{
|
namespace TweetDuck.Core.Other.Settings.Export{
|
||||||
[Flags]
|
[Flags]
|
||||||
enum ExportFileFlags{
|
enum ExportFileFlags{
|
||||||
None = 0,
|
None = 0,
|
||||||
|
@@ -3,11 +3,11 @@ using System.Collections.Generic;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using TweetDck.Configuration;
|
using TweetDuck.Configuration;
|
||||||
using TweetDck.Plugins;
|
using TweetDuck.Plugins;
|
||||||
using TweetDck.Plugins.Enums;
|
using TweetDuck.Plugins.Enums;
|
||||||
|
|
||||||
namespace TweetDck.Core.Other.Settings.Export{
|
namespace TweetDuck.Core.Other.Settings.Export{
|
||||||
sealed class ExportManager{
|
sealed class ExportManager{
|
||||||
private static readonly string CookiesPath = Path.Combine(Program.StoragePath, "Cookies");
|
private static readonly string CookiesPath = Path.Combine(Program.StoragePath, "Cookies");
|
||||||
private static readonly string TempCookiesPath = Path.Combine(Program.StoragePath, "CookiesTmp");
|
private static readonly string TempCookiesPath = Path.Combine(Program.StoragePath, "CookiesTmp");
|
||||||
@@ -27,7 +27,7 @@ namespace TweetDck.Core.Other.Settings.Export{
|
|||||||
try{
|
try{
|
||||||
using(CombinedFileStream stream = new CombinedFileStream(new FileStream(file, FileMode.Create, FileAccess.Write, FileShare.None))){
|
using(CombinedFileStream stream = new CombinedFileStream(new FileStream(file, FileMode.Create, FileAccess.Write, FileShare.None))){
|
||||||
if (flags.HasFlag(ExportFileFlags.Config)){
|
if (flags.HasFlag(ExportFileFlags.Config)){
|
||||||
stream.WriteFile("config", Program.ConfigFilePath);
|
stream.WriteFile("config", Program.UserConfigFilePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags.HasFlag(ExportFileFlags.PluginData)){
|
if (flags.HasFlag(ExportFileFlags.PluginData)){
|
||||||
@@ -101,7 +101,7 @@ namespace TweetDck.Core.Other.Settings.Export{
|
|||||||
switch(entry.KeyName){
|
switch(entry.KeyName){
|
||||||
case "config":
|
case "config":
|
||||||
if (flags.HasFlag(ExportFileFlags.Config)){
|
if (flags.HasFlag(ExportFileFlags.Config)){
|
||||||
entry.WriteToFile(Program.ConfigFilePath);
|
entry.WriteToFile(Program.UserConfigFilePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
namespace TweetDck.Core.Other.Settings {
|
namespace TweetDuck.Core.Other.Settings {
|
||||||
partial class TabSettingsAdvanced {
|
partial class TabSettingsAdvanced {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Required designer variable.
|
/// Required designer variable.
|
||||||
|
@@ -1,14 +1,14 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using TweetDck.Configuration;
|
using TweetDuck.Configuration;
|
||||||
using TweetDck.Core.Controls;
|
using TweetDuck.Core.Controls;
|
||||||
using TweetDck.Core.Other.Settings.Dialogs;
|
using TweetDuck.Core.Other.Settings.Dialogs;
|
||||||
using TweetDck.Core.Other.Settings.Export;
|
using TweetDuck.Core.Other.Settings.Export;
|
||||||
using TweetDck.Core.Utils;
|
using TweetDuck.Core.Utils;
|
||||||
using TweetDck.Plugins;
|
using TweetDuck.Plugins;
|
||||||
|
|
||||||
namespace TweetDck.Core.Other.Settings{
|
namespace TweetDuck.Core.Other.Settings{
|
||||||
partial class TabSettingsAdvanced : BaseTabSettings{
|
partial class TabSettingsAdvanced : BaseTabSettings{
|
||||||
private readonly Action<string> reinjectBrowserCSS;
|
private readonly Action<string> reinjectBrowserCSS;
|
||||||
private readonly PluginManager plugins;
|
private readonly PluginManager plugins;
|
||||||
@@ -19,7 +19,13 @@ namespace TweetDck.Core.Other.Settings{
|
|||||||
this.reinjectBrowserCSS = reinjectBrowserCSS;
|
this.reinjectBrowserCSS = reinjectBrowserCSS;
|
||||||
this.plugins = plugins;
|
this.plugins = plugins;
|
||||||
|
|
||||||
checkHardwareAcceleration.Checked = HardwareAcceleration.IsEnabled;
|
if (SystemConfig.IsHardwareAccelerationSupported){
|
||||||
|
checkHardwareAcceleration.Checked = Program.SystemConfig.HardwareAcceleration;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
checkHardwareAcceleration.Enabled = false;
|
||||||
|
checkHardwareAcceleration.Checked = false;
|
||||||
|
}
|
||||||
|
|
||||||
BrowserCache.CalculateCacheSize(bytes => this.InvokeSafe(() => {
|
BrowserCache.CalculateCacheSize(bytes => this.InvokeSafe(() => {
|
||||||
if (bytes == -1L){
|
if (bytes == -1L){
|
||||||
@@ -56,52 +62,54 @@ namespace TweetDck.Core.Other.Settings{
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void checkHardwareAcceleration_CheckedChanged(object sender, EventArgs e){
|
private void checkHardwareAcceleration_CheckedChanged(object sender, EventArgs e){
|
||||||
bool succeeded = false;
|
Program.SystemConfig.HardwareAcceleration = checkHardwareAcceleration.Checked;
|
||||||
|
Program.SystemConfig.Save();
|
||||||
if (checkHardwareAcceleration.Checked){
|
|
||||||
if (HardwareAcceleration.CanEnable){
|
|
||||||
succeeded = HardwareAcceleration.Enable();
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
MessageBox.Show("Cannot enable hardware acceleration, the libraries libEGL.dll and libGLESv2.dll could not be restored.", Program.BrandName+" Settings", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
succeeded = HardwareAcceleration.Disable();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (succeeded){
|
|
||||||
PromptRestart();
|
PromptRestart();
|
||||||
}
|
}
|
||||||
else{
|
|
||||||
checkHardwareAcceleration.CheckedChanged -= checkHardwareAcceleration_CheckedChanged;
|
|
||||||
checkHardwareAcceleration.Checked = HardwareAcceleration.IsEnabled;
|
|
||||||
checkHardwareAcceleration.CheckedChanged += checkHardwareAcceleration_CheckedChanged;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void btnEditCefArgs_Click(object sender, EventArgs e){
|
private void btnEditCefArgs_Click(object sender, EventArgs e){
|
||||||
DialogSettingsCefArgs form = new DialogSettingsCefArgs();
|
DialogSettingsCefArgs form = new DialogSettingsCefArgs();
|
||||||
|
|
||||||
if (form.ShowDialog(ParentForm) == DialogResult.OK){
|
form.VisibleChanged += (sender2, args2) => {
|
||||||
|
form.MoveToCenter(ParentForm);
|
||||||
|
};
|
||||||
|
|
||||||
|
form.FormClosed += (sender2, args2) => {
|
||||||
|
NativeMethods.SetFormDisabled(ParentForm, false);
|
||||||
|
|
||||||
|
if (form.DialogResult == DialogResult.OK){
|
||||||
Config.CustomCefArgs = form.CefArgs;
|
Config.CustomCefArgs = form.CefArgs;
|
||||||
form.Dispose();
|
form.Dispose();
|
||||||
PromptRestart();
|
PromptRestart();
|
||||||
}
|
}
|
||||||
else{
|
else form.Dispose();
|
||||||
form.Dispose();
|
};
|
||||||
}
|
|
||||||
|
form.Show(ParentForm);
|
||||||
|
NativeMethods.SetFormDisabled(ParentForm, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnEditCSS_Click(object sender, EventArgs e){
|
private void btnEditCSS_Click(object sender, EventArgs e){
|
||||||
using(DialogSettingsCSS form = new DialogSettingsCSS(reinjectBrowserCSS)){
|
DialogSettingsCSS form = new DialogSettingsCSS(reinjectBrowserCSS);
|
||||||
if (form.ShowDialog(ParentForm) == DialogResult.OK){
|
|
||||||
|
form.VisibleChanged += (sender2, args2) => {
|
||||||
|
form.MoveToCenter(ParentForm);
|
||||||
|
};
|
||||||
|
|
||||||
|
form.FormClosed += (sender2, args2) => {
|
||||||
|
NativeMethods.SetFormDisabled(ParentForm, false);
|
||||||
|
|
||||||
|
if (form.DialogResult == DialogResult.OK){
|
||||||
Config.CustomBrowserCSS = form.BrowserCSS;
|
Config.CustomBrowserCSS = form.BrowserCSS;
|
||||||
Config.CustomNotificationCSS = form.NotificationCSS;
|
Config.CustomNotificationCSS = form.NotificationCSS;
|
||||||
}
|
}
|
||||||
|
|
||||||
reinjectBrowserCSS(Config.CustomBrowserCSS); // reinject on cancel too, because the CSS is updated while typing
|
reinjectBrowserCSS(Config.CustomBrowserCSS); // reinject on cancel too, because the CSS is updated while typing
|
||||||
}
|
form.Dispose();
|
||||||
|
};
|
||||||
|
|
||||||
|
form.Show(ParentForm);
|
||||||
|
NativeMethods.SetFormDisabled(ParentForm, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnExport_Click(object sender, EventArgs e){
|
private void btnExport_Click(object sender, EventArgs e){
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
namespace TweetDck.Core.Other.Settings {
|
namespace TweetDuck.Core.Other.Settings {
|
||||||
partial class TabSettingsGeneral {
|
partial class TabSettingsGeneral {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Required designer variable.
|
/// Required designer variable.
|
||||||
|
@@ -1,10 +1,10 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using TweetDck.Core.Controls;
|
using TweetDuck.Core.Controls;
|
||||||
using TweetDck.Updates;
|
using TweetDuck.Updates;
|
||||||
using TweetDck.Updates.Events;
|
using TweetDuck.Updates.Events;
|
||||||
|
|
||||||
namespace TweetDck.Core.Other.Settings{
|
namespace TweetDuck.Core.Other.Settings{
|
||||||
partial class TabSettingsGeneral : BaseTabSettings{
|
partial class TabSettingsGeneral : BaseTabSettings{
|
||||||
private readonly UpdateHandler updates;
|
private readonly UpdateHandler updates;
|
||||||
private int updateCheckEventId = -1;
|
private int updateCheckEventId = -1;
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
namespace TweetDck.Core.Other.Settings {
|
namespace TweetDuck.Core.Other.Settings {
|
||||||
partial class TabSettingsNotifications {
|
partial class TabSettingsNotifications {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Required designer variable.
|
/// Required designer variable.
|
||||||
@@ -37,9 +37,9 @@
|
|||||||
this.trackBarEdgeDistance = new System.Windows.Forms.TrackBar();
|
this.trackBarEdgeDistance = new System.Windows.Forms.TrackBar();
|
||||||
this.groupNotificationDuration = new System.Windows.Forms.GroupBox();
|
this.groupNotificationDuration = new System.Windows.Forms.GroupBox();
|
||||||
this.tableLayoutDurationButtons = new System.Windows.Forms.TableLayoutPanel();
|
this.tableLayoutDurationButtons = new System.Windows.Forms.TableLayoutPanel();
|
||||||
this.btnDurationMedium = new TweetDck.Core.Controls.FlatButton();
|
this.btnDurationMedium = new TweetDuck.Core.Controls.FlatButton();
|
||||||
this.btnDurationLong = new TweetDck.Core.Controls.FlatButton();
|
this.btnDurationLong = new TweetDuck.Core.Controls.FlatButton();
|
||||||
this.btnDurationShort = new TweetDck.Core.Controls.FlatButton();
|
this.btnDurationShort = new TweetDuck.Core.Controls.FlatButton();
|
||||||
this.labelDurationValue = new System.Windows.Forms.Label();
|
this.labelDurationValue = new System.Windows.Forms.Label();
|
||||||
this.trackBarDuration = new System.Windows.Forms.TrackBar();
|
this.trackBarDuration = new System.Windows.Forms.TrackBar();
|
||||||
this.groupUserInterface = new System.Windows.Forms.GroupBox();
|
this.groupUserInterface = new System.Windows.Forms.GroupBox();
|
||||||
@@ -440,9 +440,9 @@
|
|||||||
private System.Windows.Forms.Label labelDurationValue;
|
private System.Windows.Forms.Label labelDurationValue;
|
||||||
private System.Windows.Forms.TrackBar trackBarDuration;
|
private System.Windows.Forms.TrackBar trackBarDuration;
|
||||||
private System.Windows.Forms.TableLayoutPanel tableLayoutDurationButtons;
|
private System.Windows.Forms.TableLayoutPanel tableLayoutDurationButtons;
|
||||||
private TweetDck.Core.Controls.FlatButton btnDurationMedium;
|
private TweetDuck.Core.Controls.FlatButton btnDurationMedium;
|
||||||
private TweetDck.Core.Controls.FlatButton btnDurationLong;
|
private TweetDuck.Core.Controls.FlatButton btnDurationLong;
|
||||||
private TweetDck.Core.Controls.FlatButton btnDurationShort;
|
private TweetDuck.Core.Controls.FlatButton btnDurationShort;
|
||||||
private System.Windows.Forms.CheckBox checkNonIntrusive;
|
private System.Windows.Forms.CheckBox checkNonIntrusive;
|
||||||
private System.Windows.Forms.Label labelIdlePause;
|
private System.Windows.Forms.Label labelIdlePause;
|
||||||
private System.Windows.Forms.ComboBox comboBoxIdlePause;
|
private System.Windows.Forms.ComboBox comboBoxIdlePause;
|
||||||
|
@@ -1,10 +1,10 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using TweetDck.Core.Controls;
|
using TweetDuck.Core.Controls;
|
||||||
using TweetDck.Core.Notification;
|
using TweetDuck.Core.Notification;
|
||||||
|
|
||||||
namespace TweetDck.Core.Other.Settings{
|
namespace TweetDuck.Core.Other.Settings{
|
||||||
partial class TabSettingsNotifications : BaseTabSettings{
|
partial class TabSettingsNotifications : BaseTabSettings{
|
||||||
private static readonly int[] IdlePauseSeconds = { 0, 30, 60, 120, 300 };
|
private static readonly int[] IdlePauseSeconds = { 0, 30, 60, 120, 300 };
|
||||||
|
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
namespace TweetDck.Core.Other.Settings {
|
namespace TweetDuck.Core.Other.Settings {
|
||||||
partial class TabSettingsSounds {
|
partial class TabSettingsSounds {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Required designer variable.
|
/// Required designer variable.
|
||||||
|
@@ -2,10 +2,10 @@
|
|||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using TweetDck.Core.Notification;
|
using TweetDuck.Core.Notification;
|
||||||
using TweetDck.Core.Notification.Sound;
|
using TweetDuck.Core.Notification.Sound;
|
||||||
|
|
||||||
namespace TweetDck.Core.Other.Settings{
|
namespace TweetDuck.Core.Other.Settings{
|
||||||
partial class TabSettingsSounds : BaseTabSettings{
|
partial class TabSettingsSounds : BaseTabSettings{
|
||||||
private readonly ISoundNotificationPlayer soundNotification;
|
private readonly ISoundNotificationPlayer soundNotification;
|
||||||
|
|
||||||
|
2
Core/TrayIcon.Designer.cs
generated
2
Core/TrayIcon.Designer.cs
generated
@@ -1,4 +1,4 @@
|
|||||||
namespace TweetDck.Core {
|
namespace TweetDuck.Core {
|
||||||
partial class TrayIcon {
|
partial class TrayIcon {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Required designer variable.
|
/// Required designer variable.
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace TweetDck.Core{
|
namespace TweetDuck.Core{
|
||||||
partial class TrayIcon : Component{
|
partial class TrayIcon : Component{
|
||||||
public enum Behavior{ // keep order
|
public enum Behavior{ // keep order
|
||||||
Disabled, DisplayOnly, MinimizeToTray, CloseToTray, Combined
|
Disabled, DisplayOnly, MinimizeToTray, CloseToTray, Combined
|
||||||
|
@@ -4,7 +4,7 @@ using System.IO;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
namespace TweetDck.Core.Utils{
|
namespace TweetDuck.Core.Utils{
|
||||||
static class BrowserCache{
|
static class BrowserCache{
|
||||||
private static bool ClearOnExit { get; set; }
|
private static bool ClearOnExit { get; set; }
|
||||||
|
|
||||||
|
@@ -8,7 +8,7 @@ using System.Net;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace TweetDck.Core.Utils{
|
namespace TweetDuck.Core.Utils{
|
||||||
static class BrowserUtils{
|
static class BrowserUtils{
|
||||||
public static string HeaderAcceptLanguage{
|
public static string HeaderAcceptLanguage{
|
||||||
get{
|
get{
|
||||||
@@ -69,17 +69,28 @@ namespace TweetDck.Core.Utils{
|
|||||||
return ConvertPascalCaseToScreamingSnakeCase(Enum.GetName(typeof(CefErrorCode), code) ?? string.Empty);
|
return ConvertPascalCaseToScreamingSnakeCase(Enum.GetName(typeof(CefErrorCode), code) ?? string.Empty);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void DownloadFileAsync(string url, string target, Action<Exception> onFailure){
|
public static WebClient DownloadFileAsync(string url, string target, Action onSuccess, Action<Exception> onFailure){
|
||||||
WebClient client = new WebClient{ Proxy = null };
|
WebClient client = new WebClient{ Proxy = null };
|
||||||
client.Headers[HttpRequestHeader.UserAgent] = HeaderUserAgent;
|
client.Headers[HttpRequestHeader.UserAgent] = HeaderUserAgent;
|
||||||
|
|
||||||
client.DownloadFileCompleted += (sender, args) => {
|
client.DownloadFileCompleted += (sender, args) => {
|
||||||
if (args.Error != null){
|
if (args.Cancelled){
|
||||||
onFailure(args.Error);
|
try{
|
||||||
|
File.Delete(target);
|
||||||
|
}catch{
|
||||||
|
// didn't want it deleted anyways
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (args.Error != null){
|
||||||
|
onFailure?.Invoke(args.Error);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
onSuccess?.Invoke();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
client.DownloadFileAsync(new Uri(url), target);
|
client.DownloadFileAsync(new Uri(url), target);
|
||||||
|
return client;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void SetZoomLevel(IBrowser browser, int percentage){
|
public static void SetZoomLevel(IBrowser browser, int percentage){
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace TweetDck.Core.Utils{
|
namespace TweetDuck.Core.Utils{
|
||||||
class CommandLineArgs{
|
class CommandLineArgs{
|
||||||
public static CommandLineArgs FromStringArray(char entryChar, string[] array){
|
public static CommandLineArgs FromStringArray(char entryChar, string[] array){
|
||||||
CommandLineArgs args = new CommandLineArgs();
|
CommandLineArgs args = new CommandLineArgs();
|
||||||
|
@@ -1,10 +1,9 @@
|
|||||||
using System.Text.RegularExpressions;
|
using System;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
namespace TweetDck.Core.Utils{
|
namespace TweetDuck.Core.Utils{
|
||||||
static class CommandLineArgsParser{
|
static class CommandLineArgsParser{
|
||||||
private static Regex splitRegex;
|
private static readonly Lazy<Regex> SplitRegex = new Lazy<Regex>(() => new Regex(@"([^=\s]+(?:=(?:[^ ]*""[^""]*?""[^ ]*|[^ ]*))?)", RegexOptions.Compiled), false);
|
||||||
|
|
||||||
private static Regex SplitRegex => 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();
|
||||||
@@ -13,7 +12,7 @@ namespace TweetDck.Core.Utils{
|
|||||||
return args;
|
return args;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach(Match match in SplitRegex.Matches(argumentString)){
|
foreach(Match match in SplitRegex.Value.Matches(argumentString)){
|
||||||
string matchValue = match.Value;
|
string matchValue = match.Value;
|
||||||
|
|
||||||
int indexEquals = matchValue.IndexOf('=');
|
int indexEquals = matchValue.IndexOf('=');
|
||||||
|
@@ -1,51 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.IO;
|
|
||||||
|
|
||||||
namespace TweetDck.Core.Utils{
|
|
||||||
static class HardwareAcceleration{
|
|
||||||
private static readonly string LibEGL = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "libEGL.dll");
|
|
||||||
private static readonly string LibGLES = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "libGLESv2.dll");
|
|
||||||
|
|
||||||
private static readonly string DisabledLibEGL = LibEGL+".bak";
|
|
||||||
private static readonly string DisabledLibGLES = LibGLES+".bak";
|
|
||||||
|
|
||||||
public static bool IsEnabled => File.Exists(LibEGL) && File.Exists(LibGLES);
|
|
||||||
public static bool CanEnable => File.Exists(DisabledLibEGL) && File.Exists(DisabledLibGLES);
|
|
||||||
|
|
||||||
public static bool Enable(){
|
|
||||||
if (IsEnabled)return false;
|
|
||||||
|
|
||||||
try{
|
|
||||||
File.Move(DisabledLibEGL, LibEGL);
|
|
||||||
File.Move(DisabledLibGLES, LibGLES);
|
|
||||||
return true;
|
|
||||||
}catch{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static bool Disable(){
|
|
||||||
if (!IsEnabled)return false;
|
|
||||||
|
|
||||||
try{
|
|
||||||
if (File.Exists(DisabledLibEGL)){
|
|
||||||
File.Delete(DisabledLibEGL);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (File.Exists(DisabledLibGLES)){
|
|
||||||
File.Delete(DisabledLibGLES);
|
|
||||||
}
|
|
||||||
}catch{
|
|
||||||
// woops
|
|
||||||
}
|
|
||||||
|
|
||||||
try{
|
|
||||||
File.Move(LibEGL, DisabledLibEGL);
|
|
||||||
File.Move(LibGLES, DisabledLibGLES);
|
|
||||||
return true;
|
|
||||||
}catch{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,6 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace TweetDck.Core.Utils{
|
namespace TweetDuck.Core.Utils{
|
||||||
class InjectedHTML{
|
class InjectedHTML{
|
||||||
public enum Position{
|
public enum Position{
|
||||||
Before, After
|
Before, After
|
||||||
|
@@ -4,7 +4,7 @@ using System.Diagnostics.CodeAnalysis;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
namespace TweetDck.Core.Utils{
|
namespace TweetDuck.Core.Utils{
|
||||||
static class NativeCoreAudio{
|
static class NativeCoreAudio{
|
||||||
private const int EDATAFLOW_RENDER = 0;
|
private const int EDATAFLOW_RENDER = 0;
|
||||||
private const int EROLE_MULTIMEDIA = 1;
|
private const int EROLE_MULTIMEDIA = 1;
|
||||||
|
@@ -4,7 +4,7 @@ using System.Drawing;
|
|||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace TweetDck.Core.Utils{
|
namespace TweetDuck.Core.Utils{
|
||||||
[SuppressMessage("ReSharper", "FieldCanBeMadeReadOnly.Local")]
|
[SuppressMessage("ReSharper", "FieldCanBeMadeReadOnly.Local")]
|
||||||
[SuppressMessage("ReSharper", "MemberCanBePrivate.Local")]
|
[SuppressMessage("ReSharper", "MemberCanBePrivate.Local")]
|
||||||
static class NativeMethods{
|
static class NativeMethods{
|
||||||
@@ -13,6 +13,8 @@ namespace TweetDck.Core.Utils{
|
|||||||
|
|
||||||
public const int HWND_TOPMOST = -1;
|
public const int HWND_TOPMOST = -1;
|
||||||
public const uint SWP_NOACTIVATE = 0x0010;
|
public const uint SWP_NOACTIVATE = 0x0010;
|
||||||
|
public const int WS_DISABLED = 0x08000000;
|
||||||
|
public const int GWL_STYLE = -16;
|
||||||
|
|
||||||
public const int SB_HORZ = 0;
|
public const int SB_HORZ = 0;
|
||||||
public const int BCM_SETSHIELD = 0x160C;
|
public const int BCM_SETSHIELD = 0x160C;
|
||||||
@@ -83,10 +85,25 @@ namespace TweetDck.Core.Utils{
|
|||||||
[DllImport("user32.dll")]
|
[DllImport("user32.dll")]
|
||||||
public static extern IntPtr CallNextHookEx(IntPtr idHook, int nCode, IntPtr wParam, IntPtr lParam);
|
public static extern IntPtr CallNextHookEx(IntPtr idHook, int nCode, IntPtr wParam, IntPtr lParam);
|
||||||
|
|
||||||
|
[DllImport("user32.dll")]
|
||||||
|
private static extern int GetWindowLong(IntPtr hWnd, int nIndex);
|
||||||
|
|
||||||
|
[DllImport("user32.dll")]
|
||||||
|
private static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);
|
||||||
|
|
||||||
public static void SetFormPos(Form form, int hWndOrder, uint flags){
|
public static void SetFormPos(Form form, int hWndOrder, uint flags){
|
||||||
SetWindowPos(form.Handle.ToInt32(), hWndOrder, form.Left, form.Top, form.Width, form.Height, flags);
|
SetWindowPos(form.Handle.ToInt32(), hWndOrder, form.Left, form.Top, form.Width, form.Height, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void SetFormDisabled(Form form, bool disabled){
|
||||||
|
if (disabled){
|
||||||
|
SetWindowLong(form.Handle, GWL_STYLE, GetWindowLong(form.Handle, GWL_STYLE) | WS_DISABLED);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
SetWindowLong(form.Handle, GWL_STYLE, GetWindowLong(form.Handle, GWL_STYLE) & ~WS_DISABLED);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static int GetMouseHookData(IntPtr ptr){
|
public static int GetMouseHookData(IntPtr ptr){
|
||||||
return Marshal.PtrToStructure<MSLLHOOKSTRUCT>(ptr).mouseData >> 16;
|
return Marshal.PtrToStructure<MSLLHOOKSTRUCT>(ptr).mouseData >> 16;
|
||||||
}
|
}
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
namespace TweetDck.Core.Utils{
|
namespace TweetDuck.Core.Utils{
|
||||||
class TwoKeyDictionary<K1, K2, V>{
|
class TwoKeyDictionary<K1, K2, V>{
|
||||||
private readonly Dictionary<K1, Dictionary<K2, V>> dict;
|
private readonly Dictionary<K1, Dictionary<K2, V>> dict;
|
||||||
private readonly int innerCapacity;
|
private readonly int innerCapacity;
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using TweetDck.Core.Controls;
|
using TweetDuck.Core.Controls;
|
||||||
|
|
||||||
namespace TweetDck.Core.Utils{
|
namespace TweetDuck.Core.Utils{
|
||||||
[Serializable]
|
[Serializable]
|
||||||
class WindowState{
|
class WindowState{
|
||||||
private Rectangle rect;
|
private Rectangle rect;
|
||||||
|
@@ -6,8 +6,11 @@ using System.Text.RegularExpressions;
|
|||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace TweetDck.Core.Utils{
|
namespace TweetDuck.Core.Utils{
|
||||||
static class WindowsUtils{
|
static class WindowsUtils{
|
||||||
|
private static readonly Lazy<Regex> RegexStripHtmlStyles = new Lazy<Regex>(() => new Regex(@"\s?(?:style|class)="".*?"""), false);
|
||||||
|
private static readonly Lazy<Regex> RegexOffsetClipboardHtml = new Lazy<Regex>(() => new Regex(@"(?<=EndHTML:|EndFragment:)(\d+)"), false);
|
||||||
|
|
||||||
public static bool ShouldAvoidToolWindow { get; }
|
public static bool ShouldAvoidToolWindow { get; }
|
||||||
|
|
||||||
static WindowsUtils(){
|
static WindowsUtils(){
|
||||||
@@ -54,6 +57,21 @@ namespace TweetDck.Core.Utils{
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void TryDeleteFolderWhenAble(string path, int timeout){
|
||||||
|
new Thread(() => {
|
||||||
|
TrySleepUntil(() => {
|
||||||
|
try{
|
||||||
|
Directory.Delete(path, true);
|
||||||
|
return true;
|
||||||
|
}catch(DirectoryNotFoundException){
|
||||||
|
return true;
|
||||||
|
}catch{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}, timeout, 500);
|
||||||
|
}).Start();
|
||||||
|
}
|
||||||
|
|
||||||
public static void ClipboardStripHtmlStyles(){
|
public static void ClipboardStripHtmlStyles(){
|
||||||
if (!Clipboard.ContainsText(TextDataFormat.Html)){
|
if (!Clipboard.ContainsText(TextDataFormat.Html)){
|
||||||
return;
|
return;
|
||||||
@@ -62,10 +80,10 @@ namespace TweetDck.Core.Utils{
|
|||||||
string originalText = Clipboard.GetText(TextDataFormat.UnicodeText);
|
string originalText = Clipboard.GetText(TextDataFormat.UnicodeText);
|
||||||
string originalHtml = Clipboard.GetText(TextDataFormat.Html);
|
string originalHtml = Clipboard.GetText(TextDataFormat.Html);
|
||||||
|
|
||||||
string updatedHtml = ClipboardRegexes.RegexStripHtmlStyles.Replace(originalHtml, string.Empty);
|
string updatedHtml = RegexStripHtmlStyles.Value.Replace(originalHtml, string.Empty);
|
||||||
|
|
||||||
int removed = originalHtml.Length-updatedHtml.Length;
|
int removed = originalHtml.Length-updatedHtml.Length;
|
||||||
updatedHtml = ClipboardRegexes.RegexOffsetClipboardHtml.Replace(updatedHtml, match => (int.Parse(match.Value)-removed).ToString().PadLeft(match.Value.Length, '0'));
|
updatedHtml = RegexOffsetClipboardHtml.Value.Replace(updatedHtml, match => (int.Parse(match.Value)-removed).ToString().PadLeft(match.Value.Length, '0'));
|
||||||
|
|
||||||
DataObject obj = new DataObject();
|
DataObject obj = new DataObject();
|
||||||
obj.SetText(originalText, TextDataFormat.UnicodeText);
|
obj.SetText(originalText, TextDataFormat.UnicodeText);
|
||||||
@@ -90,10 +108,5 @@ namespace TweetDck.Core.Utils{
|
|||||||
Program.Reporter.HandleException("Clipboard Error", Program.BrandName+" could not access the clipboard as it is currently used by another process.", true, e);
|
Program.Reporter.HandleException("Clipboard Error", Program.BrandName+" could not access the clipboard as it is currently used by another process.", true, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class ClipboardRegexes{ // delays construction of regular expressions until needed
|
|
||||||
public static readonly Regex RegexStripHtmlStyles = new Regex(@"\s?(?:style|class)="".*?""");
|
|
||||||
public static readonly Regex RegexOffsetClipboardHtml = new Regex(@"(?<=EndHTML:|EndFragment:)(\d+)");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
2
Plugins/Controls/PluginControl.Designer.cs
generated
2
Plugins/Controls/PluginControl.Designer.cs
generated
@@ -1,4 +1,4 @@
|
|||||||
namespace TweetDck.Plugins.Controls {
|
namespace TweetDuck.Plugins.Controls {
|
||||||
partial class PluginControl {
|
partial class PluginControl {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Required designer variable.
|
/// Required designer variable.
|
||||||
|
@@ -3,9 +3,9 @@ using System.Diagnostics;
|
|||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using TweetDck.Core.Utils;
|
using TweetDuck.Core.Utils;
|
||||||
|
|
||||||
namespace TweetDck.Plugins.Controls{
|
namespace TweetDuck.Plugins.Controls{
|
||||||
partial class PluginControl : UserControl{
|
partial class PluginControl : UserControl{
|
||||||
private readonly PluginManager pluginManager;
|
private readonly PluginManager pluginManager;
|
||||||
private readonly Plugin plugin;
|
private readonly Plugin plugin;
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using TweetDck.Core.Utils;
|
using TweetDuck.Core.Utils;
|
||||||
|
|
||||||
namespace TweetDck.Plugins.Controls{
|
namespace TweetDuck.Plugins.Controls{
|
||||||
sealed class PluginListFlowLayout : FlowLayoutPanel{
|
sealed class PluginListFlowLayout : FlowLayoutPanel{
|
||||||
public PluginListFlowLayout(){
|
public PluginListFlowLayout(){
|
||||||
FlowDirection = FlowDirection.TopDown;
|
FlowDirection = FlowDirection.TopDown;
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace TweetDck.Plugins.Enums{
|
namespace TweetDuck.Plugins.Enums{
|
||||||
[Flags]
|
[Flags]
|
||||||
enum PluginEnvironment{
|
enum PluginEnvironment{
|
||||||
None = 0,
|
None = 0,
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
namespace TweetDck.Plugins.Enums{
|
namespace TweetDuck.Plugins.Enums{
|
||||||
enum PluginFolder{
|
enum PluginFolder{
|
||||||
Root, Data
|
Root, Data
|
||||||
}
|
}
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
namespace TweetDck.Plugins.Enums{
|
namespace TweetDuck.Plugins.Enums{
|
||||||
enum PluginGroup{
|
enum PluginGroup{
|
||||||
Official, Custom
|
Official, Custom
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace TweetDck.Plugins.Events{
|
namespace TweetDuck.Plugins.Events{
|
||||||
class PluginChangedStateEventArgs : EventArgs{
|
class PluginChangedStateEventArgs : EventArgs{
|
||||||
public Plugin Plugin { get; }
|
public Plugin Plugin { get; }
|
||||||
public bool IsEnabled { get; }
|
public bool IsEnabled { get; }
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace TweetDck.Plugins.Events{
|
namespace TweetDuck.Plugins.Events{
|
||||||
class PluginErrorEventArgs : EventArgs{
|
class PluginErrorEventArgs : EventArgs{
|
||||||
public bool HasErrors => Errors.Count > 0;
|
public bool HasErrors => Errors.Count > 0;
|
||||||
|
|
||||||
|
@@ -3,9 +3,9 @@ using System.Collections.Generic;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using TweetDck.Plugins.Enums;
|
using TweetDuck.Plugins.Enums;
|
||||||
|
|
||||||
namespace TweetDck.Plugins{
|
namespace TweetDuck.Plugins{
|
||||||
class Plugin{
|
class Plugin{
|
||||||
public string Identifier { get; }
|
public string Identifier { get; }
|
||||||
public PluginGroup Group { get; }
|
public PluginGroup Group { get; }
|
||||||
@@ -73,22 +73,6 @@ namespace TweetDck.Plugins{
|
|||||||
if (configPath.Length > 0 && defaultConfigPath.Length > 0 && !File.Exists(configPath) && File.Exists(defaultConfigPath)){
|
if (configPath.Length > 0 && defaultConfigPath.Length > 0 && !File.Exists(configPath) && File.Exists(defaultConfigPath)){
|
||||||
string dataFolder = GetPluginFolder(PluginFolder.Data);
|
string dataFolder = GetPluginFolder(PluginFolder.Data);
|
||||||
|
|
||||||
if (!Directory.Exists(dataFolder)){ // config migration
|
|
||||||
string originalFile = Path.Combine(GetPluginFolder(PluginFolder.Root), ConfigFile);
|
|
||||||
|
|
||||||
if (File.Exists(originalFile)){
|
|
||||||
try{
|
|
||||||
Directory.CreateDirectory(dataFolder);
|
|
||||||
File.Copy(originalFile, configPath, false);
|
|
||||||
File.Delete(originalFile); // will fail without write perms in program folder, ignore if so
|
|
||||||
}catch{
|
|
||||||
// ignore
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
try{
|
try{
|
||||||
Directory.CreateDirectory(dataFolder);
|
Directory.CreateDirectory(dataFolder);
|
||||||
File.Copy(defaultConfigPath, configPath, false);
|
File.Copy(defaultConfigPath, configPath, false);
|
||||||
|
@@ -2,11 +2,11 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using TweetDck.Core.Utils;
|
using TweetDuck.Core.Utils;
|
||||||
using TweetDck.Plugins.Enums;
|
using TweetDuck.Plugins.Enums;
|
||||||
using TweetDck.Plugins.Events;
|
using TweetDuck.Plugins.Events;
|
||||||
|
|
||||||
namespace TweetDck.Plugins{
|
namespace TweetDuck.Plugins{
|
||||||
class PluginBridge{
|
class PluginBridge{
|
||||||
private static string SanitizeCacheKey(string key){
|
private static string SanitizeCacheKey(string key){
|
||||||
return key.Replace('\\', '/').Trim();
|
return key.Replace('\\', '/').Trim();
|
||||||
|
@@ -2,9 +2,9 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using TweetDck.Plugins.Events;
|
using TweetDuck.Plugins.Events;
|
||||||
|
|
||||||
namespace TweetDck.Plugins{
|
namespace TweetDuck.Plugins{
|
||||||
[Serializable]
|
[Serializable]
|
||||||
sealed class PluginConfig{
|
sealed class PluginConfig{
|
||||||
[field:NonSerialized]
|
[field:NonSerialized]
|
||||||
|
@@ -3,11 +3,11 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using TweetDck.Plugins.Enums;
|
using TweetDuck.Plugins.Enums;
|
||||||
using TweetDck.Plugins.Events;
|
using TweetDuck.Plugins.Events;
|
||||||
using TweetDck.Resources;
|
using TweetDuck.Resources;
|
||||||
|
|
||||||
namespace TweetDck.Plugins{
|
namespace TweetDuck.Plugins{
|
||||||
sealed class PluginManager{
|
sealed class PluginManager{
|
||||||
public const string PluginBrowserScriptFile = "plugins.browser.js";
|
public const string PluginBrowserScriptFile = "plugins.browser.js";
|
||||||
public const string PluginNotificationScriptFile = "plugins.notification.js";
|
public const string PluginNotificationScriptFile = "plugins.notification.js";
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using TweetDck.Plugins.Enums;
|
using TweetDuck.Plugins.Enums;
|
||||||
|
|
||||||
namespace TweetDck.Plugins{
|
namespace TweetDuck.Plugins{
|
||||||
static class PluginScriptGenerator{
|
static class PluginScriptGenerator{
|
||||||
public static string GenerateConfig(PluginConfig config){
|
public static string GenerateConfig(PluginConfig config){
|
||||||
return config.AnyDisabled ? "window.TD_PLUGINS.disabled = [\""+string.Join("\",\"", config.DisabledPlugins)+"\"];" : string.Empty;
|
return config.AnyDisabled ? "window.TD_PLUGINS.disabled = [\""+string.Join("\",\"", config.DisabledPlugins)+"\"];" : string.Empty;
|
||||||
|
61
Program.cs
61
Program.cs
@@ -5,23 +5,23 @@ using System.IO;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using TweetDck.Configuration;
|
using TweetDuck.Configuration;
|
||||||
using TweetDck.Core;
|
using TweetDuck.Core;
|
||||||
using TweetDck.Core.Handling;
|
using TweetDuck.Core.Handling;
|
||||||
using TweetDck.Core.Other;
|
using TweetDuck.Core.Other;
|
||||||
using TweetDck.Core.Other.Settings.Export;
|
using TweetDuck.Core.Other.Settings.Export;
|
||||||
using TweetDck.Core.Utils;
|
using TweetDuck.Core.Utils;
|
||||||
using TweetDck.Plugins;
|
using TweetDuck.Plugins;
|
||||||
using TweetDck.Plugins.Events;
|
using TweetDuck.Plugins.Events;
|
||||||
using TweetDck.Updates;
|
using TweetDuck.Updates;
|
||||||
|
|
||||||
namespace TweetDck{
|
namespace TweetDuck{
|
||||||
static class Program{
|
static class Program{
|
||||||
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.5";
|
public const string VersionTag = "1.7.7";
|
||||||
public const string VersionFull = "1.7.5.0";
|
public const string VersionFull = "1.7.7.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,21 +29,26 @@ 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 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 ConsoleLogFilePath = Path.Combine(StoragePath, "TD_Console.txt");
|
|
||||||
|
|
||||||
public static readonly string ScriptPath = Path.Combine(ProgramPath, "scripts");
|
public static readonly string ScriptPath = Path.Combine(ProgramPath, "scripts");
|
||||||
public static readonly string PluginPath = Path.Combine(ProgramPath, "plugins");
|
public static readonly string PluginPath = Path.Combine(ProgramPath, "plugins");
|
||||||
|
|
||||||
|
public static readonly string UserConfigFilePath = Path.Combine(StoragePath, "TD_UserConfig.cfg");
|
||||||
|
public static readonly string SystemConfigFilePath = Path.Combine(StoragePath, "TD_SystemConfig.cfg");
|
||||||
|
public static readonly string PluginConfigFilePath = Path.Combine(StoragePath, "TD_PluginConfig.cfg");
|
||||||
|
|
||||||
|
public static readonly string PluginDataPath = Path.Combine(StoragePath, "TD_Plugins");
|
||||||
|
private static readonly string InstallerPath = Path.Combine(StoragePath, "TD_Updates");
|
||||||
|
|
||||||
|
private static string ErrorLogFilePath => Path.Combine(StoragePath, "TD_Log.txt");
|
||||||
|
private static string ConsoleLogFilePath => Path.Combine(StoragePath, "TD_Console.txt");
|
||||||
|
|
||||||
public static uint WindowRestoreMessage;
|
public static uint WindowRestoreMessage;
|
||||||
|
|
||||||
private static readonly LockManager LockManager = new LockManager(Path.Combine(StoragePath, ".lock"));
|
private static readonly LockManager LockManager = new LockManager(Path.Combine(StoragePath, ".lock"));
|
||||||
private static bool HasCleanedUp;
|
private static bool HasCleanedUp;
|
||||||
|
|
||||||
public static UserConfig UserConfig { get; private set; }
|
public static UserConfig UserConfig { get; private set; }
|
||||||
|
public static SystemConfig SystemConfig { get; private set; }
|
||||||
public static Reporter Reporter { get; private set; }
|
public static Reporter Reporter { get; private set; }
|
||||||
|
|
||||||
public static event EventHandler UserConfigReplaced;
|
public static event EventHandler UserConfigReplaced;
|
||||||
@@ -122,28 +127,33 @@ namespace TweetDck{
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReloadConfig();
|
ReloadConfig();
|
||||||
|
SystemConfig = SystemConfig.Load(SystemConfigFilePath);
|
||||||
|
|
||||||
if (Arguments.HasFlag(Arguments.ArgImportCookies)){
|
if (Arguments.HasFlag(Arguments.ArgImportCookies)){
|
||||||
ExportManager.ImportCookies();
|
ExportManager.ImportCookies();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Arguments.HasFlag(Arguments.ArgUpdated)){
|
||||||
|
WindowsUtils.TryDeleteFolderWhenAble(InstallerPath, 8000);
|
||||||
|
}
|
||||||
|
|
||||||
CefSharpSettings.WcfEnabled = false;
|
CefSharpSettings.WcfEnabled = false;
|
||||||
|
|
||||||
CefSettings settings = new CefSettings{
|
CefSettings settings = new CefSettings{
|
||||||
AcceptLanguageList = BrowserUtils.HeaderAcceptLanguage,
|
AcceptLanguageList = BrowserUtils.HeaderAcceptLanguage,
|
||||||
UserAgent = BrowserUtils.HeaderUserAgent,
|
UserAgent = BrowserUtils.HeaderUserAgent,
|
||||||
Locale = Arguments.GetValue(Arguments.ArgLocale, string.Empty),
|
Locale = Arguments.GetValue(Arguments.ArgLocale, string.Empty),
|
||||||
|
BrowserSubprocessPath = BrandName+".Browser.exe",
|
||||||
CachePath = StoragePath,
|
CachePath = StoragePath,
|
||||||
LogFile = ConsoleLogFilePath,
|
LogFile = ConsoleLogFilePath,
|
||||||
#if !DEBUG
|
#if !DEBUG
|
||||||
BrowserSubprocessPath = BrandName+".Browser.exe",
|
|
||||||
LogSeverity = Arguments.HasFlag(Arguments.ArgLogging) ? LogSeverity.Info : LogSeverity.Disable
|
LogSeverity = Arguments.HasFlag(Arguments.ArgLogging) ? LogSeverity.Info : LogSeverity.Disable
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
CommandLineArgsParser.ReadCefArguments(UserConfig.CustomCefArgs).ToDictionary(settings.CefCommandLineArgs);
|
CommandLineArgsParser.ReadCefArguments(UserConfig.CustomCefArgs).ToDictionary(settings.CefCommandLineArgs);
|
||||||
|
|
||||||
if (!HardwareAcceleration.IsEnabled){
|
if (!SystemConfig.HardwareAcceleration){
|
||||||
settings.CefCommandLineArgs["disable-gpu"] = "1";
|
settings.CefCommandLineArgs["disable-gpu"] = "1";
|
||||||
settings.CefCommandLineArgs["disable-gpu-vsync"] = "1";
|
settings.CefCommandLineArgs["disable-gpu-vsync"] = "1";
|
||||||
}
|
}
|
||||||
@@ -163,7 +173,8 @@ namespace TweetDck{
|
|||||||
|
|
||||||
FormBrowser mainForm = new FormBrowser(plugins, new UpdaterSettings{
|
FormBrowser mainForm = new FormBrowser(plugins, new UpdaterSettings{
|
||||||
AllowPreReleases = Arguments.HasFlag(Arguments.ArgDebugUpdates),
|
AllowPreReleases = Arguments.HasFlag(Arguments.ArgDebugUpdates),
|
||||||
DismissedUpdate = UserConfig.DismissedUpdate
|
DismissedUpdate = UserConfig.DismissedUpdate,
|
||||||
|
InstallerDownloadFolder = InstallerPath
|
||||||
});
|
});
|
||||||
|
|
||||||
Application.Run(mainForm);
|
Application.Run(mainForm);
|
||||||
@@ -172,7 +183,7 @@ namespace TweetDck{
|
|||||||
ExitCleanup();
|
ExitCleanup();
|
||||||
|
|
||||||
// ProgramPath has a trailing backslash
|
// ProgramPath has a trailing backslash
|
||||||
string updaterArgs = "/SP- /SILENT /CLOSEAPPLICATIONS /UPDATEPATH=\""+ProgramPath+"\" /RUNARGS=\""+Arguments.GetCurrentClean().ToString().Replace("\"", "^\"")+"\""+(IsPortable ? " /PORTABLE=1" : "");
|
string updaterArgs = "/SP- /SILENT /CLOSEAPPLICATIONS /UPDATEPATH=\""+ProgramPath+"\" /RUNARGS=\""+Arguments.GetCurrentForInstallerCmd()+"\""+(IsPortable ? " /PORTABLE=1" : "");
|
||||||
bool runElevated = !IsPortable || !WindowsUtils.CheckFolderWritePermission(ProgramPath);
|
bool runElevated = !IsPortable || !WindowsUtils.CheckFolderWritePermission(ProgramPath);
|
||||||
|
|
||||||
WindowsUtils.StartProcess(mainForm.UpdateInstallerPath, updaterArgs, runElevated);
|
WindowsUtils.StartProcess(mainForm.UpdateInstallerPath, updaterArgs, runElevated);
|
||||||
@@ -213,14 +224,14 @@ namespace TweetDck{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void ReloadConfig(){
|
public static void ReloadConfig(){
|
||||||
UserConfig = UserConfig.Load(ConfigFilePath);
|
UserConfig = UserConfig.Load(UserConfigFilePath);
|
||||||
UserConfigReplaced?.Invoke(UserConfig, new EventArgs());
|
UserConfigReplaced?.Invoke(UserConfig, new EventArgs());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void ResetConfig(){
|
public static void ResetConfig(){
|
||||||
try{
|
try{
|
||||||
File.Delete(ConfigFilePath);
|
File.Delete(UserConfigFilePath);
|
||||||
File.Delete(UserConfig.GetBackupFile(ConfigFilePath));
|
File.Delete(UserConfig.GetBackupFile(UserConfigFilePath));
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
Reporter.HandleException("Configuration Reset Error", "Could not delete configuration files to reset the settings.", true, e);
|
Reporter.HandleException("Configuration Reset Error", "Could not delete configuration files to reset the settings.", true, e);
|
||||||
return;
|
return;
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Resources;
|
using System.Resources;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using TweetDck;
|
using TweetDuck;
|
||||||
|
|
||||||
// General Information about an assembly is controlled through the following
|
// General Information about an assembly is controlled through the following
|
||||||
// set of attributes. Change these attribute values to modify the information
|
// set of attributes. Change these attribute values to modify the information
|
||||||
@@ -37,7 +37,7 @@ using TweetDck;
|
|||||||
[assembly: AssemblyVersion(Program.VersionFull)]
|
[assembly: AssemblyVersion(Program.VersionFull)]
|
||||||
[assembly: AssemblyFileVersion(Program.VersionFull)]
|
[assembly: AssemblyFileVersion(Program.VersionFull)]
|
||||||
|
|
||||||
[assembly: NeutralResourcesLanguageAttribute("en")]
|
[assembly: NeutralResourcesLanguage("en")]
|
||||||
|
|
||||||
[assembly: CLSCompliant(false)]
|
[assembly: CLSCompliant(false)]
|
||||||
|
|
||||||
|
5
Properties/Resources.Designer.cs
generated
5
Properties/Resources.Designer.cs
generated
@@ -8,7 +8,8 @@
|
|||||||
// </auto-generated>
|
// </auto-generated>
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
namespace TweetDck.Properties {
|
namespace TweetDuck.Properties {
|
||||||
|
using System;
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -38,7 +39,7 @@ namespace TweetDck.Properties {
|
|||||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||||
get {
|
get {
|
||||||
if (object.ReferenceEquals(resourceMan, null)) {
|
if (object.ReferenceEquals(resourceMan, null)) {
|
||||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("TweetDck.Properties.Resources", typeof(Resources).Assembly);
|
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("TweetDuck.Properties.Resources", typeof(Resources).Assembly);
|
||||||
resourceMan = temp;
|
resourceMan = temp;
|
||||||
}
|
}
|
||||||
return resourceMan;
|
return resourceMan;
|
||||||
|
@@ -5,9 +5,9 @@ using System.Globalization;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using TweetDck.Core.Other;
|
using TweetDuck.Core.Other;
|
||||||
|
|
||||||
namespace TweetDck{
|
namespace TweetDuck{
|
||||||
class Reporter{
|
class Reporter{
|
||||||
private readonly string logFile;
|
private readonly string logFile;
|
||||||
|
|
||||||
|
@@ -3,7 +3,7 @@ Clear columns
|
|||||||
|
|
||||||
[description]
|
[description]
|
||||||
- Adds buttons and keyboard shortcuts to quickly clear columns
|
- Adds buttons and keyboard shortcuts to quickly clear columns
|
||||||
- Hold Shift when clicking or using a keyboard shortcut to reset the column instead
|
- Hold Shift when clicking or using a keyboard shortcut to restore the column instead
|
||||||
|
|
||||||
[author]
|
[author]
|
||||||
chylex
|
chylex
|
||||||
|
@@ -38,7 +38,7 @@ enabled(){
|
|||||||
$(document).off("mousemove", this.eventKeyUp);
|
$(document).off("mousemove", this.eventKeyUp);
|
||||||
}
|
}
|
||||||
|
|
||||||
$("#clear-columns-btn-all").text(pressed ? "Reset all" : "Clear all");
|
$("#clear-columns-btn-all").text(pressed ? "Restore columns" : "Clear columns");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -84,7 +84,7 @@ enabled(){
|
|||||||
replaceMustache("column/column_header.mustache", "</header>", [
|
replaceMustache("column/column_header.mustache", "</header>", [
|
||||||
'{{^isTemporary}}',
|
'{{^isTemporary}}',
|
||||||
'<a class="column-header-link" href="#" data-action="td-clearcolumns-dosingle" style="right:34px">',
|
'<a class="column-header-link" href="#" data-action="td-clearcolumns-dosingle" style="right:34px">',
|
||||||
'<i class="icon icon-clear-timeline"></i>',
|
'<i class="icon icon-clear-timeline js-show-tip" data-placement="bottom" data-original-title="Clear column (hold Shift to restore)"></i>',
|
||||||
'</a>',
|
'</a>',
|
||||||
'{{/isTemporary}}',
|
'{{/isTemporary}}',
|
||||||
'</header>'
|
'</header>'
|
||||||
@@ -94,7 +94,7 @@ enabled(){
|
|||||||
'<dd class="keyboard-shortcut-definition" style="white-space:nowrap">',
|
'<dd class="keyboard-shortcut-definition" style="white-space:nowrap">',
|
||||||
'<span class="text-like-keyboard-key">1</span> … <span class="text-like-keyboard-key">9</span> + <span class="text-like-keyboard-key">Del</span> Clear column 1-9',
|
'<span class="text-like-keyboard-key">1</span> … <span class="text-like-keyboard-key">9</span> + <span class="text-like-keyboard-key">Del</span> Clear column 1-9',
|
||||||
'</dd><dd class="keyboard-shortcut-definition">',
|
'</dd><dd class="keyboard-shortcut-definition">',
|
||||||
'<span class="text-like-keyboard-key">Alt</span> + <span class="text-like-keyboard-key">Del</span> Clear all',
|
'<span class="text-like-keyboard-key">Alt</span> + <span class="text-like-keyboard-key">Del</span> Clear all columns',
|
||||||
'</dd></dl><dl'
|
'</dd></dl><dl'
|
||||||
].join(""));
|
].join(""));
|
||||||
|
|
||||||
@@ -116,11 +116,18 @@ ready(){
|
|||||||
|
|
||||||
// add clear all button
|
// add clear all button
|
||||||
$("nav.app-navigator").first().append([
|
$("nav.app-navigator").first().append([
|
||||||
'<a class="link-clean cf app-nav-link padding-h--10" data-title="Clear all" data-action="td-clearcolumns-doall">',
|
'<a id="clear-columns-btn-all-parent" class="js-header-action link-clean cf app-nav-link padding-h--10" data-title="Clear columns (hold Shift to restore)" data-action="td-clearcolumns-doall">',
|
||||||
'<div class="obj-left margin-l--2"><i class="icon icon-medium icon-clear-timeline"></i></div>',
|
'<div class="obj-left margin-l--2"><i class="icon icon-medium icon-clear-timeline"></i></div>',
|
||||||
'<div id="clear-columns-btn-all" class="nbfc padding-ts hide-condensed txt-size--16">Clear all</div>',
|
'<div id="clear-columns-btn-all" class="nbfc padding-ts hide-condensed txt-size--16">Clear columns</div>',
|
||||||
'</a></nav>'
|
'</a></nav>'
|
||||||
].join(""));
|
].join(""));
|
||||||
|
|
||||||
|
// setup tooltip handling
|
||||||
|
var tooltipEvents = $._data($(".js-header-action")[0]).events;
|
||||||
|
|
||||||
|
if (tooltipEvents.mouseover && tooltipEvents.mouseover.length && tooltipEvents.mouseout && tooltipEvents.mouseout.length){
|
||||||
|
$("#clear-columns-btn-all-parent").on("mouseover", tooltipEvents.mouseover[0].handler).on("mouseout", tooltipEvents.mouseout[0].handler);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
disabled(){
|
disabled(){
|
||||||
|
@@ -5,7 +5,7 @@ using System.IO;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace TweetDck.Resources{
|
namespace TweetDuck.Resources{
|
||||||
static class ScriptLoader{
|
static class ScriptLoader{
|
||||||
private const string UrlPrefix = "td:";
|
private const string UrlPrefix = "td:";
|
||||||
|
|
||||||
|
@@ -62,6 +62,22 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//
|
||||||
|
// Function: Returns true if an object has a specified property, otherwise returns false without throwing an error.
|
||||||
|
//
|
||||||
|
var ensurePropertyExists = function(obj, ...chain){
|
||||||
|
for(var index = 0; index < chain.length; index++){
|
||||||
|
if (!obj.hasOwnProperty(chain[index])){
|
||||||
|
$TD.crashDebug("Missing property "+chain[index]+" in chain [obj]."+chain.join("."));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
obj = obj[chain[index]];
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
// Function: Retrieves a property of an element with a specified class.
|
// Function: Retrieves a property of an element with a specified class.
|
||||||
//
|
//
|
||||||
@@ -188,6 +204,7 @@
|
|||||||
//
|
//
|
||||||
// Block: Enable popup notifications.
|
// Block: Enable popup notifications.
|
||||||
//
|
//
|
||||||
|
if (ensurePropertyExists(TD, "controller", "notifications")){
|
||||||
TD.controller.notifications.hasNotifications = function(){
|
TD.controller.notifications.hasNotifications = function(){
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
@@ -195,6 +212,7 @@
|
|||||||
TD.controller.notifications.isPermissionGranted = function(){
|
TD.controller.notifications.isPermissionGranted = function(){
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
$.subscribe("/notifications/new", function(obj){
|
$.subscribe("/notifications/new", function(obj){
|
||||||
for(let index = obj.items.length-1; index >= 0; index--){
|
for(let index = obj.items.length-1; index >= 0; index--){
|
||||||
@@ -512,7 +530,7 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
//
|
//
|
||||||
// Block: Hold Shift to reset cleared column.
|
// Block: Hold Shift to restore cleared column.
|
||||||
//
|
//
|
||||||
(function(){
|
(function(){
|
||||||
var holdingShift = false;
|
var holdingShift = false;
|
||||||
@@ -520,7 +538,7 @@
|
|||||||
var updateShiftState = (pressed) => {
|
var updateShiftState = (pressed) => {
|
||||||
if (pressed != holdingShift){
|
if (pressed != holdingShift){
|
||||||
holdingShift = pressed;
|
holdingShift = pressed;
|
||||||
$("button[data-action='clear']").children("span").text(holdingShift ? "Reset" : "Clear");
|
$("button[data-action='clear']").children("span").text(holdingShift ? "Restore" : "Clear");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -538,6 +556,10 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (!ensurePropertyExists(TD, "vo", "Column", "prototype", "clear")){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
TD.vo.Column.prototype.clear = prependToFunction(TD.vo.Column.prototype.clear, function(){
|
TD.vo.Column.prototype.clear = prependToFunction(TD.vo.Column.prototype.clear, function(){
|
||||||
window.setTimeout(resetActiveFocus, 0); // unfocuses the Clear button, otherwise it steals keyboard input
|
window.setTimeout(resetActiveFocus, 0); // unfocuses the Clear button, otherwise it steals keyboard input
|
||||||
|
|
||||||
@@ -561,6 +583,10 @@
|
|||||||
|
|
||||||
$(".js-drawer[data-drawer='compose']").delegate(".js-account-list > .js-account-item", "click", toggleEventShiftKey);
|
$(".js-drawer[data-drawer='compose']").delegate(".js-account-list > .js-account-item", "click", toggleEventShiftKey);
|
||||||
|
|
||||||
|
if (!ensurePropertyExists(TD, "components", "AccountSelector", "prototype", "refreshPostingAccounts")){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
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");
|
||||||
@@ -591,17 +617,21 @@
|
|||||||
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(".column .column-header { height: 49px !important; }", 0); // fix one pixel space below column header
|
||||||
|
styleOfficial.sheet.insertRule(".column:not(.is-options-open) .column-header { border-bottom: none; }", 0); // fix one pixel space below column header
|
||||||
|
|
||||||
styleOfficial.sheet.insertRule(".activity-header { align-items: center !important; margin-bottom: 4px; }", 0); // tweak alignment of avatar and text in notifications
|
styleOfficial.sheet.insertRule(".activity-header { align-items: center !important; margin-bottom: 4px; }", 0); // tweak alignment of avatar and text in notifications
|
||||||
styleOfficial.sheet.insertRule(".activity-header .tweet-timestamp { line-height: unset }", 0); // fix timestamp position in notifications
|
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::-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(".app-columns-container { bottom: 0 !important; }", 0); // move column container scrollbar to bottom to fit updated style
|
||||||
|
|
||||||
|
styleOfficial.sheet.insertRule(".js-column-header .column-header-link { padding: 0; }", 0); // fix column header tooltip hover box
|
||||||
|
styleOfficial.sheet.insertRule(".js-column-header .column-header-link .icon { padding: 9px 4px; width: calc(1em + 8px); height: 100%; box-sizing: border-box; }", 0); // fix column header tooltip hover box
|
||||||
|
|
||||||
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
|
||||||
|
|
||||||
TD.services.TwitterActionRetweetedRetweet.prototype.iconClass = "icon-retweet icon-retweet-color txt-base-medium"; // fix retweet icon mismatch
|
|
||||||
|
|
||||||
window.TDGF_reinjectCustomCSS = function(styles){
|
window.TDGF_reinjectCustomCSS = function(styles){
|
||||||
$("#tweetduck-custom-css").remove();
|
$("#tweetduck-custom-css").remove();
|
||||||
|
|
||||||
@@ -617,6 +647,10 @@
|
|||||||
(function(){
|
(function(){
|
||||||
var cancelModal = false;
|
var cancelModal = false;
|
||||||
|
|
||||||
|
if (!ensurePropertyExists(TD, "components", "MediaGallery", "prototype", "_loadTweet") ||
|
||||||
|
!ensurePropertyExists(TD, "components", "BaseModal", "prototype", "setAndShowContainer") ||
|
||||||
|
!ensurePropertyExists(TD, "ui", "Column", "prototype", "playGifIfNotManuallyPaused"))return;
|
||||||
|
|
||||||
TD.components.MediaGallery.prototype._loadTweet = appendToFunction(TD.components.MediaGallery.prototype._loadTweet, function(){
|
TD.components.MediaGallery.prototype._loadTweet = appendToFunction(TD.components.MediaGallery.prototype._loadTweet, function(){
|
||||||
var media = this.chirp.getMedia().find(media => media.mediaId === this.clickedMediaEntityId);
|
var media = this.chirp.getMedia().find(media => media.mediaId === this.clickedMediaEntityId);
|
||||||
|
|
||||||
@@ -648,38 +682,53 @@
|
|||||||
//
|
//
|
||||||
// Block: Fix youtu.be previews not showing up for https links.
|
// Block: Fix youtu.be previews not showing up for https links.
|
||||||
//
|
//
|
||||||
TD.services.TwitterMedia.YOUTUBE_TINY_RE = new RegExp(TD.services.TwitterMedia.YOUTUBE_TINY_RE.source.replace("http:", "https?:"));
|
if (ensurePropertyExists(TD, "services", "TwitterMedia")){
|
||||||
TD.services.TwitterMedia.YOUTUBE_RE = new RegExp(TD.services.TwitterMedia.YOUTUBE_LONG_RE.source+"|"+TD.services.TwitterMedia.YOUTUBE_TINY_RE.source);
|
var media = TD.services.TwitterMedia;
|
||||||
TD.services.TwitterMedia.SERVICES["youtube"] = TD.services.TwitterMedia.YOUTUBE_RE;
|
|
||||||
|
if (!ensurePropertyExists(media, "YOUTUBE_TINY_RE") ||
|
||||||
|
!ensurePropertyExists(media, "YOUTUBE_LONG_RE") ||
|
||||||
|
!ensurePropertyExists(media, "YOUTUBE_RE") ||
|
||||||
|
!ensurePropertyExists(media, "SERVICES", "youtube"))return;
|
||||||
|
|
||||||
|
media.YOUTUBE_TINY_RE = new RegExp(media.YOUTUBE_TINY_RE.source.replace("http:", "https?:"));
|
||||||
|
media.YOUTUBE_RE = new RegExp(media.YOUTUBE_LONG_RE.source+"|"+media.YOUTUBE_TINY_RE.source);
|
||||||
|
media.SERVICES["youtube"] = media.YOUTUBE_RE;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Block: Fix DM reply input box not getting focused after opening a conversation.
|
// Block: Fix DM reply input box not getting focused after opening a conversation.
|
||||||
//
|
//
|
||||||
|
if (ensurePropertyExists(TD, "components", "ConversationDetailView", "prototype", "showChirp")){
|
||||||
TD.components.ConversationDetailView.prototype.showChirp = appendToFunction(TD.components.ConversationDetailView.prototype.showChirp, function(){
|
TD.components.ConversationDetailView.prototype.showChirp = appendToFunction(TD.components.ConversationDetailView.prototype.showChirp, function(){
|
||||||
setTimeout(function(){
|
setTimeout(function(){
|
||||||
$(".js-reply-tweetbox").first().focus();
|
$(".js-reply-tweetbox").first().focus();
|
||||||
}, 100);
|
}, 100);
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Block: Fix DM notifications not showing if the conversation is open.
|
// Block: Fix DM notifications not showing if the conversation is open.
|
||||||
//
|
//
|
||||||
(function(prevFunc){
|
if (ensurePropertyExists(TD, "services", "TwitterConversation", "prototype", "getUnreadChirps")){
|
||||||
|
var prevFunc = TD.services.TwitterConversation.prototype.getUnreadChirps;
|
||||||
|
|
||||||
TD.services.TwitterConversation.prototype.getUnreadChirps = function(e){
|
TD.services.TwitterConversation.prototype.getUnreadChirps = function(e){
|
||||||
return (e && e.sortIndex && !e.id && !this.notificationsDisabled)
|
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
|
? this.messages.filter(t => t.chirpType === TD.services.ChirpBase.MESSAGE && !t.isOwnChirp() && !t.read && !t.belongsBelow(e)) // changed from belongsAbove
|
||||||
: prevFunc.apply(this, arguments);
|
: prevFunc.apply(this, arguments);
|
||||||
};
|
};
|
||||||
})(TD.services.TwitterConversation.prototype.getUnreadChirps);
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Block: Disable TweetDeck metrics.
|
// Block: Disable TweetDeck metrics.
|
||||||
//
|
//
|
||||||
|
if (ensurePropertyExists(TD, "metrics")){
|
||||||
TD.metrics.inflate = function(){};
|
TD.metrics.inflate = function(){};
|
||||||
TD.metrics.inflateMetricTriple = function(){};
|
TD.metrics.inflateMetricTriple = function(){};
|
||||||
TD.metrics.log = function(){};
|
TD.metrics.log = function(){};
|
||||||
TD.metrics.makeKey = function(){};
|
TD.metrics.makeKey = function(){};
|
||||||
TD.metrics.send = function(){};
|
TD.metrics.send = function(){};
|
||||||
|
}
|
||||||
|
|
||||||
onAppReady.push(function(){
|
onAppReady.push(function(){
|
||||||
let data = $._data(window);
|
let data = $._data(window);
|
||||||
@@ -704,7 +753,9 @@
|
|||||||
//
|
//
|
||||||
// Block: Skip the initial pre-login page.
|
// Block: Skip the initial pre-login page.
|
||||||
//
|
//
|
||||||
$(document).on("uiLoginFormImpression", function(){
|
if (ensurePropertyExists(TD, "controller", "init", "showLogin")){
|
||||||
location.href = $("a.btn", ".js-login-form").first().attr("href");
|
TD.controller.init.showLogin = function(){
|
||||||
});
|
location.href = "https://twitter.com/login?hide_message=true&redirect_after_login=https%3A%2F%2Ftweetdeck.twitter.com%2F%3Fvia_twitter_login%3Dtrue";
|
||||||
|
};
|
||||||
|
}
|
||||||
})($, $TD, $TDX, TD);
|
})($, $TD, $TDX, TD);
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user