Commit 04ad3005 authored by mercury233's avatar mercury233

don't save recent host when joining from command line

parent 80bf187a
Pipeline #41790 passed with stages
in 15 minutes and 31 seconds
...@@ -445,7 +445,7 @@ public class Program : MonoBehaviour ...@@ -445,7 +445,7 @@ public class Program : MonoBehaviour
if (join) if (join)
{ {
shiftToServant(selectServer); shiftToServant(selectServer);
selectServer.KF_onlineGame(nick, host, port, "0x233", password); selectServer.KF_onlineGame(nick, host, port, "0x233", password, false);
exitOnReturn = true; exitOnReturn = true;
} }
else if (deck != null) else if (deck != null)
......
...@@ -116,7 +116,7 @@ public class SelectServer : WindowServantSP ...@@ -116,7 +116,7 @@ public class SelectServer : WindowServantSP
} }
public void KF_onlineGame(string Name, string ipString, string portString, string versionString, public void KF_onlineGame(string Name, string ipString, string portString, string versionString,
string pswString = "") string pswString = "", bool savetoList = true)
{ {
name = Name; name = Name;
Config.Set("name", name); Config.Set("name", name);
...@@ -128,15 +128,18 @@ public class SelectServer : WindowServantSP ...@@ -128,15 +128,18 @@ public class SelectServer : WindowServantSP
{ {
if (name != "") if (name != "")
{ {
var fantasty = ipString + ":" + portString + " " + pswString; if (savetoList)
list.items.Remove(fantasty); {
list.items.Insert(0, fantasty); var fantasty = ipString + ":" + portString + " " + pswString;
list.value = fantasty; list.items.Remove(fantasty);
if (list.items.Count > 5) list.items.RemoveAt(list.items.Count - 1); list.items.Insert(0, fantasty);
var all = ""; list.value = fantasty;
for (var i = 0; i < list.items.Count; i++) all += list.items[i] + "\r\n"; if (list.items.Count > 5) list.items.RemoveAt(list.items.Count - 1);
File.WriteAllText("config/hosts.conf", all); var all = "";
printFile(false); for (var i = 0; i < list.items.Count; i++) all += list.items[i] + "\r\n";
File.WriteAllText("config/hosts.conf", all);
printFile(false);
}
new Thread(() => { TcpHelper.join(ipString, name, portString, pswString, versionString); }).Start(); new Thread(() => { TcpHelper.join(ipString, name, portString, pswString, versionString); }).Start();
} }
else else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment