private static string RandomSplash() { string[] splashes = File.ReadAllLines(GlobalPaths.ConfigDir + "\\splashes.txt"); string splash = ""; try { splash = splashes[new CryptoRandom().Next(0, splashes.Length - 1)]; } catch (Exception) { try { splash = splashes[0]; } catch (Exception) { splash = "missingno"; return(splash); } } CryptoRandom random = new CryptoRandom(); string formattedsplash = splash .Replace("%name%", GlobalVars.UserConfiguration.PlayerName) .Replace("%randomtext%", SecurityFuncs.RandomString(random.Next(2, 32))); return(formattedsplash); }
public static string DecodeSplashString(string text) { CryptoRandom random = new CryptoRandom(); DateTime now = DateTime.Now; return(text.Replace("%name%", GlobalVars.UserConfiguration.PlayerName) .Replace("%randomtext%", SecurityFuncs.RandomString(random.Next(2, (GlobalVars.UserConfiguration.LauncherStyle == Settings.Style.Stylish ? 64 : 32)))) .Replace("%version%", GlobalVars.ProgramInformation.Version) .Replace("%year%", now.Year.ToString()) .Replace("%day%", now.Day.ToString()) .Replace("%month%", now.Month.ToString()) .Replace("%nextyear%", (now.Year + 1).ToString()) .Replace("%newline%", "\n") .Replace("%branch%", GlobalVars.ProgramInformation.Branch) .Replace("%nextbranch%", (Convert.ToDouble(GlobalVars.ProgramInformation.Branch) + 0.1).ToString()) .Replace("[normal]", "") .Replace("[stylish]", "")); }