Beispiel #1
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.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,
                    ThirdRepo       = dalamud.Configuration.ThirdRepoList,
                };

                Log.Information("TROUBLESHOOTING:" +
                                System.Convert.ToBase64String(
                                    Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(payload))));
            }
            catch (Exception ex)
            {
                Log.Error(ex, "Could not print troubleshooting.");
            }
        }
Beispiel #2
0
        /// <summary>
        /// Log troubleshooting information in a parseable format to Serilog.
        /// </summary>
        internal static void LogTroubleshooting()
        {
            var startInfo = Service <DalamudStartInfo> .Get();

            var configuration = Service <DalamudConfiguration> .Get();

            var interfaceManager = Service <InterfaceManager> .GetNullable();

            var pluginManager = Service <PluginManager> .GetNullable();

            try
            {
                var payload = new TroubleshootingPayload
                {
                    LoadedPlugins   = pluginManager?.InstalledPlugins?.Select(x => x.Manifest)?.ToArray(),
                    DalamudVersion  = Util.AssemblyVersion,
                    DalamudGitHash  = Util.GetGitHash(),
                    GameVersion     = startInfo.GameVersion.ToString(),
                    Language        = startInfo.Language.ToString(),
                    DoDalamudTest   = configuration.DoDalamudTest,
                    DoPluginTest    = configuration.DoPluginTest,
                    InterfaceLoaded = interfaceManager?.IsReady ?? false,
                    ThirdRepo       = 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.");
            }
        }
        internal static string GetTroubleshootingJson()
        {
            var gamePath = App.Settings.GamePath;

            var integrity = TroubleshootingPayload.IndexIntegrityResult.Success;

            try
            {
                if (!gamePath.Exists || !gamePath.GetDirectories().Any(x => x.Name == "game"))
                {
                    integrity = TroubleshootingPayload.IndexIntegrityResult.NoGame;
                }
                else
                {
                    var result = IntegrityCheck.CompareIntegrityAsync(null, gamePath, true).Result;

                    integrity = result.compareResult switch
                    {
                        IntegrityCheck.CompareResult.ReferenceFetchFailure => TroubleshootingPayload.IndexIntegrityResult.ReferenceFetchFailure,
                        IntegrityCheck.CompareResult.ReferenceNotFound => TroubleshootingPayload.IndexIntegrityResult.ReferenceNotFound,
                        IntegrityCheck.CompareResult.Invalid => TroubleshootingPayload.IndexIntegrityResult.Failed,
                        _ => integrity
                    };
                }
            }
            catch (Exception)
            {
                integrity = TroubleshootingPayload.IndexIntegrityResult.Exception;
            }

            var ffxivVer    = Repository.Ffxiv.GetVer(gamePath);
            var ffxivVerBck = Repository.Ffxiv.GetVer(gamePath, true);
            var ex1Ver      = Repository.Ex1.GetVer(gamePath);
            var ex1VerBck   = Repository.Ex1.GetVer(gamePath, true);
            var ex2Ver      = Repository.Ex2.GetVer(gamePath);
            var ex2VerBck   = Repository.Ex2.GetVer(gamePath, true);
            var ex3Ver      = Repository.Ex3.GetVer(gamePath);
            var ex3VerBck   = Repository.Ex3.GetVer(gamePath, true);
            var ex4Ver      = Repository.Ex4.GetVer(gamePath);
            var ex4VerBck   = Repository.Ex4.GetVer(gamePath, true);

            var payload = new TroubleshootingPayload
            {
                When                  = DateTime.Now,
                IsDx11                = App.Settings.IsDx11,
                IsAutoLogin           = App.Settings.AutologinEnabled,
                IsUidCache            = App.Settings.UniqueIdCacheEnabled,
                DalamudEnabled        = App.Settings.InGameAddonEnabled,
                DalamudLoadMethod     = App.Settings.InGameAddonLoadMethod.GetValueOrDefault(),
                DalamudInjectionDelay = App.Settings.DalamudInjectionDelayMs,
                EncryptArguments      = App.Settings.EncryptArguments.GetValueOrDefault(true),
                LauncherVersion       = AppUtil.GetAssemblyVersion(),
                LauncherHash          = AppUtil.GetGitHash(),
                Official              = AppUtil.GetBuildOrigin() == "goatcorp/FFXIVQuickLauncher",
                DpiAwareness          = App.Settings.DpiAwareness.GetValueOrDefault(),
                Platform              = Util.GetPlatform(),

                ObservedGameVersion = ffxivVer,
                ObservedEx1Version  = ex1Ver,
                ObservedEx2Version  = ex2Ver,
                ObservedEx3Version  = ex3Ver,
                ObservedEx4Version  = ex4Ver,

                BckMatch = ffxivVer == ffxivVerBck && ex1Ver == ex1VerBck && ex2Ver == ex2VerBck &&
                           ex3Ver == ex3VerBck && ex4Ver == ex4VerBck,

                IndexIntegrity = integrity
            };

            return(JsonConvert.SerializeObject(payload));
        }