kwsch / NHSE

Animal Crossing: New Horizons save editor
https://berichan.github.io/GetNHSE/
GNU General Public License v3.0
1.01k stars 260 forks source link

Fix dump indexing #512

Closed Ixaruz closed 2 years ago

Ixaruz commented 2 years ago

Is your feature request related to a problem? Please describe. I just encountered a problem with the indexing when dumping all/loading all [Pro]designs. Designs with numbers in front will mess up the loading process and shift the patterns.

Describe the solution you'd like either an option to turn on indexing on or off or creating a seperate folder for either indexed or indexless files.

Describe alternatives you've considered deleting the extra files does the trick.

Additional context here is the issue im talking about btw issue

could potentially do something like this:

        private static void Dump(this DesignPattern dp, string path, int index)
        {
            var name = dp.DesignName;
            if (settings.DumpIndexing) {
                // Dump with index
                fn = StringUtil.CleanFileName($"{index:00} - {name}.nhpd");
                dest = Path.Combine(path, fn);
                File.WriteAllBytes(dest, dp.Data);
            }
            else {
                // Dump without index
                var fn = StringUtil.CleanFileName($"{name}.nhpd");
                var dest = Path.Combine(dest, fn);
                File.WriteAllBytes(dest, dp.Data);
            }
        }