Example #1
0
    static void Main()
    {
        Cities  coutryBulgaria = new Cities(new string[] { "Burgas", "Sofia", "Plovdiv", "Varna", "Ruse" });
        Authors authors        = new Authors(new string[] { "Diana", "Petya", "Stella", "Elena", "Katya", "Iva", "Annie", "Eva" });
        Events  events         = new Events(new string[]
                                            { "Now I feel good.", "I have succeeded with this product.", "Makes miracles. I am happy of the results!",
                                     "I cannot believe but now I feel awesome.", "Try it yourself, I am very satisfied.", "I feel great!" });
        Phrases phrase = new Phrases(new string[] { "Excellent product.", "Such a great product.", "I always use that product.",
                                                    "Best product of its category.", "Exceptional product.", "I can’t live without this product." });


        int    input     = int.Parse(Console.ReadLine());
        Random generator = new Random();

        while (input > 0)
        {
            Console.Write(phrase.SpokenPhrases[generator.Next(phrase.GetCountOfPhrases)]);
            Console.Write(" ");
            Console.Write(events.CurrentEvents[generator.Next(events.GetCountOfEvents)]);
            Console.Write(" ");
            Console.Write(authors.Names[generator.Next(authors.GetCountOfAuthors)]);
            Console.Write(" - " +
                          coutryBulgaria.CitiesOfCountry[generator.Next(coutryBulgaria.GetCountOfCity)]);
            input--;
            Console.WriteLine();
        }
    }
Example #2
0
        private void PhraseListEditForm_Load(object sender, EventArgs e)
        {
            float currentAspectRatio = (float)ClientSize.Height / ClientSize.Width;

            if (_designTimeAspectRatio != 0.0f && currentAspectRatio != _designTimeAspectRatio)
            {
                ClientSize = new System.Drawing.Size(ClientSize.Width, (int)(_designTimeAspectRatio * ClientSize.Width));
            }

            Text = R.GetString("EditPhrases");

            labelFavoritePhrase.Text = "* " + R.GetString("FavoritePhrase");

            _phrases = Phrases.Load();

            foreach (var phrase in _phrases.PhraseList)
            {
                phraseAdd(phrase);
            }

            listBoxPhrases.Focus();
            if (listBoxPhrases.Items.Count > 0)
            {
                listBoxPhrases.SelectedIndex = 0;
            }

            _windowActiveWatchdog = new WindowActiveWatchdog(this);

            _dialogCommon.OnLoad();

            PanelCommon.AnimationManager.Start(PanelCommon.RootWidget);
        }
Example #3
0
 public void CreatePhrases()
 {
     Phrases.Add("\"What is this? this is very unusual. Your life line goes on and on.\"");
     Phrases.Add("\"The path of your life will be fraught with many hardships.\"");
     Phrases.Add("\"Are you in love? Ah? Well you soon will be.\"");
     Phrases.Add("\"You should not get too comfortable, I see a great change ahead.\"");
 }
Example #4
0
 public MagicDfsFinder(Phrases phrases, int maxDepth = 3)
 {
     this.phrases = phrases;
     this.maxDepth = maxDepth;
     dfsFinder = new HackedDfsFinder(phrases);
     allSpells = phrases.AsDirections.Reverse().ToArray();
 }
Example #5
0
        void Read(object param, ExecutedRoutedEventArgs e)
        {
            OpenFileDialog of = new OpenFileDialog();

            of.InitialDirectory = Directory.GetCurrentDirectory();
            of.Filter           = "Text Files (.txt)|*.txt";
            var res = of.ShowDialog();

            if (res == DialogResult.OK)
            {
                Filename = of.SafeFileName;

                int cpt = 1;
                Phrases.Clear();
                var lines = File.ReadAllLines(of.FileName, Encoding.GetEncoding(1252));
                foreach (string l in lines)
                {
                    if (l[0] != '-' && l != "")
                    {
                        Phrases.Add(l);
                        _stack.Children.Add(new PhraseControl(cpt, l, parole, this));
                        cpt++;
                    }
                }

                PhraseInProgress = Phrases[0];
                PhraseId         = 0;

                InProgress = true;
            }
        }
