diff --git a/VPet-Simulator.Windows/MainWindow.xaml.cs b/VPet-Simulator.Windows/MainWindow.xaml.cs index e8bb47e..7103515 100644 --- a/VPet-Simulator.Windows/MainWindow.xaml.cs +++ b/VPet-Simulator.Windows/MainWindow.xaml.cs @@ -687,9 +687,21 @@ namespace VPet_Simulator.Windows { winSetting.Show(); }; + if (Set.StartUPBoot == true && !Set["v"][(gbol)"newverstartup"]) + {//更新到最新版开机启动方式 + try + { + winSetting.GenStartUP(); + } + catch + { - //成就和统计 - Set.Statistics[(gint)"stat_open_times"]++; + } + } + + + //成就和统计 + Set.Statistics[(gint)"stat_open_times"]++; Main.MoveTimer.Elapsed += MoveTimer_Elapsed; Main.OnSay += Main_OnSay; Main.Event_TouchHead += Main_Event_TouchHead; @@ -750,17 +762,18 @@ namespace VPet_Simulator.Windows })); - //游戏提示 - if (Set["SingleTips"][(gint)"open"] == 0 && Set.StartUPBoot == true && Set.StartUPBootSteam == true) - { - await Dispatcher.InvokeAsync(new Action(() => - { - MessageBoxX.Show("检测到您开启了开机启动, 以下是开机启动相关提示信息: (仅显示一次)".Translate() + "\n------\n" + - "游戏开机启动的实现方式是创建快捷方式,不是注册表,更健康,所以游戏卸了也不知道\n如果游戏打不开,可以去这里手动删除游戏开机启动快捷方式:\n%appdata%\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\".Translate() - , "关于卸载不掉的问题是因为开启了开机启动".Translate(), Panuon.WPF.UI.MessageBoxIcon.Info); - Set["SingleTips"][(gint)"open"] = 1; - })); - } + ////游戏提示 + //if (Set["SingleTips"][(gint)"open"] == 0 && Set.StartUPBoot == true && Set.StartUPBootSteam == true) + //{ + // await Dispatcher.InvokeAsync(new Action(() => + // { + // MessageBoxX.Show("检测到您开启了开机启动, 以下是开机启动相关提示信息: (仅显示一次)".Translate() + "\n------\n" + + // "游戏开机启动的实现方式是创建快捷方式,不是注册表,更健康,所以游戏卸了也不知道\n如果游戏打不开,可以去这里手动删除游戏开机启动快捷方式:\n%appdata%\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\".Translate() + // , "关于卸载不掉的问题是因为开启了开机启动".Translate(), Panuon.WPF.UI.MessageBoxIcon.Info); + // Set["SingleTips"][(gint)"open"] = 1; + // })); + //} + } diff --git a/VPet-Simulator.Windows/WinDesign/winGameSetting.xaml.cs b/VPet-Simulator.Windows/WinDesign/winGameSetting.xaml.cs index d2de3ab..6c1f5ff 100644 --- a/VPet-Simulator.Windows/WinDesign/winGameSetting.xaml.cs +++ b/VPet-Simulator.Windows/WinDesign/winGameSetting.xaml.cs @@ -812,28 +812,26 @@ namespace VPet_Simulator.Windows return; mw.Main.SetMoveMode(mw.Set.AllowMove, mw.Set.SmartMove, mw.Set.SmartMoveInterval * 1000); } - private void GenStartUP() + public void GenStartUP() { + mw.Set["v"][(gbol)"newverstartup"] = true; var path = Environment.GetFolderPath(Environment.SpecialFolder.Startup) + @"\VPET_Simulator.lnk"; if (mw.Set.StartUPBoot) { if (File.Exists(path)) File.Delete(path); IWshRuntimeLibrary.WshShell shell = new IWshRuntimeLibrary.WshShell(); - string shortcutAddress; - if (mw.Set.StartUPBootSteam) -#if DEMO - shortcutAddress = "steam://rungameid/2293870"; -#else - shortcutAddress = "steam://rungameid/1920960"; -#endif - else - shortcutAddress = System.Reflection.Assembly.GetExecutingAssembly().Location; - IWshRuntimeLibrary.IWshShortcut shortcut = (IWshRuntimeLibrary.IWshShortcut)shell.CreateShortcut(path); + if (mw.Set.StartUPBootSteam) + { + shortcut.TargetPath = ExtensionValue.BaseDirectory + @"\VPet.Solution.exe"; + shortcut.Arguments = "launchsteam"; + } + else + shortcut.TargetPath = System.Reflection.Assembly.GetExecutingAssembly().Location; + shortcut.Description = "VPet Simulator"; shortcut.WorkingDirectory = ExtensionValue.BaseDirectory; - shortcut.TargetPath = shortcutAddress; shortcut.IconLocation = ExtensionValue.BaseDirectory + @"vpeticon.ico"; try { @@ -855,7 +853,7 @@ namespace VPet_Simulator.Windows if (!AllowChange) return; if (StartUpBox.IsChecked == true) - if (MessageBoxX.Show("该游戏随着开机启动该程序\r如需卸载游戏\r请关闭该选项".Translate() + "\n------\n" + "我已确认,并在卸载游戏前会关闭该功能".Translate(), "开机启动重要消息".Translate(), + if (MessageBoxX.Show("该游戏随着开机启动该程序\r如需卸载游戏\r请关闭该选项".Translate() + "\n------\n" + "我已确认,并在卸载游戏前会关闭该功能".Translate(), "开机启动重要消息".Translate(), MessageBoxButton.YesNo, MessageBoxIcon.Warning) != MessageBoxResult.Yes) return; else diff --git a/VPet.Solution/App.xaml.cs b/VPet.Solution/App.xaml.cs index 0985e19..a7005a0 100644 --- a/VPet.Solution/App.xaml.cs +++ b/VPet.Solution/App.xaml.cs @@ -2,10 +2,12 @@ using System.Collections.Generic; using System.Configuration; using System.Data; +using System.Diagnostics; using System.IO; using System.Linq; using System.Threading.Tasks; using System.Windows; +using VPet_Simulator.Windows.Interface; namespace VPet.Solution { @@ -24,10 +26,13 @@ namespace VPet.Solution { case "removestarup": var path = Environment.GetFolderPath(Environment.SpecialFolder.Startup) + @"\VPET_Simulator.lnk"; - if(File.Exists(path)) + if (File.Exists(path)) { File.Delete(path); - } + } + return; + case "launchsteam": + Process.Start("steam://rungameid/1920960"); return; } }