private void dialogEditorButton_Click(object sender, EventArgs e)
{
if (listViewStrings.SelectedItems.Count > 0) {
ListViewItem item = listViewStrings.SelectedItems[0];
LocString str = (LocString) item.Tag;
Save();
string winResExe = RunProgram.FindSDKTool("winres.exe");
if (winResExe == null)
MessageBox.Show(@"Cannot find al.exe in the Windows SDK. Make sure the Windows SDK is installed in c:\Program Files\Microsoft SDKs\Windows");
else {
// The unlocalized file must be copied to the same directory as the localized for winres to work.
string resXFileName = str.File.LocalizedFileName;
string resXUnlocalized = str.File.NonLocalizedFileName;
string resXCopiedUnlocalized = Path.Combine(Path.GetDirectoryName(resXFileName), Path.GetFileName(resXUnlocalized));
bool copy = ! string.Equals(resXUnlocalized, resXCopiedUnlocalized, StringComparison.InvariantCultureIgnoreCase);
if (copy)
File.Copy(resXUnlocalized, resXCopiedUnlocalized, true);
Enabled = false;
try {
RunProgram runProgram = new RunProgram();
runProgram.Run(winResExe, Path.GetFileName(resXFileName), Path.GetDirectoryName(resXFileName));
}
finally {
Enabled = true;
Activate();
}
if (copy)
File.Delete(resXCopiedUnlocalized);
resourceDirectory.ReadResources();
PopulateListView();
}
}
}