private void Save(string filename) { using (FileStream fileStream = new FileStream(filename, FileMode.Create, FileAccess.Write)) { WriteFiles.WriteHeader(fileStream, "AUIF"); UpdateStepOn = UpdateStepOn.Nothing; WriteFiles.WriteDateTime(fileStream, 1, LastCheckedForUpdate); WriteFiles.WriteInt(fileStream, 2, (int)UpdateStepOn); WriteFiles.WriteInt(fileStream, 3, (int)AutoUpdaterStatus); if (!string.IsNullOrEmpty(UpdateVersion)) { WriteFiles.WriteString(fileStream, 4, UpdateVersion); } if (!string.IsNullOrEmpty(ChangesInLatestVersion)) { WriteFiles.WriteString(fileStream, 5, ChangesInLatestVersion); WriteFiles.WriteBool(fileStream, 6, ChangesIsRTF); } if (!string.IsNullOrEmpty(ErrorTitle)) { WriteFiles.WriteString(fileStream, 7, ErrorTitle); } if (!string.IsNullOrEmpty(ErrorMessage)) { WriteFiles.WriteString(fileStream, 8, ErrorMessage); } fileStream.WriteByte(byte.MaxValue); } }
void Save(string filename) { using (FileStream fs = new FileStream(filename, FileMode.Create, FileAccess.Write)) { // Write any file-identification data you want to here WriteFiles.WriteHeader(fs, "AUIF"); #if CLIENT UpdateStepOn = UpdateStepOn.Nothing; #endif // Date last checked for update WriteFiles.WriteDateTime(fs, 0x01, LastCheckedForUpdate); // update step on WriteFiles.WriteInt(fs, 0x02, (int)UpdateStepOn); #if CLIENT // only save the AutoUpdaterStatus when wyUpdate writes the file WriteFiles.WriteInt(fs, 0x03, (int)AutoUpdaterStatus); #endif if (!string.IsNullOrEmpty(UpdateVersion)) { WriteFiles.WriteString(fs, 0x04, UpdateVersion); } if (!string.IsNullOrEmpty(ChangesInLatestVersion)) { WriteFiles.WriteString(fs, 0x05, ChangesInLatestVersion); WriteFiles.WriteBool(fs, 0x06, ChangesIsRTF); } #if CLIENT if (!string.IsNullOrEmpty(ErrorTitle)) { WriteFiles.WriteString(fs, 0x07, ErrorTitle); } if (!string.IsNullOrEmpty(ErrorMessage)) { WriteFiles.WriteString(fs, 0x08, ErrorMessage); } #endif fs.WriteByte(0xFF); } }