0

私は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.");
        }
    }

どうもありがとう。

4

2 に答える 2

1

これにはResXResourceReaderクラスを使用します。

于 2012-09-06T09:28:17.730 に答える
0
// Gets the value of associated with key "MyKey" from the local resource file for a given culture ("~/MyPage.aspx.en.resx") or from the default one ("~/MyPage.aspx.resx")
object keyValue = HttpContext.GetLocalResourceObject("~/MyPage.aspx", "MyKey", culture);

このようなものを使用してください

Windowsの場合、このリンクはあなたに役立つかもしれません

http://www.c-sharpcorner.com/uploadfile/yougerthen/handle-resource-files-read-and-write-into-a-resx-file-programmatically-part-iii/

于 2012-09-06T09:34:01.520 に答える