private void btnDec_Click(object sender, EventArgs e)
{
string temp = "";
int i = 0;
string listpath = @"c\yearsLog\2015.txt";
string writePath = @"c\logs.txt";
StreamReader file = new StreamReader(listpath);
long counter = CountLinesInFile(listpath);
for (i = 0; i < counter; i++)
{
temp = file.ReadLine().Replace("....", "");
CreateNewLogFiles(Decryption(temp),writePath);
}
file.Close();
MessageBox.Show("Log Dosyanız tamamlandı.");
}
我想只将Decrypt(2015.txt)的文件写入logs.txt,但它让我找不到路径的一部分。有人可以帮帮我吗?我该怎么办
答案 0 :(得分:0)
您需要使用Drive
冒号
:
个字母
试试这个:
string listpath = @"c:\yearsLog\2015.txt";
string writePath = @"c:\logs.txt";
解决方案2:
private void btnDec_Click(object sender, EventArgs e)
{
string temp = "";
int i = 0;
string listpath = @"c:\yearsLog\2015.txt";
if(File.Exists(listpath))
{
string writePath = @"c:\logs.txt";
StreamReader file = new StreamReader(listpath);
long counter = CountLinesInFile(listpath);
for (i = 0; i < counter; i++)
{
temp = file.ReadLine().Replace("....", "");
CreateNewLogFiles(Decryption(temp),writePath);
}
file.Close();
MessageBox.Show("Log Dosyanız tamamlandı.");
}
else
{
MessageBox.Show("File "+listpath+" not found");
}
}