示例#1
0
        internal static string[] GetPathOfEachMissedCard()
        {
            string[] all_cards = Globals.GetPathOfEachCard();
            if (all_cards == null)
            {
                // MessageBox.Show("No cards found.");
                return(null);
            }
            List <string> pending_cards = new List <string>();

            foreach (string c in all_cards)
            {
                try
                {
                    MultiCalendar mc            = MultiCalendar.FromDateTime(DateTime.Now);
                    double        gdp_now       = mc.GetGdp();
                    string        manifest_file = c + "\\manifest.man";
                    KeyValPair    kv            = new KeyValPair(';', ':');
                    kv.Load(manifest_file);
                    double nv_gdp = double.Parse(kv.GetVal("next_visit"));
                    if (nv_gdp < gdp_now)
                    {
                        pending_cards.Add(c);
                    }
                }
                catch
                {
                    continue;
                }
            }
            return(pending_cards.ToArray());
        }
示例#2
0
        internal static string[] GetPathOfEachMissedCard(string GroupPath)
        {
            string[]      cards        = Globals.GetPathOfEachCard(GroupPath);
            List <string> missed_cards = new List <string>();

            foreach (string c in cards)
            {
                try
                {
                    MultiCalendar mc            = MultiCalendar.FromDateTime(DateTime.Now);
                    double        gdp_now       = mc.GetGdp();
                    string        manifest_file = c + "\\manifest.man";
                    KeyValPair    kv            = new KeyValPair(';', ':');
                    kv.Load(manifest_file);
                    double nv_gdp = double.Parse(kv.GetVal("next_visit"));
                    if (nv_gdp < gdp_now)
                    {
                        missed_cards.Add(c);
                    }
                }
                catch
                {
                    continue;
                }
            }
            return(missed_cards.ToArray());
        }
示例#3
0
        private void btnWrongAnswer_Click(object sender, RoutedEventArgs e)
        {
            if (CurrentCardIndex == -1)
            {
                return;
            }
            Card c = Cards[CurrentCardIndex];

            try
            {
                KeyValPair kv = new KeyValPair(';', ':');
                kv.Load(c.ManifestAbsFileName);
                int stage = Convert.ToInt32(kv.GetVal("stage"));
                stage = 0;
                kv.SetVal("stage", stage.ToString());
                MultiCalendar mc  = MultiCalendar.FromDateTime(DateTime.Now);
                double        gdp = mc.GetGdp();
                gdp += Math.Pow(2, stage);
                mc.SetGdp(gdp);
                kv.SetVal("next_visit", gdp.ToString());
                kv.Save(c.ManifestAbsFileName);
                string msg = string.Format("Stage -> {0}\r\nNext -> {1}", stage, mc.GetJalDate());

                string history = string.Format("\r\n[{0}] Wrong Answer. Stage: {1}", Globals.GetDateTimeStampSec(), stage);
                File.AppendAllText(c.HistoryAbsFileName, history);

                MessageBox.Show(msg);

                this.Cards.RemoveAt(CurrentCardIndex);
                Present();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Unable to access manifest file\r\n" + ex.Message);
                System.Diagnostics.Process.Start(c.CardAbsPath);
            }
        }