예제 #1
0
        private void cZ1ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog FD = new OpenFileDialog();

            FD.Multiselect = true;

            if (FD.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            foreach (string FN in FD.FileNames)
            {
                byte[] Img = File.ReadAllBytes(FN);

                /*//commented this don't works.
                 * CZ1Parser Reader = new CZ1Parser(Img);
                 * var Image = Reader.Decode();
                 *
                 * string Out = FD.FileName + "-Decoded.bin";
                 * StructWriter Writer = new StructWriter(Out);
                 * for (uint i = 0; i < Image.Length; i++)
                 *  Writer.WriteStruct(ref Image[i]);
                 *
                 * Writer.Close();*/

                Bitmap Picture = new CZ0Parser(Img).Import();
                Picture.Save(FN + ".png", ImageFormat.Png);
            }
            MessageBox.Show("Textures Decoded.", "LSGUI");
        }
예제 #2
0
        public void OnExecute()
        {
            if (Debug)
            {
                Program.debug = true;
            }
            if (!string.IsNullOrEmpty(FileType))
            {
                AbstractFileParser selclass = null;
                switch (FileType.ToLower())
                {
                case "cz0":
                    selclass = new CZ0Parser();
                    break;

                case "cz1":
                    selclass = new CZ1Parser();
                    break;

                case "cz1_4bit":
                    selclass = new CZ1_4bitParser();
                    break;

                case "cz2":
                    selclass = new CZ2Parser();
                    break;

                case "cz3":
                    selclass = new CZ3Parser();
                    break;

                case "cz4":
                    selclass = new CZ4Parser();
                    break;

                case "dat":
                    selclass = new DatParser();
                    break;

                case "pak":
                    if (!string.IsNullOrEmpty(PakCoding))
                    {
                        selclass = new PAKManager(PakCoding);
                    }
                    else
                    {
                        selclass = new PAKManager();
                    }

                    break;

                case "psb":
                    selclass = new PsbScript();
                    break;

                case "info":
                    selclass = new FontInfoParser();
                    break;

                case "scr":
                    if (!FormatOld && !FormatLua && !FormatLuaE && !FormatJson)
                    {
                        FormatJson = true;
                    }
                    if (FormatLua && FormatLuaE)
                    {
                        FormatLuaE = false;     // 优先能导入
                    }
                    if (!string.IsNullOrEmpty(CustomOpcodePath))
                    {
                        selclass = new ScriptParser(GameScript.CUSTOM, CustomOpcodePath,
                                                    FormatOld, FormatLua, FormatLuaE, FormatJson, OnlyText);
                    }
                    else if (!string.IsNullOrEmpty(OpcodePath))
                    {
                        if (OpcodePath != "CUSTOM")
                        {
                            selclass = new ScriptParser((GameScript)Enum.Parse(typeof(GameScript), OpcodePath, true), "",
                                                        FormatOld, FormatLua, FormatLuaE, FormatJson, OnlyText);
                        }
                    }
                    else
                    {
                        throw new Exception("Need Input OpcodePath or CustomOpcodePath!");
                    }

                    if (!string.IsNullOrEmpty(TBLFile))
                    {
                        CustomEncoding.LoadTbl(TBLFile);
                    }
                    break;

                default:
                    break;
                }

                if (ParserMode.ToLower() == "import" || ParserMode.ToLower() == "i")
                {
                    if (File.Exists(FileName))
                    {
                        // 是文件
                        selclass.FileImport(FileName, OutFileName);
                    }
                    else if (Directory.Exists(FileName))
                    {
                        // 是文件夹
                        string outFolder = OutFileName;
                        if (!Directory.Exists(OutFileName))
                        {
                            Console.WriteLine("输出目录不是文件夹,默认输出目录已更改");
                            outFolder = Path.GetDirectoryName(OutFileName);
                        }
                        var files = Directory.GetFiles(FileName, "*");
                        foreach (var file in files)
                        {
                            selclass.FileImport(file, Path.Combine(outFolder, Path.GetFileNameWithoutExtension(file)));
                        }
                    }
                }
                else if (ParserMode.ToLower() == "export" || ParserMode.ToLower() == "e")
                {
                    if (File.Exists(FileName))
                    {
                        // 是文件
                        selclass.FileExport(FileName, OutFileName);
                    }
                    else if (Directory.Exists(FileName))
                    {
                        // 是文件夹
                        string outFolder = OutFileName;
                        if (!Directory.Exists(OutFileName))
                        {
                            Console.WriteLine("输出目录不是文件夹,默认输出目录已更改");
                            outFolder = Path.GetDirectoryName(OutFileName);
                        }
                        var files = Directory.GetFiles(FileName, "*");
                        foreach (var file in files)
                        {
                            selclass.FileExport(file, Path.Combine(outFolder, Path.GetFileNameWithoutExtension(file)));
                        }
                    }
                }
                else
                {
                    throw new Exception("Need Input ParserMode!");
                }
            }


            if (GameList)
            {
                Console.WriteLine(@"Supported Games:
Opcode name    Game name & Platform

SP             《Summer Pocket》Nintendo Switch
CL             《Clannad》Nintendo Switch
TAWL           《Tomoyo After Its a Wonderful Life CS Edition》Nintendo Switch
FLOWERS        《Flowers - Shiki》
ISALND         《ISLAND》Psvita

CUSTOM          Read custom Opcode file. Path: OPCODE/{CUSTOM}.txt
");
            }
            if (OpcodeHelp)
            {
                Console.WriteLine(@"
        Byte,
        Byte2,
        Byte3,
        Byte4,
        UInt16,
        UInt32,
        StringUnicode,
        StringSJIS,
        StringUTF8,
        LenStringUnicode,
        LenStringSJIS,
        Opcode,
        Skip
待完善...
");
            }
        }
예제 #3
0
        public void OnExecute()
        {
            if (Debug)
            {
                Program.debug = true;
            }
            if (!string.IsNullOrEmpty(FileType))
            {
                AbstractFileParser selclass = null;
                switch (FileType.ToLower())
                {
                case "cz0":
                    selclass = new CZ0Parser();
                    break;

                case "cz1":
                    selclass = new CZ1Parser();
                    break;

                case "cz1_4bit":
                    selclass = new CZ1_4bitParser();
                    break;

                case "cz2":
                    selclass = new CZ2Parser();
                    break;

                case "cz3":
                    selclass = new CZ3Parser();
                    break;

                case "cz4":
                    selclass = new CZ4Parser();
                    break;

                case "dat":
                    selclass = new DatParser();
                    break;

                case "pak":
                    if (!string.IsNullOrEmpty(PakCoding))
                    {
                        selclass = new PAKManager(PakCoding);
                    }
                    else
                    {
                        selclass = new PAKManager();
                    }

                    break;

                case "psb":
                    selclass = new PsbScript();
                    break;

                case "info":
                    selclass = new FontInfoParser();
                    break;

                case "scr":
                    if (!string.IsNullOrEmpty(CustomOpcodePath))
                    {
                        selclass = new ScriptParser(GameScript.CUSTOM, CustomOpcodePath);
                    }
                    else if (!string.IsNullOrEmpty(OpcodePath))
                    {
                        if (OpcodePath != "CUSTOM")
                        {
                            selclass = new ScriptParser((GameScript)Enum.Parse(typeof(GameScript), OpcodePath, true));
                        }
                    }
                    else
                    {
                        throw new Exception("Need Input OpcodePath or CustomOpcodePath!");
                    }

                    if (!string.IsNullOrEmpty(TBLFile))
                    {
                        CustomEncoding.LoadTbl(TBLFile);
                    }
                    break;

                default:
                    break;
                }

                if (ParserMode.ToLower() == "import" || ParserMode.ToLower() == "i")
                {
                    selclass.FileImport(FileName);
                }
                else if (ParserMode.ToLower() == "export" || ParserMode.ToLower() == "e")
                {
                    selclass.FileExport(FileName);
                }
                else
                {
                    throw new Exception("Need Input ParserMode!");
                }
            }


            if (GameList)
            {
                Console.WriteLine(@"Supported Games:
Opcode name    Game name & Platform

SP             《Summer Pocket》Nintendo Switch
CL             《Clannad》Nintendo Switch
TAWL           《Tomoyo After Its a Wonderful Life CS Edition》Nintendo Switch
FLOWERS        《Flowers - Shiki》
ISALND         《ISLAND》Psvita

CUSTOM          Read custom Opcode file. Path: OPCODE/{CUSTOM}.txt
");
            }
            if (OpcodeHelp)
            {
                Console.WriteLine(@"
        Byte,
        Byte2,
        Byte3,
        Byte4,
        UInt16,
        UInt32,
        StringUnicode,
        StringSJIS,
        StringUTF8,
        LenStringUnicode,
        LenStringSJIS,
        Opcode,
        Skip
待完善...
");
            }
        }