Beispiel #1
0
        public override bool ConfigurationMenu(Form parent, ActionCoreController cp, List <string> eventvars)
        {
            string             path;
            ConditionVariables vars;

            FromString(userdata, out path, out vars);

            WaveConfigureDialog cfg = new WaveConfigureDialog();

            cfg.Init(cp.AudioQueueWave, false, "Select file, volume and effects", "Configure Play Command", path,
                     vars.Exists(waitname),
                     AudioQueue.GetPriority(vars.GetString(priorityname, "Normal")),
                     vars.GetString(startname, ""),
                     vars.GetString(finishname, ""),
                     vars.GetString(volumename, "Default"),
                     vars);

            if (cfg.ShowDialog(parent) == DialogResult.OK)
            {
                ConditionVariables cond = new ConditionVariables(cfg.Effects);// add on any effects variables (and may add in some previous variables, since we did not purge)
                cond.SetOrRemove(cfg.Wait, waitname, "1");
                cond.SetOrRemove(cfg.Priority != AudioQueue.Priority.Normal, priorityname, cfg.Priority.ToString());
                cond.SetOrRemove(cfg.StartEvent.Length > 0, startname, cfg.StartEvent);
                cond.SetOrRemove(cfg.StartEvent.Length > 0, finishname, cfg.FinishEvent);
                cond.SetOrRemove(!cfg.Volume.Equals("Default", StringComparison.InvariantCultureIgnoreCase), volumename, cfg.Volume);
                userdata = ToString(cfg.Path, cond);
                return(true);
            }

            return(false);
        }
Beispiel #2
0
        static public void HistoryEventVars(ConditionVariables vars, HistoryEntry he, string prefix)
        {
            if (he != null)
            {
                System.Globalization.CultureInfo ct = System.Globalization.CultureInfo.InvariantCulture;

                vars[prefix + "LocalTime"]   = he.EventTimeLocal.ToString("MM/dd/yyyy HH:mm:ss");
                vars[prefix + "DockedState"] = he.IsDocked ? "1" : "0";
                vars[prefix + "LandedState"] = he.IsLanded ? "1" : "0";
                vars[prefix + "WhereAmI"]    = he.WhereAmI;
                vars[prefix + "ShipType"]    = he.ShipType;
                vars[prefix + "ShipId"]      = he.ShipId.ToString(ct);
                vars[prefix + "IndexOf"]     = he.Indexno.ToString(ct);
                vars[prefix + "JID"]         = he.Journalid.ToString(ct);

                vars.AddPropertiesFieldsOfClass(he.journalEntry, prefix + "Class_", new Type[] { typeof(System.Drawing.Bitmap), typeof(Newtonsoft.Json.Linq.JObject) }, 5);       //depth seems good enough

                // being backwards compatible to actions packs BEFORE the V3 change to remove JS vars
                // these were the ones used in the pack..

                vars[prefix + "JS_event"] = he.EntryType.ToString();
                if (he.journalEntry is EliteDangerous.JournalEvents.JournalReceiveText)
                {
                    vars[prefix + "JS_Channel"] = (he.journalEntry as EliteDangerous.JournalEvents.JournalReceiveText).Channel;
                }
                if (he.journalEntry is EliteDangerous.JournalEvents.JournalBuyAmmo)
                {
                    vars[prefix + "JS_Cost"] = (he.journalEntry as EliteDangerous.JournalEvents.JournalBuyAmmo).Cost.ToString(System.Globalization.CultureInfo.InvariantCulture);
                }
            }
        }
Beispiel #3
0
 static public void TriggerVars(ConditionVariables vars, string trigname, string triggertype)
 {
     vars["TriggerName"]      = trigname;                                        // Program gets eventname which triggered it.. (onRefresh, LoadGame..)
     vars["TriggerType"]      = triggertype;                                     // type (onRefresh, or OnNew, or ProgramTrigger for all others)
     vars["TriggerLocalTime"] = DateTime.Now.ToString("MM/dd/yyyy HH:mm:ss");    // time it was started, US format, to match JSON.
     vars["TriggerUTCTime"]   = DateTime.UtcNow.ToString("MM/dd/yyyy HH:mm:ss"); // time it was started, US format, to match JSON.
 }
Beispiel #4
0
        static public string Menu(Form parent, System.Drawing.Icon ic, string userdata, List <string> additionalkeys, BaseUtils.EnhancedSendKeysParser.IAdditionalKeyParser additionalparser)
        {
            ConditionVariables vars;
            string             keys;

            FromString(userdata, out keys, out vars);

            ExtendedControls.KeyForm kf = new ExtendedControls.KeyForm();
            int    defdelay             = vars.Exists(DelayID) ? vars[DelayID].InvariantParseInt(DefaultDelay) : ExtendedControls.KeyForm.DefaultDelayID;
            string process = vars.Exists(ProcessID) ? vars[ProcessID] : "";

            kf.Init(ic, true, " ", keys, process, defdelay: defdelay, additionalkeys: additionalkeys, parser: additionalparser);      // process="" default, defdelay = DefaultDelayID default

            if (kf.ShowDialog(parent) == DialogResult.OK)
            {
                ConditionVariables vlist = new ConditionVariables();

                if (kf.DefaultDelay != ExtendedControls.KeyForm.DefaultDelayID)                                       // only add these into the command if set to non default
                {
                    vlist[DelayID] = kf.DefaultDelay.ToStringInvariant();
                }
                if (kf.ProcessSelected.Length > 0)
                {
                    vlist[ProcessID] = kf.ProcessSelected;
                }

                return(ToString(kf.KeyList, vlist));
            }
            else
            {
                return(null);
            }
        }
        public bool FromString(string s, out string progname, out ConditionVariables vars, out Dictionary <string, string> altops)
        {
            StringParser p = new StringParser(s);

            vars   = new ConditionVariables();
            altops = new Dictionary <string, string>();

            progname = p.NextWord("( ");        // stop at space or (

            if (progname != null)
            {
                if (p.IsCharMoveOn('('))                                                                                                      // if (, then
                {
                    if (vars.FromString(p, ConditionVariables.FromMode.MultiEntryCommaBracketEnds, altops) && p.IsCharMoveOn(')') && p.IsEOL) // if para list decodes and we finish on a ) and its EOL
                    {
                        return(true);
                    }
                }
                else if (p.IsEOL)   // if EOL, its okay, prog name only
                {
                    return(true);
                }
            }

            return(false);
        }
        private ConditionVariables ReadVarsFromFile(string file, out bool?enable)
        {
            using (StreamReader sr = new StreamReader(file))         // read directly from file..
            {
                string json = sr.ReadToEnd();

                JObject jo = (JObject)JObject.Parse(json);

                enable = null;
                if (!JSONHelper.IsNullOrEmptyT(jo["Enabled"]))      // if this has an enabled, note it
                {
                    enable = (bool)jo["Enabled"];
                }

                JArray ivarja = (JArray)jo["Install"];

                if (!JSONHelper.IsNullOrEmptyT(ivarja))
                {
                    ConditionVariables cv = new ConditionVariables();
                    cv.FromJSONObject(ivarja);
                    return(cv);
                }
            }

            return(null);
        }
Beispiel #7
0
        public void ConfigureVoice(string title)
        {
            string             voicename = Globals.GetString(ActionSay.globalvarspeechvoice, "Default");
            string             volume    = Globals.GetString(ActionSay.globalvarspeechvolume, "Default");
            string             rate      = Globals.GetString(ActionSay.globalvarspeechrate, "Default");
            ConditionVariables effects   = new ConditionVariables(PersistentVariables.GetString(ActionSay.globalvarspeecheffects, ""), ConditionVariables.FromMode.MultiEntryComma);

            ExtendedAudioForms.SpeechConfigure cfg = new ExtendedAudioForms.SpeechConfigure();
            cfg.Init(AudioQueueSpeech, SpeechSynthesizer,
                     "Select voice synthesizer defaults", title, this.Icon,
                     null, false, false, AudioExtensions.AudioQueue.Priority.Normal, "", "",
                     voicename,
                     volume,
                     rate,
                     effects);

            if (cfg.ShowDialog(discoveryform) == DialogResult.OK)
            {
                SetPeristentGlobal(ActionSay.globalvarspeechvoice, cfg.VoiceName);
                SetPeristentGlobal(ActionSay.globalvarspeechvolume, cfg.Volume);
                SetPeristentGlobal(ActionSay.globalvarspeechrate, cfg.Rate);
                SetPeristentGlobal(ActionSay.globalvarspeecheffects, cfg.Effects.ToString());

                EDDConfig.Instance.DefaultVoiceDevice = AudioQueueSpeech.Driver.GetAudioEndpoint();
            }
        }
Beispiel #8
0
        public ActionProgramRun(ActionFile af,                      // associated file
                                ActionProgram r,                    // the program
                                ConditionVariables iparas,          // input variables to the program only.. not globals
                                ActionRun runner,                   // who is running it..
                                ActionController ed) : base(r.Name) // allow a pause
        {
            actionfile           = af;
            actionrun            = runner;
            actioncontroller     = ed;
            execlevel            = 0;
            execstate[execlevel] = ExecState.On;
            nextstepnumber       = 0;

            System.Diagnostics.Debug.WriteLine("Run " + actionfile.name + "::" + r.Name);
            //ActionData.DumpVars(gvars, " Func Var:");

            inputvars = iparas;             // current vars is set up by ActionRun at the point of invokation to have the latests globals

            List <Action> psteps = new List <Action>();
            Action        ac;

            for (int i = 0; (ac = r.GetStep(i)) != null; i++)
            {
                psteps.Add(Action.CreateCopy(ac));
            }

            programsteps = psteps;
        }
        public Object Generate(System.IO.Stream audioms, ConditionVariables effects, bool ensureaudio)
        {
            try
            {
                audioms.Position = 0;
                IWaveSource s = new CSCore.Codecs.WAV.WaveFileReader(audioms);

                if (ensureaudio)
                {
                    s = s.AppendSource(x => new ExtendWaveSource(x, 100));          // SEEMS to help the click at end..
                }
                ApplyEffects(ref s, effects);
                return(s);
            }
            catch
            {
                if (ensureaudio)
                {
                    return(new NullWaveSource(5));
                }
                else
                {
                    return(null);
                }
            }
        }
Beispiel #10
0
        public override bool ExecuteAction(ActionProgramRun ap)
        {
            string             keys;
            ConditionVariables statementvars;

            if (FromString(userdata, out keys, out statementvars))
            {
                string             errlist = null;
                ConditionVariables vars    = statementvars.ExpandAll(ap.functions, statementvars, out errlist);

                if (errlist == null)
                {
                    int    defdelay = vars.Exists(DelayID) ? vars[DelayID].InvariantParseInt(DefaultDelay) : (ap.VarExist(globalvarDelay) ? ap[globalvarDelay].InvariantParseInt(DefaultDelay) : DefaultDelay);
                    string process  = vars.Exists(ProcessID) ? vars[ProcessID] : (ap.VarExist(globalvarProcessID) ? ap[globalvarProcessID] : "");

                    string res = BaseUtils.EnhancedSendKeys.Send(keys, defdelay, DefaultShiftDelay, DefaultUpDelay, process);

                    if (res.HasChars())
                    {
                        ap.ReportError("Key Syntax error : " + res);
                    }
                }
                else
                {
                    ap.ReportError(errlist);
                }
            }
            else
            {
                ap.ReportError("Key command line not in correct format");
            }

            return(true);
        }
Beispiel #11
0
        public int ActionRun(ActionEvent ev, HistoryEntry he = null, ConditionVariables additionalvars = null,
                             string flagstart = null, bool now = false)                                            //set flagstart to be the first flag of the actiondata..
        {
            List <ActionFileList.MatchingSets> ale = actionfiles.GetMatchingConditions(ev.TriggerName, flagstart); // look thru all actions, find matching ones

            if (ale.Count > 0)
            {
                ConditionVariables eventvars = new ConditionVariables();
                Actions.ActionVars.TriggerVars(eventvars, ev.TriggerName, ev.TriggerType);
                Actions.ActionVars.HistoryEventVars(eventvars, he, "Event");                      // if HE is null, ignored
                Actions.ActionVars.ShipBasicInformation(eventvars, he?.ShipInformation, "Event"); // if He null, or si null, ignore
                Actions.ActionVars.SystemVars(eventvars, he?.System, "Event");
                eventvars.Add(additionalvars);                                                    // adding null is allowed

                //System.Diagnostics.Debug.WriteLine("Dispatch Program with" + Environment.NewLine + eventvars.ToString(prefix:".. ", separ: Environment.NewLine));

                ConditionVariables testvars = new ConditionVariables(Globals);
                testvars.Add(eventvars);

                ConditionFunctions functions = new ConditionFunctions(testvars, null);

                if (actionfiles.CheckActions(ale, he?.journalEntry, testvars, functions) > 0)
                {
                    actionfiles.RunActions(now, ale, actionrunasync, eventvars); // add programs to action run

                    actionrunasync.Execute();                                    // See if needs executing
                }
            }

            return(ale.Count);
        }
Beispiel #12
0
        public int ActionRun(string triggername, string triggertype, HistoryEntry he = null, ConditionVariables additionalvars = null,
                             string flagstart = null, bool now = false)                                         //set flagstart to be the first flag of the actiondata..
        {
            List <ActionFileList.MatchingSets> ale = actionfiles.GetMatchingConditions(triggername, flagstart); // look thru all actions, find matching ones

            if (ale.Count > 0)
            {
                ConditionVariables eventvars = new ConditionVariables();
                Actions.ActionVars.TriggerVars(eventvars, triggername, triggertype);
                Actions.ActionVars.HistoryEventVars(eventvars, he, "Event");                      // if HE is null, ignored
                Actions.ActionVars.ShipBasicInformation(eventvars, he?.ShipInformation, "Event"); // if He null, or si null, ignore
                Actions.ActionVars.SystemVars(eventvars, he?.System, "Event");
                eventvars.Add(additionalvars);                                                    // adding null is allowed

                ConditionVariables testvars = new ConditionVariables(globalvariables);
                testvars.Add(eventvars);

                ConditionFunctions functions = new ConditionFunctions(testvars, null);

                if (actionfiles.CheckActions(ale, he?.journalEntry, testvars, functions) > 0)
                {
                    actionfiles.RunActions(now, ale, actionrunasync, eventvars); // add programs to action run

                    actionrunasync.Execute();                                    // See if needs executing
                }
            }

            return(ale.Count);
        }
Beispiel #13
0
        static public void ShipBasicInformation(ConditionVariables vars, ShipInformation si, string prefix)
        {
            string ship = "Unknown", id = "0", name = "Unknown", ident = "Unknown", sv = "None", fullinfo = "Unknown", shortname = "Unknown", fuel = "0", cargo = "0", fuellevel = "0";

            if (si != null)
            {
                ship      = si.ShipType.Alt("Unknown");
                id        = si.ID.ToString(System.Globalization.CultureInfo.InvariantCulture);
                name      = si.ShipUserName.Alt("");
                ident     = si.ShipUserIdent.Alt("");
                sv        = si.SubVehicle.ToString();
                fullinfo  = si.ShipFullInfo();
                shortname = si.ShipShortName.Alt("Unknown");
                fuel      = si.FuelCapacity.ToString("0.0");
                fuellevel = si.FuelLevel.ToString("0.0");
                cargo     = si.CargoCapacity().ToStringInvariant();
            }

            vars[prefix + "Ship"]               = ship;     // need to be backwards compatible with older entries..
            vars[prefix + "Ship_ID"]            = id;
            vars[prefix + "Ship_Name"]          = name;
            vars[prefix + "Ship_Ident"]         = ident;
            vars[prefix + "Ship_SubVehicle"]    = sv;
            vars[prefix + "Ship_FullInfo"]      = fullinfo;
            vars[prefix + "Ship_ShortName"]     = shortname;
            vars[prefix + "Ship_FuelLevel"]     = fuellevel;
            vars[prefix + "Ship_FuelCapacity"]  = fuel;
            vars[prefix + "Ship_CargoCapacity"] = cargo;
        }
 private void writeEventInfoToLogDebugToolStripMenuItem_Click(object sender, EventArgs e)        //DEBUG ONLY
 {
     ConditionVariables cv = new ConditionVariables();
     cv.AddPropertiesFieldsOfClass(rightclicksystem.journalEntry, "", new Type[] { typeof(System.Drawing.Bitmap), typeof(Newtonsoft.Json.Linq.JObject) }, 5);
     discoveryform.LogLine(cv.ToString(separ: Environment.NewLine, quoteit: false));
     if (rightclicksystem.ShipInformation != null)
         discoveryform.LogLine(rightclicksystem.ShipInformation.ToString());
 }
Beispiel #15
0
        protected bool FromString(string ud, out ConditionVariables vars, out Dictionary <string, string> operations)
        {
            vars       = new ConditionVariables();
            operations = new Dictionary <string, string>();
            StringParser p = new StringParser(ud);

            return(vars.FromString(p, ConditionVariables.FromMode.OnePerLine, altops: operations));
        }
Beispiel #16
0
 public void PrepareToRun(ConditionVariables v, ConditionFileHandles fh, Dictionary <string, Forms.ConfigurableForm> d, bool chae = true)
 {
     currentvars       = v;
     currentfiles      = fh;
     closehandlesatend = chae;
     functions         = new ConditionFunctions(currentvars, currentfiles);   // point the functions at our variables and our files..
     dialogs           = d;
 }
Beispiel #17
0
 public void PrepareToRun(ConditionVariables v, ConditionPersistentData fh, Dictionary <string, ExtendedControls.ConfigurableForm> d, bool chae = true)
 {
     currentvars             = v;
     conditionpersistentdata = fh;
     closehandlesatend       = chae;
     functions = new ConditionFunctions(currentvars, conditionpersistentdata);           // point the functions at our variables and our files..
     dialogs   = d;
 }
        void Set(ConditionVariables cv)
        {
            SoundEffectSettings ap = new SoundEffectSettings(cv);

            // we have no control over values, user could have messed them up, and it excepts if out of range

            trackBarEM.Enabled = trackBarEF.Enabled = trackBarED.Enabled = checkBoxE.Checked = ap.echoenabled;
            try
            {
                trackBarEM.Value = ap.echomix;
                trackBarEF.Value = ap.echofeedback;
                trackBarED.Value = ap.echodelay;
            } catch { }

            trackBarCM.Enabled = trackBarCF.Enabled = trackBarCD.Enabled = trackBarCDp.Enabled = checkBoxC.Checked = ap.chorusenabled;
            try
            {
                trackBarCM.Value  = ap.chorusmix;
                trackBarCF.Value  = ap.chorusfeedback;
                trackBarCD.Value  = ap.chorusdelay;
                trackBarCDp.Value = ap.chorusdepth;
            } catch { }

            trackBarRM.Enabled = trackBarRT.Enabled = trackBarRH.Enabled = checkBoxR.Checked = ap.reverbenabled;
            try
            {
                trackBarRM.Value = ap.reverbmix;
                trackBarRT.Value = ap.reverbtime;
                trackBarRH.Value = ap.reverbhfratio;
            } catch { }

            trackBarDG.Enabled = trackBarDE.Enabled = trackBarDC.Enabled = trackBarDW.Enabled = checkBoxD.Checked = ap.distortionenabled;
            try
            {
                trackBarDG.Value = ap.distortiongain;
                trackBarDE.Value = ap.distortionedge;
                trackBarDC.Value = ap.distortioncentrefreq;
                trackBarDW.Value = ap.distortionfreqwidth;
            } catch { }

            trackBarGF.Enabled = checkBoxG.Checked = ap.gargleenabled;
            try
            {
                trackBarGF.Value = ap.garglefreq;
            }
            catch { }

            trackBarPitch.Enabled = checkBoxP.Checked = ap.pitchshiftenabled;
            try
            {
                trackBarPitch.Value = ap.pitchshift;
            }
            catch { }

            checkBoxCustomNone.Checked = ap.OverrideNone;

            EDDiscovery.EDDTheme.Instance.ApplyToForm(this, System.Drawing.SystemFonts.DefaultFont);
        }
Beispiel #19
0
 public void Clear(string f = "", string n = "")         // clear all data read from file
 {
     actioneventlist       = new ConditionLists();
     actionprogramlist     = new ActionProgramList();
     enabled               = true;
     installationvariables = new ConditionVariables();
     filepath              = f;
     name = n;
 }
 public ConditionEDDFunctions(ConditionFunctions c, ConditionVariables v, ConditionFileHandles h, int recd) : base(c, v, h, recd)
 {
     if (functions == null)        // one time init, done like this cause can't do it in {}
     {
         functions = new Dictionary <string, FuncEntry>();
         functions.Add("systempath", new FuncEntry(SystemPath, 1, 1, 0, 0)); // literal
         functions.Add("version", new FuncEntry(Version, 1, 1, 0));          // don't check first para
     }
 }
        public void Init(ConditionVariables cv, bool shownone)
        {
            if (!shownone)
            {
                checkBoxCustomNone.Visible = false;
            }

            Set(cv);
        }
        // true for write, for read its true if the same..

        static bool WriteOrCheckSHAFile(DownloadItem it, ConditionVariables vars, string appfolder, bool write)
        {
            try
            {
                List <string> filelist = new List <string>()
                {
                    it.localfilename
                };

                foreach (string key in vars.NameEnumuerable)  // these first, they are not the controller files
                {
                    if (key.StartsWith("OtherFile"))
                    {
                        string[] parts = vars[key].Split(';');
                        string   o     = Path.Combine(new string[] { appfolder, parts[1], parts[0] });
                        filelist.Add(o);
                    }
                }

                string shacurrent = GitHubClass.CalcSha1(filelist.ToArray());

                string shafile = Path.Combine(it.localpath, it.itemname + ".sha");

                if (write)
                {
                    using (StreamWriter sr = new StreamWriter(shafile))         // read directly from file..
                    {
                        sr.Write(shacurrent);
                    }

                    return(true);
                }
                else
                {
                    if (File.Exists(shafile))                               // if there is no SHA file, its local, prob under dev, so its false.  SHA is only written by install
                    {
                        using (StreamReader sr = new StreamReader(shafile)) // read directly from file..
                        {
                            string shastored = sr.ReadToEnd();
                            sr.Close();

                            if (shastored.Equals(shacurrent))
                            {
                                return(true);
                            }
                        }
                    }
                }
            }
            catch
            {
                System.Diagnostics.Debug.WriteLine("BUG BUG");
            }

            return(false);
        }
Beispiel #23
0
        public bool ExecuteAction(ActionProgramRun ap, BaseUtils.EnhancedSendKeysParser.IAdditionalKeyParser akp)       // additional parser
        {
            string             keys;
            ConditionVariables statementvars;

            if (FromString(userdata, out keys, out statementvars))
            {
                string             errlist = null;
                ConditionVariables vars    = ap.functions.ExpandVars(statementvars, out errlist);

                if (errlist == null)
                {
                    int    delay               = vars.Exists(DelayID) ? vars[DelayID].InvariantParseInt(DefaultDelay) : (ap.VarExist(globalvarDelay) ? ap[globalvarDelay].InvariantParseInt(DefaultDelay) : DefaultDelay);
                    int    updelay             = vars.Exists(UpDelayID) ? vars[UpDelayID].InvariantParseInt(DefaultDelay) : (ap.VarExist(globalvarUpDelay) ? ap[globalvarUpDelay].InvariantParseInt(DefaultDelay) : DefaultDelay);
                    int    shiftdelay          = vars.Exists(ShiftDelayID) ? vars[ShiftDelayID].InvariantParseInt(DefaultDelay) : (ap.VarExist(globalvarShiftDelay) ? ap[globalvarShiftDelay].InvariantParseInt(DefaultDelay) : DefaultDelay);
                    string process             = vars.Exists(ProcessID) ? vars[ProcessID] : (ap.VarExist(globalvarProcessID) ? ap[globalvarProcessID] : "");
                    string silentonerrors      = vars.Exists(SilentOnError) ? vars[SilentOnError] : (ap.VarExist(globalvarSilentOnErrors) ? ap[globalvarSilentOnErrors] : "0");
                    string announciateonerrors = vars.Exists(AnnounciateOnError) ? vars[AnnounciateOnError] : (ap.VarExist(globalvarAnnounciateOnError) ? ap[globalvarAnnounciateOnError] : "0");

                    string res = BaseUtils.EnhancedSendKeys.SendToProcess(keys, delay, shiftdelay, updelay, process, akp);

                    if (res.HasChars())
                    {
                        if (silentonerrors.Equals("2") || (errorsreported.Contains(res) && silentonerrors.Equals("1")))
                        {
                            System.Diagnostics.Debug.WriteLine("Swallow key error " + res);
                            ap.actioncontroller.TerminateAll();
                        }
                        else
                        {
                            errorsreported.Add(res);

                            if (announciateonerrors.Equals("1"))
                            {
                                string culture               = ap.VarExist(ActionSay.globalvarspeechculture) ? ap[ActionSay.globalvarspeechculture] : "Default";
                                System.IO.MemoryStream ms    = ap.actioncontroller.SpeechSynthesizer.Speak("Cannot press key due to " + res, culture, "Default", 0);
                                AudioQueue.AudioSample audio = ap.actioncontroller.AudioQueueSpeech.Generate(ms);
                                ap.actioncontroller.AudioQueueSpeech.Submit(audio, 80, AudioQueue.Priority.Normal);
                            }

                            ap.ReportError(res);
                        }
                    }
                }
                else
                {
                    ap.ReportError(errlist);
                }
            }
            else
            {
                ap.ReportError("Key command line not in correct format");
            }

            return(true);
        }
