-\r
- public void Upgrade()\r
- {\r
- UpgradeSettings(ref Settings);\r
- UpgradeParameterArray(ref RepeatIntervals);\r
- UpgradeParameterArray(ref PreliminaryPeriods);\r
- }\r
-\r
- private void UpgradeSettings(ref NotificationType[] settings)\r
- {\r
- for (var i = 0; i < settings.Length; i++)\r
- {\r
- if ((settings[i] & NotificationType.Pushbullet) != 0)\r
- settings[i] = settings[i] ^ NotificationType.Pushbullet | NotificationType.Push;\r
- }\r
- var expected = Config.NotificationNames.Length;\r
- if (expected == settings.Length)\r
- return;\r
- Array.Resize(ref settings, expected);\r
- settings[expected - 1] = NotificationType.All;\r
- }\r
-\r
- private void UpgradeParameterArray(ref int[] array)\r
- {\r
- Array.Resize(ref array, Config.NotificationNames.Length);\r
- for (var i = 0; i < array.Length; i++)\r
- {\r
- if (array[i] < 0)\r
- array[i] = 0;\r
- }\r
- }\r