public static void CreateShortcut(string page, string accId, string accName, string args = "") { Globals.DebugWriteLine(@"[JSInvoke:General\GeneralInvocableFuncs.CreateShortcut]"); var platform = page; page = page.ToLowerInvariant(); if (args.Length > 0 && args[0] != ':') { args = $" {args}"; // Add a space before arguments if doesn't start with ':' } var platformName = $"Switch to {accName} [{platform}]"; var originalAccId = accId; var primaryPlatformId = "" + page[0]; var bgImg = Path.Join(GeneralFuncs.WwwRoot(), $"\\img\\platform\\{page}.png"); switch (page) { case "steam": { var ePersonaState = -1; if (args.Length == 2) { _ = int.TryParse(args[1].ToString(), out ePersonaState); } platformName = $"Switch to {accName} {(args.Length > 0 ? $"({SteamSwitcherFuncs.PersonaStateToString(ePersonaState)})" : "")} [{platform}]"; break; } case "basic": page = CurrentPlatform.SafeName; primaryPlatformId = CurrentPlatform.PrimaryId; platform = CurrentPlatform.FullName; platformName = $"Switch to {accName} [{platform}]"; var platformImgPath = "\\img\\platform\\" + CurrentPlatform.SafeName + ".png"; var currentPlatformImgPath = Path.Join(GeneralFuncs.WwwRoot(), platformImgPath); bgImg = File.Exists(currentPlatformImgPath) ? Path.Join(currentPlatformImgPath) : Path.Join(GeneralFuncs.WwwRoot(), "\\img\\BasicDefault.png"); break; } var fgImg = Path.Join(GeneralFuncs.WwwRoot(), $"\\img\\profiles\\{page}\\{accId}.jpg"); if (!File.Exists(fgImg)) { fgImg = Path.Join(GeneralFuncs.WwwRoot(), $"\\img\\profiles\\{page}\\{accId}.png"); } if (!File.Exists(fgImg)) { _ = ShowToast("error", Lang["Toast_CantFindImage"], Lang["Toast_CantCreateShortcut"], "toastarea"); return; } var s = new Shortcut(); _ = s.Shortcut_Platform( Shortcut.Desktop, platformName, $"+{primaryPlatformId}:{originalAccId}{args}", $"Switch to {accName} [{platform}] in TcNo Account Switcher", true); s.CreateCombinedIcon(bgImg, fgImg, $"{accId}.ico"); s.TryWrite(); _ = AppSettings.StreamerModeTriggered ? ShowToast("success", Lang["Toast_ShortcutCreated"], Lang["Success"], "toastarea") : ShowToast("success", Lang["ForName", new { name = accName }], Lang["Toast_ShortcutCreated"], "toastarea"); }