mirror of
https://github.com/KillzXGaming/Switch-Toolbox
synced 2024-11-25 22:10:22 +00:00
Properly check for text converting support for archive files
This commit is contained in:
parent
043983fdad
commit
b6de4bf6a4
1 changed files with 12 additions and 5 deletions
|
@ -232,13 +232,20 @@ namespace Toolbox.Library.Forms
|
|||
bool IsTextEditor = GetEditor() == 3;
|
||||
|
||||
var File = ArchiveFileInfo.FileFormat;
|
||||
if (IsTextEditor && File != null && IsConvertableText(File.GetType()) && ((IConvertableTextFormat)File).CanConvertBack)
|
||||
if (IsTextEditor && File != null && IsConvertableText(File.GetType()))
|
||||
{
|
||||
TextEditor editor = (TextEditor)GetActiveEditor(typeof(TextEditor));
|
||||
((IConvertableTextFormat)File).ConvertFromString(editor.GetText());
|
||||
if (((IConvertableTextFormat)File).CanConvertBack)
|
||||
{
|
||||
TextEditor editor = (TextEditor)GetActiveEditor(typeof(TextEditor));
|
||||
((IConvertableTextFormat)File).ConvertFromString(editor.GetText());
|
||||
|
||||
ArchiveFileInfo.SaveFileFormat();
|
||||
MessageBox.Show($"Saved {File.FileName} to archive!");
|
||||
ArchiveFileInfo.SaveFileFormat();
|
||||
MessageBox.Show($"Saved {File.FileName} to archive!");
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show($"File format does not support converting back from type: {((IConvertableTextFormat)File).TextFileType}!");
|
||||
}
|
||||
}
|
||||
else if (File != null && File.CanSave)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue