コード例 #1
0
        public void init()
        {
            //fill the lookups for match cases with external script
            Emphasisvalues.Add("Moderate", PromptEmphasis.Moderate);
            Emphasisvalues.Add("None", PromptEmphasis.None);
            Emphasisvalues.Add("NotSet", PromptEmphasis.NotSet);
            Emphasisvalues.Add("Reduced", PromptEmphasis.Reduced);
            Emphasisvalues.Add("Strong", PromptEmphasis.Strong);

            Ratevalues.Add("ExtraFast", PromptRate.ExtraFast);
            Ratevalues.Add("ExtraSlow", PromptRate.ExtraSlow);
            Ratevalues.Add("Fast", PromptRate.Fast);
            Ratevalues.Add("Medium", PromptRate.Medium);
            Ratevalues.Add("NotSet", PromptRate.NotSet);
            Ratevalues.Add("Slow", PromptRate.Slow);

            //Fill Deepener names
            Deepener_names.Add("Deepener_1.txt");
            Deepener_names.Add("Deepener_2.txt");
            string query = "<QueryMulti:<Anchor1>,<Anchor2>,<Anchor3>,<Anchor4>,Name1,Name2,Name3,Name4>>";
            //QueryMulti(query);



            List <String> vnames = new List <String>();

            foreach (InstalledVoice voice in reader.GetInstalledVoices())
            {
                VoiceInfo info = voice.VoiceInfo;
                //Console.WriteLine(" Voice Name: " + info.Name);
                vnames.Add(info.Name);
            }

            string use_name = "";

            foreach (string n in vnames)
            {
                if (n.Contains("Zira"))
                {
                    string name = n;
                    use_name = n;
                    break;
                }
            }

            //reader.SelectVoice("IVONA 2 Salli");
            //reader.SelectVoice("Microsoft Anna");
            //reader.SelectVoice(use_name);

            QueryMulti selectvoice = new QueryMulti();

            string[] voices = vnames.ToArray();
            selectvoice.One.Text   = voices[0];
            selectvoice.Two.Text   = voices[1];
            selectvoice.Three.Text = voices[2];
            selectvoice.Four.Text  = voices[3];
            selectvoice.Text       = "Select a voice";
            selectvoice.ShowDialog();
            string voiceselected = selectvoice.returnvalue;

            switch (voiceselected)
            {
            case "One":
                reader.SelectVoice(voices[0]);
                break;

            case "Two":
                reader.SelectVoice(voices[1]);
                break;

            case "Three":
                reader.SelectVoice(voices[2]);
                break;

            case "Four":
                reader.SelectVoice(voices[3]);
                break;
            }
            //reader.SelectVoice("IVONA 2 Emma");
            //reader.SelectVoice("Microsoft Anna");
        }
コード例 #2
0
        public void QueryMulti(string input)
        {
            //Example Query
            //<QueryMulti:<Anchor1>,<Anchor2>,<Anchor3>,<Anchor4>,Name1,Name2,Name3,Name4>>
            string QueryStart = "<QueryMulti:";
            int    length     = QueryStart.Length;
            string QueryRaw   = input.Substring(length);

            string[] split        = QueryRaw.Split(',');
            string[] Anchors      = new string[4];
            string[] DisplayNames = new string[4];

            //Extract Display names and Anchor names
            for (int i = 0; i < 4; i++)
            {
                if (i <= 4)
                {
                    Anchors[i]      = split[i].Substring(1, split[i].Length - 2);
                    DisplayNames[i] = split[i + 4];
                    if (i == 3)
                    {
                        DisplayNames[i] = DisplayNames[i].Substring(0, DisplayNames[i].Length - 2);
                    }
                }
            }

            //Create the new Dialoge
            String     return_option = "error";
            QueryMulti multiquery    = new QueryMulti();

            //Set the display name for the buttons and presto.
            multiquery.One.Text   = DisplayNames[0];
            multiquery.Two.Text   = DisplayNames[1];
            multiquery.Three.Text = DisplayNames[2];
            multiquery.Four.Text  = DisplayNames[3];
            multiquery.ShowDialog();
            string returnvalue = multiquery.returnvalue;

            //Now we check what was clicked
            //And also create a default anchor to return to.
            Anchor targetanchor = new Anchor();

            switch (returnvalue)
            {
            case "One":
                targetanchor = FetchAnchor(Anchors[0], "QueryGeneric");
                break;

            case "Two":
                targetanchor = FetchAnchor(Anchors[1], "QueryGeneric");
                break;

            case "Three":
                targetanchor = FetchAnchor(Anchors[2], "QueryGeneric");
                break;

            case "Four":
                targetanchor = FetchAnchor(Anchors[3], "QueryGeneric");
                break;
            }

            Console.WriteLine("Stuff");

            //We have found our anchor
            if (targetanchor.name != "!")
            {
                int Anchorlineindex = targetanchor.line_number;
                //Now we will do the jump
                index = Anchorlineindex;
                //Jump performed.
            }

            Console.WriteLine("Stuff");
        }