Example #1
0
        internal static void SetDefaultGroup(string DefaultCardGroupPath)
        {
            if (Directory.Exists(DefaultCardGroupPath) == false)
            {
                return;
            }

            KeyValPair kv = new KeyValPair(';', ':');
            string     settings_file_name = Globals.GetExecutablePath() + "Settings.stg";

            kv.Load(settings_file_name);
            kv.SetVal("DefaultGroup", DefaultCardGroupPath);
            kv.Save(settings_file_name);
        }
Example #2
0
 public bool UpdateManifestFile()
 {
     try
     {
         KeyValPair kvp = new KeyValPair(';', ':');
         kvp.Add("next_visit", this.NextVisitGdp.ToString());
         kvp.Add("stage", this.Stage.ToString());
         kvp.Add("can_edit", this.CanEdit.ToString());
         kvp.Add("last_modified", this.LastModifiedGdp.ToString());
         kvp.Add("crc", this.Crc.ToString());
         return(kvp.Save(this.ManifestAbsFileName));
     }
     catch
     {
         return(false);
     }
 }
Example #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);
            }
        }