Example #1
0
 /// <summary>
 /// This is called by the host when current configuration must be closed.
 /// </summary>
 void OnConfigurationClosing(object sender, ConfiguredRouteHost <HandlerBase, IChannel> .ConfigurationClosingEventArgs e)
 {
     if (e.IsDisposed)
     {
         _dispatcher.Dispose();
     }
     else
     {
         lock (_bufferingChannel.FlushLock) _bufferingChannel.EnsureActive();
     }
     SignalConfigurationChanged();
 }
Example #2
0
        static void Main(string[] args)
        {
            LoggingSingleton.Instance.LogToFile   = true;
            LoggingSingleton.Instance.LogToStdout = true;

            RestSettings.Instance.ServerIP   = "192.168.186.104";
            RestSettings.Instance.ServerPort = 81;
            RestSettings.Instance.AppID      = "app";

            bool needExit = false;

            //////////////////////////////////////////////////////////////////////
            /// Disconnect any existing event handlers...
            ///
            EventDispatcher <MyCall> .DisconnectAllEventHandlers();

            //////////////////////////////////////////////////////////////////////
            /// Create a new event handler...
            ///
            EventDispatcher <MyCall> ev = new EventDispatcher <MyCall>()
            {
                DeleteAllCallsOnConnect = true
            };

            ev.Start();

            while (!needExit)
            {
                ConsoleKeyInfo info = Console.ReadKey(true);

                switch (info.KeyChar)
                {
                case 'g':
                case 'G':
                    CallDispatcher <MyCall> .Instance.GetCalls();

                    break;

                case 'x':
                case 'X':
                    needExit = true;
                    break;
                }

                Thread.Sleep(10);
            }

            ev.Stop();
            ev.WaitForStop();

            ev.Dispose();
            ev = null;
        }
Example #3
0
 public void Dispose()
 {
     dispatcher.Dispose();
 }
        /// <summary>
        ///		Call this in your engine's Program.Main method.
        /// </summary>
        /// <param name="args"></param>
        /// <returns></returns>
        public int Main(string[] args)
        {
            RootCommand rootCommand = new RootCommand
            {
                //We got a lot of arguments
                new Option <string>("-initial-url",
                                    () => "https://voltstro.dev",
                                    "The initial URL"),

                new Option <int>("-width",
                                 () => 1920,
                                 "The width of the window"),
                new Option <int>("-height",
                                 () => 1080,
                                 "The height of the window"),

                new Option <bool>("-javascript",
                                  () => true,
                                  "Enable or disable javascript"),

                new Option <bool>("-web-rtc",
                                  () => false,
                                  "Enable or disable web RTC"),

                new Option <int>("-remote-debugging",
                                 () => 0,
                                 "Some browser engines may have remote debugging"),

                new Option <byte>("-bcr",
                                  () => 255,
                                  "Background color (red)"),
                new Option <byte>("-bcg",
                                  () => 255,
                                  "Background color (green)"),
                new Option <byte>("-bcb",
                                  () => 255,
                                  "Background color (blue)"),
                new Option <byte>("-bca",
                                  () => 255,
                                  "Background color (alpha)"),

                new Option <FileInfo>("-cache-path",
                                      () => null,
                                      "The path to the cache (null for no cache)"),

                new Option <bool>("-proxy-server",
                                  () => true,
                                  "Use a proxy server or direct connect"),
                new Option <string>("-proxy-username",
                                    () => null,
                                    "The username to use in proxy auth"),
                new Option <string>("-proxy-password",
                                    () => null,
                                    "The proxy auth password"),

                new Option <int>("-in-port",
                                 () => 5555,
                                 "IPC port"),
                new Option <int>("-out-port",
                                 () => 5556,
                                 "IPC port"),

                new Option <FileInfo>("-log-path",
                                      () => new FileInfo("cef.log"),
                                      "The path to where the CEF log will be"),
                new Option <LogSeverity>("-log-severity",
                                         () => LogSeverity.Info,
                                         "The path to where the CEF log will be")
            };

            rootCommand.Description = "Process for windowless CEF rendering.";
            //Some browser engines will launch multiple processes from the same process, they will most likely use custom arguments
            rootCommand.TreatUnmatchedTokensAsErrors = false;
            rootCommand.Handler = CommandHandler.Create <LaunchArguments>(parsedArgs =>
            {
                //Is debug log enabled or not
                Logger.DebugLog = parsedArgs.LogSeverity == LogSeverity.Debug;

                //Run the entry point
                EntryPoint(parsedArgs, args);

                //We might get disposed here
                if (isDisposed)
                {
                    return;
                }

                //Setup the events replier
                eventReplier = new EventReplier <EngineActionEvent, EngineActionResponse>(parsedArgs.InPort, OnEvent);

                //Setup event dispatcher
                eventDispatcher = new EventDispatcher <EngineEvent, EngineEventResponse>(new TimeSpan(0, 0, 0, 4), parsedArgs.OutPort);
                eventDispatcher.StartDispatchingEvents();

                eventReplier.HandleEventsLoop();

                eventReplier.Dispose();
                eventDispatcher.Dispose();
            });
            //Invoke the command line parser and start the handler (the stuff above)
            return(rootCommand.Invoke(args));
        }
Example #5
0
        static void Main(string[] args)
        {
            LoggingSingleton.Instance.LogToFile   = true;
             LoggingSingleton.Instance.LogToStdout = true;

             RestSettings.Instance.ServerIP   = "192.168.186.104";
             RestSettings.Instance.ServerPort = 81;
             RestSettings.Instance.AppID      = "app";

             bool needExit = false;

             //////////////////////////////////////////////////////////////////////
             /// Disconnect any existing event handlers...
             ///
             EventDispatcher<MyCall>.DisconnectAllEventHandlers();

             //////////////////////////////////////////////////////////////////////
             /// Create a new event handler...
             ///
             EventDispatcher<MyCall> ev = new EventDispatcher<MyCall>() { DeleteAllCallsOnConnect = true };

             ev.Start();

             while (!needExit)
             {
            ConsoleKeyInfo info = Console.ReadKey(true);

            switch (info.KeyChar)
            {
               case 'g':
               case 'G':
                  CallDispatcher<MyCall>.Instance.GetCalls();
                  break;

               case 'x':
               case 'X':
                  needExit = true;
                  break;
            }

            Thread.Sleep(10);
             }

             ev.Stop();
             ev.WaitForStop();

             ev.Dispose();
             ev = null;
        }