mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-09-15 00:25:20 -05:00
Add custom savefile extension support
savexts.txt if you wanna update it without recompiling Keep in mind these are just aliases for raw data. No conversion is done, it only allows the file to be filtered to. Closes #1955 #1856 #1455
This commit is contained in:
@@ -129,6 +129,9 @@ private void FormLoadInitialSettings(string[] args, out bool showChangelog, out
|
||||
}
|
||||
|
||||
FormLoadPlugins();
|
||||
var exts = Path.Combine(WorkingDirectory, "savexts.txt");
|
||||
if (File.Exists(exts))
|
||||
WinFormsUtil.AddSaveFileExtensions(File.ReadLines(exts));
|
||||
|
||||
PKME_Tabs.InitializeFields();
|
||||
PKME_Tabs.TemplateFields(LoadTemplate(C_SAV.SAV));
|
||||
|
||||
@@ -112,6 +112,20 @@ public static IEnumerable<Control> GetAllControlsOfType(Control control, Type ty
|
||||
public static bool IsClickonceDeployed => false;
|
||||
#endif
|
||||
|
||||
public static void AddSaveFileExtensions(IEnumerable<string> exts) => CustomSaveExtensions.AddRange(exts);
|
||||
private static readonly List<string> CustomSaveExtensions = new List<string>
|
||||
{
|
||||
// THESE ARE SAVE FILE EXTENSION TYPES. SAVE STATE (RAM SNAPSHOT) EXTENSIONS DO NOT GO HERE.
|
||||
"sav", // standard
|
||||
"dat", // VC data
|
||||
"gci", // Dolphin GameCubeImage
|
||||
"dsv", // DeSmuME
|
||||
"srm", // RetroArch save files
|
||||
"fla", // flashcard
|
||||
"SaveRAM", // BizHawk
|
||||
};
|
||||
private static string ExtraSaveExtensions => ";" + string.Join(";", CustomSaveExtensions.Select(z => $"*.{z}"));
|
||||
|
||||
/// <summary>
|
||||
/// Opens a dialog to open a <see cref="SaveFile"/>, <see cref="PKM"/> file, or any other supported file.
|
||||
/// </summary>
|
||||
@@ -124,10 +138,9 @@ public static bool OpenSAVPKMDialog(IEnumerable<string> Extensions, out string p
|
||||
OpenFileDialog ofd = new OpenFileDialog
|
||||
{
|
||||
Filter = "All Files|*.*" +
|
||||
$"|Supported Files|main;*.sav;*.dat;*.gci;*.bin;{supported};*.bak" +
|
||||
"|3DS Main Files|main" +
|
||||
"|Save Files|*.sav;*.dat;*.gci" +
|
||||
"|Decrypted PKM File|" + supported +
|
||||
$"|Supported Files (*.*)|main;*.bin;{supported};*.bak" + ExtraSaveExtensions +
|
||||
"|Save Files (*.sav)|main" + ExtraSaveExtensions +
|
||||
"|Decrypted PKM File (*.pkm)|" + supported +
|
||||
"|Binary File|*.bin" +
|
||||
"|Backup File|*.bak"
|
||||
};
|
||||
@@ -211,6 +224,7 @@ public static bool SaveSAVDialog(SaveFile SAV, int CurrentBox = 0)
|
||||
{
|
||||
Filter = SAV.Filter,
|
||||
FileName = SAV.FileName,
|
||||
FilterIndex = 1000, // default to last, All Files
|
||||
RestoreDirectory = true
|
||||
};
|
||||
if (Directory.Exists(SAV.FilePath))
|
||||
|
||||
Reference in New Issue
Block a user