generate initial student files

This commit is contained in:
Tim Young 2017-08-02 11:34:53 -05:00
parent 0ba762fe01
commit f1da7f9d97
2 changed files with 21 additions and 0 deletions

View File

@ -663,12 +663,29 @@ namespace EduNetworkBuilder
//Calculate the filename for the student file
//See if the file exists. If not, gen a new file
//Keep track of total # students, # new files, # skipped because they existed
int NumStudent = 0;
int NumMade = 0;
int NumSkipped = 0;
OpenFileDialog OFD = NB.SelectDirectoryDialog(NB.Translate("PPF_SelectStudentDir"),CurrentUser.StudentFilePath);
if (OFD.FileName == "") return;//we cancel out
CurrentUser.StudentFilePath = Path.GetDirectoryName(OFD.FileName);
foreach(PersonClass PC in CurrentUser.Students)
{
NumStudent++;
string FileName = Path.Combine(CurrentUser.StudentFilePath, PC.FileName);
if (File.Exists(FileName)) NumSkipped++;
else
{
NumMade++;
PC.Save(FileName);
}
}
//Now, print the stats
MessageBox.Show(string.Format(NB.Translate("PPF_StudentWriteStats"),"\n\t" + NumStudent, "\n\t" + NumMade, "\n\t" + NumSkipped));
}
}
}

View File

@ -1821,6 +1821,10 @@
<value>Student Files Directory</value>
<comment> PPF_SelectStudentDir = Stdent Files Directory</comment>
</data>
<data name="PPF_StudentWriteStats" xml:space="preserve">
<value>Stats: {0} Students {1} New Files {2} Skipped (already existed)</value>
<comment>PPF_StudentWriteStats Stats: {0} Students {1} New Files {2} Skipped (already existed)</comment>
</data>
<data name="PPF_UserDirectory" xml:space="preserve">
<value>User File Directory</value>
<comment>PPF_UserDirectory</comment>