Beispiel #24
0
 public ConditionEDDFunctions(ConditionFunctions c, ConditionVariables v, ConditionPersistentData h, int recd) : base(c, v, h, recd)
 {
     if (functions == null)        // one time init, done like this cause can't do it in {}
     {
         functions = new Dictionary <string, FuncEntry>();
         functions.Add("systempath", new FuncEntry(SystemPath, 1, 1, NoMacros, NoStrings)); // literal
         functions.Add("version", new FuncEntry(Version, 1, 1, NoMacros, NoStrings));       // don't check first para
         functions.Add("star", new FuncEntry(Star, 2, 2, FirstMacro, AllStrings));          // var/string, literal/var/string
         functions.Add("ship", new FuncEntry(Ship, 1, 1, AllMacros, AllStrings));           //ship translator
     }
 }
 public string ToString(string progname, ConditionVariables cond, Dictionary <string, string> altops)
 {
     if (cond.Count > 0)
     {
         return(progname + "(" + cond.ToString(altops, bracket: true) + ")");
     }
     else
     {
         return(progname);
     }
 }
Beispiel #26
0
 private void Sfe_TestSettingEvent(SoundEffectsDialog sfe, ConditionVariables effects)
 {
     System.IO.MemoryStream ms = synth.Speak(textBoxBorderTest.Text, "Default", comboBoxCustomVoice.Text, trackBarRate.Value);
     if (ms != null)
     {
         AudioQueue.AudioSample a = queue.Generate(ms, effects);
         a.sampleOverEvent += SampleOver;
         a.sampleOverTag    = sfe;
         queue.Submit(a, trackBarVolume.Value, AudioQueue.Priority.High);
     }
 }
Beispiel #27
0
 static public string ToString(string keys, ConditionVariables cond)
 {
     if (cond.Count > 0)
     {
         return(keys.QuoteString(comma: true) + ", " + cond.ToString());
     }
     else
     {
         return(keys.QuoteString(comma: true));
     }
 }
Beispiel #28
0
        public void Init(Icon ic, ConditionVariables cv, bool shownone)
        {
            this.Icon = ic;

            if (!shownone)
            {
                checkBoxCustomNone.Visible = false;
            }

            Set(cv);
        }
Beispiel #29
0
 public string ToString(string saying, ConditionVariables cond)
 {
     if (cond.Count > 0)
     {
         return(saying.QuoteString(comma: true) + ", " + cond.ToString());
     }
     else
     {
         return(saying.QuoteString(comma: true));
     }
 }
Beispiel #30
0
        public override bool ExecuteAction(ActionProgramRun ap)
        {
            List <string> ctrl = FromString(UserData);

            if (ctrl != null)
            {
                List <string> exp;

                if (ap.functions.ExpandStrings(ctrl, out exp) != ConditionFunctions.ExpandResult.Failed)
                {
                    ConditionVariables cv = ap.variables.FilterVars(exp[3] + "*");

                    List <Forms.ConfigurableForm.Entry> entries = new List <Forms.ConfigurableForm.Entry>();

                    foreach (string k in cv.NameList)
                    {
                        Forms.ConfigurableForm.Entry entry;
                        string errmsg = Forms.ConfigurableForm.MakeEntry(cv[k], out entry);
                        if (errmsg != null)
                        {
                            return(ap.ReportError(errmsg + " in " + k + " variable for Dialog"));
                        }
                        entries.Add(entry);
                    }

                    StringParser sp2 = new StringParser(exp[2]);
                    int?         dw  = sp2.NextWordComma().InvariantParseIntNull();
                    int?         dh  = sp2.NextWord().InvariantParseIntNull();

                    if (dw != null && dh != null)
                    {
                        Forms.ConfigurableForm cd = new Forms.ConfigurableForm();
                        ap.dialogs[exp[0]] = cd;
                        cd.Trigger        += Cd_Trigger;
                        cd.Show(ap.actioncontroller.DiscoveryForm, exp[0], new System.Drawing.Size(dw.Value, dh.Value), exp[1], entries.ToArray(), ap);
                        return(false);       // STOP, wait input
                    }
                    else
                    {
                        ap.ReportError("Width/Height not specified in Dialog");
                    }
                }
                else
                {
                    ap.ReportError(exp[0]);
                }
            }
            else
            {
                ap.ReportError("Dialog command line not in correct format");
            }

            return(true);
        }