private void LoadSavedmails() { #region Load saved mails foreach (String item in File.ReadLines(ListOfPath.SavedMailLogs)) { string thePath = Encoding.UTF8.GetString( Convert.FromBase64String(item)); if (Availble.AvailblePath.Contains(thePath)) { continue; } if (File.Exists(thePath)) { SaveMail Savedmail = new SaveMail(); if (Savedmail.Load(thePath) == true) { Availble.AvailblePath.Add(thePath); CallRecord(Savedmail.Sender, Savedmail.Subject, thePath, Savedmail.SenderAvatar); } Savedmail = null; } } if (ListSavedMails.Controls.Count < 1) { ShowEmptySavedMail(); } #endregion }
private void ShowSavedMail_Load(object sender, EventArgs e) { #region Check Saved mail path is availble or not if (!File.Exists(PathOfSavedMail)) { MessageBox.Show("Sorry! This mail is no longer!", "NOT FOUND!", MessageBoxButtons.OK, MessageBoxIcon.Error); this.Dispose(); return; } #endregion #region LoadInfomation SaveMail Savedmail = new SaveMail(); if (Savedmail.Load(PathOfSavedMail) == true) { Subject.Text = Savedmail.Subject; senderX.Text = SenderMail = "From: " + Savedmail.Sender; SenderAvatar = Savedmail.SenderAvatar; DateTimeShow.Text = Savedmail.DateTimeReceived; if (String.IsNullOrEmpty(Savedmail.Body) || String.IsNullOrWhiteSpace(Savedmail.Body)) { Decrypt.Enabled = false; } else { try { var Temp = Convert.FromBase64String(Savedmail.Body); Decrypt.Enabled = true; } catch (Exception) { Decrypt.Enabled = false; } } ContentShow.DocumentText = Savedmail.Body; } else { MessageBox.Show("Saved Mail is defective!", "CAN NOT READ", MessageBoxButtons.OK, MessageBoxIcon.Error); this.Dispose(); return; } #endregion }
private void LoadSavedmails() { #region Load saved mails foreach (String item in File.ReadLines(ListOfPath.SavedMailLogs)) { string thePath = Encoding.UTF8.GetString( Convert.FromBase64String(item)); if (Availble.AvailblePath.Contains(thePath)) { continue; } if (File.Exists(thePath)) { // For check mail saved life! FileInfo I4 = new FileInfo(thePath); TimeSpan x = DateTime.Now - I4.CreationTime; if (x.Days > Setting.TimeDele) { File.Delete(thePath); continue; } // Another SaveMail Savedmail = new SaveMail(); if (Savedmail.Load(thePath) == true) { Availble.AvailblePath.Add(thePath); CallRecord(Savedmail.Sender, Savedmail.Subject, thePath, Savedmail.SenderAvatar); } Savedmail = null; } } if (ListSavedMails.Controls.Count < 1) { ShowEmptySavedMail(); } #endregion }