mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
[GUI] Replace file dialogs with file pickers.
This commit is contained in:
@@ -30,12 +30,14 @@
|
||||
// Copyright © 2011-2024 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Reactive;
|
||||
using System.Threading.Tasks;
|
||||
using Aaru.Decoders.ATA;
|
||||
using Aaru.Localization;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Platform.Storage;
|
||||
using JetBrains.Annotations;
|
||||
using ReactiveUI;
|
||||
|
||||
@@ -112,25 +114,17 @@ public sealed class AtaInfoViewModel : ViewModelBase
|
||||
|
||||
async Task ExecuteSaveAtaBinaryCommand()
|
||||
{
|
||||
var dlgSaveBinary = new SaveFileDialog();
|
||||
|
||||
dlgSaveBinary.Filters?.Add(new FileDialogFilter
|
||||
IStorageFile result = await _view.StorageProvider.SaveFilePickerAsync(new FilePickerSaveOptions
|
||||
{
|
||||
Extensions =
|
||||
[
|
||||
..new[]
|
||||
{
|
||||
"*.bin"
|
||||
}
|
||||
],
|
||||
Name = UI.Dialog_Binary_files
|
||||
FileTypeChoices = new List<FilePickerFileType>
|
||||
{
|
||||
FilePickerFileTypes.Binary
|
||||
}
|
||||
});
|
||||
|
||||
string result = await dlgSaveBinary.ShowAsync(_view);
|
||||
|
||||
if(result is null) return;
|
||||
|
||||
var saveFs = new FileStream(result, FileMode.Create);
|
||||
var saveFs = new FileStream(result.Path.AbsolutePath, FileMode.Create);
|
||||
|
||||
if(_ata != null)
|
||||
saveFs.Write(_ata, 0, _ata.Length);
|
||||
@@ -141,25 +135,17 @@ public sealed class AtaInfoViewModel : ViewModelBase
|
||||
|
||||
async Task ExecuteSaveAtaTextCommand()
|
||||
{
|
||||
var dlgSaveText = new SaveFileDialog();
|
||||
|
||||
dlgSaveText.Filters?.Add(new FileDialogFilter
|
||||
IStorageFile result = await _view.StorageProvider.SaveFilePickerAsync(new FilePickerSaveOptions
|
||||
{
|
||||
Extensions =
|
||||
[
|
||||
..new[]
|
||||
{
|
||||
"*.txt"
|
||||
}
|
||||
],
|
||||
Name = UI.Dialog_Text_files
|
||||
FileTypeChoices = new List<FilePickerFileType>
|
||||
{
|
||||
FilePickerFileTypes.PlainText
|
||||
}
|
||||
});
|
||||
|
||||
string result = await dlgSaveText.ShowAsync(_view);
|
||||
|
||||
if(result is null) return;
|
||||
|
||||
var saveFs = new FileStream(result, FileMode.Create);
|
||||
var saveFs = new FileStream(result.Path.AbsolutePath, FileMode.Create);
|
||||
var saveSw = new StreamWriter(saveFs);
|
||||
await saveSw.WriteAsync(AtaIdentifyText);
|
||||
saveFs.Close();
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
// Copyright © 2011-2024 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Reactive;
|
||||
using System.Threading.Tasks;
|
||||
@@ -37,6 +38,7 @@ using Aaru.Decoders.Bluray;
|
||||
using Aaru.Decoders.SCSI.MMC;
|
||||
using Aaru.Localization;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Platform.Storage;
|
||||
using JetBrains.Annotations;
|
||||
using ReactiveUI;
|
||||
|
||||
@@ -174,25 +176,17 @@ public sealed class BlurayInfoViewModel
|
||||
|
||||
async Task SaveElement(byte[] data)
|
||||
{
|
||||
var dlgSaveBinary = new SaveFileDialog();
|
||||
|
||||
dlgSaveBinary.Filters?.Add(new FileDialogFilter
|
||||
IStorageFile result = await _view.StorageProvider.SaveFilePickerAsync(new FilePickerSaveOptions
|
||||
{
|
||||
Extensions =
|
||||
[
|
||||
..new[]
|
||||
{
|
||||
"*.bin"
|
||||
}
|
||||
],
|
||||
Name = UI.Dialog_Binary_files
|
||||
FileTypeChoices = new List<FilePickerFileType>
|
||||
{
|
||||
FilePickerFileTypes.Binary
|
||||
}
|
||||
});
|
||||
|
||||
string result = await dlgSaveBinary.ShowAsync(_view);
|
||||
|
||||
if(result is null) return;
|
||||
|
||||
var saveFs = new FileStream(result, FileMode.Create);
|
||||
var saveFs = new FileStream(result.Path.AbsolutePath, FileMode.Create);
|
||||
saveFs.Write(data, 0, data.Length);
|
||||
|
||||
saveFs.Close();
|
||||
|
||||
@@ -40,6 +40,7 @@ using Aaru.Decoders.SCSI.MMC;
|
||||
using Aaru.Gui.Models;
|
||||
using Aaru.Localization;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Platform.Storage;
|
||||
using ReactiveUI;
|
||||
|
||||
namespace Aaru.Gui.ViewModels.Tabs;
|
||||
@@ -149,25 +150,17 @@ public sealed class CompactDiscInfoViewModel : ViewModelBase
|
||||
|
||||
async Task ExecuteSaveCdInformationCommand()
|
||||
{
|
||||
var dlgSaveBinary = new SaveFileDialog();
|
||||
|
||||
dlgSaveBinary.Filters?.Add(new FileDialogFilter
|
||||
IStorageFile result = await _view.StorageProvider.SaveFilePickerAsync(new FilePickerSaveOptions
|
||||
{
|
||||
Extensions =
|
||||
[
|
||||
..new[]
|
||||
{
|
||||
"*.bin"
|
||||
}
|
||||
],
|
||||
Name = UI.Dialog_Binary_files
|
||||
FileTypeChoices = new List<FilePickerFileType>
|
||||
{
|
||||
FilePickerFileTypes.Binary
|
||||
}
|
||||
});
|
||||
|
||||
string result = await dlgSaveBinary.ShowAsync(_view);
|
||||
|
||||
if(result is null) return;
|
||||
|
||||
var saveFs = new FileStream(result, FileMode.Create);
|
||||
var saveFs = new FileStream(result.Path.AbsolutePath, FileMode.Create);
|
||||
saveFs.Write(_compactDiscInformationData, 0, _compactDiscInformationData.Length);
|
||||
|
||||
saveFs.Close();
|
||||
@@ -175,25 +168,17 @@ public sealed class CompactDiscInfoViewModel : ViewModelBase
|
||||
|
||||
async Task ExecuteSaveCdTocCommand()
|
||||
{
|
||||
var dlgSaveBinary = new SaveFileDialog();
|
||||
|
||||
dlgSaveBinary.Filters?.Add(new FileDialogFilter
|
||||
IStorageFile result = await _view.StorageProvider.SaveFilePickerAsync(new FilePickerSaveOptions
|
||||
{
|
||||
Extensions =
|
||||
[
|
||||
..new[]
|
||||
{
|
||||
"*.bin"
|
||||
}
|
||||
],
|
||||
Name = UI.Dialog_Binary_files
|
||||
FileTypeChoices = new List<FilePickerFileType>
|
||||
{
|
||||
FilePickerFileTypes.Binary
|
||||
}
|
||||
});
|
||||
|
||||
string result = await dlgSaveBinary.ShowAsync(_view);
|
||||
|
||||
if(result is null) return;
|
||||
|
||||
var saveFs = new FileStream(result, FileMode.Create);
|
||||
var saveFs = new FileStream(result.Path.AbsolutePath, FileMode.Create);
|
||||
saveFs.Write(_tocData, 0, _tocData.Length);
|
||||
|
||||
saveFs.Close();
|
||||
@@ -201,25 +186,17 @@ public sealed class CompactDiscInfoViewModel : ViewModelBase
|
||||
|
||||
async Task ExecuteSaveCdFullTocCommand()
|
||||
{
|
||||
var dlgSaveBinary = new SaveFileDialog();
|
||||
|
||||
dlgSaveBinary.Filters?.Add(new FileDialogFilter
|
||||
IStorageFile result = await _view.StorageProvider.SaveFilePickerAsync(new FilePickerSaveOptions
|
||||
{
|
||||
Extensions =
|
||||
[
|
||||
..new[]
|
||||
{
|
||||
"*.bin"
|
||||
}
|
||||
],
|
||||
Name = UI.Dialog_Binary_files
|
||||
FileTypeChoices = new List<FilePickerFileType>
|
||||
{
|
||||
FilePickerFileTypes.Binary
|
||||
}
|
||||
});
|
||||
|
||||
string result = await dlgSaveBinary.ShowAsync(_view);
|
||||
|
||||
if(result is null) return;
|
||||
|
||||
var saveFs = new FileStream(result, FileMode.Create);
|
||||
var saveFs = new FileStream(result.Path.AbsolutePath, FileMode.Create);
|
||||
saveFs.Write(_rawTocData, 0, _rawTocData.Length);
|
||||
|
||||
saveFs.Close();
|
||||
@@ -227,25 +204,17 @@ public sealed class CompactDiscInfoViewModel : ViewModelBase
|
||||
|
||||
async Task ExecuteSaveCdSessionCommand()
|
||||
{
|
||||
var dlgSaveBinary = new SaveFileDialog();
|
||||
|
||||
dlgSaveBinary.Filters?.Add(new FileDialogFilter
|
||||
IStorageFile result = await _view.StorageProvider.SaveFilePickerAsync(new FilePickerSaveOptions
|
||||
{
|
||||
Extensions =
|
||||
[
|
||||
..new[]
|
||||
{
|
||||
"*.bin"
|
||||
}
|
||||
],
|
||||
Name = UI.Dialog_Binary_files
|
||||
FileTypeChoices = new List<FilePickerFileType>
|
||||
{
|
||||
FilePickerFileTypes.Binary
|
||||
}
|
||||
});
|
||||
|
||||
string result = await dlgSaveBinary.ShowAsync(_view);
|
||||
|
||||
if(result is null) return;
|
||||
|
||||
var saveFs = new FileStream(result, FileMode.Create);
|
||||
var saveFs = new FileStream(result.Path.AbsolutePath, FileMode.Create);
|
||||
saveFs.Write(_sessionData, 0, _sessionData.Length);
|
||||
|
||||
saveFs.Close();
|
||||
@@ -253,25 +222,17 @@ public sealed class CompactDiscInfoViewModel : ViewModelBase
|
||||
|
||||
async Task ExecuteSaveCdTextCommand()
|
||||
{
|
||||
var dlgSaveBinary = new SaveFileDialog();
|
||||
|
||||
dlgSaveBinary.Filters?.Add(new FileDialogFilter
|
||||
IStorageFile result = await _view.StorageProvider.SaveFilePickerAsync(new FilePickerSaveOptions
|
||||
{
|
||||
Extensions =
|
||||
[
|
||||
..new[]
|
||||
{
|
||||
"*.bin"
|
||||
}
|
||||
],
|
||||
Name = UI.Dialog_Binary_files
|
||||
FileTypeChoices = new List<FilePickerFileType>
|
||||
{
|
||||
FilePickerFileTypes.Binary
|
||||
}
|
||||
});
|
||||
|
||||
string result = await dlgSaveBinary.ShowAsync(_view);
|
||||
|
||||
if(result is null) return;
|
||||
|
||||
var saveFs = new FileStream(result, FileMode.Create);
|
||||
var saveFs = new FileStream(result.Path.AbsolutePath, FileMode.Create);
|
||||
saveFs.Write(_cdTextLeadInData, 0, _cdTextLeadInData.Length);
|
||||
|
||||
saveFs.Close();
|
||||
@@ -279,25 +240,17 @@ public sealed class CompactDiscInfoViewModel : ViewModelBase
|
||||
|
||||
async Task ExecuteSaveCdAtipCommand()
|
||||
{
|
||||
var dlgSaveBinary = new SaveFileDialog();
|
||||
|
||||
dlgSaveBinary.Filters?.Add(new FileDialogFilter
|
||||
IStorageFile result = await _view.StorageProvider.SaveFilePickerAsync(new FilePickerSaveOptions
|
||||
{
|
||||
Extensions =
|
||||
[
|
||||
..new[]
|
||||
{
|
||||
"*.bin"
|
||||
}
|
||||
],
|
||||
Name = UI.Dialog_Binary_files
|
||||
FileTypeChoices = new List<FilePickerFileType>
|
||||
{
|
||||
FilePickerFileTypes.Binary
|
||||
}
|
||||
});
|
||||
|
||||
string result = await dlgSaveBinary.ShowAsync(_view);
|
||||
|
||||
if(result is null) return;
|
||||
|
||||
var saveFs = new FileStream(result, FileMode.Create);
|
||||
var saveFs = new FileStream(result.Path.AbsolutePath, FileMode.Create);
|
||||
saveFs.Write(_atipData, 0, _atipData.Length);
|
||||
|
||||
saveFs.Close();
|
||||
@@ -305,25 +258,17 @@ public sealed class CompactDiscInfoViewModel : ViewModelBase
|
||||
|
||||
async Task ExecuteSaveCdPmaCommand()
|
||||
{
|
||||
var dlgSaveBinary = new SaveFileDialog();
|
||||
|
||||
dlgSaveBinary.Filters?.Add(new FileDialogFilter
|
||||
IStorageFile result = await _view.StorageProvider.SaveFilePickerAsync(new FilePickerSaveOptions
|
||||
{
|
||||
Extensions =
|
||||
[
|
||||
..new[]
|
||||
{
|
||||
"*.bin"
|
||||
}
|
||||
],
|
||||
Name = UI.Dialog_Binary_files
|
||||
FileTypeChoices = new List<FilePickerFileType>
|
||||
{
|
||||
FilePickerFileTypes.Binary
|
||||
}
|
||||
});
|
||||
|
||||
string result = await dlgSaveBinary.ShowAsync(_view);
|
||||
|
||||
if(result is null) return;
|
||||
|
||||
var saveFs = new FileStream(result, FileMode.Create);
|
||||
var saveFs = new FileStream(result.Path.AbsolutePath, FileMode.Create);
|
||||
saveFs.Write(_pmaData, 0, _pmaData.Length);
|
||||
|
||||
saveFs.Close();
|
||||
|
||||
@@ -30,12 +30,14 @@
|
||||
// Copyright © 2011-2024 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Reactive;
|
||||
using System.Threading.Tasks;
|
||||
using Aaru.Decoders.DVD;
|
||||
using Aaru.Localization;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Platform.Storage;
|
||||
using JetBrains.Annotations;
|
||||
using ReactiveUI;
|
||||
|
||||
@@ -124,25 +126,17 @@ public sealed class DvdInfoViewModel
|
||||
|
||||
async Task SaveElement(byte[] data)
|
||||
{
|
||||
var dlgSaveBinary = new SaveFileDialog();
|
||||
|
||||
dlgSaveBinary.Filters?.Add(new FileDialogFilter
|
||||
IStorageFile result = await _view.StorageProvider.SaveFilePickerAsync(new FilePickerSaveOptions
|
||||
{
|
||||
Extensions =
|
||||
[
|
||||
..new[]
|
||||
{
|
||||
"*.bin"
|
||||
}
|
||||
],
|
||||
Name = UI.Dialog_Binary_files
|
||||
FileTypeChoices = new List<FilePickerFileType>
|
||||
{
|
||||
FilePickerFileTypes.Binary
|
||||
}
|
||||
});
|
||||
|
||||
string result = await dlgSaveBinary.ShowAsync(_view);
|
||||
|
||||
if(result is null) return;
|
||||
|
||||
var saveFs = new FileStream(result, FileMode.Create);
|
||||
var saveFs = new FileStream(result.Path.AbsolutePath, FileMode.Create);
|
||||
saveFs.Write(data, 0, data.Length);
|
||||
|
||||
saveFs.Close();
|
||||
|
||||
@@ -30,12 +30,14 @@
|
||||
// Copyright © 2011-2024 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Reactive;
|
||||
using System.Threading.Tasks;
|
||||
using Aaru.Decoders.DVD;
|
||||
using Aaru.Localization;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Platform.Storage;
|
||||
using ReactiveUI;
|
||||
|
||||
namespace Aaru.Gui.ViewModels.Tabs;
|
||||
@@ -250,25 +252,17 @@ public sealed class DvdWritableInfoViewModel
|
||||
|
||||
async Task SaveElement(byte[] data)
|
||||
{
|
||||
var dlgSaveBinary = new SaveFileDialog();
|
||||
|
||||
dlgSaveBinary.Filters?.Add(new FileDialogFilter
|
||||
IStorageFile result = await _view.StorageProvider.SaveFilePickerAsync(new FilePickerSaveOptions
|
||||
{
|
||||
Extensions =
|
||||
[
|
||||
..new[]
|
||||
{
|
||||
"*.bin"
|
||||
}
|
||||
],
|
||||
Name = UI.Dialog_Binary_files
|
||||
FileTypeChoices = new List<FilePickerFileType>
|
||||
{
|
||||
FilePickerFileTypes.Binary
|
||||
}
|
||||
});
|
||||
|
||||
string result = await dlgSaveBinary.ShowAsync(_view);
|
||||
|
||||
if(result is null) return;
|
||||
|
||||
var saveFs = new FileStream(result, FileMode.Create);
|
||||
var saveFs = new FileStream(result.Path.AbsolutePath, FileMode.Create);
|
||||
saveFs.Write(data, 0, data.Length);
|
||||
|
||||
saveFs.Close();
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
// Copyright © 2011-2024 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.IO;
|
||||
using System.Reactive;
|
||||
@@ -39,6 +40,7 @@ using Aaru.Decoders.PCMCIA;
|
||||
using Aaru.Gui.Models;
|
||||
using Aaru.Localization;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Platform.Storage;
|
||||
using JetBrains.Annotations;
|
||||
using ReactiveUI;
|
||||
|
||||
@@ -175,25 +177,17 @@ public class PcmciaInfoViewModel : ViewModelBase
|
||||
|
||||
async Task ExecuteSavePcmciaCisCommand()
|
||||
{
|
||||
var dlgSaveBinary = new SaveFileDialog();
|
||||
|
||||
dlgSaveBinary.Filters?.Add(new FileDialogFilter
|
||||
IStorageFile result = await _view.StorageProvider.SaveFilePickerAsync(new FilePickerSaveOptions
|
||||
{
|
||||
Extensions =
|
||||
[
|
||||
..new[]
|
||||
{
|
||||
"*.bin"
|
||||
}
|
||||
],
|
||||
Name = UI.Dialog_Binary_files
|
||||
FileTypeChoices = new List<FilePickerFileType>
|
||||
{
|
||||
FilePickerFileTypes.Binary
|
||||
}
|
||||
});
|
||||
|
||||
string result = await dlgSaveBinary.ShowAsync(_view);
|
||||
|
||||
if(result is null) return;
|
||||
|
||||
var saveFs = new FileStream(result, FileMode.Create);
|
||||
var saveFs = new FileStream(result.Path.AbsolutePath, FileMode.Create);
|
||||
saveFs.Write(_cis, 0, _cis.Length);
|
||||
|
||||
saveFs.Close();
|
||||
|
||||
@@ -44,6 +44,7 @@ using Aaru.Gui.Models;
|
||||
using Aaru.Helpers;
|
||||
using Aaru.Localization;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Platform.Storage;
|
||||
using ReactiveUI;
|
||||
using Inquiry = Aaru.CommonTypes.Structs.Devices.SCSI.Inquiry;
|
||||
|
||||
@@ -801,25 +802,17 @@ public sealed class ScsiInfoViewModel : ViewModelBase
|
||||
|
||||
async Task ExecuteSaveInquiryBinaryCommand()
|
||||
{
|
||||
var dlgSaveBinary = new SaveFileDialog();
|
||||
|
||||
dlgSaveBinary.Filters?.Add(new FileDialogFilter
|
||||
IStorageFile result = await _view.StorageProvider.SaveFilePickerAsync(new FilePickerSaveOptions
|
||||
{
|
||||
Extensions =
|
||||
[
|
||||
..new[]
|
||||
{
|
||||
"*.bin"
|
||||
}
|
||||
],
|
||||
Name = UI.Dialog_Binary_files
|
||||
FileTypeChoices = new List<FilePickerFileType>
|
||||
{
|
||||
FilePickerFileTypes.Binary
|
||||
}
|
||||
});
|
||||
|
||||
string result = await dlgSaveBinary.ShowAsync(_view);
|
||||
|
||||
if(result is null) return;
|
||||
|
||||
var saveFs = new FileStream(result, FileMode.Create);
|
||||
var saveFs = new FileStream(result.Path.AbsolutePath, FileMode.Create);
|
||||
saveFs.Write(InquiryData, 0, InquiryData.Length);
|
||||
|
||||
saveFs.Close();
|
||||
@@ -827,25 +820,17 @@ public sealed class ScsiInfoViewModel : ViewModelBase
|
||||
|
||||
async Task ExecuteSaveInquiryTextCommand()
|
||||
{
|
||||
var dlgSaveText = new SaveFileDialog();
|
||||
|
||||
dlgSaveText.Filters?.Add(new FileDialogFilter
|
||||
IStorageFile result = await _view.StorageProvider.SaveFilePickerAsync(new FilePickerSaveOptions
|
||||
{
|
||||
Extensions =
|
||||
[
|
||||
..new[]
|
||||
{
|
||||
"*.txt"
|
||||
}
|
||||
],
|
||||
Name = UI.Dialog_Text_files
|
||||
FileTypeChoices = new List<FilePickerFileType>
|
||||
{
|
||||
FilePickerFileTypes.PlainText
|
||||
}
|
||||
});
|
||||
|
||||
string result = await dlgSaveText.ShowAsync(_view);
|
||||
|
||||
if(result is null) return;
|
||||
|
||||
var saveFs = new FileStream(result, FileMode.Create);
|
||||
var saveFs = new FileStream(result.Path.AbsolutePath, FileMode.Create);
|
||||
var saveSw = new StreamWriter(saveFs);
|
||||
await saveSw.WriteAsync(ScsiInquiryText);
|
||||
saveFs.Close();
|
||||
@@ -853,25 +838,17 @@ public sealed class ScsiInfoViewModel : ViewModelBase
|
||||
|
||||
async Task ExecuteSaveModeSense6Command()
|
||||
{
|
||||
var dlgSaveBinary = new SaveFileDialog();
|
||||
|
||||
dlgSaveBinary.Filters?.Add(new FileDialogFilter
|
||||
IStorageFile result = await _view.StorageProvider.SaveFilePickerAsync(new FilePickerSaveOptions
|
||||
{
|
||||
Extensions =
|
||||
[
|
||||
..new[]
|
||||
{
|
||||
"*.bin"
|
||||
}
|
||||
],
|
||||
Name = UI.Dialog_Binary_files
|
||||
FileTypeChoices = new List<FilePickerFileType>
|
||||
{
|
||||
FilePickerFileTypes.Binary
|
||||
}
|
||||
});
|
||||
|
||||
string result = await dlgSaveBinary.ShowAsync(_view);
|
||||
|
||||
if(result is null) return;
|
||||
|
||||
var saveFs = new FileStream(result, FileMode.Create);
|
||||
var saveFs = new FileStream(result.Path.AbsolutePath, FileMode.Create);
|
||||
saveFs.Write(_scsiModeSense6, 0, _scsiModeSense6.Length);
|
||||
|
||||
saveFs.Close();
|
||||
@@ -879,25 +856,17 @@ public sealed class ScsiInfoViewModel : ViewModelBase
|
||||
|
||||
async Task ExecuteSaveModeSense10Command()
|
||||
{
|
||||
var dlgSaveBinary = new SaveFileDialog();
|
||||
|
||||
dlgSaveBinary.Filters?.Add(new FileDialogFilter
|
||||
IStorageFile result = await _view.StorageProvider.SaveFilePickerAsync(new FilePickerSaveOptions
|
||||
{
|
||||
Extensions =
|
||||
[
|
||||
..new[]
|
||||
{
|
||||
"*.bin"
|
||||
}
|
||||
],
|
||||
Name = UI.Dialog_Binary_files
|
||||
FileTypeChoices = new List<FilePickerFileType>
|
||||
{
|
||||
FilePickerFileTypes.Binary
|
||||
}
|
||||
});
|
||||
|
||||
string result = await dlgSaveBinary.ShowAsync(_view);
|
||||
|
||||
if(result is null) return;
|
||||
|
||||
var saveFs = new FileStream(result, FileMode.Create);
|
||||
var saveFs = new FileStream(result.Path.AbsolutePath, FileMode.Create);
|
||||
saveFs.Write(_scsiModeSense10, 0, _scsiModeSense10.Length);
|
||||
|
||||
saveFs.Close();
|
||||
@@ -907,25 +876,17 @@ public sealed class ScsiInfoViewModel : ViewModelBase
|
||||
{
|
||||
if(SelectedEvpdPage is not ScsiPageModel pageModel) return;
|
||||
|
||||
var dlgSaveBinary = new SaveFileDialog();
|
||||
|
||||
dlgSaveBinary.Filters?.Add(new FileDialogFilter
|
||||
IStorageFile result = await _view.StorageProvider.SaveFilePickerAsync(new FilePickerSaveOptions
|
||||
{
|
||||
Extensions =
|
||||
[
|
||||
..new[]
|
||||
{
|
||||
"*.bin"
|
||||
}
|
||||
],
|
||||
Name = UI.Dialog_Binary_files
|
||||
FileTypeChoices = new List<FilePickerFileType>
|
||||
{
|
||||
FilePickerFileTypes.Binary
|
||||
}
|
||||
});
|
||||
|
||||
string result = await dlgSaveBinary.ShowAsync(_view);
|
||||
|
||||
if(result is null) return;
|
||||
|
||||
var saveFs = new FileStream(result, FileMode.Create);
|
||||
var saveFs = new FileStream(result.Path.AbsolutePath, FileMode.Create);
|
||||
saveFs.Write(pageModel.Data, 0, pageModel.Data.Length);
|
||||
|
||||
saveFs.Close();
|
||||
@@ -933,25 +894,17 @@ public sealed class ScsiInfoViewModel : ViewModelBase
|
||||
|
||||
async Task ExecuteSaveMmcFeaturesCommand()
|
||||
{
|
||||
var dlgSaveBinary = new SaveFileDialog();
|
||||
|
||||
dlgSaveBinary.Filters?.Add(new FileDialogFilter
|
||||
IStorageFile result = await _view.StorageProvider.SaveFilePickerAsync(new FilePickerSaveOptions
|
||||
{
|
||||
Extensions =
|
||||
[
|
||||
..new[]
|
||||
{
|
||||
"*.bin"
|
||||
}
|
||||
],
|
||||
Name = UI.Dialog_Binary_files
|
||||
FileTypeChoices = new List<FilePickerFileType>
|
||||
{
|
||||
FilePickerFileTypes.Binary
|
||||
}
|
||||
});
|
||||
|
||||
string result = await dlgSaveBinary.ShowAsync(_view);
|
||||
|
||||
if(result is null) return;
|
||||
|
||||
var saveFs = new FileStream(result, FileMode.Create);
|
||||
var saveFs = new FileStream(result.Path.AbsolutePath, FileMode.Create);
|
||||
saveFs.Write(_configuration, 0, _configuration.Length);
|
||||
|
||||
saveFs.Close();
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
// Copyright © 2011-2024 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Reactive;
|
||||
using System.Threading.Tasks;
|
||||
@@ -37,6 +38,7 @@ using Aaru.Core.Media.Info;
|
||||
using Aaru.Decoders.Xbox;
|
||||
using Aaru.Localization;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Platform.Storage;
|
||||
using JetBrains.Annotations;
|
||||
using ReactiveUI;
|
||||
|
||||
@@ -101,25 +103,17 @@ public sealed class XboxInfoViewModel
|
||||
|
||||
async Task SaveElement(byte[] data)
|
||||
{
|
||||
var dlgSaveBinary = new SaveFileDialog();
|
||||
|
||||
dlgSaveBinary.Filters?.Add(new FileDialogFilter
|
||||
IStorageFile result = await _view.StorageProvider.SaveFilePickerAsync(new FilePickerSaveOptions
|
||||
{
|
||||
Extensions =
|
||||
[
|
||||
..new[]
|
||||
{
|
||||
"*.bin"
|
||||
}
|
||||
],
|
||||
Name = UI.Dialog_Binary_files
|
||||
FileTypeChoices = new List<FilePickerFileType>
|
||||
{
|
||||
FilePickerFileTypes.Binary
|
||||
}
|
||||
});
|
||||
|
||||
string result = await dlgSaveBinary.ShowAsync(_view);
|
||||
|
||||
if(result is null) return;
|
||||
|
||||
var saveFs = new FileStream(result, FileMode.Create);
|
||||
var saveFs = new FileStream(result.Path.AbsolutePath, FileMode.Create);
|
||||
saveFs.Write(data, 0, data.Length);
|
||||
|
||||
saveFs.Close();
|
||||
|
||||
Reference in New Issue
Block a user