Example #1
0
        private GrowlConnector GetGrowlConnector(string hostname, int port, string password)
        {
            var growlConnector = new GrowlConnector(password, hostname, port);

            growlConnector.OKResponse    += GrowlOKResponse;
            growlConnector.ErrorResponse += GrowlErrorResponse;
            return(growlConnector);
        }
Example #2
0
        static Notifier()
        {
            GrowlConnector = new GrowlConnector {
                EncryptionAlgorithm = Cryptography.SymmetricAlgorithmType.PlainText
            };
            var application = new Application("Octopus Deploy");

            GrowlConnector.Register(application, new[] { new NotificationType("Deployment Failure"), new NotificationType("Deployment Success") });
        }
Example #3
0
 public void CreateRegester1()
 {
     var sender = new GrowlConnector(null, "CreateMessageTest", 12345);
     var note = new Notification("AppName","NoteName","id12345","title","text");
     bool waitForCallback;
     var mb = sender.CreateNotify(note, null, null, out waitForCallback);
     var message = Encoding.UTF8.GetString(mb.GetBytes());
     Assert.IsTrue(message.StartsWith(CreateRegester1Text));
 }
        public SystemBalloonIntercepter(IntPtr handle) : base(handle)
        {
            this.handle = handle;

            this.app       = new Growl.Connector.Application("Windows");
            this.app.Icon  = System.IO.Path.Combine(System.Windows.Forms.Application.StartupPath, @"icons\info.png");
            this.ntBalloon = new NotificationType("balloon", "System Balloons");
            this.growl     = new GrowlConnector();
            this.growl.EncryptionAlgorithm = Cryptography.SymmetricAlgorithmType.PlainText;
        }
Example #5
0
        public void SendNotification(string title, string message, string notificationTypeName, string hostname, int port, string password)
        {
            var notificationType = _notificationTypes.Single(n => n.Name == notificationTypeName);
            var notification     = new GrowlNotification("NzbDrone", notificationType.Name, DateTime.Now.Ticks.ToString(), title, message);

            _growlConnector = new GrowlConnector(password, hostname, port);

            Logger.Debug("Sending Notification to: {0}:{1}", hostname, port);
            _growlConnector.Notify(notification);
        }
Example #6
0
        public AppContext()
            : base()
        {
            bool ok = false;

            if (Environment.OSVersion.Version.Major > 5)
            {
                // Vista & higher
                ok = true;

                MMDeviceEnumerator devEnum = new MMDeviceEnumerator();
                this.defaultDevice = devEnum.GetDefaultAudioEndpoint(EDataFlow.eRender, ERole.eMultimedia);
                this.defaultDevice.AudioEndpointVolume.OnVolumeNotification += new AudioEndpointVolumeNotificationDelegate(AudioEndpointVolume_OnVolumeNotification);
            }
            else
            {
                this.spkrVolumeControlID = MM.GetControlID(spkrComponent, spkrVolumeControl);
                this.spkrMuteControlID   = MM.GetControlID(spkrComponent, spkrMuteControl);

                if (this.spkrVolumeControlID > 0)
                {
                    ok = true;

                    int v = MM.GetVolume(spkrVolumeControl, spkrComponent);
                    this.currentVolume = ConvertToPercentage(v);

                    this.hwnd = new Hwnd(WndProc);
                    int iw = (int)this.hwnd.Handle;

                    // ... and we can now activate the message monitor
                    bool b = MM.MonitorControl(iw);
                }
            }

            if (ok)
            {
                NotificationType            ntUp   = new NotificationType(ntNameVolumeUp);
                NotificationType            ntDown = new NotificationType(ntNameVolumeDown);
                NotificationType[]          types  = new NotificationType[] { ntUp, ntDown };
                Growl.Connector.Application app    = new Growl.Connector.Application(appName);
                app.Icon = Properties.Resources.volumeter;

                this.growl = new GrowlConnector();
                this.growl.EncryptionAlgorithm = Cryptography.SymmetricAlgorithmType.PlainText;
                this.growl.Register(app, types);

                this.timer           = new System.Timers.Timer(buffer);
                this.timer.AutoReset = false;
                this.timer.Elapsed  += new System.Timers.ElapsedEventHandler(timer_Elapsed);
            }
            else
            {
                MessageBox.Show("No speaker/line out component found to monitor");
            }
        }
Example #7
0
        static NotificationQueue()
        {
            growl = new GrowlConnector();
            growl.EncryptionAlgorithm = Cryptography.SymmetricAlgorithmType.PlainText;

            queue = new Queue <QueuedNotification>();

            timer           = new Timer(INTERVAL * 1000);
            timer.AutoReset = true;
            timer.Elapsed  += new ElapsedEventHandler(timer_Elapsed);
        }
