Skip to content

Commit b38a35b

Browse files
refactor: renamed VDrive -> HostFolderDrive
1 parent 9adefcf commit b38a35b

File tree

5 files changed

+33
-33
lines changed

5 files changed

+33
-33
lines changed

src/Spice86.Core/Emulator/InterruptHandlers/Dos/DosInt21Handler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1027,7 +1027,7 @@ public override void Run() {
10271027
/// The number of potentially valid drive letters in AL.
10281028
/// </returns>
10291029
public void SelectDefaultDrive() {
1030-
if(_dosDriveManager.TryGetValue(DosDriveManager.DriveLetters.ElementAtOrDefault(State.DL).Key, out VirtualDrive? mountedDrive)) {
1030+
if(_dosDriveManager.TryGetValue(DosDriveManager.DriveLetters.ElementAtOrDefault(State.DL).Key, out HostFolderDrive? mountedDrive)) {
10311031
_dosDriveManager.CurrentDrive = mountedDrive;
10321032
}
10331033
if (State.DL > DosDriveManager.MaxDriveCount && LoggerService.IsEnabled(LogEventLevel.Error)) {

src/Spice86.Core/Emulator/OperatingSystem/DosDriveManager.cs

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
/// <summary>
1414
/// The class responsible for centralizing all the mounted DOS drives.
1515
/// </summary>
16-
public class DosDriveManager : IDictionary<char, VirtualDrive> {
17-
private readonly SortedDictionary<char, VirtualDrive?> _driveMap = new();
16+
public class DosDriveManager : IDictionary<char, HostFolderDrive> {
17+
private readonly SortedDictionary<char, HostFolderDrive?> _driveMap = new();
1818
private readonly ILoggerService _loggerService;
1919

2020
/// <summary>
@@ -31,7 +31,7 @@ public DosDriveManager(ILoggerService loggerService, string? cDriveFolderPath, s
3131
cDriveFolderPath = ConvertUtils.ToSlashFolderPath(cDriveFolderPath);
3232
_driveMap.Add('A', null);
3333
_driveMap.Add('B', null);
34-
_driveMap.Add('C', new VirtualDrive { DriveLetter = 'C', MountedHostDirectory = cDriveFolderPath, CurrentDosDirectory = "" });
34+
_driveMap.Add('C', new HostFolderDrive { DriveLetter = 'C', MountedHostDirectory = cDriveFolderPath, CurrentDosDirectory = "" });
3535
CurrentDrive = _driveMap.ElementAt(2).Value!;
3636
if(loggerService.IsEnabled(Serilog.Events.LogEventLevel.Verbose)) {
3737
loggerService.Verbose("DOS Drives initialized: {@Drives}", _driveMap.Values);
@@ -41,7 +41,7 @@ public DosDriveManager(ILoggerService loggerService, string? cDriveFolderPath, s
4141
/// <summary>
4242
/// The currently selected drive.
4343
/// </summary>
44-
public VirtualDrive CurrentDrive { get; set; }
44+
public HostFolderDrive CurrentDrive { get; set; }
4545

4646
internal static readonly ImmutableSortedDictionary<char, byte> DriveLetters = new Dictionary<char, byte>() {
4747
{ 'A', 0 },
@@ -92,57 +92,57 @@ public byte NumberOfPotentiallyValidDriveLetters {
9292
}
9393
}
9494

95-
public ICollection<char> Keys => ((IDictionary<char, VirtualDrive>)_driveMap).Keys;
95+
public ICollection<char> Keys => ((IDictionary<char, HostFolderDrive>)_driveMap).Keys;
9696

97-
public ICollection<VirtualDrive> Values => ((IDictionary<char, VirtualDrive>)_driveMap).Values;
97+
public ICollection<HostFolderDrive> Values => ((IDictionary<char, HostFolderDrive>)_driveMap).Values;
9898

99-
public int Count => ((ICollection<KeyValuePair<char, VirtualDrive>>)_driveMap).Count;
99+
public int Count => ((ICollection<KeyValuePair<char, HostFolderDrive>>)_driveMap).Count;
100100

101-
public bool IsReadOnly => ((ICollection<KeyValuePair<char, VirtualDrive>>)_driveMap).IsReadOnly;
101+
public bool IsReadOnly => ((ICollection<KeyValuePair<char, HostFolderDrive>>)_driveMap).IsReadOnly;
102102

103-
public VirtualDrive this[char key] { get => ((IDictionary<char, VirtualDrive>)_driveMap)[key]; set => ((IDictionary<char, VirtualDrive>)_driveMap)[key] = value; }
103+
public HostFolderDrive this[char key] { get => ((IDictionary<char, HostFolderDrive>)_driveMap)[key]; set => ((IDictionary<char, HostFolderDrive>)_driveMap)[key] = value; }
104104

105105

106106
public const int MaxDriveCount = 26;
107107

108-
public void Add(char key, VirtualDrive value) {
109-
((IDictionary<char, VirtualDrive>)_driveMap).Add(key, value);
108+
public void Add(char key, HostFolderDrive value) {
109+
((IDictionary<char, HostFolderDrive>)_driveMap).Add(key, value);
110110
}
111111

112112
public bool ContainsKey(char key) {
113-
return ((IDictionary<char, VirtualDrive>)_driveMap).ContainsKey(key);
113+
return ((IDictionary<char, HostFolderDrive>)_driveMap).ContainsKey(key);
114114
}
115115

116116
public bool Remove(char key) {
117-
return ((IDictionary<char, VirtualDrive>)_driveMap).Remove(key);
117+
return ((IDictionary<char, HostFolderDrive>)_driveMap).Remove(key);
118118
}
119119

120-
public bool TryGetValue(char key, [MaybeNullWhen(false)] out VirtualDrive value) {
121-
return ((IDictionary<char, VirtualDrive>)_driveMap).TryGetValue(key, out value);
120+
public bool TryGetValue(char key, [MaybeNullWhen(false)] out HostFolderDrive value) {
121+
return ((IDictionary<char, HostFolderDrive>)_driveMap).TryGetValue(key, out value);
122122
}
123123

124-
public void Add(KeyValuePair<char, VirtualDrive> item) {
125-
((ICollection<KeyValuePair<char, VirtualDrive>>)_driveMap).Add(item);
124+
public void Add(KeyValuePair<char, HostFolderDrive> item) {
125+
((ICollection<KeyValuePair<char, HostFolderDrive>>)_driveMap).Add(item);
126126
}
127127

128128
public void Clear() {
129-
((ICollection<KeyValuePair<char, VirtualDrive>>)_driveMap).Clear();
129+
((ICollection<KeyValuePair<char, HostFolderDrive>>)_driveMap).Clear();
130130
}
131131

132-
public bool Contains(KeyValuePair<char, VirtualDrive> item) {
133-
return ((ICollection<KeyValuePair<char, VirtualDrive>>)_driveMap).Contains(item);
132+
public bool Contains(KeyValuePair<char, HostFolderDrive> item) {
133+
return ((ICollection<KeyValuePair<char, HostFolderDrive>>)_driveMap).Contains(item);
134134
}
135135

136-
public void CopyTo(KeyValuePair<char, VirtualDrive>[] array, int arrayIndex) {
137-
((ICollection<KeyValuePair<char, VirtualDrive>>)_driveMap).CopyTo(array, arrayIndex);
136+
public void CopyTo(KeyValuePair<char, HostFolderDrive>[] array, int arrayIndex) {
137+
((ICollection<KeyValuePair<char, HostFolderDrive>>)_driveMap).CopyTo(array, arrayIndex);
138138
}
139139

140-
public bool Remove(KeyValuePair<char, VirtualDrive> item) {
141-
return ((ICollection<KeyValuePair<char, VirtualDrive>>)_driveMap).Remove(item);
140+
public bool Remove(KeyValuePair<char, HostFolderDrive> item) {
141+
return ((ICollection<KeyValuePair<char, HostFolderDrive>>)_driveMap).Remove(item);
142142
}
143143

144-
public IEnumerator<KeyValuePair<char, VirtualDrive>> GetEnumerator() {
145-
return ((IEnumerable<KeyValuePair<char, VirtualDrive>>)_driveMap).GetEnumerator();
144+
public IEnumerator<KeyValuePair<char, HostFolderDrive>> GetEnumerator() {
145+
return ((IEnumerable<KeyValuePair<char, HostFolderDrive>>)_driveMap).GetEnumerator();
146146
}
147147

148148
IEnumerator IEnumerable.GetEnumerator() {

src/Spice86.Core/Emulator/OperatingSystem/DosFileManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1117,7 +1117,7 @@ public DosFileOperationResult IoControl(State state) {
11171117
{
11181118
// 1) Build the 11-byte volume label (padded with spaces)
11191119
// 1) pull the raw label (or default), split name/ext
1120-
VirtualDrive vDrive = _dosDriveManager.ElementAtOrDefault(drive).Value;
1120+
HostFolderDrive vDrive = _dosDriveManager.ElementAtOrDefault(drive).Value;
11211121
string driveLabel = vDrive.Label.ToUpperInvariant();
11221122

11231123

src/Spice86.Core/Emulator/OperatingSystem/DosPathResolver.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,13 @@ public DosPathResolver(DosDriveManager dosDriveManager) {
3535
public DosFileOperationResult GetCurrentDosDirectory(byte driveNumber, out string currentDir) {
3636
//0 = default drive
3737
if (driveNumber == 0 && _dosDriveManager.Count > 0) {
38-
VirtualDrive virtualDrive = _dosDriveManager.CurrentDrive;
38+
HostFolderDrive virtualDrive = _dosDriveManager.CurrentDrive;
3939
currentDir = virtualDrive.CurrentDosDirectory;
4040
return DosFileOperationResult.NoValue();
4141
} else {
4242
char driveLetter = DosDriveManager.DriveLetters.Keys.ElementAtOrDefault(driveNumber - 1);
4343
if (_dosDriveManager.TryGetValue(driveLetter,
44-
out VirtualDrive? virtualDrive)) {
44+
out HostFolderDrive? virtualDrive)) {
4545
currentDir = virtualDrive.CurrentDosDirectory;
4646
return DosFileOperationResult.NoValue();
4747
}
@@ -50,7 +50,7 @@ public DosFileOperationResult GetCurrentDosDirectory(byte driveNumber, out strin
5050
return DosFileOperationResult.Error(DosErrorCode.InvalidDrive);
5151
}
5252

53-
private static string GetFullCurrentDosPathOnDrive(VirtualDrive virtualDrive) =>
53+
private static string GetFullCurrentDosPathOnDrive(HostFolderDrive virtualDrive) =>
5454
Path.Combine($"{virtualDrive.DosVolume}{DirectorySeparatorChar}", virtualDrive.CurrentDosDirectory);
5555

5656
internal static string GetExeParentFolder(string? exe) {
@@ -62,7 +62,7 @@ internal static string GetExeParentFolder(string? exe) {
6262
return string.IsNullOrWhiteSpace(parent) ? fallbackValue : ConvertUtils.ToSlashFolderPath(parent);
6363
}
6464

65-
private static bool IsWithinMountPoint(string hostFullPath, VirtualDrive virtualDrive) => hostFullPath.StartsWith(virtualDrive.MountedHostDirectory);
65+
private static bool IsWithinMountPoint(string hostFullPath, HostFolderDrive virtualDrive) => hostFullPath.StartsWith(virtualDrive.MountedHostDirectory);
6666

6767
/// <summary>
6868
/// Sets the current DOS folder.

src/Spice86.Core/Emulator/OperatingSystem/Structures/VirtualDrive.cs renamed to src/Spice86.Core/Emulator/OperatingSystem/Structures/HostFolderDrive.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/// <summary>
33
/// Represents a host folder used as a drive by DOS.
44
/// </summary>
5-
public class VirtualDrive : DosDriveBase {
5+
public class HostFolderDrive : DosDriveBase {
66
/// <summary>
77
/// The full host path to the mounted folder. This path serves as the root of the DOS drive.
88
/// </summary>

0 commit comments

Comments
 (0)