public static void ReadFromDisk(ref List <InternalNotification> notifications)

        {
            try

            {
                SettingSaver ss = new SettingSaver(FILENAME);

                List <InternalNotification> notificationFromDisk = (List <InternalNotification>)ss.Load();

                if (notifications == null)
                {
                    notifications = new List <InternalNotification>();
                }

                if (notificationFromDisk != null)

                {
                    notifications.AddRange(notificationFromDisk);

                    notificationFromDisk.Clear();

                    notificationFromDisk = null;
                }

                System.IO.File.Delete(ss.Path);

                ss = null;
            }

            catch

            {
            }
        }
 public static void SaveToDisk(ref List<InternalNotification> notifications)
 {
     try
     {
         SettingSaver ss = new SettingSaver(FILENAME);
         ss.Save(notifications);
         ss = null;
     }
     catch
     {
     }
 }
 public static void SaveToDisk(ref List <InternalNotification> notifications)
 {
     try
     {
         SettingSaver ss = new SettingSaver(FILENAME);
         ss.Save(notifications);
         ss = null;
     }
     catch
     {
     }
 }
 public static void ReadFromDisk(ref List<InternalNotification> notifications)
 {
     try
     {
         SettingSaver ss = new SettingSaver(FILENAME);
         List<InternalNotification> notificationFromDisk = (List<InternalNotification>)ss.Load();
         if (notifications == null) notifications = new List<InternalNotification>();
         if (notificationFromDisk != null)
         {
             notifications.AddRange(notificationFromDisk);
             notificationFromDisk.Clear();
             notificationFromDisk = null;
         }
         System.IO.File.Delete(ss.Path);
         ss = null;
     }
     catch
     {
     }
 }
Exemplo n.º 5
0
        internal void Initialize(string appPath, System.ComponentModel.ISynchronizeInvoke synchronizingObject)
        {
            this.appPath = appPath;
            this.synchronizingObject = synchronizingObject;

            this.historyFolder = Growl.CoreLibrary.PathUtility.Combine(Utility.UserSettingFolder, @"History\");
            PastNotificationManager.HistoryFolder = this.historyFolder;

            string imageCacheFolder = Growl.CoreLibrary.PathUtility.Combine(Utility.UserSettingFolder, @"ImageCache\");
            ImageCache.CacheFolder = imageCacheFolder;

            // handle any upgrade logic
            bool upgrade = (Growl.Properties.Settings.Default.SettingsVersion < 2);
            if (upgrade)
            {
                Utility.WriteDebugInfo("UPGRADE INITIATED");

                SettingSaver raSettingSaver = new SettingSaver(REGISTERED_APPLICATIONS_SETTINGS_FILENAME, LegacyDeserializers.LegacyDeserializationHelper.OldApplicationsHelper);
                raSettingSaver.Save(raSettingSaver.Load());

                SettingSaver fcSettingSaver = new SettingSaver(FORWARD_COMPUTERS_SETTINGS_FILENAME, LegacyDeserializers.LegacyDeserializationHelper.OldForwardDestinationHelper);
                fcSettingSaver.Save(fcSettingSaver.Load());

                SettingSaver sbSettingSaver = new SettingSaver(SUBSCRIPTIONS_SETTINGS_FILENAME, LegacyDeserializers.LegacyDeserializationHelper.OldSubscriptionHelper);
                sbSettingSaver.Save(sbSettingSaver.Load());

                PastNotificationManager.DeleteHistory();

                Growl.Properties.Settings.Default.SettingsVersion = 2;

                Utility.WriteDebugInfo(String.Format("UPGRADE COMPLETED - NOW AT VERSION: {0}", Growl.Properties.Settings.Default.SettingsVersion));
            }

            DisplayStyleManager.DisplayLoaded += new DisplayStyleManager.DisplayLoadedEventHandler(DisplayStyleManager_DisplayLoaded);

            LoadPasswords();
            LoadMiscPrefs();
            LoadDisplays();     // this could take a long time as well, but other things depend on it so we have to do it synchronously and just wait
            LoadApplications();
            LoadForwardedComputers();
            LoadSubscriptions();

            // this must come *after* LoadForwardedComputers has ran
            StartBonjour();

            this.activityMonitor = new ActivityMonitor();
            this.activityMonitor.WentIdle += new ActivityMonitor.ActivityMonitorEventHandler(activityMonitor_WentIdle);
            this.activityMonitor.ResumedActivity += new ActivityMonitor.ActivityMonitorEventHandler(activityMonitor_ResumedActivity);
            this.activityMonitor.StillActive += new EventHandler(activityMonitor_StillActive);
            this.activityMonitor.CheckForIdle = Properties.Settings.Default.CheckForIdle;
            this.activityMonitor.IdleAfterSeconds = Properties.Settings.Default.IdleAfterSeconds;
        }