Esempio n. 1
0
        private void BN_ConvertCsvToPo_Click(object sender, EventArgs e)
        {
            OpenFileDialog CsvFileInfo = new OpenFileDialog();

            CsvFileInfo.Filter           = ".csv (*.csv )|*.csv";
            CsvFileInfo.InitialDirectory = TXBX_UE4LocalizationPath.Text;
            if (CsvFileInfo.ShowDialog() == DialogResult.OK)
            {
                FileInfo FindPoFile = new FileInfo(CsvFileInfo.FileName);
                if (FindPoFile.Exists)
                {
                    SaveFileDialog SavePo = new SaveFileDialog();
                    SavePo.Filter           = FindPoFile.Name.Replace(FindPoFile.Extension, "") + ".po (*.po )|*.po";
                    SavePo.FileName         = FindPoFile.Name.Replace(FindPoFile.Extension, "") + ".po";
                    SavePo.InitialDirectory = TXBX_MainPoFile.Text;
                    if (SavePo.ShowDialog() == DialogResult.OK)
                    {
                        PoFile NewPoFile = Utilities.ConvertCsvToPoFile(FindPoFile);

                        FileInfo SavePoInfo = new FileInfo(SavePo.FileName);
                        NewPoFile.SaveFile(SavePoInfo);
                    }
                }
            }
        }
Esempio n. 2
0
        private void BN_CreatePoFiles_Click(object sender, EventArgs e)
        {
            FileInfo PoFileInfo = (FileInfo)settingsControl.GetValue("UE4MainPoFile");
            PoFile   NewPoFile  = new PoFile(PoFileInfo);

            DirectoryInfo PoMainDirectors = (DirectoryInfo)settingsControl.GetValue("UE4LocalizationPath");

            FolderBrowserDialog objDialog = new FolderBrowserDialog();

            objDialog.Description  = "Choose the Project localization path";
            objDialog.SelectedPath = PoMainDirectors.FullName;
            DialogResult objResult = objDialog.ShowDialog(this);

            if (objResult == DialogResult.OK)
            {
                FileInfo LocalizationFileInfo = (FileInfo)settingsControl.GetValue("LocalizationCSV");
                if (LocalizationFileInfo.Exists)
                {
                    List <LanguageCell>  Lang             = new List <LanguageCell>();
                    List <cl_ListKeyInt> languageListCell = (List <cl_ListKeyInt>)settingsControl.GetValue("LanguageListCellID");
                    foreach (cl_ListKeyInt item in languageListCell)
                    {
                        Lang.Add(new LanguageCell(item.Key, item.value));
                    }

                    int KeyCell            = (int)settingsControl.GetValue("KeyCell");
                    int SourceCell         = (int)settingsControl.GetValue("SourceCell");
                    int SourceLocationCell = (int)settingsControl.GetValue("SourceLocationCell");
                    LocalizationFile NewLocalizationFileInfo = new LocalizationFile(LocalizationFileInfo, Lang, KeyCell, SourceCell, SourceLocationCell);
                    if (NewLocalizationFileInfo.LanguageValues.Count > 0)
                    {
                        foreach (LanguageCell Language in NewLocalizationFileInfo.Languages)
                        {
                            PoFile NewLanguagePoFile     = Utilities.CreatePofileFromLocalizationCSV(NewLocalizationFileInfo, Language.Language);
                            PoFile CombineLanguagePoFile = Utilities.CombinePoFiles(NewPoFile, NewLanguagePoFile);

                            FileInfo ToSavePo = new FileInfo(Path.Combine(objDialog.SelectedPath, Language.Language, PoFileInfo.Name));
                            if (!ToSavePo.Directory.Exists)
                            {
                                Directory.CreateDirectory(ToSavePo.Directory.FullName);
                            }

                            CombineLanguagePoFile.SaveFile(ToSavePo);
                        }
                    }

                    MessageBox.Show("Files are created!");
                }
            }
        }