public LocalizationSettingWindow(Dictionary <string, XmlObjectsListWrapper> loadedListWrappers)
        {
            InitializeComponent();

            Closing += new CancelEventHandler(LocalizatonSettingWindow_Closing);

            AddTooltips();

            StartingMod             = Properties.Settings.Default.ModTagSetting;
            WindowTitle             = StartingMod.ToString();
            this.Title              = GetTitleForWindow();
            this.LoadedListWrappers = loadedListWrappers;

            string pathToModLocalizationFile = XmlFileManager.ModConfigOutputPath + LocalizationFileObject.LOCALIZATION_FILE_NAME;

            ModLocalizationGridUserControl = new LocalizationGridUserControl(pathToModLocalizationFile);
            GridAsCSVAfterUpdate           = ModLocalizationGridUserControl.Maingrid.GridAsCSV();

            List <string> allCustomTagDirectories = XmlFileManager.GetCustomModFoldersInOutput();

            foreach (string nextModTag in allCustomTagDirectories)
            {
                ModSelectionComboBox.AddUniqueValueTo(nextModTag);
            }
            ModSelectionComboBox.SelectedItem = Properties.Settings.Default.ModTagSetting;

            ModSelectionComboBox.DropDownClosed += ModSelectionComboBox_DropDownClosed;

            ModLocalizationScrollViewer.Content = ModLocalizationGridUserControl;

            string pathToGameLocalizationFile = XmlFileManager.LoadedFilesPath + LocalizationFileObject.LOCALIZATION_FILE_NAME;

            GameLocalizationFile = new LocalizationFileObject(pathToGameLocalizationFile);
            TextEditorOptions newOptions = new TextEditorOptions
            {
                EnableRectangularSelection = true,
                EnableTextDragDrop         = true,
                HighlightCurrentLine       = true,
                ShowTabs = true
            };

            LocalizationPreviewBox.ShowLineNumbers  = true;
            LocalizationPreviewBox.TextArea.Options = newOptions;
            LocalizationPreviewBox.Text             = ModLocalizationGridUserControl.Maingrid.GridAsCSV();
            LocalizationPreviewBox.LostFocus       += LocalizationPreviewBox_LostFocus;
            SearchPanel.Install(LocalizationPreviewBox);
            ModLocalizationScrollViewer.GotFocus  += Maingrid_GotOrLostFocus;
            ModLocalizationScrollViewer.LostFocus += Maingrid_GotOrLostFocus;

            SortedSet <string> gameFileKeysSorted = GameLocalizationFile.HeaderKeyToCommonValuesMap.GetValueOrDefault(GameLocalizationFile.KeyColumn);
            List <string>      gameFileKeys       = new List <string>(gameFileKeysSorted);

            GameKeySelectionComboBox.SetComboBox(gameFileKeys);
            GameKeySelectionComboBox.IsEditable      = true;
            GameKeySelectionComboBox.DropDownClosed += GameKeySelectionComboBox_DropDownClosed;
            GameKeySelectionComboBox.PreviewKeyDown += GameKeySelectionComboBox_PreviewKeyDown;

            SetBackgroundColor();
        }
Ejemplo n.º 2
0
        private void AddNewGridWithRecord(string gameKeyRecord)
        {
            string pathToTempFile = System.IO.Path.Combine(Directory.GetCurrentDirectory(), "TMP_" + LocalizationFileObject.LOCALIZATION_FILE_NAME);

            XmlFileManager.WriteStringToFile(Directory.GetCurrentDirectory(), "TMP_" + LocalizationFileObject.LOCALIZATION_FILE_NAME, gameKeyRecord);
            GameRecordGridUserControl      = new LocalizationGridUserControl(pathToTempFile, true);
            GameRecordScrollViewer.Content = GameRecordGridUserControl;
        }
Ejemplo n.º 3
0
        private void ReloadModLocalizationGrid(ComboBox modSelectionComboBox)
        {
            string modOutptPath = XmlFileManager.Get_ModOutputPath(modSelectionComboBox.SelectedItem.ToString());
            string pathToModLocalizationFile = modOutptPath + LocalizationFileObject.LOCALIZATION_FILE_NAME;
            LocalizationFileObject testParse = new LocalizationFileObject(pathToModLocalizationFile);

            if (testParse.PARSING_ERROR)
            {
                ShowLocalizationParsingError();
            }
            else
            {
                ModLocalizationGridUserControl      = new LocalizationGridUserControl(pathToModLocalizationFile);
                ModLocalizationScrollViewer.Content = ModLocalizationGridUserControl;
                string currentGridAsCSV = ModLocalizationGridUserControl.Maingrid.GridAsCSV();
                LocalizationPreviewBox.Text = currentGridAsCSV;
                StartingMod = ModSelectionComboBox.SelectedItem.ToString();
                WindowTitle = StartingMod.ToString();
                this.Title  = GetTitleForWindow();
            }
        }
Ejemplo n.º 4
0
        private void ReloadModLocalizationGrid(string pathToLocalizatioFile, bool deleteFileAfterLoadingGrid = true)
        {
            LocalizationFileObject testParse = new LocalizationFileObject(pathToLocalizatioFile);

            if (testParse.PARSING_ERROR)
            {
                ShowLocalizationParsingError();
            }
            else
            {
                ModLocalizationGridUserControl      = new LocalizationGridUserControl(pathToLocalizatioFile);
                ModLocalizationScrollViewer.Content = ModLocalizationGridUserControl;
                string currentGridAsCSV = ModLocalizationGridUserControl.Maingrid.GridAsCSV();
                LocalizationPreviewBox.Text = currentGridAsCSV;
                if (deleteFileAfterLoadingGrid)
                {
                    File.Delete(pathToLocalizatioFile);
                }
                GridAsCSVAfterUpdate = LocalizationPreviewBox.Text;
                ModLocalizationGridUserControl.SetGridChangedToTrue();
            }
        }