aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.HLE/HOS/Services/FspSrv/IDirectory.cs
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/HOS/Services/FspSrv/IDirectory.cs
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/HOS/Services/FspSrv/IDirectory.cs')
-rw-r--r--Ryujinx.HLE/HOS/Services/FspSrv/IDirectory.cs70
1 files changed, 35 insertions, 35 deletions
diff --git a/Ryujinx.HLE/HOS/Services/FspSrv/IDirectory.cs b/Ryujinx.HLE/HOS/Services/FspSrv/IDirectory.cs
index c964eecb..e5dcd8b1 100644
--- a/Ryujinx.HLE/HOS/Services/FspSrv/IDirectory.cs
+++ b/Ryujinx.HLE/HOS/Services/FspSrv/IDirectory.cs
@@ -11,88 +11,88 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv
{
private const int DirectoryEntrySize = 0x310;
- private Dictionary<int, ServiceProcessRequest> m_Commands;
+ private Dictionary<int, ServiceProcessRequest> _commands;
- public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
+ public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => _commands;
- private List<DirectoryEntry> DirectoryEntries;
+ private List<DirectoryEntry> _directoryEntries;
- private int CurrentItemIndex;
+ private int _currentItemIndex;
public event EventHandler<EventArgs> Disposed;
- public string DirectoryPath { get; private set; }
+ public string DirectoryPath { get; }
- private IFileSystemProvider Provider;
+ private IFileSystemProvider _provider;
- public IDirectory(string DirectoryPath, int Flags, IFileSystemProvider Provider)
+ public IDirectory(string directoryPath, int flags, IFileSystemProvider provider)
{
- m_Commands = new Dictionary<int, ServiceProcessRequest>()
+ _commands = new Dictionary<int, ServiceProcessRequest>
{
{ 0, Read },
{ 1, GetEntryCount }
};
- this.Provider = Provider;
- this.DirectoryPath = DirectoryPath;
+ _provider = provider;
+ DirectoryPath = directoryPath;
- DirectoryEntries = new List<DirectoryEntry>();
+ _directoryEntries = new List<DirectoryEntry>();
- if ((Flags & 1) != 0)
+ if ((flags & 1) != 0)
{
- DirectoryEntries.AddRange(Provider.GetDirectories(DirectoryPath));
+ _directoryEntries.AddRange(provider.GetDirectories(directoryPath));
}
- if ((Flags & 2) != 0)
+ if ((flags & 2) != 0)
{
- DirectoryEntries.AddRange(Provider.GetFiles(DirectoryPath));
+ _directoryEntries.AddRange(provider.GetFiles(directoryPath));
}
- CurrentItemIndex = 0;
+ _currentItemIndex = 0;
}
// Read() -> (u64 count, buffer<nn::fssrv::sf::IDirectoryEntry, 6, 0> entries)
- public long Read(ServiceCtx Context)
+ public long Read(ServiceCtx context)
{
- long BufferPosition = Context.Request.ReceiveBuff[0].Position;
- long BufferLen = Context.Request.ReceiveBuff[0].Size;
+ long bufferPosition = context.Request.ReceiveBuff[0].Position;
+ long bufferLen = context.Request.ReceiveBuff[0].Size;
- int MaxReadCount = (int)(BufferLen / DirectoryEntrySize);
+ int maxReadCount = (int)(bufferLen / DirectoryEntrySize);
- int Count = Math.Min(DirectoryEntries.Count - CurrentItemIndex, MaxReadCount);
+ int count = Math.Min(_directoryEntries.Count - _currentItemIndex, maxReadCount);
- for (int Index = 0; Index < Count; Index++)
+ for (int index = 0; index < count; index++)
{
- long Position = BufferPosition + Index * DirectoryEntrySize;
+ long position = bufferPosition + index * DirectoryEntrySize;
- WriteDirectoryEntry(Context, Position, DirectoryEntries[CurrentItemIndex++]);
+ WriteDirectoryEntry(context, position, _directoryEntries[_currentItemIndex++]);
}
- Context.ResponseData.Write((long)Count);
+ context.ResponseData.Write((long)count);
return 0;
}
- private void WriteDirectoryEntry(ServiceCtx Context, long Position, DirectoryEntry Entry)
+ private void WriteDirectoryEntry(ServiceCtx context, long position, DirectoryEntry entry)
{
- for (int Offset = 0; Offset < 0x300; Offset += 8)
+ for (int offset = 0; offset < 0x300; offset += 8)
{
- Context.Memory.WriteInt64(Position + Offset, 0);
+ context.Memory.WriteInt64(position + offset, 0);
}
- byte[] NameBuffer = Encoding.UTF8.GetBytes(Path.GetFileName(Entry.Path));
+ byte[] nameBuffer = Encoding.UTF8.GetBytes(Path.GetFileName(entry.Path));
- Context.Memory.WriteBytes(Position, NameBuffer);
+ context.Memory.WriteBytes(position, nameBuffer);
- Context.Memory.WriteInt32(Position + 0x300, 0); //Padding?
- Context.Memory.WriteInt32(Position + 0x304, (byte)Entry.EntryType);
- Context.Memory.WriteInt64(Position + 0x308, Entry.Size);
+ context.Memory.WriteInt32(position + 0x300, 0); //Padding?
+ context.Memory.WriteInt32(position + 0x304, (byte)entry.EntryType);
+ context.Memory.WriteInt64(position + 0x308, entry.Size);
}
// GetEntryCount() -> u64
- public long GetEntryCount(ServiceCtx Context)
+ public long GetEntryCount(ServiceCtx context)
{
- Context.ResponseData.Write((long)DirectoryEntries.Count);
+ context.ResponseData.Write((long)_directoryEntries.Count);
return 0;
}