Username in window title using %username%

- No window title is set if 'consoletitle' setting is not set
- Lowercase %username% will be replaced by the user's name
This commit is contained in:
ORelio 2014-01-17 19:54:10 +01:00
parent ed3079091b
commit a627842bed
2 changed files with 10 additions and 4 deletions

View file

@ -147,7 +147,10 @@ namespace MinecraftClient
} }
else Settings.WriteDefaultSettings("MinecraftClient.ini"); else Settings.WriteDefaultSettings("MinecraftClient.ini");
Console.Title = Settings.ConsoleTitle; if (Settings.ConsoleTitle != "")
{
Console.Title = Settings.ConsoleTitle.Replace("%username%", "New Window");
}
//Asking the user to type in missing data such as Username and Password //Asking the user to type in missing data such as Username and Password
@ -200,7 +203,10 @@ namespace MinecraftClient
} }
if (result == MinecraftCom.LoginResult.Success) if (result == MinecraftCom.LoginResult.Success)
{ {
Console.Title = Settings.ConsoleTitle + " - " + Settings.Username; if (Settings.ConsoleTitle != "")
{
Console.Title = Settings.ConsoleTitle.Replace("%username%", Settings.Username);
}
Console.WriteLine("Success. (session ID: " + sessionID + ')'); Console.WriteLine("Success. (session ID: " + sessionID + ')');
if (Settings.ServerIP == "") if (Settings.ServerIP == "")

View file

@ -21,7 +21,7 @@ namespace MinecraftClient
public static string Password = ""; public static string Password = "";
public static string ServerIP = ""; public static string ServerIP = "";
public static string SingleCommand = ""; public static string SingleCommand = "";
public static string ConsoleTitle = "Minecraft Console Client"; public static string ConsoleTitle = "";
//Other Settings //Other Settings
public static string TranslationsFile_FromMCDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\.minecraft\assets\virtual\legacy\lang\en_GB.lang"; public static string TranslationsFile_FromMCDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\.minecraft\assets\virtual\legacy\lang\en_GB.lang";
@ -214,7 +214,7 @@ namespace MinecraftClient
+ "\r\n" + "\r\n"
+ "translationsfile=translations.lang\r\n" + "translationsfile=translations.lang\r\n"
+ "botownersfile=bot-owners.txt\r\n" + "botownersfile=bot-owners.txt\r\n"
+ "consoletitle=Minecraft Console Client\r\n" + "consoletitle=Minecraft Console Client - %username%\r\n"
+ "\r\n" + "\r\n"
+ "#Bot Settings\r\n" + "#Bot Settings\r\n"
+ "\r\n" + "\r\n"