Example #8
0
        public static void SimpleGrowl(string title, string message = "")
        {
            GrowlConnector   simpleGrowl     = new GrowlConnector();
            Application      thisApp         = new Application(AppDeployment.Instance.AppSetting("ApplicationName", "Oem Advantage"));
            NotificationType simpleGrowlType = new NotificationType("ERROR");

            simpleGrowl.Register(thisApp, new[] { simpleGrowlType });
            Notification myGrowl = new Notification(AppDeployment.Instance.AppSetting("ApplicationName", "Oem Advantage"), "ERROR", title, title, message);

            simpleGrowl.Notify(myGrowl);
        }
        private void Test_Register(string testName, Growl.Connector.Application app, List <NotificationType> types, Cryptography.SymmetricAlgorithmType ea, Cryptography.HashAlgorithmType ha)
        {
            GrowlConnector g = new GrowlConnector(this.textBox2.Text);

            g.EncryptionAlgorithm = ea;
            g.KeyHashAlgorithm    = ha;

            //string r = g.Register(app, types.ToArray());

            //WriteTestRequest(r);
        }
Example #10
0
        public void RunStarted(string name, int testCount)
        {
            m_isFirstTestFailed   = false;
            m_lastTestRunFullName = name;

            if (m_growlConnector == null || !GrowlConnector.IsGrowlRunningLocally())
            {
                return;
            }

            NotifyTestRunStarted(name, testCount);
        }
Example #11
0
        public static void simpleGrowl(string title, string message = "")
        {
            GrowlConnector simpleGrowl = new GrowlConnector();

            Growl.Connector.Application thisApp         = new Growl.Connector.Application(System.Windows.Forms.Application.ProductName);
            NotificationType            simpleGrowlType = new NotificationType("SIMPLEGROWL");

            simpleGrowl.Register(thisApp, new NotificationType[] { simpleGrowlType });
            Notification myGrowl = new Notification(System.Windows.Forms.Application.ProductName, "SIMPLEGROWL", title, title, message);

            simpleGrowl.Notify(myGrowl);
        }
Example #12
0
        public GrowlNotification(ConfigurationDictionary configuration)
        {
            this.configuration = configuration;

            growlConnector = new GrowlConnector();

            Application growlApplication = new Application(Constants.ApplicationName);

            growlConnector.Register(growlApplication, new NotificationType[] {
                new NotificationType(NotificationName, "Incoming Message")
            });
        }
Example #13
0
        void Initialize()
        {
            notificationType = new NotificationType("BUILD_RESULT_NOTIFICATION", "Sample Notification");
            application      = new Application("Giles");
            growl            = new GrowlConnector
            {
                EncryptionAlgorithm = Cryptography.SymmetricAlgorithmType.PlainText
            };


            growl.Register(application, new[] { notificationType });
        }
Example #14
0
        private GrowlNotifier()
        {
            _connector = new GrowlConnector();

            NotificationType buildNotificationType          = new NotificationType("DoneBuildingSolution", "Done Building Solution", icon.build_icon.ToBitmap(), true);
            NotificationType solutionLoadedNotificationType = new NotificationType("SolutionLoaded", "Solution Loaded", icon.build_icon.ToBitmap(), true);

            _connector.Register(new Application("Build Monitor")
            {
                Icon = icon.build_icon.ToBitmap()
            }, new[] { buildNotificationType, solutionLoadedNotificationType });
        }
Example #15
0
        private void Form1_Load(object sender, EventArgs e)
        {
            this.notificationType = new NotificationType(sampleNotificationType, "Sample Notification");

            this.growl = new GrowlConnector();
            //this.growl = new GrowlConnector("password");    // use this if you need to set a password - you can also pass null or an empty string to this constructor to use no password
            //this.growl = new GrowlConnector("password", "hostname", GrowlConnector.TCP_PORT);   // use this if you want to connect to a remote Growl instance on another machine

            this.growl.NotificationCallback += new GrowlConnector.CallbackEventHandler(growl_NotificationCallback);

            // set this so messages are sent in plain text (easier for debugging)
            this.growl.EncryptionAlgorithm = Cryptography.SymmetricAlgorithmType.PlainText;
        }
