Applied some preprocessing to RecurrencePatterns before evaluation for additional accuracy.

--- New/DDay.iCal/Evaluation/RecurrencePatternEvaluator.cs
+++ New/DDay.iCal/Evaluation/RecurrencePatternEvaluator.cs
@@ -21,12 +21,57 @@

         public RecurrencePatternEvaluator(IRecurrencePattern pattern)
 	    {
-            Pattern = pattern;
+            Pattern = pattern;
 	    }

         #endregion

         #region Private Methods
+
+        private IRecurrencePattern ProcessRecurrencePattern(IDateTime referenceDate)
+        {
+            RecurrencePattern r = new RecurrencePattern();
+            r.CopyFrom(Pattern);
+
+            // If the frequency is weekly, and
+            // no day of week is specified, use
+            // the original date's day of week.
+            // NOTE: fixes RRULE7 and RRULE8 handling
+            if (r.Frequency == FrequencyType.Weekly &&
+                r.ByDay.Count == 0)
+                r.ByDay.Add(new WeekDay(referenceDate.DayOfWeek));
+            if (r.Frequency > FrequencyType.Secondly &&
+                r.BySecond.Count == 0 &&
+                referenceDate.HasTime /* NOTE: Fixes a bug where all-day events have BySecond/ByMinute/ByHour added incorrectly */)
+                r.BySecond.Add(referenceDate.Second);
+            if (r.Frequency > FrequencyType.Minutely &&
+                r.ByMinute.Count == 0 &&
+                referenceDate.HasTime /* NOTE: Fixes a bug where all-day events have BySecond/ByMinute/ByHour added incorrectly */)
+                r.ByMinute.Add(referenceDate.Minute);
+            if (r.Frequency > FrequencyType.Hourly &&
+                r.ByHour.Count == 0 &&
+                referenceDate.HasTime /* NOTE: Fixes a bug where all-day events have BySecond/ByMinute/ByHour added incorrectly */)
+                r.ByHour.Add(referenceDate.Hour);
+            // If neither BYDAY, BYMONTHDAY, or BYYEARDAY is specified,
+            // default to the current day of month
+            // NOTE: fixes RRULE23 handling, added BYYEARDAY exclusion
+            // to fix RRULE25 handling
+            if (r.Frequency > FrequencyType.Weekly &&
+                r.ByMonthDay.Count == 0 &&
+                r.ByYearDay.Count == 0 &&
+                r.ByDay.Count == 0)
+                r.ByMonthDay.Add(referenceDate.Day);
+            // If neither BYMONTH nor BYYEARDAY is specified, default to
+            // the current month
+            // NOTE: fixes RRULE25 handling
+            if (r.Frequency > FrequencyType.Monthly &&
+                r.ByYearDay.Count == 0 &&
+                r.ByDay.Count == 0 &&
+                r.ByMonth.Count == 0)
+                r.ByMonth.Add(referenceDate.Month);
+
+            return r;
+        }

         /**
          * Returns a list of start dates in the specified period represented by this recur. Any date fields not specified by
@@ -37,9 +82,9 @@
          * @param value the type of dates to generate (i.e. date/date-time)
          * @return a list of dates
          */
