判断一个文件夹是远程还是本地
var x = new System.Windows.Forms.FolderBrowserDialog();
if (x.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
foreach (var file in new DirectoryInfo(x.SelectedPath).GetFiles("*.xml"))
{
System.Uri uri = new System.Uri(file.FullName);
// FullName 表示包括文件的路径
// DirectoryName 表示不包括文件的路径
if (uri.Host.Equals(System.String.Empty) == false)
{
System.Windows.Forms.MessageBox.Show("Operation failed, please choose local documents");
break;
}
var x = new System.Windows.Forms.FolderBrowserDialog();
if (x.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
foreach (var file in new DirectoryInfo(x.SelectedPath).GetFiles("*.xml"))
{
System.Uri uri = new System.Uri(file.FullName);
// FullName 表示包括文件的路径
// DirectoryName 表示不包括文件的路径
if (uri.Host.Equals(System.String.Empty) == false)
{
System.Windows.Forms.MessageBox.Show("Operation failed, please choose local documents");
break;
}