public LocalizationCreateForm(LocalizationAddResult result, string destinationFolder)
        {
            InitializeComponent();
            _result = result;

            if (!Directory.Exists(destinationFolder))
            {
                Directory.CreateDirectory(destinationFolder);
            }

            PakFileName = Path.Combine(destinationFolder, result.Language.FileName);
        }
Example #2
0
        private void BtnOk_Click(object sender, System.EventArgs e)
        {
            var result = new LocalizationAddResult
            {
                Language           = (Language)cbLanguages.SelectedItem,
                IncludeTranslation = cbIncludeTranslation.Checked
            };

            if (rbFromExisting.Checked)
            {
                result.IsLocal         = true;
                result.PackageFileName = ((Language)cbExistingLanguages.SelectedItem).FileName;
            }
            else
            {
                if (string.IsNullOrWhiteSpace(tbNewPackage.Text))
                {
                    MessageBox.Show(this, Resources.Package_file_is_not_selected, Resources.Caption_Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                result.PackageFileName = tbNewPackage.Text;

                result.IncludeFiles = new List <string>();
                foreach (var item in cbPakResources.CheckedItems)
                {
                    result.IncludeFiles.Add((string)item);
                }

                if (result.IncludeFiles.Count == 0)
                {
                    MessageBox.Show(this, Resources.Zero_resources_selected_, Resources.Caption_Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }

            Result       = result;
            DialogResult = DialogResult.OK;
            Close();
        }