Esempio n. 1
0
        private static void ShowFuslog()
        {
            var fuslog = new RegistryFusLog();

            if (fuslog.ExistKey())
            {
                var state = fuslog.ReadFuslog() == 1 ? "enabled." : "disabled.";
                Console.WriteLine($"Fuslog is {state}");
                Console.WriteLine($"Current fuslog logfolder is: {fuslog.ReadLogFolder()}");
            }
            else
            {
                Console.WriteLine("No fuslog key in registry, thus no fuslog enabled");
            }
        }
Esempio n. 2
0
        private static void FixFuslogAndDump(DiagnosticsCommands command)
        {
            try
            {
                if (command.HasDumpCommand && command.Fix)
                {
                    var dump   = new RegistryDump(true);
                    var enable = command.EnableDisableDump == 1;
                    if (enable)
                    {
                        dump.EnableDump();
                    }
                    else
                    {
                        dump.DisableDump();
                    }
                    Console.WriteLine(enable ? "Dump enabled" : "Dump disabled");
                }


                if (command.HasFuslogCommand && command.Fix)
                {
                    var fuslog = new RegistryFusLog();
                    var enable = command.EnableDisableFuslog == 1;
                    if (enable)
                    {
                        fuslog.Enable();
                    }
                    else
                    {
                        fuslog.Disable();
                    }
                    Console.WriteLine(enable ? "Fuslog enabled" : "Fuslog disabled");
                }

                if (command.Fix && command.DumpFolder.Length > 0)
                {
                    var dump = new RegistryDump();
                    if (command.DumpFolder != dump.ReadDumpFolder())
                    {
                        dump.SetDumpFolder(command.DumpFolder);
                        Console.WriteLine($"Dumpfolder set to {command.DumpFolder}");
                        if (!Directory.Exists(command.DumpFolder))
                        {
                            Directory.CreateDirectory(command.DumpFolder);
                        }
                    }
                    else
                    {
                        Console.WriteLine($"Dump folder not changed, already set to {command.DumpFolder}");
                    }
                }

                if (command.Fix && command.FuslogFolder.Length > 0)
                {
                    var fusLog = new RegistryFusLog();
                    if (command.DumpFolder != fusLog.ReadLogFolder())
                    {
                        fusLog.SetLogFolder(command.FuslogFolder);
                        Console.WriteLine($"Fuslog folder set to {command.FuslogFolder}");
                        if (!Directory.Exists(command.FuslogFolder))
                        {
                            Directory.CreateDirectory(command.FuslogFolder);
                        }
                    }
                    else
                    {
                        Console.WriteLine($"Fuslog folder  not changed, already set to {command.FuslogFolder}");
                    }
                }
            }
            catch (SecurityException)
            {
                Console.WriteLine("IFix needs to change your registry, please run from an elevated (admin) command prompt");
            }
        }