我是C#.NET的新手 .
我需要从本地文件夹访问* .resx文件,然后从每个* .resx文件中检索数据 . 我正在为此创建一个Windows应用程序 .
首先,一旦我给了该文件夹的路径,就会在那里找到文件,但现在,我如何读取这些文件并将数据从它们获取到RAM上的临时数据库 .
private void buttonBrowseSource1_Click(object sender,EventArgs e)
{
FolderBrowserDialog selectPathDialog = new FolderBrowserDialog();
if (selectPathDialog.ShowDialog() == DialogResult.OK)
{
DirectoryInfo di = new DirectoryInfo(selectPathDialog.SelectedPath);
FileInfo[] RESXFiles = di.GetFiles("*.resx");
if (RESXFiles.Length == 0)
{
UpdateStatus("No RESX files found in this directory. Please check the folder/path again.");
}
else
{
UpdateStatus("Total " + RESXFiles.Length + " RESX files found in this directory.);
textBoxSource1.Text = selectPathDialog.SelectedPath;
}
}
else
{
UpdateStatus("Missing directory! Please try again.");
}
}
非常感谢 .
2 回答
使用ResXResourceReader Class为此 .
使用这样的东西
对于Windows,此链接可能对您有用