// save the course after first saving the current files to the undo directory public void Save() { saveBackup(); string file = directory + "/" + filename; serialize(file); serializeControl(); hash.HashCode = HashStat.ReadHash(file); hash.Serialize(hashfile); }
// copy the current files to the undo directory private void saveBackup() { FileInfo fi = new FileInfo(directory + "/" + filename); if (fi.Exists) { UnDoCtr++; UnDoPos = 1 + UnDoCtr; // reset after save (new DirectoryInfo(directory + @"\" + undodir)).Create(); string file = undoName(UnDoCtr); fi.CopyTo(file); control.Serialize(undoName(UnDoCtr, controlname)); hash.HashCode = HashStat.ReadHash(file); hash.Serialize(undoName(UnDoCtr, hashname)); } }