示例#1
0
        public static void postCheck()
        {
            //ask to disable Fusion logs because it needs a lot of resources

            if (isFusionLogEnabled())
            {
                Windows.simpleDialog s = new Windows.simpleDialog();
                s.Owner        = Application.Current.MainWindow;
                s.Title        = "Disable logging now?";
                s.TextBox.Text = "FUSION logging is still enabled, disable now?" + Environment.NewLine + "Logging is using a lot of resources! It is recommended to disable it when not needed anymore.";
                s.ShowDialog();
                if (s.Value == (int)Windows.simpleDialog.DialogValues.Yes)
                {
                    FusionLogReg(true);
                }
            }
        }
示例#2
0
        // **********************************************************
        // ************ Functions ***********************************
        // **********************************************************
        public void mBox(string Title, string Message)
        {
            Application.Current.Dispatcher.Invoke(
                System.Windows.Threading.DispatcherPriority.Normal,
                new Action(() =>
            {
                Windows.simpleDialog s = new Windows.simpleDialog();
                s.Owner             = Application.Current.MainWindow;
                s.Title             = Title;
                s.TextBox.Text      = Message;
                s.Cancel.Visibility = Visibility.Collapsed;
                s.Yes.Visibility    = Visibility.Collapsed;
                s.No.Visibility     = Visibility.Collapsed;

                s.OK.IsDefault = true;

                s.ShowDialog();
            }));
        }
示例#3
0
        public static void FusionLogReg(bool disable)
        {
            int Value = 0;

            if (disable == false)
            {
                Value = 1;
            }

            try
            {
                //RegistryKey basekey = RegistryKey.OpenRemoteBaseKey(RegistryHive.LocalMachine, Environment.MachineName, RegistryView.Registry64);
                RegistryKey basekey = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64);
                RegistryKey key     = basekey.OpenSubKey("Software\\Microsoft\\Fusion\\", true);
                //Object value = key.GetValue("EnableLog");
                key.SetValue("EnableLog", Value, RegistryValueKind.DWord);
                key.SetValue("ForceLog", Value, RegistryValueKind.DWord);
                key.SetValue("LogFailures", Value, RegistryValueKind.DWord);
                key.SetValue("LogResourceBinds", Value, RegistryValueKind.DWord);

                key.SetValue("LogPath", MainWindow.Instance.LogPath, RegistryValueKind.String);

                key.Close();
            }
            catch (System.UnauthorizedAccessException ex)
            {
                Windows.simpleDialog s = new Windows.simpleDialog();
                s.Title        = "Restart elevated?";
                s.TextBox.Text = "Writing to the registry requires elevation. Restart now elevated?";
                s.ShowDialog();
                if (s.Value == (int)Windows.simpleDialog.DialogValues.Yes)
                {
                    restartElevated();
                }
            }
            catch (Exception ex)
            {
                //MessageBox.Show("FusionLogReg: " + ex.ToString());
                MainWindow.Instance.mBox("FusionLogReg", ex.ToString());
            }
        }