-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ConfigApp: Several workshop-related changes (#3706)
- Moved settings file handler to a separate class - Made an option to open text and sound files for preview - Improved search: now it supports individual file names, script names and script IDs. Found files are highlighted in the settings window. --------- Co-authored-by: Reguas <[email protected]>
- Loading branch information
Showing
12 changed files
with
360 additions
and
151 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
ConfigApp/WorkshopInfoHandler.cs → ConfigApp/Workshop/WorkshopInfoHandler.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
using System.IO; | ||
using System.Windows; | ||
using System.Windows.Input; | ||
using Newtonsoft.Json; | ||
using Newtonsoft.Json.Linq; | ||
|
||
namespace ConfigApp.Workshop | ||
{ | ||
public class WorkshopSettingsHandler : ICommand | ||
{ | ||
public event EventHandler? CanExecuteChanged = null; | ||
|
||
private readonly WorkshopSubmissionItem m_SubmissionItem; | ||
private readonly WorkshopSubmissionFileHandler m_FileHandler; | ||
|
||
public WorkshopSettingsHandler(WorkshopSubmissionItem submissionItem, WorkshopSubmissionFileHandler fileHandler) | ||
{ | ||
m_SubmissionItem = submissionItem; | ||
m_FileHandler = fileHandler; | ||
} | ||
|
||
public bool CanExecute(object? parameter) | ||
{ | ||
return true; | ||
} | ||
|
||
public void Execute(object? parameter) | ||
{ | ||
List<WorkshopSubmissionFile> files; | ||
|
||
try | ||
{ | ||
m_FileHandler.ReloadFiles(); | ||
files = m_FileHandler.GetSubmissionFiles(); | ||
m_SubmissionItem.UpdateSearchTerms(); | ||
} | ||
catch (Exception ex) | ||
{ | ||
MessageBox.Show(ex.Message, "ChaosModV", MessageBoxButton.OK, MessageBoxImage.Error); | ||
return; | ||
} | ||
|
||
var editWindow = new WorkshopEditDialog(files, WorkshopEditDialogMode.Edit, m_FileHandler.SubmissionDirectory, m_SubmissionItem.HighlightedFiles); | ||
editWindow.ShowDialog(); | ||
|
||
try | ||
{ | ||
m_FileHandler.SetSettings(editWindow.FileStates); | ||
m_SubmissionItem.UpdateSearchTerms(); | ||
} | ||
catch (Exception) | ||
{ | ||
MessageBox.Show("Error while saving settings! Check that workshop folder has write permissions", "ChaosModV", MessageBoxButton.OK, MessageBoxImage.Error); | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.