Example #16
0
        private void InitializeGrowl()
        {
            this.app      = new Growl.Connector.Application("Feed Monitor");
            this.app.Icon = new BinaryData(ImageConverter.ImageToBytes(global::GrowlExtras.FeedMonitor.Properties.Resources.feed.ToBitmap()));

            this.ntNewFeedItem = new NotificationType("New Feed Item", "New Feed Item");
            this.ntFeedError   = new NotificationType("Feed Error", "Feed Error");

            this.growl = new GrowlConnector();
            this.growl.EncryptionAlgorithm = Cryptography.SymmetricAlgorithmType.PlainText;

            this.growl.Register(this.app, new NotificationType[] { this.ntNewFeedItem, this.ntFeedError });
        }
Example #17
0
        /// <summary>
        /// Initializes the GrowlCommunicator
        /// </summary>
        private static void Initialize()
        {
            if (growl == null)
            {
                growl = new GrowlConnector
                {
                    EncryptionAlgorithm = Cryptography.SymmetricAlgorithmType.PlainText
                };

                application = new Application("Handbrake")
                {
                    Icon = Properties.Resources.logo64
                };
            }
        }
        public GrowlNotifier()
        {
            notificationType = new NotificationType(sampleNotificationType, "Network ARP change notification");

            growl = new GrowlConnector();
            //this.growl = new GrowlConnector("password");    // use this if you need to set a password - you can also pass null or an empty string to this constructor to use no password
            //this.growl.NotificationCallback += new GrowlConnector.CallbackEventHandler(growl_NotificationCallback);
            // set this so messages are sent in plain text (easier for debugging)

            growl.EncryptionAlgorithm = Cryptography.SymmetricAlgorithmType.PlainText;

            application = new Application("MacNotifier");

            growl.Register(application, new NotificationType[] { notificationType });
        }
Example #19
0
 public void CreateRegester2()
 {
     var pass = "******";
     var sender = new GrowlConnector(pass, "CreateMessageTest", 12345);
     var note = new Notification("AppName", "NoteName", "id12345", "title", "text");
     bool waitForCallback;
     var mb = sender.CreateNotify(note, null, null, out waitForCallback);
     var message = Encoding.UTF8.GetString(mb.GetBytes());
     var match = Regex.Match(message, @"SHA1:([0-9A-F]+).([0-9A-F]+)");
     Assert.IsTrue(match.Success);
     var hash = match.Groups[1].Value;
     var salt = match.Groups[2].Value;
     Key matchKey;
     Assert.IsTrue(Key.Compare(pass, hash, salt, Cryptography.HashAlgorithmType.SHA1, Cryptography.SymmetricAlgorithmType.PlainText, out matchKey));
 }
 void timer_Tick(object sender, EventArgs e)
 {
     try
     {
         timer.Stop();
         if (started && !GrowlConnector.IsGrowlRunningLocally())
         {
             Win32.PostMessage(this.hwnd.Handle, MSG_STOP, IntPtr.Zero, IntPtr.Zero);
         }
     }
     catch {}
     finally
     {
         timer.Start();
     }
 }
Example #21
0
        public GrowlListener(string appName)
        {
            _appName = appName;

            _cnn = new GrowlConnector();
            _cnn.Register(new Application(_appName), new NotificationType[]
            {
                Notifier(L4j.Off),
                Notifier(L4j.Fatal),
                Notifier(L4j.Error),
                Notifier(L4j.Warn),
                Notifier(L4j.Info),
                Notifier(L4j.Debug),
                Notifier(L4j.Trace)
            });
        }
Example #22
0
        /// <summary>
        /// Initializes the GrowlCommunicator
        /// </summary>
        private static void Initialize()
        {
            if (growl == null)
            {
                growl = new GrowlConnector();
                growl.EncryptionAlgorithm = Cryptography.SymmetricAlgorithmType.PlainText;

                application      = new Application("Witty");
                application.Icon = global::Witty.Properties.Resources.AppIcon.ToBitmap();

                NewTweet         = new NotificationType("New Tweet");
                NewTweetsSummary = new NotificationType("New Tweets Summary");
                NewReply         = new NotificationType("New Reply/Mention");
                NewDirectMessage = new NotificationType("New Direct Message");
            }
        }
Example #23
0
        public GrowlTrayAppContext()

            : base()

        {
            this.hwnd = new Hwnd(WndProc);



            NotificationType ntInfo = new NotificationType(ntNameInfo, ntNameInfo, Properties.Resources.info, true);

            NotificationType ntWarning = new NotificationType(ntNameWarning, ntNameWarning, Properties.Resources.warning, true);

            NotificationType ntError = new NotificationType(ntNameError, ntNameError, Properties.Resources.error, true);

            NotificationType ntOther = new NotificationType(ntNameOther, ntNameOther, Properties.Resources.windows, true);



            NotificationType[] types = new NotificationType[] { ntInfo, ntWarning, ntError, ntOther };

            Growl.Connector.Application app = new Growl.Connector.Application(appName);

            app.Icon = Properties.Resources.windows;



            this.growl = new GrowlConnector();

            this.growl.EncryptionAlgorithm = Cryptography.SymmetricAlgorithmType.PlainText;

            this.growl.NotificationCallback += new GrowlConnector.CallbackEventHandler(growl_NotificationCallback);

            if (GROWL)
            {
                this.growl.Register(app, types);
            }



            timer = new Timer();

            timer.Interval = 5 * 1000;

            timer.Tick += new EventHandler(timer_Tick);
        }
