mirror of
https://github.com/4sval/FModel.git
synced 2026-09-25 18:48:50 -05:00
implemented #242
This commit is contained in:
@@ -307,7 +307,7 @@ namespace FModel.ViewModels
|
||||
{
|
||||
Title = "Save Audio",
|
||||
FileName = fileToSave.FileName,
|
||||
InitialDirectory = Path.Combine(UserSettings.Default.OutputDirectory, "Exports")
|
||||
InitialDirectory = UserSettings.Default.AudioDirectory
|
||||
};
|
||||
if (!(bool) saveFileDialog.ShowDialog()) return;
|
||||
path = saveFileDialog.FileName;
|
||||
|
||||
@@ -729,9 +729,8 @@ namespace FModel.ViewModels
|
||||
|
||||
private void SaveAndPlaySound(string fullPath, string ext, byte[] data)
|
||||
{
|
||||
var userDir = Path.Combine(UserSettings.Default.OutputDirectory, "Exports");
|
||||
if (fullPath.StartsWith("/")) fullPath = fullPath[1..];
|
||||
var savedAudioPath = Path.Combine(userDir,
|
||||
var savedAudioPath = Path.Combine(UserSettings.Default.AudioDirectory,
|
||||
UserSettings.Default.KeepDirectoryStructure ? fullPath : fullPath.SubstringAfterLast('/')).Replace('\\', '/') + $".{ext.ToLower()}";
|
||||
|
||||
if (!UserSettings.Default.IsAutoOpenSounds)
|
||||
@@ -776,13 +775,11 @@ namespace FModel.ViewModels
|
||||
public void ExportData(string fullPath)
|
||||
{
|
||||
var fileName = fullPath.SubstringAfterLast('/');
|
||||
var directory = Path.Combine(UserSettings.Default.OutputDirectory, "Exports");
|
||||
|
||||
if (Provider.TrySavePackage(fullPath, out var assets))
|
||||
{
|
||||
foreach (var kvp in assets)
|
||||
{
|
||||
var path = Path.Combine(directory, UserSettings.Default.KeepDirectoryStructure ? kvp.Key : kvp.Key.SubstringAfterLast('/')).Replace('\\', '/');
|
||||
var path = Path.Combine(UserSettings.Default.RawDataDirectory, UserSettings.Default.KeepDirectoryStructure ? kvp.Key : kvp.Key.SubstringAfterLast('/')).Replace('\\', '/');
|
||||
Directory.CreateDirectory(path.SubstringBeforeLast('/'));
|
||||
File.WriteAllBytes(path, kvp.Value);
|
||||
}
|
||||
|
||||
@@ -133,6 +133,10 @@ namespace FModel.ViewModels
|
||||
private readonly FGame _game;
|
||||
private Game _gamePreset;
|
||||
private string _outputSnapshot;
|
||||
private string _rawDataSnapshot;
|
||||
private string _propertiesSnapshot;
|
||||
private string _textureSnapshot;
|
||||
private string _audioSnapshot;
|
||||
private string _modelSnapshot;
|
||||
private string _gameSnapshot;
|
||||
private EUpdateMode _updateModeSnapshot;
|
||||
@@ -155,6 +159,10 @@ namespace FModel.ViewModels
|
||||
public void Initialize()
|
||||
{
|
||||
_outputSnapshot = UserSettings.Default.OutputDirectory;
|
||||
_rawDataSnapshot = UserSettings.Default.RawDataDirectory;
|
||||
_propertiesSnapshot = UserSettings.Default.PropertiesDirectory;
|
||||
_textureSnapshot = UserSettings.Default.TextureDirectory;
|
||||
_audioSnapshot = UserSettings.Default.AudioDirectory;
|
||||
_modelSnapshot = UserSettings.Default.ModelDirectory;
|
||||
_gameSnapshot = UserSettings.Default.GameDirectory;
|
||||
_updateModeSnapshot = UserSettings.Default.UpdateMode;
|
||||
@@ -252,6 +260,10 @@ namespace FModel.ViewModels
|
||||
if (_ueGameSnapshot != SelectedUeGame || // combobox
|
||||
_customVersionsSnapshot != SelectedCustomVersions || _optionsSnapshot != SelectedOptions ||
|
||||
_outputSnapshot != UserSettings.Default.OutputDirectory || // textbox
|
||||
_rawDataSnapshot != UserSettings.Default.RawDataDirectory || // textbox
|
||||
_propertiesSnapshot != UserSettings.Default.PropertiesDirectory || // textbox
|
||||
_textureSnapshot != UserSettings.Default.TextureDirectory || // textbox
|
||||
_audioSnapshot != UserSettings.Default.AudioDirectory || // textbox
|
||||
_modelSnapshot != UserSettings.Default.ModelDirectory || // textbox
|
||||
_gameSnapshot != UserSettings.Default.GameDirectory) // textbox
|
||||
ret = SettingsOut.Restart;
|
||||
|
||||
@@ -266,7 +266,7 @@ namespace FModel.ViewModels
|
||||
{
|
||||
if (image == null) return;
|
||||
var fileName = $"{image.ExportName}.png";
|
||||
var directory = Path.Combine(UserSettings.Default.OutputDirectory, "Exports",
|
||||
var directory = Path.Combine(UserSettings.Default.TextureDirectory,
|
||||
UserSettings.Default.KeepDirectoryStructure ? Directory : "", fileName!).Replace('\\', '/');
|
||||
|
||||
if (!autoSave)
|
||||
@@ -275,7 +275,7 @@ namespace FModel.ViewModels
|
||||
{
|
||||
Title = "Save Texture",
|
||||
FileName = fileName,
|
||||
InitialDirectory = Path.Combine(UserSettings.Default.OutputDirectory, "Exports"),
|
||||
InitialDirectory = UserSettings.Default.TextureDirectory,
|
||||
Filter = "PNG Files (*.png)|*.png|All Files (*.*)|*.*"
|
||||
};
|
||||
var result = saveFileDialog.ShowDialog();
|
||||
@@ -298,7 +298,7 @@ namespace FModel.ViewModels
|
||||
public void SaveProperty(bool autoSave)
|
||||
{
|
||||
var fileName = Path.ChangeExtension(Header, ".json");
|
||||
var directory = Path.Combine(UserSettings.Default.OutputDirectory, "Exports",
|
||||
var directory = Path.Combine(UserSettings.Default.PropertiesDirectory,
|
||||
UserSettings.Default.KeepDirectoryStructure ? Directory : "", fileName).Replace('\\', '/');
|
||||
|
||||
if (!autoSave)
|
||||
@@ -307,7 +307,7 @@ namespace FModel.ViewModels
|
||||
{
|
||||
Title = "Save Property",
|
||||
FileName = fileName,
|
||||
InitialDirectory = Path.Combine(UserSettings.Default.OutputDirectory, "Exports"),
|
||||
InitialDirectory = UserSettings.Default.PropertiesDirectory,
|
||||
Filter = "JSON Files (*.json)|*.json|INI Files (*.ini)|*.ini|XML Files (*.xml)|*.xml|All Files (*.*)|*.*"
|
||||
};
|
||||
var result = saveFileDialog.ShowDialog();
|
||||
|
||||
Reference in New Issue
Block a user