mirror of
https://github.com/chylex/TweetDuck.git
synced 2024-11-13 05:42:48 +01:00
39 lines
1.3 KiB
C#
39 lines
1.3 KiB
C#
using System;
|
|
using System.Diagnostics;
|
|
using CefSharp;
|
|
using CefSharp.BrowserSubprocess;
|
|
using TweetLib.Communication;
|
|
|
|
namespace TweetDuck.Browser{
|
|
static class Program{
|
|
internal const string Version = "1.2.0.0";
|
|
|
|
private static int Main(string[] args){
|
|
SubProcess.EnableHighDPISupport();
|
|
|
|
const string typePrefix = "--type=";
|
|
string type = Array.Find(args, arg => arg.StartsWith(typePrefix, StringComparison.OrdinalIgnoreCase)).Substring(typePrefix.Length);
|
|
|
|
if (type == "renderer"){
|
|
using(RendererProcess subProcess = new RendererProcess(args)){
|
|
return subProcess.Run();
|
|
}
|
|
}
|
|
else return SubProcess.ExecuteProcess();
|
|
}
|
|
|
|
private sealed class RendererProcess : SubProcess{
|
|
// ReSharper disable once ParameterTypeCanBeEnumerable.Local
|
|
public RendererProcess(string[] args) : base(args){}
|
|
|
|
public override void OnBrowserCreated(CefBrowserWrapper wrapper){
|
|
base.OnBrowserCreated(wrapper);
|
|
|
|
using(Process me = Process.GetCurrentProcess()){
|
|
Comms.BroadcastMessage(Comms.RegisterMessage("TweetDuckSubProcess"), (uint)me.Id, wrapper.BrowserId);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|