Example #24
0
        public void RunFinished(Exception exception)
        {
            #region Argument Check

            if (exception == null)
            {
                throw new ArgumentNullException("exception");
            }

            #endregion

            if (m_growlConnector == null || !GrowlConnector.IsGrowlRunningLocally())
            {
                return;
            }

            NotifyTestRunFailure(exception);
        }
Example #25
0
        private void WndProc(ref Message m)

        {
            //System.Diagnostics.Debug.WriteLine(String.Format("{0} - {1} - {2}", m.Msg, m.WParam, m.WParam));



            // close down if we were abandonded

            if (m.Msg == (int)MSG_STOP || m.Msg == (int)Win32.WM_CLOSE || m.Msg == (int)Win32.WM_QUIT)

            {
                Log("Close message received - stopping Growl Tray");

                Stop();
            }

            else if (GROWL && started && !GrowlConnector.IsGrowlRunningLocally())

            {
                Win32.PostMessage(this.hwnd.Handle, MSG_STOP, IntPtr.Zero, IntPtr.Zero);
            }

            else if (m.Msg == (int)Win32.WM_COPYDATA)

            {
                Win32.COPYDATASTRUCT cds = new Win32.COPYDATASTRUCT();

                cds = (Win32.COPYDATASTRUCT)m.GetLParam(typeof(Win32.COPYDATASTRUCT));

                try

                {
                    HandleCopyData(m.HWnd, m.WParam, cds);
                }

                catch (Exception ex)

                {
                    Log(ex.ToString());
                }
            }
        }
Example #26
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="NUnitGrowlAddIn"/> class.
        /// </summary>
        public NUnitGrowlAddIn()
        {
            m_growlConnector = new GrowlConnector();
            if (!GrowlConnector.IsGrowlRunningLocally())
            {
                return;
            }

            m_growlApplication = new Application("NUnit");
            NotificationType[] notificationTypes = new NotificationType[]
            {
                new NotificationType(c_testRunStarted),
                new NotificationType(c_testRunSucceeded),
                new NotificationType(c_testRunFailed),
                new NotificationType(c_testRunFirstTestFailed)
            };

            m_growlConnector.Register(m_growlApplication, notificationTypes);
        }
Example #27
0
 public void CreateRegester3()
 {
     var pass = "******";
     var sender = new GrowlConnector(pass, "CreateMessageTest", 12345);
     sender.KeyHashAlgorithm = Cryptography.HashAlgorithmType.SHA256;
     sender.EncryptionAlgorithm = Cryptography.SymmetricAlgorithmType.AES;
     var note = new Notification("AppName", "NoteName", "id12345", "title", "text");
     bool waitForCallback;
     var mb = sender.CreateNotify(note, null, null, out waitForCallback);
     var message = Encoding.UTF8.GetString(mb.GetBytes());
     var matchHash = regExMessageHeader_Remote.Match(message);
     Assert.IsTrue(matchHash.Success);
     Assert.AreEqual("AES", matchHash.Groups["EncryptionAlgorithm"].Value);
     Assert.AreEqual("SHA256", matchHash.Groups["KeyHashAlgorithm"].Value);
     var iv = matchHash.Groups["IV"].Value;
     var hash = matchHash.Groups["KeyHash"].Value;
     var salt = matchHash.Groups["Salt"].Value;
     Key matchKey;
     Assert.IsTrue(Key.Compare(pass, hash, salt, Cryptography.HashAlgorithmType.SHA256, Cryptography.SymmetricAlgorithmType.AES, out matchKey));
 }
Example #28
0
        void Initialize()
        {
            informationNotificationType = new NotificationType("BUILD_RESULT_NOTIFICATION", "Sample Notification");
            successNotificationType     = new NotificationType("SUCCESS_NOTIFICATION", "Success Notification");
            failureNotificationType     = new NotificationType("FAILURE_NOTIFICATION", "Failure Notification");

            application = new Application("Giles");
            growl       = new GrowlConnector
            {
                EncryptionAlgorithm = Cryptography.SymmetricAlgorithmType.PlainText
            };


            growl.Register(application,
                           new[] {
                informationNotificationType,
                successNotificationType,
                failureNotificationType
            });
        }
