private void SetDefaultSettings() { DestinationEmail = "*****@*****.**"; MaxFileSize = 2048; StartInNormalMode = true; FilesOperations.Write(FullPath, Crypter.Encrypt(FileContent), false); }
public bool ChangeSettings(string emailAddress, string maxFileSize, bool startNormal) { var successFlag = true; try { if (VerifyEmail(emailAddress)) { DestinationEmail = emailAddress; } else { successFlag = false; } MaxFileSize = Convert.ToInt64(maxFileSize); StartInNormalMode = Convert.ToBoolean(startNormal); } catch (Exception) { successFlag = false; } FilesOperations.Write(FullPath, Crypter.Encrypt(FileContent), false); return(successFlag); }
protected void WriteLog(string message) { Lock = Lock ?? new object(); lock (Lock) { try { FilesOperations.FixOrCreate(FullPath); if (FilesOperations.ContentLength(FullPath) > MaxFileSize) // Send by email is required { var newPath = $"{FullPathWithoutExtension}_File{FileNumber++}.txt"; FilesOperations.Move(FullPath, newPath); } FilesOperations.Write(FullPath, $"{DateTime.Now.ToString()} {message}", true); } catch (Exception) { // ignored } EventTextBox.Text = message; TimeTextBox.Text = DateTime.Now.ToString(); } }