Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow GUI users to delete registry lockfiles #3829

Merged
merged 1 commit into from
Apr 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ConsoleUI/GameInstanceListScreen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ public static bool TryGetInstance(ConsoleTheme theme, GameInstance ksp, Action<C
} catch (RegistryInUseKraken k) {

ConsoleMessageDialog md = new ConsoleMessageDialog(
string.Format(Properties.Resources.InstanceListLocked, k.lockfilePath),
k.ToString(),
new List<string>() {
Properties.Resources.Cancel,
Properties.Resources.Force
Expand Down
3 changes: 0 additions & 3 deletions ConsoleUI/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 0 additions & 7 deletions ConsoleUI/Properties/Resources.fr-FR.resx
Original file line number Diff line number Diff line change
Expand Up @@ -420,13 +420,6 @@
<data name="InstanceListLoadingError" xml:space="preserve">
<value>Erreur lors du chargement de {0} :
{1}</value>
</data>
<data name="InstanceListLocked" xml:space="preserve">
<value>Fichier verrou avec un ID de processus actif à {0}

Cela veut probablement dire qu'une autre instance de CKAN s'occupe de cette instance. Vous pouvez supprimer ce fichier pour continuer, mais cela risque fortement de corrompre des données.

Voulez-vous supprimez ce fichier verrou pour forcer l'accès ?</value>
</data>
<data name="InstanceListNoVersion" xml:space="preserve">
<value>&lt;AUCUNE&gt;</value>
Expand Down
9 changes: 1 addition & 8 deletions ConsoleUI/Properties/Resources.it-IT.resx
Original file line number Diff line number Diff line change
Expand Up @@ -420,13 +420,6 @@
<data name="InstanceListLoadingError" xml:space="preserve">
<value>Errore nel caricamento di {0}:
{1}</value>
</data>
<data name="InstanceListLocked" xml:space="preserve">
<value>File di blocco con ID di processo attivo trovato a {0}

Ciò significa che probabilmente un'altra istanza di CKAN sta accedendo a questa istanza. Puoi eliminare il file per continuare, ma è molto probabile che i dati vengano danneggiati.

Vuoi eliminare questo file di blocco per forzare l'accesso?</value>
</data>
<data name="InstanceListNoVersion" xml:space="preserve">
<value>&lt;NESSUNA&gt;</value>
Expand Down Expand Up @@ -907,7 +900,7 @@ Se la disinstalli, CKAN non sarà in grado di reinstallarla.</value>
<data name="ExitBody" xml:space="preserve">
<value>STAI UTILIZZANDO {1}.

Grazie per aver scaricato {0}. Ci auguriamo che tu ti diverta
Grazie per aver scaricato {0}. Ci auguriamo che tu ti diverta
a usarlo come ci siamo divertiti noi a crearlo.

Se hai pagato per {0}, cerca di ottenere il rimborso,
Expand Down
7 changes: 0 additions & 7 deletions ConsoleUI/Properties/Resources.pl-PL.resx
Original file line number Diff line number Diff line change
Expand Up @@ -420,13 +420,6 @@
<data name="InstanceListLoadingError" xml:space="preserve">
<value>Błąd ładowania {0}:
{1}</value>
</data>
<data name="InstanceListLocked" xml:space="preserve">
<value>Plik blokady znaleziony w {0}

Oznacza to, że inna instancja CKAN prawdopodobnie ma dostęp do tej instalacji gry. Możesz usunąć plik, aby kontynuować, ale uszkodzenie danych jest bardzo prawdopodobne.

Czy chcesz usunąć ten plik blokady, aby wymusić dostęp?</value>
</data>
<data name="InstanceListNoVersion" xml:space="preserve">
<value>&lt;BRAK&gt;</value>
Expand Down
5 changes: 0 additions & 5 deletions ConsoleUI/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -219,11 +219,6 @@
<data name="InstanceListDefaultToggle" xml:space="preserve"><value>Default</value></data>
<data name="InstanceListLoadingError" xml:space="preserve"><value>Error loading {0}:
{1}</value></data>
<data name="InstanceListLocked" xml:space="preserve"><value>Lock file with live process ID found at {0}

This means that another instance of CKAN probably is accessing this instance. You can delete the file to continue, but data corruption is very likely.

Do you want to delete this lock file to force access?</value></data>
<data name="InstanceListNoVersion" xml:space="preserve"><value>&lt;NONE&gt;</value></data>
<data name="InstallTitle" xml:space="preserve"><value>Installing, Upgrading, and Removing Mods</value></data>
<data name="InstallMessage" xml:space="preserve"><value>Calculating...</value></data>
Expand Down
6 changes: 0 additions & 6 deletions ConsoleUI/Properties/Resources.ru-RU.resx
Original file line number Diff line number Diff line change
Expand Up @@ -210,12 +210,6 @@
<data name="InstanceListDefaultToggle" xml:space="preserve"><value>По умолчанию</value></data>
<data name="InstanceListLoadingError" xml:space="preserve"><value>Ошибка загрузки «{0}»:
{1}</value></data>
<data name="InstanceListLocked" xml:space="preserve"><value>Блокирующий файл с ID процесса найден в {0}

Это может означать, что другой процесс CKAN работает с этой сборкой.
Вы можете удалить этот файл, но в таком случае вероятно повреждение данных.

Хотите ли вы удалить блокирующий файл для получения доступа?</value></data>
<data name="InstanceListNoVersion" xml:space="preserve"><value>&lt;НЕТ&gt;</value></data>
<data name="InstallTitle" xml:space="preserve"><value>Установка, обновление и удаление модификаций</value></data>
<data name="InstallMessage" xml:space="preserve"><value>Вычисление...</value></data>
Expand Down
7 changes: 4 additions & 3 deletions Core/Properties/Resources.fr-FR.resx
Original file line number Diff line number Diff line change
Expand Up @@ -552,10 +552,11 @@ Consultez cette page pour obtenir de l'aide :
Pensez à ajouter un jeton d'authentification pour augmenter la limite avant bridage.</value>
</data>
<data name="KrakenAlreadyRunning" xml:space="preserve">
<value>CKAN est déjà lancé pour cette instance !
<value>Fichier verrou avec un ID de processus actif à {0}

Si vous êtes certain que ce n'est pas le cas, alors supprimez :
"{0}"</value>
Cela veut probablement dire qu'une autre instance de CKAN s'occupe de cette instance. Vous pouvez supprimer ce fichier pour continuer, mais cela risque fortement de corrompre des données.

Voulez-vous supprimez ce fichier verrou pour forcer l'accès ?</value>
</data>
<data name="NotEnoughSpaceToDownload" xml:space="preserve">
<value>Pas assez d'espace dans le dossier temporaire pour télécharger les modules !</value>
Expand Down
7 changes: 4 additions & 3 deletions Core/Properties/Resources.it-IT.resx
Original file line number Diff line number Diff line change
Expand Up @@ -552,10 +552,11 @@ Consulta questa pagina per aiuto:
Prendi in considerazione l'aggiunta di un token di autenticazione per aumentare il limite prima del throttling.</value>
</data>
<data name="KrakenAlreadyRunning" xml:space="preserve">
<value>CKAN è già in esecuzione per questa istanza!
<value>File di blocco con ID di processo attivo trovato a {0}

Se sei sicuro che non sia questo il caso, elimina:
"{0}"</value>
Ciò significa che probabilmente un'altra istanza di CKAN sta accedendo a questa istanza. Puoi eliminare il file per continuare, ma è molto probabile che i dati vengano danneggiati.

Vuoi eliminare questo file di blocco per forzare l'accesso?</value>
</data>
<data name="NotEnoughSpaceToDownload" xml:space="preserve">
<value>Spazio insufficiente nella cartella temporanea per scaricare i moduli!</value>
Expand Down
7 changes: 4 additions & 3 deletions Core/Properties/Resources.pl-PL.resx
Original file line number Diff line number Diff line change
Expand Up @@ -552,10 +552,11 @@ Odwiedź tę stronę, aby uzyskać pomoc:
Rozważ dodanie tokenu uwierzytelniającego, aby zwiększyć limit ograniczania.</value>
</data>
<data name="KrakenAlreadyRunning" xml:space="preserve">
<value>CKAN jest już uruchomiony z tą instalacją gry!
<value>Plik blokady znaleziony w {0}

Jeśli jesteś pewien, że tak nie jest, to usuń:
"{0}"</value>
Oznacza to, że inna instancja CKAN prawdopodobnie ma dostęp do tej instalacji gry. Możesz usunąć plik, aby kontynuować, ale uszkodzenie danych jest bardzo prawdopodobne.

Czy chcesz usunąć ten plik blokady, aby wymusić dostęp?</value>
</data>
<data name="NotEnoughSpaceToDownload" xml:space="preserve">
<value>Za mało miejsca w folderze tymczasowym do pobrania modułów!</value>
Expand Down
8 changes: 5 additions & 3 deletions Core/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -271,10 +271,12 @@ Consult this page for help:
<data name="KrakenMissingCertificateNotUnix" xml:space="preserve"><value>Oh no! Our download failed with a certificate error!</value></data>
<data name="KrakenDownloadThrottled" xml:space="preserve"><value>Download from {0} was throttled.
Consider adding an authentication token to increase the throttling limit.</value></data>
<data name="KrakenAlreadyRunning" xml:space="preserve"><value>CKAN is already running for this instance!
<data name="KrakenAlreadyRunning" xml:space="preserve"><value>Lock file with live process ID found at:
{0}

If you're certain this is not the case, then delete:
"{0}"</value></data>
Another active CKAN process probably is accessing this game folder. Check your operating system's task manager application. If you are sure the lock file is stale, you may delete it to continue, but if it's not, then it's very likely that the two running CKANs will clash and corrupt your mod registry and game folder.

Do you want to delete this lock file to force access?</value></data>
<data name="NotEnoughSpaceToDownload" xml:space="preserve"><value>Not enough space in temp folder to download modules!</value></data>
<data name="NotEnoughSpaceToCache" xml:space="preserve"><value>Not enough space in cache folder to store modules!</value></data>
<data name="NotEnoughSpaceToInstall" xml:space="preserve"><value>Not enough space in game folder to install modules!</value></data>
Expand Down
8 changes: 5 additions & 3 deletions Core/Properties/Resources.ru-RU.resx
Original file line number Diff line number Diff line change
Expand Up @@ -267,10 +267,12 @@ https://github.com/KSP-CKAN/CKAN/wiki/SSL-certificate-errors</value></data>
<data name="KrakenMissingCertificateNotUnix" xml:space="preserve"><value>О нет! Загрузка не завершена из-за ошибки сертификата!</value></data>
<data name="KrakenDownloadThrottled" xml:space="preserve"><value>Загрузка из {0} была ограничена.
Для увеличения квоты добавьте токен аутентификации.</value></data>
<data name="KrakenAlreadyRunning" xml:space="preserve"><value>CKAN уже запущен для этой сборки!
<data name="KrakenAlreadyRunning" xml:space="preserve"><value>Блокирующий файл с ID процесса найден в {0}

Если вы уверены, что это не так, удалите:
"{0}"</value></data>
Это может означать, что другой процесс CKAN работает с этой сборкой.
Вы можете удалить этот файл, но в таком случае вероятно повреждение данных.

Хотите ли вы удалить блокирующий файл для получения доступа?</value></data>
<data name="RelationshipResolverConflictsWith" xml:space="preserve"><value>{0} конфликтует с {1}</value></data>
<data name="RelationshipResolverRequiredButResolver" xml:space="preserve"><value>Необходима {0}, но в ресольвере несовместимая версия</value></data>
<data name="RelationshipResolverRequiredButInstalled" xml:space="preserve"><value>Необходима {0}, но установлена несовместимая версия</value></data>
Expand Down
5 changes: 2 additions & 3 deletions Core/Types/Kraken.cs
Original file line number Diff line number Diff line change
Expand Up @@ -474,9 +474,8 @@ public RegistryInUseKraken(string path, string reason = null, Exception inner_ex
}

public override string ToString()
{
return String.Format(Properties.Resources.KrakenAlreadyRunning, lockfilePath);
}
=> string.Format(Properties.Resources.KrakenAlreadyRunning,
lockfilePath.Replace('/', Path.DirectorySeparatorChar));
}

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion GUI/Controls/EditModpack.cs
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ private bool TrySavePrompt(List<ExportOption> exportOptions, out ExportOption se
Filter = string.Join("|", exportOptions.Select(i => i.ToString()).ToArray()),
Title = Properties.Resources.ExportInstalledModsDialogTitle
};
if (dlg.ShowDialog() == DialogResult.OK)
if (dlg.ShowDialog(Main.Instance) == DialogResult.OK)
{
selectedOption = exportOptions[dlg.FilterIndex - 1];
filename = dlg.FileName;
Expand Down
4 changes: 3 additions & 1 deletion GUI/Controls/ManageMods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1122,7 +1122,9 @@ private void _UpdateModsList(Dictionary<string, bool> old_modules = null)
{
log.Info("Updating the mod list");

Main.Instance.Wait.AddLogMessage(Properties.Resources.MainModListLoadingRegistry);
Main.Instance.Wait.AddLogMessage(Properties.Resources.MainRepoScanning);
Main.Instance.CurrentInstance.Scan();

GameVersionCriteria versionCriteria = Main.Instance.CurrentInstance.VersionCriteria();
IRegistryQuerier registry = RegistryManager.Instance(Main.Instance.CurrentInstance).registry;

Expand Down
2 changes: 1 addition & 1 deletion GUI/Controls/ModInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ private void ModInfoTabControl_SelectedIndexChanged(object sender, EventArgs e)
LoadTab(ModInfoTabControl.SelectedTab.Name, SelectedModule);
}

private GameInstanceManager manager => Main.Instance.manager;
private GameInstanceManager manager => Main.Instance.Manager;

private int StringHeight(string text, Font font, int maxWidth)
=> (int)CreateGraphics().MeasureString(text, font, maxWidth).Height;
Expand Down
2 changes: 1 addition & 1 deletion GUI/Controls/ModInfoTabs/Contents.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public void Refresh()

private GUIMod selectedModule;
private CkanModule currentModContentsModule;
private GameInstanceManager manager => Main.Instance.manager;
private GameInstanceManager manager => Main.Instance.Manager;

private void ContentsPreviewTree_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e)
{
Expand Down
2 changes: 1 addition & 1 deletion GUI/Controls/ModInfoTabs/Metadata.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ private void OnAuthorClick(object sender, LinkLabelLinkClickedEventArgs e)
merge);
}

private GameInstanceManager manager => Main.Instance.manager;
private GameInstanceManager manager => Main.Instance.Manager;

private void LinkLabel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
Expand Down
2 changes: 1 addition & 1 deletion GUI/Controls/ModInfoTabs/Relationships.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ private void UpdateModDependencyGraph(CkanModule module)
}

