Browse Source

Добавлена обработка некоторых ошибок в файле

ПроваленкоЛН 1 month ago
parent
commit
3b060851c5
1 changed files with 50 additions and 17 deletions
  1. 50 17
      AvaloniaApplication1/MainWindow.axaml.cs

+ 50 - 17
AvaloniaApplication1/MainWindow.axaml.cs

@@ -156,68 +156,68 @@ namespace AvaloniaApplication1
         {
             string[] ZnakV = new string[]
             {
-                        "Êðûñà", "Áûê", "Òèãð", "Êðîëèê", "Äðàêîí",
-                        "Çìåÿ", "Ëîøàäü", "Êîçà", "Îáåçüÿíà", "Ïåòóõ",
-                        "Ñîáàêà", "Ñâèíüÿ"
+                   "Îáåçüÿíà", "Ïåòóõ",
+                   "Ñîáàêà", "Ñâèíüÿ","Êðûñà", "Áûê", "Òèãð", "Êðîëèê", "Äðàêîí",
+                    "Çìåÿ", "Ëîøàäü", "Êîçà"
             };
-            int index = (year - 4) % 12;
+            int index = year % 12;
             return ZnakV[index];
         }
         public string Zodiac(int day, int mounth)
         {
             string Zod = " ";
-            if (day >= 21 && mounth == 3 || day <= 19 && mounth == 4)
+            if (day >= 21 && day <= 31 && mounth == 3 || day <= 19 && mounth == 4)
             {
                 Zod = "Îâåí";
 
             }
-            else if (day >= 20 && mounth == 4 || day <= 20 && mounth == 5)
+            else if (day >= 20 && day<=30 && mounth == 4 || day <= 20 && mounth == 5)
             {
                 Zod = "Òåëåö";
             }
-            else if (day >= 21 && mounth == 5 || day <= 20 && mounth == 6)
+            else if (day >= 21 && day<=31 && mounth == 5 || day <= 20 && mounth == 6)
             {
                 Zod = "Áëèçíåöû";
             }
-            else if (day >= 21 && mounth == 6 || day <= 22 && mounth == 7)
+            else if (day >= 21 && day <= 30 && mounth == 6 || day <= 22 && mounth == 7)
             {
                 Zod = "Ðàê";
             }
-            else if (day >= 23 && mounth == 7 || day <= 22 && mounth == 8)
+            else if (day >= 23 && day <= 31 && mounth == 7 || day <= 22 && mounth == 8)
             {
                 Zod = "Ëåâ";
             }
-            else if (day >= 23 && mounth == 8 || day <= 22 && mounth == 9)
+            else if (day >= 23 && day <= 31 && mounth == 8 || day <= 22 && mounth == 9)
             {
                 Zod = "Äåâà";
             }
-            else if (day >= 23 && mounth == 9 || day <= 22 && mounth == 10)
+            else if (day >= 23 && day <= 30 && mounth == 9 || day <= 22 && mounth == 10)
             {
                 Zod = "Âåñû";
             }
-            else if (day >= 23 && mounth == 10 || day <= 21 && mounth == 11)
+            else if (day >= 23 && day <= 31 && mounth == 10 || day <= 21 && mounth == 11)
             {
                 Zod = "Ñêîðïèîí";
             }
-            else if (day >= 22 && day <= 31 && mounth == 11 || day <= 21 && mounth == 12)
+            else if (day >= 22 && day <= 30 && mounth == 11 || day <= 21 && mounth == 12)
             {
                 Zod = "Ñòðåëåö";
             }
-            else if (day >= 22 && mounth == 12 || day <= 19 && mounth == 1)
+            else if (day >= 22 && day <= 31 && mounth == 12 || day <= 19 && mounth == 1)
             {
                 Zod = "Êîçåðîã";
             }
-            else if (day >= 20 && mounth == 1 || day <= 18 && mounth == 2)
+            else if (day >= 20 && day<=31 && mounth == 1 || day <= 18 && mounth == 2)
             {
                 Zod = "Âîäîëåé";
             }
-            else if (day >= 19 && mounth == 2 || day <= 20 && mounth == 3)
+            else if (day >= 19 && day<=28 && mounth == 2 || day <= 20 && mounth == 3)
             {
                 Zod = "Ðûáû";
             }
             else
             {
-                Zod = "Äåíü èëè ìåñÿö íå ñóùåñòâóåò";
+                Zod = "Äåíü íå ñóùåñòâóåò èëè ìåñÿö íå ñóùåñòâóåò";
             }
             return Zod;
         }