Example #6
0
 private static void List(List <string> args)
 {
     if (args.Count == 0)
     {
         if (currentBook == null)
         {
             Books.List();
         }
         else
         {
             Phrases.List();
         }
     }
     else if (args[0] == "books")
     {
         if (args.Count == 1)
         {
             Books.List();
         }
         else
         {
             Console.WriteLine(strings.Get("WrongArgCount"));
         }
     }
     else if (args[0] == "phrases")
     {
         if (args.Count == 3)
         {
             if (args[1] == "in")
             {
                 VersionedDictionary oldBook = currentBook; //TO-DO: 此处实现别扭,应改
                 if (books.TryGetValue(args[2], out currentBook))
                 {
                     Phrases.List();
                 }
                 else
                 {
                     Console.WriteLine(strings.Get("BookNotFound"));
                 }
                 currentBook = oldBook;
             }
             else
             {
                 Console.WriteLine(strings.Get("WrongSyntax"));
             }
         }
         else if (args.Count == 1)
         {
             Phrases.List();
         }
         else
         {
             Console.WriteLine(strings.Get("WrongSyntax"));
         }
     }
     else
     {
         Console.WriteLine(strings.Get("WrongSyntax"));
     }
 }
Example #7
0
        void Open(object param, ExecutedRoutedEventArgs e)
        {
            OpenFileDialog of = new OpenFileDialog();

            of.InitialDirectory = Directory.GetCurrentDirectory();
            of.Filter           = "Text Files (.txt)|*.txt";
            var res = of.ShowDialog();

            if (res == DialogResult.OK)
            {
                Filename = of.SafeFileName;

                int cpt = 0;
                Phrases.Clear();
                var lines = File.ReadAllLines(of.FileName, Encoding.GetEncoding(1252));
                foreach (string l in lines)
                {
                    if (l[0] != '-' && l != "")
                    {
                        Phrases.Add(l);
                        ((PhraseControl)_stack.Children[cpt]).SetPhrase(l);
                        cpt++;
                    }
                }
            }
        }
Example #8
0
        public void Write(BinaryWriter w)
        {
            BPMs.Write(w);
            Phrases.Write(w);
            Chords.Write(w);
            ChordNotes.Write(w);
            Vocals.Write(w);

            if (Vocals.Count > 0)
            {
                SymbolsHeader.Write(w);
                SymbolsTexture.Write(w);
                SymbolsDefinition.Write(w);
            }

            PhraseIterations.Write(w);
            PhraseExtraInfo.Write(w);
            NLD.Write(w);
            Actions.Write(w);
            Events.Write(w);
            Tones.Write(w);
            DNAs.Write(w);
            Sections.Write(w);
            Arrangements.Write(w);
            Meta.Write(w);
        }
        /// <summary>
        /// Loads favorite phrases from the phrase list.
        /// </summary>
        private void loadPhrases()
        {
            var phrases = Phrases.Load();

            _phraseList = new List <Phrase>();

            foreach (var phrase in phrases.PhraseList)
            {
                if (phrase.Favorite)
                {
                    _phraseList.Add(phrase);
                }
            }

            for (int index = 1, phraseIndex = 0; phraseIndex < _phraseList.Count && index <= PhraseCount; index++)
            {
                String name = "Phrase" + index;

                var widget = _alphabetScannerCommon.PanelCommon.RootWidget.Finder.FindChild(name);
                if (widget != null)
                {
                    (widget as TabStopScannerButton).SetTabStops(0.0f, new float[] { 0 });
                    widget.SetText(_phraseList[phraseIndex].Text);
                    phraseIndex++;
                }
            }
        }
 void Start()
 {
     Text prelude_text = GetComponentInChildren<Text>();
     phrases_manager = gameObject.AddComponent<Phrases>();
     phrases_manager.setPhrases(prelude_text);
     load();
 }
Example #11
0
        public async Task <bool> Update(Phrases phrases, string _connection)
        {
            try
            {
                using (SqlConnection conexao = new SqlConnection(_connection))
                {
                    var parametros = new DynamicParameters();
                    parametros.Add("Descricao", phrases.Descricao, DbType.String);
                    parametros.Add("Status", phrases.Status, DbType.Int32);
                    parametros.Add("Data_Registro", phrases.Data_Registro, DbType.DateTime);
                    parametros.Add("Autor", phrases.Autor, DbType.String);
                    parametros.Add("Id", phrases.Id, DbType.Int32);

                    await Policy.Handle <Exception>()
                    .WaitAndRetryAsync(2, i => TimeSpan.FromSeconds(1))
                    .ExecuteAsync(async() => await conexao.ExecuteAsync("Update Phrases set Descricao = @Descricao, Status = @Status, Data_Registro = @Data_Registro, Autor = @Autor where Id = @Id",
                                                                        parametros));
                };
            }
            catch (Exception)
            {
                return(false);
            }
            return(true);
        }
