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
This commit is contained in:
Alex Barney 2018-12-04 14:23:37 -06:00 committed by gdkchan
parent c86aacde76
commit 85dbb9559a
299 changed files with 12268 additions and 12276 deletions

View file

@ -48,7 +48,7 @@ namespace Ryujinx.HLE.HOS.SystemState
public bool InstallContents { get; set; }
private ConcurrentDictionary<string, UserProfile> Profiles;
private ConcurrentDictionary<string, UserProfile> _profiles;
internal UserProfile LastOpenUser { get; private set; }
@ -58,20 +58,20 @@ namespace Ryujinx.HLE.HOS.SystemState
SetAudioOutputAsBuiltInSpeaker();
Profiles = new ConcurrentDictionary<string, UserProfile>();
_profiles = new ConcurrentDictionary<string, UserProfile>();
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<TitleLanguage>(Enum.GetName(typeof(SystemLanguage), Language));
DesiredTitleLanguage = Enum.Parse<TitleLanguage>(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<UserProfile> GetAllUsers()
{
return Profiles.Values;
return _profiles.Values;
}
internal IEnumerable<UserProfile> 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;
}
}
}