private void ChangeGameDir_Click(object sender, RoutedEventArgs e) { ManagerInfo inst = ManagerInfo.Get(); string result = GameInstallFinder.FindInstallDir_Dialog(); if (result != null) { InstallDirText.Text = result; inst.installDir = result; inst.Save(); } }
public static ManagerInfo Get() { if (_instance == null) { string configFileName = GetConfigFileName(); if (File.Exists(configFileName)) { string json = File.ReadAllText(configFileName); _instance = JsonConvert.DeserializeObject <ManagerInfo>(json); } else { _instance = new ManagerInfo(); } if (_instance.installDir == null || !Directory.Exists(_instance.installDir)) { _instance.installDir = GameInstallFinder.FindGameInstallDirectory(); if (_instance.installDir == null) { System.Windows.Application.Current.Shutdown(); return(null); } } _instance.Save(); } if (!Directory.Exists(_instance.GetFullDownloadDirectory())) { Directory.CreateDirectory(_instance.GetFullDownloadDirectory()); } if (!Directory.Exists(_instance.GetFullProfileDirectory())) { Directory.CreateDirectory(_instance.GetFullProfileDirectory()); } return(_instance); }