Example #29
0
        private void RegisterApplication()
        {
            if (string.IsNullOrEmpty(GrowlConfig.Host))
            {
                growl = new GrowlConnector(GrowlConfig.Password);
            }
            else
            {
                growl = new GrowlConnector(GrowlConfig.Password, GrowlConfig.Host, int.Parse(GrowlConfig.Port, CultureInfo.CurrentCulture));
            }

            growl.EncryptionAlgorithm = Cryptography.SymmetricAlgorithmType.PlainText;

            application      = new Application("uTorrent Notifier");
            application.Icon = GetIconData(Resources.utorrent_icon);

            added    = new NotificationType("Added", "Torrent Added", GetIconData(Resources.utorrent_icon_added), true);
            complete = new NotificationType("Complete", "Download Complete", GetIconData(Resources.utorrent_icon_complete), true);
            error    = new NotificationType("Error", "uTorrent Error", GetIconData(Resources.utorrent_icon_error), true);

            growl.Register(application, new NotificationType[] { added, complete, error });
        }
Example #30
0
        /// <summary>
        /// Initializes a new instance of the <see cref="T:System.Object"/> class.
        /// </summary>
        public GrowlConnection(GrowlConfiguration config)
        {
            myConfig = config;

            // create the growl connection and register it
            if (!string.IsNullOrEmpty(config.Password))
            {
                myConnector = !string.IsNullOrEmpty(config.Hostname)
                                  ? new GrowlConnector(config.Password, config.Hostname, config.Port)
                                  : new GrowlConnector(config.Password);
            }
            else
            {
                myConnector = new GrowlConnector();
            }

            var application = new Application(config.AppId);

            // use the defaul icon if no override set
            if (string.IsNullOrEmpty(config.IconFile))
            {
                config.IconFile = DEFAULT_ICON;
            }
            var icon = new SmartLocation(config.IconFile);

            if (File.Exists(icon.Location))
            {
                application.Icon = icon.Location;
            }

            var healthCheck = new NotificationType(config.NotificationId, config.NotificationTitle);

            myConnector.Register(application,
                                 new[]
            {
                healthCheck
            });
        }
Example #31
0
        public static void growlSetup()
        {
            notificationType = new NotificationType(sampleNotificationType, "Hunt Notification");

            if (Settings.Default.remoteGrowlIp != "")
            {
                growl = new GrowlConnector(Settings.Default.growlPassword, Settings.Default.remoteGrowlIp, GrowlConnector.TCP_PORT);
            }
            else
            {
                growl = new GrowlConnector(Settings.Default.growlPassword);
            }

            //growl = new GrowlConnector("password");    // use this if you need to set a password - you can also pass null or an empty string to this constructor to use no password
            //growl = new GrowlConnector("password", "hostname", GrowlConnector.TCP_PORT);   // use this if you want to connect to a remote Growl instance on another machine

            growl.NotificationCallback += new GrowlConnector.CallbackEventHandler(growlNotificationCallback);

            // set this so messages are sent in plain text (easier for debugging)
            growl.EncryptionAlgorithm = Cryptography.SymmetricAlgorithmType.PlainText;

            application = new Growl.Connector.Application(growlApplicationName);
        }
        public Form1()
        {
            InitializeComponent();

            log4net.Config.XmlConfigurator.Configure();

            textBox1.Text = ConfigurationManager.AppSettings["Path"];
            _application  = new Application(ApplicationName);

            _workerFiber = new PoolFiber();
            _workerFiber.Start();

            _importar = new Channel <string>();
            _importar.Subscribe(_workerFiber, Work);

            _notificationType = new NotificationType(SampleNotificationType, "Sample Notification");

            _growl = new GrowlConnector {
                EncryptionAlgorithm = Cryptography.SymmetricAlgorithmType.AES
            };
            _growl.NotificationCallback += GrowlNotificationCallback;
            _growl.Register(_application, new[] { _notificationType });

            folderWatch.Created += FolderWatchCreated;
            folderWatch.Renamed += FolderWatchRenamed;
            folderWatch.Deleted += FolderWatchDeleted;

            InitDatabase();

            if (!_autostart)
            {
                return;
            }

            Operar(true, true);
        }
        /// <summary>
        /// Checks to see if Growl is currently running on the local machine.
        /// </summary>
        /// <returns>
        /// <c>true</c> if Growl is running;
        /// <c>false</c> otherwise
        /// </returns>
        public static bool IsRunning()
        {
            Initialize();

            return(GrowlConnector.IsGrowlRunningLocally());
        }