/// <summary> /// 通过软件安装路径中的launcherConfig.ini获取当前最新版本路径 /// </summary> /// <param name="softwareFolder"></param> /// <returns></returns> public static string GetLastetVersionPathByIni(string softwareFolder) { string versionPath = string.Empty; var iniPath = Path.Combine(softwareFolder, "swenlauncher\\launcherConfig.ini"); if (File.Exists(versionPath)) { try { var actualExePath = IniUtility.ReadValue("Version", "ActualExePath", iniPath); var leftPathStr = actualExePath.Replace(softwareFolder + "\\", string.Empty); var versionFileName = leftPathStr.Substring(0, leftPathStr.IndexOf("\\")); versionPath = Path.Combine(softwareFolder, versionFileName); } catch (Exception e) { } } return(versionPath); }
public MainWindow() { InitializeComponent(); //Loaded += MainWindow_Loaded; ViewTabControl.SelectedItem = ViewTabControl.Items.Cast <TabItem>().FirstOrDefault(); Loaded += (s, e) => { var iniFilePath = CustomPath.GetUserSettingIniPath(); Task.Run(() => { CleanCacheVeiwModel.Instance.RefreshCommand.Execute(null); }); //获取配置清理路径 var viewName = IniUtility.ReadValue(IniSection, IniSection, iniFilePath); if (string.IsNullOrWhiteSpace(viewName)) { MainViewGrid.Visibility = Visibility.Visible; } else { MainViewGrid.Visibility = viewName == nameof(MainViewGrid) ? Visibility.Visible : Visibility.Collapsed; } }; }