1
0
mirror of https://github.com/chylex/TweetDuck.git synced 2025-09-14 10:32:10 +02:00

Compare commits

...

21 Commits
1.7.5 ... 1.7.6

Author SHA1 Message Date
ecbcbcaed4 Release 1.7.6 2017-05-24 20:31:50 +02:00
1677b73ff8 Add protection to prevent code.js from crashing if Twitter changes something again 2017-05-24 19:21:13 +02:00
5929067a3d Add a function to code.js that checks if an object contains a nested property 2017-05-24 18:52:55 +02:00
d06834617b Remove code that broke after TweetDeck updated
Closes #125
2017-05-24 18:32:28 +02:00
9d048efe06 Cleanup code in TweetNotification 2017-05-24 18:31:42 +02:00
6a379bc2cd Make hardware acceleration setting use a new system config file
Closes #123
2017-05-24 14:06:10 +02:00
9f415b11b5 Fuck you and your stupid cmd line MS 2017-05-24 13:20:41 +02:00
b9b9193222 Push devtools_resources.pak 2017-05-19 19:46:06 +02:00
867c2d1632 Make static regexes lazily initialized 2017-05-19 15:53:26 +02:00
5447afc3f5 Make dev tools work in release if devtools_resources.pak is present 2017-05-19 15:14:46 +02:00
b5e58db242 Rewrite pre-login page skip to be instant 2017-05-19 14:24:51 +02:00
8ab99619d6 Fix project file 2017-05-19 14:24:29 +02:00
4c7660ee65 Restire browser window when the browser process is killed 2017-05-19 13:23:52 +02:00
c1b9bde7b0 Add an abstract request handler 2017-05-19 04:14:58 +02:00
0e8c6c066f Rewrite update system to predownload update installers 2017-05-17 18:21:06 +02:00
9e44a86be0 Make BrowserUtils.DownloadFileAsync return WebClient and delete the file when cancelled 2017-05-17 17:25:44 +02:00
b61479f84f Add WindowsUtils.TryDeleteFolderWhenAble for async folder deletion 2017-05-17 15:09:07 +02:00
e3c709b005 Add success action parameter to BrowserUtils.DownloadFileAsync 2017-05-17 14:19:35 +02:00
b2b3dba504 Make 'Edit CEF' and 'Edit CSS' dialogs not block the browser window 2017-05-17 14:05:23 +02:00
4d05441aa8 Rename root namespace to TweetDuck 2017-05-17 13:00:17 +02:00
419b3ee850 Make browser subprocess a custom project with custom assembly info 2017-05-17 00:54:15 +02:00
128 changed files with 946 additions and 604 deletions

View File

