public IStorage GetStorage(StorageComponentTypes StorageType) { IStorage storageComponent = null; switch (StorageType) { case StorageComponentTypes.ApacerMicroSDHC: storageComponent = new ApacerMicroSDHC(Output); Output.WriteLine($"{nameof(ApacerMicroSDHC)} selected"); break; case StorageComponentTypes.KingstonMicroSDHC: storageComponent = new KingstonMicroSDHC(Output); Output.WriteLine($"{nameof(KingstonMicroSDHC)} selected"); break; case StorageComponentTypes.SanDiskMicroSDXC: storageComponent = new SanDiskMicroSDXC(Output); Output.WriteLine($"{nameof(SanDiskMicroSDXC)} selected"); break; case StorageComponentTypes.SiliconPowerMicroSD: storageComponent = new SiliconPowerMicroSD(Output); Output.WriteLine($"{nameof(SiliconPowerMicroSD)} selected"); break; } return(storageComponent); }
public void GetAndProcessUserSelectionOfStorage(SimCorpMobile simCorpMobile) { StorageHandler storageHandler = new StorageHandler(Output); string enteredStorageTypeIndex = Input.ReadLine(); try { StorageComponentTypes storageType = storageHandler.GetStorageType(enteredStorageTypeIndex); IStorage storageComponent = storageHandler.GetStorage(storageType); storageHandler.SetAndRunStorage(simCorpMobile, storageComponent); } catch (Exception e) { Output.Write(e.Message); } }