예제 #1
0
        public void ExportAllFolder(string TargetPath, bool IncludeSubFolder, RhoFile file)
        {
            this.Show();
            Task task = new Task(() =>
            {
                ExportAllFolder_bg(TargetPath, IncludeSubFolder, file);
            });

            task.Start();
        }
예제 #2
0
 private void openToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (openFileDialog1.ShowDialog() == DialogResult.OK)
     {
         //RhoTesting
         FileInfo fi = new FileInfo(openFileDialog1.FileName);
         BaseRhoFile = new RhoFile(openFileDialog1.FileName);
         UpdateFolders();
     }
 }
예제 #3
0
        private void ExportAllFolder_bg(string outputPath, bool IncludeSubFolder, RhoFile file)
        {
            IPackedObject[]         ipos  = RhoPackedFilesInfoDecoder.GetRhoPackedFileInfos(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)
                    {
                        RhoPackedFolderInfo jpfi = (RhoPackedFolderInfo)ipo;
                        ExportProcessor     nep  = new ExportProcessor
                        {
                            Path = ep.Path + $"\\{jpfi.FolderName}",
                            ipos = RhoPackedFilesInfoDecoder.GetRhoPackedFileInfos(file.GetStreamData(jpfi.Index), file.HeaderKey, jpfi.Index)
                        };
                        Stack.Push(nep);
                        if (!Directory.Exists($"{outPath}\\{((RhoPackedFolderInfo)ipo).FolderName}"))
                        {
                            Directory.CreateDirectory($"{outPath}\\{((RhoPackedFolderInfo)ipo).FolderName}");
                        }
                        continue;
                    }
                    if (ipo.Type == ObjectType.File)
                    {
                        RhoPackedFileInfo jfi = (RhoPackedFileInfo)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();
        }