System.DateTimeParse.GetDateOfNNDS C# (CSharp) Méthode

GetDateOfNNDS() private static méthode

private static GetDateOfNNDS ( DateTimeResult &result, DateTimeRawInfo &raw, DateTimeFormatInfo dtfi ) : Boolean
result DateTimeResult
raw DateTimeRawInfo
dtfi DateTimeFormatInfo
Résultat Boolean
        private static Boolean GetDateOfNNDS(ref DateTimeResult result, ref DateTimeRawInfo raw, DateTimeFormatInfo dtfi)
        {

            // For partial CJK Dates, the only valid formats are with a specified year, followed by two numbers, which
            // will be the Month and Day, and with a specified Month, when the numbers are either the year and day or
            // day and year, depending on the short date pattern.

            if ((result.flags & ParseFlags.HaveYear) != 0) {
                if (((result.flags & ParseFlags.HaveMonth) == 0) && ((result.flags & ParseFlags.HaveDay) == 0)) {
                    if (SetDateYMD(ref result, result.Year = AdjustYear(ref result, raw.year), raw.GetNumber(0), raw.GetNumber(1))) {
                        return true;
                    }
                }
            }
            else if ((result.flags & ParseFlags.HaveMonth) != 0) {
                if (((result.flags & ParseFlags.HaveYear) == 0) && ((result.flags & ParseFlags.HaveDay) == 0)) {
                    int order;
                    if (!GetYearMonthDayOrder(dtfi.ShortDatePattern, dtfi, out order)) {
                        result.SetFailure(ParseFailureKind.FormatWithParameter, "Format_BadDatePattern", dtfi.ShortDatePattern);
                        return false;
                    }
                    int year;
                    if (order == ORDER_YMD) {
                        if (SetDateYMD(ref result, year = AdjustYear(ref result, raw.GetNumber(0)), result.Month, raw.GetNumber(1))) {
                            return true;
                        }
                    }
                    else {
                        if (SetDateYMD(ref result, year = AdjustYear(ref result, raw.GetNumber(1)), result.Month, raw.GetNumber(0))){
                            return true;
                        }
                    }
                }
            }
            result.SetFailure(ParseFailureKind.Format, "Format_BadDateTime", null);
            return false;
        }