diff options
author | Alex Barney <thealexbarney@gmail.com> | 2018-12-04 14:23:37 -0600 |
---|---|---|
committer | gdkchan <gab.dark.100@gmail.com> | 2018-12-04 18:23:37 -0200 |
commit | 85dbb9559ad317a657dafd24da27fec4b3f5250f (patch) | |
tree | ecd92931bc2146e549484d9a3af308469089ad4e /Ryujinx.HLE/Utilities/StringUtils.cs | |
parent | c86aacde76b5f8e503e2b412385c8491ecc86b3b (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/Utilities/StringUtils.cs')
-rw-r--r-- | Ryujinx.HLE/Utilities/StringUtils.cs | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/Ryujinx.HLE/Utilities/StringUtils.cs b/Ryujinx.HLE/Utilities/StringUtils.cs index a10273ee..e6602f48 100644 --- a/Ryujinx.HLE/Utilities/StringUtils.cs +++ b/Ryujinx.HLE/Utilities/StringUtils.cs @@ -9,67 +9,67 @@ namespace Ryujinx.HLE.Utilities { static class StringUtils { - public static byte[] GetFixedLengthBytes(string InputString, int Size, Encoding Encoding) + public static byte[] GetFixedLengthBytes(string inputString, int size, Encoding encoding) { - InputString = InputString + "\0"; + inputString = inputString + "\0"; - int BytesCount = Encoding.GetByteCount(InputString); + int bytesCount = encoding.GetByteCount(inputString); - byte[] Output = new byte[Size]; + byte[] output = new byte[size]; - if (BytesCount < Size) + if (bytesCount < size) { - Encoding.GetBytes(InputString, 0, InputString.Length, Output, 0); + encoding.GetBytes(inputString, 0, inputString.Length, output, 0); } else { - int NullSize = Encoding.GetByteCount("\0"); + int nullSize = encoding.GetByteCount("\0"); - Output = Encoding.GetBytes(InputString); + output = encoding.GetBytes(inputString); - Array.Resize(ref Output, Size - NullSize); + Array.Resize(ref output, size - nullSize); - Output = Output.Concat(Encoding.GetBytes("\0")).ToArray(); + output = output.Concat(encoding.GetBytes("\0")).ToArray(); } - return Output; + return output; } - public static byte[] HexToBytes(string HexString) + public static byte[] HexToBytes(string hexString) { //Ignore last charactor if HexLength % 2 != 0. - int BytesInHex = HexString.Length / 2; + int bytesInHex = hexString.Length / 2; - byte[] Output = new byte[BytesInHex]; + byte[] output = new byte[bytesInHex]; - for (int Index = 0; Index < BytesInHex; Index++) + for (int index = 0; index < bytesInHex; index++) { - Output[Index] = byte.Parse(HexString.Substring(Index * 2, 2), NumberStyles.HexNumber); + output[index] = byte.Parse(hexString.Substring(index * 2, 2), NumberStyles.HexNumber); } - return Output; + return output; } - public static string ReadUtf8String(ServiceCtx Context, int Index = 0) + public static string ReadUtf8String(ServiceCtx context, int index = 0) { - long Position = Context.Request.PtrBuff[Index].Position; - long Size = Context.Request.PtrBuff[Index].Size; + long position = context.Request.PtrBuff[index].Position; + long size = context.Request.PtrBuff[index].Size; - using (MemoryStream MS = new MemoryStream()) + using (MemoryStream ms = new MemoryStream()) { - while (Size-- > 0) + while (size-- > 0) { - byte Value = Context.Memory.ReadByte(Position++); + byte value = context.Memory.ReadByte(position++); - if (Value == 0) + if (value == 0) { break; } - MS.WriteByte(Value); + ms.WriteByte(value); } - return Encoding.UTF8.GetString(MS.ToArray()); + return Encoding.UTF8.GetString(ms.ToArray()); } } } |