From 4e9585d10a1fca1f7f6647ff07925ff2f824de42 Mon Sep 17 00:00:00 2001 From: jrtechs Date: Mon, 1 Feb 2016 19:23:40 -0500 Subject: [PATCH] Export all skype history to text file code added. --- Skype History Viewer/Form1.cs | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/Skype History Viewer/Form1.cs b/Skype History Viewer/Form1.cs index 0188f98..23f9a0d 100644 --- a/Skype History Viewer/Form1.cs +++ b/Skype History Viewer/Form1.cs @@ -41,8 +41,12 @@ namespace Skype_History_Viewer { if(oMessage.Sender.FullName.Equals(name)) { - if (chTime.Checked) display = oMessage.Timestamp.ToString() + " "; - if (chUser.Checked) display += oMessage.Sender.FullName + " "; + if (chTime.Checked) display = oMessage.Timestamp.ToString() + " "; + if (chUser.Checked) + { + display += oMessage.Sender.FullName + " "; + } + display += oMessage.Body; lstChat.Items.Add(display); display = ""; @@ -107,7 +111,22 @@ namespace Skype_History_Viewer } else { + //exports all skype history to a text file + System.IO.StreamWriter file = new System.IO.StreamWriter("SkypeHistory.txt"); + String line = ""; + foreach (Chat oChat in skype.Chats) + { + foreach (ChatMessage oMessage in oChat.Messages) + { + if (chTime.Checked) line = oMessage.Timestamp.ToString() + " "; + if (chUser.Checked) line += oMessage.Sender.FullName + " "; + line += oMessage.Body; + file.WriteLine(line); + line = ""; + } + } + file.Close(); } }