예제 #1
0
        private void OnLoaded(object sender, RoutedEventArgs e)
        {
            var gta3Fname = Path.Combine(Properties.Settings.Default.GTASAPath, "models", "gta3.img");
            var sampFname = Path.Combine(Properties.Settings.Default.GTASAPath, "SAMP", "samp.img");

            if (!File.Exists(gta3Fname))
            {
                new SettingsWindow().ShowDialog();
            }

            // if, again, after prompting the user with the settings window,
            // they didn't set a valid path to GTA San Andreas root folder, then:
            if (!File.Exists(gta3Fname))
            {
                MessageBox.Show(
                    "You must specify a valid GTA San Andreas installation folder. Unable to load model data.",
                    "Error",
                    MessageBoxButton.OK,
                    MessageBoxImage.Error
                    );
            }
            else
            {
                MasterDictionary.LoadIMG();
            }
        }
        public GameRules(string GenerationType, string PracticeType, MasterDictionary Dictionary)
        {
            Data   = Dictionary;
            random = new Random();

            Modes = new Dictionary <string, List <int> >()
            {
                { "Kanji", new List <int>()
                  {
                      Kanji, Reading, English
                  } },
                { "Reading", new List <int>()
                  {
                      Reading, English, Kanji
                  } },
                { "English", new List <int>()
                  {
                      English, Reading, Kanji
                  } }
            };

            mode = PracticeType;

            GameMode(GenerationType);
        }
예제 #3
0
        protected void btnProcess_Click(object sender, EventArgs e)
        {
            if (FileUpload1.HasFile)
            {
                var reader   = new StreamReader(FileUpload1.FileContent);
                var document = reader.ReadToEnd();
                reader.Close();
                string fileName = tbFileName.Text;
                bool   success  = gen.saveDocument(document, path, fileName, fileName);
                if (success)
                {
                    int batchSize     = 1000;
                    var isCustomBatch = int.TryParse(tbBatchSize.Text, out batchSize);
                    if (isCustomBatch)
                    {
                        lblBatchSize.Text = string.Format("Batch Size {0}", batchSize);
                    }
                    var docList = gen.splitDocument(document, batchSize, true);

                    // update dictionary entry
                    MasterDictionary.UpdateEntry(fileName, true, 0);

                    int docCount = 1;
                    foreach (var doc in docList)
                    {
                        var name = fileName + "_" + docCount.ToString();
                        gen.saveDocument(doc, path, fileName, name);
                        docCount++;
                    }

                    lblProcess.ForeColor = System.Drawing.Color.Green;
                    lblProcess.Text      = "Done: Sucess!";
                }

                else
                {
                    lblFileUpload.ForeColor = System.Drawing.Color.Red;
                    lblFileUpload.Text      = "Upload Failed: File not stored to server";
                }
            }
            else
            {
                lblFileUpload.ForeColor = System.Drawing.Color.Red;
                lblFileUpload.Text      = "Upload Failed: File not found";
            }
        }
예제 #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            fileName = tbFileName.Text;
            if (fileName == null)
            {
                fileName = "Batch";
            }

            batchSize = int.Parse(tbBatchSize.Text);
            if (batchSize == 0)
            {
                batchSize = 1000;
            }

            master = MasterDictionary.Instance;
            gen    = new BatchGen();
        }
예제 #5
0
 private void OnMasterDictionaryIDELoadCompleted(object sender, EventArgs e)
 {
     MasterDictionary.LoadIPL();
 }
예제 #6
0
 private BatchData GetNext()
 {
     return(MasterDictionary.GetRandomBatch(0));
 }