Component-based C # Log Algorithm

zhaozj2021-02-16  47

// The following is a lunar calendar algorithm / / date data definition method as follows // The first 12 bytes represent from 1 to December for the day, 1 for the day, 0 is the month 29 days , // The 13th is the case of the month, and 1 is 30 days in the month, 0 is 29 days in Xiaoyue, and the 14th, 15th is the month / / part of the month, and the 10 binding is used. The last 4 is the date of the Lunar New Year in the year - the date of the lunar calendar on January 1, such as 0131 on behalf of January 31. // Date function usage, such as the question of the question of the Queen Calenda, i Queu Yue is the public calendar, i Qi Causa is // Qi Causa, return value is: belonging, day dry land, the lunar calendar.

Using system;

namespace {public class components Lunar Lunar {private string [] m_str lunar calendar; private string [] m_str attribution table; private string m_str zodiac table; private string m_str lunar months table; private string m_str lunar date table; private int m_i maximum Enterprise of the public calendar; private int m_i minimum gauge;

public lunar () {m_str lunar calendar = new string [] { "0100101101101080131", "0100101011100000219", "1010010101110000208", "0101001001101050129", "1101001001100000216", "1101100101010000204", "0110101010101040125", "0101011010100000213", "1001101011010000202" "0100101011101020122" "0100101011100000210" "1010010011011060130" "1010010011010000218" "1101001001010000206" "1101010101001050126" "1011010101010000214" "0101011010100000204" "1001011011010020123" "1001010110110000211" "0100100110111070201" "0100100110110000220" " 1010010010110000208 "" 1011001001011050128 "" 0110101001010000216 "" 0110110101000000205 "" 1010110110101040124 "" 0010101101100000213 "" 1001010101110000202 "" 0100100101111020123 "" 0100100101110000210 "" 0110010010110060130 "" 1101010010100000217 "" 1110101001010000206 "" 0110110101001050126 " "010110101101000000214", "00101 01101100000204, "" 1001001101110030124 "" 1001001011100000211 "" 1100100101101070131 "" 1100100101010000219 "" 1101010010100000208 "" 1101101001010060127 "" 1011010101010000215 "" 0101011010100000205 "" 1010101011011040125 "" 0010010111010000213 "" 1001001011010000202 "" 1100100101011020122 " "

1010100101010000210 "" 1011010010101070129 "" 0110110010100000217 "" 1011010101010000206 "" 0101010110101050127 "" 0100110110100000214 "" 1010010110110000203 "" 0101001010111030124 "" 0101001010110000212 "" 1010100101010080131 "" 1110100101010000218 "" 0110101010100000208 "" 1010110101010060128 " "1010101101010000215" "0100101101100000205" "1010010101110040125" "1010010101110000213" "0101001001100000202" "1110100100110030121" "1101100101010000209" "0101101010101070130" "0101011010100000217" "1001011011010000206" "0100101011101050127" "0100101011010000215" " 1010010011010000203 "" 1101001001101040123 "" 1101001001010000211 "" 1101010100101080131 "" 1011010101000000218 "" 1011011010100000207 "" 1001011011010060128 "" 1001010110110000216 "" 0100100110110000205 "" 1010010010111040125 "" 1010010010110000213 "" 1011001001011100202 "" 0 110101001010000220 "" 0110110101000000209 "" 1010110110101060129 "" 1010101101100000217 "" 1001001101110000206 "" 0100100101111050127 "" 0100100101110000215 "" 0110010010110000204 "" 0110101001010030123 "" 1110101001010000210 "" 0110101100101080131 "" 0101101011000000219 "" 1010101101100000207 " "

1001001101101050128 "" 1001001011100000216 "" 1100100101100000205 "" 1101010010101040124 "" 1101010010100000212 "" 1101101001010000201 "" 0101101010101020122 "" 0101011010100000209 "" 1010101011011070129 "" 0010010111010000218 "" 1001001011010000207 "" 1100100101011050126 "" 1010100101010000214 " "1011010010100000214"}; M_STR deceleration table = "Mouse Niuhu Rabbit Dragon Snake Pigs"; M_STR Lunar Monthum = "Two Third Four Five-Year Seventh or Ninety Ten Tyrust"; M_STR Lunar Day = " In the first six first three first three first five seventh eighth, the first nine, 1123, the first day, the first day, the second 26th廿 六 八 八;;;;;; 公 公 公 份 份 份 份 份 份 份 份 份 年 年; 份 份 干;; 份; 干; 干 份; 干 干 干 干 天; 干 干 干;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;酉 亥 海 "; M_STR Tian dry place branch table = new string [60]; for (int i = 0; i <60; i ) {m_str Tian dry plain table [i] = STR day dry. Substring (I% 10, 1) STR Substring (i% 12, 1);}

}

Public String Date (INT I Quality, INT I Gate Month, INT I Question) {IF ((i Qian Calenda M_i Maximum Phonetic Year) {// If not Effective Queen Date, exit. Return "invalid calendar year";

// Calculate the Lunar New Year INT I Lunar Year; INT I Lunar Month; INT I Lunar Day;

i Lunar Year = I Qian Calenda; // Lunar New Year I Lunar Months = Convert.Toint32 ((M_STR Lunar Calendar [i Lunar Year - M_i Minimum Quality Calendar] .substring (15, 2))); // Lunar New Year Day I Lunar Day = Convert.Toint32 ((M_STR Lunar Calendar [i Lunar Year - M_i Minimum Quality Calendar] .substring (17, 2)))) ;; if ((((i Q)

// Calculate the Phase String STR phase = m_STR belongings. Substring ((i Lunar Year - 4)% 12, 1); // Return to the Lunar Date Return STR Part "," Str Tian dry land "," Str Lunar Year Str Lunar Month Str Lunar Day;}}} Reference: VB Computation Lunar Algorithm Thinkeasy

转载请注明原文地址:https://www.9cbs.com/read-25752.html

New Post(0)