示例#1
0
文件: CD.cs 项目: pawlos/ProjectPSX
        public CD(string diskFilename)
        {
            string ext = Path.GetExtension(diskFilename);

            if (ext == ".bin")
            {
                tracks = TrackBuilder.fromBin(diskFilename);
            }
            else if (ext == ".cue")
            {
                tracks = TrackBuilder.fromCue(diskFilename);
            }
            else if (ext == ".exe")
            {
                // TODO: THERES NOT ONLY NO CD BUT ANY ACCESS TO THE CDROM WILL THROW.
                // EXES THAT ACCES THE CDROM WILL CURRENTLY CRASH.
                return;
            }

            streams = new FileStream[tracks.Count];

            for (int i = 0; i < tracks.Count; i++)
            {
                streams[i] = new FileStream(tracks[i].file, FileMode.Open, FileAccess.Read);
                Console.WriteLine($"Track {i} size: {tracks[i].size} lbaStart: {tracks[i].lbaStart} lbaEnd: {tracks[i].lbaEnd}");
            }
        }
示例#2
0
        public CD()
        {
            var cla = Environment.GetCommandLineArgs();

            if (cla.Any(s => s.EndsWith(".bin")))
            {
                String file = cla.First(s => s.EndsWith(".bin"));
                tracks = TrackBuilder.fromBin(file);
            }
            else
            {
                //Show the user a dialog so they can pick the bin they want to load.
                var fileDialog = new OpenFileDialog();
                fileDialog.Filter = "BIN/CUE files (*.bin, *.cue)|*.bin;*.cue";
                fileDialog.ShowDialog();

                string file = fileDialog.FileName;
                string ext  = Path.GetExtension(file);

                if (ext == ".bin")
                {
                    tracks = TrackBuilder.fromBin(file);
                }
                else if (ext == ".cue")
                {
                    tracks = TrackBuilder.fromCue(file);
                }
            }

            for (int i = 0; i < tracks.Count; i++)
            {
                Console.WriteLine($"Track {i} size: {tracks[i].size} lbaStart: {tracks[i].lbaStart} lbaEnd: {tracks[i].lbaEnd}");
            }
        }
示例#3
0
        public CD(string diskFilename)
        {
            string ext = Path.GetExtension(diskFilename);

            if (ext == ".bin")
            {
                tracks = TrackBuilder.fromBin(diskFilename);
            }
            else if (ext == ".cue")
            {
                tracks = TrackBuilder.fromCue(diskFilename);
            }

            for (int i = 0; i < tracks.Count; i++)
            {
                Console.WriteLine($"Track {i} size: {tracks[i].size} lbaStart: {tracks[i].lbaStart} lbaEnd: {tracks[i].lbaEnd}");
            }
        }