FarsiLibrary Find and returns a FieldInfo by its name, on the specified type. Sets a value to a field of the owner object Find and returns a FieldInfo by its name, on the specified type. returns value of a field in the owner object. Returns ProprtyInfo of a Returns value of a property in the owner object. Returns value of a property in the owner object. The number of milliseconds represented by each instance of this TimeUnit. The maximum quantity of this Unit to be used as a threshold for the next largest Unit (e.g. if one Second represents 1000ms, and Second has a maxQuantity of 5, then if the difference between compared timestamps is larger than 5000ms, PrettyTime will move on to the next smallest TimeUnit for calculation; Minute, by default) The grammatically singular name for this unit of time. (e.g. one "second") The grammatically plural name for this unit of time. (e.g. many "seconds") Farsi Localizer Helper class to convert numbers to it's farsi equivalent. Use this class' methods to overcome a problem in displaying farsi numeric values. Converts a Farsi number to it's English numeric values. This method only converts the numbers in a string, and does not convert any non-numeric characters. Class to convert PersianDate into normal DateTime value and vice versa. You can use FarsiLibrary.Utils.FarsiDate.Now property to access current Date. Checks if a specified Persian year is a leap one. returns 1 if the year is leap, otherwise returns 0. Checks if a year is a leap one. Year to check true if the year is leap Checks if a specified Gregorian year is a leap one. returns 1 if the year is leap, otherwise returns 0. Converts a Gregorian Date of type System.DateTime class to Persian Date. DateTime to evaluate string representation of Jalali Date Converts a Gregorian Date of type String and a TimeSpan into a Persian Date. Converts a Gregorian Date of type String class to Persian Date. Date to evaluate string representation of Jalali Date. Converts a Persian Date of type String to Gregorian Date of type DateTime class. Date to evaluate Gregorian DateTime representation of evaluated Jalali Date. Converts a Persian Date of type String to Gregorian Date of type String. Gregorian DateTime representation in string format of evaluated Jalali Date. Gets Persian Weekday name from specified Gregorian Date. Returns number of days in specified month number. Month no to evaluate in integer number of days in the evaluated month A wrapper around Win32 Theming. Return which theme is currently active. Formats a duration Helper class to convert numbers to it's farsi equivalent. Use this class' methods to overcome a problem in displaying farsi numeric values. Converts a number in string format e.g. 14500 to its localized version, if Localized value is set to true. Converts an English number to it's Farsi value. This method only converts the numbers in a string, and does not convert any non-numeric characters. PersianCalendar calendar. Persian calendar, also named Jalaali calendar, was first based on Solar year by Omar Khayyam, the great Iranian poet, astrologer and scientist. Jalaali calendar is approximately 365 days. Each of the first six months in the Jalaali calendar has 31 days, each of the next five months has 30 days, and the last month has 29 days in a common year and 30 days in a leap year. A leap year is a year that, when divided by 33, has a remainder of 1, 5, 9, 13, 17, 22, 26, or 30. For example, the year 1370 is a leap year because dividing it by 33 yields a remainder of 17. There are approximately 8 leap years in every 33 year cycle. Maximum amount of month that can be added or removed to / from a DateTime instance. Represents the current era. The Persian calendar recognizes only A.P (Anno Persarum) era. Returns a DateTime that is the specified number of months away from the specified DateTime. The DateTime instance to add. The number of months to add. The DateTime that results from adding the specified number of months to the specified DateTime. The year part of the resulting DateTime is affected if the resulting month is beyond the last month of the current year. The day part of the resulting DateTime is also affected if the resulting day is not a valid day in the resulting month of the resulting year; it is changed to the last valid day in the resulting month of the resulting year. The time-of-day part of the resulting DateTime remains the same as the specified DateTime. For example, if the specified month is Ordibehesht, which is the 2nd month and has 31 days, the specified day is the 31th day of that month, and the value of the months parameter is -3, the resulting year is one less than the specified year, the resulting month is Bahman, and the resulting day is the 30th day, which is the last day in Bahman. If the value of the months parameter is negative, the resulting DateTime would be earlier than the specified DateTime. Returns a DateTime that is the specified number of years away from the specified DateTime. The DateTime instance to add. The number of years to add. The DateTime that results from adding the specified number of years to the specified DateTime. The day part of the resulting DateTime is affected if the resulting day is not a valid day in the resulting month of the resulting year; it is changed to the last valid day in the resulting month of the resulting year. The time-of-day part of the resulting DateTime remains the same as the specified DateTime. For example, Esfand has 29 days, except during leap years when it has 30 days. If the specified Date is the 30th day of Esfand in a leap year and the value of years is 1, the resulting Date will be the 29th day of Esfand in the following year. If years is negative, the resulting DateTime would be earlier than the specified DateTime. Gets the day of the month in the specified DateTime. The DateTime instance to read. An integer from 1 to 31 that represents the day of the month in time. Gets the day of the week in the specified DateTime. The DateTime instance to read. A DayOfWeek value that represents the day of the week in time. The DayOfWeek values are Sunday which indicates YekShanbe', Monday which indicates DoShanbe', Tuesday which indicates SeShanbe', Wednesday which indicates ChaharShanbe', Thursday which indicates PanjShanbe', Friday which indicates Jom'e, and Saturday which indicates Shanbe'. Gets the day of the year in the specified DateTime. The DateTime instance to read. An integer from 1 to 366 that represents the day of the year in time. Gets the number of days in the specified month. An integer that represents the year. An integer that represents the month. An integer that represents the era. The number of days in the specified month in the specified year in the specified era. For example, this method might return 29 or 30 for Esfand (month = 12), depending on whether year is a leap year. Gets the number of days in the year specified by the year and era parameters. An integer that represents the year. An integer that represents the era. The number of days in the specified year in the specified era. For example, this method might return 365 or 366, depending on whether year is a leap year. Gets the era in the specified DateTime. The DateTime instance to read. An integer that represents the era in time. The Persian calendar recognizes one era: A.P. (Latin "Anno Persarum", which means "the year of/for Persians"). Gets the month in the specified DateTime. The DateTime instance to read. An integer between 1 and 12 that represents the month in time. Month 1 indicates Farvardin, month 2 indicates Ordibehesht, month 3 indicates Khordad, month 4 indicates Tir, month 5 indicates Amordad, month 6 indicates Shahrivar, month 7 indicates Mehr, month 8 indicates Aban, month 9 indicates Azar, month 10 indicates Dey, month 11 indicates Bahman, and month 12 indicates Esfand. Gets the number of months in the year specified by the year and era parameters. An integer that represents the year. An integer that represents the era. The number of months in the specified year in the specified era. Gets the year in the specified DateTime. The DateTime instance to read. An integer between 1 and 9378 that represents the year in time. Determines whether the Date specified by the year, month, day, and era parameters is a leap day. An integer that represents the year. An integer that represents the month. An integer that represents the day. An integer that represents the era. true if the specified day is a leap day; otherwise, false. In the Persian calendar leap years are applied every 4 or 5 years according to a certain pattern that iterates in a 2820-year cycle. A common year has 365 days and a leap year has 366 days. A leap day is a day that occurs only in a leap year. In the Persian calendar, the 30th day of Esfand (month 12) is the only leap day. Determines whether the month specified by the year, month, and era parameters is a leap month. An integer that represents the year. An integer that represents the month. An integer that represents the era. This method always returns false, unless overridden by a derived class. In the Persian calendar leap years are applied every 4 or 5 years according to a certain pattern that iterates in a 2820-year cycle. A common year has 365 days and a leap year has 366 days. A leap month is an entire month that occurs only in a leap year. The Persian calendar does not have any leap months. Determines whether the month specified by the year, month, and era parameters is a leap month. An integer that represents the year. An integer that represents the month. This method always returns false, unless overridden by a derived class. In the Persian calendar leap years are applied every 4 or 5 years according to a certain pattern that iterates in a 2820-year cycle. A common year has 365 days and a leap year has 366 days. A leap month is an entire month that occurs only in a leap year. The Persian calendar does not have any leap months. Determines whether the year specified by the year and era parameters is a leap year. An integer that represents the year. An integer that represents the era. true if the specified year is a leap year; otherwise, false. In the Persian calendar leap years are applied every 4 or 5 years according to a certain pattern that iterates in a 2820-year cycle. A common year has 365 days and a leap year has 366 days. Returns a DateTime that is set to the specified Date and time in the specified era. An integer that represents the year. An integer that represents the month. An integer that represents the day. An integer that represents the hour. An integer that represents the minute. An integer that represents the second. An integer that represents the millisecond. An integer that represents the era. The DateTime instance set to the specified Date and time in the current era. Converts the specified two-digit year to a four-digit year by using the Globalization.PersianCalendar.TwoDigitYearMax property to determine the appropriate century. A two-digit integer that represents the year to convert. An integer that contains the four-digit representation of year. TwoDigitYearMax is the last year in the 100-year range that can be represented by a two-digit year. The century is determined by finding the sole occurrence of the two-digit year within that 100-year range. For example, if TwoDigitYearMax is set to 1429, the 100-year range is from 1330 to 1429; therefore, a 2-digit value of 30 is interpreted as 1330, while a 2-digit value of 29 is interpreted as 1429. Gets the century of the specified DateTime. An instance of the DateTime class to read. An integer from 1 to 94 that represents the century. A century is a whole 100-year period. So the century 14 for example, represents years 1301 through 1400. Calculates the number of leap years until -but not including- the specified year. An integer between 1 and 9378 An integer representing the number of leap years that have occured by the year specified. In the Persian calendar leap years are applied every 4 or 5 years according to a certain pattern that iterates in a 2820-year cycle. A common year has 365 days and a leap year has 366 days. Algorithm Type Maximum supported date time by this calendar. Minimum supported date time by this calendar. Gets the list of eras in the PersianCalendar. The Persian calendar recognizes one era: A.P. (Latin "Anno Persarum", which means "the year of/for Persians"). Gets and sets the last year of a 100-year range that can be represented by a 2-digit year. The last year of a 100-year range that can be represented by a 2-digit year. This property allows a 2-digit year to be properly translated to a 4-digit year. For example, if this property is set to 1429, the 100-year range is from 1330 to 1429; therefore, a 2-digit value of 30 is interpreted as 1330, while a 2-digit value of 29 is interpreted as 1429. PersianDate class to work with dates in Jalali calendar transparently. An example on how to convert current System.DateTime to PersianDate. class MyClass { public static void Main() { Console.WriteLine("Current Persian Date Is : " + PersianDate.Now.ToString()); } } You can alternatively create a specified date/time based on specific DateTime value. To do this you need to use PersianDateConverter class. Static constructor initializes Now property of PersianDate and Min/Max values. Constructs a PersianDate instance with values provided in datetime string. You should include Date part only in Date and set the Time of the instance as a TimeSpan. Constructs a PersianDate instance with values provided as a string. The provided string should be in format 'yyyy/mm/dd'. Constructs a PersianDate instance with values specified as Integer and default second and millisecond set to zero. Constructs a PersianDate instance with values specified as Integer and default millisecond set to zero. Constructs a PersianDate instance with values specified as Integer. Constructs a PersianDate instance with values specified as Integer. Time value of this instance is set to DateTime.Now. Assigns an instance of PersianDate's values to this instance. Returns a string representation of current PersianDate value. Returns a pretty representation of this date instance Tries to parse a string value into a PersianDate instance. Value can only be in 'yyyy/mm/dd' format. Parse a string value into a PersianDate instance. Returns Date in 'yyyy/mm/dd' string format. string representation of evaluated Date. An example on how to get the written form of a Date. class MyClass { public static void Main() { Console.WriteLine(PersianDate.Now.ToString()); } } Compares two instance of the PersianDate for the specified operator. Compares two instance of the PersianDate for the specified operator. Compares two instance of the PersianDate for the specified operator. Compares two instance of the PersianDate for the specified operator. Compares two instance of the PersianDate for the specified operator. Compares two instance of the PersianDate for the specified operator. Serves as a hash function for a particular type. System.Object.GetHashCode() is suitable for use in hashing algorithms and data structures like a hash table. Determines whether the specified System.Object instances are considered equal. Converts a nullable DateTime to PersianDate. Compares the current instance with another object of the same type. A 32-bit signed integer that indicates the relative order of the objects being compared. The return value has these meanings: Value Meaning Less than zero This instance is less than obj. Zero This instance is equal to obj. Greater than zero This instance is greater than obj. An object to compare with this instance. obj is not the same type as this instance. 2 Compares two objects and returns a value indicating whether one is less than, equal to, or greater than the other. Value Condition Less than zero x is less than y. Zero x equals y. Greater than zero x is greater than y. The second object to compare. The first object to compare. Neither x nor y implements the interface.-or- x and y are of different types and neither one can handle comparisons with the other. 2 Either x or y is a null reference Compares the current object with another object of the same type. A 32-bit signed integer that indicates the relative order of the objects being compared. The return value has the following meanings: Value Meaning Less than zero This object is less than the other parameter.Zero This object is equal to other. Greater than zero This object is greater than other. An object to compare with this object. Compares two objects and returns a value indicating whether one is less than, equal to, or greater than the other. Value Condition Less than zerox is less than y.Zerox equals y.Greater than zero x is greater than y. The second object to compare. The first object to compare. Indicates whether the current object is equal to another object of the same type. true if the current object is equal to the other parameter; otherwise, false. An object to compare with this object. Returns string representation of this instance in default format. Returns string representation of this instance and format it using the instance. Returns string representation of this instance in desired format, or using provided instance. Current date/time in PersianDate format. Year value of PersianDate. Month value of PersianDate. Day value of PersianDate. Hour value of PersianDate. Minute value of PersianDate. Second value of PersianDate. Millisecond value of PersianDate. Time value of PersianDate in TimeSpan format. Returns the DayOfWeek of the date instance Localized name of PersianDate months. Weekday names of this instance in localized format. Number of days in this month. Helper class for guard statements, which allow prettier code for guard clauses Will throw a if the assertion is true, with the specificied message. if set to true [assertion]. The message. Sample usage: Guard.Against(string.IsNullOrEmpty(name), "Name must have a value"); Will throw exception of type with the specified message if the assertion is true if set to true [assertion]. The message. Sample usage: (string.IsNullOrEmpty(name), "Name must have a value"); ]]> Classes to convert a number to its persian written form. It accepts both an Integer or Long as input parameter. Thrown when input number is larger than 999999999999 An example on how to convert a Integer number to words. class MyClass { public static void Main() { Console.WriteLine(FarsiLibrary.Utils.ToWords.ToString(1452)); } } Has two overloads. Converts an integer number to its written form in Persian Converts a long number to its written form in Persian Localizer class used to get string values of Arabic language. Gets a localized string for Arabic culture, for specified . Adds a preceding zero to single day or months CultureInfo for "FA-IR" culture, which has correct calendar information. Initializes a new instance of the class. Creates a copy of the current . A copy of the current . Gets the default calendar used by the culture. A that represents the default calendar used by the culture. Gets the list of calendars that can be used by the culture. An array of type that represents the calendars that can be used by the culture represented by the current . Gets or sets a that defines the culturally appropriate format of displaying dates and times. A that defines the culturally appropriate format of displaying dates and times. The property is set to null. Base culture information Returns the day of week based on calendar. Finds the corresponding DayOfWeek in specified culture Currently selected UICulture Instance of Arabic culture Instance of Farsi culture Instance of Persian Culture with correct date formatting. Instance of Neutral culture Returns the default calendar for the current culture. Converts the DateTime to a PersianDate equivalant. Converts the PersianDate to a DateTime equivalant. Various Strings that could be translater in Localizers. Localizer class to work with internal localized strings. Returns an instance of the localized based on CurrentUICulture of the thread. Returns a localizer instance based on the culture. Fires the LocalizerChanged event. Fired when Localizer has changed. Singleton Instance of FALocalizeManager. Custom culture, when set , is used across all controls. Farsi Culture Arabic Culture Invariant Culture Gets or Sets a new instance of Localizer. If this value is initialized (default is null), Localize Manager class will use the custom class provided, to interpret localized strings.