Ejemplo n.º 1
0
        public AnalyzeResults(Wizard sb)
        {
            InitializeComponent();

            _scanBase = sb;

            double oldRegistrySize = HiveManager.GetOldRegistrySize(),
                   newRegistrySize = HiveManager.GetNewRegistrySize();

            var oldRegistrySizeMb  = decimal.Round(Convert.ToDecimal(oldRegistrySize) / 1024 / 1024, 2);
            var diffRegistrySizeMb = decimal.Round(Convert.ToDecimal(oldRegistrySize - newRegistrySize) / 1024 / 1024, 2);

            ((PieSeries)McChart.Series[0]).ItemsSource =
                new[]
            {
                new KeyValuePair <string, decimal>($"Registry Size ({oldRegistrySizeMb}MB)",
                                                   oldRegistrySizeMb - diffRegistrySizeMb),
                new KeyValuePair <string, decimal>($"Saving ({diffRegistrySizeMb}MB)", diffRegistrySizeMb)
            };

            if (100 - newRegistrySize / oldRegistrySize * 100 >= 5)
            {
                // Set errors to number of registry hives
                Settings.Default.lastScanErrors = Wizard.RegistryHives.Count;

                McChart.Title = "The Windows Registry Needs To Be Compacted";
            }
            else
            {
                // Properties.Settings.Default.lastScanErrors will still equal 0

                McChart.Title           = "The Windows Registry Does Not Need To Be Compacted";
                ButtonCompact.IsEnabled = false;
            }
        }
Ejemplo n.º 2
0
        private void buttonAnalyze_Click(object sender, RoutedEventArgs e)
        {
            if (
                MessageBox.Show(Application.Current.MainWindow,
                                "You must close running programs before optimizing the registry.\nPlease save your work and close any running programs now.",
                                Utils.ProductName, MessageBoxButton.OKCancel, MessageBoxImage.Information) != MessageBoxResult.OK)
            {
                return;
            }

            Wizard.IsBusy = true;

            var secureDesktop = new SecureDesktop();

            secureDesktop.Show();

            var analyzeWnd = new Analyze();

            analyzeWnd.ShowDialog();

            secureDesktop.Close();

            Wizard.IsBusy = false;

            // Check registry size before continuing
            if (HiveManager.GetNewRegistrySize() <= 0 || IsCompacted)
            {
                MessageBox.Show(Application.Current.MainWindow,
                                "It appears that the registry has already been compacted.", Utils.ProductName, MessageBoxButton.OK,
                                MessageBoxImage.Error);
                return;
            }

            _scanBase.MoveNext();
        }