private static void putCouch(string message, DateTime now) { if (String.IsNullOrEmpty(message)) return; if (message.Contains(POST_LOG)) return; if (LogExceptions.Any(prefix => message.StartsWith(prefix))) return; var name = (ThisAddIn.instance == null || ThisAddIn.instance.Application == null || String.IsNullOrEmpty(ThisAddIn.instance.Application.Name)) ? "unknown" : ThisAddIn.instance.Application.Name; int currentPosition = (ThisAddIn.instance == null || ThisAddIn.instance.Application == null || String.IsNullOrEmpty(ThisAddIn.instance.Application.Name) || ThisAddIn.instance.Application.ActivePresentation == null || ThisAddIn.instance.Application.ActivePresentation.SlideShowWindow == null || ThisAddIn.instance.Application.ActivePresentation.SlideShowWindow.View == null) ? 0 : ThisAddIn.instance.Application.ActivePresentation.SlideShowWindow.View.CurrentShowPosition; string pptVersion = (ThisAddIn.instance == null || ThisAddIn.instance.Application == null || String.IsNullOrEmpty(ThisAddIn.instance.Application.Version)) ? "unknown PowerPoint version" : ThisAddIn.instance.Application.Version; string version = ThisAddIn.version; var msg = new LogMessage(message,now.Ticks,currentPosition,name,pptVersion,version); putCouch(msg); }
private static void saveToQueue(LogMessage message) { MessageQueue.Add(message); renewTimer(); }
private static void putCouch(LogMessage message) { try { //client().UploadStringAsync(couchServer, message.JSON); client().QueryString = message.QueryString; client().DownloadStringAsync(LoggingServer); } catch (Exception) { saveToQueue(message); } }