-        private List<DateTime> GetDates(DateTime periodStart, DateTime periodEnd)
-        {
-            return GetDates(new iCalDateTime(periodStart), periodStart, periodEnd, -1);
+        private List<DateTime> GetDates(DateTime periodStart, DateTime periodEnd, IRecurrencePattern pattern)
+        {
+            return GetDates(new iCalDateTime(periodStart), periodStart, periodEnd, -1, pattern);
         }

         /**
@@ -49,9 +94,9 @@
          * @param value type of dates to generate
          * @return a list of dates
          */
-        private List<DateTime> GetDates(IDateTime seed, IPeriod period)
-        {
-            return GetDates(seed, DateUtil.GetSimpleDateTimeData(period.StartTime), DateUtil.GetSimpleDateTimeData(period.EndTime), -1);
+        private List<DateTime> GetDates(IDateTime seed, IPeriod period, IRecurrencePattern pattern)
+        {
+            return GetDates(seed, DateUtil.GetSimpleDateTimeData(period.StartTime), DateUtil.GetSimpleDateTimeData(period.EndTime), -1, pattern);
         }

         /**
@@ -66,9 +111,9 @@
          * @param periodEnd the end of the period
          * @param value the type of dates to generate (i.e. date/date-time)
          */
-        private List<DateTime> GetDates(IDateTime seed, DateTime periodStart, DateTime periodEnd)
-        {
-             return GetDates(seed, periodStart, periodEnd, -1);
+        private List<DateTime> GetDates(IDateTime seed, DateTime periodStart, DateTime periodEnd, IRecurrencePattern pattern)
+        {
+             return GetDates(seed, periodStart, periodEnd, -1, pattern);
         }

         /**
@@ -85,9 +130,8 @@
          * @param maxCount limits the number of instances returned. Up to one years
          *       worth extra may be returned. Less than 0 means no limit
          */
-        private List<DateTime> GetDates(IDateTime seed, DateTime periodStart, DateTime periodEnd, int maxCount)
-        {
-            IRecurrencePattern r = Pattern;
+        private List<DateTime> GetDates(IDateTime seed, DateTime periodStart, DateTime periodEnd, int maxCount, IRecurrencePattern pattern)
+        {
             List<DateTime> dates = new List<DateTime>();

             DateTime seedCopy = DateUtil.GetSimpleDateTimeData(seed);
@@ -96,7 +140,7 @@
             if (Pattern.Count == int.MinValue)
             {
                 while (seedCopy < periodStart)
-                    IncrementDate(ref seedCopy, r, r.Interval);
+                    IncrementDate(ref seedCopy, pattern, pattern.Interval);
             }

             int invalidCandidateCount = 0;
@@ -104,16 +148,16 @@
             DateTime candidate = DateTime.MinValue;
             while ((maxCount < 0) || (dates.Count < maxCount))
             {
-                if (r.Until != null && candidate != DateTime.MinValue && candidate > r.Until.Value)
+                if (pattern.Until != null && candidate != DateTime.MinValue && candidate > pattern.Until.Value)
                     break;

                 if (periodEnd != null && candidate != DateTime.MinValue && candidate > periodEnd)
                     break;

-                if (r.Count >= 1 && (dates.Count + invalidCandidateCount) >= r.Count)
+                if (pattern.Count >= 1 && (dates.Count + invalidCandidateCount) >= pattern.Count)
                     break;

-                List<DateTime> candidates = GetCandidates(seedCopy);
+                List<DateTime> candidates = GetCandidates(seedCopy, pattern);
                 if (candidates.Count > 0)
                 {
                     noCandidateIncrementCount = 0;
@@ -133,11 +177,11 @@
                             {
                                 invalidCandidateCount++;
                             }
-                            else if (r.Count >= 1 && (dates.Count + invalidCandidateCount) >= r.Count)
+                            else if (pattern.Count >= 1 && (dates.Count + invalidCandidateCount) >= pattern.Count)
                             {
                                 break;
                             }
-                            else if (!(r.Until != null && candidate > r.Until.Value))
+                            else if (!(pattern.Until != null && candidate > pattern.Until.Value))
                             {
                                 dates.Add(candidate);
                             }
@@ -151,7 +195,7 @@
                         break;
                 }

-                IncrementDate(ref seedCopy, r, r.Interval);
+                IncrementDate(ref seedCopy, pattern, pattern.Interval);
             }

             // sort final list..
@@ -169,16 +213,15 @@
          * @param seed the start date of this Recurrence's first instance
          * @param startDate the date to start the search
          */
-        private DateTime? GetNextDate(IDateTime seed, DateTime startDate)
-        {
-            IRecurrencePattern r = Pattern;
+        private DateTime? GetNextDate(IDateTime seed, DateTime startDate, IRecurrencePattern pattern)
+        {
             DateTime seedCopy = DateUtil.GetSimpleDateTimeData(seed);
             // optimize the start time for selecting candidates
             // (only applicable where a COUNT is not specified)
             if (Pattern.Count == int.MinValue)
             {
                 while (seedCopy < startDate)
-                    IncrementDate(ref seedCopy, r, r.Interval);
+                    IncrementDate(ref seedCopy, pattern, pattern.Interval);
             }

             int invalidCandidateCount = 0;
@@ -187,13 +230,13 @@

             while (true)
             {
-                if (r.Until != null && candidate != DateTime.MinValue && candidate > r.Until.Value)
+                if (pattern.Until != null && candidate != DateTime.MinValue && candidate > pattern.Until.Value)
                     break;

-                if (r.Count > 0 && invalidCandidateCount >= r.Count)
+                if (pattern.Count > 0 && invalidCandidateCount >= pattern.Count)
                     break;

-                List<DateTime> candidates = GetCandidates(seedCopy);
+                List<DateTime> candidates = GetCandidates(seedCopy, pattern);
                 if (candidates.Count > 0)
                 {
                     noCandidateIncrementCount = 0;
@@ -214,11 +257,11 @@
                             {
                                 invalidCandidateCount++;
                             }
-                            else if (r.Count > 0 && invalidCandidateCount >= r.Count)
+                            else if (pattern.Count > 0 && invalidCandidateCount >= pattern.Count)
                             {
                                 break;
                             }
-                            else if (!(r.Until != null && candidate > r.Until.Value))
+                            else if (!(pattern.Until != null && candidate > pattern.Until.Value))
                             {
                                 return candidate;
                             }
@@ -232,7 +275,7 @@
                         break;
                 }

-                IncrementDate(ref seedCopy, r, r.Interval);
+                IncrementDate(ref seedCopy, pattern, pattern.Interval);
             }
             return null;
         }
@@ -243,19 +286,19 @@
          * @param value the type of date list to return
          * @return a DateList
          */
-        private List<DateTime> GetCandidates(DateTime date)
+        private List<DateTime> GetCandidates(DateTime date, IRecurrencePattern pattern)
         {
             List<DateTime> dates = new List<DateTime>();
             dates.Add(date);
-            dates = GetMonthVariants(dates);
-            dates = GetWeekNoVariants(dates);
-            dates = GetYearDayVariants(dates);
-            dates = GetMonthDayVariants(dates);
-            dates = GetDayVariants(dates);
-            dates = GetHourVariants(dates);
-            dates = GetMinuteVariants(dates);
-            dates = GetSecondVariants(dates);
-            dates = ApplySetPosRules(dates);
+            dates = GetMonthVariants(dates, pattern);
+            dates = GetWeekNoVariants(dates, pattern);
+            dates = GetYearDayVariants(dates, pattern);
+            dates = GetMonthDayVariants(dates, pattern);
+            dates = GetDayVariants(dates, pattern);
+            dates = GetHourVariants(dates, pattern);
+            dates = GetMinuteVariants(dates, pattern);
+            dates = GetSecondVariants(dates, pattern);
+            dates = ApplySetPosRules(dates, pattern);
             return dates;
         }

@@ -264,12 +307,10 @@
          * positions are ignored.
          * @param dates
          */
-        private List<DateTime> ApplySetPosRules(List<DateTime> dates)
-        {
-            IRecurrencePattern r = Pattern;
-
+        private List<DateTime> ApplySetPosRules(List<DateTime> dates, IRecurrencePattern pattern)
+        {
             // return if no SETPOS rules specified..
-            if (r.BySetPosition.Count == 0)
+            if (pattern.BySetPosition.Count == 0)
                 return dates;

             // sort the list before processing..
@@ -278,9 +319,9 @@
             List<DateTime> setPosDates = new List<DateTime>();
             int size = dates.Count;

-            for (int i = 0; i < r.BySetPosition.Count; i++)
-            {
-                int pos = r.BySetPosition[i];
+            for (int i = 0; i < pattern.BySetPosition.Count; i++)
+            {
+                int pos = pattern.BySetPosition[i];
                 if (pos > 0 && pos <= size)
                 {
                     setPosDates.Add(dates[pos - 1]);
@@ -299,19 +340,18 @@
          * @param dates
          * @return
          */
-        private List<DateTime> GetMonthVariants(List<DateTime> dates)
-        {
-            IRecurrencePattern r = Pattern;
-            if (r.ByMonth.Count == 0)
+        private List<DateTime> GetMonthVariants(List<DateTime> dates, IRecurrencePattern pattern)
+        {
+            if (pattern.ByMonth.Count == 0)
                 return dates;

             List<DateTime> monthlyDates = new List<DateTime>();
             for (int i = 0; i < dates.Count; i++)
             {
                 DateTime date = dates[i];
-                for (int j = 0; j < r.ByMonth.Count; j++)
-                {
-                    int month = r.ByMonth[j];
+                for (int j = 0; j < pattern.ByMonth.Count; j++)
+                {
+                    int month = pattern.ByMonth[j];
                     date = date.AddMonths(month - date.Month);
                     monthlyDates.Add(date);
                 }
@@ -325,23 +365,22 @@
          * @param dates
          * @return
          */
-        private List<DateTime> GetWeekNoVariants(List<DateTime> dates)
-        {
-            IRecurrencePattern r = Pattern;
-            if (r.ByWeekNo.Count == 0)
+        private List<DateTime> GetWeekNoVariants(List<DateTime> dates, IRecurrencePattern pattern)
+        {
+            if (pattern.ByWeekNo.Count == 0)
                 return dates;

             List<DateTime> weekNoDates = new List<DateTime>();
             for (int i = 0; i < dates.Count; i++)
             {
                 DateTime date = dates[i];
-                for (int j = 0; j < r.ByWeekNo.Count; j++)
+                for (int j = 0; j < pattern.ByWeekNo.Count; j++)
                 {
                     // Determine our target week number
-                    int weekNo = r.ByWeekNo[j];
+                    int weekNo = pattern.ByWeekNo[j];

                     // Determine our current week number
-                    int currWeekNo = Calendar.GetWeekOfYear(date, CalendarWeekRule.FirstFourDayWeek, r.FirstDayOfWeek);
+                    int currWeekNo = Calendar.GetWeekOfYear(date, CalendarWeekRule.FirstFourDayWeek, pattern.FirstDayOfWeek);
                     while (currWeekNo > weekNo)
                     {
                         // If currWeekNo > weekNo, then we're likely at the start of a year
@@ -349,13 +388,13 @@
                         // we should be back to week 1, where we can easily make the calculation
                         // to move to weekNo.
                         date = date.AddDays(7);
-                        currWeekNo = Calendar.GetWeekOfYear(date, CalendarWeekRule.FirstFourDayWeek, r.FirstDayOfWeek);
+                        currWeekNo = Calendar.GetWeekOfYear(date, CalendarWeekRule.FirstFourDayWeek, pattern.FirstDayOfWeek);
                     }

                     // Move ahead to the correct week of the year
                     date = date.AddDays((weekNo - currWeekNo) * 7);
                     // Step backward single days until we're at the correct DayOfWeek
-                    while (date.DayOfWeek != r.FirstDayOfWeek)
+                    while (date.DayOfWeek != pattern.FirstDayOfWeek)
                         date = date.AddDays(-1);

                     for (int k = 0; k < 7; k++)
@@ -374,19 +413,18 @@
          * @param dates
          * @return
          */
-        private List<DateTime> GetYearDayVariants(List<DateTime> dates)
-        {
-            IRecurrencePattern r = Pattern;
-            if (r.ByYearDay.Count == 0)
+        private List<DateTime> GetYearDayVariants(List<DateTime> dates, IRecurrencePattern pattern)
+        {
+            if (pattern.ByYearDay.Count == 0)
                 return dates;

             List<DateTime> yearDayDates = new List<DateTime>();
             for (int i = 0; i < dates.Count; i++)
             {
                 DateTime date = dates[i];
-                for (int j = 0; j < r.ByYearDay.Count; j++)
-                {
-                    int yearDay = r.ByYearDay[j];
+                for (int j = 0; j < pattern.ByYearDay.Count; j++)
+                {
+                    int yearDay = pattern.ByYearDay[j];

                     DateTime newDate;
                     if (yearDay > 0)
@@ -406,19 +444,18 @@
          * @param dates
          * @return
          */
-        private List<DateTime> GetMonthDayVariants(List<DateTime> dates)
-        {
-            IRecurrencePattern r = Pattern;
-            if (r.ByMonthDay.Count == 0)
+        private List<DateTime> GetMonthDayVariants(List<DateTime> dates, IRecurrencePattern pattern)
+        {
+            if (pattern.ByMonthDay.Count == 0)
                 return dates;

             List<DateTime> monthDayDates = new List<DateTime>();
             for (int i = 0; i < dates.Count; i++)
             {
                 DateTime date = dates[i];
-                for (int j = 0; j < r.ByMonthDay.Count; j++)
-                {
-                    int monthDay = r.ByMonthDay[j];
+                for (int j = 0; j < pattern.ByMonthDay.Count; j++)
+                {
+                    int monthDay = pattern.ByMonthDay[j];

                     int daysInMonth = Calendar.GetDaysInMonth(date.Year, date.Month);
                     if (Math.Abs(monthDay) > daysInMonth)
@@ -443,30 +480,29 @@
          * @param dates
          * @return
          */
-        private List<DateTime> GetDayVariants(List<DateTime> dates)
-        {
-            IRecurrencePattern r = Pattern;
-            if (r.ByDay.Count == 0)
+        private List<DateTime> GetDayVariants(List<DateTime> dates, IRecurrencePattern pattern)
+        {
+            if (pattern.ByDay.Count == 0)
                 return dates;

             List<DateTime> weekDayDates = new List<DateTime>();
             for (int i = 0; i < dates.Count; i++)
             {
                 DateTime date = dates[i];
-                for (int j = 0; j < r.ByDay.Count; j++)
-                {
-                    IWeekDay weekDay = r.ByDay[j];
+                for (int j = 0; j < pattern.ByDay.Count; j++)
+                {
+                    IWeekDay weekDay = pattern.ByDay[j];

                     // if BYYEARDAY or BYMONTHDAY is specified filter existing
                     // list..
-                    if (r.ByYearDay.Count > 0 || r.ByMonthDay.Count > 0)
+                    if (pattern.ByYearDay.Count > 0 || pattern.ByMonthDay.Count > 0)
                     {
                         if (weekDay.Equals((WeekDay)date))
                             weekDayDates.Add(date);
                     }
                     else
                     {
-                        weekDayDates.AddRange(GetAbsWeekDays(date, weekDay));
+                        weekDayDates.AddRange(GetAbsWeekDays(date, weekDay, pattern));
                     }
                 }
             }
@@ -480,32 +516,31 @@
          * @param weekDay
          * @return
          */
-        private List<DateTime> GetAbsWeekDays(DateTime date, IWeekDay weekDay)
-        {
-            IRecurrencePattern r = Pattern;
+        private List<DateTime> GetAbsWeekDays(DateTime date, IWeekDay weekDay, IRecurrencePattern pattern)
+        {
             List<DateTime> days = new List<DateTime>();

             DayOfWeek dayOfWeek = weekDay.DayOfWeek;
-            if (r.Frequency == FrequencyType.Daily)
+            if (pattern.Frequency == FrequencyType.Daily)
             {
                 if (date.DayOfWeek == dayOfWeek)
                     days.Add(date);
             }
-            else if (r.Frequency == FrequencyType.Weekly || r.ByWeekNo.Count > 0)
-            {
-                int weekNo = Calendar.GetWeekOfYear(date, CalendarWeekRule.FirstFourDayWeek, r.FirstDayOfWeek);
+            else if (pattern.Frequency == FrequencyType.Weekly || pattern.ByWeekNo.Count > 0)
+            {
+                int weekNo = Calendar.GetWeekOfYear(date, CalendarWeekRule.FirstFourDayWeek, pattern.FirstDayOfWeek);

                 // construct a list of possible week days..
                 while (date.DayOfWeek != dayOfWeek)
                     date = date.AddDays(1);

-                while (Calendar.GetWeekOfYear(date, CalendarWeekRule.FirstFourDayWeek, r.FirstDayOfWeek) == weekNo)
+                while (Calendar.GetWeekOfYear(date, CalendarWeekRule.FirstFourDayWeek, pattern.FirstDayOfWeek) == weekNo)
                 {
                     days.Add(date);
                     date = date.AddDays(7);
                 }
             }
-            else if (r.Frequency == FrequencyType.Monthly || r.ByMonth.Count > 0)
+            else if (pattern.Frequency == FrequencyType.Monthly || pattern.ByMonth.Count > 0)
             {
                 int month = date.Month;

@@ -520,7 +555,7 @@
                     date = date.AddDays(7);
                 }
             }
-            else if (r.Frequency == FrequencyType.Yearly)
+            else if (pattern.Frequency == FrequencyType.Yearly)
             {
                 int year = date.Year;

@@ -570,20 +605,18 @@
          * @param dates
          * @return
          */
-        private List<DateTime> GetHourVariants(List<DateTime> dates)
-        {
-            IRecurrencePattern r = Pattern;
-
-            if (r.ByHour.Count == 0)
+        private List<DateTime> GetHourVariants(List<DateTime> dates, IRecurrencePattern pattern)
+        {
+            if (pattern.ByHour.Count == 0)
                 return dates;

             List<DateTime> hourlyDates = new List<DateTime>();
             for (int i = 0; i < dates.Count; i++)
             {
                 DateTime date = dates[i];
-                for (int j = 0; j < r.ByHour.Count; j++)
-                {
-                    int hour = r.ByHour[j];
+                for (int j = 0; j < pattern.ByHour.Count; j++)
+                {
+                    int hour = pattern.ByHour[j];
                     date = date.AddHours(-date.Hour + hour);
                     hourlyDates.Add(date);
                 }
@@ -597,20 +630,18 @@
          * @param dates
          * @return
          */
-        private List<DateTime> GetMinuteVariants(List<DateTime> dates)
-        {
-            IRecurrencePattern r = Pattern;
-
-            if (r.ByMinute.Count == 0)
+        private List<DateTime> GetMinuteVariants(List<DateTime> dates, IRecurrencePattern pattern)
+        {
+            if (pattern.ByMinute.Count == 0)
                 return dates;

             List<DateTime> minutelyDates = new List<DateTime>();
             for (int i = 0; i < dates.Count; i++)
             {
                 DateTime date = dates[i];
-                for (int j = 0; j < r.ByMinute.Count; j++)
-                {
-                    int minute = r.ByMinute[j];
+                for (int j = 0; j < pattern.ByMinute.Count; j++)
+                {
+                    int minute = pattern.ByMinute[j];
                     date = date.AddMinutes(-date.Minute + minute);
                     minutelyDates.Add(date);
                 }
@@ -624,20 +655,18 @@
          * @param dates
          * @return
          */
-        private List<DateTime> GetSecondVariants(List<DateTime> dates)
-        {
-            IRecurrencePattern r = Pattern;
-
-            if (r.BySecond.Count == 0)
+        private List<DateTime> GetSecondVariants(List<DateTime> dates, IRecurrencePattern pattern)
+        {
+            if (pattern.BySecond.Count == 0)
                 return dates;

             List<DateTime> secondlyDates = new List<DateTime>();
             for (int i = 0; i < dates.Count; i++)
             {
                 DateTime date = dates[i];
-                for (int j = 0; j < r.BySecond.Count; j++)
-                {
-                    int second = r.BySecond[j];
+                for (int j = 0; j < pattern.BySecond.Count; j++)
+                {
+                    int second = pattern.BySecond[j];
                     date = date.AddSeconds(-date.Second + second);
                     secondlyDates.Add(date);
                 }
@@ -651,8 +680,10 @@

         public override IList<IPeriod> Evaluate(IDateTime referenceDate, DateTime periodStart, DateTime periodEnd)
         {
+            IRecurrencePattern pattern = ProcessRecurrencePattern(referenceDate);
+
             Periods.Clear();
-            foreach (DateTime dt in GetDates(referenceDate, periodStart, periodEnd))
+            foreach (DateTime dt in GetDates(referenceDate, periodStart, periodEnd, pattern))
             {
                 IDateTime newDt = new iCalDateTime(dt, referenceDate.TZID);
                 newDt.AssociateWith(referenceDate);


BaseHttpServer: if the handler sets the content length, don't override it. This happens in HEAD handlers.

--- OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
+++ OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
@@ -688,7 +688,7 @@

                 if (buffer != null)
                 {
-                    if (!response.SendChunked)
+                    if (!response.SendChunked && response.ContentLength64 <= 0)
                         response.ContentLength64 = buffer.LongLength;

                     response.OutputStream.Write(buffer, 0, buffer.Length);


Test utility methods

Test utility methods

--- PART/Source/CprBroker/PartInterface.Tests/Utilities.cs
+++ PART/Source/CprBroker/PartInterface.Tests/Utilities.cs
@@ -71,6 +71,16 @@
         public static string[] RandomCprNumbers2()
         {
             return RandomCprNumbers(2);
+        }
+
+        public static string[] RandomCprNumbers5()
+        {
+            return RandomCprNumbers(5);
+        }
+
+        public static string[] RandomCprNumbers10()
+        {
+            return RandomCprNumbers(10);
         }

         public static string[] RandomCprNumbers(int count)


optimized reading dense double and float matrices

--- src/Matlab/MatlabParser.cs
+++ src/Matlab/MatlabParser.cs
@@ -24,10 +24,10 @@
 // OTHER DEALINGS IN THE SOFTWARE.
 // </copyright>

-using System.IO.Compression;
 using System;
 using System.Collections.Generic;
 using System.IO;
+using System.IO.Compression;
 using System.Numerics;
 using System.Reflection;
 using System.Text;
@@ -157,7 +157,7 @@
                 // for each data block add a Matlab object to the file.
                 while (reader.BaseStream.Position < length)
                 {
-                    var type = (DataType)reader.ReadInt16();
+                    var type = (DataType) reader.ReadInt16();
                     int size = reader.ReadInt16();
                     var smallBlock = true;
                     if (size == 0)
@@ -202,7 +202,7 @@
         {
             var blockSize = smallBlock ? SmallBlockSize : LargeBlockSize;
             var offset = 0;
-            var mod = size % blockSize;
+            var mod = size%blockSize;
             if (mod != 0)
             {
                 offset = blockSize - mod;
@@ -220,16 +220,16 @@
         private static byte[] DecompressBlock(byte[] compressed, out DataType type)
         {
             byte[] data;
-            using (var compressedStream = new MemoryStream(compressed, 2, compressed.Length-6))
+            using (var compressedStream = new MemoryStream(compressed, 2, compressed.Length - 6))
             {
                 using (var decompressor = new DeflateStream(compressedStream, CompressionMode.Decompress))
-                using(var decompressed = new MemoryStream())
+                using (var decompressed = new MemoryStream())
                 {
                     decompressor.CopyTo(decompressed);
                     decompressed.Position = 0;
                     var buf = new byte[4];
                     decompressed.Read(buf, 0, 4);
-                    type = (DataType)BitConverter.ToInt32(buf, 0);
+                    type = (DataType) BitConverter.ToInt32(buf, 0);
                     decompressed.Read(buf, 0, 4);
                     var size = BitConverter.ToInt32(buf, 0);
                     data = new byte[size];
@@ -254,14 +254,14 @@
                     // skip tag - doesn't tell us anything we don't already know
                     reader.BaseStream.Seek(8, SeekOrigin.Current);

-                    var arrayClass = (ArrayClass)reader.ReadByte();
+                    var arrayClass = (ArrayClass) reader.ReadByte();
                     var flags = reader.ReadByte();
-                    var isComplex = (flags & (byte)ArrayFlags.Complex) == (byte)ArrayFlags.Complex;
+                    var isComplex = (flags & (byte) ArrayFlags.Complex) == (byte) ArrayFlags.Complex;

                     // skip unneeded bytes
                     reader.BaseStream.Seek(10, SeekOrigin.Current);

-                    var numDimensions = reader.ReadInt32() / 8;
+                    var numDimensions = reader.ReadInt32()/8;
                     if (numDimensions > 2)
                     {
                         throw new NotSupportedException(Resources.MoreThan2D);
@@ -289,7 +289,7 @@
                         return;
                     }

-                    var type = (DataType)reader.ReadInt16();
+                    var type = (DataType) reader.ReadInt16();
                     size = reader.ReadInt16();
                     if (size == 0)
                     {
@@ -332,10 +332,11 @@
         /// <param name="columns">The number of columns.</param>
         /// <param name="size">The size of the block.</param>
         /// <returns>A populated sparse matrix.</returns>
-        private static Matrix<TDataType> PopulateSparseMatrix(BinaryReader reader, bool isComplex, int rows, int columns, int size)
+        private static Matrix<TDataType> PopulateSparseMatrix(BinaryReader reader, bool isComplex, int rows, int columns,
+                                                              int size)
         {
             // populate the row data array
-            var ir = new int[size / 4];
+            var ir = new int[size/4];
             for (var i = 0; i < ir.Length; i++)
             {
                 ir[i] = reader.ReadInt32();
@@ -348,7 +349,7 @@

             // populate the column data array
             var jcsize = reader.ReadInt32();
-            var jc = new int[jcsize / 4];
+            var jc = new int[jcsize/4];
             for (var j = 0; j < jc.Length; j++)
             {
                 jc[j] = reader.ReadInt32();
@@ -356,37 +357,40 @@

             AlignData(reader.BaseStream, jcsize, false);

-            var type = (DataType)reader.ReadInt32();
+            var type = (DataType) reader.ReadInt32();
             var dataSize = reader.ReadInt32();

             var matrix = CreateMatrix(true, rows, columns);
-            var dataType = typeof(TDataType);
-
-            if (dataType == typeof(double))
+            var dataType = typeof (TDataType);
+
+            if (dataType == typeof (double))
             {
                 if (isComplex)
                 {
-                    throw new ArgumentException("Invalid TDataType. Matrix is stored as a complex matrix, but a real data type was given.");
-                }
-
-                PopulateDoubleSparseMatrix((Matrix<double>)(object)matrix, type, ir, jc, reader);
-            }
-            else if (dataType == typeof(float))
+                    throw new ArgumentException(
+                        "Invalid TDataType. Matrix is stored as a complex matrix, but a real data type was given.");
+                }
+
+                PopulateDoubleSparseMatrix((Matrix<double>) (object) matrix, type, ir, jc, reader);
+            }
+            else if (dataType == typeof (float))
             {
                 if (isComplex)
                 {
-                    throw new ArgumentException("Invalid TDataType. Matrix is stored as a complex matrix, but a real data type was given.");
-                }
-
-                PopulateSingleSparseMatrix((Matrix<float>)(object)matrix, type, ir, jc, reader);
-            }
-            else if (dataType == typeof(Complex))
-            {
-                PopulateComplexSparseMatrix((Matrix<Complex>)(object)matrix, type, isComplex, ir, jc, reader, dataSize);
-            }
-            else if (dataType == typeof(Complex32))
-            {
-                PopulateComplex32SparseMatrix((Matrix<Complex32>)(object)matrix, type, isComplex, ir, jc, reader, dataSize);
+                    throw new ArgumentException(
+                        "Invalid TDataType. Matrix is stored as a complex matrix, but a real data type was given.");
+                }
+
+                PopulateSingleSparseMatrix((Matrix<float>) (object) matrix, type, ir, jc, reader);
+            }
+            else if (dataType == typeof (Complex))
+            {
+                PopulateComplexSparseMatrix((Matrix<Complex>) (object) matrix, type, isComplex, ir, jc, reader, dataSize);
+            }
+            else if (dataType == typeof (Complex32))
+            {
+                PopulateComplex32SparseMatrix((Matrix<Complex32>) (object) matrix, type, isComplex, ir, jc, reader,
+                                              dataSize);
             }
             else
             {
@@ -404,13 +408,14 @@
         /// <param name="ir">The row indices.</param>
         /// <param name="jc">The column indices.</param>
         /// <param name="reader">The reader to read from.</param>
-        private static void PopulateDoubleSparseMatrix(Matrix<double> matrix, DataType type, IList<int> ir, IList<int> jc, BinaryReader reader)
+        private static void PopulateDoubleSparseMatrix(Matrix<double> matrix, DataType type, IList<int> ir,
+                                                       IList<int> jc, BinaryReader reader)
         {
             var col = 0;
             for (var i = 0; i < ir.Count; i++)
             {
                 var row = ir[i];
-                while(jc[col + 1] == i)
+                while (jc[col + 1] == i)
                 {
                     col++;
                 }
@@ -461,7 +466,8 @@
         /// <param name="ir">The row indices.</param>
         /// <param name="jc">The column indices.</param>
         /// <param name="reader">The reader to read from.</param>
-        private static void PopulateSingleSparseMatrix(Matrix<float> matrix, DataType type, IList<int> ir, IList<int> jc, BinaryReader reader)
+        private static void PopulateSingleSparseMatrix(Matrix<float> matrix, DataType type, IList<int> ir, IList<int> jc,
+                                                       BinaryReader reader)
         {
             var col = 0;
             for (var i = 0; i < ir.Count; i++)
@@ -520,7 +526,8 @@
         /// <param name="jc">The column indices.</param>
         /// <param name="reader">The reader to read from.</param>
         /// <param name="dataSize">The length of the stored data.</param>
-        private static void PopulateComplexSparseMatrix(Matrix<Complex> matrix, DataType type, bool isComplex, IList<int> ir, IList<int> jc, BinaryReader reader, int dataSize)
+        private static void PopulateComplexSparseMatrix(Matrix<Complex> matrix, DataType type, bool isComplex,
+                                                        IList<int> ir, IList<int> jc, BinaryReader reader, int dataSize)
         {
             var col = 0;
             for (var i = 0; i < ir.Count; i++)
@@ -570,13 +577,13 @@

             if (isComplex)
             {
-                var skip = dataSize % 8;
+                var skip = dataSize%8;

                 // skip pad
                 reader.ReadBytes(skip);

                 // skip header
-                type = (DataType)reader.ReadInt32();
+                type = (DataType) reader.ReadInt32();
                 reader.ReadInt32();
                 col = 0;
                 for (var i = 0; i < ir.Count; i++)
@@ -637,7 +644,9 @@
         /// <param name="jc">The column indices.</param>
         /// <param name="reader">The reader to read from.</param>
         /// <param name="dataSize">The length of the stored data.</param>
-        private static void PopulateComplex32SparseMatrix(Matrix<Complex32> matrix, DataType type, bool isComplex, IList<int> ir, IList<int> jc, BinaryReader reader, int dataSize)
+        private static void PopulateComplex32SparseMatrix(Matrix<Complex32> matrix, DataType type, bool isComplex,
+                                                          IList<int> ir, IList<int> jc, BinaryReader reader,
+                                                          int dataSize)
         {
             var col = 0;
             for (var i = 0; i < ir.Count; i++)
@@ -687,15 +696,15 @@

             if (isComplex)
             {
-                var skip = dataSize % 8;
+                var skip = dataSize%8;

                 // skip pad
                 reader.ReadBytes(skip);

                 // skip header
-                type = (DataType)reader.ReadInt32();
+                type = (DataType) reader.ReadInt32();
                 reader.ReadInt32();
-
+
                 col = 0;
                 for (var i = 0; i < ir.Count; i++)
                 {
@@ -755,43 +764,66 @@
         /// <param name="columns">The number of columns.</param>
         /// <param name="size">The length of the stored data.</param>
         /// <returns>Returns a populated dense matrix.</returns>
-        private static Matrix<TDataType> PopulateDenseMatrix(DataType type, BinaryReader reader, bool isComplex, int rows, int columns, int size)
-        {
-            var matrix = CreateMatrix(false, rows, columns);
-
-            var dataType = typeof(TDataType);
-
-            if (dataType == typeof(double))
-            {
-                if (isComplex)
-                {
-                    throw new ArgumentException("Invalid TDataType. Matrix is stored as a complex matrix, but a real data type was given.");
-                }
-
-                PopulateDoubleDenseMatrix((Matrix<double>)(object)matrix, type, reader, rows, columns);
-            }
-            else if (dataType == typeof(float))
-            {
-                if (isComplex)
-                {
-                    throw new ArgumentException("Invalid TDataType. Matrix is stored as a complex matrix, but a real data type was given.");
-                }
-
-                PopulateSingleDenseMatrix((Matrix<float>)(object)matrix, type, reader, rows, columns);
-            }
-            else if (dataType == typeof(Complex))
-            {
-                PopulateComplexDenseMatrix((Matrix<Complex>)(object)matrix, type, isComplex, reader, rows, columns, size);
-            }
-            else if (dataType == typeof(Complex32))
-            {
-                PopulateComplex32DenseMatrix((Matrix<Complex32>)(object)matrix, type, isComplex, reader, rows, columns, size);
+        private static Matrix<TDataType> PopulateDenseMatrix(DataType type, BinaryReader reader, bool isComplex,
+                                                             int rows, int columns, int size)
+        {
+            var dataType = typeof (TDataType);
+            Matrix<TDataType> matrix;
+            if (type == DataType.Double && dataType == typeof (double))
+            {
+                var count = rows*columns;
+                var data = new double[count];
+                Buffer.BlockCopy(reader.ReadBytes(count*Constants.SizeOfDouble), 0, data, 0,
+                                 count*Constants.SizeOfDouble);
+                matrix = (Matrix<TDataType>)(object)new LinearAlgebra.Double.DenseMatrix(rows, columns, data);
+            }
+            else if (type == DataType.Single && dataType == typeof (float))
+            {
+                var count = rows*columns;
+                var data = new float[count];
+                Buffer.BlockCopy(reader.ReadBytes(count*Constants.SizeOfFloat), 0, data, 0,
+                                 count*Constants.SizeOfFloat);
+                matrix = (Matrix<TDataType>) (object) new LinearAlgebra.Single.DenseMatrix(rows, columns, data);
             }
             else
             {
-                throw new NotSupportedException();
-            }
-
+                matrix = CreateMatrix(false, rows, columns);
+
+                if (dataType == typeof (double))
+                {
+                    if (isComplex)
+                    {
+                        throw new ArgumentException(
+                            "Invalid TDataType. Matrix is stored as a complex matrix, but a real data type was given.");
+                    }
+
+                    PopulateDoubleDenseMatrix((Matrix<double>) (object) matrix, type, reader, rows, columns);
+                }
+                else if (dataType == typeof (float))
+                {
+                    if (isComplex)
+                    {
+                        throw new ArgumentException(
+                            "Invalid TDataType. Matrix is stored as a complex matrix, but a real data type was given.");
+                    }
+
+                    PopulateSingleDenseMatrix((Matrix<float>) (object) matrix, type, reader, rows, columns);
+                }
+                else if (dataType == typeof (Complex))
+                {
+                    PopulateComplexDenseMatrix((Matrix<Complex>) (object) matrix, type, isComplex, reader, rows, columns,
+                                               size);
+                }
+                else if (dataType == typeof (Complex32))
+                {
+                    PopulateComplex32DenseMatrix((Matrix<Complex32>) (object) matrix, type, isComplex, reader, rows,
+                                                 columns, size);
+                }
+                else
+                {
+                    throw new NotSupportedException();
+                }
+            }
             return matrix;
         }

@@ -803,7 +835,8 @@
         /// <param name="reader">The reader to read from.</param>
         /// <param name="rows">The number of rows.</param>
         /// <param name="columns">The number of columns.</param>
-        public static void PopulateDoubleDenseMatrix(Matrix<double> matrix, DataType type, BinaryReader reader, int rows, int columns)
+        public static void PopulateDoubleDenseMatrix(Matrix<double> matrix, DataType type, BinaryReader reader, int rows,
+                                                     int columns)
         {
             switch (type)
             {
@@ -922,7 +955,8 @@
         /// <param name="rows">The number of rows.</param>
         /// <param name="columns">The number of columns.</param>
         /// <param name="dataSize">The length of the stored data.</param>
-        public static void PopulateComplexDenseMatrix(Matrix<Complex> matrix, DataType type, bool isComplex, BinaryReader reader, int rows, int columns, int dataSize)
+        public static void PopulateComplexDenseMatrix(Matrix<Complex> matrix, DataType type, bool isComplex,
+                                                      BinaryReader reader, int rows, int columns, int dataSize)
         {
             switch (type)
             {
@@ -1032,13 +1066,13 @@

             if (isComplex)
             {
-                var skip = dataSize % 8;
+                var skip = dataSize%8;

                 // skip pad
                 reader.ReadBytes(skip);

                 // skip header
-                type = (DataType)reader.ReadInt32();
+                type = (DataType) reader.ReadInt32();
                 reader.ReadInt32();

                 switch (type)
@@ -1159,7 +1193,8 @@
         /// <param name="rows">The number of rows.</param>
         /// <param name="columns">The number of columns.</param>
         /// <param name="dataSize">The length of the stored data.</param>
-        public static void PopulateComplex32DenseMatrix(Matrix<Complex32> matrix, DataType type, bool isComplex, BinaryReader reader, int rows, int columns, int dataSize)
+        public static void PopulateComplex32DenseMatrix(Matrix<Complex32> matrix, DataType type, bool isComplex,
+                                                        BinaryReader reader, int rows, int columns, int dataSize)
         {
             switch (type)
             {
@@ -1269,13 +1304,13 @@

             if (isComplex)
             {
-                var skip = dataSize % 8;
+                var skip = dataSize%8;

                 // skip pad
                 reader.ReadBytes(skip);

                 // skip header
-                type = (DataType)reader.ReadInt32();
+                type = (DataType) reader.ReadInt32();
                 reader.ReadInt32();

                 switch (type)
@@ -1375,7 +1410,8 @@
                         {
                             for (var i = 0; i < rows; i++)
                             {
-                                matrix.At(i, j, new Complex32(matrix.At(i, j).Real, Convert.ToSingle(reader.ReadDouble())));
+                                matrix.At(i, j,
+                                          new Complex32(matrix.At(i, j).Real, Convert.ToSingle(reader.ReadDouble())));
                             }
                         }

@@ -1394,7 +1430,8 @@
         /// <param name="reader">The reader to read from.</param>
         /// <param name="rows">The number of rows.</param>
         /// <param name="columns">The number of columns.</param>
-        public static void PopulateSingleDenseMatrix(Matrix<float> matrix, DataType type, BinaryReader reader, int rows, int columns)
+        public static void PopulateSingleDenseMatrix(Matrix<float> matrix, DataType type, BinaryReader reader, int rows,
+                                                     int columns)
         {
             switch (type)
             {
@@ -1513,25 +1550,28 @@
         private static Matrix<TDataType> CreateMatrix(bool sparse, int rows, int columns)
         {
             ConstructorInfo constructor;
-            var dataType = typeof(TDataType);
+            var dataType = typeof (TDataType);

             if (sparse)
             {
-                if (dataType == typeof(double))
-                {
-                    constructor = typeof(LinearAlgebra.Double.SparseMatrix).GetConstructor(new[] { typeof(int), typeof(int) });
-                }
-                else if (dataType == typeof(float))
-                {
-                    constructor = typeof(LinearAlgebra.Single.SparseMatrix).GetConstructor(new[] { typeof(int), typeof(int) });
-                }
-                else if (dataType == typeof(Complex))
-                {
-                    constructor = typeof(LinearAlgebra.Complex.SparseMatrix).GetConstructor(new[] { typeof(int), typeof(int) });
-                }
-                else if (dataType == typeof(Complex32))
-                {
-                    constructor = typeof(LinearAlgebra.Complex32.SparseMatrix).GetConstructor(new[] { typeof(int), typeof(int) });
+                if (dataType == typeof (double))
+                {
+                    constructor = typeof (LinearAlgebra.Double.SparseMatrix).GetConstructor(new[] {typeof (int), typeof (int)});
+                }
+                else if (dataType == typeof (float))
+                {
+                    constructor =
+                        typeof (LinearAlgebra.Single.SparseMatrix).GetConstructor(new[] {typeof (int), typeof (int)});
+                }
+                else if (dataType == typeof (Complex))
+                {
+                    constructor =
+                        typeof (LinearAlgebra.Complex.SparseMatrix).GetConstructor(new[] {typeof (int), typeof (int)});
+                }
+                else if (dataType == typeof (Complex32))
+                {
+                    constructor =
+                        typeof (LinearAlgebra.Complex32.SparseMatrix).GetConstructor(new[] {typeof (int), typeof (int)});
                 }
                 else
                 {
@@ -1540,21 +1580,24 @@
             }
             else
             {
-                if (dataType == typeof(double))
-                {
-                    constructor = typeof(LinearAlgebra.Double.DenseMatrix).GetConstructor(new[] { typeof(int), typeof(int) });
-                }
-                else if (dataType == typeof(float))
-                {
-                    constructor = typeof(LinearAlgebra.Single.DenseMatrix).GetConstructor(new[] { typeof(int), typeof(int) });
-                }
-                else if (dataType == typeof(Complex))
-                {
-                    constructor = typeof(LinearAlgebra.Complex.DenseMatrix).GetConstructor(new[] { typeof(int), typeof(int) });
-                }
-                else if (dataType == typeof(Complex32))
-                {
-                    constructor = typeof(LinearAlgebra.Complex32.DenseMatrix).GetConstructor(new[] { typeof(int), typeof(int) });
+                if (dataType == typeof (double))
+                {
+                    constructor = typeof (LinearAlgebra.Double.DenseMatrix).GetConstructor(new[] {typeof (int), typeof (int)});
+                }
+                else if (dataType == typeof (float))
+                {
+                    constructor =
+                        typeof (LinearAlgebra.Single.DenseMatrix).GetConstructor(new[] {typeof (int), typeof (int)});
+                }
+                else if (dataType == typeof (Complex))
+                {
+                    constructor =
+                        typeof (LinearAlgebra.Complex.DenseMatrix).GetConstructor(new[] {typeof (int), typeof (int)});
+                }
+                else if (dataType == typeof (Complex32))
+                {
+                    constructor =
+                        typeof (LinearAlgebra.Complex32.DenseMatrix).GetConstructor(new[] {typeof (int), typeof (int)});
                 }
                 else
                 {
@@ -1562,7 +1605,7 @@
                 }
             }

-            return (Matrix<TDataType>)constructor.Invoke(new object[] { rows, columns });
+            return (Matrix<TDataType>) constructor.Invoke(new object[] {rows, columns});
         }
     }
-}
+}


adding error page

adding error page

--- src/MiauCore.IO/Startup.cs
+++ src/MiauCore.IO/Startup.cs
@@ -76,16 +76,13 @@
                         await next();
                     }
                 });
-                app.UseDeveloperExceptionPage();
             }
+
+            app.UseStatusCodePages();

             app.UseMvc(routes =>
             {
-                routes.MapRoute("Admin", "{area:exists}/{controller=Account}/{action=Index}/{id?}");
-
-                routes.MapRoute(
-                    name: "default",
-                    template: "{controller=Home}/{action=Index}/{id?}");
+                routes.MapRoute("Admin", "{area:exists}/{controller=Account}/{action=Index}/{id?}");
             });
         }
     }


added chance in results for recipies

added chance in results for recipies

--- Pandaros.Settlers/Pandaros.Settlers/Items/ICSRecipe.cs
+++ Pandaros.Settlers/Pandaros.Settlers/Items/ICSRecipe.cs
@@ -30,6 +30,7 @@

         public string type { get; set; }
         public int amount { get; set; }
+        public float? chance { get; set; }
     }

     public interface ICSRecipe : INameable


[Fix] 辞書からキーを削除する際のエラー修正

[Fix] 辞書からキーを削除する際のエラー修正

--- CurtainFireMakerPlugin/Entities/CurtainFireMotion.cs
+++ CurtainFireMakerPlugin/Entities/CurtainFireMotion.cs
@@ -64,9 +64,9 @@
         public void FinalizeKeyFrame(IEnumerable<PmxMorphData> morphs)
         {
             var morphNames = morphs.Select(m => m.MorphName);
-            foreach (var key in MorphFrameDict.Keys)
+            foreach (var key in MorphFrameDict.Keys.Where(k => !morphNames.Contains(k.name)).ToArray())
             {
-                if (!morphNames.Contains(key.name)) MorphFrameDict.Remove(key);
+                MorphFrameDict.Remove(key);
             }
         }


use a low priority g_timeout instead of a g_idle, so the animator isn't run more often than 25 times a sec

--- src/Bling/Animation.cs
+++ src/Bling/Animation.cs
@@ -68,7 +68,7 @@
 				throw new InvalidOperationException ("Can't Resume a non running animation");
 			starttime = DateTimeOffset.Now - pausedafter;
 			state = AnimationState.Running;
-			GLib.Idle.Add (Handler);
+			GLib.Timeout.Add (40, Handler, GLib.Priority.DefaultIdle);
 		}

 		public void Start ()
@@ -77,7 +77,7 @@
 				throw new InvalidOperationException ("Can't Start() a running or paused animation");
 			starttime = DateTimeOffset.Now;
 			state = AnimationState.Running;
-			GLib.Idle.Add (Handler);
+			GLib.Timeout.Add (40, Handler, GLib.Priority.DefaultIdle);
 		}

 		public void Stop ()


Improved exception handling on browser binding

If any Syste.Net.WebException occurs on parsing a JSON response
a CmisConnectionException is thrown with the web exception embedded.

--- DotCMIS/binding/browser/browser.cs
+++ DotCMIS/binding/browser/browser.cs
@@ -388,7 +388,11 @@
             {
                 using (JsonTextReader reader = new JsonTextReader(new StreamReader(stream)))
                 {
-                    json = JToken.ReadFrom(reader);
+                    try {
+                        json = JToken.ReadFrom(reader);
+                    } catch (WebException e) {
+                        throw new CmisConnectionException(e.Message, e);
+                    }
                 }
             }
             finally
@@ -410,7 +414,11 @@
             {
                 using (JsonTextReader reader = new JsonTextReader(new StreamReader(stream)))
                 {
-                    json = JToken.ReadFrom(reader);
+                    try {
+                        json = JToken.ReadFrom(reader);
+                    } catch (WebException e) {
+                        throw new CmisConnectionException(e.Message, e);
+                    }
                 }
             }
             finally


Update TrainerData.cs

Update TrainerData.cs

--- PokemonUnity.Shared/Combat/Trainer/Data/TrainerData.cs
+++ PokemonUnity.Shared/Combat/Trainer/Data/TrainerData.cs
@@ -7,7 +7,7 @@
 namespace PokemonUnity.Character
 {
 	/// <summary>
-	/// MetaData struct for Trainer, Secret, Gender (use for pokemons, and players)
+	/// Data struct for Trainer, Secret, Gender (use for pokemons, players, and battles)
 	/// </summary>
 	public struct TrainerData : IEquatable<TrainerData>, IEqualityComparer<TrainerData>
 	{


Removed manually played stat.

Removed manually played stat.

--- Draughts.Ai.Trainer.CLI/Program.cs
+++ Draughts.Ai.Trainer.CLI/Program.cs
@@ -159,12 +159,6 @@
                     return;
                 }
                 Console.WriteLine($"Best contestant beat random AI {randomWins} out {testGameCount} games.");
-                int manualWins = PlayGames(winningContestant.GamePlayer, spawner.SpawnManualWeightedAiGamePlayer(), testGameCount);
-                if (shouldClose)
-                {
-                    return;
-                }
-                Console.WriteLine($"Best contestant beat manually tuned AI {manualWins} out {testGameCount} games.");
             }

             contestants = contestants.OrderBy(c => c.Draws).ThenByDescending(c => c.Wins).ToList();


add equals function

add equals function

--- Project/WorkshopManager/WorkshopManager/Models/Part.cs
+++ Project/WorkshopManager/WorkshopManager/Models/Part.cs
@@ -12,5 +12,10 @@
             Name = name;
             Prize = prize;
         }
+
+        public bool Equals(Part part)
+        {
+            return false;
+        }
     }
 }


Fix order-dependent error in test running

--- EOLib.Config.Test/IniReaderTest.cs
+++ EOLib.Config.Test/IniReaderTest.cs
@@ -15,8 +15,8 @@
         private const string TestFile = "SomeFile.ini";
         private static readonly string FullPath = Path.Combine(TestDirectory, TestFile);

-        [ClassCleanup]
-        public static void ClassCleanup()
+        [TestCleanup]
+        public void TestCleanup()
         {
             if (Directory.Exists(TestDirectory))
                 Directory.Delete(TestDirectory, true);


refactor

refactor

--- EagleEye/Reviews/ReviewsManager.cs
+++ EagleEye/Reviews/ReviewsManager.cs
@@ -23,7 +23,7 @@
             ICommand cmdCodeDefectDensityUploaded,
             ICommand cmdCodeDefectDensityChanged,
             ICommand cmdInspectionRateByMonth,
-            ICommand cmdDefectDensityChangedByMonthCommand,
+            ICommand cmdDefectDensityChangedByMonth,
             ICommand cmdCommentDensityChangedByMonth
         )
         {
@@ -35,7 +35,7 @@
             _cmdCodeDefectDensityUploaded = cmdCodeDefectDensityUploaded;
             _cmdCodeDefectDensityChanged = cmdCodeDefectDensityChanged;
             _cmdInspectionRateByMonth = cmdInspectionRateByMonth;
-            _cmdDefectDensityChangedByMonth = cmdDefectDensityChangedByMonthCommand;
+            _cmdDefectDensityChangedByMonth = cmdDefectDensityChangedByMonth;
             _cmdCommentDensityChangedByMonth = cmdCommentDensityChangedByMonth;
         }


Null check on return value of registry key

--- Eavesdrop/Internals/INETOptions.cs
+++ Eavesdrop/Internals/INETOptions.cs
@@ -95,18 +95,13 @@
             {
                 LoadAddresses();
                 LoadOverrides();
-
-                object proxyEnable = _proxyKey.GetValue("ProxyEnable");
-                if (proxyEnable != null)
-                {
-                    IsProxyEnabled = proxyEnable.ToString() == "1";
-                }
+                IsProxyEnabled = (_proxyKey.GetValue("ProxyEnable")?.ToString() == "1");
             }
         }

         private static void LoadOverrides()
         {
-            var proxyOverride = (string)_proxyKey.GetValue("ProxyOverride");
+            string proxyOverride = _proxyKey.GetValue("ProxyOverride")?.ToString();
             if (string.IsNullOrWhiteSpace(proxyOverride)) return;

             string[] overrides = proxyOverride.Split(';');
@@ -124,7 +119,7 @@
         }
         private static void LoadAddresses()
         {
-            string proxyServer = _proxyKey.GetValue("ProxyServer").ToString();
+            string proxyServer = _proxyKey.GetValue("ProxyServer")?.ToString();
             if (string.IsNullOrWhiteSpace(proxyServer)) return;

             string[] values = proxyServer.Split(';');


Use Regex Source Generator

Use Regex Source Generator

Use the new Regex Source Generator where the pattern is static.

--- src/AdventOfCode/Puzzles/Y2020/Day04.cs
+++ src/AdventOfCode/Puzzles/Y2020/Day04.cs
@@ -10,7 +10,7 @@
 /// A class representing the puzzle for <c>https://adventofcode.com/2020/day/4</c>. This class cannot be inherited.
 /// </summary>
 [Puzzle(2020, 04, "Passport Processing", RequiresData = true)]
-public sealed class Day04 : Puzzle
+public sealed partial class Day04 : Puzzle
 {
     /// <summary>
     /// The required keys for passports. This field is read-only.
@@ -128,7 +128,7 @@
                 return false;
             }

-            return Regex.IsMatch(value, "#[0-9a-f]{6}", RegexOptions.IgnoreCase);
+            return HexColor().IsMatch(value);
         }

         static bool IsValidHeight(ReadOnlySpan<char> value)
@@ -187,4 +187,7 @@

         return true;
     }
+
+    [RegexGenerator("#[0-9a-f]{6}", RegexOptions.IgnoreCase)]
+    private static partial Regex HexColor();
 }


Fix bug causing wrong kills/deaths stats in scoreboard

--- DemoParser/Packets/Handlers/PacketEntitiesHandler.cs
+++ DemoParser/Packets/Handlers/PacketEntitiesHandler.cs
@@ -53,10 +53,6 @@
 						if (reader.ReadBit())
 						{
 							parser.entities.Remove(currentEntity);
-
-							// TODO vérifier pourquoi on retire le joueur : disconnect ? retirer aussi de teams ? voir C++
-							if (parser.players.ContainsKey(currentEntity))
-								parser.players.Remove(currentEntity);
 						}
 					}
 				}


Made it possible to retrive the base statusurl - which enables creating a StatusReference object at a later time

--- Digipost.Signature.Api.Client.Direct/ResponseUrls.cs
+++ Digipost.Signature.Api.Client.Direct/ResponseUrls.cs
@@ -4,11 +4,11 @@
 {
     public class ResponseUrls
     {
-        private readonly Uri _statusUrl;
+        public readonly Uri StatusBaseUrl;

-        public ResponseUrls(Uri redirectUrl, Uri statusUrl)
+        public ResponseUrls(Uri redirectUrl, Uri statusBaseUrl)
         {
-            _statusUrl = statusUrl;
+            StatusBaseUrl = statusBaseUrl;
             Redirect = new RedirectReference(redirectUrl);
         }

@@ -27,7 +27,7 @@
         /// <returns></returns>
         public StatusReference Status(string statusQueryToken)
         {
-            return new StatusReference(_statusUrl, statusQueryToken);
+            return new StatusReference(StatusBaseUrl, statusQueryToken);
         }
     }
 }


git-svn-id: https://gorgonlib.googlecode.com/svn/branches/2.x@1472 a61f9e97-bd4c-0410-8c65-85b29eaa70ff

--- Dorian/Test/Gorgon.Graphics.Test/ConcurrentRender.cs
+++ Dorian/Test/Gorgon.Graphics.Test/ConcurrentRender.cs
@@ -105,13 +105,15 @@
                         constantBuffer.Update(_deferred, ref _wvp);

                         _deferred.Output.DrawIndexed(0, 0, 6);
+
+                        return _deferred.FinalizeDeferred();
                     }
                     catch (Exception ex)
                     {
                         UI.GorgonDialogs.ErrorBox(null, ex);
                     }

-                    return _deferred.FinalizeDeferred();
+                    return null;
                 }));

             for (int i = 0; i < _tasks.Count; i++)


Material frequencies now match in-game behaviour not icons

--- EliteDangerous/EliteDangerous/MaterialCommodities.cs
+++ EliteDangerous/EliteDangerous/MaterialCommodities.cs
@@ -169,36 +169,37 @@

         public static void SetUpInitialTable()
         {
-            AddRaw("Antimony", MaterialFreqVeryRare, "Sb");
-            AddRaw("Polonium", MaterialFreqVeryRare, "Po");
-            AddRaw("Ruthenium", MaterialFreqVeryRare, "Ru");
-            AddRaw("Technetium", MaterialFreqVeryRare, "Tc");
-            AddRaw("Tellurium", MaterialFreqVeryRare, "Te");
-
-            AddRaw( "Yttrium", MaterialFreqRare, "Y");
-            AddRaw( "Cadmium", MaterialFreqRare, "Cd");
-            AddRaw( "Mercury", MaterialFreqRare, "Hg");
-            AddRaw( "Molybdenum", MaterialFreqRare, "Mo");
-            AddRaw( "Tin", MaterialFreqRare, "Sn");
-
+
             AddRaw("Carbon", MaterialFreqVeryCommon, "C");
             AddRaw("Iron", MaterialFreqVeryCommon, "Fe");
             AddRaw("Nickel", MaterialFreqVeryCommon, "Ni");
             AddRaw("Phosphorus", MaterialFreqVeryCommon, "P");
             AddRaw("Sulphur", MaterialFreqVeryCommon, "S");

-            AddRaw( "Chromium", MaterialFreqCommon, "Cr");
-            AddRaw( "Germanium", MaterialFreqCommon, "Ge");
-            AddRaw( "Manganese", MaterialFreqCommon, "Mn");
-            AddRaw( "Vanadium", MaterialFreqCommon, "V");
-            AddRaw( "Zinc", MaterialFreqCommon, "Zn");
-
+            AddRaw("Chromium", MaterialFreqCommon, "Cr");
+            AddRaw("Germanium", MaterialFreqCommon, "Ge");
+            AddRaw("Manganese", MaterialFreqCommon, "Mn");
+            AddRaw("Vanadium", MaterialFreqCommon, "V");
+            AddRaw("Zinc", MaterialFreqCommon, "Zn");
+            AddRaw("Zirconium", MaterialFreqCommon, "Zr");
+            AddRaw("Tin", MaterialFreqCommon, "Sn");
+            AddRaw("Arsenic", MaterialFreqCommon, "As");
+
             AddRaw("Niobium", MaterialFreqStandard, "Nb");        // realign to Anthors standard
             AddRaw("Tungsten", MaterialFreqStandard, "W");
-            AddRaw("Arsenic", MaterialFreqStandard, "As");
-            AddRaw("Selenium", MaterialFreqStandard, "Se");
-            AddRaw("Zirconium", MaterialFreqStandard, "Zr");
-
+            AddRaw("Molybdenum", MaterialFreqStandard, "Mo");
+            AddRaw("Mercury", MaterialFreqStandard, "Hg");
+
+            AddRaw("Selenium", MaterialFreqRare, "Se");
+            AddRaw("Yttrium", MaterialFreqRare, "Y");
+            AddRaw("Cadmium", MaterialFreqRare, "Cd");
+            AddRaw("Technetium", MaterialFreqRare, "Tc");
+            AddRaw("Tellurium", MaterialFreqRare, "Te");
+            AddRaw("Ruthenium", MaterialFreqRare, "Ru");
+            AddRaw("Polonium", MaterialFreqRare, "Po");
+
+            AddRaw("Antimony", MaterialFreqVeryRare, "Sb");
+
             AddCommodity("Explosives;Hydrogen Fuel;Hydrogen Peroxide;Liquid Oxygen;Mineral Oil;Nerve Agents;Pesticides;Surface Stabilisers;Synthetic Reagents;Water", "Chemicals");

             AddCommodity("Clothing;Consumer Technology;Domestic Appliances;Evacuation Shelter;Survival Equipment", "Consumer Items");
@@ -464,7 +465,6 @@
             AddManu("Hybrid Capacitors", MaterialFreqCommon, "HC");
             AddManu("Mechanical Equipment", MaterialFreqCommon, "ME");
             AddManu("Shield Emitters", MaterialFreqCommon, "SE");
-
             // standard manufactured
             AddManu( "Chemical Distillery", MaterialFreqStandard, "CD");
             AddManu( "Conductive Ceramics", MaterialFreqStandard, "CCe");


pluton version 1.1.4.*

pluton version 1.1.4.*

--- Pluton/Properties/AssemblyInfo.cs
+++ Pluton/Properties/AssemblyInfo.cs
@@ -16,7 +16,7 @@
 // The form "{Major}.{Minor}.*" will automatically update the build and revision,
 // and "{Major}.{Minor}.{Build}.*" will update just the revision.

-[assembly: AssemblyVersion("1.1.3.*")]
+[assembly: AssemblyVersion("1.1.4.*")]

 // The following attributes are used to specify the signing key for the assembly,
 // if desired. See the Mono documentation for more information about signing.


Resolved issue #476: Updated Castle.Core reference for all consuming packages.
Includes version updates for associated/affected modules so they're ready to
publish:
* Autofac.Extras.AggregateService 3.0.2 => 3.0.3
* Autofac.Extras.DynamicProxy2 3.0.2 => 3.0.3

Note that the change also affected Autofac.Extras.Integration.Wcf, but since
that package has not yet been published no version change was required.

--- Properties/VersionAssemblyInfo.cs
+++ Properties/VersionAssemblyInfo.cs
@@ -1,7 +1,7 @@
 //------------------------------------------------------------------------------
 // <auto-generated>
 //     This code was generated by a tool.
-//     Runtime Version:4.0.30319.18051
+//     Runtime Version:4.0.30319.34003
 //
 //     Changes to this file may cause incorrect behavior and will be lost if
 //     the code is regenerated.
@@ -16,7 +16,7 @@

 [assembly: AssemblyVersion("3.0.0.0")]
 [assembly: AssemblyFileVersion("3.0.1.0")]
-[assembly: AssemblyConfiguration("Release built on 2013-12-03 10:23")]
+[assembly: AssemblyConfiguration("Release built on 2013-12-05 16:05")]
 [assembly: AssemblyCopyright("Copyright © 2013 Autofac Contributors")]
 [assembly: AssemblyDescription("Autofac.Extras.CommonServiceLocator 3.0.1")]


Removed manual test

Removed manual test

--- resharper/tests.manual/tests.xunitversions/Theories.cs
+++ resharper/tests.manual/tests.xunitversions/Theories.cs
@@ -16,17 +16,5 @@
         {
             Assert.Equal(5, value.Length);
         }
-
-        [Theory]
-        [PropertyData("Data")]
-        public void Sausages(int i)
-        {
-            Thread.Sleep(2000);
-        }
-
-        public static IEnumerable<object[]> Data
-        {
-            get { return Enumerable.Range(1, 100).Select(x => new object[] { x }); }
-        }
-    }
+   }
 }


Add encoding configuration to RconClient

--- RconSharp/RconSharp/RconClient.cs
+++ RconSharp/RconSharp/RconClient.cs
@@ -4,6 +4,7 @@
 using System.IO.Pipelines;
 using System.Linq;
 using System.Security.Authentication;
+using System.Text;
 using System.Threading.Tasks;

 /*
@@ -40,6 +41,8 @@
 		private IChannel channel;
 		private Pipe pipe = new Pipe();

+		private Encoding encoding;
+
 		private Queue<Operation> operations = new Queue<Operation>();
 		private Task communicationTask;
 		public event Action ConnectionClosed;
@@ -54,6 +57,13 @@
 			if (channel == null)
 				throw new NullReferenceException("channel parameter must be an instance of a class implementing INetworkSocket inteface");
 			this.channel = channel;
+			encoding = Encoding.UTF8;
+		}
+
+		public RconClient WithEncoding(Encoding encoding)
+		{
+			this.encoding = encoding;
+			return this;
 		}

 		public string Host { get; private set; }
@@ -128,7 +138,7 @@
 				if (buffer.Length >= packetSize + 4)
 				{
 					var endPosition = buffer.GetPosition(packetSize + 4, startPosition);
-					var rconPacket = RconPacket.FromBytes(buffer.Slice(startPosition, endPosition).ToArray());
+					var rconPacket = RconPacket.FromBytes(buffer.Slice(startPosition, endPosition).ToArray(), encoding);
 					if (!rconPacket.IsDummy)
 					{
 						var currentOperation = operations.Peek();
@@ -179,7 +189,7 @@
 			{
 				var response = await SendPacketAsync(authPacket);
 			}
-			catch (AuthenticationException ex)
+			catch (AuthenticationException)
 			{
 				return false;
 			}
@@ -200,10 +210,10 @@
 		{
 			var packetDescription = new Operation(packet, isMultiPacketResponse);
 			operations.Enqueue(packetDescription);
-			await channel.SendAsync(packet.ToBytes());
+			await channel.SendAsync(packet.ToBytes(encoding));
 			if (isMultiPacketResponse)
 			{
-				await channel.SendAsync(RconPacket.Dummy.Value.ToBytes());
+				await channel.SendAsync(RconPacket.Dummy.Value.ToBytes(encoding));
 			}

 			return await packetDescription.TaskCompletionSource.Task;


Main tab in designer.

Main tab in designer.

--- RdlDesign/RdlDesigner.Designer.cs
+++ RdlDesign/RdlDesigner.Designer.cs
@@ -176,17 +176,16 @@
             this.CsvToolStripButton2 = new System.Windows.Forms.ToolStripButton();
             this.RtfToolStripButton2 = new System.Windows.Forms.ToolStripButton();
             this.TifToolStripButton2 = new System.Windows.Forms.ToolStripButton();
+            this.mainTC = new System.Windows.Forms.TabControl();
+            this.label1 = new System.Windows.Forms.Label();
+            this.label2 = new System.Windows.Forms.Label();
+            this.panel1 = new System.Windows.Forms.Panel();
             this.foreColorPicker1 = new fyiReporting.RdlDesign.ColorPicker();
             this.backColorPicker1 = new fyiReporting.RdlDesign.ColorPicker();
-            this.mainTC = new System.Windows.Forms.TabControl();
-            this.tabPage1 = new System.Windows.Forms.TabPage();
-            this.tabPage2 = new System.Windows.Forms.TabPage();
-            this.label1 = new System.Windows.Forms.Label();
-            this.label2 = new System.Windows.Forms.Label();
             this.menuStrip1.SuspendLayout();
             this.mainTB.SuspendLayout();
             this.toolStrip1.SuspendLayout();
-            this.mainTC.SuspendLayout();
+            this.panel1.SuspendLayout();
             this.SuspendLayout();
             //
             // menuStrip1
@@ -1526,6 +1525,47 @@
             this.TifToolStripButton2.Tag = "TIF";
             this.TifToolStripButton2.Text = "TIF";
             this.TifToolStripButton2.Click += new System.EventHandler(this.exportToolStripMenuItemTif_Click);
+            //
+            // mainTC
+            //
+            this.mainTC.Location = new System.Drawing.Point(3, 39);
+            this.mainTC.Name = "mainTC";
+            this.mainTC.SelectedIndex = 0;
+            this.mainTC.Size = new System.Drawing.Size(712, 21);
+            this.mainTC.TabIndex = 34;
+            this.mainTC.MouseClick += new System.Windows.Forms.MouseEventHandler(this.mainTC_MouseClick);
+            this.mainTC.SelectedIndexChanged += new System.EventHandler(this.mainTC_SelectedIndexChanged);
+            //
+            // label1
+            //
+            this.label1.AutoSize = true;
+            this.label1.Location = new System.Drawing.Point(4, 15);
+            this.label1.Name = "label1";
+            this.label1.Size = new System.Drawing.Size(58, 13);
+            this.label1.TabIndex = 0;
+            this.label1.Text = "Fore Color:";
+            //
+            // label2
+            //
+            this.label2.AutoSize = true;
+            this.label2.Location = new System.Drawing.Point(209, 15);
+            this.label2.Name = "label2";
+            this.label2.Size = new System.Drawing.Size(62, 13);
+            this.label2.TabIndex = 35;
+            this.label2.Text = "Back Color:";
+            //
+            // panel1
+            //
+            this.panel1.Controls.Add(this.label1);
+            this.panel1.Controls.Add(this.label2);
+            this.panel1.Controls.Add(this.foreColorPicker1);
+            this.panel1.Controls.Add(this.backColorPicker1);
+            this.panel1.Controls.Add(this.mainTC);
+            this.panel1.Dock = System.Windows.Forms.DockStyle.Top;
+            this.panel1.Location = new System.Drawing.Point(0, 74);
+            this.panel1.Name = "panel1";
+            this.panel1.Size = new System.Drawing.Size(712, 66);
+            this.panel1.TabIndex = 36;
             //
             // foreColorPicker1
             //
@@ -5876,9 +5916,149 @@
             "Whitesmoke",
             "Yellow",
             "Yellowgreen",
+            "Aliceblue",
+            "Antiquewhite",
+            "Aqua",
+            "Aquamarine",
+            "Azure",
+            "Beige",
+            "Bisque",
+            "Black",
+            "Blanchedalmond",
+            "Blue",
+            "Blueviolet",
+            "Brown",
+            "Burlywood",
+            "Cadetblue",
+            "Chartreuse",
+            "Chocolate",
+            "Coral",
+            "Cornflowerblue",
+            "Cornsilk",
+            "Crimson",
+            "Cyan",
+            "Darkblue",
+            "Darkcyan",
+            "Darkgoldenrod",
+            "Darkgray",
+            "Darkgreen",
+            "Darkkhaki",
+            "Darkmagenta",
+            "Darkolivegreen",
+            "Darkorange",
+            "Darkorchid",
+            "Darkred",
+            "Darksalmon",
+            "Darkseagreen",
+            "Darkslateblue",
+            "Darkslategray",
+            "Darkturquoise",
+            "Darkviolet",
+            "Deeppink",
+            "Deepskyblue",
+            "Dimgray",
+            "Dodgerblue",
+            "Firebrick",
+            "Floralwhite",
+            "Forestgreen",
+            "Fuchsia",
+            "Gainsboro",
+            "Ghostwhite",
+            "Gold",
+            "Goldenrod",
+            "Gray",
+            "Green",
+            "Greenyellow",
+            "Honeydew",
+            "Hotpink",
+            "Indianred",
+            "Indigo",
+            "Ivory",
+            "Khaki",
+            "Lavender",
+            "Lavenderblush",
+            "Lawngreen",
+            "Lemonchiffon",
+            "Lightblue",
+            "Lightcoral",
+            "Lightcyan",
+            "Lightgoldenrodyellow",
+            "Lightgreen",
+            "Lightgrey",
+            "Lightpink",
+            "Lightsalmon",
+            "Lightseagreen",
+            "Lightskyblue",
+            "Lightslategrey",
+            "Lightsteelblue",
+            "Lightyellow",
+            "Lime",
+            "Limegreen",
+            "Linen",
+            "Magenta",
+            "Maroon",
+            "Mediumaquamarine",
+            "Mediumblue",
+            "Mediumorchid",
+            "Mediumpurple",
+            "Mediumseagreen",
+            "Mediumslateblue",
+            "Mediumspringgreen",
+            "Mediumturquoise",
+            "Mediumvioletred",
+            "Midnightblue",
+            "Mintcream",
+            "Mistyrose",
+            "Moccasin",
+            "Navajowhite",
+            "Navy",
+            "Oldlace",
+            "Olive",
+            "Olivedrab",
+            "Orange",
+            "Orangered",
+            "Orchid",
+            "Palegoldenrod",
+            "Palegreen",
+            "Paleturquoise",
+            "Palevioletred",
+            "Papayawhip",
+            "Peachpuff",
+            "Peru",
+            "Pink",
+            "Plum",
+            "Powderblue",
+            "Purple",
+            "Red",
+            "Rosybrown",
+            "Royalblue",
+            "Saddlebrown",
+            "Salmon",
+            "Sandybrown",
+            "Seagreen",
+            "Seashell",
+            "Sienna",
+            "Silver",
+            "Skyblue",
+            "Slateblue",
+            "Slategray",
+            "Snow",
+            "Springgreen",
+            "Steelblue",
+            "Tan",
+            "Teal",
+            "Thistle",
+            "Tomato",
+            "Turquoise",
+            "Violet",
+            "Wheat",
+            "White",
+            "Whitesmoke",
+            "Yellow",
+            "Yellowgreen",
             "colorPicker1",
             ""});
-            this.foreColorPicker1.Location = new System.Drawing.Point(71, 77);
+            this.foreColorPicker1.Location = new System.Drawing.Point(66, 12);
             this.foreColorPicker1.Name = "foreColorPicker1";
             this.foreColorPicker1.Size = new System.Drawing.Size(121, 21);
             this.foreColorPicker1.TabIndex = 32;
@@ -10375,9 +10555,149 @@
             "Whitesmoke",
             "Yellow",
             "Yellowgreen",
+            "Aliceblue",
+            "Antiquewhite",
+            "Aqua",
+            "Aquamarine",
+            "Azure",
+            "Beige",
+            "Bisque",
+            "Black",
+            "Blanchedalmond",
+            "Blue",
+            "Blueviolet",
+            "Brown",
+            "Burlywood",
+            "Cadetblue",
+            "Chartreuse",
+            "Chocolate",
+            "Coral",
+            "Cornflowerblue",
+            "Cornsilk",
+            "Crimson",
+            "Cyan",
+            "Darkblue",
+            "Darkcyan",
+            "Darkgoldenrod",
+            "Darkgray",
+            "Darkgreen",
+            "Darkkhaki",
+            "Darkmagenta",
+            "Darkolivegreen",
+            "Darkorange",
+            "Darkorchid",
+            "Darkred",
+            "Darksalmon",
+            "Darkseagreen",
+            "Darkslateblue",
+            "Darkslategray",
+            "Darkturquoise",
+            "Darkviolet",
+            "Deeppink",
+            "Deepskyblue",
+            "Dimgray",
+            "Dodgerblue",
+            "Firebrick",
+            "Floralwhite",
+            "Forestgreen",
+            "Fuchsia",
+            "Gainsboro",
+            "Ghostwhite",
+            "Gold",
+            "Goldenrod",
+            "Gray",
+            "Green",
+            "Greenyellow",
+            "Honeydew",
+            "Hotpink",
+            "Indianred",
+            "Indigo",
+            "Ivory",
+            "Khaki",
+            "Lavender",
+            "Lavenderblush",
+            "Lawngreen",
+            "Lemonchiffon",
+            "Lightblue",
+            "Lightcoral",
+            "Lightcyan",
+            "Lightgoldenrodyellow",
+            "Lightgreen",
+            "Lightgrey",
+            "Lightpink",
+            "Lightsalmon",
+            "Lightseagreen",
+            "Lightskyblue",
+            "Lightslategrey",
+            "Lightsteelblue",
+            "Lightyellow",
+            "Lime",
+            "Limegreen",
+            "Linen",
+            "Magenta",
+            "Maroon",
+            "Mediumaquamarine",
+            "Mediumblue",
+            "Mediumorchid",
+            "Mediumpurple",
+            "Mediumseagreen",
+            "Mediumslateblue",
+            "Mediumspringgreen",
+            "Mediumturquoise",
+            "Mediumvioletred",
+            "Midnightblue",
+            "Mintcream",
+            "Mistyrose",
+            "Moccasin",
+            "Navajowhite",
+            "Navy",
+            "Oldlace",
+            "Olive",
+            "Olivedrab",
+            "Orange",
+            "Orangered",
+            "Orchid",
+            "Palegoldenrod",
+            "Palegreen",
+            "Paleturquoise",
+            "Palevioletred",
+            "Papayawhip",
+            "Peachpuff",
+            "Peru",
+            "Pink",
+            "Plum",
+            "Powderblue",
+            "Purple",
+            "Red",
+            "Rosybrown",
+            "Royalblue",
+            "Saddlebrown",
+            "Salmon",
+            "Sandybrown",
+            "Seagreen",
+            "Seashell",
+            "Sienna",
+            "Silver",
+            "Skyblue",
+            "Slateblue",
+            "Slategray",
+            "Snow",
+            "Springgreen",
+            "Steelblue",
+            "Tan",
+            "Teal",
+            "Thistle",
+            "Tomato",
+            "Turquoise",
+            "Violet",
+            "Wheat",
+            "White",
+            "Whitesmoke",
+            "Yellow",
+            "Yellowgreen",
             "colorPicker1",
             ""});
-            this.backColorPicker1.Location = new System.Drawing.Point(278, 77);
+            this.backColorPicker1.Location = new System.Drawing.Point(273, 12);
             this.backColorPicker1.Name = "backColorPicker1";
             this.backColorPicker1.Size = new System.Drawing.Size(121, 21);
             this.backColorPicker1.TabIndex = 33;
@@ -10385,68 +10705,11 @@
             this.backColorPicker1.SelectedValueChanged += new System.EventHandler(this.ctlBackColor_Change);
             this.backColorPicker1.Validated += new System.EventHandler(this.ctlBackColor_Change);
             //
-            // mainTC
-            //
-            this.mainTC.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
-                        | System.Windows.Forms.AnchorStyles.Left)
-                        | System.Windows.Forms.AnchorStyles.Right)));
-            this.mainTC.Controls.Add(this.tabPage1);
-            this.mainTC.Controls.Add(this.tabPage2);
-            this.mainTC.Location = new System.Drawing.Point(0, 104);
-            this.mainTC.Name = "mainTC";
-            this.mainTC.SelectedIndex = 0;
-            this.mainTC.Size = new System.Drawing.Size(712, 342);
-            this.mainTC.TabIndex = 34;
-            this.mainTC.MouseClick += new System.Windows.Forms.MouseEventHandler(this.mainTC_MouseClick);
-            this.mainTC.SelectedIndexChanged += new System.EventHandler(this.mainTC_SelectedIndexChanged);
-            //
-            // tabPage1
-            //
-            this.tabPage1.Location = new System.Drawing.Point(4, 22);
-            this.tabPage1.Name = "tabPage1";
-            this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
-            this.tabPage1.Size = new System.Drawing.Size(704, 316);
-            this.tabPage1.TabIndex = 0;
-            this.tabPage1.Text = "tabPage1";
-            this.tabPage1.UseVisualStyleBackColor = true;
-            //
-            // tabPage2
-            //
-            this.tabPage2.Location = new System.Drawing.Point(4, 22);
-            this.tabPage2.Name = "tabPage2";
-            this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
-            this.tabPage2.Size = new System.Drawing.Size(704, 304);
-            this.tabPage2.TabIndex = 1;
-            this.tabPage2.Text = "tabPage2";
-            this.tabPage2.UseVisualStyleBackColor = true;
-            //
-            // label1
-            //
-            this.label1.AutoSize = true;
-            this.label1.Location = new System.Drawing.Point(9, 80);
-            this.label1.Name = "label1";
-            this.label1.Size = new System.Drawing.Size(58, 13);
-            this.label1.TabIndex = 0;
-            this.label1.Text = "Fore Color:";
-            //
-            // label2
-            //
-            this.label2.AutoSize = true;
-            this.label2.Location = new System.Drawing.Point(214, 80);
-            this.label2.Name = "label2";
-            this.label2.Size = new System.Drawing.Size(62, 13);
-            this.label2.TabIndex = 35;
-            this.label2.Text = "Back Color:";
-            //
             // RdlDesigner
             //
             this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
             this.ClientSize = new System.Drawing.Size(712, 470);
-            this.Controls.Add(this.label2);
-            this.Controls.Add(this.label1);
-            this.Controls.Add(this.mainTC);
-            this.Controls.Add(this.backColorPicker1);
-            this.Controls.Add(this.foreColorPicker1);
+            this.Controls.Add(this.panel1);
             this.Controls.Add(this.toolStrip1);
             this.Controls.Add(this.mainTB);
             this.Controls.Add(this.menuStrip1);
@@ -10462,7 +10725,8 @@
             this.mainTB.PerformLayout();
             this.toolStrip1.ResumeLayout(false);
             this.toolStrip1.PerformLayout();
-            this.mainTC.ResumeLayout(false);
+            this.panel1.ResumeLayout(false);
+            this.panel1.PerformLayout();
             this.ResumeLayout(false);
             this.PerformLayout();

@@ -10623,8 +10887,6 @@
         private ToolStripComboBox zoomToolStripComboBox1;
         private ToolStripButton selectToolStripButton2;
         private TabControl mainTC;
-        private TabPage tabPage1;
-        private TabPage tabPage2;
         private ToolStripButton pdfToolStripButton2;
         private ToolStripButton htmlToolStripButton2;
         private ToolStripButton excelToolStripButton2;
@@ -10635,5 +10897,6 @@
         private ToolStripButton TifToolStripButton2;
         private Label label1;
         private Label label2;
+        private Panel panel1;
 	}
 }


fix(TouchHandler): Only decrease touch counter if last touch event is concluded.

Two touch events got the same identifier when the first touch is concluded before the second and brought back before second one concludes.

Fixes #371

--- ReactNative/Touch/TouchHandler.cs
+++ ReactNative/Touch/TouchHandler.cs
@@ -97,7 +97,16 @@
                 UpdatePointerForEvent(pointer, e);
                 DispatchTouchEvent(touchEventType, _pointers, pointerIndex);

-                --_activePointers;
+                if (_activePointers == pointerIndex + 1)
+                {
+                    --_activePointers;
+                }
+
+                if (_pointers.Count == 1)
+                {
+                    _activePointers = 0;
+                }
+
                 _pointers.RemoveAt(pointerIndex);

                 _view.ReleasePointerCapture(e.Pointer);


Formを参照してないとビルド通らなかったのでコメントアウト

Formを参照してないとビルド通らなかったのでコメントアウト

--- GameLoop/FPSTimer.cs
+++ GameLoop/FPSTimer.cs
@@ -3,6 +3,7 @@
 using System.Linq;
 using System.Text;
 using System.Diagnostics;
+//using System.Windows.Forms;
 using System.Runtime.InteropServices;

@@ -492,11 +493,11 @@
         /// 引数に指定したフォームのClosingイベントにスレッドを中止する処理を追加します
         /// </summary>
         /// <param name="form"></param>
-        public void UseWindowsForm(Form form)
-        {
-            if (form != null)
-                form.FormClosing += new FormClosingEventHandler(FormClosing);
-        }
+        //public void UseWindowsForm(Form form)
+        //{
+        //    if (form != null)
+        //        form.FormClosing += new FormClosingEventHandler(FormClosing);
+        //}

         #endregion パブリックメソッド

@@ -507,10 +508,10 @@
             thread.IsBackground = true;
         }

-        void FormClosing(object sender, FormClosingEventArgs e)
-        {
-            Abort();
-        }
+        //void FormClosing(object sender, FormClosingEventArgs e)
+        //{
+        //    Abort();
+        //}
         #endregion プライベートメソッド
     }
 }


Add a polly retry policy and a reliable way of removing folders by normalising attributes and retrying when an exception occurs. Fixes issue #3.

--- src/MysticMind.PostgresEmbed/PgServer.cs
+++ src/MysticMind.PostgresEmbed/PgServer.cs
@@ -41,7 +41,8 @@

         private bool _addLocalUserAccessPermission;

-        private Policy _retryPolicy;
+        private Policy _downloadRetryPolicy;
+        private Policy _deleteFoldersRetryPolicy;

         public PgServer(
             string pgVersion,
@@ -53,7 +54,10 @@
             List<PgExtensionConfig> pgExtensions = null,
             bool addLocalUserAccessPermission = false,
             bool clearInstanceDirOnStop = false,
-            bool clearWorkingDirOnStart=false)
+            bool clearWorkingDirOnStart=false,
+            int deleteFolderRetryCount =5,
+            int deleteFolderInitialTimeout =16,
+            int deleteFolderTimeoutFactor =2)
         {
             PgVersion = pgVersion;

@@ -115,9 +119,13 @@

             // setup the policy for retry pertaining to downloading binary
-            _retryPolicy =
+            _downloadRetryPolicy =
                 Polly.Policy.Handle<Exception>()
                     .WaitAndRetry(new[] { TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(2), TimeSpan.FromSeconds(4) });
+            //Set up the policy for retry pertaining to folder deletion.
+            _deleteFoldersRetryPolicy =
+                Polly.Policy.Handle<Exception>()
+                    .WaitAndRetry(deleteFolderRetryCount, retryAttempt =>TimeSpan.FromMilliseconds(deleteFolderInitialTimeout *(int) Math.Pow(deleteFolderTimeoutFactor, retryAttempt-1)));
         }

         public string PgVersion { get; private set; }
@@ -152,7 +160,7 @@

             try
             {
-                _pgBinaryFullPath = _retryPolicy.Execute(() => downloader.Download());
+                _pgBinaryFullPath = _downloadRetryPolicy.Execute(() => downloader.Download());
             }
             catch (Exception ex)
             {
@@ -165,7 +173,7 @@
             foreach (var extnConfig in _pgExtensions)
             {
                 var pgExtensionInstance = new PgExtension(PgVersion, PG_HOST, PgPort, PgUser, PgDbName, BinariesDir, PgDir, extnConfig);
-                _retryPolicy.Execute(() => pgExtensionInstance.Download());
+                _downloadRetryPolicy.Execute(() => pgExtensionInstance.Download());
             }
         }

@@ -177,26 +185,40 @@
             Directory.CreateDirectory(DataDir);
         }

-        private void RemoveWorkingDir()
-        {
-            try
-            {
-                Directory.Delete(DbDir, true);
-            }
-            catch
-            {
-            }
-        }
-
-        private void RemoveInstanceDir()
-        {
-            try
-            {
-                Directory.Delete(InstanceDir, true);
-            }
-            catch
-            {
-            }
+        private void RemoveWorkingDir() => DeleteDirectory(DbDir);
+
+        private void RemoveInstanceDir() => DeleteDirectory(InstanceDir);
+
+        private void DeleteDirectory(string directoryPath)
+        {
+            // From http://stackoverflow.com/questions/329355/cannot-delete-directory-with-directory-deletepath-true/329502#329502
+
+            if (!Directory.Exists(directoryPath))
+            {
+                Trace.WriteLine(string.Format("Directory '{0}' is missing and can't be removed.", directoryPath));
+                return;
+            }
+
+            NormalizeAttributes(directoryPath);
+            _deleteFoldersRetryPolicy.Execute(() =>Directory.Delete(directoryPath, true));
+        }
+
+        private static void NormalizeAttributes(string directoryPath)
+        {
+            string[] filePaths = Directory.GetFiles(directoryPath);
+            string[] subdirectoryPaths = Directory.GetDirectories(directoryPath);
+
+            foreach (string filePath in filePaths)
+            {
+                File.SetAttributes(filePath, FileAttributes.Normal);
+            }
+
+            foreach (string subdirectoryPath in subdirectoryPaths)
+            {
+                NormalizeAttributes(subdirectoryPath);
+            }
+
+            File.SetAttributes(directoryPath, FileAttributes.Normal);
         }

         private void ExtractPgBinary()
@@ -209,7 +231,7 @@
             foreach (var extnConfig in _pgExtensions)
             {
                 var pgExtensionInstance = new PgExtension(PgVersion, PG_HOST, PgPort, PgUser, PgDbName, BinariesDir, PgDir, extnConfig);
-                _retryPolicy.Execute(() => pgExtensionInstance.Extract());
+                _downloadRetryPolicy.Execute(() => pgExtensionInstance.Extract());
             }
         }

@@ -279,7 +301,7 @@
             foreach (var extnConfig in _pgExtensions)
             {
                 var pgExtensionInstance = new PgExtension(PgVersion, PG_HOST, PgPort, PgUser, PgDbName, BinariesDir, PgDir, extnConfig);
-                _retryPolicy.Execute(() => pgExtensionInstance.CreateExtension());
+                _downloadRetryPolicy.Execute(() => pgExtensionInstance.CreateExtension());
             }
         }


Code clean-up

Code clean-up

--- src/Nancy/Extensions/StringExtensions.cs
+++ src/Nancy/Extensions/StringExtensions.cs
@@ -32,10 +32,7 @@

             if (nameMatch.Any())
             {
-                //foreach (var capture in nameMatch.Captures)
-                //{
-                //    yield return
-                //}
+
                 return nameMatch.Select(x => x.Groups["name"].Value);
             }

@@ -66,8 +63,12 @@
         {
             var coll = HttpUtility.ParseQueryString(queryString);
             var ret = new DynamicDictionary();
-            foreach (var key in coll.AllKeys.Where(key => key != null))
+
+            foreach (var key in coll.AllKeys.Where(key => key != null))
+            {
                 ret[key] = coll[key];
+            }
+
             return ret;
         }
     }


easier step debugging

easier step debugging

git-svn-id: fcce7d6ce0ac15bf24f68871b5145d46fc068279@2227 2c1201b4-01cd-e047-a400-b836ae1fbc61

--- src/booc/App.cs
+++ src/booc/App.cs
@@ -564,7 +564,7 @@
 			}
 			if (debugSteps)
 			{
-				_options.Pipeline.AfterStep += new CompilerStepEventHandler(DebugModuleAfterStep);
+				_options.Pipeline.AfterStep += new CompilerStepEventHandler(new StepDebugger().AfterStep);
 			}
 			if (!noLogo)
 			{
@@ -581,10 +581,27 @@
 			return s;
 		}

-		private void DebugModuleAfterStep(object sender, CompilerStepEventArgs args)
-		{
-			Console.WriteLine("********* {0} *********", args.Step);
-			args.Context.CompileUnit.Accept(new BooPrinterVisitor(Console.Out, BooPrinterVisitor.PrintOptions.PrintLocals));
+		private class StepDebugger
+		{
+			string _last;
+
+			public void AfterStep(object sender, CompilerStepEventArgs args)
+			{
+				Console.WriteLine("********* {0} *********", args.Step);
+
+				StringWriter writer = new StringWriter();
+				args.Context.CompileUnit.Accept(new BooPrinterVisitor(writer, BooPrinterVisitor.PrintOptions.PrintLocals));
+				string code = writer.ToString();
+				if (code != _last)
+				{
+					Console.WriteLine(code);
+				}
+				else
+				{
+					Console.WriteLine("no changes");
+				}
+				_last = code;
+			}
 		}

 		ArrayList LoadResponseFile(string file)


Changed PTB getText

Changed PTB getText

Previously checking if textbox was editable before trying to read from
it.  Now only checking that the element exists before trying to read
from it.

--- ProtoTest.Golem/Purple/PurpleElements/PurpleTextBox.cs
+++ ProtoTest.Golem/Purple/PurpleElements/PurpleTextBox.cs
@@ -11,11 +11,7 @@
         {
             get
             {
-                string enteredText = "ELEMENT NOT FOUND";
-                if (PurpleElement.Current.IsEnabled)
-                {
-                    enteredText = GetText();
-                }
+                string enteredText = GetText();
                 return enteredText;
             }
             set


Added nullcheck

Added nullcheck

--- Quilt4.Service/Controllers/Web/WebProjectController.cs
+++ Quilt4.Service/Controllers/Web/WebProjectController.cs
@@ -70,6 +70,9 @@
         [Route("api/project/getUsers")]
         public IEnumerable<ProjectMember> GetUsers(GetUsersRequest request)
         {
+            if (request == null && string.IsNullOrEmpty(request.Email))
+                return null;
+
             var members = _projectBusiness.GetMembers(request.Email);

             return members;