@@ -1,7 +1,7 @@
using System;
using TweetDck.Core.Utils;
using TweetDuck.Core.Utils;
namespace TweetDck.Configuration{
namespace TweetDuck.Configuration{
static class Arguments{
// public args
public const string ArgDataFolder = "-datafolder";
@@ -12,6 +12,7 @@ namespace TweetDck.Configuration{
// internal args
public const string ArgRestart = "-restart";
public const string ArgImportCookies = "-importcookies";
public const string ArgUpdated = "-updated";
// class data and methods
private static readonly CommandLineArgs Current = CommandLineArgs.FromStringArray('-', Environment.GetCommandLineArgs());
@@ -28,7 +29,18 @@ namespace TweetDck.Configuration{
CommandLineArgs args = Current.Clone();
args.RemoveFlag(ArgRestart);
args.RemoveFlag(ArgImportCookies);
args.RemoveFlag(ArgUpdated);
return args;
}
public static CommandLineArgs GetCurrentForInstaller(){
CommandLineArgs args = GetCurrentClean();
args.AddFlag(ArgUpdated);
return args;
}
public static string GetCurrentForInstallerCmd(){
return GetCurrentForInstaller().ToString().Replace("\"", "::");
}
}
}

View File

@@ -2,9 +2,9 @@
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using TweetDck.Core.Utils;
using TweetDuck.Core.Utils;
namespace TweetDck.Configuration{
namespace TweetDuck.Configuration{
sealed class LockManager{
public enum Result{
Success, HasProcess, Fail

View 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;
}
}
}

View File

@@ -3,16 +3,22 @@ using System.Drawing;
using System.IO;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Binary;
using TweetDck.Core;
using TweetDck.Core.Controls;
using TweetDck.Core.Notification;
using TweetDck.Core.Utils;
using TweetDck.Plugins;
using TweetDuck.Core;
using TweetDuck.Core.Controls;
using TweetDuck.Core.Notification;
using TweetDuck.Core.Utils;
using TweetDuck.Plugins;
namespace TweetDck.Configuration{
namespace TweetDuck.Configuration{
[Serializable]
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;

View File

@@ -1,8 +1,8 @@
using System;
using System.Windows.Forms;
using TweetDck.Core.Controls;
using TweetDuck.Core.Controls;
namespace TweetDck.Core.Bridge{
namespace TweetDuck.Core.Bridge{
sealed class CallbackBridge{
private readonly Control owner;
private readonly Action safeCallback;

View File

@@ -1,7 +1,7 @@
using System;
using System.Text;
namespace TweetDck.Core.Bridge{
namespace TweetDuck.Core.Bridge{
static class PropertyBridge{
[Flags]
public enum Properties{

View File

@@ -1,9 +1,9 @@
using System.Windows.Forms;
using TweetDck.Core.Controls;
using TweetDck.Core.Notification;
using TweetDck.Core.Utils;
using TweetDuck.Core.Controls;
using TweetDuck.Core.Notification;
using TweetDuck.Core.Utils;
namespace TweetDck.Core.Bridge{
namespace TweetDuck.Core.Bridge{
sealed class TweetDeckBridge{
public static string LastRightClickedLink = 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);
}
public void CrashDebug(string message){
#if DEBUG
Log(message);
System.Diagnostics.Debugger.Break();
#endif
}
public void Log(string data){
System.Diagnostics.Debug.WriteLine(data);
}

View File

@@ -2,9 +2,9 @@
using System.Drawing;
using System.Linq;
using System.Windows.Forms;
using TweetDck.Core.Utils;
using TweetDuck.Core.Utils;
namespace TweetDck.Core.Controls{
namespace TweetDuck.Core.Controls{
static class ControlExtensions{
public static readonly Point InvisibleLocation = new Point(-32000, -32000);

View File

@@ -1,7 +1,7 @@
using System;
using System.Windows.Forms;
namespace TweetDck.Core.Controls{
namespace TweetDuck.Core.Controls{
class FlatButton : Button{
protected override bool ShowFocusCues => false;

View File

@@ -1,7 +1,7 @@
using System.Drawing;
using System.Windows.Forms;
namespace TweetDck.Core.Controls{
namespace TweetDuck.Core.Controls{
sealed class FlatProgressBar : ProgressBar{
private readonly SolidBrush brush;

View File

@@ -2,7 +2,7 @@
using System.Drawing;
using System.Windows.Forms;
namespace TweetDck.Core.Controls{
namespace TweetDuck.Core.Controls{
sealed class TabButton : FlatButton{
public Action Callback { get; private set; }

View File

@@ -1,4 +1,4 @@
namespace TweetDck.Core.Controls {
namespace TweetDuck.Core.Controls {
partial class TabPanel {
/// <summary>
/// Required designer variable.

View File

@@ -4,7 +4,7 @@ using System.Drawing;
using System.Linq;
using System.Windows.Forms;
namespace TweetDck.Core.Controls{
namespace TweetDuck.Core.Controls{
sealed partial class TabPanel : UserControl{
public Panel Content => panelContent;
public IEnumerable<TabButton> Buttons => panelButtons.Controls.Cast<TabButton>();

View File

@@ -1,4 +1,4 @@
namespace TweetDck.Core {
namespace TweetDuck.Core {
sealed partial class FormBrowser {
/// <summary>
/// Required designer variable.
@@ -24,7 +24,7 @@
/// </summary>
private void InitializeComponent() {
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.SuspendLayout();
//
@@ -32,15 +32,16 @@
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
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.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.Name = "FormBrowser";
this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
this.Activated += new System.EventHandler(this.FormBrowser_Activated);
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.Resize += new System.EventHandler(this.FormBrowser_Resize);
this.ResumeLayout(false);

View File

@@ -5,23 +5,23 @@ using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Windows.Forms;
using TweetDck.Configuration;
using TweetDck.Core.Bridge;
using TweetDck.Core.Controls;
using TweetDck.Core.Handling;
using TweetDck.Core.Notification;
using TweetDck.Core.Notification.Screenshot;
using TweetDck.Core.Notification.Sound;
using TweetDck.Core.Other;
using TweetDck.Core.Utils;
using TweetDck.Plugins;
using TweetDck.Plugins.Enums;
using TweetDck.Plugins.Events;
using TweetDck.Resources;
using TweetDck.Updates;
using TweetDck.Updates.Events;
using TweetDuck.Configuration;
using TweetDuck.Core.Bridge;
using TweetDuck.Core.Controls;
using TweetDuck.Core.Handling;
using TweetDuck.Core.Notification;
using TweetDuck.Core.Notification.Screenshot;
using TweetDuck.Core.Notification.Sound;
using TweetDuck.Core.Other;
using TweetDuck.Core.Utils;
using TweetDuck.Plugins;
using TweetDuck.Plugins.Enums;
using TweetDuck.Plugins.Events;
using TweetDuck.Resources;
using TweetDuck.Updates;
using TweetDuck.Updates.Events;
namespace TweetDck.Core{
namespace TweetDuck.Core{
sealed partial class FormBrowser : Form{
private static UserConfig Config => Program.UserConfig;
@@ -64,7 +64,8 @@ namespace TweetDck.Core{
this.browser = new ChromiumWebBrowser("https://tweetdeck.twitter.com/"){
MenuHandler = new ContextMenuBrowser(this),
JsDialogHandler = new JavaScriptDialogHandler(),
LifeSpanHandler = new LifeSpanHandler()
LifeSpanHandler = new LifeSpanHandler(),
RequestHandler = new RequestHandlerBrowser()
};
#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){
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();
}
else if (downloadForm.UpdateStatus == FormUpdateDownload.Status.Manual){
ForceClose();
}
else{
Show();
}
});
}
private void updates_UpdateDismissed(object sender, UpdateDismissedEventArgs e){

View File

@@ -1,7 +1,7 @@
using CefSharp;
using System;
namespace TweetDck.Core.Handling{
namespace TweetDuck.Core.Handling{
class BrowserProcessHandler : IBrowserProcessHandler{
void IBrowserProcessHandler.OnContextInitialized(){
using(IRequestContext ctx = Cef.GetGlobalRequestContext()){

View File

@@ -3,13 +3,14 @@ using System;
using System.IO;
using System.Text.RegularExpressions;
using System.Windows.Forms;
using TweetDck.Core.Bridge;
using TweetDck.Core.Controls;
using TweetDck.Core.Utils;
using TweetDuck.Core.Bridge;
using TweetDuck.Core.Controls;
using TweetDuck.Core.Utils;
namespace TweetDck.Core.Handling{
namespace TweetDuck.Core.Handling{
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 MenuCopyLinkUrl = 26501;
@@ -17,15 +18,8 @@ namespace TweetDck.Core.Handling{
private const int MenuOpenImage = 26503;
private const int MenuSaveImage = 26504;
private const int MenuCopyImageUrl = 26505;
#if DEBUG
private const int MenuOpenDevTools = 26599;
protected void AddDebugMenuItems(IMenuModel model){
model.AddItem((CefMenuCommand)MenuOpenDevTools, "Open dev tools");
}
#endif
private readonly 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){
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)MenuCopyLinkUrl, "Copy account address");
model.AddItem((CefMenuCommand)MenuCopyUsername, "Copy account username");
@@ -85,7 +79,7 @@ namespace TweetDck.Core.Handling{
}
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);
});
}
@@ -97,15 +91,13 @@ namespace TweetDck.Core.Handling{
break;
case MenuCopyUsername:
Match match = RegexTwitterAccount.Match(parameters.UnfilteredLinkUrl);
Match match = RegexTwitterAccount.Value.Match(parameters.UnfilteredLinkUrl);
SetClipboardText(match.Success ? match.Groups[1].Value : parameters.UnfilteredLinkUrl);
break;
#if DEBUG
case MenuOpenDevTools:
browserControl.ShowDevTools();
break;
#endif
}
return false;
@@ -121,6 +113,10 @@ namespace TweetDck.Core.Handling{
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){
if (model.Count > 0 && model.GetTypeAt(model.Count-1) == MenuItemType.Separator){
model.RemoveAt(model.Count-1);

View File

@@ -1,10 +1,10 @@
using CefSharp;
using System.Windows.Forms;
using TweetDck.Core.Bridge;
using TweetDck.Core.Controls;
using TweetDck.Core.Utils;
using TweetDuck.Core.Bridge;
using TweetDuck.Core.Controls;
using TweetDuck.Core.Utils;
namespace TweetDck.Core.Handling{
namespace TweetDuck.Core.Handling{
class ContextMenuBrowser : ContextMenuBase{
private const int MenuGlobal = 26600;
private const int MenuMute = 26601;
@@ -82,10 +82,10 @@ namespace TweetDck.Core.Handling{
globalMenu.AddItem((CefMenuCommand)MenuPlugins, TitlePlugins);
globalMenu.AddItem((CefMenuCommand)MenuAbout, TitleAboutProgram);
#if DEBUG
if (HasDevTools){
globalMenu.AddSeparator();
AddDebugMenuItems(globalMenu);
#endif
}
}
RemoveSeparatorIfLast(model);

View File

@@ -1,8 +1,8 @@
using CefSharp;
using TweetDck.Core.Controls;
using TweetDck.Core.Notification;
using TweetDuck.Core.Controls;
using TweetDuck.Core.Notification;
namespace TweetDck.Core.Handling{
namespace TweetDuck.Core.Handling{
class ContextMenuNotification : ContextMenuBase{
private const int MenuSkipTweet = 26600;
private const int MenuFreeze = 26601;
@@ -44,9 +44,9 @@ namespace TweetDck.Core.Handling{
}
}
#if DEBUG
if (HasDevTools){
AddDebugMenuItems(model);
#endif
}
RemoveSeparatorIfLast(model);

View File

@@ -2,10 +2,10 @@
using CefSharp.WinForms;
using System.Drawing;
using System.Windows.Forms;
using TweetDck.Core.Controls;
using TweetDck.Core.Other;
using TweetDuck.Core.Controls;
using TweetDuck.Core.Other;
namespace TweetDck.Core.Handling {
namespace TweetDuck.Core.Handling {
class JavaScriptDialogHandler : IJsDialogHandler{
bool IJsDialogHandler.OnJSDialog(IWebBrowser browserControl, IBrowser browser, string originUrl, CefJsDialogType dialogType, string messageText, string defaultPromptText, IJsDialogCallback callback, ref bool suppressMessage){
((ChromiumWebBrowser)browserControl).InvokeSafe(() => {

View File

@@ -1,7 +1,7 @@
using CefSharp;
using TweetDck.Core.Utils;
using TweetDuck.Core.Utils;
namespace TweetDck.Core.Handling{
namespace TweetDuck.Core.Handling{
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){
newBrowser = null;

View 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;
}
}
}

View 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();
}
}
}

View File

@@ -3,7 +3,7 @@ using System.Collections.Specialized;
using System.IO;
using System.Text;
namespace TweetDck.Core.Handling{
namespace TweetDuck.Core.Handling{
class ResourceHandlerNotification : IResourceHandler{
private readonly NameValueCollection headers = new NameValueCollection(0);
private MemoryStream dataIn;

View File

@@ -1,4 +1,4 @@
namespace TweetDck.Core.Notification {
namespace TweetDuck.Core.Notification {
partial class FormNotificationBase {
/// <summary>
/// Required designer variable.
@@ -34,7 +34,7 @@
this.BackColor = System.Drawing.SystemColors.Control;
this.ClientSize = new System.Drawing.Size(284, 122);
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.MinimizeBox = false;
this.Name = "FormNotification";

View File

@@ -3,12 +3,12 @@ using CefSharp.WinForms;
using System;
using System.Drawing;
using System.Windows.Forms;
using TweetDck.Configuration;
using TweetDck.Core.Controls;
using TweetDck.Core.Handling;
using TweetDck.Core.Utils;
using TweetDuck.Configuration;
using TweetDuck.Core.Controls;
using TweetDuck.Core.Handling;
using TweetDuck.Core.Utils;
namespace TweetDck.Core.Notification{
namespace TweetDuck.Core.Notification{
partial class FormNotificationBase : Form{
protected Point PrimaryLocation{
get{

View File

@@ -1,4 +1,4 @@
namespace TweetDck.Core.Notification {
namespace TweetDuck.Core.Notification {
partial class FormNotificationMain {
/// <summary>
/// Required designer variable.
@@ -26,7 +26,7 @@
this.components = new System.ComponentModel.Container();
this.timerDisplayDelay = 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();
//
// timerDisplayDelay

View File

@@ -2,14 +2,14 @@
using System;
using System.Drawing;
using System.Windows.Forms;
using TweetDck.Core.Bridge;
using TweetDck.Core.Controls;
using TweetDck.Core.Utils;
using TweetDck.Plugins;
using TweetDck.Plugins.Enums;
using TweetDck.Resources;
using TweetDuck.Core.Bridge;
using TweetDuck.Core.Controls;
using TweetDuck.Core.Utils;
using TweetDuck.Plugins;
using TweetDuck.Plugins.Enums;
using TweetDuck.Resources;
namespace TweetDck.Core.Notification{
namespace TweetDuck.Core.Notification{
partial class FormNotificationMain : FormNotificationBase{
private const string NotificationScriptFile = "notification.js";

View File

@@ -1,4 +1,4 @@
namespace TweetDck.Core.Notification {
namespace TweetDuck.Core.Notification {
partial class FormNotificationTweet {
/// <summary>
/// Required designer variable.

View File

@@ -1,11 +1,11 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using TweetDck.Plugins;
using TweetDuck.Plugins;
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{
private const int NonIntrusiveIdleLimit = 30;
private const int TrimMinimum = 32;

View File

@@ -2,11 +2,11 @@
using System.Drawing;
using System.Drawing.Imaging;
using System.Windows.Forms;
using TweetDck.Core.Bridge;
using TweetDck.Core.Utils;
using TweetDck.Resources;
using TweetDuck.Core.Bridge;
using TweetDuck.Core.Utils;
using TweetDuck.Resources;
namespace TweetDck.Core.Notification.Screenshot{
namespace TweetDuck.Core.Notification.Screenshot{
sealed class FormNotificationScreenshotable : FormNotificationBase{
public FormNotificationScreenshotable(Action callback, Form owner) : base(owner, false){
browser.RegisterAsyncJsObject("$TD_NotificationScreenshot", new CallbackBridge(this, callback));

View File

@@ -3,9 +3,9 @@
using System;
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{
private readonly Form owner;
private readonly Timer timeout;

View File

@@ -1,6 +1,6 @@
using System;
namespace TweetDck.Core.Notification.Sound{
namespace TweetDuck.Core.Notification.Sound{
interface ISoundNotificationPlayer : IDisposable{
string SupportedFormats { get; }

View File

@@ -1,6 +1,6 @@
using System;
namespace TweetDck.Core.Notification.Sound{
namespace TweetDuck.Core.Notification.Sound{
sealed class PlaybackErrorEventArgs : EventArgs{
public string Message { get; }
public bool Ignore { get; set; }

View File

@@ -2,7 +2,7 @@
using System.IO;
using System.Media;
namespace TweetDck.Core.Notification.Sound{
namespace TweetDuck.Core.Notification.Sound{
sealed class SoundPlayerImplFallback : ISoundNotificationPlayer{
string ISoundNotificationPlayer.SupportedFormats => "*.wav";

View File

@@ -1,9 +1,9 @@
using System;
using System.Runtime.InteropServices;
using TweetDck.Core.Utils;
using TweetDuck.Core.Utils;
using WMPLib;
namespace TweetDck.Core.Notification.Sound{
namespace TweetDuck.Core.Notification.Sound{
sealed class SoundPlayerImplWMP : ISoundNotificationPlayer{
string ISoundNotificationPlayer.SupportedFormats => "*.wav;*.mp3;*.mp2;*.m4a;*.mid;*.midi;*.rmi;*.wma;*.aif;*.aifc;*.aiff;*.snd;*.au";

View File

@@ -1,7 +1,7 @@
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{
private static bool? IsWMPAvailable;

View File

@@ -1,8 +1,8 @@
using System;
using System.Text;
using TweetDck.Resources;
using TweetDuck.Resources;
namespace TweetDck.Core.Notification{
namespace TweetDuck.Core.Notification{
sealed class TweetNotification{
private static string FontSizeClass { get; set; }
private static string HeadTag { get; set; }
@@ -51,24 +51,22 @@ namespace TweetDck.Core.Notification{
TopLeft, TopRight, BottomLeft, BottomRight, Custom
}
public string Column => column;
public string TweetUrl => tweetUrl;
public string QuoteUrl => quoteUrl;
public string Column { get; }
public string TweetUrl { get; }
public string QuoteUrl { get; }
private readonly string column;
private readonly string html;
private readonly int characters;
private readonly string tweetUrl;
private readonly string quoteUrl;
private readonly bool isExample;
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){
this.column = column;
this.Column = column;
this.TweetUrl = tweetUrl;
this.QuoteUrl = quoteUrl;
this.html = html;
this.tweetUrl = tweetUrl;
this.quoteUrl = quoteUrl;
this.characters = characters;
this.isExample = isExample;
}

View File

@@ -1,4 +1,4 @@
namespace TweetDck.Core.Other {
namespace TweetDuck.Core.Other {
sealed partial class FormAbout {
/// <summary>
/// Required designer variable.

View File

@@ -1,7 +1,7 @@
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{
private const string TipsLink = "https://github.com/chylex/TweetDuck/wiki";
private const string IssuesLink = "https://github.com/chylex/TweetDuck/issues";

View File

@@ -1,4 +1,4 @@
namespace TweetDck.Core.Other {
namespace TweetDuck.Core.Other {
partial class FormMessage {
/// <summary>
/// Required designer variable.

View File

@@ -2,7 +2,7 @@
using System.Drawing;
using System.Windows.Forms;
namespace TweetDck.Core.Other{
namespace TweetDuck.Core.Other{
sealed partial class FormMessage : Form{
public Button ClickedButton { get; private set; }

View File

@@ -1,4 +1,4 @@
namespace TweetDck.Core.Other {
namespace TweetDuck.Core.Other {
partial class FormPlugins {
/// <summary>
/// Required designer variable.
@@ -26,7 +26,7 @@
this.btnClose = new System.Windows.Forms.Button();
this.btnReload = 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();
//
// btnClose
@@ -87,7 +87,7 @@
this.Controls.Add(this.btnOpenFolder);
this.Controls.Add(this.btnReload);
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.Name = "FormPlugins";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
@@ -101,6 +101,6 @@
private System.Windows.Forms.Button btnClose;
private System.Windows.Forms.Button btnReload;
private System.Windows.Forms.Button btnOpenFolder;
private TweetDck.Core.Controls.TabPanel tabPanelPlugins;
private TweetDuck.Core.Controls.TabPanel tabPanelPlugins;
}
}

View File

@@ -3,13 +3,13 @@ using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Windows.Forms;
using TweetDck.Core.Controls;
using TweetDck.Plugins;
using TweetDck.Plugins.Controls;
using TweetDck.Plugins.Enums;
using TweetDck.Plugins.Events;
using TweetDuck.Core.Controls;
using TweetDuck.Plugins;
using TweetDuck.Plugins.Controls;
using TweetDuck.Plugins.Enums;
using TweetDuck.Plugins.Events;
namespace TweetDck.Core.Other{
namespace TweetDuck.Core.Other{
sealed partial class FormPlugins : Form{
private readonly PluginManager pluginManager;
private readonly TabButton tabBtnOfficial, tabBtnCustom;

View File

@@ -1,4 +1,4 @@
namespace TweetDck.Core.Other {
namespace TweetDuck.Core.Other {
sealed partial class FormSettings {
/// <summary>
/// Required designer variable.
@@ -25,7 +25,7 @@
private void InitializeComponent() {
this.btnClose = new System.Windows.Forms.Button();
this.labelTip = new System.Windows.Forms.Label();
this.tabPanel = new TweetDck.Core.Controls.TabPanel();
this.tabPanel = new TweetDuck.Core.Controls.TabPanel();
this.SuspendLayout();
//
// btnClose
@@ -70,7 +70,7 @@
this.Controls.Add(this.btnClose);
this.Controls.Add(this.tabPanel);
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.MinimizeBox = false;
this.Name = "FormSettings";

View File

@@ -2,11 +2,11 @@
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using TweetDck.Core.Other.Settings;
using TweetDck.Plugins;
using TweetDck.Updates;
using TweetDuck.Core.Other.Settings;
using TweetDuck.Plugins;
using TweetDuck.Updates;
namespace TweetDck.Core.Other{
namespace TweetDuck.Core.Other{
sealed partial class FormSettings : Form{
public const int TabIndexNotification = 1;

View File

@@ -1,7 +1,7 @@
using System.Windows.Forms;
using TweetDck.Configuration;
using TweetDuck.Configuration;
namespace TweetDck.Core.Other.Settings{
namespace TweetDuck.Core.Other.Settings{
class BaseTabSettings : UserControl{
protected static UserConfig Config => Program.UserConfig;

View File

@@ -1,4 +1,4 @@
namespace TweetDck.Core.Other.Settings.Dialogs {
namespace TweetDuck.Core.Other.Settings.Dialogs {
partial class DialogSettingsCSS {
/// <summary>
/// Required designer variable.

View File

@@ -1,9 +1,9 @@
using System;
using System.Windows.Forms;
using TweetDck.Core.Controls;
using TweetDck.Core.Utils;
using TweetDuck.Core.Controls;
using TweetDuck.Core.Utils;
namespace TweetDck.Core.Other.Settings.Dialogs{
namespace TweetDuck.Core.Other.Settings.Dialogs{
sealed partial class DialogSettingsCSS : Form{
public string BrowserCSS => textBoxBrowserCSS.Text;
public string NotificationCSS => textBoxNotificationCSS.Text;

View File

@@ -1,4 +1,4 @@
namespace TweetDck.Core.Other.Settings.Dialogs {
namespace TweetDuck.Core.Other.Settings.Dialogs {
partial class DialogSettingsCefArgs {
/// <summary>
/// Required designer variable.

View File

@@ -1,9 +1,9 @@
using System;
using System.Windows.Forms;
using TweetDck.Core.Controls;
using TweetDck.Core.Utils;
using TweetDuck.Core.Controls;
using TweetDuck.Core.Utils;
namespace TweetDck.Core.Other.Settings.Dialogs{
namespace TweetDuck.Core.Other.Settings.Dialogs{
sealed partial class DialogSettingsCefArgs : Form{
public string CefArgs => textBoxArgs.Text;

View File

@@ -1,4 +1,4 @@
namespace TweetDck.Core.Other.Settings.Dialogs {
namespace TweetDuck.Core.Other.Settings.Dialogs {
partial class DialogSettingsExport {
/// <summary>
/// Required designer variable.

View File

@@ -1,8 +1,8 @@
using System;
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{
public static DialogSettingsExport Import(ExportFileFlags flags){
return new DialogSettingsExport(flags);

View File

@@ -1,4 +1,4 @@
namespace TweetDck.Core.Other.Settings.Dialogs {
namespace TweetDuck.Core.Other.Settings.Dialogs {
partial class DialogSettingsRestart {
/// <summary>
/// Required designer variable.

View File

@@ -2,10 +2,10 @@
using System.IO;
using System.Linq;
using System.Windows.Forms;
using TweetDck.Configuration;
using TweetDck.Core.Utils;
using TweetDuck.Configuration;
using TweetDuck.Core.Utils;
namespace TweetDck.Core.Other.Settings.Dialogs{
namespace TweetDuck.Core.Other.Settings.Dialogs{
sealed partial class DialogSettingsRestart : Form{
private const string DefaultLocale = "en-US";

View File

@@ -2,7 +2,7 @@
using System.IO;
using System.Text;
namespace TweetDck.Core.Other.Settings.Export{
namespace TweetDuck.Core.Other.Settings.Export{
class CombinedFileStream : IDisposable{
public const char KeySeparator = '|';

View File

@@ -1,6 +1,6 @@
using System;
namespace TweetDck.Core.Other.Settings.Export{
namespace TweetDuck.Core.Other.Settings.Export{
[Flags]
enum ExportFileFlags{
None = 0,

View File

@@ -3,11 +3,11 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Windows.Forms;
using TweetDck.Configuration;
using TweetDck.Plugins;
using TweetDck.Plugins.Enums;
using TweetDuck.Configuration;
using TweetDuck.Plugins;
using TweetDuck.Plugins.Enums;
namespace TweetDck.Core.Other.Settings.Export{
namespace TweetDuck.Core.Other.Settings.Export{
sealed class ExportManager{
private static readonly string CookiesPath = Path.Combine(Program.StoragePath, "Cookies");
private static readonly string TempCookiesPath = Path.Combine(Program.StoragePath, "CookiesTmp");
@@ -27,7 +27,7 @@ namespace TweetDck.Core.Other.Settings.Export{
try{
using(CombinedFileStream stream = new CombinedFileStream(new FileStream(file, FileMode.Create, FileAccess.Write, FileShare.None))){
if (flags.HasFlag(ExportFileFlags.Config)){
stream.WriteFile("config", Program.ConfigFilePath);
stream.WriteFile("config", Program.UserConfigFilePath);
}
if (flags.HasFlag(ExportFileFlags.PluginData)){
@@ -101,7 +101,7 @@ namespace TweetDck.Core.Other.Settings.Export{
switch(entry.KeyName){
case "config":
if (flags.HasFlag(ExportFileFlags.Config)){
entry.WriteToFile(Program.ConfigFilePath);
entry.WriteToFile(Program.UserConfigFilePath);
}
break;

View File

@@ -1,4 +1,4 @@
namespace TweetDck.Core.Other.Settings {
namespace TweetDuck.Core.Other.Settings {
partial class TabSettingsAdvanced {
/// <summary>
/// Required designer variable.

View File

@@ -1,14 +1,14 @@
using System;
using System.Diagnostics;
using System.Windows.Forms;
using TweetDck.Configuration;
using TweetDck.Core.Controls;
using TweetDck.Core.Other.Settings.Dialogs;
using TweetDck.Core.Other.Settings.Export;
using TweetDck.Core.Utils;
using TweetDck.Plugins;
using TweetDuck.Configuration;
using TweetDuck.Core.Controls;
using TweetDuck.Core.Other.Settings.Dialogs;
using TweetDuck.Core.Other.Settings.Export;
using TweetDuck.Core.Utils;
using TweetDuck.Plugins;
namespace TweetDck.Core.Other.Settings{
namespace TweetDuck.Core.Other.Settings{
partial class TabSettingsAdvanced : BaseTabSettings{
private readonly Action<string> reinjectBrowserCSS;
private readonly PluginManager plugins;
@@ -19,7 +19,13 @@ namespace TweetDck.Core.Other.Settings{
this.reinjectBrowserCSS = reinjectBrowserCSS;
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(() => {
if (bytes == -1L){
@@ -56,52 +62,54 @@ namespace TweetDck.Core.Other.Settings{
}
private void checkHardwareAcceleration_CheckedChanged(object sender, EventArgs e){
bool succeeded = false;
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){
Program.SystemConfig.HardwareAcceleration = checkHardwareAcceleration.Checked;
Program.SystemConfig.Save();
PromptRestart();
}
else{
checkHardwareAcceleration.CheckedChanged -= checkHardwareAcceleration_CheckedChanged;
checkHardwareAcceleration.Checked = HardwareAcceleration.IsEnabled;
checkHardwareAcceleration.CheckedChanged += checkHardwareAcceleration_CheckedChanged;
}
}
private void btnEditCefArgs_Click(object sender, EventArgs e){
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;
form.Dispose();
PromptRestart();
}
else{
form.Dispose();
}
else form.Dispose();
};
form.Show(ParentForm);
NativeMethods.SetFormDisabled(ParentForm, true);
}
private void btnEditCSS_Click(object sender, EventArgs e){
using(DialogSettingsCSS form = new DialogSettingsCSS(reinjectBrowserCSS)){
if (form.ShowDialog(ParentForm) == DialogResult.OK){
DialogSettingsCSS form = new DialogSettingsCSS(reinjectBrowserCSS);
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.CustomNotificationCSS = form.NotificationCSS;
}
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){

View File

@@ -1,4 +1,4 @@
namespace TweetDck.Core.Other.Settings {
namespace TweetDuck.Core.Other.Settings {
partial class TabSettingsGeneral {
/// <summary>
/// Required designer variable.

View File

@@ -1,10 +1,10 @@
using System;
using System.Windows.Forms;
using TweetDck.Core.Controls;
using TweetDck.Updates;
using TweetDck.Updates.Events;
using TweetDuck.Core.Controls;
using TweetDuck.Updates;
using TweetDuck.Updates.Events;
namespace TweetDck.Core.Other.Settings{
namespace TweetDuck.Core.Other.Settings{
partial class TabSettingsGeneral : BaseTabSettings{
private readonly UpdateHandler updates;
private int updateCheckEventId = -1;

View File

@@ -1,4 +1,4 @@
namespace TweetDck.Core.Other.Settings {
namespace TweetDuck.Core.Other.Settings {
partial class TabSettingsNotifications {
/// <summary>
/// Required designer variable.
@@ -37,9 +37,9 @@
this.trackBarEdgeDistance = new System.Windows.Forms.TrackBar();
this.groupNotificationDuration = new System.Windows.Forms.GroupBox();
this.tableLayoutDurationButtons = new System.Windows.Forms.TableLayoutPanel();
this.btnDurationMedium = new TweetDck.Core.Controls.FlatButton();
this.btnDurationLong = new TweetDck.Core.Controls.FlatButton();
this.btnDurationShort = new TweetDck.Core.Controls.FlatButton();
this.btnDurationMedium = new TweetDuck.Core.Controls.FlatButton();
this.btnDurationLong = new TweetDuck.Core.Controls.FlatButton();
this.btnDurationShort = new TweetDuck.Core.Controls.FlatButton();
this.labelDurationValue = new System.Windows.Forms.Label();
this.trackBarDuration = new System.Windows.Forms.TrackBar();
this.groupUserInterface = new System.Windows.Forms.GroupBox();
@@ -440,9 +440,9 @@
private System.Windows.Forms.Label labelDurationValue;
private System.Windows.Forms.TrackBar trackBarDuration;
private System.Windows.Forms.TableLayoutPanel tableLayoutDurationButtons;
private TweetDck.Core.Controls.FlatButton btnDurationMedium;
private TweetDck.Core.Controls.FlatButton btnDurationLong;
private TweetDck.Core.Controls.FlatButton btnDurationShort;
private TweetDuck.Core.Controls.FlatButton btnDurationMedium;
private TweetDuck.Core.Controls.FlatButton btnDurationLong;
private TweetDuck.Core.Controls.FlatButton btnDurationShort;
private System.Windows.Forms.CheckBox checkNonIntrusive;
private System.Windows.Forms.Label labelIdlePause;
private System.Windows.Forms.ComboBox comboBoxIdlePause;

View File

@@ -1,10 +1,10 @@
using System;
using System.Globalization;
using System.Windows.Forms;
using TweetDck.Core.Controls;
using TweetDck.Core.Notification;
using TweetDuck.Core.Controls;
using TweetDuck.Core.Notification;
namespace TweetDck.Core.Other.Settings{
namespace TweetDuck.Core.Other.Settings{
partial class TabSettingsNotifications : BaseTabSettings{
private static readonly int[] IdlePauseSeconds = { 0, 30, 60, 120, 300 };

View File

@@ -1,4 +1,4 @@
namespace TweetDck.Core.Other.Settings {
namespace TweetDuck.Core.Other.Settings {
partial class TabSettingsSounds {
/// <summary>
/// Required designer variable.

View File

@@ -2,10 +2,10 @@
using System.Drawing;
using System.IO;
using System.Windows.Forms;
using TweetDck.Core.Notification;
using TweetDck.Core.Notification.Sound;
using TweetDuck.Core.Notification;
using TweetDuck.Core.Notification.Sound;
namespace TweetDck.Core.Other.Settings{
namespace TweetDuck.Core.Other.Settings{
partial class TabSettingsSounds : BaseTabSettings{
private readonly ISoundNotificationPlayer soundNotification;

View File

@@ -1,4 +1,4 @@
namespace TweetDck.Core {
namespace TweetDuck.Core {
partial class TrayIcon {
/// <summary>
/// Required designer variable.

View File

@@ -2,7 +2,7 @@
using System.ComponentModel;
using System.Windows.Forms;
namespace TweetDck.Core{
namespace TweetDuck.Core{
partial class TrayIcon : Component{
public enum Behavior{ // keep order
Disabled, DisplayOnly, MinimizeToTray, CloseToTray, Combined

View File

@@ -4,7 +4,7 @@ using System.IO;
using System.Threading.Tasks;
using System.Linq;
namespace TweetDck.Core.Utils{
namespace TweetDuck.Core.Utils{
static class BrowserCache{
private static bool ClearOnExit { get; set; }

View File

@@ -8,7 +8,7 @@ using System.Net;
using System.Text.RegularExpressions;
using System.Windows.Forms;
namespace TweetDck.Core.Utils{
namespace TweetDuck.Core.Utils{
static class BrowserUtils{
public static string HeaderAcceptLanguage{
get{
@@ -69,17 +69,28 @@ namespace TweetDck.Core.Utils{
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 };
client.Headers[HttpRequestHeader.UserAgent] = HeaderUserAgent;
client.DownloadFileCompleted += (sender, args) => {
if (args.Error != null){
onFailure(args.Error);
if (args.Cancelled){
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);
return client;
}
public static void SetZoomLevel(IBrowser browser, int percentage){

View File

@@ -1,7 +1,7 @@
using System.Collections.Generic;
using System.Text;
namespace TweetDck.Core.Utils{
namespace TweetDuck.Core.Utils{
class CommandLineArgs{
public static CommandLineArgs FromStringArray(char entryChar, string[] array){
CommandLineArgs args = new CommandLineArgs();

View File

@@ -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{
private static Regex splitRegex;
private static Regex SplitRegex => splitRegex ?? (splitRegex = new Regex(@"([^=\s]+(?:=(?:[^ ]*""[^""]*?""[^ ]*|[^ ]*))?)", RegexOptions.Compiled));
private static readonly Lazy<Regex> SplitRegex = new Lazy<Regex>(() => new Regex(@"([^=\s]+(?:=(?:[^ ]*""[^""]*?""[^ ]*|[^ ]*))?)", RegexOptions.Compiled), false);
public static CommandLineArgs ReadCefArguments(string argumentString){
CommandLineArgs args = new CommandLineArgs();
@@ -13,7 +12,7 @@ namespace TweetDck.Core.Utils{
return args;
}
foreach(Match match in SplitRegex.Matches(argumentString)){
foreach(Match match in SplitRegex.Value.Matches(argumentString)){
string matchValue = match.Value;
int indexEquals = matchValue.IndexOf('=');

View File

@@ -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;
}
}
}
}

View File

@@ -1,6 +1,6 @@
using System;
namespace TweetDck.Core.Utils{
namespace TweetDuck.Core.Utils{
class InjectedHTML{
public enum Position{
Before, After

View File

@@ -4,7 +4,7 @@ using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Runtime.InteropServices;
namespace TweetDck.Core.Utils{
namespace TweetDuck.Core.Utils{
static class NativeCoreAudio{
private const int EDATAFLOW_RENDER = 0;
private const int EROLE_MULTIMEDIA = 1;

View File

@@ -4,7 +4,7 @@ using System.Drawing;
using System.Runtime.InteropServices;
using System.Windows.Forms;
namespace TweetDck.Core.Utils{
namespace TweetDuck.Core.Utils{
[SuppressMessage("ReSharper", "FieldCanBeMadeReadOnly.Local")]
[SuppressMessage("ReSharper", "MemberCanBePrivate.Local")]
static class NativeMethods{
@@ -13,6 +13,8 @@ namespace TweetDck.Core.Utils{
public const int HWND_TOPMOST = -1;
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 BCM_SETSHIELD = 0x160C;
@@ -83,10 +85,25 @@ namespace TweetDck.Core.Utils{
[DllImport("user32.dll")]
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){
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){
return Marshal.PtrToStructure<MSLLHOOKSTRUCT>(ptr).mouseData >> 16;
}

View File

@@ -1,7 +1,7 @@
using System.Collections.Generic;
using System.Linq;
namespace TweetDck.Core.Utils{
namespace TweetDuck.Core.Utils{
class TwoKeyDictionary<K1, K2, V>{
private readonly Dictionary<K1, Dictionary<K2, V>> dict;
private readonly int innerCapacity;

View File

@@ -1,9 +1,9 @@
using System;
using System.Drawing;
using System.Windows.Forms;
using TweetDck.Core.Controls;
using TweetDuck.Core.Controls;
namespace TweetDck.Core.Utils{
namespace TweetDuck.Core.Utils{
[Serializable]
class WindowState{
private Rectangle rect;

View File

@@ -6,8 +6,11 @@ using System.Text.RegularExpressions;
using System.Threading;
using System.Windows.Forms;
namespace TweetDck.Core.Utils{
namespace TweetDuck.Core.Utils{
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; }
static WindowsUtils(){
@@ -54,6 +57,21 @@ namespace TweetDck.Core.Utils{
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(){
if (!Clipboard.ContainsText(TextDataFormat.Html)){
return;
@@ -62,10 +80,10 @@ namespace TweetDck.Core.Utils{
string originalText = Clipboard.GetText(TextDataFormat.UnicodeText);
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;
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();
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);
}
}
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+)");
}
}
}

View File

@@ -1,4 +1,4 @@
namespace TweetDck.Plugins.Controls {
namespace TweetDuck.Plugins.Controls {
partial class PluginControl {
/// <summary>
/// Required designer variable.

View File

@@ -3,9 +3,9 @@ using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Windows.Forms;
using TweetDck.Core.Utils;
using TweetDuck.Core.Utils;
namespace TweetDck.Plugins.Controls{
namespace TweetDuck.Plugins.Controls{
partial class PluginControl : UserControl{
private readonly PluginManager pluginManager;
private readonly Plugin plugin;

View File

@@ -1,7 +1,7 @@
using System.Windows.Forms;
using TweetDck.Core.Utils;
using TweetDuck.Core.Utils;
namespace TweetDck.Plugins.Controls{
namespace TweetDuck.Plugins.Controls{
sealed class PluginListFlowLayout : FlowLayoutPanel{
public PluginListFlowLayout(){
FlowDirection = FlowDirection.TopDown;

View File

@@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;
namespace TweetDck.Plugins.Enums{
namespace TweetDuck.Plugins.Enums{
[Flags]
enum PluginEnvironment{
None = 0,

View File

@@ -1,4 +1,4 @@
namespace TweetDck.Plugins.Enums{
namespace TweetDuck.Plugins.Enums{
enum PluginFolder{
Root, Data
}

View File

@@ -1,4 +1,4 @@
namespace TweetDck.Plugins.Enums{
namespace TweetDuck.Plugins.Enums{
enum PluginGroup{
Official, Custom
}

View File

@@ -1,6 +1,6 @@
using System;
namespace TweetDck.Plugins.Events{
namespace TweetDuck.Plugins.Events{
class PluginChangedStateEventArgs : EventArgs{
public Plugin Plugin { get; }
public bool IsEnabled { get; }

View File

@@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;
namespace TweetDck.Plugins.Events{
namespace TweetDuck.Plugins.Events{
class PluginErrorEventArgs : EventArgs{
public bool HasErrors => Errors.Count > 0;

View File

@@ -3,9 +3,9 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using TweetDck.Plugins.Enums;
using TweetDuck.Plugins.Enums;
namespace TweetDck.Plugins{
namespace TweetDuck.Plugins{
class Plugin{
public string Identifier { get; }
public PluginGroup Group { get; }

View File

@@ -2,11 +2,11 @@
using System.Collections.Generic;
using System.IO;
using System.Text;
using TweetDck.Core.Utils;
using TweetDck.Plugins.Enums;
using TweetDck.Plugins.Events;
using TweetDuck.Core.Utils;
using TweetDuck.Plugins.Enums;
using TweetDuck.Plugins.Events;
namespace TweetDck.Plugins{
namespace TweetDuck.Plugins{
class PluginBridge{
private static string SanitizeCacheKey(string key){
return key.Replace('\\', '/').Trim();

View File

@@ -2,9 +2,9 @@
using System.Collections.Generic;
using System.IO;
using System.Text;
using TweetDck.Plugins.Events;
using TweetDuck.Plugins.Events;
namespace TweetDck.Plugins{
namespace TweetDuck.Plugins{
[Serializable]
sealed class PluginConfig{
[field:NonSerialized]

View File

@@ -3,11 +3,11 @@ using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using TweetDck.Plugins.Enums;
using TweetDck.Plugins.Events;
using TweetDck.Resources;
using TweetDuck.Plugins.Enums;
using TweetDuck.Plugins.Events;
using TweetDuck.Resources;
namespace TweetDck.Plugins{
namespace TweetDuck.Plugins{
sealed class PluginManager{
public const string PluginBrowserScriptFile = "plugins.browser.js";
public const string PluginNotificationScriptFile = "plugins.notification.js";

View File

@@ -1,7 +1,7 @@
using System.Text;
using TweetDck.Plugins.Enums;
using TweetDuck.Plugins.Enums;
namespace TweetDck.Plugins{
namespace TweetDuck.Plugins{
static class PluginScriptGenerator{
public static string GenerateConfig(PluginConfig config){
return config.AnyDisabled ? "window.TD_PLUGINS.disabled = [\""+string.Join("\",\"", config.DisabledPlugins)+"\"];" : string.Empty;

View File

@@ -5,23 +5,23 @@ using System.IO;
using System.Linq;
using System.Threading;
using System.Windows.Forms;
using TweetDck.Configuration;
using TweetDck.Core;
using TweetDck.Core.Handling;
using TweetDck.Core.Other;
using TweetDck.Core.Other.Settings.Export;
using TweetDck.Core.Utils;
using TweetDck.Plugins;
using TweetDck.Plugins.Events;
using TweetDck.Updates;
using TweetDuck.Configuration;
using TweetDuck.Core;
using TweetDuck.Core.Handling;
using TweetDuck.Core.Other;
using TweetDuck.Core.Other.Settings.Export;
using TweetDuck.Core.Utils;
using TweetDuck.Plugins;
using TweetDuck.Plugins.Events;
using TweetDuck.Updates;
namespace TweetDck{
namespace TweetDuck{
static class Program{
public const string BrandName = "TweetDuck";
public const string Website = "https://tweetduck.chylex.com";
public const string VersionTag = "1.7.5";
public const string VersionFull = "1.7.5.0";
public const string VersionTag = "1.7.6";
public const string VersionFull = "1.7.6.0";
public static readonly Version Version = new Version(VersionTag);
public static readonly bool IsPortable = File.Exists("makeportable");
@@ -29,11 +29,13 @@ namespace TweetDck{
public static readonly string ProgramPath = AppDomain.CurrentDomain.BaseDirectory;
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 UserConfigFilePath = Path.Combine(StoragePath, "TD_UserConfig.cfg");
public static readonly string SystemConfigFilePath = Path.Combine(StoragePath, "TD_SystemConfig.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");
private static readonly string InstallerPath = Path.Combine(StoragePath, "TD_Updates");
public static readonly string ScriptPath = Path.Combine(ProgramPath, "scripts");
public static readonly string PluginPath = Path.Combine(ProgramPath, "plugins");
@@ -44,6 +46,7 @@ namespace TweetDck{
private static bool HasCleanedUp;
public static UserConfig UserConfig { get; private set; }
public static SystemConfig SystemConfig { get; private set; }
public static Reporter Reporter { get; private set; }
public static event EventHandler UserConfigReplaced;
@@ -122,28 +125,33 @@ namespace TweetDck{
}
ReloadConfig();
SystemConfig = SystemConfig.Load(SystemConfigFilePath);
if (Arguments.HasFlag(Arguments.ArgImportCookies)){
ExportManager.ImportCookies();
}
if (Arguments.HasFlag(Arguments.ArgUpdated)){
WindowsUtils.TryDeleteFolderWhenAble(InstallerPath, 8000);
}
CefSharpSettings.WcfEnabled = false;
CefSettings settings = new CefSettings{
AcceptLanguageList = BrowserUtils.HeaderAcceptLanguage,
UserAgent = BrowserUtils.HeaderUserAgent,
Locale = Arguments.GetValue(Arguments.ArgLocale, string.Empty),
BrowserSubprocessPath = BrandName+".Browser.exe",
CachePath = StoragePath,
LogFile = ConsoleLogFilePath,
#if !DEBUG
BrowserSubprocessPath = BrandName+".Browser.exe",
LogSeverity = Arguments.HasFlag(Arguments.ArgLogging) ? LogSeverity.Info : LogSeverity.Disable
#endif
};
CommandLineArgsParser.ReadCefArguments(UserConfig.CustomCefArgs).ToDictionary(settings.CefCommandLineArgs);
if (!HardwareAcceleration.IsEnabled){
if (!SystemConfig.HardwareAcceleration){
settings.CefCommandLineArgs["disable-gpu"] = "1";
settings.CefCommandLineArgs["disable-gpu-vsync"] = "1";
}
@@ -163,7 +171,8 @@ namespace TweetDck{
FormBrowser mainForm = new FormBrowser(plugins, new UpdaterSettings{
AllowPreReleases = Arguments.HasFlag(Arguments.ArgDebugUpdates),
DismissedUpdate = UserConfig.DismissedUpdate
DismissedUpdate = UserConfig.DismissedUpdate,
InstallerDownloadFolder = InstallerPath
});
Application.Run(mainForm);
@@ -172,7 +181,7 @@ namespace TweetDck{
ExitCleanup();
// 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);
WindowsUtils.StartProcess(mainForm.UpdateInstallerPath, updaterArgs, runElevated);
@@ -213,14 +222,14 @@ namespace TweetDck{
}
public static void ReloadConfig(){
UserConfig = UserConfig.Load(ConfigFilePath);
UserConfig = UserConfig.Load(UserConfigFilePath);
UserConfigReplaced?.Invoke(UserConfig, new EventArgs());
}
public static void ResetConfig(){
try{
File.Delete(ConfigFilePath);
File.Delete(UserConfig.GetBackupFile(ConfigFilePath));
File.Delete(UserConfigFilePath);
File.Delete(UserConfig.GetBackupFile(UserConfigFilePath));
}catch(Exception e){
Reporter.HandleException("Configuration Reset Error", "Could not delete configuration files to reset the settings.", true, e);
return;

View File

@@ -2,7 +2,7 @@
using System.Reflection;
using System.Resources;
using System.Runtime.InteropServices;
using TweetDck;
using TweetDuck;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
@@ -37,7 +37,7 @@ using TweetDck;
[assembly: AssemblyVersion(Program.VersionFull)]
[assembly: AssemblyFileVersion(Program.VersionFull)]
[assembly: NeutralResourcesLanguageAttribute("en")]
[assembly: NeutralResourcesLanguage("en")]
[assembly: CLSCompliant(false)]

View File

@@ -8,7 +8,8 @@
// </auto-generated>
//------------------------------------------------------------------------------
namespace TweetDck.Properties {
namespace TweetDuck.Properties {
using System;
/// <summary>
@@ -38,7 +39,7 @@ namespace TweetDck.Properties {
internal static global::System.Resources.ResourceManager ResourceManager {
get {
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;
}
return resourceMan;

View File

@@ -5,9 +5,9 @@ using System.Globalization;
using System.IO;
using System.Text;
using System.Windows.Forms;
using TweetDck.Core.Other;
using TweetDuck.Core.Other;
namespace TweetDck{
namespace TweetDuck{
class Reporter{
private readonly string logFile;

View File

@@ -5,7 +5,7 @@ using System.IO;
using System.Text;
using System.Windows.Forms;
namespace TweetDck.Resources{
namespace TweetDuck.Resources{
static class ScriptLoader{
private const string UrlPrefix = "td:";

View File

@@ -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.
//
@@ -188,6 +204,7 @@
//
// Block: Enable popup notifications.
//
if (ensurePropertyExists(TD, "controller", "notifications")){
TD.controller.notifications.hasNotifications = function(){
return true;
};
@@ -195,6 +212,7 @@
TD.controller.notifications.isPermissionGranted = function(){
return true;
};
}
$.subscribe("/notifications/new", function(obj){
for(let index = obj.items.length-1; index >= 0; index--){
@@ -538,6 +556,10 @@
}
});
if (!ensurePropertyExists(TD, "vo", "Column", "prototype", "clear")){
return;
}
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
@@ -561,6 +583,10 @@
$(".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(){
if (!this.$node.attr("td-account-selector-hook")){
this.$node.attr("td-account-selector-hook", "1");
@@ -600,8 +626,6 @@
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
TD.services.TwitterActionRetweetedRetweet.prototype.iconClass = "icon-retweet icon-retweet-color txt-base-medium"; // fix retweet icon mismatch
window.TDGF_reinjectCustomCSS = function(styles){
$("#tweetduck-custom-css").remove();
@@ -617,6 +641,10 @@
(function(){
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(){
var media = this.chirp.getMedia().find(media => media.mediaId === this.clickedMediaEntityId);
@@ -648,38 +676,53 @@
//
// 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?:"));
TD.services.TwitterMedia.YOUTUBE_RE = new RegExp(TD.services.TwitterMedia.YOUTUBE_LONG_RE.source+"|"+TD.services.TwitterMedia.YOUTUBE_TINY_RE.source);
TD.services.TwitterMedia.SERVICES["youtube"] = TD.services.TwitterMedia.YOUTUBE_RE;
if (ensurePropertyExists(TD, "services", "TwitterMedia")){
var media = TD.services.TwitterMedia;
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.
//
if (ensurePropertyExists(TD, "components", "ConversationDetailView", "prototype", "showChirp")){
TD.components.ConversationDetailView.prototype.showChirp = appendToFunction(TD.components.ConversationDetailView.prototype.showChirp, function(){
setTimeout(function(){
$(".js-reply-tweetbox").first().focus();
}, 100);
});
}
//
// 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){
return (e && e.sortIndex && !e.id && !this.notificationsDisabled)
? this.messages.filter(t => t.chirpType === TD.services.ChirpBase.MESSAGE && !t.isOwnChirp() && !t.read && !t.belongsBelow(e)) // changed from belongsAbove
: prevFunc.apply(this, arguments);
};
})(TD.services.TwitterConversation.prototype.getUnreadChirps);
}
//
// Block: Disable TweetDeck metrics.
//
if (ensurePropertyExists(TD, "metrics")){
TD.metrics.inflate = function(){};
TD.metrics.inflateMetricTriple = function(){};
TD.metrics.log = function(){};
TD.metrics.makeKey = function(){};
TD.metrics.send = function(){};
}
onAppReady.push(function(){
let data = $._data(window);
@@ -704,7 +747,9 @@
//
// Block: Skip the initial pre-login page.
//
$(document).on("uiLoginFormImpression", function(){
location.href = $("a.btn", ".js-login-form").first().attr("href");
});
if (ensurePropertyExists(TD, "controller", "init", "showLogin")){
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);

View File

@@ -113,7 +113,7 @@
ele.remove();
if (download){
$TDU.onUpdateAccepted(version, download);
$TDU.onUpdateAccepted();
}
else{
$TDU.openBrowser(updateDownloadFallback);
@@ -125,7 +125,7 @@
});
buttonDiv.children(".tdu-btn-dismiss,.tdu-btn-unsupported").click(function(){
$TDU.onUpdateDismissed(version);
$TDU.onUpdateDismissed();
ele.slideUp(function(){ ele.remove(); });
});
@@ -161,10 +161,13 @@
if (hasUpdate){
var obj = release.assets.find(asset => asset.name === updateFileName) || { browser_download_url: "" };
displayNotification(tagName, obj.browser_download_url);
}
if (eventID){ // ignore undefined and 0
$TDU.onUpdateCheckFinished(eventID, hasUpdate, tagName);
$TDU.onUpdateCheckFinished(eventID, tagName, obj.browser_download_url);
}
}
else if (eventID){ // ignore undefined and 0
$TDU.onUpdateCheckFinished(eventID, null, null);
}
});
};

View File

@@ -9,7 +9,7 @@
<ProjectGuid>{2389A7CD-E0D3-4706-8294-092929A33A2D}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>TweetDck</RootNamespace>
<RootNamespace>TweetDuck</RootNamespace>
<AssemblyName>TweetDuck</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
@@ -70,6 +70,7 @@
<ItemGroup>
<Compile Include="Configuration\Arguments.cs" />
<Compile Include="Configuration\LockManager.cs" />
<Compile Include="Configuration\SystemConfig.cs" />
<Compile Include="Configuration\UserConfig.cs" />
<Compile Include="Core\Bridge\PropertyBridge.cs" />
<Compile Include="Core\Controls\ControlExtensions.cs" />
@@ -97,6 +98,8 @@
<Compile Include="Core\FormBrowser.Designer.cs">
<DependentUpon>FormBrowser.cs</DependentUpon>
</Compile>
<Compile Include="Core\Handling\RequestHandlerBrowser.cs" />
<Compile Include="Core\Handling\RequestHandler.cs" />
<Compile Include="Core\Handling\ResourceHandlerNotification.cs" />
<Compile Include="Core\Notification\FormNotificationMain.cs">
<SubType>Form</SubType>
@@ -251,10 +254,10 @@
</Compile>
<Compile Include="Core\Utils\BrowserCache.cs" />
<Compile Include="Core\Utils\BrowserUtils.cs" />
<Compile Include="Core\Utils\HardwareAcceleration.cs" />
<Compile Include="Core\Utils\NativeMethods.cs" />
<Compile Include="Updates\Events\UpdateAcceptedEventArgs.cs" />
<Compile Include="Updates\Events\UpdateCheckEventArgs.cs" />
<Compile Include="Updates\UpdateDownloadStatus.cs" />
<Compile Include="Updates\UpdateHandler.cs" />
<Compile Include="Updates\UpdateInfo.cs" />
<Compile Include="Program.cs" />
@@ -347,6 +350,12 @@
<EmbedInteropTypes>True</EmbedInteropTypes>
</COMReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="subprocess\TweetDuck.Browser.csproj">
<Project>{b10b0017-819e-4f71-870f-8256b36a26aa}</Project>
<Name>TweetDuck.Browser</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>del "$(TargetPath).config"

Some files were not shown because too many files have changed in this diff Show More