public static void Save(string account, string server, string name) { LastCharacterInfo lastChar = LastCharacters.FirstOrDefault(c => c.AccountName.Equals(account) && c.ServerName == server); // Check to see if they passed in -lastcharactername but picked another character, clear override then if (!string.IsNullOrEmpty(LastCharacterNameOverride) && !LastCharacterNameOverride.Equals(name)) { LastCharacterNameOverride = string.Empty; } if (lastChar != null) { lastChar.LastCharacterName = name; } else { LastCharacters.Add(new LastCharacterInfo { ServerName = server, LastCharacterName = name, AccountName = account }); } ConfigurationResolver.Save(LastCharacters, _lastCharacterFile); }
public static string GetLastCharacter(string account, string server) { if (LastCharacters == null) { Load(); } // If they passed in a -lastcharactername param, ignore json value, use that value instead if (!string.IsNullOrEmpty(LastCharacterNameOverride)) { return(LastCharacterNameOverride); } LastCharacterInfo lastChar = LastCharacters.FirstOrDefault(c => c.AccountName.Equals(account) && c.ServerName == server); return(lastChar != null ? lastChar.LastCharacterName : string.Empty); }