1
0
mirror of https://github.com/chylex/TweetDuck.git synced 2025-05-24 23:34:05 +02:00

Fix source code indentation problems

This commit is contained in:
chylex 2021-12-17 00:58:38 +01:00
parent d9782f554f
commit b18cd2658c
Signed by: chylex
GPG Key ID: 4DE42C8F19A80548
3 changed files with 43 additions and 42 deletions
Browser/Notification/Screenshot
Management

View File

@ -24,10 +24,10 @@ sealed class TweetScreenshotManager : IDisposable {
private readonly Timer disposer; private readonly Timer disposer;
#if GEN_SCREENSHOT_FRAMES #if GEN_SCREENSHOT_FRAMES
private readonly Timer debugger; private readonly Timer debugger;
private int frameCounter; private int frameCounter;
public const int WaitFrames = 60; public const int WaitFrames = 60;
#else #else
public const int WaitFrames = 5; public const int WaitFrames = 5;
#endif #endif
@ -45,8 +45,8 @@ public TweetScreenshotManager(FormBrowser owner, PluginManager pluginManager) {
this.disposer.Tick += disposer_Tick; this.disposer.Tick += disposer_Tick;
#if GEN_SCREENSHOT_FRAMES #if GEN_SCREENSHOT_FRAMES
this.debugger = new Timer{ Interval = 16 }; this.debugger = new Timer{ Interval = 16 };
this.debugger.Tick += debugger_Tick; this.debugger.Tick += debugger_Tick;
#endif #endif
} }
@ -71,7 +71,7 @@ public void Trigger(string html, int width) {
timeout.Start(); timeout.Start();
#if GEN_SCREENSHOT_FRAMES #if GEN_SCREENSHOT_FRAMES
StartDebugger(); StartDebugger();
#endif #endif
#if !NO_HIDE_SCREENSHOTS #if !NO_HIDE_SCREENSHOTS
@ -90,14 +90,14 @@ private void Callback() {
#if !NO_HIDE_SCREENSHOTS #if !NO_HIDE_SCREENSHOTS
OnFinished(); OnFinished();
#else #else
screenshot.MoveToVisibleLocation(); screenshot.MoveToVisibleLocation();
screenshot.FormClosed += (sender, args) => disposer.Start(); screenshot.FormClosed += (sender, args) => disposer.Start();
#endif #endif
} }
private void OnFinished() { private void OnFinished() {
#if GEN_SCREENSHOT_FRAMES #if GEN_SCREENSHOT_FRAMES
debugger.Stop(); debugger.Stop();
#endif #endif
screenshot.Location = ControlExtensions.InvisibleLocation; screenshot.Location = ControlExtensions.InvisibleLocation;
@ -107,7 +107,7 @@ private void OnFinished() {
public void Dispose() { public void Dispose() {
#if GEN_SCREENSHOT_FRAMES #if GEN_SCREENSHOT_FRAMES
debugger.Dispose(); debugger.Dispose();
#endif #endif
timeout.Dispose(); timeout.Dispose();
@ -116,32 +116,32 @@ public void Dispose() {
} }
#if GEN_SCREENSHOT_FRAMES #if GEN_SCREENSHOT_FRAMES
private static readonly string DebugScreenshotPath = Path.Combine(Program.StoragePath, "TD_Screenshots"); private static readonly string DebugScreenshotPath = Path.Combine(Program.StoragePath, "TD_Screenshots");
private void StartDebugger(){ private void StartDebugger(){
frameCounter = 0; frameCounter = 0;
try{ try{
Directory.Delete(DebugScreenshotPath, true); Directory.Delete(DebugScreenshotPath, true);
WindowsUtils.TrySleepUntil(() => !Directory.Exists(DebugScreenshotPath), 1000, 10); WindowsUtils.TrySleepUntil(() => !Directory.Exists(DebugScreenshotPath), 1000, 10);
}catch(DirectoryNotFoundException){} }catch(DirectoryNotFoundException){}
Directory.CreateDirectory(DebugScreenshotPath);
debugger.Start();
}
private void debugger_Tick(object sender, EventArgs e){ Directory.CreateDirectory(DebugScreenshotPath);
if (frameCounter < 63 && screenshot.TakeScreenshot(true)){ debugger.Start();
try{ }
Clipboard.GetImage()?.Save(Path.Combine(DebugScreenshotPath, "frame_" + (++frameCounter) + ".png"), ImageFormat.Png);
}catch{ private void debugger_Tick(object sender, EventArgs e){
System.Diagnostics.Debug.WriteLine("Failed generating frame " + frameCounter); if (frameCounter < 63 && screenshot.TakeScreenshot(true)){
} try{
} Clipboard.GetImage()?.Save(Path.Combine(DebugScreenshotPath, "frame_" + (++frameCounter) + ".png"), ImageFormat.Png);
else{ }catch{
debugger.Stop(); System.Diagnostics.Debug.WriteLine("Failed generating frame " + frameCounter);
} }
} }
else{
debugger.Stop();
}
}
#endif #endif
} }
} }

View File

@ -19,7 +19,7 @@ sealed class AnalyticsManager : IDisposable {
private static readonly Uri CollectionUrl = new Uri( private static readonly Uri CollectionUrl = new Uri(
#if (DEBUG && ANALYTICS_LOCALHOST) #if (DEBUG && ANALYTICS_LOCALHOST)
"http://localhost/newhome/tweetduck/~breadcrumb/request.php?type=report" "http://localhost/newhome/tweetduck/~breadcrumb/request.php?type=report"
#else #else
"https://tweetduck.chylex.com/breadcrumb/report" "https://tweetduck.chylex.com/breadcrumb/report"
#endif #endif
@ -52,7 +52,7 @@ public AnalyticsManager(FormBrowser browser, PluginManager plugins, string file)
} }
#if (DEBUG && ANALYTICS_INSTANT) #if (DEBUG && ANALYTICS_INSTANT)
SendReport(); SendReport();
#endif #endif
} }

View File

@ -37,14 +37,15 @@ public void Launch(string videoUrl, string tweetUrl, string username) {
DuplexPipe.Server pipe = DuplexPipe.CreateServer(); DuplexPipe.Server pipe = DuplexPipe.CreateServer();
pipe.DataIn += pipe_DataIn; pipe.DataIn += pipe_DataIn;
Process process; ProcessStartInfo startInfo = new ProcessStartInfo {
FileName = Path.Combine(Program.ProgramPath, "TweetDuck.Video.exe"),
Arguments = $"{owner.Handle} {(int) Math.Floor(100F * owner.GetDPIScale())} {Config.VideoPlayerVolume} \"{videoUrl}\" \"{pipe.GenerateToken()}\"",
UseShellExecute = false,
RedirectStandardOutput = true
};
if ((process = Process.Start(new ProcessStartInfo { Process process;
FileName = Path.Combine(Program.ProgramPath, "TweetDuck.Video.exe"), if ((process = Process.Start(startInfo)) != null) {
Arguments = $"{owner.Handle} {(int) Math.Floor(100F * owner.GetDPIScale())} {Config.VideoPlayerVolume} \"{videoUrl}\" \"{pipe.GenerateToken()}\"",
UseShellExecute = false,
RedirectStandardOutput = true
})) != null) {
currentInstance = new Instance(process, pipe, videoUrl, tweetUrl, username); currentInstance = new Instance(process, pipe, videoUrl, tweetUrl, username);
process.EnableRaisingEvents = true; process.EnableRaisingEvents = true;