/// <summary> /// The user changed the selected RESX file to edit /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void lstResX_SelectedIndexChanged(object sender, EventArgs e) { lblFileName.Text = ResXUnified.GetBaseName(lstResX.SelectedValue); CurrentSelection = lstResX.SelectedValue; FillGridView(lstResX.SelectedValue, true); FillLanguages(); btSave.Visible = true; currCultureName = ""; currEditLang = ""; }
// process files protected void ProcessFiles(DirectoryInfo dir, List <string> processed) { // Subfiles try // Avoid errors such as "Access Denied" { foreach (FileInfo iInfo in dir.GetFiles()) { if (Path.GetExtension(iInfo.FullName).ToLower().EndsWith("resx")) { // default culture resx file string defaultFile = Path.Combine(dir.FullName, ResXUnified.GetBaseName(iInfo.FullName) + ".resx"); // only the culture name string culture = ResXUnified.FindCultureInFilename(iInfo.FullName); switch (this.OperationSettings.OperationMode) { case ResXOperationModes.GetAvailableCultures: this.AddCultureToAvailables(culture); break; case ResXOperationModes.CreateNewCulture: if (this.ContinueCondition(processed, defaultFile)) { continue; } // build target file name var targetFile = Path.Combine(dir.FullName, ResXUnified.GetBaseName(iInfo.FullName) + "." + OperationSettings.SelectedCulture + ".resx"); // copy default resx to the new resx if (!File.Exists(targetFile) && File.Exists(defaultFile)) { File.Copy(defaultFile, targetFile, false); mMessage(targetFile); } processed.Add(defaultFile); break; case ResXOperationModes.Synchronize: if (this.ContinueCondition(processed, defaultFile)) { continue; } // some kind of bug here with the full path concatenation - quick & dirty fix if (File.Exists(defaultFile)) { mMessage(defaultFile); processed.Add(defaultFile); SynchronizeMultipleFiles(defaultFile, this.OperationSettings.Backup, this.OperationSettings.AddOnly, true); } break; case ResXOperationModes.CreatePackage: // buffer default resx culture file string translatedFile = defaultFile; // get selected culture for exporting string selectedCulture = GetCultureFromCombo(OperationSettings.SelectedCulture); // process all cultures except the default if (culture.ToLower() != "default") { translatedFile = Path.Combine(dir.FullName, ResXUnified.GetBaseName(iInfo.FullName) + "." + culture + ".resx"); } if (this.ContinueCondition(ResXFiles, translatedFile)) { continue; } if (selectedCulture.ToLower().Equals(culture.ToLower())) { ResXFiles.Add(translatedFile); } break; default: break; } } } } catch (Exception ex) { mMessage(ex.ToString()); // send message to the status textbox } }