Esempio n. 1
0
        public LevelSetupEntry(string _FilePath)
        {
            FilePath = _FilePath;
            FileName = Path.GetFileNameWithoutExtension(FilePath);
            Info     = Globals.StageInfoList.Find(x => x.Name == FileName);

            Header  = ByteOps.GetNumBytes(4, 0, FilePath);
            Entries = LevelSetupEntryEntry.GetListOfEntriesFromData(File.ReadAllBytes(FilePath).Skip(4).ToArray(), Header);
            Footer  = File.ReadAllBytes(FilePath).Skip(4 + (100 * (int)SPMDefs.EntrySizes[(SPMDefs.HeaderSize)Header[1]])).ToArray();
        }
Esempio n. 2
0
        public static bool IsValid(string FilePath)
        {
            byte[] HeaderSize = ByteOps.GetNumBytes(2, 0, FilePath);

            if (HeaderSize[1] < (byte)SPMDefs.HeaderSize.HEADER_SIZE_1 || HeaderSize[1] > (byte)SPMDefs.HeaderSize.HEADER_SIZE_6)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
Esempio n. 3
0
        private async void extractISOToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string InFile  = "";
            string OutPath = "";

            using (OpenFileDialog fd = new OpenFileDialog())
            {
                fd.Title  = Resources.select_spm_iso;
                fd.Filter = Resources.isoselect_filter;
                DialogResult dr = fd.ShowDialog();

                if (dr == DialogResult.OK)
                {
                    byte[] ISOID = ByteOps.GetNumBytes(3, 0, fd.FileName);

                    if (Encoding.ASCII.GetString(ISOID) != Resources.spm_titlecode)
                    {
                        if (MessageBox.Show(Resources.not_spm_iso, Resources.not_spm_iso_title, MessageBoxButtons.YesNo) == DialogResult.Yes)
                        {
                            InFile = fd.FileName;
                        }
                        else
                        {
                            return;
                        }
                    }
                    else
                    {
                        InFile = fd.FileName;
                    }

                    using (FolderBrowserDialog fb = new FolderBrowserDialog())
                    {
                        fb.Description         = Resources.select_iso_extract_dir;
                        fb.ShowNewFolderButton = false;
                        DialogResult drsf = fb.ShowDialog();

                        if (drsf == DialogResult.OK)
                        {
                            OutPath = Path.Combine(fb.SelectedPath, Encoding.ASCII.GetString(ByteOps.GetNumBytes(6, 0, fd.FileName)));

                            if (!Directory.Exists(OutPath) || MessageBox.Show(Resources.folder_will_be_overwritten, Resources.folder_will_be_overwritten_title, MessageBoxButtons.YesNo) == DialogResult.Yes)
                            {
                                await ExtractISO(InFile, OutPath);
                            }
                        }
                    }
                }
            }
        }