using System; using Livescribe.DesktopSDK.PenData; using Livescribe.DesktopSDK.AFP; namespace ListPaperReplaySessions { class ListPaperReplaySessions { private static string PR_TARGET = "PaperReplayData.zip"; static void Main(string[] args) { System.Console.WriteLine(" =============================================================="); System.Console.WriteLine(" Query a local Container and display Paper Replay metadata"); System.Console.WriteLine(" =============================================================="); PrintPaperRelayDataInfo(PR_TARGET); Console.ReadLine(); } public static void PrintPaperRelayDataInfo(string fileName) { // Determine if the target Container contains Penlet Data Container container = new Container(fileName); if (!container.IsPenletData()) { Console.Out.WriteLine("\n ERROR: Data file does not contain penlet data."); return; } try { // Query container containing penlet data for Paper Replay data PaperReplayData paperReplayData = new PaperReplayData(container.PenletData); if (paperReplayData==null) { Console.Out.WriteLine("\n ERROR: Data file does not contain Paper Replay data."); return; } // Iterate on each notebook (Paper Product) foreach (NotebookInfo notebook in paperReplayData.Notebooks) { Console.Out.WriteLine("\n Notebook Guid: " + notebook.NotebookId); Console.Out.WriteLine("\t Number of session: " + notebook.Sessions.Count); // Iterate on each session foreach (SessionInfo session in notebook.Sessions) { Console.Out.WriteLine("\t\t Session Guid: " + session.SessionGuid); Console.Out.WriteLine("\t\t\t Session Start Time: " + session.StartTime); Console.Out.WriteLine("\t\t\t Session End Time: " + session.EndTime); Console.Out.WriteLine("\t\t\t Session audio files: "); // Iterate on each audio clip. We may have multiple clips due to pauses. foreach (SessionAudioClip audioclip in session.AudioClips) { // Display the session length in seconds Console.Out.WriteLine("\t\t\t\t File: " + audioclip.name + " Duration: " + (audioclip.endTime - audioclip.startTime) / 1000 + " seconds"); } } } } catch (Exception e) { System.Console.WriteLine("Exception: " + e.Message, "Error"); } } } }