WriteNote.cs 645 B

123456789101112131415161718192021
  1. using System;
  2. using System.IO;
  3. namespace NotePad.Helper
  4. {
  5. class WriteNote
  6. {
  7. public static void Write(string Note, string NoteData)
  8. {
  9. if (NoteData == "")
  10. {
  11. FileStream fs = new FileStream(NotePadForm.Folder + DateTime.Now.ToString("yyyy-MM-dd") + ".txt", FileMode.OpenOrCreate, FileAccess.ReadWrite);
  12. fs.Close();
  13. File.WriteAllText(NotePadForm.Folder + DateTime.Now.ToString("yyyy-MM-dd") + ".txt", Note);
  14. }
  15. else
  16. File.WriteAllText(NotePadForm.Folder + NoteData + ".txt", Note);
  17. }
  18. }
  19. }