private GUIMod selectedModule;
private GameInstanceManager manager => Main.Instance.manager;
private GameInstanceManager manager => Main.Instance.Manager;

private void DependsGraphTree_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e)
{
Expand Down
4 changes: 2 additions & 2 deletions GUI/Dialogs/CloneFakeGameDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ private void buttonInstancePathSelection_Click(object sender, EventArgs e)
};

// Show the FileDialog and let the user search for the game directory.
if (instanceDialog.ShowDialog() != DialogResult.OK || !File.Exists(instanceDialog.FileName))
if (instanceDialog.ShowDialog(this) != DialogResult.OK || !File.Exists(instanceDialog.FileName))
return;

// Write the path to the textbox
Expand Down Expand Up @@ -327,7 +327,7 @@ private void reactivateDialog()

private void buttonPathBrowser_Click(object sender, EventArgs e)
{
if (folderBrowserDialogNewPath.ShowDialog().Equals(DialogResult.OK))
if (folderBrowserDialogNewPath.ShowDialog(this).Equals(DialogResult.OK))
{
textBoxNewPath.Text = folderBrowserDialogNewPath.SelectedPath;
}
Expand Down
4 changes: 2 additions & 2 deletions GUI/Dialogs/ManageGameInstancesDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ private static string FormatVersion(GameVersion v)

private void AddToCKANMenuItem_Click(object sender, EventArgs e)
{
if (_instanceDialog.ShowDialog() != DialogResult.OK
if (_instanceDialog.ShowDialog(this) != DialogResult.OK
|| !File.Exists(_instanceDialog.FileName))
return;

Expand Down Expand Up @@ -187,7 +187,7 @@ private void CloneFakeInstanceMenuItem_Click(object sender, EventArgs e)
{
var old_instance = Main.Instance.CurrentInstance;

var result = new CloneFakeGameDialog(_manager, _user).ShowDialog();
var result = new CloneFakeGameDialog(_manager, _user).ShowDialog(this);
if (result == DialogResult.OK && !Equals(old_instance, Main.Instance.CurrentInstance))
{
DialogResult = DialogResult.OK;
Expand Down
2 changes: 1 addition & 1 deletion GUI/Dialogs/PluginsDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ private void UnloadPluginButton_Click(object sender, EventArgs e)

private void AddNewPluginButton_Click(object sender, EventArgs e)
{
if (m_AddNewPluginDialog.ShowDialog() == DialogResult.OK)
if (m_AddNewPluginDialog.ShowDialog(this) == DialogResult.OK)
{
var path = m_AddNewPluginDialog.FileName;
Main.Instance.pluginController.AddNewAssemblyToPluginsPath(path);
Expand Down
12 changes: 2 additions & 10 deletions GUI/Dialogs/SettingsDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ private void ChangeCacheButton_Click(object sender, EventArgs e)
SelectedPath = config.DownloadCacheDir,
ShowNewFolderButton = true
};
DialogResult result = cacheChooser.ShowDialog();
DialogResult result = cacheChooser.ShowDialog(this);
if (result == DialogResult.OK)
{
UpdateCacheInfo(cacheChooser.SelectedPath);
Expand Down Expand Up @@ -309,7 +309,7 @@ private void DeleteRepoButton_Click(object sender, EventArgs e)
private void NewRepoButton_Click(object sender, EventArgs e)
{
var dialog = new NewRepoDialog();
if (dialog.ShowDialog() == DialogResult.OK)
if (dialog.ShowDialog(this) == DialogResult.OK)
{
try
{
Expand Down Expand Up @@ -548,25 +548,21 @@ private void InstallUpdateButton_Click(object sender, EventArgs e)
private void CheckUpdateOnLaunchCheckbox_CheckedChanged(object sender, EventArgs e)
{
Main.Instance.configuration.CheckForUpdatesOnLaunch = CheckUpdateOnLaunchCheckbox.Checked;
Main.Instance.configuration.Save();
}

private void RefreshOnStartupCheckbox_CheckedChanged(object sender, EventArgs e)
{
Main.Instance.configuration.RefreshOnStartup = RefreshOnStartupCheckbox.Checked;
Main.Instance.configuration.Save();
}

private void HideEpochsCheckbox_CheckedChanged(object sender, EventArgs e)
{
Main.Instance.configuration.HideEpochs = HideEpochsCheckbox.Checked;
Main.Instance.configuration.Save();
}

private void HideVCheckbox_CheckedChanged(object sender, EventArgs e)
{
Main.Instance.configuration.HideV = HideVCheckbox.Checked;
Main.Instance.configuration.Save();
}

private void LanguageSelectionComboBox_SelectionChanged(object sender, EventArgs e)
Expand All @@ -577,20 +573,17 @@ private void LanguageSelectionComboBox_SelectionChanged(object sender, EventArgs
private void AutoSortUpdateCheckBox_CheckedChanged(object sender, EventArgs e)
{
Main.Instance.configuration.AutoSortByUpdate = AutoSortUpdateCheckBox.Checked;
Main.Instance.configuration.Save();
}

private void EnableTrayIconCheckBox_CheckedChanged(object sender, EventArgs e)
{
MinimizeToTrayCheckBox.Enabled = Main.Instance.configuration.EnableTrayIcon = EnableTrayIconCheckBox.Checked;
Main.Instance.configuration.Save();
Main.Instance.CheckTrayState();
}

private void MinimizeToTrayCheckBox_CheckedChanged(object sender, EventArgs e)
{
Main.Instance.configuration.MinimizeToTray = MinimizeToTrayCheckBox.Checked;
Main.Instance.configuration.Save();
Main.Instance.CheckTrayState();
}

Expand All @@ -609,7 +602,6 @@ private void RefreshTextBox_KeyPress(object sender, KeyPressEventArgs e)
private void PauseRefreshCheckBox_CheckedChanged(object sender, EventArgs e)
{
Main.Instance.configuration.RefreshPaused = PauseRefreshCheckBox.Checked;
Main.Instance.configuration.Save();

if (Main.Instance.configuration.RefreshPaused)
Main.Instance.refreshTimer.Stop();
Expand Down
Loading