private void ProjectListBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { UnityL10nToolProjectInfo unityL10NToolProjectInfo = (ProjectListBox.SelectedItem as UnityL10nToolProjectInfo); if (unityL10NToolProjectInfo != null) { Window projectConfig = new ProjectConfig(unityL10NToolProjectInfo); projectConfig.Show(); Window.GetWindow(this).Close(); } }
private void Button_Click(object sender, RoutedEventArgs e) { // https://stackoverflow.com/questions/11624298/how-to-use-openfiledialog-to-select-a-folder // 유니티의 폴더 열기를 구현할 수 있는 방법이 있는것 같음 //UnityL10nToolCppManaged unityL10NToolCppManaged = ((App)Application.Current).unityL10NToolCppManaged = new UnityL10nToolCppManaged(gameFolderPath.Text); //Dictionary<string, List<FontAssetMapCLI>> directory = unityL10NToolCppManaged.GetPluginsSupportAssetMap(); var dialog = new CommonOpenFileDialog { EnsurePathExists = true, EnsureFileExists = false, AllowNonFileSystemItems = false, IsFolderPicker = true, Title = "Select Unity Game Folder" }; if (dialog.ShowDialog() == CommonFileDialogResult.Ok) { string dirToProcess = Directory.Exists(dialog.FileName) ? dialog.FileName : System.IO.Path.GetDirectoryName(dialog.FileName); string projectJsonFolder = UnityL10nToolCppCLI.UnityL10nToolCppManaged.NewGameProjectFromFolder(dirToProcess); if (projectJsonFolder != "") { string jsonStr = System.IO.File.ReadAllText(projectJsonFolder + "setting.json"); JObject jObject = JObject.Parse(jsonStr); string GameName = (string)jObject["GameName"]; string MakerName = (string)jObject["MakerName"]; string GamePath = (string)jObject["GamePath"]; string DataFolderName = (string)jObject["DataFolderName"]; UnityL10nToolProjectInfo unityL10NToolProjectInfo = new UnityL10nToolProjectInfo( GameName: GameName, MakerName: MakerName, GamePath: GamePath, JSONPath: projectJsonFolder + "setting.json", DataFolderName: DataFolderName); Window projectConfig = new ProjectConfig(unityL10NToolProjectInfo); projectConfig.Show(); Window.GetWindow(this).Close(); } else { MessageBox.Show("Fail to find unity game folder. please check github wiki manual. If there is a problem, please report issue at github.", "Find unity folder fail"); } } }