public static String Modify(String source) { source = TextOpCodeModifier.ReplaceMogIconText(source); source = TextOpCodeModifier.ReplaceChanbaraText(source); source = TextOpCodeModifier.ReplacePotionShopText(source); source = TextOpCodeModifier.ReplaceFossilRouteText(source); source = TextOpCodeModifier.ReplaceAuctionText(source); source = TextOpCodeModifier.ReplaceGyshalShopText(source); source = TextOpCodeModifier.ReplaceOreShopText(source); source = TextOpCodeModifier.ReplaceEikoCookingText(source); source = TextOpCodeModifier.ReplacePandoniumText(source); return(source); }
private static Boolean ReadEmbadedText(Int32 fieldZoneId, out String[] text) { String path = EmbadedTextResources.GetCurrentPath("/Field/" + FF9TextToolInterceptor.GetFieldTextFileName(fieldZoneId) + ".mes"); String raw = EmbadedSentenseLoader.LoadText(path); if (raw != null) { raw = TextOpCodeModifier.Modify(raw); text = FF9TextToolInterceptor.ExtractSentense(raw); return(true); } text = null; return(false); }
public void Export() { try { String directory = ModTextResources.Export.FieldsDirectory; if (Directory.Exists(directory)) { Log.Warning($"[{nameof(FieldExporter)}] Some fields refer to each other. They should be exported together."); Log.Warning($"[{nameof(FieldExporter)}] Export was skipped bacause the directory already exists: [{directory}]."); return; } Log.Message($"[{nameof(FieldExporter)}] Exporting..."); FieldFormatter formatter = new FieldFormatter(); KeyValuePair <Int32, String> chocoboForest = new KeyValuePair <Int32, String>(945, "MES_CHOCO"); foreach (KeyValuePair <Int32, String> pair in ExtensionMethodsIEnumerable.Append(FF9DBAll.EventDB, chocoboForest)) { Int32 fieldZoneId = pair.Key; String path = EmbadedTextResources.GetCurrentPath("/Field/" + GetFieldTextFileName(fieldZoneId) + ".mes"); String text = EmbadedSentenseLoader.LoadText(path); if (text == null) { continue; } String name = fieldZoneId.ToString("D4", CultureInfo.InvariantCulture) + '_' + pair.Value; text = TextOpCodeModifier.Modify(text); String[] lines = FF9TextTool.ExtractSentense(text); TxtEntry[] commands = formatter.Build(name, lines); Directory.CreateDirectory(directory); String outputPath = Path.Combine(directory, name + ".strings"); TxtWriter.WriteStrings(outputPath, commands); } ExportTags(directory, formatter); Log.Message($"[{nameof(FieldExporter)}] Exporting completed successfully."); } catch (Exception ex) { Log.Error(ex, $"[{nameof(FieldExporter)}] Failed to export resource."); } }