Merge pull request #913 from Daniel15/fix-catchall-routing-master
[mono.git] / mcs / class / corlib / System.Globalization / PersianCalendar.cs
index a25ed2eab98a6918158c02f8d98d9fa0b5e4460e..576abb7a18a81f68d9c2998b87967ac7f1b697b2 100644 (file)
@@ -1,5 +1,5 @@
 //
-// PersianCalendar.cs: Implements the Persian calendar
+// System.Globalization.PersianCalendar.cs
 //
 // Authors:
 //   Roozbeh Pournader (roozbeh@farsiweb.info)
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if NET_2_0
-
 namespace System.Globalization {
 
 using System;
 using System.IO;
+using System.Runtime.InteropServices;
 
 /// <summary>
 /// This is the Persian calendar of Iran, also known as the Iranian
@@ -65,6 +64,7 @@ using System.IO;
 /// on the mean tropical year, not the mean March equinoctial year.
 /// </para>
 /// </remarks>
+[Serializable]
 public class PersianCalendar : Calendar {
        /// <summary>
        /// Constructor.
@@ -72,10 +72,10 @@ public class PersianCalendar : Calendar {
        public PersianCalendar() {
                M_AbbrEraNames = new string[] {"A.P."};
                M_EraNames = new string[] {"Anno Persico"};
-               if (M_TwoDigitYearMax == 99)
+               if (twoDigitYearMax == 99)
                        // FIXME: the .NET documentation does not mention the default value,
                        // This is the value mentioned in the .NET documentation example result.
-                       M_TwoDigitYearMax = 1410;
+                       twoDigitYearMax = 1410;
        }
 
        /// <summary>
@@ -104,10 +104,6 @@ public class PersianCalendar : Calendar {
                        return new int[] { PersianEra }; 
                }
        }
-
-       // FIXME: the .NET documentation does not mention the default value,
-       // This is the value mentioned in the .NET documentation example result.
-       int twoDigitYearMax = 1410;
        
        public override int TwoDigitYearMax {
                get {
@@ -501,6 +497,11 @@ public class PersianCalendar : Calendar {
                return PersianEra;
        }
 
+       public override int GetLeapMonth (int year, int era)
+       {
+               return 0;
+       }
+
        /// <summary>
        /// Overridden. Gives the number of the month of the specified
        /// date.
@@ -670,14 +671,14 @@ public class PersianCalendar : Calendar {
        /// </exception>
        public override DateTime ToDateTime(int year, int month, int day,
                                            int hour, int minute,
-                                           int second, int milliseconds,
+                                           int second, int millisecond,
                                            int era)
        {
                M_CheckYMDE(year, month, day, ref era);
-               M_CheckHMSM(hour, minute, second, milliseconds);
+               M_CheckHMSM(hour, minute, second, millisecond);
                int rd = fixed_from_dmy(day, month, year);
                return CCFixed.ToDateTime(rd,
-                       hour, minute, second, milliseconds);
+                       hour, minute, second, millisecond);
        }
 
        // FIXME: Calendar.cs and HebrewCalendar.cs are different in
@@ -696,8 +697,26 @@ public class PersianCalendar : Calendar {
                        return baseCentury + year - 100;
        }
 
+       public override CalendarAlgorithmType AlgorithmType {
+               get {
+                       return CalendarAlgorithmType.SolarCalendar;
+               }
+       }
+
+       static DateTime PersianMin = new DateTime (622, 3, 21, 0, 0, 0);
+       static DateTime PersianMax = new DateTime (9999, 12, 31, 11, 59, 59);
+               
+       public override DateTime MinSupportedDateTime {
+               get {
+                       return PersianMin;
+               }
+       }
+
+       public override DateTime MaxSupportedDateTime {
+               get {
+                       return PersianMax;
+               }
+       }
 } // class PersianCalendar
        
 } // namespace System.Globalization
-
-#endif