Example #12
0
    public void ReactTo(BaseLevel.Event gameEvent)
    {
        switch (gameEvent)
        {
        case BaseLevel.Event.Greetings:
        case BaseLevel.Event.DodgedBoulder:
        case BaseLevel.Event.DodgedWorm:
        case BaseLevel.Event.DodgedGlove:
        case BaseLevel.Event.Punched:
            this.Say(Phrases.Random(gameEvent.ToString("G")));
            break;

        case BaseLevel.Event.Started:
            this.ForceInterrupt(Phrases.Random(gameEvent.ToString("G")));
            break;

        case BaseLevel.Event.Fell:
        case BaseLevel.Event.Eaten:
        case BaseLevel.Event.Smashed:
        case BaseLevel.Event.Win:
            this.ForceInterrupt(Phrases.Random(gameEvent.ToString("G")));
            this.CanFeelBlank = false;
            break;
        }
    }
Example #13
0
        /// <summary>
        /// Extracts speak abbreviations from the abbreviations
        /// file and adds them to the phrases file. Removes 'favorite'
        /// phrases from the abbreviations file.
        /// </summary>
        /// <param name="abbreviationsFile">input abbreviations file</param>
        /// <param name="phrasesFile">output phrases file</param>
        private static void extractPhrases(String abbreviationsFile, String phrasesFile)
        {
            var abbreviations = new Abbreviations();

            bool retVal = abbreviations.Load(abbreviationsFile);

            if (!abbreviations.AbbreviationList.Any() || !retVal)
            {
                return;
            }

            var phrases = File.Exists(phrasesFile) ? Phrases.Load(phrasesFile) : new Phrases();

            foreach (var abbreviation in abbreviations.AbbreviationList)
            {
                if (abbreviation.Mode == Abbreviation.AbbreviationMode.Speak && !String.IsNullOrEmpty(abbreviation.Expansion))
                {
                    var phrase = new Phrase {
                        Text = abbreviation.Expansion
                    };

                    if (abbreviation.Mnemonic.StartsWith("**"))
                    {
                        phrase.Favorite = true;
                    }

                    phrases.Add(phrase);
                }
            }

            phrases.Save(phrasesFile);

            var count = 0;

            while (true)
            {
                bool found = false;

                foreach (var abbreviation in abbreviations.AbbreviationList)
                {
                    if (abbreviation.Mnemonic.StartsWith("**"))
                    {
                        abbreviations.Remove(abbreviation.Mnemonic);
                        found = true;
                        count++;
                        break;
                    }
                }

                if (!found)
                {
                    if (count > 0)
                    {
                        abbreviations.Save(abbreviationsFile);
                    }

                    break;
                }
            }
        }
Example #14
0
        public async Task <bool> Insert(Phrases phrases, string _connection)
        {
            try
            {
                using (SqlConnection conexao = new SqlConnection(_connection))
                {
                    var parametros = new DynamicParameters();
                    parametros.Add("Descricao", phrases.Descricao, DbType.String);
                    parametros.Add("Status", phrases.Status, DbType.Int32);
                    parametros.Add("Data_Registro", phrases.Data_Registro, DbType.DateTime);
                    parametros.Add("Autor", phrases.Autor, DbType.String);

                    conexao.Open();

                    await Policy.Handle <Exception>()
                    .WaitAndRetryAsync(2, i => TimeSpan.FromSeconds(1))
                    .ExecuteAsync(async() => await conexao.ExecuteAsync("Insert into Phrases(Descricao,Status,Data_Registro,Autor)" +
                                                                        "values(@Descricao, @Status, @Data_Registro, @Autor)", parametros));

                    return(true);
                }
            }
            catch (Exception)
            {
                return(false);
            }
        }
        public string GetPhrase()
        {
            //local variable
            int randomNumber = Random.Next(Phrases.Count);

            return(Phrases.ElementAt(randomNumber));
        }
Example #16
0
 public string GetPhrase(string key)
 {
     if (Phrases.ContainsKey(key))
     {
         return(Phrases[key]);
     }
     return(string.Format("Phrase '{0}' is not defined", key));
 }
        exoMissingWords(ExercicesRow data) : base(data)
        {
            PhrasesRow sentence = (PhrasesRow)Phrases.Select("codePhrase = '" + data.codePhrase + "'")[0];

            lblSentence.Text = sentence.traducPhrase;
            _solution        = sentence.textePhrase;
            CreateChallenge(_solution, data.listeMots);
        }
Example #18
0
    private void FillBlank()
    {
        if (!this.CanFeelBlank)
        {
            return;
        }

        this.Say(Phrases.Random(Phrases.FillBlank));
    }
