日期:2014-05-17 浏览次数:20834 次
void openFileDialogFileOk(object sender, System.ComponentModel.CancelEventArgs e)
{
string fullPathname = openFileDialog.FileName;
FileInfo src = new FileInfo(fullPathname);
fileName.Text = src.Name;
source.Text = "";
TextReader reader = src.OpenText();
string line = reader.ReadLine();
int count = 0;
while (line != null)
{
line = reader.ReadLine();
count += 1;
}
string[] quest;
quest = new string[count];
int yes = 1;
TextReader second = src.OpenText();
while (yes != count)
{
quest[yes] = second.ReadLine();
yes += 1;
}
Random ran = new Random();
source.Text += quest[ran.Next(1, count)];
reader.Close();
&