public void Remove(ServerData server) { CharacterHost charToIP = FindServer(server); if (charToIP != null) { AllHosts.Remove(charToIP); SaveChanges(); } }
private void SetAllHosts(RichTextBox RTB_Input) { char[] delimiterChars = { ' ', ',', '.', '\t', '\n', '-', ':' }; string text = RTB_Input.Text; string[] words = text.Split(delimiterChars); int count = 0; foreach (var x in words) { AllHosts.Add(Convert.ToUInt64(words[count])); count++; } }
// replaced with AddJoinIP //public void SetJoinIP(string currentIP) //{ // SGGValheimMod.Log("Setting Join IP for : " + Character + " to " + currentIP); // List<CharacterHost> characterToIPList = AllHosts; // CharacterHost charToIP = characterToIPList.Find(x => x.Character == Character && x.ServerType == ServerTypes.JoinIP); //if we find the character and server type, set their last IP. // if (charToIP != null) // { // charToIP.IPHost = currentIP; // } // else // { // no character found, add them to the list of characters. // charToIP = new CharacterHost() { Character = Character, IPHost = currentIP, ServerType = ServerTypes.JoinIP }; // characterToIPList.Add(charToIP); // } // CurrentSelected = charToIP; // SaveChanges(); //} public void AddJoinIP(string currentIP) { SGGValheimMod.Log("Setting Join IP for : " + Character + " to " + currentIP); CharacterHost charToIP = FindServer(currentIP); if (charToIP != null) //already exists, no need to resave { CurrentSelected = charToIP; return; } charToIP = new CharacterHost() { Character = Character, IPHost = currentIP, ServerType = ServerTypes.JoinIP }; AllHosts.Add(charToIP); CurrentSelected = charToIP; SaveChanges(); }
public void AddFavorite(ServerData server) { //first check to see if it already exists. if so, update it CharacterHost charToIP = FindServer(server);// Current.Find(x => x.ServerName == server.m_name); if (charToIP == null) { charToIP = new CharacterHost(); AllHosts.Add(charToIP); } charToIP.Character = Character; charToIP.ServerName = server.m_name; charToIP.ServerType = ServerTypes.Community; charToIP.SteamHostID = server.m_steamHostID; charToIP.SteamHostAddr = server.m_steamHostAddr; charToIP.RequirePassword = server.m_password; SaveChanges(); }