public DiskLoadManager(DiskImage diskImage)
        {
            AddSerializer(new UdiSerializer(diskImage));
            AddSerializer(new FdiSerializer(diskImage));
            AddSerializer(new Td0Serializer(diskImage));
            AddSerializer(new TrdSerializer(diskImage));
            AddSerializer(new ImgSerializer(diskImage));
            AddSerializer(new SclSerializer(diskImage));
            AddSerializer(new HobetaSerializer(diskImage));

            diskImage.SaveDisk += new SaveDiskDelegate(saveDisk);
        }
        private void applyDrive(DiskImage diskImage, CheckBox chkPresent, TextBox txtPath, CheckBox chkProtect)
        {
            string fileName = txtPath.Text;
            if (fileName != string.Empty)
            {
                if (!File.Exists(Path.GetFullPath(fileName)) && chkPresent.Checked)
                    throw new FileNotFoundException(string.Format("File not found: \"{0}\"", fileName));
                fileName = Path.GetFullPath(fileName);
            }

            diskImage.Present = chkPresent.Checked;
            diskImage.FileName = fileName;
            diskImage.IsWP = chkProtect.Checked;
        }
        private void saveDisk(DiskImage sender)
        {
            if (sender.IsWP)
            {
                LogAgent.Error("Write protected disk was changed! Autosave canceled");
                return;
            }

            string fileName = sender.FileName;
            if (fileName != string.Empty)
            {
                FormatSerializer serializer = GetSerializer(Path.GetExtension(fileName));
                if (serializer == null || !serializer.CanSerialize)
                    fileName = string.Empty;
            }
            if (fileName == string.Empty)
            {
                string folderName = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
                folderName = Path.Combine(folderName, "Images");
                for (int i = 0; i < 10001; i++)
                {
                    fileName = string.Format("zxmak2image{0:D3}{1}", i, GetDefaultExtension());
                    fileName = Path.Combine(folderName, fileName);
                    if (!File.Exists(fileName))
                        break;
                    fileName = string.Empty;
                }
            }

            string msg = string.Format(
                "Do you want to save disk changes to {0}",
                Path.GetFileName(fileName));

            DlgResult qr = DialogProvider.Show(
                msg,
                "Attention!",
                DlgButtonSet.YesNo,
                DlgIcon.Question);
            if (qr == DlgResult.Yes)
            {
                //if (Path.GetExtension(_fileName).ToUpper() == ".SCL")
                //{
                //   _fileName = Path.ChangeExtension(_fileName, ".TRD");
                //   if (File.Exists(_fileName))
                //      _fileName = string.Empty;
                //}

                if (fileName == string.Empty)
                {
                    DialogProvider.Show(
                        "Can't save disk image!\nNo space on HDD!",
                        "Warning",
                        DlgButtonSet.OK,
                        DlgIcon.Warning);
                }
                else
                {
                    string folderName = Path.GetDirectoryName(fileName);
                    if (!Directory.Exists(folderName))
                        Directory.CreateDirectory(folderName);
                    sender.FileName = fileName;
                    SaveFileName(sender.FileName);
                    DialogProvider.Show(
                        string.Format("Disk image successfuly saved!\n{0}", sender.FileName),
                        "Notification",
                        DlgButtonSet.OK,
                        DlgIcon.Information);
                }
            }
        }
Beispiel #4
0
        public SprinterBDI()
        {
            drive = 0;
            fdd = new DiskImage[2];
            for (int i = 0; i < fdd.Length; i++)
            {
                DiskImage di = new DiskImage();
                di.Init(Z80FQ / FDD_RPS);
                //di.Format();  // take ~1 second (long delay on show options)
                fdd[i] = di;
            }
            fdd[drive].t = fdd[drive].CurrentTrack;

            //fdd[i].set_appendboot(NULL);

            wd93_nodelay = false;
        }
 private void initDrive(DiskImage diskImage, CheckBox chkPresent, TextBox txtPath, CheckBox chkProtect)
 {
     chkPresent.Checked = diskImage.Present;
     txtPath.Text = diskImage.FileName;
     txtPath.SelectionStart = txtPath.Text.Length;
     chkProtect.Checked = diskImage.IsWP;
     updateEnabled();
 }
Beispiel #6
0
 public FdiSerializer(DiskImage diskImage)
 {
     _diskImage = diskImage;
 }
Beispiel #7
0
 public Td0Serializer(DiskImage diskImage)
 {
     _diskImage = diskImage;
 }
Beispiel #8
0
 public SclSerializer(DiskImage diskImage)
     : base(diskImage)
 {
 }
Beispiel #9
0
 public ImgSerializer(DiskImage diskImage)
 {
     this._diskImage = diskImage;
     //_diskImage.Init
 }
 public HobetaSerializer(DiskImage diskImage)
 {
     _diskImage = diskImage;
 }