aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.HLE/FileSystem
diff options
context:
space:
mode:
authorAlex Barney <thealexbarney@gmail.com>2018-12-04 14:23:37 -0600
committergdkchan <gab.dark.100@gmail.com>2018-12-04 18:23:37 -0200
commit85dbb9559ad317a657dafd24da27fec4b3f5250f (patch)
treeecd92931bc2146e549484d9a3af308469089ad4e /Ryujinx.HLE/FileSystem
parentc86aacde76b5f8e503e2b412385c8491ecc86b3b (diff)
Adjust naming conventions and general refactoring in HLE Project (#490)
* Rename enum fields * Naming conventions * Remove unneeded ".this" * Remove unneeded semicolons * Remove unused Usings * Don't use var * Remove unneeded enum underlying types * Explicitly label class visibility * Remove unneeded @ prefixes * Remove unneeded commas * Remove unneeded if expressions * Method doesn't use unsafe code * Remove unneeded casts * Initialized objects don't need an empty constructor * Remove settings from DotSettings * Revert "Explicitly label class visibility" This reverts commit ad5eb5787cc5b27a4631cd46ef5f551c4ae95e51. * Small changes * Revert external enum renaming * Changes from feedback * Remove unneeded property setters
Diffstat (limited to 'Ryujinx.HLE/FileSystem')
-rw-r--r--Ryujinx.HLE/FileSystem/Content/ContentManager.cs252
-rw-r--r--Ryujinx.HLE/FileSystem/Content/LocationEntry.cs25
-rw-r--r--Ryujinx.HLE/FileSystem/Content/LocationHelper.cs36
-rw-r--r--Ryujinx.HLE/FileSystem/FileSystemProvider.cs192
-rw-r--r--Ryujinx.HLE/FileSystem/IFileSystemProvider.cs33
-rw-r--r--Ryujinx.HLE/FileSystem/PFsProvider.cs84
-rw-r--r--Ryujinx.HLE/FileSystem/RomFsProvider.cs100
-rw-r--r--Ryujinx.HLE/FileSystem/SaveHelper.cs32
-rw-r--r--Ryujinx.HLE/FileSystem/SaveInfo.cs30
-rw-r--r--Ryujinx.HLE/FileSystem/VirtualFileSystem.cs88
10 files changed, 434 insertions, 438 deletions
diff --git a/Ryujinx.HLE/FileSystem/Content/ContentManager.cs b/Ryujinx.HLE/FileSystem/Content/ContentManager.cs
index 3727841d..0b3bfe00 100644
--- a/Ryujinx.HLE/FileSystem/Content/ContentManager.cs
+++ b/Ryujinx.HLE/FileSystem/Content/ContentManager.cs
@@ -9,297 +9,297 @@ namespace Ryujinx.HLE.FileSystem.Content
{
internal class ContentManager
{
- private Dictionary<StorageId, LinkedList<LocationEntry>> LocationEntries;
+ private Dictionary<StorageId, LinkedList<LocationEntry>> _locationEntries;
- private Dictionary<string, long> SharedFontTitleDictionary;
+ private Dictionary<string, long> _sharedFontTitleDictionary;
- private SortedDictionary<(ulong, ContentType), string> ContentDictionary;
+ private SortedDictionary<(ulong, ContentType), string> _contentDictionary;
- private Switch Device;
+ private Switch _device;
- public ContentManager(Switch Device)
+ public ContentManager(Switch device)
{
- ContentDictionary = new SortedDictionary<(ulong, ContentType), string>();
- LocationEntries = new Dictionary<StorageId, LinkedList<LocationEntry>>();
+ _contentDictionary = new SortedDictionary<(ulong, ContentType), string>();
+ _locationEntries = new Dictionary<StorageId, LinkedList<LocationEntry>>();
- SharedFontTitleDictionary = new Dictionary<string, long>()
+ _sharedFontTitleDictionary = new Dictionary<string, long>
{
{ "FontStandard", 0x0100000000000811 },
{ "FontChineseSimplified", 0x0100000000000814 },
{ "FontExtendedChineseSimplified", 0x0100000000000814 },
{ "FontKorean", 0x0100000000000812 },
{ "FontChineseTraditional", 0x0100000000000813 },
- { "FontNintendoExtended" , 0x0100000000000810 },
+ { "FontNintendoExtended", 0x0100000000000810 }
};
- this.Device = Device;
+ _device = device;
}
public void LoadEntries()
{
- ContentDictionary = new SortedDictionary<(ulong, ContentType), string>();
+ _contentDictionary = new SortedDictionary<(ulong, ContentType), string>();
- foreach (StorageId StorageId in Enum.GetValues(typeof(StorageId)))
+ foreach (StorageId storageId in Enum.GetValues(typeof(StorageId)))
{
- string ContentDirectory = null;
- string ContentPathString = null;
- string RegisteredDirectory = null;
+ string contentDirectory = null;
+ string contentPathString = null;
+ string registeredDirectory = null;
try
{
- ContentPathString = LocationHelper.GetContentRoot(StorageId);
- ContentDirectory = LocationHelper.GetRealPath(Device.FileSystem, ContentPathString);
- RegisteredDirectory = Path.Combine(ContentDirectory, "registered");
+ contentPathString = LocationHelper.GetContentRoot(storageId);
+ contentDirectory = LocationHelper.GetRealPath(_device.FileSystem, contentPathString);
+ registeredDirectory = Path.Combine(contentDirectory, "registered");
}
- catch (NotSupportedException NEx)
+ catch (NotSupportedException)
{
continue;
}
- Directory.CreateDirectory(RegisteredDirectory);
+ Directory.CreateDirectory(registeredDirectory);
- LinkedList<LocationEntry> LocationList = new LinkedList<LocationEntry>();
+ LinkedList<LocationEntry> locationList = new LinkedList<LocationEntry>();
- void AddEntry(LocationEntry Entry)
+ void AddEntry(LocationEntry entry)
{
- LocationList.AddLast(Entry);
+ locationList.AddLast(entry);
}
- foreach (string DirectoryPath in Directory.EnumerateDirectories(RegisteredDirectory))
+ foreach (string directoryPath in Directory.EnumerateDirectories(registeredDirectory))
{
- if (Directory.GetFiles(DirectoryPath).Length > 0)
+ if (Directory.GetFiles(directoryPath).Length > 0)
{
- string NcaName = new DirectoryInfo(DirectoryPath).Name.Replace(".nca", string.Empty);
+ string ncaName = new DirectoryInfo(directoryPath).Name.Replace(".nca", string.Empty);
- using (FileStream NcaFile = new FileStream(Directory.GetFiles(DirectoryPath)[0], FileMode.Open, FileAccess.Read))
+ using (FileStream ncaFile = new FileStream(Directory.GetFiles(directoryPath)[0], FileMode.Open, FileAccess.Read))
{
- Nca Nca = new Nca(Device.System.KeySet, NcaFile, false);
+ Nca nca = new Nca(_device.System.KeySet, ncaFile, false);
- string SwitchPath = Path.Combine(ContentPathString + ":",
- NcaFile.Name.Replace(ContentDirectory, string.Empty).TrimStart('\\'));
+ string switchPath = Path.Combine(contentPathString + ":",
+ ncaFile.Name.Replace(contentDirectory, string.Empty).TrimStart('\\'));
// Change path format to switch's
- SwitchPath = SwitchPath.Replace('\\', '/');
+ switchPath = switchPath.Replace('\\', '/');
- LocationEntry Entry = new LocationEntry(SwitchPath,
+ LocationEntry entry = new LocationEntry(switchPath,
0,
- (long)Nca.Header.TitleId,
- Nca.Header.ContentType);
+ (long)nca.Header.TitleId,
+ nca.Header.ContentType);
- AddEntry(Entry);
+ AddEntry(entry);
- ContentDictionary.Add((Nca.Header.TitleId, Nca.Header.ContentType), NcaName);
+ _contentDictionary.Add((nca.Header.TitleId, nca.Header.ContentType), ncaName);
- NcaFile.Close();
- Nca.Dispose();
- NcaFile.Dispose();
+ ncaFile.Close();
+ nca.Dispose();
+ ncaFile.Dispose();
}
}
}
- foreach (string FilePath in Directory.EnumerateFiles(ContentDirectory))
+ foreach (string filePath in Directory.EnumerateFiles(contentDirectory))
{
- if (Path.GetExtension(FilePath) == ".nca")
+ if (Path.GetExtension(filePath) == ".nca")
{
- string NcaName = Path.GetFileNameWithoutExtension(FilePath);
+ string ncaName = Path.GetFileNameWithoutExtension(filePath);
- using (FileStream NcaFile = new FileStream(FilePath, FileMode.Open, FileAccess.Read))
+ using (FileStream ncaFile = new FileStream(filePath, FileMode.Open, FileAccess.Read))
{
- Nca Nca = new Nca(Device.System.KeySet, NcaFile, false);
+ Nca nca = new Nca(_device.System.KeySet, ncaFile, false);
- string SwitchPath = Path.Combine(ContentPathString + ":",
- FilePath.Replace(ContentDirectory, string.Empty).TrimStart('\\'));
+ string switchPath = Path.Combine(contentPathString + ":",
+ filePath.Replace(contentDirectory, string.Empty).TrimStart('\\'));
// Change path format to switch's
- SwitchPath = SwitchPath.Replace('\\', '/');
+ switchPath = switchPath.Replace('\\', '/');
- LocationEntry Entry = new LocationEntry(SwitchPath,
+ LocationEntry entry = new LocationEntry(switchPath,
0,
- (long)Nca.Header.TitleId,
- Nca.Header.ContentType);
+ (long)nca.Header.TitleId,
+ nca.Header.ContentType);
- AddEntry(Entry);
+ AddEntry(entry);
- ContentDictionary.Add((Nca.Header.TitleId, Nca.Header.ContentType), NcaName);
+ _contentDictionary.Add((nca.Header.TitleId, nca.Header.ContentType), ncaName);
- NcaFile.Close();
- Nca.Dispose();
- NcaFile.Dispose();
+ ncaFile.Close();
+ nca.Dispose();
+ ncaFile.Dispose();
}
}
}
- if(LocationEntries.ContainsKey(StorageId) && LocationEntries[StorageId]?.Count == 0)
+ if(_locationEntries.ContainsKey(storageId) && _locationEntries[storageId]?.Count == 0)
{
- LocationEntries.Remove(StorageId);
+ _locationEntries.Remove(storageId);
}
- if (!LocationEntries.ContainsKey(StorageId))
+ if (!_locationEntries.ContainsKey(storageId))
{
- LocationEntries.Add(StorageId, LocationList);
+ _locationEntries.Add(storageId, locationList);
}
}
}
- public void ClearEntry(long TitleId, ContentType ContentType,StorageId StorageId)
+ public void ClearEntry(long titleId, ContentType contentType,StorageId storageId)
{
- RemoveLocationEntry(TitleId, ContentType, StorageId);
+ RemoveLocationEntry(titleId, contentType, storageId);
}
- public void RefreshEntries(StorageId StorageId, int Flag)
+ public void RefreshEntries(StorageId storageId, int flag)
{
- LinkedList<LocationEntry> LocationList = LocationEntries[StorageId];
- LinkedListNode<LocationEntry> LocationEntry = LocationList.First;
+ LinkedList<LocationEntry> locationList = _locationEntries[storageId];
+ LinkedListNode<LocationEntry> locationEntry = locationList.First;
- while (LocationEntry != null)
+ while (locationEntry != null)
{
- LinkedListNode<LocationEntry> NextLocationEntry = LocationEntry.Next;
+ LinkedListNode<LocationEntry> nextLocationEntry = locationEntry.Next;
- if (LocationEntry.Value.Flag == Flag)
+ if (locationEntry.Value.Flag == flag)
{
- LocationList.Remove(LocationEntry.Value);
+ locationList.Remove(locationEntry.Value);
}
- LocationEntry = NextLocationEntry;
+ locationEntry = nextLocationEntry;
}
}
- public bool HasNca(string NcaId, StorageId StorageId)
+ public bool HasNca(string ncaId, StorageId storageId)
{
- if (ContentDictionary.ContainsValue(NcaId))
+ if (_contentDictionary.ContainsValue(ncaId))
{
- var Content = ContentDictionary.FirstOrDefault(x => x.Value == NcaId);
- long TitleId = (long)Content.Key.Item1;
- ContentType ContentType = Content.Key.Item2;
- StorageId Storage = GetInstalledStorage(TitleId, ContentType, StorageId);
+ var content = _contentDictionary.FirstOrDefault(x => x.Value == ncaId);
+ long titleId = (long)content.Key.Item1;
+ ContentType contentType = content.Key.Item2;
+ StorageId storage = GetInstalledStorage(titleId, contentType, storageId);
- return Storage == StorageId;
+ return storage == storageId;
}
return false;
}
- public UInt128 GetInstalledNcaId(long TitleId, ContentType ContentType)
+ public UInt128 GetInstalledNcaId(long titleId, ContentType contentType)
{
- if (ContentDictionary.ContainsKey(((ulong)TitleId,ContentType)))
+ if (_contentDictionary.ContainsKey(((ulong)titleId,contentType)))
{
- return new UInt128(ContentDictionary[((ulong)TitleId,ContentType)]);
+ return new UInt128(_contentDictionary[((ulong)titleId,contentType)]);
}
return new UInt128();
}
- public StorageId GetInstalledStorage(long TitleId, ContentType ContentType, StorageId StorageId)
+ public StorageId GetInstalledStorage(long titleId, ContentType contentType, StorageId storageId)
{
- LocationEntry LocationEntry = GetLocation(TitleId, ContentType, StorageId);
+ LocationEntry locationEntry = GetLocation(titleId, contentType, storageId);
- return LocationEntry.ContentPath != null ?
- LocationHelper.GetStorageId(LocationEntry.ContentPath) : StorageId.None;
+ return locationEntry.ContentPath != null ?
+ LocationHelper.GetStorageId(locationEntry.ContentPath) : StorageId.None;
}
- public string GetInstalledContentPath(long TitleId, StorageId StorageId, ContentType ContentType)
+ public string GetInstalledContentPath(long titleId, StorageId storageId, ContentType contentType)
{
- LocationEntry LocationEntry = GetLocation(TitleId, ContentType, StorageId);
+ LocationEntry locationEntry = GetLocation(titleId, contentType, storageId);
- if (VerifyContentType(LocationEntry, ContentType))
+ if (VerifyContentType(locationEntry, contentType))
{
- return LocationEntry.ContentPath;
+ return locationEntry.ContentPath;
}
return string.Empty;
}
- public void RedirectLocation(LocationEntry NewEntry, StorageId StorageId)
+ public void RedirectLocation(LocationEntry newEntry, StorageId storageId)
{
- LocationEntry LocationEntry = GetLocation(NewEntry.TitleId, NewEntry.ContentType, StorageId);
+ LocationEntry locationEntry = GetLocation(newEntry.TitleId, newEntry.ContentType, storageId);
- if (LocationEntry.ContentPath != null)
+ if (locationEntry.ContentPath != null)
{
- RemoveLocationEntry(NewEntry.TitleId, NewEntry.ContentType, StorageId);
+ RemoveLocationEntry(newEntry.TitleId, newEntry.ContentType, storageId);
}
- AddLocationEntry(NewEntry, StorageId);
+ AddLocationEntry(newEntry, storageId);
}
- private bool VerifyContentType(LocationEntry LocationEntry, ContentType ContentType)
+ private bool VerifyContentType(LocationEntry locationEntry, ContentType contentType)
{
- if (LocationEntry.ContentPath == null)
+ if (locationEntry.ContentPath == null)
{
return false;
}
- StorageId StorageId = LocationHelper.GetStorageId(LocationEntry.ContentPath);
- string InstalledPath = Device.FileSystem.SwitchPathToSystemPath(LocationEntry.ContentPath);
+ StorageId storageId = LocationHelper.GetStorageId(locationEntry.ContentPath);
+ string installedPath = _device.FileSystem.SwitchPathToSystemPath(locationEntry.ContentPath);
- if (!string.IsNullOrWhiteSpace(InstalledPath))
+ if (!string.IsNullOrWhiteSpace(installedPath))
{
- if (File.Exists(InstalledPath))
+ if (File.Exists(installedPath))
{
- FileStream File = new FileStream(InstalledPath, FileMode.Open, FileAccess.Read);
- Nca Nca = new Nca(Device.System.KeySet, File, false);
- bool ContentCheck = Nca.Header.ContentType == ContentType;
+ FileStream file = new FileStream(installedPath, FileMode.Open, FileAccess.Read);
+ Nca nca = new Nca(_device.System.KeySet, file, false);
+ bool contentCheck = nca.Header.ContentType == contentType;
- Nca.Dispose();
- File.Dispose();
+ nca.Dispose();
+ file.Dispose();
- return ContentCheck;
+ return contentCheck;
}
}
return false;
}
- private void AddLocationEntry(LocationEntry Entry, StorageId StorageId)
+ private void AddLocationEntry(LocationEntry entry, StorageId storageId)
{
- LinkedList<LocationEntry> LocationList = null;
+ LinkedList<LocationEntry> locationList = null;
- if (LocationEntries.ContainsKey(StorageId))
+ if (_locationEntries.ContainsKey(storageId))
{
- LocationList = LocationEntries[StorageId];
+ locationList = _locationEntries[storageId];
}
- if (LocationList != null)
+ if (locationList != null)
{
- if (LocationList.Contains(Entry))
+ if (locationList.Contains(entry))
{
- LocationList.Remove(Entry);
+ locationList.Remove(entry);
}
- LocationList.AddLast(Entry);
+ locationList.AddLast(entry);
}
}
- private void RemoveLocationEntry(long TitleId, ContentType ContentType, StorageId StorageId)
+ private void RemoveLocationEntry(long titleId, ContentType contentType, StorageId storageId)
{
- LinkedList<LocationEntry> LocationList = null;
+ LinkedList<LocationEntry> locationList = null;
- if (LocationEntries.ContainsKey(StorageId))
+ if (_locationEntries.ContainsKey(storageId))
{
- LocationList = LocationEntries[StorageId];
+ locationList = _locationEntries[storageId];
}
- if (LocationList != null)
+ if (locationList != null)
{
- LocationEntry Entry =
- LocationList.ToList().Find(x => x.TitleId == TitleId && x.ContentType == ContentType);
+ LocationEntry entry =
+ locationList.ToList().Find(x => x.TitleId == titleId && x.ContentType == contentType);
- if (Entry.ContentPath != null)
+ if (entry.ContentPath != null)
{
- LocationList.Remove(Entry);
+ locationList.Remove(entry);
}
}
}
- public bool TryGetFontTitle(string FontName, out long TitleId)
+ public bool TryGetFontTitle(string fontName, out long titleId)
{
- return SharedFontTitleDictionary.TryGetValue(FontName, out TitleId);
+ return _sharedFontTitleDictionary.TryGetValue(fontName, out titleId);
}
- private LocationEntry GetLocation(long TitleId, ContentType ContentType,StorageId StorageId)
+ private LocationEntry GetLocation(long titleId, ContentType contentType,StorageId storageId)
{
- LinkedList<LocationEntry> LocationList = LocationEntries[StorageId];
+ LinkedList<LocationEntry> locationList = _locationEntries[storageId];
- return LocationList.ToList().Find(x => x.TitleId == TitleId && x.ContentType == ContentType);
+ return locationList.ToList().Find(x => x.TitleId == titleId && x.ContentType == contentType);
}
}
}
diff --git a/Ryujinx.HLE/FileSystem/Content/LocationEntry.cs b/Ryujinx.HLE/FileSystem/Content/LocationEntry.cs
index c7c6133b..ade2e5a8 100644
--- a/Ryujinx.HLE/FileSystem/Content/LocationEntry.cs
+++ b/Ryujinx.HLE/FileSystem/Content/LocationEntry.cs
@@ -1,28 +1,25 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-using LibHac;
+using LibHac;
namespace Ryujinx.HLE.FileSystem.Content
{
public struct LocationEntry
{
- public string ContentPath { get; private set; }
+ public string ContentPath { get; }
public int Flag { get; private set; }
- public long TitleId { get; private set; }
- public ContentType ContentType { get; private set; }
+ public long TitleId { get; }
+ public ContentType ContentType { get; }
- public LocationEntry(string ContentPath, int Flag, long TitleId, ContentType ContentType)
+ public LocationEntry(string contentPath, int flag, long titleId, ContentType contentType)
{
- this.ContentPath = ContentPath;
- this.Flag = Flag;
- this.TitleId = TitleId;
- this.ContentType = ContentType;
+ ContentPath = contentPath;
+ Flag = flag;
+ TitleId = titleId;
+ ContentType = contentType;
}
- public void SetFlag(int Flag)
+ public void SetFlag(int flag)
{
- this.Flag = Flag;
+ Flag = flag;
}
}
}
diff --git a/Ryujinx.HLE/FileSystem/Content/LocationHelper.cs b/Ryujinx.HLE/FileSystem/Content/LocationHelper.cs
index 75b59431..df3f5ad6 100644
--- a/Ryujinx.HLE/FileSystem/Content/LocationHelper.cs
+++ b/Ryujinx.HLE/FileSystem/Content/LocationHelper.cs
@@ -7,30 +7,30 @@ namespace Ryujinx.HLE.FileSystem.Content
{
internal static class LocationHelper
{
- public static string GetRealPath(VirtualFileSystem FileSystem, string SwitchContentPath)
+ public static string GetRealPath(VirtualFileSystem fileSystem, string switchContentPath)
{
- string BasePath = FileSystem.GetBasePath();
+ string basePath = fileSystem.GetBasePath();
- switch (SwitchContentPath)
+ switch (switchContentPath)
{
case ContentPath.SystemContent:
- return Path.Combine(FileSystem.GetBasePath(), SystemNandPath, "Contents");
+ return Path.Combine(fileSystem.GetBasePath(), SystemNandPath, "Contents");
case ContentPath.UserContent:
- return Path.Combine(FileSystem.GetBasePath(), UserNandPath, "Contents");
+ return Path.Combine(fileSystem.GetBasePath(), UserNandPath, "Contents");
case ContentPath.SdCardContent:
- return Path.Combine(FileSystem.GetSdCardPath(), "Nintendo", "Contents");
+ return Path.Combine(fileSystem.GetSdCardPath(), "Nintendo", "Contents");
case ContentPath.System:
- return Path.Combine(BasePath, SystemNandPath);
+ return Path.Combine(basePath, SystemNandPath);
case ContentPath.User:
- return Path.Combine(BasePath, UserNandPath);
+ return Path.Combine(basePath, UserNandPath);
default:
- throw new NotSupportedException($"Content Path `{SwitchContentPath}` is not supported.");
+ throw new NotSupportedException($"Content Path `{switchContentPath}` is not supported.");
}
}
- public static string GetContentPath(ContentStorageId ContentStorageId)
+ public static string GetContentPath(ContentStorageId contentStorageId)
{
- switch (ContentStorageId)
+ switch (contentStorageId)
{
case ContentStorageId.NandSystem:
return ContentPath.SystemContent;
@@ -39,13 +39,13 @@ namespace Ryujinx.HLE.FileSystem.Content
case ContentStorageId.SdCard:
return ContentPath.SdCardContent;
default:
- throw new NotSupportedException($"Content Storage `{ContentStorageId}` is not supported.");
+ throw new NotSupportedException($"Content Storage `{contentStorageId}` is not supported.");
}
}
- public static string GetContentRoot(StorageId StorageId)
+ public static string GetContentRoot(StorageId storageId)
{
- switch (StorageId)
+ switch (storageId)
{
case StorageId.NandSystem:
return ContentPath.SystemContent;
@@ -54,15 +54,15 @@ namespace Ryujinx.HLE.FileSystem.Content
case StorageId.SdCard:
return ContentPath.SdCardContent;
default:
- throw new NotSupportedException($"Storage Id `{StorageId}` is not supported.");
+ throw new NotSupportedException($"Storage Id `{storageId}` is not supported.");
}
}
- public static StorageId GetStorageId(string ContentPathString)
+ public static StorageId GetStorageId(string contentPathString)
{
- string CleanedPath = ContentPathString.Split(':')[0];
+ string cleanedPath = contentPathString.Split(':')[0];
- switch (CleanedPath)
+ switch (cleanedPath)
{
case ContentPath.SystemContent:
case ContentPath.System:
diff --git a/Ryujinx.HLE/FileSystem/FileSystemProvider.cs b/Ryujinx.HLE/FileSystem/FileSystemProvider.cs
index fdaa7fd7..8461467d 100644
--- a/Ryujinx.HLE/FileSystem/FileSystemProvider.cs
+++ b/Ryujinx.HLE/FileSystem/FileSystemProvider.cs
@@ -10,228 +10,228 @@ namespace Ryujinx.HLE.FileSystem
{
class FileSystemProvider : IFileSystemProvider
{
- private readonly string BasePath;
- private readonly string RootPath;
+ private readonly string _basePath;
+ private readonly string _rootPath;
- public FileSystemProvider(string BasePath, string RootPath)
+ public FileSystemProvider(string basePath, string rootPath)
{
- this.BasePath = BasePath;
- this.RootPath = RootPath;
+ _basePath = basePath;
+ _rootPath = rootPath;
- CheckIfDescendentOfRootPath(BasePath);
+ CheckIfDescendentOfRootPath(basePath);
}
- public long CreateDirectory(string Name)
+ public long CreateDirectory(string name)
{
- CheckIfDescendentOfRootPath(Name);
+ CheckIfDescendentOfRootPath(name);
- if (Directory.Exists(Name))
+ if (Directory.Exists(name))
{
return MakeError(ErrorModule.Fs, FsErr.PathAlreadyExists);
}
- Directory.CreateDirectory(Name);
+ Directory.CreateDirectory(name);
return 0;
}
- public long CreateFile(string Name, long Size)
+ public long CreateFile(string name, long size)
{
- CheckIfDescendentOfRootPath(Name);
+ CheckIfDescendentOfRootPath(name);
- if (File.Exists(Name))
+ if (File.Exists(name))
{
return MakeError(ErrorModule.Fs, FsErr.PathAlreadyExists);
}
- using (FileStream NewFile = File.Create(Name))
+ using (FileStream newFile = File.Create(name))
{
- NewFile.SetLength(Size);
+ newFile.SetLength(size);
}
return 0;
}
- public long DeleteDirectory(string Name, bool Recursive)
+ public long DeleteDirectory(string name, bool recursive)
{
- CheckIfDescendentOfRootPath(Name);
+ CheckIfDescendentOfRootPath(name);
- string DirName = Name;
+ string dirName = name;
- if (!Directory.Exists(DirName))
+ if (!Directory.Exists(dirName))
{
return MakeError(ErrorModule.Fs, FsErr.PathDoesNotExist);
}
- Directory.Delete(DirName, Recursive);
+ Directory.Delete(dirName, recursive);
return 0;
}
- public long DeleteFile(string Name)
+ public long DeleteFile(string name)
{
- CheckIfDescendentOfRootPath(Name);
+ CheckIfDescendentOfRootPath(name);
- if (!File.Exists(Name))
+ if (!File.Exists(name))
{
return MakeError(ErrorModule.Fs, FsErr.PathDoesNotExist);
}
else
{
- File.Delete(Name);
+ File.Delete(name);
}
return 0;
}
- public DirectoryEntry[] GetDirectories(string Path)
+ public DirectoryEntry[] GetDirectories(string path)
{
- CheckIfDescendentOfRootPath(Path);
+ CheckIfDescendentOfRootPath(path);
- List<DirectoryEntry> Entries = new List<DirectoryEntry>();
+ List<DirectoryEntry> entries = new List<DirectoryEntry>();
- foreach(string Directory in Directory.EnumerateDirectories(Path))
+ foreach(string directory in Directory.EnumerateDirectories(path))
{
- DirectoryEntry DirectoryEntry = new DirectoryEntry(Directory, DirectoryEntryType.Directory);
+ DirectoryEntry directoryEntry = new DirectoryEntry(directory, DirectoryEntryType.Directory);
- Entries.Add(DirectoryEntry);
+ entries.Add(directoryEntry);
}
- return Entries.ToArray();
+ return entries.ToArray();
}
- public DirectoryEntry[] GetEntries(string Path)
+ public DirectoryEntry[] GetEntries(string path)
{
- CheckIfDescendentOfRootPath(Path);
+ CheckIfDescendentOfRootPath(path);
- if (Directory.Exists(Path))
+ if (Directory.Exists(path))
{
- List<DirectoryEntry> Entries = new List<DirectoryEntry>();
+ List<DirectoryEntry> entries = new List<DirectoryEntry>();
- foreach (string Directory in Directory.EnumerateDirectories(Path))
+ foreach (string directory in Directory.EnumerateDirectories(path))
{
- DirectoryEntry DirectoryEntry = new DirectoryEntry(Directory, DirectoryEntryType.Directory);
+ DirectoryEntry directoryEntry = new DirectoryEntry(directory, DirectoryEntryType.Directory);
- Entries.Add(DirectoryEntry);
+ entries.Add(directoryEntry);
}
- foreach (string File in Directory.EnumerateFiles(Path))
+ foreach (string file in Directory.EnumerateFiles(path))
{
- FileInfo FileInfo = new FileInfo(File);
- DirectoryEntry DirectoryEntry = new DirectoryEntry(File, DirectoryEntryType.File, FileInfo.Length);
+ FileInfo fileInfo = new FileInfo(file);
+ DirectoryEntry directoryEntry = new DirectoryEntry(file, DirectoryEntryType.File, fileInfo.Length);
- Entries.Add(DirectoryEntry);
+ entries.Add(directoryEntry);
}
}
return null;
}
- public DirectoryEntry[] GetFiles(string Path)
+ public DirectoryEntry[] GetFiles(string path)
{
- CheckIfDescendentOfRootPath(Path);
+ CheckIfDescendentOfRootPath(path);
- List<DirectoryEntry> Entries = new List<DirectoryEntry>();
+ List<DirectoryEntry> entries = new List<DirectoryEntry>();
- foreach (string File in Directory.EnumerateFiles(Path))
+ foreach (string file in Directory.EnumerateFiles(path))
{
- FileInfo FileInfo = new FileInfo(File);
- DirectoryEntry DirectoryEntry = new DirectoryEntry(File, DirectoryEntryType.File, FileInfo.Length);
+ FileInfo fileInfo = new FileInfo(file);
+ DirectoryEntry directoryEntry = new DirectoryEntry(file, DirectoryEntryType.File, fileInfo.Length);
- Entries.Add(DirectoryEntry);
+ entries.Add(directoryEntry);
}
- return Entries.ToArray();
+ return entries.ToArray();
}
- public long GetFreeSpace(ServiceCtx Context)
+ public long GetFreeSpace(ServiceCtx context)
{
- return Context.Device.FileSystem.GetDrive().AvailableFreeSpace;
+ return context.Device.FileSystem.GetDrive().AvailableFreeSpace;
}
- public string GetFullPath(string Name)
+ public string GetFullPath(string name)
{
- if (Name.StartsWith("//"))
+ if (name.StartsWith("//"))
{
- Name = Name.Substring(2);
+ name = name.Substring(2);
}
- else if (Name.StartsWith('/'))
+ else if (name.StartsWith('/'))
{
- Name = Name.Substring(1);
+ name = name.Substring(1);
}
else
{
return null;
}
- string FullPath = Path.Combine(BasePath, Name);
+ string fullPath = Path.Combine(_basePath, name);
- CheckIfDescendentOfRootPath(FullPath);
+ CheckIfDescendentOfRootPath(fullPath);
- return FullPath;
+ return fullPath;
}
- public long GetTotalSpace(ServiceCtx Context)
+ public long GetTotalSpace(ServiceCtx context)
{
- return Context.Device.FileSystem.GetDrive().TotalSize;
+ return context.Device.FileSystem.GetDrive().TotalSize;
}
- public bool DirectoryExists(string Name)
+ public bool DirectoryExists(string name)
{
- CheckIfDescendentOfRootPath(Name);
+ CheckIfDescendentOfRootPath(name);
- return Directory.Exists(Name);
+ return Directory.Exists(name);
}
- public bool FileExists(string Name)
+ public bool FileExists(string name)
{
- CheckIfDescendentOfRootPath(Name);
+ CheckIfDescendentOfRootPath(name);
- return File.Exists(Name);
+ return File.Exists(name);
}
- public long OpenDirectory(string Name, int FilterFlags, out IDirectory DirectoryInterface)
+ public long OpenDirectory(string name, int filterFlags, out IDirectory directoryInterface)
{
- CheckIfDescendentOfRootPath(Name);
+ CheckIfDescendentOfRootPath(name);
- if (Directory.Exists(Name))
+ if (Directory.Exists(name))
{
- DirectoryInterface = new IDirectory(Name, FilterFlags, this);
+ directoryInterface = new IDirectory(name, filterFlags, this);
return 0;
}
- DirectoryInterface = null;
+ directoryInterface = null;
return MakeError(ErrorModule.Fs, FsErr.PathDoesNotExist);
}
- public long OpenFile(string Name, out IFile FileInterface)
+ public long OpenFile(string name, out IFile fileInterface)
{
- CheckIfDescendentOfRootPath(Name);
+ CheckIfDescendentOfRootPath(name);
- if (File.Exists(Name))
+ if (File.Exists(name))
{
- FileStream Stream = new FileStream(Name, FileMode.Open);
+ FileStream stream = new FileStream(name, FileMode.Open);
- FileInterface = new IFile(Stream, Name);
+ fileInterface = new IFile(stream, name);
return 0;
}
- FileInterface = null;
+ fileInterface = null;
return MakeError(ErrorModule.Fs, FsErr.PathDoesNotExist);
}
- public long RenameDirectory(string OldName, string NewName)
+ public long RenameDirectory(string oldName, string newName)
{
- CheckIfDescendentOfRootPath(OldName);
- CheckIfDescendentOfRootPath(NewName);
+ CheckIfDescendentOfRootPath(oldName);
+ CheckIfDescendentOfRootPath(newName);
- if (Directory.Exists(OldName))
+ if (Directory.Exists(oldName))
{
- Directory.Move(OldName, NewName);
+ Directory.Move(oldName, newName);
}
else
{
@@ -241,14 +241,14 @@ namespace Ryujinx.HLE.FileSystem
return 0;
}
- public long RenameFile(string OldName, string NewName)
+ public long RenameFile(string oldName, string newName)
{
- CheckIfDescendentOfRootPath(OldName);
- CheckIfDescendentOfRootPath(NewName);
+ CheckIfDescendentOfRootPath(oldName);
+ CheckIfDescendentOfRootPath(newName);
- if (File.Exists(OldName))
+ if (File.Exists(oldName))
{
- File.Move(OldName, NewName);
+ File.Move(oldName, newName);
}
else
{
@@ -258,24 +258,24 @@ namespace Ryujinx.HLE.FileSystem
return 0;
}
- public void CheckIfDescendentOfRootPath(string Path)
+ public void CheckIfDescendentOfRootPath(string path)
{
- DirectoryInfo PathInfo = new DirectoryInfo(Path);
- DirectoryInfo RootInfo = new DirectoryInfo(RootPath);
+ DirectoryInfo pathInfo = new DirectoryInfo(path);
+ DirectoryInfo rootInfo = new DirectoryInfo(_rootPath);
- while (PathInfo.Parent != null)
+ while (pathInfo.Parent != null)
{
- if (PathInfo.Parent.FullName == RootInfo.FullName)
+ if (pathInfo.Parent.FullName == rootInfo.FullName)
{
return;
}
else
{
- PathInfo = PathInfo.Parent;
+ pathInfo = pathInfo.Parent;
}
}
- throw new InvalidOperationException($"Path {Path} is not a child directory of {RootPath}");
+ throw new InvalidOperationException($"Path {path} is not a child directory of {_rootPath}");
}
}
}
diff --git a/Ryujinx.HLE/FileSystem/IFileSystemProvider.cs b/Ryujinx.HLE/FileSystem/IFileSystemProvider.cs
index 88a630a0..8e2cae64 100644
--- a/Ryujinx.HLE/FileSystem/IFileSystemProvider.cs
+++ b/Ryujinx.HLE/FileSystem/IFileSystemProvider.cs
@@ -1,41 +1,40 @@
using Ryujinx.HLE.HOS;
using Ryujinx.HLE.HOS.Services.FspSrv;
-using System;
namespace Ryujinx.HLE.FileSystem
{
interface IFileSystemProvider
{
- long CreateFile(string Name, long Size);
+ long CreateFile(string name, long size);
- long CreateDirectory(string Name);
+ long CreateDirectory(string name);
- long RenameFile(string OldName, string NewName);
+ long RenameFile(string oldName, string newName);
- long RenameDirectory(string OldName, string NewName);
+ long RenameDirectory(string oldName, string newName);
- DirectoryEntry[] GetEntries(string Path);
+ DirectoryEntry[] GetEntries(string path);
- DirectoryEntry[] GetDirectories(string Path);
+ DirectoryEntry[] GetDirectories(string path);
- DirectoryEntry[] GetFiles(string Path);
+ DirectoryEntry[] GetFiles(string path);
- long DeleteFile(string Name);
+ long DeleteFile(string name);
- long DeleteDirectory(string Name, bool Recursive);
+ long DeleteDirectory(string name, bool recursive);
- bool FileExists(string Name);
+ bool FileExists(string name);
- bool DirectoryExists(string Name);
+ bool DirectoryExists(string name);
- long OpenFile(string Name, out IFile FileInterface);
+ long OpenFile(string name, out IFile fileInterface);
- long OpenDirectory(string Name, int FilterFlags, out IDirectory DirectoryInterface);
+ long OpenDirectory(string name, int filterFlags, out IDirectory directoryInterface);
- string GetFullPath(string Name);
+ string GetFullPath(string name);
- long GetFreeSpace(ServiceCtx Context);
+ long GetFreeSpace(ServiceCtx context);
- long GetTotalSpace(ServiceCtx Context);
+ long GetTotalSpace(ServiceCtx context);
}
}
diff --git a/Ryujinx.HLE/FileSystem/PFsProvider.cs b/Ryujinx.HLE/FileSystem/PFsProvider.cs
index c901f073..71757669 100644
--- a/Ryujinx.HLE/FileSystem/PFsProvider.cs
+++ b/Ryujinx.HLE/FileSystem/PFsProvider.cs
@@ -12,98 +12,98 @@ namespace Ryujinx.HLE.FileSystem
{
class PFsProvider : IFileSystemProvider
{
- private Pfs Pfs;
+ private Pfs _pfs;
- public PFsProvider(Pfs Pfs)
+ public PFsProvider(Pfs pfs)
{
- this.Pfs = Pfs;
+ _pfs = pfs;
}
- public long CreateDirectory(string Name)
+ public long CreateDirectory(string name)
{
throw new NotSupportedException();
}
- public long CreateFile(string Name, long Size)
+ public long CreateFile(string name, long size)
{
throw new NotSupportedException();
}
- public long DeleteDirectory(string Name, bool Recursive)
+ public long DeleteDirectory(string name, bool recursive)
{
throw new NotSupportedException();
}
- public long DeleteFile(string Name)
+ public long DeleteFile(string name)
{
throw new NotSupportedException();
}
- public DirectoryEntry[] GetDirectories(string Path)
+ public DirectoryEntry[] GetDirectories(string path)
{
return new DirectoryEntry[0];
}
- public DirectoryEntry[] GetEntries(string Path)
+ public DirectoryEntry[] GetEntries(string path)
{
- List<DirectoryEntry> Entries = new List<DirectoryEntry>();
+ List<DirectoryEntry> entries = new List<DirectoryEntry>();
- foreach (PfsFileEntry File in Pfs.Files)
+ foreach (PfsFileEntry file in _pfs.Files)
{
- DirectoryEntry DirectoryEntry = new DirectoryEntry(File.Name, DirectoryEntryType.File, File.Size);
+ DirectoryEntry directoryEntry = new DirectoryEntry(file.Name, DirectoryEntryType.File, file.Size);
- Entries.Add(DirectoryEntry);
+ entries.Add(directoryEntry);
}
- return Entries.ToArray();
+ return entries.ToArray();
}
- public DirectoryEntry[] GetFiles(string Path)
+ public DirectoryEntry[] GetFiles(string path)
{
- List<DirectoryEntry> Entries = new List<DirectoryEntry>();
+ List<DirectoryEntry> entries = new List<DirectoryEntry>();
- foreach (PfsFileEntry File in Pfs.Files)
+ foreach (PfsFileEntry file in _pfs.Files)
{
- DirectoryEntry DirectoryEntry = new DirectoryEntry(File.Name, DirectoryEntryType.File, File.Size);
+ DirectoryEntry directoryEntry = new DirectoryEntry(file.Name, DirectoryEntryType.File, file.Size);
- Entries.Add(DirectoryEntry);
+ entries.Add(directoryEntry);
}
- return Entries.ToArray();
+ return entries.ToArray();
}
- public long GetFreeSpace(ServiceCtx Context)
+ public long GetFreeSpace(ServiceCtx context)
{
return 0;
}
- public string GetFullPath(string Name)
+ public string GetFullPath(string name)
{
- return Name;
+ return name;
}
- public long GetTotalSpace(ServiceCtx Context)
+ public long GetTotalSpace(ServiceCtx context)
{
- return Pfs.Files.Sum(x => x.Size);
+ return _pfs.Files.Sum(x => x.Size);
}
- public bool DirectoryExists(string Name)
+ public bool DirectoryExists(string name)
{
- return Name == "/" ? true : false;
+ return name == "/";
}
- public bool FileExists(string Name)
+ public bool FileExists(string name)
{
- Name = Name.TrimStart('/');
+ name = name.TrimStart('/');
- return Pfs.FileExists(Name);
+ return _pfs.FileExists(name);
}
- public long OpenDirectory(string Name, int FilterFlags, out IDirectory DirectoryInterface)
+ public long OpenDirectory(string name, int filterFlags, out IDirectory directoryInterface)
{
- if (Name == "/")
+ if (name == "/")
{
- DirectoryInterface = new IDirectory(Name, FilterFlags, this);
+ directoryInterface = new IDirectory(name, filterFlags, this);
return 0;
}
@@ -111,34 +111,34 @@ namespace Ryujinx.HLE.FileSystem
throw new NotSupportedException();
}
- public long OpenFile(string Name, out IFile FileInterface)
+ public long OpenFile(string name, out IFile fileInterface)
{
- Name = Name.TrimStart('/');
+ name = name.TrimStart('/');
- if (Pfs.FileExists(Name))
+ if (_pfs.FileExists(name))
{
- Stream Stream = Pfs.OpenFile(Name);
- FileInterface = new IFile(Stream, Name);
+ Stream stream = _pfs.OpenFile(name);
+ fileInterface = new IFile(stream, name);
return 0;
}
- FileInterface = null;
+ fileInterface = null;
return MakeError(ErrorModule.Fs, FsErr.PathDoesNotExist);
}
- public long RenameDirectory(string OldName, string NewName)
+ public long RenameDirectory(string oldName, string newName)
{
throw new NotSupportedException();
}
- public long RenameFile(string OldName, string NewName)
+ public long RenameFile(string oldName, string newName)
{
throw new NotSupportedException();
}
- public void CheckIfOutsideBasePath(string Path)
+ public void CheckIfOutsideBasePath(string path)
{
throw new NotSupportedException();
}
diff --git a/Ryujinx.HLE/FileSystem/RomFsProvider.cs b/Ryujinx.HLE/FileSystem/RomFsProvider.cs
index d966d3d7..f6a2f82f 100644
--- a/Ryujinx.HLE/FileSystem/RomFsProvider.cs
+++ b/Ryujinx.HLE/FileSystem/RomFsProvider.cs
@@ -12,150 +12,150 @@ namespace Ryujinx.HLE.FileSystem
{
class RomFsProvider : IFileSystemProvider
{
- private Romfs RomFs;
+ private Romfs _romFs;
- public RomFsProvider(Stream StorageStream)
+ public RomFsProvider(Stream storageStream)
{
- RomFs = new Romfs(StorageStream);
+ _romFs = new Romfs(storageStream);
}
- public long CreateDirectory(string Name)
+ public long CreateDirectory(string name)
{
throw new NotSupportedException();
}
- public long CreateFile(string Name, long Size)
+ public long CreateFile(string name, long size)
{
throw new NotSupportedException();
}
- public long DeleteDirectory(string Name, bool Recursive)
+ public long DeleteDirectory(string name, bool recursive)
{
throw new NotSupportedException();
}
- public long DeleteFile(string Name)
+ public long DeleteFile(string name)
{
throw new NotSupportedException();
}
- public DirectoryEntry[] GetDirectories(string Path)
+ public DirectoryEntry[] GetDirectories(string path)
{
- List<DirectoryEntry> Directories = new List<DirectoryEntry>();
+ List<DirectoryEntry> directories = new List<DirectoryEntry>();
- foreach(RomfsDir Directory in RomFs.Directories)
+ foreach(RomfsDir directory in _romFs.Directories)
{
- DirectoryEntry DirectoryEntry = new DirectoryEntry(Directory.Name, DirectoryEntryType.Directory);
+ DirectoryEntry directoryEntry = new DirectoryEntry(directory.Name, DirectoryEntryType.Directory);
- Directories.Add(DirectoryEntry);
+ directories.Add(directoryEntry);
}
- return Directories.ToArray();
+ return directories.ToArray();
}
- public DirectoryEntry[] GetEntries(string Path)
+ public DirectoryEntry[] GetEntries(string path)
{
- List<DirectoryEntry> Entries = new List<DirectoryEntry>();
+ List<DirectoryEntry> entries = new List<DirectoryEntry>();
- foreach (RomfsDir Directory in RomFs.Directories)
+ foreach (RomfsDir directory in _romFs.Directories)
{
- DirectoryEntry DirectoryEntry = new DirectoryEntry(Directory.Name, DirectoryEntryType.Directory);
+ DirectoryEntry directoryEntry = new DirectoryEntry(directory.Name, DirectoryEntryType.Directory);
- Entries.Add(DirectoryEntry);
+ entries.Add(directoryEntry);
}
- foreach (RomfsFile File in RomFs.Files)
+ foreach (RomfsFile file in _romFs.Files)
{
- DirectoryEntry DirectoryEntry = new DirectoryEntry(File.Name, DirectoryEntryType.File, File.DataLength);
+ DirectoryEntry directoryEntry = new DirectoryEntry(file.Name, DirectoryEntryType.File, file.DataLength);
- Entries.Add(DirectoryEntry);
+ entries.Add(directoryEntry);
}
- return Entries.ToArray();
+ return entries.ToArray();
}
- public DirectoryEntry[] GetFiles(string Path)
+ public DirectoryEntry[] GetFiles(string path)
{
- List<DirectoryEntry> Files = new List<DirectoryEntry>();
+ List<DirectoryEntry> files = new List<DirectoryEntry>();
- foreach (RomfsFile File in RomFs.Files)
+ foreach (RomfsFile file in _romFs.Files)
{
- DirectoryEntry DirectoryEntry = new DirectoryEntry(File.Name, DirectoryEntryType.File, File.DataLength);
+ DirectoryEntry directoryEntry = new DirectoryEntry(file.Name, DirectoryEntryType.File, file.DataLength);
- Files.Add(DirectoryEntry);
+ files.Add(directoryEntry);
}
- return Files.ToArray();
+ return files.ToArray();
}
- public long GetFreeSpace(ServiceCtx Context)
+ public long GetFreeSpace(ServiceCtx context)
{
return 0;
}
- public string GetFullPath(string Name)
+ public string GetFullPath(string name)
{
- return Name;
+ return name;
}
- public long GetTotalSpace(ServiceCtx Context)
+ public long GetTotalSpace(ServiceCtx context)
{
- return RomFs.Files.Sum(x => x.DataLength);
+ return _romFs.Files.Sum(x => x.DataLength);
}
- public bool DirectoryExists(string Name)
+ public bool DirectoryExists(string name)
{
- return RomFs.Directories.Exists(x=>x.Name == Name);
+ return _romFs.Directories.Exists(x=>x.Name == name);
}
- public bool FileExists(string Name)
+ public bool FileExists(string name)
{
- return RomFs.FileExists(Name);
+ return _romFs.FileExists(name);
}
- public long OpenDirectory(string Name, int FilterFlags, out IDirectory DirectoryInterface)
+ public long OpenDirectory(string name, int filterFlags, out IDirectory directoryInterface)
{
- RomfsDir Directory = RomFs.Directories.Find(x => x.Name == Name);
+ RomfsDir directory = _romFs.Directories.Find(x => x.Name == name);
- if (Directory != null)
+ if (directory != null)
{
- DirectoryInterface = new IDirectory(Name, FilterFlags, this);
+ directoryInterface = new IDirectory(name, filterFlags, this);
return 0;
}
- DirectoryInterface = null;
+ directoryInterface = null;
return MakeError(ErrorModule.Fs, FsErr.PathDoesNotExist);
}
- public long OpenFile(string Name, out IFile FileInterface)
+ public long OpenFile(string name, out IFile fileInterface)
{
- if (RomFs.FileExists(Name))
+ if (_romFs.FileExists(name))
{
- Stream Stream = RomFs.OpenFile(Name);
+ Stream stream = _romFs.OpenFile(name);
- FileInterface = new IFile(Stream, Name);
+ fileInterface = new IFile(stream, name);
return 0;
}
- FileInterface = null;
+ fileInterface = null;
return MakeError(ErrorModule.Fs, FsErr.PathDoesNotExist);
}
- public long RenameDirectory(string OldName, string NewName)
+ public long RenameDirectory(string oldName, string newName)
{
throw new NotSupportedException();
}
- public long RenameFile(string OldName, string NewName)
+ public long RenameFile(string oldName, string newName)
{
throw new NotSupportedException();
}
- public void CheckIfOutsideBasePath(string Path)
+ public void CheckIfOutsideBasePath(string path)
{
throw new NotSupportedException();
}
diff --git a/Ryujinx.HLE/FileSystem/SaveHelper.cs b/Ryujinx.HLE/FileSystem/SaveHelper.cs
index 20138c8c..0dfcfd2b 100644
--- a/Ryujinx.HLE/FileSystem/SaveHelper.cs
+++ b/Ryujinx.HLE/FileSystem/SaveHelper.cs
@@ -7,39 +7,39 @@ namespace Ryujinx.HLE.FileSystem
{
static class SaveHelper
{
- public static string GetSavePath(SaveInfo SaveMetaData, ServiceCtx Context)
+ public static string GetSavePath(SaveInfo saveMetaData, ServiceCtx context)
{
- string BaseSavePath = NandPath;
- long CurrentTitleId = SaveMetaData.TitleId;
+ string baseSavePath = NandPath;
+ long currentTitleId = saveMetaData.TitleId;
- switch (SaveMetaData.SaveSpaceId)
+ switch (saveMetaData.SaveSpaceId)
{
case SaveSpaceId.NandUser:
- BaseSavePath = UserNandPath;
+ baseSavePath = UserNandPath;
break;
case SaveSpaceId.NandSystem:
- BaseSavePath = SystemNandPath;
+ baseSavePath = SystemNandPath;
break;
case SaveSpaceId.SdCard:
- BaseSavePath = Path.Combine(SdCardPath, "Nintendo");
+ baseSavePath = Path.Combine(SdCardPath, "Nintendo");
break;
}
- BaseSavePath = Path.Combine(BaseSavePath, "save");
+ baseSavePath = Path.Combine(baseSavePath, "save");
- if (SaveMetaData.TitleId == 0 && SaveMetaData.SaveDataType == SaveDataType.SaveData)
+ if (saveMetaData.TitleId == 0 && saveMetaData.SaveDataType == SaveDataType.SaveData)
{
- CurrentTitleId = Context.Process.TitleId;
+ currentTitleId = context.Process.TitleId;
}
- string SaveAccount = SaveMetaData.UserId.IsZero() ? "savecommon" : SaveMetaData.UserId.ToString();
+ string saveAccount = saveMetaData.UserId.IsZero() ? "savecommon" : saveMetaData.UserId.ToString();
- string SavePath = Path.Combine(BaseSavePath,
- SaveMetaData.SaveId.ToString("x16"),
- SaveAccount,
- SaveMetaData.SaveDataType == SaveDataType.SaveData ? CurrentTitleId.ToString("x16") : string.Empty);
+ string savePath = Path.Combine(baseSavePath,
+ saveMetaData.SaveId.ToString("x16"),
+ saveAccount,
+ saveMetaData.SaveDataType == SaveDataType.SaveData ? currentTitleId.ToString("x16") : string.Empty);
- return SavePath;
+ return savePath;
}
}
}
diff --git a/Ryujinx.HLE/FileSystem/SaveInfo.cs b/Ryujinx.HLE/FileSystem/SaveInfo.cs
index 3acd33fd..a7e7f01a 100644
--- a/Ryujinx.HLE/FileSystem/SaveInfo.cs
+++ b/Ryujinx.HLE/FileSystem/SaveInfo.cs
@@ -4,25 +4,25 @@ namespace Ryujinx.HLE.FileSystem
{
struct SaveInfo
{
- public long TitleId { get; private set; }
- public long SaveId { get; private set; }
- public UInt128 UserId { get; private set; }
+ public long TitleId { get; }
+ public long SaveId { get; }
+ public UInt128 UserId { get; }
- public SaveDataType SaveDataType { get; private set; }
- public SaveSpaceId SaveSpaceId { get; private set; }
+ public SaveDataType SaveDataType { get; }
+ public SaveSpaceId SaveSpaceId { get; }
public SaveInfo(
- long TitleId,
- long SaveId,
- SaveDataType SaveDataType,
- UInt128 UserId,
- SaveSpaceId SaveSpaceId)
+ long titleId,
+ long saveId,
+ SaveDataType saveDataType,
+ UInt128 userId,
+ SaveSpaceId saveSpaceId)
{
- this.TitleId = TitleId;
- this.UserId = UserId;
- this.SaveId = SaveId;
- this.SaveDataType = SaveDataType;
- this.SaveSpaceId = SaveSpaceId;
+ TitleId = titleId;
+ UserId = userId;
+ SaveId = saveId;
+ SaveDataType = saveDataType;
+ SaveSpaceId = saveSpaceId;
}
}
}
diff --git a/Ryujinx.HLE/FileSystem/VirtualFileSystem.cs b/Ryujinx.HLE/FileSystem/VirtualFileSystem.cs
index bde6f69f..eed5953f 100644
--- a/Ryujinx.HLE/FileSystem/VirtualFileSystem.cs
+++ b/Ryujinx.HLE/FileSystem/VirtualFileSystem.cs
@@ -18,40 +18,40 @@ namespace Ryujinx.HLE.FileSystem
public Stream RomFs { get; private set; }
- public void LoadRomFs(string FileName)
+ public void LoadRomFs(string fileName)
{
- RomFs = new FileStream(FileName, FileMode.Open, FileAccess.Read);
+ RomFs = new FileStream(fileName, FileMode.Open, FileAccess.Read);
}
- public void SetRomFs(Stream RomfsStream)
+ public void SetRomFs(Stream romfsStream)
{
RomFs?.Close();
- RomFs = RomfsStream;
+ RomFs = romfsStream;
}
- public string GetFullPath(string BasePath, string FileName)
+ public string GetFullPath(string basePath, string fileName)
{
- if (FileName.StartsWith("//"))
+ if (fileName.StartsWith("//"))
{
- FileName = FileName.Substring(2);
+ fileName = fileName.Substring(2);
}
- else if (FileName.StartsWith('/'))
+ else if (fileName.StartsWith('/'))
{
- FileName = FileName.Substring(1);
+ fileName = fileName.Substring(1);
}
else
{
return null;
}
- string FullPath = Path.GetFullPath(Path.Combine(BasePath, FileName));
+ string fullPath = Path.GetFullPath(Path.Combine(basePath, fileName));
- if (!FullPath.StartsWith(GetBasePath()))
+ if (!fullPath.StartsWith(GetBasePath()))
{
return null;
}
- return FullPath;
+ return fullPath;
}
public string GetSdCardPath() => MakeDirAndGetFullPath(SdCardPath);
@@ -60,84 +60,84 @@ namespace Ryujinx.HLE.FileSystem
public string GetSystemPath() => MakeDirAndGetFullPath(SystemPath);
- public string GetGameSavePath(SaveInfo Save, ServiceCtx Context)
+ public string GetGameSavePath(SaveInfo save, ServiceCtx context)
{
- return MakeDirAndGetFullPath(SaveHelper.GetSavePath(Save, Context));
+ return MakeDirAndGetFullPath(SaveHelper.GetSavePath(save, context));
}
- public string GetFullPartitionPath(string PartitionPath)
+ public string GetFullPartitionPath(string partitionPath)
{
- return MakeDirAndGetFullPath(PartitionPath);
+ return MakeDirAndGetFullPath(partitionPath);
}
- public string SwitchPathToSystemPath(string SwitchPath)
+ public string SwitchPathToSystemPath(string switchPath)
{
- string[] Parts = SwitchPath.Split(":");
+ string[] parts = switchPath.Split(":");
- if (Parts.Length != 2)
+ if (parts.Length != 2)
{
return null;
}
- return GetFullPath(MakeDirAndGetFullPath(Parts[0]), Parts[1]);
+ return GetFullPath(MakeDirAndGetFullPath(parts[0]), parts[1]);
}
- public string SystemPathToSwitchPath(string SystemPath)
+ public string SystemPathToSwitchPath(string systemPath)
{
- string BaseSystemPath = GetBasePath() + Path.DirectorySeparatorChar;
+ string baseSystemPath = GetBasePath() + Path.DirectorySeparatorChar;
- if (SystemPath.StartsWith(BaseSystemPath))
+ if (systemPath.StartsWith(baseSystemPath))
{
- string RawPath = SystemPath.Replace(BaseSystemPath, "");
- int FirstSeparatorOffset = RawPath.IndexOf(Path.DirectorySeparatorChar);
+ string rawPath = systemPath.Replace(baseSystemPath, "");
+ int firstSeparatorOffset = rawPath.IndexOf(Path.DirectorySeparatorChar);
- if (FirstSeparatorOffset == -1)
+ if (firstSeparatorOffset == -1)
{
- return $"{RawPath}:/";
+ return $"{rawPath}:/";
}
- string BasePath = RawPath.Substring(0, FirstSeparatorOffset);
- string FileName = RawPath.Substring(FirstSeparatorOffset + 1);
+ string basePath = rawPath.Substring(0, firstSeparatorOffset);
+ string fileName = rawPath.Substring(firstSeparatorOffset + 1);
- return $"{BasePath}:/{FileName}";
+ return $"{basePath}:/{fileName}";
}
return null;
}
- private string MakeDirAndGetFullPath(string Dir)
+ private string MakeDirAndGetFullPath(string dir)
{
// Handles Common Switch Content Paths
- switch (Dir)
+ switch (dir)
{
case ContentPath.SdCard:
case "@Sdcard":
- Dir = SdCardPath;
+ dir = SdCardPath;
break;
case ContentPath.User:
- Dir = UserNandPath;
+ dir = UserNandPath;
break;
case ContentPath.System:
- Dir = SystemNandPath;
+ dir = SystemNandPath;
break;
case ContentPath.SdCardContent:
- Dir = Path.Combine(SdCardPath, "Nintendo", "Contents");
+ dir = Path.Combine(SdCardPath, "Nintendo", "Contents");
break;
case ContentPath.UserContent:
- Dir = Path.Combine(UserNandPath, "Contents");
+ dir = Path.Combine(UserNandPath, "Contents");
break;
case ContentPath.SystemContent:
- Dir = Path.Combine(SystemNandPath, "Contents");
+ dir = Path.Combine(SystemNandPath, "Contents");
break;
}
- string FullPath = Path.Combine(GetBasePath(), Dir);
+ string fullPath = Path.Combine(GetBasePath(), dir);
- if (!Directory.Exists(FullPath))
+ if (!Directory.Exists(fullPath))
{
- Directory.CreateDirectory(FullPath);
+ Directory.CreateDirectory(fullPath);
}
- return FullPath;
+ return fullPath;
}
public DriveInfo GetDrive()
@@ -147,9 +147,9 @@ namespace Ryujinx.HLE.FileSystem
public string GetBasePath()
{
- string AppDataPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
+ string appDataPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
- return Path.Combine(AppDataPath, BasePath);
+ return Path.Combine(appDataPath, BasePath);
}
public void Dispose()