私はこのコードを持っています:
public static string GetUserEmail()
{
string path = Application.StartupPath + "\\mail.txt";
MessageBox.Show(path);
string adres = String.Empty;
if (File.Exists(path))
{
using (StreamReader sr = new StreamReader(path))
{
adres = sr.ReadLine();
}
}
else
{
using (FileStream fs = File.Create(path))
{
using (StreamReader sr = new StreamReader(path))
{
adres = sr.ReadLine();
}
}
}
MessageBox.Show(adres);
return adres;
}
MessageBox.Show(); で ApplicationPath を確認しました。ご覧のとおり、そこに移動してファイルを削除し、アプリを再起動しても、前の行が読み取られます。アプリの再インストールをアンインストールしても、ファイルが見つかり、最初のインストールで入力したのと同じ行を読み取っているようです。Windows、Cドライブ全体を検索しましたが、mail.txtはありませんが、mail.txtを見つけて行を読み取ります(ユーザーを識別するために使用される電子メールアドレス)
それは何でしょうか?エイリアン?