public JsonResult GetPhrases(string start, string length)
        {
            PhraseManager pMgr = new PhraseManager(config, cache);

            List <EuphracPhrase> phrases = pMgr.Get();

            int pageSize = length != null?Convert.ToInt32(length) : 0;

            int skip = start != null?Convert.ToInt32(start) : 0;

            var data = phrases.Skip(skip).Take(pageSize).ToList();

            return(Json(data));
        }
Example #2
0
        public void CoreGetterTest()
        {
            Core          core    = Core.GetCore();
            PhraseManager manager = core.GetPhraseManager();

            Assert.AreEqual(manager.PhraseCount(), 0);

            Scheduler scheduler = core.GetScheduler();

            Assert.AreEqual(scheduler.TaskCount, 0);

            AppConfig config = core.GetConfig();

            Assert.AreEqual(config.ShowClosedTasks, false);
        }
        public void PhraseManagerTest()
        {
            PhraseManager manager = new PhraseManager("Blah");
            Phrase        phrase1 = new Phrase("<name>, I am testing this phrase.", 5, 3, 0);
            Phrase        phrase2 = new Phrase("So it's gonna be forever, or it's going to go down in flames!");
            Phrase        phrase3 = new Phrase("And you love the game!", 4, 2);

            manager.AddPhrase(phrase1);
            manager.AddPhrase(phrase2);
            manager.AddPhrase(phrase3);

            Assert.AreEqual(manager.PhraseCount(), 3);
            Phrase phrase = manager.PhraseAt(1);

            Assert.AreEqual(phrase.Text, "So it's gonna be forever, or it's going to go down in flames!");

            phrase = manager.PhraseAt(2);
            Assert.AreEqual(phrase.VerbPosition, 2);
        }
Example #4
0
 private Core()
 {
     m_configuration = new AppConfig(SCHEDULEAPP_CONFIG_FILE);
     m_phraseManager = new PhraseManager(SCHEDULEAPP_PHRASE_FILE);
     m_scheduler     = new Scheduler(SCHEDULEAPP_TASKS_FILE);
 }
Example #5
0
 private void Awake()
 {
     Instance = this;
 }
 //Awake method
 void Awake()
 {
     instance = this;
 }
Example #7
0
 private Core()
 {
     m_configuration = new AppConfig(SCHEDULEAPP_CONFIG_FILE);
     m_phraseManager = new PhraseManager(SCHEDULEAPP_PHRASE_FILE);
     m_scheduler = new Scheduler(SCHEDULEAPP_TASKS_FILE);
 }