-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
122 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
using System; | ||
using System.IO; | ||
using System.Text; | ||
|
||
namespace NotepadKeeper | ||
{ | ||
class NotepadPP | ||
{ | ||
public static void get() | ||
{ | ||
|
||
Console.WriteLine($"\n----[NOTEPAD ++]----\n"); | ||
|
||
// 动态获取当前Windows用户的用户名 | ||
string username = Environment.UserName; | ||
|
||
// 根据用户名设置目录路径 | ||
string directoryPath = $@"C:\Users\{username}\AppData\Roaming\Notepad++\backup"; | ||
|
||
// 检查目录是否存在 | ||
if (Directory.Exists(directoryPath)) | ||
{ | ||
// 获取目录中的所有文件 | ||
string[] files = Directory.GetFiles(directoryPath); | ||
|
||
Console.WriteLine($"Total files: {files.Length}"); | ||
|
||
// 遍历所有文件 | ||
foreach (string file in files) | ||
{ | ||
// 读取每个文件的内容 | ||
string content = File.ReadAllText(file, Encoding.UTF8); | ||
Console.WriteLine($"Reading file: {file}"); | ||
Console.WriteLine(content); | ||
Console.WriteLine("--------------------------------"); | ||
} | ||
} | ||
else | ||
{ | ||
Console.WriteLine($"The directory {directoryPath} does not exist."); | ||
} | ||
|
||
#if DEBUG | ||
Console.WriteLine("Press any key to exit."); | ||
Console.ReadKey(); | ||
#endif | ||
} | ||
} | ||
} |