Example #1
0
 private void openToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (openFileDialog1.ShowDialog() == DialogResult.OK)
     {
         BaseJMDFile = new JMDFile(openFileDialog1.FileName);
         UpdateFolders();
     }
 }
Example #2
0
        public void ExportAllFolder(string TargetPath, bool IncludeSubFolder, JMDFile file)
        {
            this.Show();
            Task task = new Task(() =>
            {
                ExportAllFolder_bg(TargetPath, IncludeSubFolder, file);
            });

            task.Start();
        }
Example #3
0
        private void ExportAllFolder_bg(string outputPath, bool IncludeSubFolder, JMDFile file)
        {
            IPackedObject[]         ipos  = JMDPackedFilesInfoDecoder.GetJMDPackedFileInfos(file.GetStreamData(0xFFFFFFFF), file.HeaderKey, 0xFFFFFFFF);
            Stack <ExportProcessor> Stack = new Stack <ExportProcessor>();

            if (!Directory.Exists(outputPath))
            {
                throw new Exception("");
            }
            string StartPath = "";

            Stack.Push(new ExportProcessor
            {
                Path = StartPath,
                ipos = ipos
            });
            while (Stack.Count > 0 && !Canceled)
            {
                ExportProcessor ep      = Stack.Pop();
                string          outPath = outputPath + (StartPath == "" ? ep.Path : ep.Path.Replace(StartPath, ""));
                foreach (IPackedObject ipo in ep.ipos)
                {
                    if (ipo.Type == ObjectType.Folder && IncludeSubFolder)
                    {
                        JMDPackedFolderInfo jpfi = (JMDPackedFolderInfo)ipo;
                        ExportProcessor     nep  = new ExportProcessor
                        {
                            Path = ep.Path + $"\\{jpfi.FolderName}",
                            ipos = JMDPackedFilesInfoDecoder.GetJMDPackedFileInfos(file.GetStreamData(jpfi.Index), file.HeaderKey, jpfi.Index)
                        };
                        Stack.Push(nep);
                        if (!Directory.Exists($"{outPath}\\{((JMDPackedFolderInfo)ipo).FolderName}"))
                        {
                            Directory.CreateDirectory($"{outPath}\\{((JMDPackedFolderInfo)ipo).FolderName}");
                        }
                        continue;
                    }
                    if (ipo.Type == ObjectType.File)
                    {
                        JMDPackedFileInfo jfi = (JMDPackedFileInfo)ipo;
                        ChangeText(label5, $"Outputing: {ep.Path}\\{jfi.FileName}.{jfi.Extension}");
                        FileStream fs   = new FileStream($"{outPath}\\{jfi.FileName}.{jfi.Extension}", FileMode.Create);
                        byte[]     data = file.GetPackedFile(jfi);
                        fs.Write(data, 0, data.Length);
                        fs.Close();
                        data = null;
                    }
                    if (Canceled)
                    {
                        break;
                    }
                }
            }
            CloseWindow();
        }
Example #4
0
        public void Testing()
        {
            JMDFile    jf = new JMDFile(@"D:\M-etel\RayCity\Data\sound\bgm\main\mu_bgm_org_driversparadise.jmd");
            FileStream fs = new FileStream(@"D:\M-etel\RayCity\Data\sound\bgm\main\mu_bgm_org_driversparadise.jmd.decrypt", FileMode.Open);

            byte[] data = new byte[fs.Length];
            fs.Read(data, 0, data.Length);
            data = Crypt.JMDCrypt.Decrypt(data, Crypt.KeyGenerator.GetDictionaryDataKey(jf.HeaderKey));
            fs.Write(data, 0, data.Length);
            fs.Close();
        }