mirror of
https://github.com/chylex/TweetDuck.git
synced 2025-09-14 19:32:10 +02:00
Compare commits
14 Commits
1.17.1
...
random_wip
Author | SHA1 | Date | |
---|---|---|---|
d6a14edcdf | |||
20e29a7975 | |||
ef815dabce | |||
1fb133e6b8 | |||
50b58cd6a6 | |||
01485d7ef9 | |||
b17c6a5ac7 | |||
d2ed2b4a00 | |||
710a7524a1 | |||
2be46464d6 | |||
8d536a6734 | |||
250d502238 | |||
e8de7266d0 | |||
9414f372d7 |
@@ -7,6 +7,7 @@ namespace TweetDuck.Configuration{
|
|||||||
public const string ArgDataFolder = "-datafolder";
|
public const string ArgDataFolder = "-datafolder";
|
||||||
public const string ArgLogging = "-log";
|
public const string ArgLogging = "-log";
|
||||||
public const string ArgIgnoreGDPR = "-nogdpr";
|
public const string ArgIgnoreGDPR = "-nogdpr";
|
||||||
|
public const string ArgFreeze = "-freeze";
|
||||||
|
|
||||||
// internal args
|
// internal args
|
||||||
public const string ArgRestart = "-restart";
|
public const string ArgRestart = "-restart";
|
||||||
|
@@ -34,7 +34,7 @@ namespace TweetDuck.Configuration.Instance{
|
|||||||
LoadInternal(attempt > 0);
|
LoadInternal(attempt > 0);
|
||||||
|
|
||||||
if (firstException != null){ // silently log exception that caused a backup restore
|
if (firstException != null){ // silently log exception that caused a backup restore
|
||||||
Program.Reporter.Log(firstException.ToString());
|
Program.Reporter.LogImportant(firstException.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@@ -124,7 +124,7 @@ namespace TweetDuck.Configuration{
|
|||||||
try{
|
try{
|
||||||
File.Delete(file);
|
File.Delete(file);
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
Program.Reporter.Log(e.ToString());
|
Program.Reporter.LogImportant(e.ToString());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
47
Core/Handling/KeyboardHandlerBase.cs
Normal file
47
Core/Handling/KeyboardHandlerBase.cs
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
using System.Windows.Forms;
|
||||||
|
using CefSharp;
|
||||||
|
using TweetDuck.Core.Controls;
|
||||||
|
using TweetDuck.Core.Other;
|
||||||
|
using TweetDuck.Core.Utils;
|
||||||
|
|
||||||
|
namespace TweetDuck.Core.Handling{
|
||||||
|
class KeyboardHandlerBase : IKeyboardHandler{
|
||||||
|
protected virtual bool HandleRawKey(IWebBrowser browserControl, IBrowser browser, Keys key, CefEventFlags modifiers){
|
||||||
|
if (modifiers == (CefEventFlags.ControlDown | CefEventFlags.ShiftDown) && key == Keys.I){
|
||||||
|
if (BrowserUtils.HasDevTools){
|
||||||
|
browser.ShowDevTools();
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
browserControl.AsControl().InvokeSafe(() => {
|
||||||
|
string extraMessage;
|
||||||
|
|
||||||
|
if (Program.IsPortable){
|
||||||
|
extraMessage = "Please download the portable installer, select the folder with your current installation of TweetDuck Portable, and tick 'Install dev tools' during the installation process.";
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
extraMessage = "Please download the installer, and tick 'Install dev tools' during the installation process. The installer will automatically find and update your current installation of TweetDuck.";
|
||||||
|
}
|
||||||
|
|
||||||
|
FormMessage.Information("Dev Tools", "You do not have dev tools installed. "+extraMessage, FormMessage.OK);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IKeyboardHandler.OnPreKeyEvent(IWebBrowser browserControl, IBrowser browser, KeyType type, int windowsKeyCode, int nativeKeyCode, CefEventFlags modifiers, bool isSystemKey, ref bool isKeyboardShortcut){
|
||||||
|
if (type == KeyType.RawKeyDown && !browser.FocusedFrame.Url.StartsWith("chrome-devtools://")){
|
||||||
|
return HandleRawKey(browserControl, browser, (Keys)windowsKeyCode, modifiers);
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IKeyboardHandler.OnKeyEvent(IWebBrowser browserControl, IBrowser browser, KeyType type, int windowsKeyCode, int nativeKeyCode, CefEventFlags modifiers, bool isSystemKey){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -2,19 +2,19 @@
|
|||||||
using CefSharp;
|
using CefSharp;
|
||||||
|
|
||||||
namespace TweetDuck.Core.Handling{
|
namespace TweetDuck.Core.Handling{
|
||||||
sealed class KeyboardHandlerBrowser : IKeyboardHandler{
|
sealed class KeyboardHandlerBrowser : KeyboardHandlerBase{
|
||||||
private readonly FormBrowser form;
|
private readonly FormBrowser form;
|
||||||
|
|
||||||
public KeyboardHandlerBrowser(FormBrowser form){
|
public KeyboardHandlerBrowser(FormBrowser form){
|
||||||
this.form = form;
|
this.form = form;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IKeyboardHandler.OnPreKeyEvent(IWebBrowser browserControl, IBrowser browser, KeyType type, int windowsKeyCode, int nativeKeyCode, CefEventFlags modifiers, bool isSystemKey, ref bool isKeyboardShortcut){
|
protected override bool HandleRawKey(IWebBrowser browserControl, IBrowser browser, Keys key, CefEventFlags modifiers){
|
||||||
return type == KeyType.RawKeyDown && form.ProcessBrowserKey((Keys)windowsKeyCode);
|
if (base.HandleRawKey(browserControl, browser, key, modifiers)){
|
||||||
}
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool IKeyboardHandler.OnKeyEvent(IWebBrowser browserControl, IBrowser browser, KeyType type, int windowsKeyCode, int nativeKeyCode, CefEventFlags modifiers, bool isSystemKey){
|
return form.ProcessBrowserKey(key);
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -4,7 +4,7 @@ using TweetDuck.Core.Controls;
|
|||||||
using TweetDuck.Core.Notification;
|
using TweetDuck.Core.Notification;
|
||||||
|
|
||||||
namespace TweetDuck.Core.Handling {
|
namespace TweetDuck.Core.Handling {
|
||||||
sealed class KeyboardHandlerNotification : IKeyboardHandler{
|
sealed class KeyboardHandlerNotification : KeyboardHandlerBase{
|
||||||
private readonly FormNotificationBase notification;
|
private readonly FormNotificationBase notification;
|
||||||
|
|
||||||
public KeyboardHandlerNotification(FormNotificationBase notification){
|
public KeyboardHandlerNotification(FormNotificationBase notification){
|
||||||
@@ -15,31 +15,30 @@ namespace TweetDuck.Core.Handling {
|
|||||||
notification.InvokeAsyncSafe(notification.AnalyticsFile.NotificationKeyboardShortcuts.Trigger);
|
notification.InvokeAsyncSafe(notification.AnalyticsFile.NotificationKeyboardShortcuts.Trigger);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IKeyboardHandler.OnPreKeyEvent(IWebBrowser browserControl, IBrowser browser, KeyType type, int windowsKeyCode, int nativeKeyCode, CefEventFlags modifiers, bool isSystemKey, ref bool isKeyboardShortcut){
|
protected override bool HandleRawKey(IWebBrowser browserControl, IBrowser browser, Keys key, CefEventFlags modifiers){
|
||||||
if (type == KeyType.RawKeyDown && !browser.FocusedFrame.Url.StartsWith("chrome-devtools://")){
|
if (base.HandleRawKey(browserControl, browser, key, modifiers)){
|
||||||
switch((Keys)windowsKeyCode){
|
return true;
|
||||||
case Keys.Enter:
|
|
||||||
notification.InvokeAsyncSafe(notification.FinishCurrentNotification);
|
|
||||||
TriggerKeyboardShortcutAnalytics();
|
|
||||||
return true;
|
|
||||||
|
|
||||||
case Keys.Escape:
|
|
||||||
notification.InvokeAsyncSafe(notification.HideNotification);
|
|
||||||
TriggerKeyboardShortcutAnalytics();
|
|
||||||
return true;
|
|
||||||
|
|
||||||
case Keys.Space:
|
|
||||||
notification.InvokeAsyncSafe(() => notification.FreezeTimer = !notification.FreezeTimer);
|
|
||||||
TriggerKeyboardShortcutAnalytics();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
switch(key){
|
||||||
}
|
case Keys.Enter:
|
||||||
|
notification.InvokeAsyncSafe(notification.FinishCurrentNotification);
|
||||||
|
TriggerKeyboardShortcutAnalytics();
|
||||||
|
return true;
|
||||||
|
|
||||||
bool IKeyboardHandler.OnKeyEvent(IWebBrowser browserControl, IBrowser browser, KeyType type, int windowsKeyCode, int nativeKeyCode, CefEventFlags modifiers, bool isSystemKey){
|
case Keys.Escape:
|
||||||
return false;
|
notification.InvokeAsyncSafe(notification.HideNotification);
|
||||||
|
TriggerKeyboardShortcutAnalytics();
|
||||||
|
return true;
|
||||||
|
|
||||||
|
case Keys.Space:
|
||||||
|
notification.InvokeAsyncSafe(() => notification.FreezeTimer = !notification.FreezeTimer);
|
||||||
|
TriggerKeyboardShortcutAnalytics();
|
||||||
|
return true;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,20 +1,45 @@
|
|||||||
// Uncomment to force TweetDeck to load a predefined version of the vendor/bundle scripts and stylesheets
|
using System;
|
||||||
// #define FREEZE_TWEETDECK_RESOURCES
|
using System.Collections.Generic;
|
||||||
|
|
||||||
using System.Collections.Specialized;
|
using System.Collections.Specialized;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
using CefSharp;
|
using CefSharp;
|
||||||
using CefSharp.Handler;
|
using CefSharp.Handler;
|
||||||
using TweetDuck.Core.Handling.General;
|
using TweetDuck.Core.Handling.General;
|
||||||
using TweetDuck.Core.Utils;
|
using TweetDuck.Core.Utils;
|
||||||
|
|
||||||
#if FREEZE_TWEETDECK_RESOURCES
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Diagnostics;
|
|
||||||
using System.Text.RegularExpressions;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace TweetDuck.Core.Handling{
|
namespace TweetDuck.Core.Handling{
|
||||||
class RequestHandlerBase : DefaultRequestHandler{
|
class RequestHandlerBase : DefaultRequestHandler{
|
||||||
|
private static readonly Regex TweetDeckResourceUrl = new Regex(@"/dist/(.*?)\.(.*?)\.(css|js)$", RegexOptions.Compiled);
|
||||||
|
private static readonly SortedList<string, string> TweetDeckHashes = new SortedList<string, string>(4);
|
||||||
|
|
||||||
|
public static void LoadResourceRewriteRules(string rules){
|
||||||
|
if (string.IsNullOrEmpty(rules)){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
TweetDeckHashes.Clear();
|
||||||
|
|
||||||
|
foreach(string rule in rules.Replace(" ", "").ToLower().Split(',')){
|
||||||
|
string[] split = rule.Split('=');
|
||||||
|
|
||||||
|
if (split.Length == 2){
|
||||||
|
string key = split[0];
|
||||||
|
string hash = split[1];
|
||||||
|
|
||||||
|
if (hash.All(chr => char.IsDigit(chr) || (chr >= 'a' && chr <= 'f'))){
|
||||||
|
TweetDeckHashes.Add(key, hash);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
throw new ArgumentException("Invalid hash characters: "+rule);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
throw new ArgumentException("A rule must have exactly one '=' character: "+rule);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private readonly bool autoReload;
|
private readonly bool autoReload;
|
||||||
|
|
||||||
public RequestHandlerBase(bool autoReload){
|
public RequestHandlerBase(bool autoReload){
|
||||||
@@ -34,34 +59,18 @@ namespace TweetDuck.Core.Handling{
|
|||||||
|
|
||||||
return base.OnBeforeResourceLoad(browserControl, browser, frame, request, callback);
|
return base.OnBeforeResourceLoad(browserControl, browser, frame, request, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnRenderProcessTerminated(IWebBrowser browserControl, IBrowser browser, CefTerminationStatus status){
|
|
||||||
if (autoReload){
|
|
||||||
browser.Reload();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#if FREEZE_TWEETDECK_RESOURCES
|
|
||||||
private static readonly Regex TweetDeckResourceUrl = new Regex(@"/dist/(.*?)\.(.*?)\.(css|js)$", RegexOptions.Compiled);
|
|
||||||
|
|
||||||
private static readonly SortedList<string, string> TweetDeckHashes = new SortedList<string, string>(2){
|
|
||||||
{ "vendor.js", "d897f6b9ed" },
|
|
||||||
{ "bundle.js", "851d3877b9" },
|
|
||||||
{ "vendor.css", "ce7cdd10b6" },
|
|
||||||
{ "bundle.css", "c339f07047" }
|
|
||||||
};
|
|
||||||
|
|
||||||
public override bool OnResourceResponse(IWebBrowser browserControl, IBrowser browser, IFrame frame, IRequest request, IResponse response){
|
public override bool OnResourceResponse(IWebBrowser browserControl, IBrowser browser, IFrame frame, IRequest request, IResponse response){
|
||||||
if (request.ResourceType == ResourceType.Script || request.ResourceType == ResourceType.Stylesheet){
|
if ((request.ResourceType == ResourceType.Script || request.ResourceType == ResourceType.Stylesheet) && TweetDeckHashes.Count > 0){
|
||||||
string url = request.Url;
|
string url = request.Url;
|
||||||
Match match = TweetDeckResourceUrl.Match(url);
|
Match match = TweetDeckResourceUrl.Match(url);
|
||||||
|
|
||||||
if (match.Success && TweetDeckHashes.TryGetValue($"{match.Groups[1]}.{match.Groups[3]}", out string hash)){
|
if (match.Success && TweetDeckHashes.TryGetValue($"{match.Groups[1]}.{match.Groups[3]}", out string hash)){
|
||||||
if (match.Groups[2].Value == hash){
|
if (match.Groups[2].Value == hash){
|
||||||
Debug.WriteLine($"Accepting {url}");
|
Program.Reporter.LogVerbose("[RequestHandlerBase] Accepting " + url);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
Debug.WriteLine($"Rewriting {url} hash to {hash}");
|
Program.Reporter.LogVerbose("[RequestHandlerBase] Replacing " + url + " hash with " + hash);
|
||||||
request.Url = TweetDeckResourceUrl.Replace(url, $"/dist/$1.{hash}.$3");
|
request.Url = TweetDeckResourceUrl.Replace(url, $"/dist/$1.{hash}.$3");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -70,6 +79,11 @@ namespace TweetDuck.Core.Handling{
|
|||||||
|
|
||||||
return base.OnResourceResponse(browserControl, browser, frame, request, response);
|
return base.OnResourceResponse(browserControl, browser, frame, request, response);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
public override void OnRenderProcessTerminated(IWebBrowser browserControl, IBrowser browser, CefTerminationStatus status){
|
||||||
|
if (autoReload){
|
||||||
|
browser.Reload();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -40,7 +40,7 @@ namespace TweetDuck.Core.Management{
|
|||||||
|
|
||||||
if ((process = Process.Start(new ProcessStartInfo{
|
if ((process = Process.Start(new ProcessStartInfo{
|
||||||
FileName = Path.Combine(Program.ProgramPath, "TweetDuck.Video.exe"),
|
FileName = Path.Combine(Program.ProgramPath, "TweetDuck.Video.exe"),
|
||||||
Arguments = $"{owner.Handle} {Config.VideoPlayerVolume} \"{url}\" \"{pipe.GenerateToken()}\"",
|
Arguments = $"{owner.Handle} {(int)Math.Floor(100F*owner.GetDPIScale())} {Config.VideoPlayerVolume} \"{url}\" \"{pipe.GenerateToken()}\"",
|
||||||
UseShellExecute = false,
|
UseShellExecute = false,
|
||||||
RedirectStandardOutput = true
|
RedirectStandardOutput = true
|
||||||
})) != null){
|
})) != null){
|
||||||
@@ -135,7 +135,7 @@ namespace TweetDuck.Core.Management{
|
|||||||
|
|
||||||
private void process_OutputDataReceived(object sender, DataReceivedEventArgs e){
|
private void process_OutputDataReceived(object sender, DataReceivedEventArgs e){
|
||||||
if (!string.IsNullOrEmpty(e.Data)){
|
if (!string.IsNullOrEmpty(e.Data)){
|
||||||
Program.Reporter.Log("[VideoPlayer] "+e.Data);
|
Program.Reporter.LogVerbose("[VideoPlayer] "+e.Data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -33,7 +33,7 @@ namespace TweetDuck.Core.Notification{
|
|||||||
screen = Screen.AllScreens[Config.NotificationDisplay-1];
|
screen = Screen.AllScreens[Config.NotificationDisplay-1];
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
screen = Screen.FromControl(owner);
|
screen = Screen.FromControl(owner); // TODO may be disposed?
|
||||||
}
|
}
|
||||||
|
|
||||||
int edgeDist = Config.NotificationEdgeDistance;
|
int edgeDist = Config.NotificationEdgeDistance;
|
||||||
|
@@ -70,6 +70,7 @@ namespace TweetDuck.Core.Other{
|
|||||||
this.browser = new ChromiumWebBrowser(url){
|
this.browser = new ChromiumWebBrowser(url){
|
||||||
MenuHandler = new ContextMenuGuide(owner),
|
MenuHandler = new ContextMenuGuide(owner),
|
||||||
JsDialogHandler = new JavaScriptDialogHandler(),
|
JsDialogHandler = new JavaScriptDialogHandler(),
|
||||||
|
KeyboardHandler = new KeyboardHandlerBase(),
|
||||||
LifeSpanHandler = new LifeSpanHandler(),
|
LifeSpanHandler = new LifeSpanHandler(),
|
||||||
RequestHandler = new RequestHandlerBase(true),
|
RequestHandler = new RequestHandlerBase(true),
|
||||||
ResourceHandlerFactory = resourceHandlerFactory
|
ResourceHandlerFactory = resourceHandlerFactory
|
||||||
|
10
Program.cs
10
Program.cs
@@ -9,6 +9,7 @@ using System.Threading;
|
|||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using TweetDuck.Configuration;
|
using TweetDuck.Configuration;
|
||||||
using TweetDuck.Core;
|
using TweetDuck.Core;
|
||||||
|
using TweetDuck.Core.Handling;
|
||||||
using TweetDuck.Core.Handling.General;
|
using TweetDuck.Core.Handling.General;
|
||||||
using TweetDuck.Core.Other;
|
using TweetDuck.Core.Other;
|
||||||
using TweetDuck.Core.Management;
|
using TweetDuck.Core.Management;
|
||||||
@@ -20,7 +21,7 @@ namespace TweetDuck{
|
|||||||
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.17.1";
|
public const string VersionTag = "1.17.3";
|
||||||
|
|
||||||
public static readonly string ProgramPath = AppDomain.CurrentDomain.BaseDirectory;
|
public static readonly string ProgramPath = AppDomain.CurrentDomain.BaseDirectory;
|
||||||
public static readonly bool IsPortable = File.Exists(Path.Combine(ProgramPath, "makeportable"));
|
public static readonly bool IsPortable = File.Exists(Path.Combine(ProgramPath, "makeportable"));
|
||||||
@@ -129,6 +130,13 @@ namespace TweetDuck{
|
|||||||
BrowserCache.TryClearNow();
|
BrowserCache.TryClearNow();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try{
|
||||||
|
RequestHandlerBase.LoadResourceRewriteRules(Arguments.GetValue(Arguments.ArgFreeze, null));
|
||||||
|
}catch(Exception e){
|
||||||
|
FormMessage.Error("Resource Freeze", "Error parsing resource rewrite rules: "+e.Message, FormMessage.OK);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
BrowserCache.RefreshTimer();
|
BrowserCache.RefreshTimer();
|
||||||
|
|
||||||
CefSharpSettings.WcfEnabled = false;
|
CefSharpSettings.WcfEnabled = false;
|
||||||
|
@@ -4,6 +4,7 @@ using System.Drawing;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
using TweetDuck.Configuration;
|
||||||
using TweetDuck.Core.Other;
|
using TweetDuck.Core.Other;
|
||||||
|
|
||||||
namespace TweetDuck{
|
namespace TweetDuck{
|
||||||
@@ -22,7 +23,11 @@ namespace TweetDuck{
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Log(string data){
|
public bool LogVerbose(string data){
|
||||||
|
return Arguments.HasFlag(Arguments.ArgLogging) && LogImportant(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool LogImportant(string data){
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
Debug.WriteLine(data);
|
Debug.WriteLine(data);
|
||||||
#endif
|
#endif
|
||||||
@@ -45,7 +50,7 @@ namespace TweetDuck{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void HandleException(string caption, string message, bool canIgnore, Exception e){
|
public void HandleException(string caption, string message, bool canIgnore, Exception e){
|
||||||
bool loggedSuccessfully = Log(e.ToString());
|
bool loggedSuccessfully = LogImportant(e.ToString());
|
||||||
|
|
||||||
string exceptionText = e is ExpandedLogException ? e.Message+"\n\nDetails with potentially sensitive information are in the Error Log." : e.Message;
|
string exceptionText = e is ExpandedLogException ? e.Message+"\n\nDetails with potentially sensitive information are in the Error Log." : e.Message;
|
||||||
FormMessage form = new FormMessage(caption, message+"\nError: "+exceptionText, canIgnore ? MessageBoxIcon.Warning : MessageBoxIcon.Error);
|
FormMessage form = new FormMessage(caption, message+"\nError: "+exceptionText, canIgnore ? MessageBoxIcon.Warning : MessageBoxIcon.Error);
|
||||||
|
@@ -560,7 +560,7 @@
|
|||||||
execSafe(function setupShortenerBypass(){
|
execSafe(function setupShortenerBypass(){
|
||||||
$(document.body).delegate("a[data-full-url]", "click auxclick", function(e){
|
$(document.body).delegate("a[data-full-url]", "click auxclick", function(e){
|
||||||
if (e.button === 0 || e.button === 1){ // event.which seems to be borked in auxclick
|
if (e.button === 0 || e.button === 1){ // event.which seems to be borked in auxclick
|
||||||
$TD.openBrowser($(this).attr("data-full-url"));
|
$TD.openBrowser($(this).attr("data-full-url")); // TODO detect rel="tweet"?
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -755,28 +755,35 @@
|
|||||||
return chirp.getMedia().filter(item => !item.isAnimatedGif).map(item => item.entity.media_url_https+":small").join(";");
|
return chirp.getMedia().filter(item => !item.isAnimatedGif).map(item => item.entity.media_url_https+":small").join(";");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const updateContextInfo = function(chirp){
|
||||||
|
let quote = chirp.quotedTweet;
|
||||||
|
|
||||||
|
if (chirp.chirpType === TD.services.ChirpBase.TWEET){
|
||||||
|
let tweetUrl = chirp.getChirpURL();
|
||||||
|
let quoteUrl = quote && quote.getChirpURL();
|
||||||
|
|
||||||
|
let chirpAuthors = quote ? [ chirp.getMainUser().screenName, quote.getMainUser().screenName ].join(";") : chirp.getMainUser().screenName;
|
||||||
|
let chirpImages = chirp.hasImage() ? processMedia(chirp) : quote && quote.hasImage() ? processMedia(quote) : "";
|
||||||
|
|
||||||
|
$TD.setRightClickedChirp(tweetUrl || "", quoteUrl || "", chirpAuthors, chirpImages);
|
||||||
|
}
|
||||||
|
else if (chirp instanceof TD.services.TwitterActionFollow){
|
||||||
|
$TD.setRightClickedLink("link", chirp.following.getProfileURL());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
app.delegate("section.js-column", {
|
app.delegate("section.js-column", {
|
||||||
contextmenu: function(){
|
contextmenu: function(){
|
||||||
let hovered = getHoveredTweet();
|
let hovered = getHoveredTweet();
|
||||||
return if !hovered;
|
hovered && updateContextInfo(hovered.obj);
|
||||||
|
|
||||||
let tweet = hovered.obj;
|
|
||||||
let quote = tweet.quotedTweet;
|
|
||||||
|
|
||||||
if (tweet.chirpType === TD.services.ChirpBase.TWEET){
|
|
||||||
let tweetUrl = tweet.getChirpURL();
|
|
||||||
let quoteUrl = quote && quote.getChirpURL();
|
|
||||||
|
|
||||||
let chirpAuthors = quote ? [ tweet.getMainUser().screenName, quote.getMainUser().screenName ].join(";") : tweet.getMainUser().screenName;
|
|
||||||
let chirpImages = tweet.hasImage() ? processMedia(tweet) : quote && quote.hasImage() ? processMedia(quote) : "";
|
|
||||||
|
|
||||||
$TD.setRightClickedChirp(tweetUrl || "", quoteUrl || "", chirpAuthors, chirpImages);
|
|
||||||
}
|
|
||||||
else if (tweet instanceof TD.services.TwitterActionFollow){
|
|
||||||
$TD.setRightClickedLink("link", tweet.following.getProfileURL());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (ensurePropertyExists(TD, "services", "TwitterStatus", "prototype", "renderInMediaGallery")){
|
||||||
|
TD.services.TwitterStatus.prototype.renderInMediaGallery = appendToFunction(TD.services.TwitterStatus.prototype.renderInMediaGallery, function(){
|
||||||
|
updateContextInfo(this);
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -1198,6 +1205,8 @@
|
|||||||
//
|
//
|
||||||
execSafe(function setupVideoPlayer(){
|
execSafe(function setupVideoPlayer(){
|
||||||
window.TDGF_playVideo = function(url, username){
|
window.TDGF_playVideo = function(url, username){
|
||||||
|
return if !url;
|
||||||
|
|
||||||
$('<div id="td-video-player-overlay" class="ovl" style="display:block"></div>').on("click contextmenu", function(){
|
$('<div id="td-video-player-overlay" class="ovl" style="display:block"></div>').on("click contextmenu", function(){
|
||||||
$TD.playVideo(null, null);
|
$TD.playVideo(null, null);
|
||||||
}).appendTo(app);
|
}).appendTo(app);
|
||||||
|
@@ -92,6 +92,7 @@
|
|||||||
<DependentUpon>FormBrowser.cs</DependentUpon>
|
<DependentUpon>FormBrowser.cs</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Core\Handling\General\FileDialogHandler.cs" />
|
<Compile Include="Core\Handling\General\FileDialogHandler.cs" />
|
||||||
|
<Compile Include="Core\Handling\KeyboardHandlerBase.cs" />
|
||||||
<Compile Include="Core\Handling\KeyboardHandlerBrowser.cs" />
|
<Compile Include="Core\Handling\KeyboardHandlerBrowser.cs" />
|
||||||
<Compile Include="Core\Handling\KeyboardHandlerNotification.cs" />
|
<Compile Include="Core\Handling\KeyboardHandlerNotification.cs" />
|
||||||
<Compile Include="Core\Handling\RequestHandlerBase.cs" />
|
<Compile Include="Core\Handling\RequestHandlerBase.cs" />
|
||||||
|
@@ -1,17 +1,29 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Threading.Tasks;
|
||||||
using CefSharp.BrowserSubprocess;
|
using CefSharp.BrowserSubprocess;
|
||||||
|
|
||||||
namespace TweetDuck.Browser{
|
namespace TweetDuck.Browser{
|
||||||
static class Program{
|
static class Program{
|
||||||
internal const string Version = "1.4.1.0";
|
internal const string Version = "1.4.2";
|
||||||
|
|
||||||
private static int Main(string[] args){
|
private static int Main(string[] args){
|
||||||
SubProcess.EnableHighDPISupport();
|
SubProcess.EnableHighDPISupport();
|
||||||
|
|
||||||
const string typePrefix = "--type=";
|
string FindArg(string key){
|
||||||
string type = Array.Find(args, arg => arg.StartsWith(typePrefix, StringComparison.OrdinalIgnoreCase)).Substring(typePrefix.Length);
|
return Array.Find(args, arg => arg.StartsWith(key, StringComparison.OrdinalIgnoreCase)).Substring(key.Length);
|
||||||
|
}
|
||||||
|
|
||||||
if (type == "renderer"){
|
const string typePrefix = "--type=";
|
||||||
|
const string parentIdPrefix = "--host-process-id=";
|
||||||
|
|
||||||
|
if (!int.TryParse(FindArg(parentIdPrefix), out int parentId)){
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
Task.Factory.StartNew(() => KillWhenHung(parentId), TaskCreationOptions.LongRunning);
|
||||||
|
|
||||||
|
if (FindArg(typePrefix) == "renderer"){
|
||||||
using(SubProcess subProcess = new SubProcess(args)){
|
using(SubProcess subProcess = new SubProcess(args)){
|
||||||
return subProcess.Run();
|
return subProcess.Run();
|
||||||
}
|
}
|
||||||
@@ -20,5 +32,18 @@ namespace TweetDuck.Browser{
|
|||||||
return SubProcess.ExecuteProcess();
|
return SubProcess.ExecuteProcess();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static async void KillWhenHung(int parentId){
|
||||||
|
try{
|
||||||
|
using(Process process = Process.GetProcessById(parentId)){
|
||||||
|
process.WaitForExit();
|
||||||
|
}
|
||||||
|
}catch{
|
||||||
|
// ded
|
||||||
|
}
|
||||||
|
|
||||||
|
await Task.Delay(10000);
|
||||||
|
Environment.Exit(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -30,7 +30,7 @@ namespace TweetDuck.Video.Controls{
|
|||||||
brushBack.Color = Parent.BackColor;
|
brushBack.Color = Parent.BackColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle rect = e.ClipRectangle;
|
Rectangle rect = new Rectangle(0, 0, Width, Height);
|
||||||
Point cursor = PointToClient(Cursor.Position);
|
Point cursor = PointToClient(Cursor.Position);
|
||||||
int width = rect.Width-1;
|
int width = rect.Width-1;
|
||||||
int progress = (int)(width*((double)Value/Maximum));
|
int progress = (int)(width*((double)Value/Maximum));
|
||||||
|
153
video/FormPlayer.Designer.cs
generated
153
video/FormPlayer.Designer.cs
generated
@@ -26,16 +26,18 @@
|
|||||||
this.components = new System.ComponentModel.Container();
|
this.components = new System.ComponentModel.Container();
|
||||||
this.timerSync = new System.Windows.Forms.Timer(this.components);
|
this.timerSync = new System.Windows.Forms.Timer(this.components);
|
||||||
this.trackBarVolume = new System.Windows.Forms.TrackBar();
|
this.trackBarVolume = new System.Windows.Forms.TrackBar();
|
||||||
this.tablePanel = new System.Windows.Forms.TableLayoutPanel();
|
this.tablePanelFull = new System.Windows.Forms.TableLayoutPanel();
|
||||||
this.progressSeek = new TweetDuck.Video.Controls.SeekBar();
|
this.progressSeek = new TweetDuck.Video.Controls.SeekBar();
|
||||||
this.labelTime = new System.Windows.Forms.Label();
|
this.labelTime = new System.Windows.Forms.Label();
|
||||||
this.timerData = new System.Windows.Forms.Timer(this.components);
|
|
||||||
this.labelTooltip = new TweetDuck.Video.Controls.LabelTooltip();
|
|
||||||
this.imageResize = new System.Windows.Forms.PictureBox();
|
this.imageResize = new System.Windows.Forms.PictureBox();
|
||||||
this.imageDownload = new System.Windows.Forms.PictureBox();
|
this.imageDownload = new System.Windows.Forms.PictureBox();
|
||||||
this.imageClose = new System.Windows.Forms.PictureBox();
|
this.imageClose = new System.Windows.Forms.PictureBox();
|
||||||
|
this.timerData = new System.Windows.Forms.Timer(this.components);
|
||||||
|
this.tablePanelCompactBottom = new System.Windows.Forms.TableLayoutPanel();
|
||||||
|
this.tablePanelCompactTop = new System.Windows.Forms.TableLayoutPanel();
|
||||||
|
this.labelTooltip = new TweetDuck.Video.Controls.LabelTooltip();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.trackBarVolume)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.trackBarVolume)).BeginInit();
|
||||||
this.tablePanel.SuspendLayout();
|
this.tablePanelFull.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.imageResize)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.imageResize)).BeginInit();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.imageDownload)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.imageDownload)).BeginInit();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.imageClose)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.imageClose)).BeginInit();
|
||||||
@@ -64,31 +66,32 @@
|
|||||||
this.trackBarVolume.MouseDown += new System.Windows.Forms.MouseEventHandler(this.trackBarVolume_MouseDown);
|
this.trackBarVolume.MouseDown += new System.Windows.Forms.MouseEventHandler(this.trackBarVolume_MouseDown);
|
||||||
this.trackBarVolume.MouseUp += new System.Windows.Forms.MouseEventHandler(this.trackBarVolume_MouseUp);
|
this.trackBarVolume.MouseUp += new System.Windows.Forms.MouseEventHandler(this.trackBarVolume_MouseUp);
|
||||||
//
|
//
|
||||||
// tablePanel
|
// tablePanelFull
|
||||||
//
|
//
|
||||||
this.tablePanel.BackColor = System.Drawing.SystemColors.Control;
|
this.tablePanelFull.BackColor = System.Drawing.SystemColors.Control;
|
||||||
this.tablePanel.ColumnCount = 6;
|
this.tablePanelFull.ColumnCount = 6;
|
||||||
this.tablePanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 28F));
|
this.tablePanelFull.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 28F));
|
||||||
this.tablePanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
this.tablePanelFull.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
||||||
this.tablePanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 74F));
|
this.tablePanelFull.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 80F));
|
||||||
this.tablePanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 130F));
|
this.tablePanelFull.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 130F));
|
||||||
this.tablePanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 28F));
|
this.tablePanelFull.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 28F));
|
||||||
this.tablePanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 28F));
|
this.tablePanelFull.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 28F));
|
||||||
this.tablePanel.Controls.Add(this.trackBarVolume, 3, 0);
|
this.tablePanelFull.Controls.Add(this.trackBarVolume, 3, 0);
|
||||||
this.tablePanel.Controls.Add(this.progressSeek, 1, 0);
|
this.tablePanelFull.Controls.Add(this.progressSeek, 1, 0);
|
||||||
this.tablePanel.Controls.Add(this.labelTime, 2, 0);
|
this.tablePanelFull.Controls.Add(this.labelTime, 2, 0);
|
||||||
this.tablePanel.Controls.Add(this.imageResize, 5, 0);
|
this.tablePanelFull.Controls.Add(this.imageResize, 5, 0);
|
||||||
this.tablePanel.Controls.Add(this.imageDownload, 4, 0);
|
this.tablePanelFull.Controls.Add(this.imageDownload, 4, 0);
|
||||||
this.tablePanel.Controls.Add(this.imageClose, 0, 0);
|
this.tablePanelFull.Controls.Add(this.imageClose, 0, 0);
|
||||||
this.tablePanel.Dock = System.Windows.Forms.DockStyle.Bottom;
|
this.tablePanelFull.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||||
this.tablePanel.Location = new System.Drawing.Point(0, 86);
|
this.tablePanelFull.Enabled = false;
|
||||||
this.tablePanel.Name = "tablePanel";
|
this.tablePanelFull.Location = new System.Drawing.Point(0, 86);
|
||||||
this.tablePanel.Padding = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
this.tablePanelFull.Name = "tablePanelFull";
|
||||||
this.tablePanel.RowCount = 1;
|
this.tablePanelFull.Padding = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
||||||
this.tablePanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
this.tablePanelFull.RowCount = 1;
|
||||||
this.tablePanel.Size = new System.Drawing.Size(400, 34);
|
this.tablePanelFull.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
||||||
this.tablePanel.TabIndex = 1;
|
this.tablePanelFull.Size = new System.Drawing.Size(400, 34);
|
||||||
this.tablePanel.Visible = false;
|
this.tablePanelFull.TabIndex = 0;
|
||||||
|
this.tablePanelFull.Visible = false;
|
||||||
//
|
//
|
||||||
// progressSeek
|
// progressSeek
|
||||||
//
|
//
|
||||||
@@ -99,7 +102,7 @@
|
|||||||
this.progressSeek.Margin = new System.Windows.Forms.Padding(9, 10, 8, 10);
|
this.progressSeek.Margin = new System.Windows.Forms.Padding(9, 10, 8, 10);
|
||||||
this.progressSeek.Maximum = 5000;
|
this.progressSeek.Maximum = 5000;
|
||||||
this.progressSeek.Name = "progressSeek";
|
this.progressSeek.Name = "progressSeek";
|
||||||
this.progressSeek.Size = new System.Drawing.Size(91, 14);
|
this.progressSeek.Size = new System.Drawing.Size(85, 14);
|
||||||
this.progressSeek.Style = System.Windows.Forms.ProgressBarStyle.Continuous;
|
this.progressSeek.Style = System.Windows.Forms.ProgressBarStyle.Continuous;
|
||||||
this.progressSeek.TabIndex = 0;
|
this.progressSeek.TabIndex = 0;
|
||||||
this.progressSeek.MouseDown += new System.Windows.Forms.MouseEventHandler(this.progressSeek_MouseDown);
|
this.progressSeek.MouseDown += new System.Windows.Forms.MouseEventHandler(this.progressSeek_MouseDown);
|
||||||
@@ -108,31 +111,13 @@
|
|||||||
//
|
//
|
||||||
this.labelTime.Dock = System.Windows.Forms.DockStyle.Fill;
|
this.labelTime.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
this.labelTime.Font = new System.Drawing.Font("Segoe UI", 9F);
|
this.labelTime.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||||
this.labelTime.Location = new System.Drawing.Point(138, 3);
|
this.labelTime.Location = new System.Drawing.Point(132, 3);
|
||||||
this.labelTime.Margin = new System.Windows.Forms.Padding(0, 3, 0, 5);
|
this.labelTime.Margin = new System.Windows.Forms.Padding(0, 3, 0, 5);
|
||||||
this.labelTime.Name = "labelTime";
|
this.labelTime.Name = "labelTime";
|
||||||
this.labelTime.Size = new System.Drawing.Size(74, 26);
|
this.labelTime.Size = new System.Drawing.Size(80, 26);
|
||||||
this.labelTime.TabIndex = 1;
|
this.labelTime.TabIndex = 1;
|
||||||
this.labelTime.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
this.labelTime.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||||
//
|
//
|
||||||
// timerData
|
|
||||||
//
|
|
||||||
this.timerData.Interval = 500;
|
|
||||||
this.timerData.Tick += new System.EventHandler(this.timerData_Tick);
|
|
||||||
//
|
|
||||||
// labelTooltip
|
|
||||||
//
|
|
||||||
this.labelTooltip.AutoSize = true;
|
|
||||||
this.labelTooltip.Font = new System.Drawing.Font("Segoe UI Semibold", 9F, System.Drawing.FontStyle.Bold);
|
|
||||||
this.labelTooltip.ForeColor = System.Drawing.Color.White;
|
|
||||||
this.labelTooltip.Location = new System.Drawing.Point(0, 0);
|
|
||||||
this.labelTooltip.Margin = new System.Windows.Forms.Padding(0, 2, 0, 0);
|
|
||||||
this.labelTooltip.Name = "labelTooltip";
|
|
||||||
this.labelTooltip.Padding = new System.Windows.Forms.Padding(4, 2, 2, 2);
|
|
||||||
this.labelTooltip.Size = new System.Drawing.Size(6, 19);
|
|
||||||
this.labelTooltip.TabIndex = 2;
|
|
||||||
this.labelTooltip.Visible = false;
|
|
||||||
//
|
|
||||||
// imageResize
|
// imageResize
|
||||||
//
|
//
|
||||||
this.imageResize.Cursor = System.Windows.Forms.Cursors.Hand;
|
this.imageResize.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||||
@@ -179,6 +164,66 @@
|
|||||||
this.imageClose.WaitOnLoad = true;
|
this.imageClose.WaitOnLoad = true;
|
||||||
this.imageClose.Click += new System.EventHandler(this.imageClose_Click);
|
this.imageClose.Click += new System.EventHandler(this.imageClose_Click);
|
||||||
//
|
//
|
||||||
|
// timerData
|
||||||
|
//
|
||||||
|
this.timerData.Interval = 500;
|
||||||
|
this.timerData.Tick += new System.EventHandler(this.timerData_Tick);
|
||||||
|
//
|
||||||
|
// tablePanelCompactBottom
|
||||||
|
//
|
||||||
|
this.tablePanelCompactBottom.BackColor = System.Drawing.SystemColors.Control;
|
||||||
|
this.tablePanelCompactBottom.ColumnCount = 5;
|
||||||
|
this.tablePanelCompactBottom.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 28F));
|
||||||
|
this.tablePanelCompactBottom.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
||||||
|
this.tablePanelCompactBottom.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 130F));
|
||||||
|
this.tablePanelCompactBottom.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 28F));
|
||||||
|
this.tablePanelCompactBottom.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 28F));
|
||||||
|
this.tablePanelCompactBottom.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||||
|
this.tablePanelCompactBottom.Enabled = false;
|
||||||
|
this.tablePanelCompactBottom.Location = new System.Drawing.Point(0, 52);
|
||||||
|
this.tablePanelCompactBottom.Margin = new System.Windows.Forms.Padding(3, 0, 3, 3);
|
||||||
|
this.tablePanelCompactBottom.Name = "tablePanelCompactBottom";
|
||||||
|
this.tablePanelCompactBottom.Padding = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
||||||
|
this.tablePanelCompactBottom.RowCount = 1;
|
||||||
|
this.tablePanelCompactBottom.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
||||||
|
this.tablePanelCompactBottom.Size = new System.Drawing.Size(400, 34);
|
||||||
|
this.tablePanelCompactBottom.TabIndex = 1;
|
||||||
|
//
|
||||||
|
// tablePanelCompactTop
|
||||||
|
//
|
||||||
|
this.tablePanelCompactTop.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
|
||||||
|
| System.Windows.Forms.AnchorStyles.Right)));
|
||||||
|
this.tablePanelCompactTop.BackColor = System.Drawing.SystemColors.Control;
|
||||||
|
this.tablePanelCompactTop.ColumnCount = 2;
|
||||||
|
this.tablePanelCompactTop.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
||||||
|
this.tablePanelCompactTop.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 80F));
|
||||||
|
this.tablePanelCompactTop.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
|
||||||
|
this.tablePanelCompactTop.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
|
||||||
|
this.tablePanelCompactTop.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
|
||||||
|
this.tablePanelCompactTop.Enabled = false;
|
||||||
|
this.tablePanelCompactTop.Location = new System.Drawing.Point(0, 60);
|
||||||
|
this.tablePanelCompactTop.Margin = new System.Windows.Forms.Padding(0);
|
||||||
|
this.tablePanelCompactTop.Name = "tablePanelCompactTop";
|
||||||
|
this.tablePanelCompactTop.Padding = new System.Windows.Forms.Padding(2, 0, 4, 0);
|
||||||
|
this.tablePanelCompactTop.RowCount = 1;
|
||||||
|
this.tablePanelCompactTop.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
||||||
|
this.tablePanelCompactTop.Size = new System.Drawing.Size(400, 34);
|
||||||
|
this.tablePanelCompactTop.TabIndex = 2;
|
||||||
|
this.tablePanelCompactTop.Visible = false;
|
||||||
|
//
|
||||||
|
// labelTooltip
|
||||||
|
//
|
||||||
|
this.labelTooltip.AutoSize = true;
|
||||||
|
this.labelTooltip.Font = new System.Drawing.Font("Segoe UI Semibold", 9F, System.Drawing.FontStyle.Bold);
|
||||||
|
this.labelTooltip.ForeColor = System.Drawing.Color.White;
|
||||||
|
this.labelTooltip.Location = new System.Drawing.Point(0, 0);
|
||||||
|
this.labelTooltip.Margin = new System.Windows.Forms.Padding(0, 2, 0, 0);
|
||||||
|
this.labelTooltip.Name = "labelTooltip";
|
||||||
|
this.labelTooltip.Padding = new System.Windows.Forms.Padding(4, 2, 2, 2);
|
||||||
|
this.labelTooltip.Size = new System.Drawing.Size(6, 19);
|
||||||
|
this.labelTooltip.TabIndex = 3;
|
||||||
|
this.labelTooltip.Visible = false;
|
||||||
|
//
|
||||||
// FormPlayer
|
// FormPlayer
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
@@ -187,7 +232,9 @@
|
|||||||
this.ClientSize = new System.Drawing.Size(400, 120);
|
this.ClientSize = new System.Drawing.Size(400, 120);
|
||||||
this.ControlBox = false;
|
this.ControlBox = false;
|
||||||
this.Controls.Add(this.labelTooltip);
|
this.Controls.Add(this.labelTooltip);
|
||||||
this.Controls.Add(this.tablePanel);
|
this.Controls.Add(this.tablePanelCompactBottom);
|
||||||
|
this.Controls.Add(this.tablePanelFull);
|
||||||
|
this.Controls.Add(this.tablePanelCompactTop);
|
||||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
|
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
|
||||||
this.Location = new System.Drawing.Point(-32000, -32000);
|
this.Location = new System.Drawing.Point(-32000, -32000);
|
||||||
this.MaximizeBox = false;
|
this.MaximizeBox = false;
|
||||||
@@ -199,7 +246,7 @@
|
|||||||
this.Text = "TweetDuck Video";
|
this.Text = "TweetDuck Video";
|
||||||
this.Load += new System.EventHandler(this.FormPlayer_Load);
|
this.Load += new System.EventHandler(this.FormPlayer_Load);
|
||||||
((System.ComponentModel.ISupportInitialize)(this.trackBarVolume)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.trackBarVolume)).EndInit();
|
||||||
this.tablePanel.ResumeLayout(false);
|
this.tablePanelFull.ResumeLayout(false);
|
||||||
((System.ComponentModel.ISupportInitialize)(this.imageResize)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.imageResize)).EndInit();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.imageDownload)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.imageDownload)).EndInit();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.imageClose)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.imageClose)).EndInit();
|
||||||
@@ -212,7 +259,7 @@
|
|||||||
|
|
||||||
private System.Windows.Forms.Timer timerSync;
|
private System.Windows.Forms.Timer timerSync;
|
||||||
private System.Windows.Forms.TrackBar trackBarVolume;
|
private System.Windows.Forms.TrackBar trackBarVolume;
|
||||||
private System.Windows.Forms.TableLayoutPanel tablePanel;
|
private System.Windows.Forms.TableLayoutPanel tablePanelFull;
|
||||||
private Controls.SeekBar progressSeek;
|
private Controls.SeekBar progressSeek;
|
||||||
private System.Windows.Forms.Label labelTime;
|
private System.Windows.Forms.Label labelTime;
|
||||||
private System.Windows.Forms.Timer timerData;
|
private System.Windows.Forms.Timer timerData;
|
||||||
@@ -220,6 +267,8 @@
|
|||||||
private System.Windows.Forms.PictureBox imageResize;
|
private System.Windows.Forms.PictureBox imageResize;
|
||||||
private System.Windows.Forms.PictureBox imageDownload;
|
private System.Windows.Forms.PictureBox imageDownload;
|
||||||
private System.Windows.Forms.PictureBox imageClose;
|
private System.Windows.Forms.PictureBox imageClose;
|
||||||
|
private System.Windows.Forms.TableLayoutPanel tablePanelCompactBottom;
|
||||||
|
private System.Windows.Forms.TableLayoutPanel tablePanelCompactTop;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -10,9 +10,17 @@ using WMPLib;
|
|||||||
|
|
||||||
namespace TweetDuck.Video{
|
namespace TweetDuck.Video{
|
||||||
sealed partial class FormPlayer : Form{
|
sealed partial class FormPlayer : Form{
|
||||||
|
private bool IsCursorOverVideo{
|
||||||
|
get{
|
||||||
|
Point cursor = PointToClient(Cursor.Position);
|
||||||
|
return cursor.Y < (tablePanelFull.Enabled ? tablePanelFull.Location.Y : tablePanelCompactTop.Location.Y);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected override bool ShowWithoutActivation => true;
|
protected override bool ShowWithoutActivation => true;
|
||||||
|
|
||||||
private readonly IntPtr ownerHandle;
|
private readonly IntPtr ownerHandle;
|
||||||
|
private readonly float ownerDpi;
|
||||||
private readonly string videoUrl;
|
private readonly string videoUrl;
|
||||||
private readonly DuplexPipe pipe;
|
private readonly DuplexPipe pipe;
|
||||||
|
|
||||||
@@ -23,10 +31,11 @@ namespace TweetDuck.Video{
|
|||||||
|
|
||||||
private WindowsMediaPlayer Player => player.Ocx;
|
private WindowsMediaPlayer Player => player.Ocx;
|
||||||
|
|
||||||
public FormPlayer(IntPtr handle, int volume, string url, string token){
|
public FormPlayer(IntPtr handle, int dpi, int volume, string url, string token){
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
this.ownerHandle = handle;
|
this.ownerHandle = handle;
|
||||||
|
this.ownerDpi = dpi / 100F;
|
||||||
this.videoUrl = url;
|
this.videoUrl = url;
|
||||||
this.pipe = DuplexPipe.CreateClient(token);
|
this.pipe = DuplexPipe.CreateClient(token);
|
||||||
this.pipe.DataIn += pipe_DataIn;
|
this.pipe.DataIn += pipe_DataIn;
|
||||||
@@ -78,6 +87,59 @@ namespace TweetDuck.Video{
|
|||||||
Application.AddMessageFilter(new MessageFilter(this));
|
Application.AddMessageFilter(new MessageFilter(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Layout
|
||||||
|
|
||||||
|
private int DpiScaled(int value){
|
||||||
|
return (int)Math.Round(value*ownerDpi);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void RefreshControlPanel(){
|
||||||
|
bool useCompactLayout = ClientSize.Width < DpiScaled(480);
|
||||||
|
bool needsUpdate = !timerSync.Enabled || (useCompactLayout ? tablePanelFull.Enabled : tablePanelCompactBottom.Enabled);
|
||||||
|
|
||||||
|
if (needsUpdate){
|
||||||
|
void Disable(TableLayoutPanel panel){
|
||||||
|
panel.Controls.Clear();
|
||||||
|
panel.Visible = false;
|
||||||
|
panel.Enabled = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
tablePanelFull.SuspendLayout();
|
||||||
|
tablePanelCompactBottom.SuspendLayout();
|
||||||
|
tablePanelCompactTop.SuspendLayout();
|
||||||
|
|
||||||
|
if (useCompactLayout){
|
||||||
|
Disable(tablePanelFull);
|
||||||
|
|
||||||
|
tablePanelCompactBottom.Enabled = true;
|
||||||
|
tablePanelCompactBottom.Controls.Add(imageClose, 0, 0);
|
||||||
|
tablePanelCompactBottom.Controls.Add(trackBarVolume, 2, 0);
|
||||||
|
tablePanelCompactBottom.Controls.Add(imageDownload, 3, 0);
|
||||||
|
tablePanelCompactBottom.Controls.Add(imageResize, 4, 0);
|
||||||
|
|
||||||
|
tablePanelCompactTop.Enabled = true;
|
||||||
|
tablePanelCompactTop.Controls.Add(progressSeek, 0, 0);
|
||||||
|
tablePanelCompactTop.Controls.Add(labelTime, 1, 0);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
Disable(tablePanelCompactBottom);
|
||||||
|
Disable(tablePanelCompactTop);
|
||||||
|
|
||||||
|
tablePanelFull.Enabled = true;
|
||||||
|
tablePanelFull.Controls.Add(imageClose, 0, 0);
|
||||||
|
tablePanelFull.Controls.Add(progressSeek, 1, 0);
|
||||||
|
tablePanelFull.Controls.Add(labelTime, 2, 0);
|
||||||
|
tablePanelFull.Controls.Add(trackBarVolume, 3, 0);
|
||||||
|
tablePanelFull.Controls.Add(imageDownload, 4, 0);
|
||||||
|
tablePanelFull.Controls.Add(imageResize, 5, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
tablePanelFull.ResumeLayout();
|
||||||
|
tablePanelCompactBottom.ResumeLayout();
|
||||||
|
tablePanelCompactTop.ResumeLayout();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Events
|
// Events
|
||||||
|
|
||||||
private void FormPlayer_Load(object sender, EventArgs e){
|
private void FormPlayer_Load(object sender, EventArgs e){
|
||||||
@@ -107,12 +169,12 @@ namespace TweetDuck.Video{
|
|||||||
else if (state == WMPPlayState.wmppsPlaying){
|
else if (state == WMPPlayState.wmppsPlaying){
|
||||||
Player.PlayStateChange -= player_PlayStateChange;
|
Player.PlayStateChange -= player_PlayStateChange;
|
||||||
|
|
||||||
timerSync.Start();
|
|
||||||
NativeMethods.SetWindowOwner(Handle, ownerHandle);
|
NativeMethods.SetWindowOwner(Handle, ownerHandle);
|
||||||
Cursor.Current = Cursors.Default;
|
Cursor.Current = Cursors.Default;
|
||||||
|
|
||||||
SuspendLayout();
|
SuspendLayout();
|
||||||
timerSync_Tick(timerSync, EventArgs.Empty);
|
timerSync_Tick(timerSync, EventArgs.Empty);
|
||||||
|
timerSync.Start();
|
||||||
Opacity = 1;
|
Opacity = 1;
|
||||||
ResumeLayout(true);
|
ResumeLayout(true);
|
||||||
}
|
}
|
||||||
@@ -138,26 +200,30 @@ namespace TweetDuck.Video{
|
|||||||
int ownerWidth = rect.Right-rect.Left+1;
|
int ownerWidth = rect.Right-rect.Left+1;
|
||||||
int ownerHeight = rect.Bottom-rect.Top+1;
|
int ownerHeight = rect.Bottom-rect.Top+1;
|
||||||
|
|
||||||
// roughly matches MinimumSize for client bounds
|
// roughly matches MinimumSize for client bounds, adjusted a bit for weirdness with higher DPI
|
||||||
const int minWidth = 334;
|
int minWidth = DpiScaled(356);
|
||||||
const int minHeight = 388;
|
int minHeight = DpiScaled(386);
|
||||||
|
|
||||||
int maxWidth = Math.Min(media.imageSourceWidth, ownerWidth*3/4);
|
if (NativeMethods.GetClientRect(ownerHandle, out NativeMethods.RECT clientSize)){
|
||||||
int maxHeight = Math.Min(media.imageSourceHeight, ownerHeight*3/4);
|
minWidth = Math.Min(minWidth, clientSize.Right);
|
||||||
|
minHeight = Math.Min(minHeight, clientSize.Bottom);
|
||||||
|
}
|
||||||
|
|
||||||
|
int maxWidth = Math.Min(DpiScaled(media.imageSourceWidth), ownerWidth*3/4);
|
||||||
|
int maxHeight = Math.Min(DpiScaled(media.imageSourceHeight), ownerHeight*3/4);
|
||||||
|
|
||||||
bool isCursorInside = ClientRectangle.Contains(PointToClient(Cursor.Position));
|
bool isCursorInside = ClientRectangle.Contains(PointToClient(Cursor.Position));
|
||||||
|
|
||||||
Size newSize = new Size(Math.Max(minWidth, maxWidth), Math.Max(minHeight, maxHeight));
|
Size newSize = new Size(Math.Max(minWidth+2, maxWidth), Math.Max(minHeight+2, maxHeight));
|
||||||
Point newLocation = new Point(ownerLeft+(ownerWidth-newSize.Width)/2, ownerTop+(ownerHeight-newSize.Height+SystemInformation.CaptionHeight)/2);
|
Point newLocation = new Point(ownerLeft+(ownerWidth-newSize.Width)/2, ownerTop+(ownerHeight-newSize.Height+SystemInformation.CaptionHeight)/2);
|
||||||
|
|
||||||
if (ClientSize != newSize || Location != newLocation){
|
if (ClientSize != newSize || Location != newLocation){
|
||||||
ClientSize = newSize;
|
ClientSize = newSize;
|
||||||
Location = newLocation;
|
Location = newLocation;
|
||||||
|
RefreshControlPanel();
|
||||||
}
|
}
|
||||||
|
|
||||||
tablePanel.Visible = isCursorInside || isDragging;
|
if (isCursorInside || isDragging){
|
||||||
|
|
||||||
if (tablePanel.Visible){
|
|
||||||
labelTime.Text = $"{controls.currentPositionString} / {media.durationString}";
|
labelTime.Text = $"{controls.currentPositionString} / {media.durationString}";
|
||||||
|
|
||||||
int value = (int)Math.Round(progressSeek.Maximum*controls.currentPosition/media.duration);
|
int value = (int)Math.Round(progressSeek.Maximum*controls.currentPosition/media.duration);
|
||||||
@@ -171,6 +237,19 @@ namespace TweetDuck.Video{
|
|||||||
progressSeek.Value = value+1;
|
progressSeek.Value = value+1;
|
||||||
progressSeek.Value = value;
|
progressSeek.Value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (tablePanelFull.Enabled){
|
||||||
|
tablePanelFull.Visible = true;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
tablePanelCompactBottom.Visible = true;
|
||||||
|
tablePanelCompactTop.Visible = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
tablePanelFull.Visible = false;
|
||||||
|
tablePanelCompactBottom.Visible = false;
|
||||||
|
tablePanelCompactTop.Visible = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (controls.currentPosition > media.duration){ // pausing near the end of the video causes WMP to play beyond the end of the video wtf
|
if (controls.currentPosition > media.duration){ // pausing near the end of the video causes WMP to play beyond the end of the video wtf
|
||||||
@@ -186,6 +265,10 @@ namespace TweetDuck.Video{
|
|||||||
|
|
||||||
if (isCursorInside && !wasCursorInside){
|
if (isCursorInside && !wasCursorInside){
|
||||||
wasCursorInside = true;
|
wasCursorInside = true;
|
||||||
|
|
||||||
|
if (IsCursorOverVideo){
|
||||||
|
Cursor.Current = Cursors.Default;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (!isCursorInside && wasCursorInside){
|
else if (!isCursorInside && wasCursorInside){
|
||||||
wasCursorInside = false;
|
wasCursorInside = false;
|
||||||
@@ -302,26 +385,19 @@ namespace TweetDuck.Video{
|
|||||||
internal sealed class MessageFilter : IMessageFilter{
|
internal sealed class MessageFilter : IMessageFilter{
|
||||||
private readonly FormPlayer form;
|
private readonly FormPlayer form;
|
||||||
|
|
||||||
private bool IsCursorOverVideo{
|
|
||||||
get{
|
|
||||||
Point cursor = form.PointToClient(Cursor.Position);
|
|
||||||
return cursor.Y < form.tablePanel.Location.Y;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public MessageFilter(FormPlayer form){
|
public MessageFilter(FormPlayer form){
|
||||||
this.form = form;
|
this.form = form;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IMessageFilter.PreFilterMessage(ref Message m){
|
bool IMessageFilter.PreFilterMessage(ref Message m){
|
||||||
if (m.Msg == 0x0201){ // WM_LBUTTONDOWN
|
if (m.Msg == 0x0201){ // WM_LBUTTONDOWN
|
||||||
if (IsCursorOverVideo){
|
if (form.IsCursorOverVideo){
|
||||||
form.TogglePause();
|
form.TogglePause();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (m.Msg == 0x0203){ // WM_LBUTTONDBLCLK
|
else if (m.Msg == 0x0203){ // WM_LBUTTONDBLCLK
|
||||||
if (IsCursorOverVideo){
|
if (form.IsCursorOverVideo){
|
||||||
form.TogglePause();
|
form.TogglePause();
|
||||||
form.Player.fullScreen = !form.Player.fullScreen;
|
form.Player.fullScreen = !form.Player.fullScreen;
|
||||||
return true;
|
return true;
|
||||||
|
@@ -9,6 +9,10 @@ namespace TweetDuck.Video{
|
|||||||
[return: MarshalAs(UnmanagedType.Bool)]
|
[return: MarshalAs(UnmanagedType.Bool)]
|
||||||
public static extern bool GetWindowRect(IntPtr hWnd, out RECT lpRect);
|
public static extern bool GetWindowRect(IntPtr hWnd, out RECT lpRect);
|
||||||
|
|
||||||
|
[DllImport("user32.dll")]
|
||||||
|
[return: MarshalAs(UnmanagedType.Bool)]
|
||||||
|
public static extern bool GetClientRect(IntPtr hWnd, out RECT lpRect);
|
||||||
|
|
||||||
[DllImport("user32.dll")]
|
[DllImport("user32.dll")]
|
||||||
private static extern int SetWindowLong(IntPtr hWnd, int nIndex, IntPtr dwNewLong);
|
private static extern int SetWindowLong(IntPtr hWnd, int nIndex, IntPtr dwNewLong);
|
||||||
|
|
||||||
|
@@ -5,7 +5,7 @@ using System.Windows.Forms;
|
|||||||
|
|
||||||
namespace TweetDuck.Video{
|
namespace TweetDuck.Video{
|
||||||
static class Program{
|
static class Program{
|
||||||
internal const string Version = "1.4";
|
internal const string Version = "1.4.2";
|
||||||
|
|
||||||
// referenced in VideoPlayer
|
// referenced in VideoPlayer
|
||||||
// set by task manager -- public const int CODE_PROCESS_KILLED = 1;
|
// set by task manager -- public const int CODE_PROCESS_KILLED = 1;
|
||||||
@@ -25,21 +25,23 @@ namespace TweetDuck.Video{
|
|||||||
CultureInfo.DefaultThreadCurrentCulture = CultureInfo.InvariantCulture;
|
CultureInfo.DefaultThreadCurrentCulture = CultureInfo.InvariantCulture;
|
||||||
|
|
||||||
IntPtr ownerHandle;
|
IntPtr ownerHandle;
|
||||||
|
int ownerDpi;
|
||||||
int defaultVolume;
|
int defaultVolume;
|
||||||
string videoUrl;
|
string videoUrl;
|
||||||
string pipeToken;
|
string pipeToken;
|
||||||
|
|
||||||
try{
|
try{
|
||||||
ownerHandle = new IntPtr(int.Parse(args[0], NumberStyles.Integer));
|
ownerHandle = new IntPtr(int.Parse(args[0], NumberStyles.Integer));
|
||||||
defaultVolume = int.Parse(args[1], NumberStyles.Integer);
|
ownerDpi = int.Parse(args[1], NumberStyles.Integer);
|
||||||
videoUrl = new Uri(args[2], UriKind.Absolute).AbsoluteUri;
|
defaultVolume = int.Parse(args[2], NumberStyles.Integer);
|
||||||
pipeToken = args[3];
|
videoUrl = new Uri(args[3], UriKind.Absolute).AbsoluteUri;
|
||||||
|
pipeToken = args[4];
|
||||||
}catch{
|
}catch{
|
||||||
return CODE_INVALID_ARGS;
|
return CODE_INVALID_ARGS;
|
||||||
}
|
}
|
||||||
|
|
||||||
try{
|
try{
|
||||||
Application.Run(new FormPlayer(ownerHandle, defaultVolume, videoUrl, pipeToken));
|
Application.Run(new FormPlayer(ownerHandle, ownerDpi, defaultVolume, videoUrl, pipeToken));
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
Console.Out.WriteLine(e);
|
Console.Out.WriteLine(e);
|
||||||
return CODE_LAUNCH_FAIL;
|
return CODE_LAUNCH_FAIL;
|
||||||
|
Reference in New Issue
Block a user