/// <summary> /// ヘッダオブジェクトよりレコードを作成します。 /// </summary> public static NeithNotificationRec FromHeaders(HeaderCollection headers) { var p = headers.GetHeaderStringValue(HeaderKeys.NOTIFICATION_PRIORITY, false); var priority = Neith.Growl.Connector.Priority.Normal; if (p != null) { int pval = 0; bool pok = int.TryParse(p, out pval); if (pok && Enum.IsDefined(typeof(Priority), pval)) priority = (Priority)pval; } var text = headers.GetHeaderStringValue(HeaderKeys.NOTIFICATION_TEXT, false); if (text == null) text = String.Empty; var item = new NeithNotificationRec() { Name = headers.GetHeaderStringValue(HeaderKeys.NOTIFICATION_NAME, true), Icon = headers.GetHeaderResourceValue(HeaderKeys.NOTIFICATION_ICON, false), ApplicationName = headers.GetHeaderStringValue(HeaderKeys.APPLICATION_NAME, true), ID = headers.GetHeaderStringValue(HeaderKeys.NOTIFICATION_ID, false), CoalescingID = headers.GetHeaderStringValue(HeaderKeys.NOTIFICATION_COALESCING_ID, false), Priority = priority, Sticky = headers.GetHeaderBooleanValue(HeaderKeys.NOTIFICATION_STICKY, false), Title = headers.GetHeaderStringValue(HeaderKeys.NOTIFICATION_TITLE, true), Text = text, EventTime = headers.GetHeaderDateTimeOffsetValue(NeithHeaderKeys.EVENT_TIME, false), ProcessKey = headers.GetHeaderStringValue(NeithHeaderKeys.PROCESS_KEY, false), User = headers.GetHeaderStringValue(NeithHeaderKeys.USER, false), LogText = headers.GetHeaderStringValue(NeithHeaderKeys.LOGTEXT, false), Category = headers.GetHeaderStringValue(NeithHeaderKeys.CATEGORY, false), Type = headers.GetHeaderStringValue(NeithHeaderKeys.TYPE, false), Target = headers.GetHeaderStringValue(NeithHeaderKeys.TARGET, false), }; item.ToExtensibleObject().SetInhertiedAttributesFromHeaders(headers); return item; }