创建类似于Windows的文件夹 [英] Create folder windows-like

查看:128
本文介绍了创建类似于Windows的文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我正在使用C#中的FileExplorer Type工具,具有更多功能,例如重命名一堆文件/文件夹,我还提供基本复制/粘贴/剪切操作。



现在我正在创建新文件夹按钮我希望它像Windows一样



我的代码到目前为止:

So i'm working on a FileExplorer Type thing in C# with more functionalities like renaming a bunch of files/folders, and i'm also providing the Basic Copy/Paste/Cut operations.

Now i'm working on the create new folder button And i want it to be windows-like

My code so far :

int i = 0;
while (true)
 {
   string dirName = i == 0 ? System.IO.Path.Combine(txtCurrentPath.Text, "New Folder") : System.IO.Path.Combine(txtCurrentPath.Text, "New Folder (" + i + ")");
   if (!Directory.Exists(dirName))
    {
     Directory.CreateDirectory(dirName);
     break;
    }
      else
         i++;
}



无论如何,我的问题是,我怎样才能避免所有这一切,只需向探险家发送一个简单的命令或类似命令即可使用内置的在创建新文件夹的方式。

我是所有这个windows api和shell扩展的新手,谢谢:)



我尝试过:



i googled,弹出的所有内容都是C#方式Directory.CreateDirectory(String DirName);


Anyway my question is, How can i avoid all of that and just send a simple command or something like that to the explorer to use the built-in way of creating new folder.
i'm new to all this windows api and shell extension stuff, Thanks :)

What I have tried:

i googled and all that pops up is the C# way Directory.CreateDirectory(String DirName);

推荐答案

资源管理器不公开API - 它使用一个...用于目录管理的Windows API ...同样的.NET目录包装...

如果您要创建更丰富的文件浏览器应用程序,将它绑定到其他应用程序是非常不明智的...

如果您有兴趣了解API的低级别,请检查: 目录管理参考(Windows) [ ^ ]但是请不要犹豫使用.NET用于执行任务的类,如创建目录......
Explorer does not expose API - it uses one... The Windows API for Directory management... The very same .NET's Directory wraps...
If you are going to create a richer file browser application it would be very unwise to bind it to an other application...
If you are interested to learn about the low level of the API check this: Directory Management Reference (Windows)[^], however do not hesitate to use .NET's classes to perform tasks, like creating a directory...


这篇关于创建类似于Windows的文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