@@ -263,7 +263,11 @@ namespace AvaloniaApplication1
                         for (int i = 0; i<k; i++)
                         {
                             bool isNumericMounthNotInt = Regex.IsMatch(dateB[i].mounthB, @"^(\d+|0),\d+$");
+                            bool isNumericDayNotInt = Regex.IsMatch(dateB[i].dayB, @"^(\d+|0),\d+$");
+                            bool isNumericYearNotInt = Regex.IsMatch(dateB[i].yearB, @"^(\d+|0),\d+$");
                             bool isNumericDayDate = Regex.IsMatch(dateB[i].dayB, @"^\d{2}\.\d{2}\.\d{4}$");
+                            bool isNumericMounthDate = Regex.IsMatch(dateB[i].mounthB, @"^\d{2}\.\d{2}\.\d{4}$");
+                            bool isNumericYearDate = Regex.IsMatch(dateB[i].yearB, @"^\d{2}\.\d{2}\.\d{4}$");
                             bool isNumericDayOtr = Regex.IsMatch(dateB[i].dayB, @"^-?\d+$");
                             bool isNumericMounthOtr = Regex.IsMatch(dateB[i].mounthB, @"^-?\d+$");
                             bool isNumericYearOtr = Regex.IsMatch(dateB[i].yearB, @"^-?\d+$");
@@ -288,6 +292,10 @@ namespace AvaloniaApplication1
                                 {
                                     sw.WriteLine(dateB[i].dayB + ";" + dateB[i].mounthB + ";" + dateB[i].yearB + ";" + "Ìåñÿö íå ÿâëÿåòñÿ ÷èñëîì" + ";" + Vostoch(int.Parse(dateB[i].yearB)));
                                 }
+                                else if(isNumericMounthDate == true)
+                                {
+                                    sw.WriteLine(dateB[i].dayB + ";" + dateB[i].mounthB + ";" + dateB[i].yearB + ";" + "Â ìåñÿöå óêàçàíà ïîëíàÿ äàòà" + ";" + Vostoch(int.Parse(dateB[i].yearB)));
+                                }
                             }
                             else if (isNumericDay == false & isNumericMounth == true && isNumericYear == true)
                             {
@@ -303,6 +311,10 @@ namespace AvaloniaApplication1
                                 {
                                     sw.WriteLine(dateB[i].dayB + ";" + dateB[i].mounthB + ";" + dateB[i].yearB + ";" + "Äåíü íå ÿâëÿåòñÿ ÷èñëîì" + ";" + Vostoch(int.Parse(dateB[i].yearB)));
                                 }
+                                else if(isNumericDayDate == true)
+                                {
+                                    sw.WriteLine(dateB[i].dayB + ";" + dateB[i].mounthB + ";" + dateB[i].yearB + ";" + "Â äíå óêàçàíà ïîëíàÿ äàòà" + ";" + Vostoch(int.Parse(dateB[i].yearB)));
+                                }
                             }
                             else if (isNumericDay == true & isNumericMounth == true && isNumericYear == false)
                             {
@@ -318,6 +330,10 @@ namespace AvaloniaApplication1
                                 {
                                     sw.WriteLine(dateB[i].dayB + ";" + dateB[i].mounthB + ";" + dateB[i].yearB + ";" + Zodiac(int.Parse(dateB[i].dayB), int.Parse(dateB[i].mounthB)) + ";" + "Ãîä íå ÿâëÿåòñÿ ÷èñëîì");
                                 }
+                                else if(isNumericYearDate == true)
+                                {
+                                    sw.WriteLine(dateB[i].dayB + ";" + dateB[i].mounthB + ";" + dateB[i].yearB + ";" + Zodiac(int.Parse(dateB[i].dayB), int.Parse(dateB[i].mounthB)) + ";" + "Â ãîäå óêàçàíà ïîëíàÿ äàòà");
+                                }
                             }
                             else if (isNumericDay == false && isNumericMounth == false && isNumericYear == false)
                             {
@@ -345,6 +361,18 @@ namespace AvaloniaApplication1
                                 {
                                     sw.WriteLine(dateB[i].dayB + ";" + dateB[i].mounthB + ";" + dateB[i].yearB + ";" + "Äåíü è ìåñÿö íå óêàçàíû" + ";" + "Ãîä íå ÿâëÿåòñÿ ÷èñëîì");
                                 }
+                                else if (isNumericDayOtr == true && isNumericMounthOtr == true && isNumericYearOtr == true)
+                                {
+                                    sw.WriteLine(dateB[i].dayB + ";" + dateB[i].mounthB + ";" + dateB[i].yearB + ";" + "Äåíü è ìåñÿö ÿâëÿþòñÿ îòðèöàòåëüíûìè ÷èñëàìè" + ";" + "Ãîä ÿâëÿåòñÿ îòðèöàòåëüíûì ÷èñëîì");
+                                }
+                                else if (isNumericDayDate == true && isNumericMounthDate == true && isNumericYearDate == true)
+                                {
+                                    sw.WriteLine(dateB[i].dayB + ";" + dateB[i].mounthB + ";" + dateB[i].yearB + ";" + "Â äíå è ìåñÿöå óêàçàíà ïîëíàÿ äàòà" + ";" + "Â ãîäå óêàçàíà ïîëíàÿ äàòà");
+                                }
+                                else if(isNumericDayNotInt == true && isNumericMounthNotInt == true && isNumericYearNotInt == true)
+                                {
+                                    sw.WriteLine(dateB[i].dayB + ";" + dateB[i].mounthB + ";" + dateB[i].yearB + ";" + " äíå è ìåñÿöå óêàçàíû íå ÷èñëà" + ";" + " ãîäå óêàçàíî íå ÷èñëî");
+                                }
                             }
                             else if (isNumericDay == false & isNumericMounth == false && isNumericYear == true)
                             {
@@ -387,10 +415,15 @@ namespace AvaloniaApplication1
                                 {
                                     sw.WriteLine(dateB[i].dayB + ";" + dateB[i].mounthB + ";" + dateB[i].yearB + ";" + "Ìåñÿö ÿâëÿåòñÿ íå öåëûì ÷èñëì" + ";" + "Ãîä íå óêàçàí");
                                 }
+                                else if (isNumericMounthOtr == true && isNumericYearOtr == true)
+                                {
+                                    sw.WriteLine(dateB[i].dayB + ";" + dateB[i].mounthB + ";" + dateB[i].yearB + ";" + "Ìåñÿö ÿâëÿåòñÿ îòðèöàòåëüíûì ÷èñëîì" + ";" + "Ãîä ÿâëÿåòñÿ îòðèöàòåëüíûì ÷èñëîì");
+                                }
                                 else if (dateB[i].mounthB != "" && isNumericYearOtr == true)
                                 {
                                     sw.WriteLine(dateB[i].dayB + ";" + dateB[i].mounthB + ";" + dateB[i].yearB + ";" + "Ìåñÿö íå ÿâëÿåòñÿ ÷èñëîì" + ";" + "Ãîä ÿâëÿåòñÿ îòðèöàòåëüíûì ÷èñëîì");
                                 }
+                               
 
                             }
                         }