Advertisement
Guest User

Mannic Calendar Conversion

a guest
Jan 19th, 2020
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 28.81 KB | None | 0 0
  1. using System;
  2.  
  3. namespace ConsoleCalendar
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             DateTime date = DateTime.Now;
  10.             //DateTime date = new DateTime(1970, 1, 1);
  11.             Console.WriteLine(ConvertToMannic(date));
  12.         }
  13.  
  14.         /*
  15.          *I got this program working to my desires
  16.  
  17. It works perfectly well for any dates before 1582 in the Gregorian Calendar.
  18.  
  19. In later development I am contemplating what to do before 1582.
  20.  
  21. My current idea is to base years off of the Julian Calendar in the way 1582 works in this calendar. And I will go with the Julian Calendar to Jan 1st 1 AD
  22.  
  23. From there I will then eliminate the month of Manu to have it simply be Capricorn and go like that for BC years
  24.  
  25. Alternatively if I find that proleptic Gregorian is the most common system for dates then I will have the month of Manu not exist before 11582, because if the year isn't preserved to primary sources anyways then there isn't a point in preserving the year to the Gregorian calendar
  26.  
  27. In the future I want to reform the Mannic calendar to merge the month of Manu into Capricorn. There will be a short year, and then the feast of Manu will be the New Year rather than the first day of the Month of Manu
  28.          */
  29.         public static MannicDay ConvertToMannic(DateTime dt)
  30.         {
  31.             return ConvertToMannic(dt, 0);
  32.         }
  33.         public static MannicDay ConvertToMannic(DateTime dt, int calendar)
  34.         {
  35.             //Console.WriteLine("Hello World!");
  36.  
  37.             //Console.WriteLine("We are going to convert a date from the gregorian calendar to the Mannic Calendar");
  38.  
  39.             bool British = false;
  40.  
  41.             if (calendar == 3)
  42.             {
  43.                 British = true;
  44.             }
  45.  
  46.             /*In England until 1751 the year began on March 25 and used the Julian calendar
  47.              * In England and Wales, the legal year 1751 was a short year of 282 days, running from 25 March to 31 December. 1752 began on 1 January.
  48.  * Wednesday 2 September 1752 was followed by Thursday 14 September 1752.[c] The year 1752 was thus a short year (355 days) as well.*/
  49.  
  50.  
  51.             bool Swedish = false;
  52.  
  53.             if (calendar == 4)
  54.             {
  55.                 Swedish = true;
  56.             }
  57.  
  58.             /*
  59.              * In Sweden there was a complicated transition from the Julian to the Gregorian Calendar
  60.              * From 1700-1753 there was a complex date conversion, before then it was Julian, after was Gregorian
  61.              **/
  62.  
  63.             //dt = new DateTime(2018, 7, 24);
  64.             //Console.WriteLine("This is our sample date to start");
  65.             //Console.WriteLine(dt.ToString());
  66.             int day_of_the_year_to_convert = dt.DayOfYear - 1;
  67.             //Console.WriteLine(dt.DayOfYear);
  68.  
  69.             int year = dt.Year;
  70.             //Console.WriteLine(year);
  71.  
  72.             //MannicDay[] MannicYear = new MannicDay[355];
  73.             DateTime Vernal;
  74.             DateTime Midsummer;
  75.             DateTime Mabon;
  76.             DateTime LastJulian = new DateTime(1582, 10, 4, 0, 0, 0);
  77.             DateTime FirstGregorian = new DateTime(1582, 10, 15, 0, 0, 0);
  78.             DateTime Yule;
  79.  
  80.             if ((year == 1582) && (dt.Month == 10) && (dt.Day > 4) && (dt.Day < 15) )
  81.             {
  82.                 calendar = 1;
  83.             }
  84.  
  85.             bool Gregory = false;
  86.  
  87.  
  88.             if ((year == 1582) && (calendar == 0))
  89.             {
  90.                 Gregory = true;
  91.             }
  92.  
  93.             if (Gregory == true)
  94.             {
  95.                 //MannicDay[] MannicYear = new MannicDay[355];
  96.                 //1582 had 355 days, not 365
  97.                 Vernal = new DateTime(1582, 03, 11, 0, 09, 0);
  98.                 Midsummer = new DateTime(1582, 06, 12, 1, 37, 0);
  99.                 Mabon = new DateTime(1582, 09, 13, 12, 47, 0);
  100.                 Yule = new DateTime(1582, 12, 22, 2, 0, 0);
  101.             }
  102.             else
  103.             {
  104.                 DateTime[] FourPoints = Points(year, calendar);
  105.                 Vernal = FourPoints[0];
  106.                 Midsummer = FourPoints[1];
  107.                 Mabon = FourPoints[2];
  108.                 Yule = FourPoints[3];
  109.             }
  110.  
  111.             //Console.WriteLine("Printing Vernal Midsummer Mabon and Yule");
  112.             //Console.WriteLine(Vernal);
  113.             //Console.WriteLine(Midsummer);
  114.             //Console.WriteLine(Mabon);
  115.             //Console.WriteLine(Yule);
  116.  
  117.             //Console.WriteLine((Yule - Mabon).TotalDays);
  118.  
  119.             int winter = Vernal.DayOfYear - 1;
  120.             int spring = (int)(Midsummer - Vernal).TotalDays;
  121.             int summer = (int)(Mabon - Midsummer).TotalDays;
  122.             int fall = (int)(Yule - Mabon).TotalDays;
  123.  
  124.  
  125.             //Console.WriteLine("days in fall");
  126.             //Console.WriteLine(fall);
  127.             if (Gregory == true)
  128.             {
  129.                 fall -= 9;
  130.             }
  131.             DateTime newyeareve = new DateTime(year, 12, 31);
  132.             int intercalary = (int)(newyeareve - Yule).TotalDays;
  133.  
  134.  
  135.  
  136.  
  137.  
  138.             //Console.WriteLine("Winter " + winter + " spring " + spring + " summer " + summer + " fall " + fall + " intercalary " + intercalary);
  139.  
  140.             // other important numbers
  141.  
  142.             //int preEaster = (int)(Easter - Vernal).TotalDays;
  143.             //int preHannukkah = (int)(HannukahBeginning - Mabon).TotalDays;
  144.             //int preThanksgiving = (int)(Thanksgiving - Mabon).TotalDays;
  145.  
  146.             int Cap = 0;
  147.             int Aqua = 0;
  148.             int Pis = 0;
  149.             int Ari = 0;
  150.             int Tau = 0;
  151.             int Gem = 0;
  152.             int Can = 0;
  153.             int Leo = 0;
  154.             int Vir = 0;
  155.             int Lib = 0;
  156.             int Sco = 0;
  157.             int Sag = 0;
  158.             int Manu = 0;
  159.  
  160.             //days short in season are taken from first month
  161.             //extra days in a season are put in the last month
  162.  
  163.             int wintersmudge = winter - 90;
  164.             if (wintersmudge < 0)
  165.             {
  166.                 Cap = wintersmudge;
  167.             }
  168.             else
  169.             {
  170.                 Pis = wintersmudge;
  171.             }
  172.  
  173.             int springsmudge = spring - 90;
  174.             if (springsmudge < 0)
  175.             {
  176.                 Ari = springsmudge;
  177.             }
  178.             else
  179.             {
  180.                 Gem = springsmudge;
  181.             }
  182.  
  183.             int summersmudge = summer - 90;
  184.             if (summersmudge < 0)
  185.             {
  186.                 Can = summersmudge;
  187.             }
  188.             else
  189.             {
  190.                 Vir = summersmudge;
  191.             }
  192.  
  193.             int fallsmudge = fall - 90;
  194.             if (fallsmudge < 0)
  195.             {
  196.                 Lib = fallsmudge;
  197.             }
  198.             else
  199.             {
  200.                 Sag = fallsmudge;
  201.             }
  202.  
  203.             Cap += 30;
  204.             Aqua = 30;
  205.             Pis += 30;
  206.             Ari += 30;
  207.             Tau = 30;
  208.             Gem += 30;
  209.             Can += 30;
  210.             Leo = 30;
  211.             Vir += 30;
  212.             Lib += 30;
  213.             Sco = 30;
  214.             Sag += 30;
  215.             Manu = intercalary;
  216.  
  217.             //Console.WriteLine("Cap");
  218.             //Console.WriteLine(Cap);
  219.             //Console.WriteLine("Aqua");
  220.             //Console.WriteLine(Aqua);
  221.             //Console.WriteLine("Pis");
  222.             //Console.WriteLine(Pis);
  223.             //Console.WriteLine("Ari");
  224.             //Console.WriteLine(Ari);
  225.             //Console.WriteLine("Tau");
  226.             //Console.WriteLine(Tau);
  227.             //Console.WriteLine("Gem");
  228.             //Console.WriteLine(Gem);
  229.             //Console.WriteLine("Can");
  230.             //Console.WriteLine(Can);
  231.             //Console.WriteLine("Leo");
  232.             //Console.WriteLine(Leo);
  233.             //Console.WriteLine("Vir");
  234.             //Console.WriteLine(Vir);
  235.             //Console.WriteLine("Lib");
  236.             //Console.WriteLine(Lib);
  237.             //Console.WriteLine("Sco");
  238.             //Console.WriteLine(Sco);
  239.             //Console.WriteLine("Sag");
  240.             //Console.WriteLine(Sag);
  241.             //Console.WriteLine("Manu");
  242.             //Console.WriteLine(Manu);
  243.  
  244.             int yeardays;
  245.  
  246.  
  247.             yeardays = newyeareve.DayOfYear;
  248.             //Console.WriteLine("how many days in the year");
  249.             //Console.WriteLine(yeardays);
  250.             //yeardays = Cap + Aqua + Pis + Ari + Tau + Gem + Can + Leo + Vir + Lib + Sco + Sag + Manu;
  251.  
  252.             if (Gregory == true)
  253.             {
  254.                 //Console.WriteLine("1582 yeardays calculated");
  255.                 //Console.WriteLine(yeardays);
  256.                 yeardays = 355;
  257.             }
  258.  
  259.  
  260.             int holidays = 1 + (spring % 30) + (summer % 30) + (fall % 30) + Manu;
  261.  
  262.             //Console.WriteLine(Cap);
  263.             //Console.WriteLine(Aqua);
  264.             //Console.WriteLine(Pis);
  265.             //Console.WriteLine(Ari);
  266.             //Console.WriteLine(Tau);
  267.             //Console.WriteLine(Gem);
  268.             //Console.WriteLine(Can);
  269.             //Console.WriteLine(Leo);
  270.             //Console.WriteLine(Vir);
  271.             //Console.WriteLine(Lib);
  272.             //Console.WriteLine(Sco);
  273.             //Console.WriteLine(Sag);
  274.             //Console.WriteLine(Manu);
  275.             //Console.WriteLine(yeardays);
  276.             //Console.WriteLine(holidays);
  277.  
  278.             MannicDay[] MannicYear = new MannicDay[yeardays];
  279.  
  280.             int i = 0;
  281.             int month = 1;
  282.             int day = 1;
  283.             string feast = "none";
  284.             int monthdays = Cap;
  285.  
  286.             //filling the array with days
  287.  
  288.             DateTime Gregorian = new DateTime(year, 1, 1);
  289.  
  290.             while (i < yeardays)
  291.             {
  292.                 //getting inputs
  293.                 //public MannicDay (DateTime Gregorian, int dayoftheyear, int year, int month, int day)
  294.                 int dayoftheyear = i + 1;
  295.                 //Gregorian Calendar dependent dates
  296.                 if ((Gregorian.Month == 12) && (Gregorian.Day == 25))
  297.                 {
  298.                     feast = "Gregorian Christmas";
  299.                 }
  300.                 //Mannic feasts/Holidays
  301.                 if (month == 13)
  302.                 {
  303.                     switch (day)
  304.                     {
  305.                         case 1:
  306.                             feast = "1st Blessing of Manu";
  307.                             break;
  308.                         case 2:
  309.                             feast = "2nd Blessing of Manu";
  310.                             break;
  311.                         case 3:
  312.                             feast = "3rd Blessing of Manu";
  313.                             break;
  314.                         case 5:
  315.                             feast = "Christmas of Manu";
  316.                             break;
  317.                         default:
  318.                             feast = (day + "th Blessing of Manu");
  319.                             break;
  320.                     }
  321.                 }
  322.                 if (day == 1)
  323.                 {
  324.                     switch (month)
  325.                     {
  326.                         case 1:
  327.                             feast = "Feast of Capricorn"; break;
  328.                         case 2:
  329.                             feast = "Feast of Aquarius"; break;
  330.                         case 3:
  331.                             feast = "Feast of Pisces"; break;
  332.                         case 4:
  333.                             feast = "Feast of Aries"; break;
  334.                         case 5:
  335.                             feast = "Feast of Taurus"; break;
  336.                         case 6:
  337.                             feast = "Feast of Gemini"; break;
  338.                         case 7:
  339.                             feast = "Feast of Cancer"; break;
  340.                         case 8:
  341.                             feast = "Feast of Leo"; break;
  342.                         case 9:
  343.                             feast = "Feast of Virgo"; break;
  344.                         case 10:
  345.                             feast = "Feast of Libra"; break;
  346.                         case 11:
  347.                             feast = "Feast of Scorpio"; break;
  348.                         case 12:
  349.                             feast = "Feast of Saggittarius"; break;
  350.                         case 13:
  351.                             feast = "Feast of Manu"; break;
  352.                     }
  353.                 }
  354.                 if ((monthdays < 30) && (day == monthdays) && (month < 13))
  355.                 {
  356.                     feast = "Sabbath of Doors";
  357.                 }
  358.                 if (Gregorian == newyeareve)
  359.                 {
  360.                     feast = "Feast of Yemo";
  361.                 }
  362.                 if (day > 30)
  363.                 {
  364.                     int ordinal = day - 30;
  365.                     string monthname = "Capricorn";
  366.                     switch (month)
  367.                     {
  368.                         case 1:
  369.                             monthname = "Capricorn"; break;
  370.                         case 2:
  371.                             monthname = "Aquarius"; break;
  372.                         case 3:
  373.                             monthname = "Pisces"; break;
  374.                         case 4:
  375.                             monthname = "Aries"; break;
  376.                         case 5:
  377.                             monthname = "Taurus"; break;
  378.                         case 6:
  379.                             monthname = "Gemini"; break;
  380.                         case 7:
  381.                             monthname = "Cancer"; break;
  382.                         case 8:
  383.                             monthname = "Leo"; break;
  384.                         case 9:
  385.                             monthname = "Virgo"; break;
  386.                         case 10:
  387.                             monthname = "Libra"; break;
  388.                         case 11:
  389.                             monthname = "Scorpio"; break;
  390.                         case 12:
  391.                             monthname = "Saggittarius"; break;
  392.                         case 13:
  393.                             monthname = "Mannus"; break;
  394.                     }
  395.  
  396.                     switch (ordinal)
  397.                     {
  398.                         case 1:
  399.                             feast = ("1st Blessing of " + monthname);
  400.                             break;
  401.                         case 2:
  402.                             feast = ("2nd Blessing of " + monthname);
  403.                             break;
  404.                         case 3:
  405.                             feast = ("3rd Blessing of " + monthname);
  406.                             break;
  407.                         default:
  408.                             feast = (ordinal + "th Blessing of " + monthname);
  409.                             break;
  410.                     }
  411.                 }
  412.                 if ((month == 12) && (day == monthdays))
  413.                 {
  414.                     feast = "Eve of the Solstice";
  415.                 }
  416.                 //initialize object
  417.                 MannicYear[i] = new MannicDay(Gregorian, dayoftheyear, year, month, day, feast);
  418.                 //Console.WriteLine(MannicYear[i].ToString());
  419.                 //move calendar forward
  420.                 day++;
  421.                 if (month == 13)
  422.                 {
  423.  
  424.                 }
  425.                 else if (monthdays < day)
  426.                 {
  427.                     day = 1;
  428.                     month++;
  429.                     switch (month)
  430.                     {
  431.                         case 1:
  432.                             monthdays = Cap; break;
  433.                         case 2:
  434.                             monthdays = Aqua; break;
  435.                         case 3:
  436.                             monthdays = Pis; break;
  437.                         case 4:
  438.                             monthdays = Ari; break;
  439.                         case 5:
  440.                             monthdays = Tau; break;
  441.                         case 6:
  442.                             monthdays = Gem; break;
  443.                         case 7:
  444.                             monthdays = Can; break;
  445.                         case 8:
  446.                             monthdays = Leo; break;
  447.                         case 9:
  448.                             monthdays = Vir; break;
  449.                         case 10:
  450.                             monthdays = Lib; break;
  451.                         case 11:
  452.                             monthdays = Sco; break;
  453.                         case 12:
  454.                             monthdays = Sag; break;
  455.                         case 13:
  456.                             monthdays = Manu; break;
  457.                     }
  458.                 }
  459.                 //reset variables
  460.                 if ((Gregory == true) && (Gregorian == LastJulian))
  461.                 {
  462.                     Gregorian = FirstGregorian;
  463.                 }
  464.                 else { Gregorian = Gregorian.AddDays(1); }
  465.                
  466.                 feast = "none";
  467.                 i++;
  468.             }
  469.             //returning date
  470.  
  471.             return MannicYear[day_of_the_year_to_convert];
  472.             /*
  473.             int i = 0;
  474.             int month = 1;
  475.             int day = 1;
  476.             string feast = "none";
  477.             */
  478.         }
  479.  
  480.         public static DateTime CalculateDate(double val, int calendar, int date)
  481.         {
  482.             double ut;
  483.             int jdn;
  484.             int year;
  485.             int month;
  486.             int day;
  487.             int hour;
  488.             int minute;
  489.             bool julian;
  490.             int x;
  491.             int z;
  492.             int m;
  493.             int d;
  494.             int y;
  495.             int daysPer400Years = 146097;
  496.             int fudgedDaysPer4000Years = 1460970 + 31;
  497.  
  498.             val += 0.5; //  Convert astronomical JDN to chronological
  499.  
  500.             jdn = (int)Math.Floor(val);
  501.             ut = val - jdn;
  502.             //julian = (jdn <= DefineConstants.LASTJULJDN);
  503.             switch (calendar)
  504.             {
  505.                 case 1: //gregorian
  506.                     julian = false;
  507.                     break;
  508.                 case 2: //julian
  509.                     julian = true;
  510.                     break;
  511.                 // possibly add more calendars as we go along, converting them to Gregorian first and then to Mannic
  512.                 case 3: //British Old Style Calendar
  513.                         //break;
  514.                 case 4: //Swedish
  515.                         //break;
  516.                 default: //julian gregorian unknown
  517.                     if (date <= 1582)
  518.                     {
  519.                         julian = true;
  520.                     }
  521.                     else
  522.                     {
  523.                         julian = false;
  524.                     }
  525.                     break;
  526.             }
  527.             x = jdn + 68569;
  528.  
  529.             if (julian == true)
  530.             {
  531.                 x += 38;
  532.                 daysPer400Years = 146100;
  533.                 fudgedDaysPer4000Years = 1461000 + 1;
  534.             }
  535.  
  536.             z = 4 * x / daysPer400Years;
  537.             x = x - (daysPer400Years * z + 3) / 4;
  538.             y = 4000 * (x + 1) / fudgedDaysPer4000Years;
  539.             x = x - 1461 * y / 4 + 31;
  540.             m = 80 * x / 2447;
  541.             d = x - 2447 * m / 80;
  542.             x = m / 11;
  543.             m = m + 2 - 12 * x;
  544.             y = 100 * (z - 49) + y + x;
  545.             year = (int)y;
  546.             month = (int)m;
  547.             day = (int)d;
  548.             if (year <= 0) // adjust BC years
  549.             {
  550.                 year--;
  551.             }
  552.  
  553.             hour = (int)(ut * 24);
  554.             minute = (int)((ut * 24 - hour) * 60); //  Accurate to about 15 minutes c. 2000 CE.
  555.  
  556.             //retval.Format("%02d-%02d-%4d %02d:%02d GMT", day, month, year, hour, minute);
  557.  
  558.             DateTime retval = new DateTime(year, month, day, hour, minute, 0);
  559.  
  560.             return (retval);
  561.         }
  562.  
  563.         public static DateTime[] Points(int input_year, int calendar)
  564.         {
  565.             DateTime[] points = new DateTime[4];
  566.             double m;
  567.             double ve;
  568.             double ss;
  569.             double ae;
  570.             double ws;
  571.  
  572.             m = ((double)input_year - 2000.0) / 1000.0;
  573.             ve = 2451623.80984 + 365242.37404 * m + 0.05169 * m * m - 0.00411 * m * m * m - 0.00057 * m * m * m * m;
  574.  
  575.  
  576.             points[0] = CalculateDate(ve, calendar, input_year);
  577.             ss = 2451716.56767 + 365241.62603 * m + 0.00325 * m * m + 0.00888 * m * m * m - 0.00030 * m * m * m * m;
  578.  
  579.  
  580.             points[1] = CalculateDate(ss, calendar, input_year);
  581.             ae = 2451810.21715 + 365242.01767 * m - 0.11575 * m * m + 0.00337 * m * m * m + 0.00078 * m * m * m * m;
  582.  
  583.  
  584.             points[2] = CalculateDate(ae, calendar, input_year);
  585.             ws = 2451900.05952 + 365242.74049 * m - 0.06223 * m * m - 0.00823 * m * m * m + 0.00032 * m * m * m * m;
  586.  
  587.  
  588.             points[3] = CalculateDate(ws, calendar, input_year);
  589.  
  590.             return points;
  591.         }
  592.  
  593.         public static string textform(int input)
  594.         {
  595.             string suffix;
  596.             int end = input % 100;
  597.             int ten = 10;
  598.             if ((end / ten) == 1)
  599.             {
  600.                 suffix = "th";
  601.             }
  602.             else
  603.             {
  604.                 end %= 10;
  605.                 switch (end)
  606.                 {
  607.                     case 1:
  608.                         suffix = "st";
  609.                         break;
  610.                     case 2:
  611.                         suffix = "nd";
  612.                         break;
  613.                     case 3:
  614.                         suffix = "rd";
  615.                         break;
  616.                     default:
  617.                         suffix = "th";
  618.                         break;
  619.                 }
  620.             }
  621.  
  622.             return (input + suffix);
  623.  
  624.         }
  625.  
  626.  
  627.     }
  628.  
  629.  
  630.     class MannicDay
  631.     {
  632.         public DateTime Gregorian;
  633.         public int dayoftheyear;
  634.         public int year;
  635.         public int month;
  636.         public int day;
  637.         public string feast;
  638.  
  639.         public MannicDay(DateTime Gregorian, int dayoftheyear, int year, int month, int day, string feast)
  640.         {
  641.             this.Gregorian = Gregorian;
  642.             this.dayoftheyear = dayoftheyear;
  643.             if (year >= 1)
  644.             {
  645.                 this.year = year + 10000;
  646.             }
  647.             else
  648.             {
  649.                 this.year = year + 1001;
  650.             }
  651.             this.month = month;
  652.             this.day = day;
  653.             this.feast = feast;
  654.         }
  655.  
  656.         public string getmonthname()
  657.         {
  658.             switch (this.month)
  659.             {
  660.                 case 1:
  661.                     return "Capricorn";
  662.                 case 2:
  663.                     return "Aquarius";
  664.                 case 3:
  665.                     return "Pisces";
  666.                 case 4:
  667.                     return "Aries";
  668.                 case 5:
  669.                     return "Taurus";
  670.                 case 6:
  671.                     return "Gemini";
  672.                 case 7:
  673.                     return "Cancer";
  674.                 case 8:
  675.                     return "Leo";
  676.                 case 9:
  677.                     return "Virgo";
  678.                 case 10:
  679.                     return "Libra";
  680.                 case 11:
  681.                     return "Scorpio";
  682.                 case 12:
  683.                     return "Saggittarius";
  684.                 case 13:
  685.                     return "Mannus";
  686.             }
  687.             return "?";
  688.         }
  689.  
  690.         public string monthabbreviation()
  691.         {
  692.             switch (this.month)
  693.             {
  694.                 case 1:
  695.                     return "Cap";
  696.                 case 2:
  697.                     return "Aqua";
  698.                 case 3:
  699.                     return "Pis";
  700.                 case 4:
  701.                     return "Ari";
  702.                 case 5:
  703.                     return "Tau";
  704.                 case 6:
  705.                     return "Gem";
  706.                 case 7:
  707.                     return "Can";
  708.                 case 8:
  709.                     return "Leo";
  710.                 case 9:
  711.                     return "Vir";
  712.                 case 10:
  713.                     return "Lib";
  714.                 case 11:
  715.                     return "Sco";
  716.                 case 12:
  717.                     return "Sag";
  718.                 case 13:
  719.                     return "Manu";
  720.             }
  721.             return "?";
  722.         }
  723.  
  724.         public string getmonthsymbol()
  725.         {
  726.             switch (this.month)
  727.             {
  728.                 case 1:
  729.                     return "♑";
  730.                 case 2:
  731.                     return "♒";
  732.                 case 3:
  733.                     return "♓️";
  734.                 case 4:
  735.                     return "♈";
  736.                 case 5:
  737.                     return "♉";
  738.                 case 6:
  739.                     return "♊";
  740.                 case 7:
  741.                     return "♋️";
  742.                 case 8:
  743.                     return "♌";
  744.                 case 9:
  745.                     return "♍";
  746.                 case 10:
  747.                     return "♎";
  748.                 case 11:
  749.                     return "♏";
  750.                 case 12:
  751.                     return "♐";
  752.                 case 13:
  753.                     return "🎄";
  754.             }
  755.             return "?";
  756.         }
  757.  
  758.         public string getfeast()
  759.         {
  760.             return this.feast;
  761.         }
  762.  
  763.         public bool feastbool()
  764.         {
  765.             if (string.Equals(this.feast, "none") == true)
  766.             {
  767.                 return false;
  768.             }
  769.             else
  770.             {
  771.                 return true;
  772.             }
  773.         }
  774.  
  775.         public bool dayoff()
  776.         {
  777.             if (this.feastbool() == true)
  778.             {
  779.                 return true;
  780.             }
  781.             if ((this.day % 5) == 1)
  782.             {
  783.                 return true;
  784.             }
  785.             else
  786.             {
  787.                 return false;
  788.             }
  789.         }
  790.  
  791.         public DateTime getGregorian()
  792.         {
  793.             return this.Gregorian;
  794.         }
  795.  
  796.         public int getmonth()
  797.         {
  798.             return this.month;
  799.         }
  800.  
  801.         public int getyear()
  802.         {
  803.             return this.year;
  804.         }
  805.  
  806.         public int getday()
  807.         {
  808.             return this.day;
  809.         }
  810.  
  811.         public int getdayoftheyear()
  812.         {
  813.             return this.dayoftheyear;
  814.         }
  815.  
  816.         public string ymd()
  817.         {
  818.             //return string("" + this.year + "/" + this.month + "/" + this.day);
  819.             string output = ("" + this.year + "/" + this.month + "/" + this.day);
  820.             return output;
  821.         }
  822.  
  823.         public string dmy()
  824.         {
  825.             string output = ("" + this.day + "/" + this.month + "/" + this.year);
  826.             return output;
  827.         }
  828.  
  829.         public string mdy()
  830.         {
  831.             string output = ("" + this.month + "/" + this.day + "/" + this.year);
  832.             return output;
  833.         }
  834.  
  835.         public string weekday()
  836.         {
  837.             switch (this.day % 5)
  838.             {
  839.                 case 1:
  840.                     return "Adonai";
  841.                 case 2:
  842.                     return "Mithra";
  843.                 case 3:
  844.                     return "Azoth";
  845.                 case 4:
  846.                     return "Oxa";
  847.                 default:
  848.                     return "Manu";
  849.             }
  850.         }
  851.  
  852.         override public string ToString()
  853.         {
  854.             string s0 = ("" + this.getdayoftheyear());
  855.             string s1 = this.ymd();
  856.             string s2 = this.getmonthsymbol();
  857.             string s3 = this.getmonthname();
  858.             string s4 = this.feast;
  859.             string greg = this.Gregorian.ToString();
  860.             string text = ("day " + s0 + " " + greg + " " + s1 + " " + s3 + " " + s4);
  861.             return text;
  862.         }
  863.  
  864.         public string display()
  865.         {
  866.             string weekday = this.weekday();
  867.             int day = this.getday();
  868.             string dayth = textform(day);
  869.             string month = this.getmonthname();
  870.             int year = this.getyear();
  871.             string yearth = textform(year);
  872.             string display = (weekday + "day " + month + " " + dayth + ", of the " + yearth + " year of Manu");
  873.             return display;
  874.         }
  875.  
  876.         public static string textform(int input)
  877.         {
  878.             string suffix;
  879.             int end = input % 100;
  880.             int ten = 10;
  881.             if ((end / ten) == 1)
  882.             {
  883.                 suffix = "th";
  884.             }
  885.             else
  886.             {
  887.                 end %= 10;
  888.                 switch (end)
  889.                 {
  890.                     case 1:
  891.                         suffix = "st";
  892.                         break;
  893.                     case 2:
  894.                         suffix = "nd";
  895.                         break;
  896.                     case 3:
  897.                         suffix = "rd";
  898.                         break;
  899.                     default:
  900.                         suffix = "th";
  901.                         break;
  902.                 }
  903.             }
  904.  
  905.             return (input + suffix);
  906.  
  907.         }
  908.     }
  909. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement