OpenFileDialog.Filenames 有限制吗?

发布于 2024-08-03 05:59:12 字数 856 浏览 1 评论 0原文

我有一个小助手应用程序,用于将脚本“注入”到 html 页面中。

我有一个 openfiledialog promt,我选择该目录中的所有 html 文件(1403 个文件),无论我做什么,我都会看到 OFD.filenames.count = 776

是否有限制?

谢谢

OpenFileDialog OFD = new OpenFileDialog();
            OFD.Multiselect = true;
            OFD.Filter = "HTML Files (*.htm*)|*.HTM*|" +
          "All files (*.*)|*.*";

            if (OFD.ShowDialog() == DialogResult.OK)
            {
                progressBar1.Maximum = OFD.FileNames.Count();
                foreach (string s in OFD.FileNames)
                {
                    Console.WriteLine(s);
                    AddAnalytics(s);
                    progressBar1.Value++;
                }
                MessageBox.Show(string.Format("Done! \r\n {0} files completed",progressBar1.Value));
                progressBar1.Value = 0;
            }

I have a small helper app that I use to "inject" scripts into html pages.

I have an openfiledialog promt and i select all the html files in that directory (1403 files) and no matter what i do i see that OFD.filenames.count = 776

is there a limit?

thanks

OpenFileDialog OFD = new OpenFileDialog();
            OFD.Multiselect = true;
            OFD.Filter = "HTML Files (*.htm*)|*.HTM*|" +
          "All files (*.*)|*.*";

            if (OFD.ShowDialog() == DialogResult.OK)
            {
                progressBar1.Maximum = OFD.FileNames.Count();
                foreach (string s in OFD.FileNames)
                {
                    Console.WriteLine(s);
                    AddAnalytics(s);
                    progressBar1.Value++;
                }
                MessageBox.Show(string.Format("Done! \r\n {0} files completed",progressBar1.Value));
                progressBar1.Value = 0;
            }

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

转身泪倾城 2024-08-10 05:59:12

OpenFileDialog 将仅使用“文件名”字段中的前 256 个字符。该字段本身显示更多​​内容,但它会忽略 256 个字符之后的任何内容。

我相信在您的情况下,丢失的文件会在 256 个字符标记之后列出。

The OpenFileDialog will only use the first 256 characters in the 'file name' field. The field itself displays more, but it ignores anything after the 256 characters.

I believe in your case the missing files are listed after the 256 character mark.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文