Ejemplo n.º 1
0
        private void PurgeAllMenuItem_Click(object sender, EventArgs e)
        {
            YesNoDialog deleteConfirmationDialog = new YesNoDialog();
            string      confirmationText         = String.Format
                                                   (
                Properties.Resources.SettingsDialogDeleteConfirm,
                m_cacheFileCount,
                CkanModule.FmtSize(m_cacheSize)
                                                   );

            if (deleteConfirmationDialog.ShowYesNoDialog(confirmationText) == DialogResult.Yes)
            {
                // tell the cache object to nuke itself
                Main.Instance.Manager.Cache.RemoveAll();

                // forcibly tell all mod rows to re-check cache state
                foreach (DataGridViewRow row in Main.Instance.ModList.Rows)
                {
                    var mod = row.Tag as GUIMod;
                    mod?.UpdateIsCached();
                }

                // finally, clear the preview contents list
                Main.Instance.UpdateModContentsTree(null, true);

                UpdateCacheInfo(config.DownloadCacheDir);
            }
        }
Ejemplo n.º 2
0
        private void ClearCKANCacheButton_Click(object sender, EventArgs e)
        {
            YesNoDialog deleteConfirmationDialog = new YesNoDialog();
            string confirmationText = String.Format
            (
                "Do you really want to delete {0} files from the cache for a total of {1} MiB?",
                m_cacheFileCount,
                m_cacheSize / 1024 / 1024
            );

            if (deleteConfirmationDialog.ShowYesNoDialog(confirmationText) == System.Windows.Forms.DialogResult.Yes)
            {
                var cachePath = Path.Combine(Main.Instance.CurrentInstance.CkanDir(), "downloads");
                foreach (var file in Directory.GetFiles(cachePath))
                {
                    try
                    {
                        File.Delete(file);
                    }
                    catch (Exception)
                    {
                    }
                }

                UpdateCacheInfo();
            }
        }
Ejemplo n.º 3
0
 public void RecreateDialogs()
 {
     errorDialog     = controlFactory.CreateControl <ErrorDialog>();
     pluginsDialog   = controlFactory.CreateControl <PluginsDialog>();
     yesNoDialog     = controlFactory.CreateControl <YesNoDialog>();
     selectionDialog = controlFactory.CreateControl <SelectionDialog>();
 }
Ejemplo n.º 4
0
        private void ClearCKANCacheButton_Click(object sender, EventArgs e)
        {
            YesNoDialog deleteConfirmationDialog = new YesNoDialog();
            string      confirmationText         = String.Format
                                                   (
                "Do you really want to delete {0} files from the cache for a total of {1} MB?",
                m_cacheFileCount,
                m_cacheSize / 1024 / 1024
                                                   );

            if (deleteConfirmationDialog.ShowYesNoDialog(confirmationText) == System.Windows.Forms.DialogResult.Yes)
            {
                var cachePath = Path.Combine(Main.Instance.CurrentInstance.CkanDir(), "downloads");
                foreach (var file in Directory.GetFiles(cachePath))
                {
                    try
                    {
                        File.Delete(file);
                    }
                    catch (Exception)
                    {
                    }
                }

                UpdateCacheInfo();
            }
        }
Ejemplo n.º 5
0
        private void reinstallToolStripMenuItem_Click(object sender, EventArgs e)
        {
            GUIMod module = ModInfoTabControl.SelectedModule;

            if (module == null || !module.IsCKAN)
            {
                return;
            }

            YesNoDialog reinstallDialog  = new YesNoDialog();
            string      confirmationText = $"Do you want to reinstall {module.Name}?";

            if (reinstallDialog.ShowYesNoDialog(confirmationText) == DialogResult.No)
            {
                return;
            }

            IRegistryQuerier registry = RegistryManager.Instance(CurrentInstance).registry;

            // Build the list of changes, first the mod to remove:
            List <ModChange> toReinstall = new List <ModChange>()
            {
                new ModChange(module, GUIModChangeType.Remove, null)
            };
            // Then everything we need to re-install:
            var revdep = registry.FindReverseDependencies(new List <string>()
            {
                module.Identifier
            });
            var goners = revdep.Union(
                registry.FindRemovableAutoInstalled(
                    registry.InstalledModules.Where(im => !revdep.Contains(im.identifier))
                    ).Select(im => im.Module.identifier)
                );

            foreach (string id in goners)
            {
                toReinstall.Add(new ModChange(
                                    mainModList.full_list_of_mod_rows[id]?.Tag as GUIMod,
                                    GUIModChangeType.Install,
                                    null
                                    ));
            }
            // Hand off to centralized [un]installer code
            installWorker.RunWorkerAsync(
                new KeyValuePair <List <ModChange>, RelationshipResolverOptions>(
                    toReinstall,
                    RelationshipResolver.DependsOnlyOpts()
                    )
                );
        }
Ejemplo n.º 6
0
        private void ClearCKANCacheButton_Click(object sender, EventArgs e)
        {
            YesNoDialog deleteConfirmationDialog = new YesNoDialog();
            string      confirmationText         = String.Format
                                                   (
                "Do you really want to delete {0} cached files, freeing {1} MB?",
                m_cacheFileCount,
                m_cacheSize / 1024 / 1024
                                                   );

            if (deleteConfirmationDialog.ShowYesNoDialog(confirmationText) == System.Windows.Forms.DialogResult.Yes)
            {
                foreach (var file in Directory.GetFiles(Main.Instance.CurrentInstance.DownloadCacheDir()))
                {
                    try
                    {
                        File.Delete(file);
                    }
                    catch (Exception)
                    {
                    }
                }

                // tell the cache object to nuke itself
                Main.Instance.CurrentInstance.Cache.OnCacheChanged();

                // forcibly tell all mod rows to re-check cache state
                foreach (DataGridViewRow row in Main.Instance.ModList.Rows)
                {
                    var mod = row.Tag as GUIMod;
                    mod?.UpdateIsCached();
                }

                // finally, clear the preview contents list
                Main.Instance.UpdateModContentsTree(null, true);

                UpdateCacheInfo();
            }
        }
Ejemplo n.º 7
0
 public void RecreateDialogs()
 {
     m_SettingsDialog = controlFactory.CreateControl<SettingsDialog>();
     m_PluginsDialog = controlFactory.CreateControl<PluginsDialog>();
     m_YesNoDialog = controlFactory.CreateControl<YesNoDialog>();
 }
Ejemplo n.º 8
0
 public void RecreateDialogs()
 {
     m_SettingsDialog = controlFactory.CreateControl<SettingsDialog>();
     m_PluginsDialog = controlFactory.CreateControl<PluginsDialog>();
     m_YesNoDialog = controlFactory.CreateControl<YesNoDialog>();
 }