Esempio n. 1
0
        private NotepadEntity GetNotePadEntity(ErrorLogEntity errorLogEntity)
        {
            var notePadEntity = new NotepadEntity();

            notePadEntity.Name        = "ErrorLogs";
            notePadEntity.FilePath    = @"c:\Temp\Log\ErrorLogs.txt";
            notePadEntity.Description = "desc";
            notePadEntity.Contents    = $"ControllerName {errorLogEntity.ControllerName} StackTrace {errorLogEntity.StackTrace} TimeStamp {errorLogEntity.TimeStamp}";
            return(notePadEntity);
        }
Esempio n. 2
0
 public int AppendInNotePad(NotepadEntity notePadEntity)
 {
     try
     {
         File.AppendAllLines(notePadEntity.FilePath, ConvertToIEnumerableString(notePadEntity.Contents));
         return(0);
     }
     catch (Exception ex)
     {
         return(1);
     }
 }
Esempio n. 3
0
 public string GetAllNotepad(NotepadEntity notePadEntity)
 {
     try
     {
         if (File.Exists(notePadEntity.FilePath))
         {
             var text = File.ReadAllText(notePadEntity.FilePath);
             return(text);
         }
         else
         {
             return("File does not exist");
         }
     }
     catch (Exception ex)
     {
         return("File does not exist");
     }
 }
Esempio n. 4
0
 public int EditNotePad(NotepadEntity notePadEntity)
 {
     try
     {
         if (File.Exists(notePadEntity.FilePath))
         {
             File.WriteAllText(notePadEntity.FilePath, notePadEntity.Contents);
             return(0);
         }
         else
         {
             return(1);
         }
     }
     catch (Exception ex)
     {
         return(1);
     }
 }