Example #19
0
 public Solver(Phrases phrases, IFinder finder, IOracle oracle, int bestSugessionsCount = 20, double metricEpsilon = 1)
 {
     this.phrases = phrases;
     Finder = finder;
     Oracle = oracle;
     this.bestSugessionsCount = bestSugessionsCount;
     this.metricEpsilon = metricEpsilon;
     Name = oracle.GetType().Name + "-" + finder.GetType().Name;
 }
Example #20
0
        internal void SetPhrases(string v)
        {
            if (Locked)
            {
                throw new InvalidOperationException("This MonsterType is locked and cannot be altered.");
            }

            Phrases.AddRange(CipParser.SplitByTokenPreserveQuoted(v, ','));
        }
Example #21
0
        public override void RemoveAt(TranscriptionIndex index)
        {
            ValidateIndexOrThrow(index);
            if (!index.IsPhraseIndex)
            {
                throw new IndexOutOfRangeException("index");
            }

            Phrases.RemoveAt(index.PhraseIndex);
        }
Example #22
0
        public override void Insert(TranscriptionIndex index, TranscriptionElement value)
        {
            ValidateIndexOrThrow(index);
            if (!index.IsPhraseIndex)
            {
                throw new IndexOutOfRangeException("index");
            }

            Phrases.Insert(index.PhraseIndex, (TranscriptionPhrase)value);
        }
Example #23
0
    void SetCurrentPhrase()
    {
        int randomPhraseIndex = Random.Range(0, unansweredPhrases.Count);

        currentPhrase = unansweredPhrases[randomPhraseIndex];

        phraseText.text = currentPhrase.phrase;

        unansweredPhrases.RemoveAt(randomPhraseIndex);
    }
Example #24
0
 public AdaptiveSolver(Phrases phrases)
 {
     this.phrases = phrases;
     finder = new MagicDfsFinder(phrases);
     fastest = BuildSolver(new MephalaOracle(new MagicDfsFinder(phrases, 2), WeightedMetric.Keening));
     fast = BuildSolver(new MephalaOracle(finder, WeightedMetric.Keening));
     fast2 = BuildSolver(new MephalaOracle(finder, WeightedMetric.Sunder));
     slowest = BuildSolver(new HircineOracle(finder, WeightedMetric.Debug, 4, 5));
     slow = BuildSolver(new HircineOracle(finder, WeightedMetric.Debug, 3, 5));
 }
        private Phrases ParseDataFromFile()
        {
            var       phrases = new Phrases();
            TextAsset file    = Resources.Load("phrases") as TextAsset;
            string    content = file.ToString();

            JsonUtility.FromJsonOverwrite(content, phrases);


            return(phrases);
        }
 public ChildTalkerBackButton(string _text, string _imagePath, Phrases _root, bool _inColor)
 {
     Text      = _text;
     ImagePath = _imagePath;
     InColor   = false;
     root      = _root;
     Xml       = null;
     //Xml.Text = null;
     //Xml.ImagePath = null;
     scan = Autoscan2.Instance;
 }
Example #27
0
        /// <summary>
        /// Get the list of and populates the list
        /// </summary>
        public void LoadPhrases()
        {
            Windows.SetText(SearchFilter, String.Empty);

            var phrases = Phrases.Load();

            _allPhrasesList = phrases.PhraseList;

            _phrasesList = _allPhrasesList.ToList();

            refreshPhrasesList();
        }
        // DELETE api/<controller>/5
        public IHttpActionResult Delete(int id)
        {
            bool rows = Phrases.Delete(id);

            if (rows == true)
            {
                return(Content(HttpStatusCode.NoContent, 204));
            }
            else
            {
                return(Content(HttpStatusCode.NotFound, 404));
            }
        }
 public void AddPhrase(PhraseEdit phrase)
 {
     //PhraseIds.Add(phrase.Id);
     if (_PhraseAdding != null)
     {
         throw new Exception();
     }
     _PhraseAdding     = phrase;
     Phrases.AddedNew += Phrases_AddedNew;
     Phrases.AddNew();
     Phrases.AddedNew -= Phrases_AddedNew;
     BusinessRules.CheckRules();
 }
Example #30
0
        public async Task <ActionResult> Insert([FromBody] Phrases phrases)
        {
            var result = await phrasesRepository.Insert(phrases, _config.GetConnectionString("ExemploDapperSqlServer"));

            if (result)
            {
                return(StatusCode(201));
            }
            else
            {
                return(BadRequest());
            }
        }
