public void Export(CommandSubType com, ArgumentsWork.Parameters parameters, string dest)
 {
     if (com == CommandSubType.ALL)
     {
         ExportAll(parameters);
     }
 }
 public void Import(CommandSubType com, ArgumentsWork.Parameters parameters, string src)
 {
     if (com == CommandSubType.ALL)
     {
         ImportAll(parameters);
     }
 }
 public void Export(CommandSubType com, ArgumentsWork.Parameters parameters, string dest)
 {
     if (com == CommandSubType.TXT)
     {
         ExportTXT(dest, parameters);
     }
 }
 public void Import(CommandSubType com, ArgumentsWork.Parameters parameters, string src)
 {
     if (com == CommandSubType.TXT)
     {
         ImportTXT(src, parameters);
     }
 }
 public void Export(CommandSubType com, ArgumentsWork.Parameters parameters, string dest)
 {
     if (com == CommandSubType.Image)
     {
         ExportImg(dest);
     }
 }
        public void Save(ArgumentsWork.Parameters parameters, string dest)
        {
            if (dest == "")
            {
                dest = Util.GetNewPath(source, "(NEW).DAT");
            }

            File.WriteAllBytes(dest, StringList.Get(parameters.Old ? new CharList(parameters.OldMap, parameters.OldFont) : new CharList(parameters.NewMap, parameters.NewFont)));
        }
        public void Save(ArgumentsWork.Parameters parameters, string dest)
        {
            if (dest == "")
            {
                dest = Util.GetNewPath(source, "(NEW).FNT");
            }

            File.WriteAllBytes(dest, FNT.This);
        }
        public void Save(ArgumentsWork.Parameters parameters, string dest)
        {
            if (dest == "")
            {
                dest = Util.GetNewPath(source, ".PTP");
            }

            PTP.SaveProject(dest);
        }
        public void Save(ArgumentsWork.Parameters parameters, string dest)
        {
            if (dest == "")
            {
                dest = Util.GetNewPath(source, "(NEW).TBL");
            }

            File.WriteAllBytes(dest, TBL.Get(parameters.IsLittleEndian));
        }
        private void ExportAll(string dest, ArgumentsWork.Parameters ParList)
        {
            List <string> filelist = BIN.GetFileList.Select(x => Path.Combine(Path.GetDirectoryName(Path.GetFullPath(source)), Path.GetFileName(source) + "+" + x.Replace('/', '+'))).ToList();

            for (int i = 0; i < filelist.Count; i++)
            {
                using (BinaryWriter writer = new BinaryWriter(File.Create(filelist[i])))
                    writer.Write(BIN[i]);
            }
        }
        private void ExportAll(ArgumentsWork.Parameters ParList)
        {
            string temp  = Path.GetDirectoryName(Path.GetFullPath(source));
            string temp2 = Path.GetFileName(source);

            for (int i = 0; i < TBL.Count; i++)
            {
                File.WriteAllBytes(Path.Combine(temp, temp2 + "(" + i.ToString().PadLeft(2, '0') + ").DAT"), TBL[i]);
            }
        }
        private void ExportAll(ArgumentsWork.Parameters ParList)
        {
            string temp  = Path.GetDirectoryName(source);
            string temp2 = Path.GetFileNameWithoutExtension(source);

            for (int i = 0; i < BVP.Count; i++)
            {
                File.WriteAllBytes(Path.Combine(temp, temp2 + "(" + i.ToString().PadLeft(3, '0') + ").BMD"), BVP[i]);
            }
        }
        public void Save(ArgumentsWork.Parameters parameters, string dest)
        {
            if (dest == "")
            {
                string fullpath = Path.GetFullPath(source);
                dest = Path.GetDirectoryName(fullpath) + "\\" + Path.GetFileNameWithoutExtension(fullpath) + "(NEW)" + Path.GetExtension(fullpath);
            }

            File.WriteAllBytes(dest, BIN.Get(parameters.IsLittleEndian));
        }
        private void ExportBMD(string dest, ArgumentsWork.Parameters ParList)
        {
            if (dest == "")
            {
                dest = Util.GetNewPath(source, "(NEW).BMD");
            }

            PersonaEditorLib.FileStructure.BMD.BMD BMD = new PersonaEditorLib.FileStructure.BMD.BMD();
            BMD.Open(PTP);
            File.WriteAllBytes(dest, BMD.Get(ParList.IsLittleEndian));
        }
 public void Import(CommandSubType com, ArgumentsWork.Parameters parameters, string src)
 {
     if (com == CommandSubType.BMD)
     {
         ImportBMD(src);
     }
     else if (com == CommandSubType.PTP)
     {
         ImportPTP(src, parameters);
     }
 }
 public void Import(CommandSubType com, ArgumentsWork.Parameters parameters, string src)
 {
     if (com == CommandSubType.Image)
     {
         ImportImg(src);
     }
     if (com == CommandSubType.Table)
     {
         ImportWT(src);
     }
 }
        private void ExportPTP(string dest, ArgumentsWork.Parameters ParList)
        {
            if (dest == "")
            {
                dest = Util.GetNewPath(source, ".PTP");
            }

            PersonaEditorLib.FileStructure.PTP.PTP PTP = new PersonaEditorLib.FileStructure.PTP.PTP(ParList.OldFont, ParList.OldMap, ParList.NewFont, ParList.NewMap);
            PTP.Open(BMD, ParList.CopyOld2New);
            PTP.SaveProject(dest);
        }
        public FNTConsole(string filepath, ArgumentsWork.Parameters parameters)
        {
            Console.WriteLine("---------------------------------------------------");
            Console.WriteLine("-----Font decompressor/compressor by Meloman19-----");
            Console.WriteLine("-------------------Persona 3/4/5-------------------");
            Console.WriteLine("----------Based on RikuKH3's decompressor----------");
            Console.WriteLine("---------------------------------------------------");

            source = Path.GetFullPath(filepath);
            FNT    = new PersonaEditorLib.FileStructure.FNT.FNT(source);
        }
 public void Export(CommandSubType com, ArgumentsWork.Parameters parameters, string dest)
 {
     if (com == CommandSubType.BMD)
     {
         ExportBMD(dest);
     }
     else if (com == CommandSubType.PTP)
     {
         ExportPTP(dest, parameters);
     }
 }
        private void ExportTXT(string dest, ArgumentsWork.Parameters ParList)
        {
            if (dest == "")
            {
                dest = Util.GetNewPath(source, ".TXT");
            }

            for (int i = 0; i < StringList.Count; i++)
            {
                File.AppendAllText(dest, StringList[i].Item1 + "\t" + StringList[i].Item2 + "\r\n");
            }
        }
        private void ImportPTP(string src, ArgumentsWork.Parameters ParList)
        {
            if (src == "")
            {
                src = Util.GetNewPath(source, ".PTP");
            }

            PersonaEditorLib.FileStructure.PTP.PTP PTP = new PersonaEditorLib.FileStructure.PTP.PTP(ParList.OldFont, ParList.OldMap, ParList.NewFont, ParList.NewMap);
            PersonaEditorLib.FileStructure.BMD.BMD BMD = new PersonaEditorLib.FileStructure.BMD.BMD();
            BMD.Open(PTP);
            BF.SetBMD(BMD.Get(ParList.IsLittleEndian));
        }
        private void ExportPTP(string dest, ArgumentsWork.Parameters ParList)
        {
            if (dest == "")
            {
                dest = Util.GetNewPath(source, ".PTP");
            }

            PersonaEditorLib.FileStructure.BMD.BMD BMD = new PersonaEditorLib.FileStructure.BMD.BMD();
            BMD.Open(BF.GetBMD(), Path.GetFileNameWithoutExtension(dest), true);
            PersonaEditorLib.FileStructure.PTP.PTP PTP = new PersonaEditorLib.FileStructure.PTP.PTP(ParList.OldFont, ParList.OldMap, ParList.NewFont, ParList.NewMap);
            PTP.Open(BMD, ParList.CopyOld2New);
            PTP.SaveProject(dest);
        }
        private void ImportAll(ArgumentsWork.Parameters ParList)
        {
            string temp  = Path.GetDirectoryName(Path.GetFullPath(source));
            string temp2 = Path.GetFileName(source);

            for (int i = 0; i < TBL.Count; i++)
            {
                string name = Path.Combine(temp, temp2 + "(" + i.ToString().PadLeft(2, '0') + ")(NEW).DAT");
                if (File.Exists(name))
                {
                    TBL[i] = File.ReadAllBytes(name);
                }
            }
        }
        private void ImportAll(string src, ArgumentsWork.Parameters ParList)
        {
            List <string> filelist = BIN.GetFileList.Select(x => Path.Combine(Path.GetDirectoryName(source), Path.GetFileName(source) + "+" + x.Replace('/', '+')))
                                     .Select(x => Path.Combine(Path.GetDirectoryName(x), Path.GetFileNameWithoutExtension(x) + "(NEW)" + Path.GetExtension(x))).ToList();

            List <FileInfo> Files = new List <FileInfo>(new DirectoryInfo(Path.GetDirectoryName(Path.GetFullPath(source))).GetFiles());

            for (int i = 0; i < filelist.Count; i++)
            {
                var temp = Files.Find(x => x.Name == filelist[i]);
                if (temp != null)
                {
                    using (BinaryReader reader = new BinaryReader(File.OpenRead(temp.FullName)))
                        BIN[i] = reader.ReadBytes((int)reader.BaseStream.Length);
                }
            }
        }
 private void ImportTXT(string src, ArgumentsWork.Parameters ParList)
 {
     StringList.Import(src);
 }
 public TEXTConsole(string filepath, ArgumentsWork.Parameters parameters)
 {
     source     = Path.GetFullPath(filepath);
     StringList = new PersonaEditorLib.FileStructure.StringList(source, parameters.Length,
                                                                parameters.Old ? new CharList(parameters.OldMap, parameters.OldFont) : new CharList(parameters.NewMap, parameters.NewFont));
 }
 private void ExportTXT(string dest, ArgumentsWork.Parameters ParList)
 {
     PTP.ExportTXT(dest, ParList.Map, ParList.RemoveSplit);
 }
 private void ImportTXT(string src, ArgumentsWork.Parameters ParList)
 {
     PTP.ImportTXT(src, ParList.Map, ParList.Auto, ParList.Width, ParList.SkipEmpty, ParList.Encode);
 }
 public PTPConsole(string filepath, ArgumentsWork.Parameters parameters)
 {
     source = Path.GetFullPath(filepath);
     PTP    = new PersonaEditorLib.FileStructure.PTP.PTP(parameters.OldFont, parameters.OldMap, parameters.NewFont, parameters.NewMap);
     PTP.Open(source);
 }
 public TBLConsole(string filepath, ArgumentsWork.Parameters parameters)
 {
     source = Path.GetFullPath(filepath);
     TBL    = new PersonaEditorLib.FileStructure.TBL.TBL(source, parameters.IsLittleEndian);
 }