Ejemplo n.º 1
0
 private string checkMonthString(string prev, string s)
 {
     if (s.EndsWith("月") && CE.getYinMonth("2015", s.Substring(0, s.Length - 1)) > 0)
     {
         if (prev == "闰")
         {
             return("闰" + s.Substring(0, s.Length - 1));
         }
         else
         {
             return(s.Substring(0, s.Length - 1));
         }
     }
     if (s.StartsWith("大年"))
     {
         int ans = CE.getYinMonth(getYear() != null ? getYear() : DateTime.Now.Year.ToString(), s);
         return(ans.ToString());
     }
     return(null);
 }
Ejemplo n.º 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            this.label1.Text = "请稍候";
            this.label2.Text = "请稍候";
            this.label3.Text = "请稍候";
            this.Refresh();
            SentenceParse sp = new SentenceParse(this.textBox1.Text);

            if (!sp.hasExactDate() && int.MinValue == sp.ApproDate())
            {
                this.label1.Text = "请重新输入";
            }
            else if (!sp.hasExactDate())
            {
                this.label1.Text = ce.getDate((int)sp.ApproDate(), sp.isExpectYang());
                this.label2.Text = NetInfoCatcher.InfoPicker(ce.getYangDate()[0], ce.getYangDate()[1], ce.getYangDate()[2])[0];
                this.label3.Text = NetInfoCatcher.InfoPicker(ce.getYangDate()[0], ce.getYangDate()[1], ce.getYangDate()[2])[1];
            }
            else if (sp.isExpectYang())
            {
                int y = ce.getYear(sp.getYear());
                int m = ce.getYinMonth(sp.getYear(), sp.getMonth());
                int d = ce.getDay(sp.getDay());
                this.label1.Text = ce.setYinDate(y, m, d);
                this.label2.Text = NetInfoCatcher.InfoPicker(ce.getYangDate()[0], ce.getYangDate()[1], ce.getYangDate()[2])[0];
                this.label3.Text = NetInfoCatcher.InfoPicker(ce.getYangDate()[0], ce.getYangDate()[1], ce.getYangDate()[2])[1];
            }
            else if (!sp.isExpectYang())
            {
                int y = ce.getYear(sp.getYear());
                int m = ce.getYangMonth(sp.getMonth());
                int d = ce.getDay(sp.getDay());
                this.label1.Text = ce.setYangDate(y, m, d);
                this.label2.Text = NetInfoCatcher.InfoPicker(ce.getYangDate()[0], ce.getYangDate()[1], ce.getYangDate()[2])[0];
                this.label3.Text = NetInfoCatcher.InfoPicker(ce.getYangDate()[0], ce.getYangDate()[1], ce.getYangDate()[2])[1];
            }
            else
            {
                this.label1.Text = "请重新输入";
            }
        }