예제 #1
0
        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
        /// <summary>
        /// Log troubleshooting information to Serilog.
        /// </summary>
        /// <param name="dalamud">The <see cref="Dalamud"/> instance to read information from.</param>
        /// <param name="isInterfaceLoaded">Whether or not the interface was loaded.</param>
        public static void LogTroubleshooting(Dalamud dalamud, bool isInterfaceLoaded)
        {
            try
            {
                var payload = new TroubleshootingPayload
                {
                    LoadedPlugins   = dalamud.PluginManager.InstalledPlugins.Select(x => x.Manifest).ToArray(),
                    DalamudVersion  = Util.AssemblyVersion,
                    DalamudGitHash  = Util.GetGitHash(),
                    GameVersion     = dalamud.StartInfo.GameVersion.ToString(),
                    Language        = dalamud.StartInfo.Language.ToString(),
                    DoDalamudTest   = dalamud.Configuration.DoDalamudTest,
                    DoPluginTest    = dalamud.Configuration.DoPluginTest,
                    InterfaceLoaded = isInterfaceLoaded,
                    ThirdRepo       = dalamud.Configuration.ThirdRepoList,
                };

                var encodedPayload = Convert.ToBase64String(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(payload)));
                Log.Information($"TROUBLESHOOTING:{encodedPayload}");
            }
            catch (Exception ex)
            {
                Log.Error(ex, "Could not print troubleshooting.");
            }
        }
예제 #3
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();
            }
        }
예제 #4
0
        /// <summary>
        /// Initialize all Dalamud subsystems and start running on the main thread.
        /// </summary>
        /// <param name="info">The <see cref="DalamudStartInfo"/> containing information needed to initialize Dalamud.</param>
        private static void RunThread(DalamudStartInfo info)
        {
            // Setup logger
            var levelSwitch = InitLogging(info.WorkingDirectory);

            // Load configuration first to get some early persistent state, like log level
            var configuration = DalamudConfiguration.Load(info.ConfigurationPath);

            // Set the appropriate logging level from the configuration
#if !DEBUG
            levelSwitch.MinimumLevel = configuration.LogLevel;
#endif

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

            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
                ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12 | SecurityProtocolType.Tls;

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

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

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

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

                finishSignal.Set();
            }
        }
예제 #5
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.LoadTier1();
                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();
            }
        }
예제 #6
0
        public static void LogTroubleshooting(Dalamud dalamud, bool isInterfaceLoaded)
        {
            try {
                var payload = new TroubleshootingPayload {
                    LoadedPlugins   = dalamud.PluginManager.Plugins.Select(x => x.Definition).ToArray(),
                    DalamudVersion  = Util.AssemblyVersion,
                    GameVersion     = dalamud.StartInfo.GameVersion,
                    Language        = dalamud.StartInfo.Language.ToString(),
                    DoDalamudTest   = dalamud.Configuration.DoDalamudTest,
                    DoPluginTest    = dalamud.Configuration.DoPluginTest,
                    InterfaceLoaded = isInterfaceLoaded
                };


                Log.Information("TROUBLESHOOTING:" +
                                System.Convert.ToBase64String(
                                    Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(payload))));
            } catch (Exception ex) {
                Log.Error(ex, "Could not print troubleshooting.");
            }
        }
예제 #7
0
 public DalamudCommands(Dalamud dalamud)
 {
     this.dalamud = dalamud;
 }