private void ListInfoAStorageList(List <Storage> storegeList)
 {
     foreach (Storage store in storegeList)
     {
         if (store is Hdd)
         {
             Hdd hdd = (Hdd)store;
             ShConsole.ConsoleInfo(hdd.ToString());
         }
         else if (store is DvD_RW)
         {
             DvD_RW dvd_rw = (DvD_RW)store;
             ShConsole.ConsoleInfo(dvd_rw.ToString());
         }
         else if (store is DVD)
         {
             DVD dvd = (DVD)store;
             ShConsole.ConsoleInfo(dvd.ToString());
         }
         else if (store is Floppy)
         {
             Floppy floppy = (Floppy)store;
             ShConsole.ConsoleInfo(floppy.ToString());
         }
     }
 }
示例#2
0
 private void btnQuery_Click(object sender, EventArgs e)
 {
     try
     {
         Floppy.UploadTimeOut   = int.Parse(txtUploadTimeOut.Text);
         Floppy.FunctionTimeOut = int.Parse(txtFunctionTimeOut.Text);
         Floppy.IsClearFile     = cbIsClearFile.Checked;
         string com = string.Format("{0},{1},{2},{3}", txtCom.Text, txtNodeNum.Text, txtSpeed.Text, txtMode.Text);
         var    str = new Floppy().QueryFunction(com, int.Parse(txtNode.Text));
         MessageBox.Show(str);
         listView1.Items.Clear();
         if (str != "2" && !string.IsNullOrEmpty(str))
         {
             Console.Write("Length={0}", str.Length);
             for (int i = 0; i < str.Length / 12; i++)
             {
                 var item = str.Substring(i * 12, 12);
                 Console.WriteLine(item);
                 Console.WriteLine("Item.Length={0}", item.Length);
                 var fileName = string.Format("{0}.{1}", item.Substring(0, 8).Trim(), item.Substring(8, 3).Trim());
                 listView1.Items.Add(item);
             }
         }
         MessageBox.Show("查询成功");
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
示例#3
0
    public void SpawnFloppyDisks()
    {
        FileGenerator fileGen = FileGenerator.instance;

        List <FileData> files   = new List <FileData>();
        List <Floppy>   floppys = new List <Floppy>();

        numberOfFloppy = fileGen.categories.Length;
        numberOfFile   = Mathf.RoundToInt((float)fileGen.Lenght * floppyFilesRatio);

        int averageFiles = Mathf.RoundToInt((float)numberOfFile / (float)numberOfFloppy);

        for (int i = 0; i < numberOfFloppy; i++)
        {
            Floppy newFloppy = Instantiate(prefab, transform).GetComponent <Floppy>();
            newFloppy.SetFloppy(i);
            newFloppy.transform.position = transform.position + Vector3.up * offset * i;
            newFloppy.transform.rotation = Quaternion.Euler(0, Random.value * 360, 0);
            floppys.Add(newFloppy);
        }

        int safeInt = 0;

        while (numberOfFile > 0)
        {
            int rand  = Random.Range(0, floppys.Count);
            int rand2 = Random.Range(0, fileGen.dataToSpawn.Count);

            if (floppys[rand].AddFile(fileGen.dataToSpawn[rand2]))
            {
                fileGen.dataToSpawn.RemoveAt(rand2);
                numberOfFile--;
            }

            safeInt++;
            if (safeInt >= 1000)
            {
                break;
            }
        }

        Debug.Log(PCManager.Instance);
        Debug.Log(PCManager.Instance.hardDrive);
        Debug.Log(PCManager.Instance.hardDrive.Files);

        foreach (FileData d in fileGen.dataToSpawn)
        {
            if (d != null)
            {
                PCManager.Instance.hardDrive.Files.Add(d);
            }
        }

        fileGen.dataToSpawn.Clear();

        PCManager.Instance.hardDrive.capacity = Mathf.RoundToInt(PCManager.Instance.hardDrive.GetUsedSpace() * 1.5f);
        PCManager.Instance.initialCapacity    = PCManager.Instance.hardDrive.capacity;
    }
示例#4
0
    public void UnloadFloppy()
    {
        LoadingSequence.Kill();
        Loaded      = false;
        currentDisk = null;

        DEL.Blink(2);


        PCManager.Instance.Viewer.Clear();
        PCManager.Instance.DisplayExplorer(true);

        PCManager.Instance.Explorer.FloppyTab.text = "Empty(A:)";
    }
示例#5
0
 /// <summary>
 /// Returns a clone of this revision
 /// </summary>
 /// <returns>Cloned revision</returns>
 public SpectrumEdition Clone()
 {
     return(new SpectrumEdition
     {
         Cpu = Cpu.Clone(),
         Rom = Rom.Clone(),
         Memory = Memory.Clone(),
         Screen = Screen.Clone(),
         Beeper = Beeper.Clone(),
         Sound = Sound?.Clone(),
         Floppy = Floppy?.Clone(),
         UlaIssue = UlaIssue
     });
 }
示例#6
0
        public Machine(Form uiForm)
        {
            picDevice     = new PIC8259();
            vgaDevice     = new VGA();
            FloppyDrive   = new Floppy();
            dmaController = new DMAController();
            keyboard      = new KeyboardDevice();
            ataDevice     = new ATA();

            if (SystemConfig.Machine.Floppies.Count > 0)
            {
                FloppyDrive.MountImage(SystemConfig.Machine.Floppies[0].Image);
            }

            switch (Settings.Default.graphics.ToUpper())
            {
                //case "XNA":
                //    throw new Exception("XNA not supported OwO");
                //    //gui = new XNAUI(uiForm, vgaDevice);
                //    break;
                //case "SDL":
                //    gui = new SDLUI(uiForm, vgaDevice);
                //    break;
            }

            gui = new SHARPDX(uiForm, vgaDevice); // SharpDX it is
            //gui = new ASCII(uiForm, vgaDevice); // ASCII test

            Application.Idle += new System.EventHandler(ApplicationIdle);

            gui.KeyDown += new EventHandler <UIntEventArgs>(GUIKeyDown);
            gui.KeyUp   += new EventHandler <UIntEventArgs>(GUIKeyUp);

            gui.Init();

            devices = new IDevice[]
            {
                FloppyDrive, new CMOS(ataDevice), new Misc(), new PIT8253(), picDevice, keyboard, dmaController, vgaDevice, ataDevice
            };

            CPU = new CPU.CPU();

            picDevice.Interrupt += PicDeviceInterrupt;

            SetupSystem();

            CPU.IORead  += CPUIORead;
            CPU.IOWrite += CPUIOWrite;
        }
        public void ReadDataFromFloppy()
        {
            Computer computer = _world.tingRunner.CreateTing <Computer> ("ComputerWithFloppy", testDefaultCoordinate);

            computer.masterProgramName = "FloppyReader";

            Floppy floppy = _world.tingRunner.CreateTing <Floppy> ("Floppy", testDefaultCoordinate);

            floppy.masterProgram.sourceCodeContent = "hejsan";

            WorldTestHelper.UpdateWorld(_world, 0.5f);
            computer.RunProgram(floppy);
            WorldTestHelper.UpdateWorld(_world, 1f);

            PrintErrors(computer.masterProgram);
            Assert.AreEqual(false, computer.containsBrokenPrograms);

            Assert.AreEqual("hejsan", computer.consoleOutput[0]);
        }
示例#8
0
    public void ReadFloppyDisk(Floppy Disk)
    {
        if (currentDisk != null)
        {
            return;
        }

        currentDisk = Disk;
        DEL.Blink();
        currentDisk.Rigidbody.isKinematic = true;
        DEL.Blink();
        currentDisk.reader = this;
        DEL.Blink();
        PCManager.Instance.isLoading = true;
        LoadingSequence = DOTween.Sequence();
        LoadingSequence.Append(Disk.transform.DORotate(floppyAnchor.rotation.eulerAngles, 0.5f));
        LoadingSequence.Join(Disk.transform.DOMove(floppyAnchor.position, 0.5f));
        LoadingSequence.Append(Disk.transform.DOMove(floppyAnchor.position + transform.forward * 0.5f, 1.0f));
        LoadingSequence.onComplete += LoadData;
    }
        public void StorageMenu()
        {
            if (System.IO.File.Exists(storesfilepath) && new FileInfo(storesfilepath).Length > 0)
            {
                FileHandling.DeserializerProcess(storages, storesfilepath);
            }
            if (System.IO.File.Exists(mountedfilepath) && new FileInfo(mountedfilepath).Length > 0)
            {
                FileHandling.DeserializerProcess(computer.GetStorages(), mountedfilepath);
            }

            while (true)
            {
                try
                {
                    StorageMenuList();
                    ShConsole.UserInput("Choose a menu: ");
                    string answer = Console.ReadLine().ToLower();
                    if (answer == "listmounts" || answer == "list mounts")
                    {
                        if (computer.GetStorages().Count == 0)
                        {
                            throw new NullReferenceException("Mount at least one storage first");
                        }
                        else
                        {
                            ListInfoAStorageList(computer.GetStorages());
                        }
                        Console.WriteLine();
                    }
                    else if (answer == "liststores" || answer == "list stores")
                    {
                        if (storages.Count == 0)
                        {
                            throw new NullReferenceException("Make at least one storage first");
                        }
                        else
                        {
                            ListInfoAStorageList(storages);
                        }
                        Console.WriteLine();
                    }
                    else if (answer == "addmount" || answer == "add mount")
                    {
                        if (storages.Count == 0)
                        {
                            throw new NullReferenceException("Make one storage at least!");
                        }
                        else
                        {
                            ListInfoAStorageList(storages);
                            ShConsole.UserInput("Give me the storage Id,which you want put on the computer: ");
                            string addAnswer = Console.ReadLine();
                            computer.Mount(addAnswer, storages);
                        }
                        Console.WriteLine();
                    }
                    else if (answer == "usemount" || answer == "use mount")
                    {
                        ListInfoAStorageList(computer.GetStorages());
                        MountedStorageHandler msh = new MountedStorageHandler(ShConsole, computer);
                        msh.MountedMenu();
                        Console.WriteLine();
                    }
                    else if (answer == "addstore" || answer == "add store")
                    {
                        Console.WriteLine("What storage you want to make(Hdd,Dvd,Dvd_rw,Floppy)");
                        string newstorage = Console.ReadLine().ToLower();

                        string id = IdGenerator();
                        if (newstorage == "hdd")
                        {
                            string[]      storageParams = new string[] { "Max capacity", "Name" };
                            List <string> sp            = new List <string>();
                            foreach (string param in storageParams)
                            {
                                ShConsole.UserInput($"Give me  {param}: ");
                                sp.Add(Console.ReadLine());
                            }
                            Storage storage = new Hdd(id, Convert.ToInt32(sp[0]), sp[1]);

                            storages.Add(storage);
                        }
                        else if (newstorage == "dvd" || newstorage == "floppy" || newstorage == "dvd_rw" || newstorage == "dvd-rw" || newstorage == "dvd rw")
                        {
                            ShConsole.UserInput($"Give me the storage Name : ");
                            string name = Console.ReadLine();
                            if (newstorage == "dvd")
                            {
                                Storage storage = new DVD(id, name);
                                storages.Add(storage);
                            }
                            else if (newstorage == "floppy")
                            {
                                Storage storage = new Floppy(id, name);
                                storages.Add(storage);
                            }
                            else if (newstorage == "dvd_rw" || newstorage == "dvd-rw" || newstorage == "dvd rw")
                            {
                                Storage storage = new DvD_RW(id, name);
                                storages.Add(storage);
                            }
                        }
                        else
                        {
                            throw new ArgumentException("Invalid argument");
                        }
                        ShConsole.ConsoleInfo($"The {newstorage} storage has been created");
                        Console.WriteLine();
                    }
                    else if (answer == "deletestore" || answer == "delete store")
                    {
                        if (storages.Count == 0)
                        {
                            throw new NullReferenceException("Create a storage first please");
                        }
                        else
                        {
                            ListInfoAStorageList(storages);
                            ShConsole.UserInput("Give me the storage Id you want to delete: ");
                            string deletingStoreId = Console.ReadLine();
                            for (int i = 0; i < storages.Count; i++)
                            {
                                if (storages[i].Id == deletingStoreId)
                                {
                                    ShConsole.UserInput($"Are you sure you want to delete this storage {storages[i].StoreName}?(yes/no): ");
                                    string deleteAnswer = Console.ReadLine().ToLower();
                                    if (deleteAnswer == "yes" || deleteAnswer == "y")
                                    {
                                        ShConsole.ConsoleInfo($"the {storages[i].StoreName} has been deleted");
                                        storages.Remove(storages[i]);
                                    }
                                    else if (deleteAnswer == "no" || deleteAnswer == "n")
                                    {
                                        ShConsole.ConsoleInfo("the deleting process has been declined");
                                    }
                                    else
                                    {
                                        throw new ArgumentException("invalid input");
                                    }
                                }
                                else if (storages[i].Id != deletingStoreId && i == storages.Count() - 1)
                                {
                                    throw new NullReferenceException("There is no such store");
                                }
                            }

                            Console.WriteLine();
                        }
                    }
                    else if (answer == "remove mount" || answer == "removemount")
                    {
                        if (computer.GetStorages().Count == 0)
                        {
                            throw new NullReferenceException("There is no mounted storage");
                        }
                        else
                        {
                            ListInfoAStorageList(computer.GetStorages());
                            ShConsole.UserInput("Give me the storage Id you want to remove: ");
                            string removingStoreId = Console.ReadLine();
                            for (int i = 0; i < computer.GetStorages().Count; i++)
                            {
                                if (computer.GetStorages()[i].Id == removingStoreId)
                                {
                                    ShConsole.UserInput($"Are you sure you want to remove this storage {computer.GetStorages()[i].StoreName}?(yes/no) : ");
                                    string removeAnswer = Console.ReadLine().ToLower();
                                    if (removeAnswer == "yes" || removeAnswer == "y")
                                    {
                                        ShConsole.ConsoleInfo($"the {computer.GetStorages()[i].StoreName} has been removed");
                                        storages.Add(computer.GetStorages()[i]);
                                        computer.GetStorages().Remove(computer.GetStorages()[i]);
                                    }
                                    else if (removeAnswer == "no" || removeAnswer == "n")
                                    {
                                        ShConsole.ConsoleInfo("the removing process has been declined");
                                    }
                                    else
                                    {
                                        throw new ArgumentException("invalid input");
                                    }
                                    break;
                                }
                                else if (computer.GetStorages()[i].Id != removingStoreId && i == computer.GetStorages().Count() - 1)
                                {
                                    throw new NullReferenceException("There is no such store");
                                }
                            }
                        }
                        Console.WriteLine();
                    }
                    else if (answer == "modify mount" || answer == "modifymount")
                    {
                        if (computer.GetStorages().Count == 0)
                        {
                            throw new NullReferenceException("There is no mounted storage");
                        }
                        else
                        {
                            ListInfoAStorageList(computer.GetStorages());
                            ShConsole.UserInput("Give me the mounted storage Id you want to modify");
                            string modifyingMountedStoreId = Console.ReadLine();
                            for (int i = 0; i < computer.GetStorages().Count; i++)
                            {
                                if (computer.GetStorages()[i].Id == modifyingMountedStoreId)
                                {
                                    ShConsole.UserInput($"Are you sure You want to modify the storage NAME?(yes/no): ");
                                    string removeAnswer = Console.ReadLine().ToLower();
                                    if (removeAnswer == "yes" || removeAnswer == "y")
                                    {
                                        ShConsole.UserInput("Give me the new store name: ");
                                        string newName = Console.ReadLine();
                                        computer.GetStorages()[i].StoreName = newName;
                                    }
                                    else if (removeAnswer == "no" || removeAnswer == "n")
                                    {
                                        ShConsole.ConsoleInfo("the modifying process has been declined");
                                    }
                                    else
                                    {
                                        throw new ArgumentException("invalid input");
                                    }
                                    break;
                                }
                                else if (computer.GetStorages()[i].Id != modifyingMountedStoreId && i == computer.GetStorages().Count() - 1)
                                {
                                    throw new Exception("There is no such mounted store");
                                }
                            }
                        }
                        Console.WriteLine();
                    }
                    else if (answer == "modify store" || answer == "modifystore")
                    {
                        if (storages.Count == 0)
                        {
                            throw new NullReferenceException("There is no unmounted storage");
                        }
                        else
                        {
                            ListInfoAStorageList(storages);
                            ShConsole.UserInput("Give me the storage Id you want to modify: ");
                            string modifyingStoreId = Console.ReadLine();
                            for (int i = 0; i < storages.Count; i++)
                            {
                                if (storages[i].Id == modifyingStoreId)
                                {
                                    if (storages[i].FileList.Count == 0)
                                    {
                                        ShConsole.UserInput($"Are you sure You want to modify the storage NAME?(yes/no): ");
                                        string removeAnswer = Console.ReadLine().ToLower();
                                        if (removeAnswer == "yes" || removeAnswer == "y")
                                        {
                                            ShConsole.UserInput("Give me the new store name: ");
                                            string newName = Console.ReadLine();
                                            storages[i].StoreName = newName;
                                        }
                                        else if (removeAnswer == "no" || removeAnswer == "n")
                                        {
                                            ShConsole.ConsoleInfo("the modifying process has been declined");
                                        }
                                        else
                                        {
                                            throw new ArgumentException("invalid input");
                                        }
                                    }
                                    else if (storages[i].FileList.Count > 0)
                                    {
                                        throw new Exception("The store is not empty,you can't modify the name");
                                    }
                                }
                                else if (storages[i].Id != modifyingStoreId && i == computer.GetStorages().Count() - 1)
                                {
                                    throw new NullReferenceException("There is no such store");
                                }
                            }
                            Console.WriteLine();
                        }
                    }
                    else if (answer == "save")
                    {
                        FileHandling.SerializeProcess(storages, storesfilepath);
                        ShConsole.ConsoleInfo("the storage data has been saved");
                        FileHandling.SerializeProcess(computer.GetStorages(), mountedfilepath);
                        ShConsole.ConsoleInfo("the mounted storage data has been saved");
                        Console.WriteLine();
                    }
                    else if (answer == "exit")
                    {
                        FileHandling.SerializeProcess(storages, storesfilepath);
                        ShConsole.ConsoleInfo("the storage data has been saved");
                        FileHandling.SerializeProcess(computer.GetStorages(), mountedfilepath);
                        ShConsole.ConsoleInfo("the mounted storage data has been saved");
                        Console.WriteLine();
                        ShConsole.ConsoleInfo("Good bye");
                        break;
                    }
                    else
                    {
                        throw new ArgumentException("invalid argument");
                    }
                }
                catch (Exception ex)
                {
                    ShConsole.Error(ex.Message);
                }
            }
        }
        public void MountedMenu()
        {
            if (computer.GetStorages().Count == 0)
            {
                MsConsoleLogger.Warning("Mount a storage first");
                return;
            }
            else
            {
                Storage ChoosedStorage = SelectMounted();
                while (true)
                {
                    try
                    {
                        MountedMenuList();
                        MsConsoleLogger.UserInput("Choose a menu: ");
                        string answer = Console.ReadLine().ToLower();

                        if (answer == "addfile" || answer == "add file")
                        {
                            string[] fileParams = new string[] { "file name",
                                                                 "file size",
                                                                 "only read(true/false)",
                                                                 "system",
                                                                 "hidden(true/false)" };
                            List <string> fp = new List <string>();
                            foreach (string param in fileParams)
                            {
                                if (param == "file size")
                                {
                                    while (true)
                                    {
                                        MsConsoleLogger.UserInput($"Give me  {param}: ");
                                        int  n;
                                        bool isNumeric = int.TryParse(Console.ReadLine(), out n);
                                        if (isNumeric && n > 0)
                                        {
                                            fp.Add(Convert.ToString(n));
                                            break;
                                        }
                                        else
                                        {
                                            MsConsoleLogger.Warning("Give me a proper file size");
                                        }
                                    }
                                }
                                else if (param == "only read(true/false)")
                                {
                                    while (true)
                                    {
                                        MsConsoleLogger.UserInput($"Give me  {param}: ");
                                        string paramanswer = Console.ReadLine().ToLower();
                                        if (paramanswer == "true" || paramanswer == "false")
                                        {
                                            fp.Add(paramanswer);
                                            break;
                                        }
                                        else
                                        {
                                            MsConsoleLogger.Warning("Give me a proper argument(false/true)");
                                        }
                                    }
                                }
                                else if (param == "hidden(true/false)")
                                {
                                    while (true)
                                    {
                                        MsConsoleLogger.UserInput($"Give me  {param}: ");
                                        string paramanswer = Console.ReadLine().ToLower();
                                        if (paramanswer == "true" || paramanswer == "false")
                                        {
                                            fp.Add(paramanswer);
                                            break;
                                        }
                                        else
                                        {
                                            MsConsoleLogger.Warning("Give me a proper argument(false/true)");
                                        }
                                    }
                                }
                                else
                                {
                                    MsConsoleLogger.UserInput($"Give me  {param}: ");
                                    fp.Add(Console.ReadLine());
                                }
                            }
                            ChoosedStorage.AddFile(fp[(int)Fileenum.Filename],
                                                   Convert.ToInt32(fp[(int)Fileenum.FileSize]),
                                                   Convert.ToBoolean(fp[(int)Fileenum.Onlyread]),
                                                   fp[(int)Fileenum.System],
                                                   Convert.ToBoolean(fp[(int)Fileenum.Hidden]));
                            MsConsoleLogger.ConsoleInfo("The file has been added to the storage");
                            Console.WriteLine();
                        }
                        else if (answer == "check cap" || answer == "checkcap")
                        {
                            if (ChoosedStorage is DVD || ChoosedStorage is DvD_RW || ChoosedStorage is Hdd)
                            {
                                MsConsoleLogger.ConsoleInfo($"max capacity = {ChoosedStorage.MaxCapacity:F1}GB" +
                                                            $" free capacity = {ChoosedStorage.FreeCapacity:F1}GB" +
                                                            $" reserved capacity = {ChoosedStorage.ReservedCapacity:F1}GB");
                            }
                            else if (ChoosedStorage is Floppy)
                            {
                                MsConsoleLogger.ConsoleInfo($"max capacity = {ChoosedStorage.MaxCapacity:F1}Kb" +
                                                            $" free capacity = {ChoosedStorage.FreeCapacity:F1}Kb" +
                                                            $" reserved capacity = {ChoosedStorage.ReservedCapacity:F1}Kb");
                            }
                        }
                        else if (answer == "list file" || answer == "listfile")
                        {
                            ListFile(ChoosedStorage);
                        }
                        else if (answer == "remove")
                        {
                            if (ChoosedStorage.FileList.Count == 0)
                            {
                                throw new NullReferenceException("The storage is empty");
                            }
                            else
                            {
                                ListFile(ChoosedStorage);
                                Console.WriteLine();
                                MsConsoleLogger.UserInput("Give me the file which you want to delete: ");
                                string fileYouWantToRemove = Console.ReadLine();
                                ChoosedStorage.Remove(fileYouWantToRemove);
                            }
                        }
                        else if (answer == "archive")
                        {
                            Storage     secondStorage = SelectMounted();
                            List <File> mutualFiles   = computer.Archive(ChoosedStorage, secondStorage);
                            foreach (File file in mutualFiles)
                            {
                                MsConsoleLogger.ConsoleInfo($"{file.ToString()} is already on the {secondStorage.StoreName} storage ");
                            }
                            MsConsoleLogger.ConsoleInfo($"The unmutual files has been archive to the {secondStorage} storage");
                            Console.WriteLine();
                        }
                        else if (answer == "format")
                        {
                            ChoosedStorage.Format();
                            MsConsoleLogger.ConsoleInfo($"The {ChoosedStorage.StoreName} has been formatted");
                            Console.WriteLine();
                        }
                        else if (answer == "setdefense" || answer == "set defense")
                        {
                            if (ChoosedStorage is DvD_RW || ChoosedStorage is DVD)
                            {
                                DVD dvd = (DVD)ChoosedStorage;
                                dvd.Block();
                                MsConsoleLogger.ConsoleInfo("The dvd's write defense has been set");
                            }
                            else if (ChoosedStorage is Floppy)
                            {
                                Floppy floppy = (Floppy)ChoosedStorage;
                                floppy.TurnOnWriteDefense();
                                MsConsoleLogger.ConsoleInfo("The floppy's write defense has been set");
                            }
                            else if (!(ChoosedStorage is Floppy) && !(ChoosedStorage is DVD) && !(ChoosedStorage is DvD_RW))
                            {
                                throw new InvalidCastException("To this storage has no write defense ");
                            }
                            Console.WriteLine();
                        }
                        else if (answer == "open")
                        {
                            if (ChoosedStorage is DvD_RW)
                            {
                                DvD_RW dvd_rw = (DvD_RW)ChoosedStorage;
                                dvd_rw.Open();
                                MsConsoleLogger.ConsoleInfo("You can write again on this storage,but all saved file what was on this storage has been removed");
                            }
                            else if (!(ChoosedStorage is DvD_RW))
                            {
                                throw new InvalidCastException("This is not a dvd_rw storage please select another mounted storage,wich type is dvd_rw");
                            }
                        }
                        else if (answer == "exit")
                        {
                            MsConsoleLogger.ConsoleInfo("Go back to the storage menu");
                            Console.WriteLine();
                            break;
                        }
                        else
                        {
                            throw new ArgumentException("Invalid argument");
                        }
                    }
                    catch (Exception ex)
                    {
                        MsConsoleLogger.Error(ex.Message);
                    }
                }
            }
        }