System.DateTimeParse.GetDayOfYNN C# (CSharp) Method

GetDayOfYNN() private static method

private static GetDayOfYNN ( DateTimeResult &result, DateTimeRawInfo &raw, DateTimeFormatInfo dtfi ) : Boolean
result DateTimeResult
raw DateTimeRawInfo
dtfi DateTimeFormatInfo
return Boolean
        private static Boolean GetDayOfYNN(ref DateTimeResult result, ref DateTimeRawInfo raw, DateTimeFormatInfo dtfi) {

            if ((result.flags & ParseFlags.HaveDate) != 0) {
                // Multiple dates in the input string
                result.SetFailure(ParseFailureKind.Format, "Format_BadDateTime", null);
                return false;
            }

            int n1 = raw.GetNumber(0);
            int n2 = raw.GetNumber(1);
            String pattern = dtfi.ShortDatePattern;

            // by the way, I think I've seen the opposite behavior in the tables.
            if (dtfi.CultureId == 0x0437) {
                // 0x0437 = Georgian - Georgia (ka-GE)
                // Very special case for ka-GE:
                //  Its short date patten is "dd.MM.yyyy" (ORDER_DMY).
                //  However, its long date pattern is "yyyy '\x10ec\x10da\x10d8\x10e1' dd MM, dddd" (ORDER_YDM)
                pattern = dtfi.LongDatePattern;
            }

            // For compatability, don't throw if we can't determine the order, but default to YMD instead
            int order;
            if (GetYearMonthDayOrder(pattern, dtfi, out order) && order == ORDER_YDM) {
                if (SetDateYMD(ref result, raw.year, n2, n1)) {
                    result.flags |= ParseFlags.HaveDate;
                    return true; // Year + DM
                }
            }
            else {
                if (SetDateYMD(ref result, raw.year, n1, n2)) {
                    result.flags |= ParseFlags.HaveDate;
                    return true; // Year + MD
                }
            }
            result.SetFailure(ParseFailureKind.Format, "Format_BadDateTime", null);
            return false;
        }