From 85dbb9559ad317a657dafd24da27fec4b3f5250f Mon Sep 17 00:00:00 2001 From: Alex Barney Date: Tue, 4 Dec 2018 14:23:37 -0600 Subject: 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 --- Ryujinx.HLE/HOS/SystemState/SystemStateMgr.cs | 60 +++++++++++++-------------- 1 file changed, 30 insertions(+), 30 deletions(-) (limited to 'Ryujinx.HLE/HOS/SystemState/SystemStateMgr.cs') diff --git a/Ryujinx.HLE/HOS/SystemState/SystemStateMgr.cs b/Ryujinx.HLE/HOS/SystemState/SystemStateMgr.cs index aa96a416..74513795 100644 --- a/Ryujinx.HLE/HOS/SystemState/SystemStateMgr.cs +++ b/Ryujinx.HLE/HOS/SystemState/SystemStateMgr.cs @@ -48,7 +48,7 @@ namespace Ryujinx.HLE.HOS.SystemState public bool InstallContents { get; set; } - private ConcurrentDictionary Profiles; + private ConcurrentDictionary _profiles; internal UserProfile LastOpenUser { get; private set; } @@ -58,20 +58,20 @@ namespace Ryujinx.HLE.HOS.SystemState SetAudioOutputAsBuiltInSpeaker(); - Profiles = new ConcurrentDictionary(); + _profiles = new ConcurrentDictionary(); - UInt128 DefaultUuid = new UInt128("00000000000000000000000000000001"); + UInt128 defaultUuid = new UInt128("00000000000000000000000000000001"); - AddUser(DefaultUuid, "Player"); + AddUser(defaultUuid, "Player"); - OpenUser(DefaultUuid); + OpenUser(defaultUuid); } - public void SetLanguage(SystemLanguage Language) + public void SetLanguage(SystemLanguage language) { - DesiredLanguageCode = GetLanguageCode((int)Language); + DesiredLanguageCode = GetLanguageCode((int)language); - DesiredTitleLanguage = Enum.Parse(Enum.GetName(typeof(SystemLanguage), Language)); + DesiredTitleLanguage = Enum.Parse(Enum.GetName(typeof(SystemLanguage), language)); } public void SetAudioOutputAsTv() @@ -89,65 +89,65 @@ namespace Ryujinx.HLE.HOS.SystemState ActiveAudioOutput = AudioOutputs[2]; } - public void AddUser(UInt128 Uuid, string Name) + public void AddUser(UInt128 uuid, string name) { - UserProfile Profile = new UserProfile(Uuid, Name); + UserProfile profile = new UserProfile(uuid, name); - Profiles.AddOrUpdate(Uuid.ToString(), Profile, (Key, Old) => Profile); + _profiles.AddOrUpdate(uuid.ToString(), profile, (key, old) => profile); } - public void OpenUser(UInt128 Uuid) + public void OpenUser(UInt128 uuid) { - if (Profiles.TryGetValue(Uuid.ToString(), out UserProfile Profile)) + if (_profiles.TryGetValue(uuid.ToString(), out UserProfile profile)) { - (LastOpenUser = Profile).AccountState = OpenCloseState.Open; + (LastOpenUser = profile).AccountState = OpenCloseState.Open; } } - public void CloseUser(UInt128 Uuid) + public void CloseUser(UInt128 uuid) { - if (Profiles.TryGetValue(Uuid.ToString(), out UserProfile Profile)) + if (_profiles.TryGetValue(uuid.ToString(), out UserProfile profile)) { - Profile.AccountState = OpenCloseState.Closed; + profile.AccountState = OpenCloseState.Closed; } } public int GetUserCount() { - return Profiles.Count; + return _profiles.Count; } - internal bool TryGetUser(UInt128 Uuid, out UserProfile Profile) + internal bool TryGetUser(UInt128 uuid, out UserProfile profile) { - return Profiles.TryGetValue(Uuid.ToString(), out Profile); + return _profiles.TryGetValue(uuid.ToString(), out profile); } internal IEnumerable GetAllUsers() { - return Profiles.Values; + return _profiles.Values; } internal IEnumerable GetOpenUsers() { - return Profiles.Values.Where(x => x.AccountState == OpenCloseState.Open); + return _profiles.Values.Where(x => x.AccountState == OpenCloseState.Open); } - internal static long GetLanguageCode(int Index) + internal static long GetLanguageCode(int index) { - if ((uint)Index >= LanguageCodes.Length) + if ((uint)index >= LanguageCodes.Length) { - throw new ArgumentOutOfRangeException(nameof(Index)); + throw new ArgumentOutOfRangeException(nameof(index)); } - long Code = 0; - int Shift = 0; + long code = 0; + int shift = 0; - foreach (char Chr in LanguageCodes[Index]) + foreach (char chr in LanguageCodes[index]) { - Code |= (long)(byte)Chr << Shift++ * 8; + code |= (long)(byte)chr << shift++ * 8; } - return Code; + return code; } } } -- cgit v1.2.3