// the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
// Boston, MA 02110-1301, USA.
+#nullable enable
+
using System;
using System.Collections.Generic;
using System.Linq;
{
public class GrowlHelper
{
- private Assembly _connector = null;
- private Assembly _core = null;
+ private Assembly? _connector = null;
+ private Assembly? _core = null;
- private object _growlNTreply;
- private object _growlNTdm;
- private object _growlNTnew;
- private object _growlNTusevent;
- private object _growlApp;
+ private object? _growlNTreply;
+ private object? _growlNTdm;
+ private object? _growlNTnew;
+ private object? _growlNTusevent;
+ private object? _growlApp;
- private object _targetConnector;
+ private object? _targetConnector;
bool _initialized = false;
public class NotifyCallbackEventArgs : EventArgs
return true;
}
- public void Notify(NotifyType notificationType, string id, string title, string text, Image icon = null, string url = "")
+ public void Notify(NotifyType notificationType, string id, string title, string text, Image? icon = null, string url = "")
{
if (!_initialized) return;
var notificationName = "";
notificationName = "USERSTREAM_EVENT";
break;
}
- object n;
+ object? n;
if (icon != null || !string.IsNullOrEmpty(url))
{
- var gCore = _core.GetType("Growl.CoreLibrary.Resource");
- object res;
+ var gCore = _core!.GetType("Growl.CoreLibrary.Resource");
+ object? res;
if (icon != null)
{
res = gCore.InvokeMember("op_Implicit",
CultureInfo.InvariantCulture);
}
var priority =
- _connector.GetType("Growl.Connector.Priority").InvokeMember(
+ _connector!.GetType("Growl.Connector.Priority").InvokeMember(
"Normal", BindingFlags.GetField, null, null, null, CultureInfo.InvariantCulture);
- n = _connector.GetType("Growl.Connector.Notification").InvokeMember(
+ n = _connector!.GetType("Growl.Connector.Notification").InvokeMember(
"Notification",
BindingFlags.CreateInstance,
null,
}
else
{
- n = _connector.GetType("Growl.Connector.Notification").InvokeMember(
+ n = _connector!.GetType("Growl.Connector.Notification").InvokeMember(
"Notification",
BindingFlags.CreateInstance,
null,
null, BindingFlags.CreateInstance, null, _connector,
new object[] { "some fake information", notificationName },
CultureInfo.InvariantCulture);
- _targetConnector.GetType().InvokeMember("Notify", BindingFlags.InvokeMethod, null, _targetConnector, new object[] { n, cc }, CultureInfo.InvariantCulture);
+ _targetConnector!.GetType().InvokeMember("Notify", BindingFlags.InvokeMethod, null, _targetConnector, new object[] { n, cc }, CultureInfo.InvariantCulture);
}
private void GrowlCallbackHandler(object response, object callbackData, object state)
{
// 定数取得
var vCLICK =
- _core.GetType("Growl.CoreLibrary.CallbackResult").GetField(
+ _core!.GetType("Growl.CoreLibrary.CallbackResult").GetField(
"CLICK",
BindingFlags.Public | BindingFlags.Static).GetRawConstantValue();
// 実際の値