Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ GetPlayerPathFromName()

static string Terraria.Main.GetPlayerPathFromName ( string playerName,
bool cloudSave )
inlinestatic

Definition at line 4461 of file Main.cs.

4462 {
4464 string text = "";
4465 playerName = playerName.Replace(".", "_");
4466 playerName = playerName.Replace("*", "_");
4467 foreach (char c in playerName)
4468 {
4469 text += ((!invalidFileNameChars.Contains(c)) ? ((c != ' ') ? c : '_') : '-');
4470 }
4472 if (FileUtilities.GetFullPath(text2 + Path.DirectorySeparatorChar + text + ".plr", cloudSave).StartsWith("\\\\.\\", StringComparison.Ordinal))
4473 {
4474 text += "_";
4475 }
4477 {
4478 int num = 2;
4479 while (FileUtilities.Exists(text2 + Path.DirectorySeparatorChar.ToString() + text + num + ".plr", cloudSave))
4480 {
4481 num++;
4482 }
4483 text += num;
4484 }
4485 return text2 + Path.DirectorySeparatorChar + text + ".plr";
4486 }
bool ICollection< KeyValuePair< TKey, TValue > >. Contains(KeyValuePair< TKey, TValue > keyValuePair)
static char[] GetInvalidFileNameChars()
Definition Path.cs:858
static readonly char DirectorySeparatorChar
Definition Path.cs:71
static string PlayerPath
Definition Main.cs:1952
static string CloudPlayerPath
Definition Main.cs:1954
static bool Exists(string path, bool cloud)
static string GetFullPath(string path, bool cloud)

References Terraria.Main.CloudPlayerPath, System.Collections.Generic.Dictionary< TKey, TValue >.Contains(), System.IO.Path.DirectorySeparatorChar, Terraria.Utilities.FileUtilities.Exists(), Terraria.Utilities.FileUtilities.GetFullPath(), System.IO.Path.GetInvalidFileNameChars(), Terraria.Main.PlayerPath, and System.text.

Referenced by Terraria.IO.PlayerFileData.CreateAndSave(), Terraria.IO.PlayerFileData.MoveToCloud(), and Terraria.IO.PlayerFileData.MoveToLocal().