コード例 #1
0
ファイル: EntryPoint.cs プロジェクト: Aida-Enna/Dalamud
        public void Run(RemoteHooking.IContext ctx, DalamudStartInfo info)
        {
            // Setup logger
            Log.Logger = NewLogger(info.WorkingDirectory);

            try {
                Log.Information("Initializing a session..");

                // This is due to GitHub not supporting TLS 1.0, so we enable all TLS versions globally
                System.Net.ServicePointManager.SecurityProtocol =
                    SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12 | SecurityProtocolType.Tls | SecurityProtocolType.Ssl3;

                // Log any unhandled exception.
                AppDomain.CurrentDomain.UnhandledException += OnUnhandledException;

                using (var dalamud = new Dalamud(info)) {
                    Log.Information("Starting a session..");

                    // Run session
                    dalamud.Start();
                    dalamud.WaitForUnload();
                }
            } catch (Exception ex) {
                Log.Fatal(ex, "Unhandled exception on main thread.");
            } finally {
                AppDomain.CurrentDomain.UnhandledException -= OnUnhandledException;

                Log.Information("Session has ended.");
                Log.CloseAndFlush();
            }
        }
コード例 #2
0
        public void Run(RemoteHooking.IContext ctx, DalamudStartInfo info)
        {
            // Setup logger
            Log.Logger = NewLogger(info.WorkingDirectory);

            try {
                Log.Information("Initializing a session..");

                // Log any unhandled exception.
                AppDomain.CurrentDomain.UnhandledException += OnUnhandledException;

                using (var dalamud = new Dalamud(info)) {
                    Log.Information("Starting a session..");

                    // Run session
                    dalamud.Start();
                    dalamud.WaitForUnload();
                }
            } catch (Exception ex) {
                Log.Fatal(ex, "Unhandled exception on main thread.");
            } finally {
                AppDomain.CurrentDomain.UnhandledException -= OnUnhandledException;

                Log.Information("Session has ended.");
                Log.CloseAndFlush();
            }
        }
コード例 #3
0
        /// <summary>
        /// Initialize all Dalamud subsystems and start running on the main thread.
        /// </summary>
        /// <param name="ctx">The <see cref="RemoteHooking.IContext"/> used to load the DLL.</param>
        /// <param name="info">The <see cref="DalamudStartInfo"/> containing information needed to initialize Dalamud.</param>
        public void Run(RemoteHooking.IContext ctx, DalamudStartInfo info)
        {
            // Setup logger
            var(logger, levelSwitch) = this.NewLogger(info.WorkingDirectory);
            Log.Logger = logger;

            var finishSignal = new ManualResetEvent(false);

            try
            {
                Log.Information(new string('-', 80));
                Log.Information("Initializing a session..");

                // This is due to GitHub not supporting TLS 1.0, so we enable all TLS versions globally
                System.Net.ServicePointManager.SecurityProtocol =
                    SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12 | SecurityProtocolType.Tls | SecurityProtocolType.Ssl3;

                // Log any unhandled exception.
                AppDomain.CurrentDomain.UnhandledException += this.OnUnhandledException;
                TaskScheduler.UnobservedTaskException      += this.OnUnobservedTaskException;

                var dalamud = new Dalamud(info, levelSwitch, finishSignal);
                Log.Information("Starting a session..");

                // Run session
                dalamud.Start();
                dalamud.WaitForUnload();

                dalamud.Dispose();
            }
            catch (Exception ex)
            {
                Log.Fatal(ex, "Unhandled exception on main thread.");
            }
            finally
            {
                AppDomain.CurrentDomain.UnhandledException -= this.OnUnhandledException;

                Log.Information("Session has ended.");
                Log.CloseAndFlush();

                finishSignal.Set();
            }
        }