Example #31
0
        // CreateTable()
        public void CreateTable()
        {
            var db = new PocoDynamo(con.GetClient());

            try
            {
                db.RegisterTable <Phrases>();
                db.InitSchema();

                List <string> phrases = new List <string>();
                phrases.Add("Para ganar en la vida, antes hay que saber perder");
                phrases.Add("Educa a los niños, y no será necesario castigar a los hombres");
                phrases.Add("Vive el presente sin olvidar el pasado, pero mirando siempre hacia el futuro");
                phrases.Add("La gente inteligente cuida lo que dice, respeta lo que escucha y medita lo que calla");
                phrases.Add("Si quieres una mano que te ayude, la encontraras al final de tu brazo");
                phrases.Add("La medida de la inteligencia es la habilidad para cambiar y adaptarse");
                phrases.Add("La mente es como un paracaídas, sólo funciona si se abre");
                phrases.Add("Eres el juez de tus propios actos y el árbitro de tu propio destino");
                phrases.Add("El dinero hace personas ricas, el conocimiento hace personas sabias, la humildad hace grandes personas");
                phrases.Add("Hace falta toda una vida para aprender a vivir");
                phrases.Add("No es sabia el que sabe sino el que no sabe y quiere aprender");
                phrases.Add("La sabiduría comienza donde termina el conocimiento");
                phrases.Add("Aprende del pasado, vive el presente y trabaja para el futuro");
                phrases.Add("En la vida algunas veces se gana, otras veces se aprende");
                phrases.Add("Un hombre inteligente jamás se irritaría, si tuviera delante siempre un espejo y se viera cuando discute");
                phrases.Add("Si quieres algo que nunca tuviste, debes hacer algo que nunca hiciste");
                phrases.Add("Lo malo de aprender con la experiencia, es que nunca nos graduamos");
                phrases.Add("El mayor defecto de los defectos es no darse cuenta de ninguno de ellos");
                phrases.Add("Experiencia es lo que conseguimos cuando no leemos las instrucciones");
                phrases.Add("Un tropezón puede prevenir una caída");

                for (int i = 1; i < 21; i++)
                {
                    var pharse = new Phrases
                    {
                        Id     = i,
                        Phrase = phrases[i - 1]
                    };

                    db.PutItem(pharse);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine("\nError \nUbicación: Capa DAL -> MPhrases -> CreateTable(). \nDescripción: " + ex.Message);
            }
            finally
            {
                db.Close();
            }
        }
Example #32
0
 public void CreatePhrases()
 {
     Phrases.Add("\"Night time is a dark place for you. Be careful of your choices.\"");
     Phrases.Add("\"Joy shines upon you with the coming of the dawn.\"");
     Phrases.Add("\"Stop and wait. Realign your energies. You are in conflict.\"");
     Phrases.Add("\"Now is the time to act! You must make your move immediately!\"");
     Phrases.Add("\"I see shiny objects in your near future.\"");
     Phrases.Add("\"The decorating around you is terrible Feng Shui.\"");
     Phrases.Add("\"Mars is in high sanction - don't start any business ventures.\"");
     Phrases.Add("\"If you always face the light, you will never see shadow.\"");
     Phrases.Add("\"The moon is full.. beware your tomorrows.");
     Phrases.Add("\"Never take your safety for granted. Death watches and paces restlessly.\"");
     Phrases.Add("\"The beautiful emerald resonates with your soul. Your aura will protect you.\"");
 }
 public ChildTalkerFolderAdder(string _text, string _imagePath, Phrases _root, bool _hasColor)
 {
     Text      = _text;
     ImagePath = _imagePath;
     HasColor  = _hasColor;
     Root      = _root;
     // collection initializer
     Xml = new ChildTalkerXml
     {
         Text      = _text,
         ImagePath = _imagePath,
         TileType  = ChildTalkerXml.Tile.folder
     };
 }
 public ChildTalkerTileAdder(string _text, string _imagePath, Phrases _root)
 {
     Text      = _text;
     ImagePath = _imagePath;
     HasColor  = IsFileTypeTransparent(_imagePath);
     Root      = _root;
     // collection initializer
     Xml = new ChildTalkerXml()
     {
         Text      = _text,
         ImagePath = _imagePath,
         TileType  = ChildTalkerXml.Tile.talker
     };
 }
Example #35
0
 public void Test()
 {
     var directions = new Phrases(Phrases.DefaultPowerWords).All.Select(w => w + " → " + string.Join(" ", w.ToDirections().Select(d => d.ToString())));
     Console.WriteLine(directions);
     Approvals.VerifyAll(directions, "d");
 }
Example #36
0
 public HackedDfsFinder(Phrases phrases)
 {
     this.phrases = phrases;
 }