private void FileMenuOpen_Click(object sender, RoutedEventArgs e) { OpenFileDialog openFileDialog = new OpenFileDialog { Filter = "Decompressed NUTR file|*.nutr.decompressed" }; if (openFileDialog.ShowDialog() == true) { Nutr.FileTypeBPLength fileType = Nutr.FileTypeBPLength.DRAMA; if (openFileDialog.FileName.Contains("interface", StringComparison.OrdinalIgnoreCase)) { fileType = Nutr.FileTypeBPLength.INTERFACE; } else if (openFileDialog.FileName.Contains("item", StringComparison.OrdinalIgnoreCase)) { fileType = Nutr.FileTypeBPLength.ITEM; } Title = $"Sailor Moon La Luna Splende Script Editor - {Path.GetFileName(openFileDialog.FileName)}"; NutrFile = Nutr.ParseFromFile(openFileDialog.FileName, fileType); commandsListBox.ItemsSource = NutrFile.PostScriptCommands.Select(c => $"{c.Line(NutrFile.Script.Select(n => n.Text).ToList())} (0x{c.LineNumber:X2}):\t\t" + $"0x{string.Join(" ", c.CommandBytes.Select(cb => $"{cb:X2}"))}"); dialogueListBox.ItemsSource = NutrFile.DialogueBoxes; } }
public void NutrParseWriteSame(string file, Nutr.FileTypeBPLength fileType) { byte[] dataOnDisk = File.ReadAllBytes(file); Nutr nutr = Nutr.ParseFromFile(file, fileType); byte[] dataInMemory = nutr.GetBytes(); Assert.AreEqual(dataOnDisk, dataInMemory); }