我是 C# .NET 的新手。
我需要从本地文件夹访问 *.resx 文件,然后从每个 *.resx 文件中检索数据。我正在为此创建一个 Windows 应用程序。
因此,首先,一旦我给出了该文件夹的路径,它就会在那里找到文件,但是现在,我如何读取这些文件并将数据从它们获取到 RAM 上的临时数据库中。
私人无效按钮BrowseSource1_Click(对象发送者,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.");
}
}
非常感谢。