static void ImportText(GameFile objectFile, string value, string openedFileDir, Parameters parameters) { if (objectFile.GameData is PTP ptp) { string path = value == "" ? Path.Combine(openedFileDir, Path.GetFileNameWithoutExtension(objectFile.Name) + ".TXT") : value; if (File.Exists(path)) { List <string[]> import = File.ReadAllLines(path, parameters.FileEncoding).Select(x => x.Split('\t')).ToList(); LineMap MAP = new LineMap(parameters.Map); if (parameters.LineByLine) { if (MAP[LineMap.Type.NewText] >= 0) { string[] importedText = import .Select(x => x[MAP[LineMap.Type.NewText]]) .ToArray(); ptp.ImportTextLBL(importedText); } } else { if (MAP[LineMap.Type.FileName] >= 0 & MAP[LineMap.Type.MSGindex] >= 0 & MAP[LineMap.Type.StringIndex] >= 0 & MAP[LineMap.Type.NewText] >= 0) { string[][] importedText = import .Where(x => x.Length >= MAP.MinLength) .Where(x => x[MAP[LineMap.Type.FileName]].Equals(objectFile.Name, StringComparison.CurrentCultureIgnoreCase)) .Where(x => x[MAP[LineMap.Type.NewText]] != "") .Select(x => new string[] { x[MAP[LineMap.Type.MSGindex]], x[MAP[LineMap.Type.StringIndex]], x[MAP[LineMap.Type.NewText]] }) .ToArray(); if (parameters.Width > 0) { var charWidth = Static.NewFont().GetCharWidth(Static.NewEncoding()); ptp.ImportText(importedText, charWidth, parameters.Width); } else { ptp.ImportText(importedText); } } } if (MAP[LineMap.Type.OldName] >= 0 & MAP[LineMap.Type.NewName] >= 0) { Dictionary <string, string> importedText = import .Where(x => x.Length >= MAP.MinLength) .GroupBy(x => x[MAP[LineMap.Type.OldName]]) .ToDictionary(x => x.Key, x => x.First()[MAP[LineMap.Type.NewName]]); ptp.ImportNames(importedText, Static.OldEncoding()); } } } else if (objectFile.GameData is StringList strlst) { string path = value == "" ? Path.Combine(openedFileDir, Path.GetFileNameWithoutExtension(objectFile.Name) + ".TXT") : value; if (File.Exists(path)) { string[][] importedtext = File.ReadAllLines(path, parameters.FileEncoding).Select(x => x.Split('\t')). Where(x => x.Length > 1 && x[1] != "").ToArray(); strlst.ImportText(importedtext); } } }