示例#1
0
        public bool EditPack(string name)            // edit pack name
        {
            ActionPackEditPack frm = new ActionPackEditPack();

            frm.AdditionalNames      += Frm_onAdditionalNames;
            frm.CreateActionPackEdit += SetPackEditorAndCondition;
            ActionFile f = actionfiles.Get(name);

            if (f != null)
            {
                string collapsestate = SQLiteConnectionUser.GetSettingString("ActionEditorCollapseState_" + name, "");  // get any collapsed state info for this pack

                frm.Init("Edit pack " + name, this.Icon, this, EDDOptions.Instance.ActionsAppDirectory(), f, ActionEventEDList.EventList(), collapsestate);

                frm.ShowDialog(discoveryform);                                                                    // don't care about the result, the form does all the saving

                SQLiteConnectionUser.PutSettingString("ActionEditorCollapseState_" + name, frm.CollapsedState()); // get any collapsed state info for this pack

                ActionConfigureKeys();                                                                            // kick it to load in case its changed
                VoiceLoadEvents();

                lasteditedpack = name;
                SQLiteConnectionUser.PutSettingString("ActionPackLastFile", lasteditedpack);
                return(true);
            }
            else
            {
                return(false);
            }
        }
示例#2
0
        public void CreateSet(string s)
        {
            string     appfolder = Path.Combine(Tools.GetAppDataDirectory(), "Actions");
            ActionFile af        = new ActionFile(new ConditionLists(), new ActionProgramList(), appfolder + "\\\\" + s + ".act", s, true);

            actionfiles.Add(af);
        }
示例#3
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;
        }
示例#4
0
        private bool EditActionFile(string name)            // edit pack name
        {
            List <string> jevents = JournalEntry.GetListOfEventsWithOptMethod(towords: false);

            jevents.Sort();
            List <ActionEvent> eventlist = ActionEventEDList.EventsFromNames(jevents, "Journal");

            eventlist.AddRange(ActionEventEDList.events); // our ED events
            eventlist.AddRange(ActionEvent.events);       // core events

            ActionPackEditorForm frm = new ActionPackEditorForm();

            frm.AdditionalNames      += Frm_onAdditionalNames;
            frm.CreateActionPackEdit += SetPackEditorAndCondition;
            ActionFile f = actionfiles.Get(name);

            if (f != null)
            {
                frm.Init("Edit pack " + name, this.Icon, this, AppFolder, f, eventlist);
                frm.TopMost = discoveryform.FindForm().TopMost;

                frm.ShowDialog(discoveryform.FindForm()); // don't care about the result, the form does all the saving

                ActionConfigureKeys();

                lasteditedpack = name;
                SQLiteConnectionUser.PutSettingString("ActionPackLastFile", lasteditedpack);
                return(true);
            }
            else
            {
                return(false);
            }
        }
示例#5
0
        private bool EditActionFile(string name)
        {
            List <string> jevents = EDDiscovery.EliteDangerous.JournalEntry.GetListOfEventsWithOptMethod(towords: false);

            jevents.Sort();

            List <Tuple <string, string> > eventnames = new List <Tuple <string, string> >();

            foreach (string s in jevents)
            {
                eventnames.Add(new Tuple <string, string>(s, "Journal"));
            }

            eventnames.Add(new Tuple <string, string>("All", "Misc"));
            eventnames.Add(new Tuple <string, string>("onRefreshStart", "Program"));
            eventnames.Add(new Tuple <string, string>("onRefreshEnd", "Program"));
            eventnames.Add(new Tuple <string, string>("onInstall", "Program"));
            eventnames.Add(new Tuple <string, string>("onStartup", "Program"));
            eventnames.Add(new Tuple <string, string>("onPostStartup", "Program"));
            eventnames.Add(new Tuple <string, string>("onShutdown", "Program"));
            eventnames.Add(new Tuple <string, string>("onKeyPress", "UI"));
            eventnames.Add(new Tuple <string, string>("onTimer", "Action"));
            eventnames.Add(new Tuple <string, string>("onPopUp", "UI"));
            eventnames.Add(new Tuple <string, string>("onPopDown", "UI"));
            eventnames.Add(new Tuple <string, string>("onTabChange", "UI"));
            eventnames.Add(new Tuple <string, string>("onPanelChange", "UI"));
            eventnames.Add(new Tuple <string, string>("onHistorySelection", "UI"));
            eventnames.Add(new Tuple <string, string>("onSayStarted", "Audio"));
            eventnames.Add(new Tuple <string, string>("onSayFinished", "Audio"));
            eventnames.Add(new Tuple <string, string>("onPlayStarted", "Audio"));
            eventnames.Add(new Tuple <string, string>("onPlayFinished", "Audio"));
            eventnames.Add(new Tuple <string, string>("onMenuItem", "UI"));
            eventnames.Add(new Tuple <string, string>("onEliteInputRaw", "EliteUI"));
            eventnames.Add(new Tuple <string, string>("onEliteInput", "EliteUI"));
            eventnames.Add(new Tuple <string, string>("onEliteInputOff", "EliteUI"));

            ActionPackEditorForm frm = new ActionPackEditorForm();

            frm.onAdditionalNames += Frm_onAdditionalNames;
            ActionFile f = actionfiles.Get(name);

            if (f != null)
            {
                frm.Init("Edit pack " + name, this, AppFolder, f, eventnames);
                frm.TopMost = discoveryform.FindForm().TopMost;

                frm.ShowDialog(discoveryform.FindForm()); // don't care about the result, the form does all the saving

                ActionConfigureKeys();

                lasteditedpack = name;
                SQLiteConnectionUser.PutSettingString("ActionPackLastFile", lasteditedpack);
                return(true);
            }
            else
            {
                return(false);
            }
        }
示例#6
0
        public Tuple <ActionFile, ActionProgram> FindProgram(string req, ActionFile preferred = null)        // find a program
        {
            Actions.ActionProgram ap = null;

            string file = null, prog;
            int    colon = req.IndexOf("::");

            if (colon != -1)
            {
                file = req.Substring(0, colon);
                prog = req.Substring(colon + 2);
            }
            else
            {
                prog = req;
            }

            if (file != null)                             // if file given, only search that
            {
                ActionFile f = actionfiles.Find(x => x.name.Equals(file));

                if (f != null)      // found file..
                {
                    ap = f.actionprogramlist.Get(prog);

                    return((ap != null) ? new Tuple <ActionFile, ActionProgram>(f, ap) : null);
                }
            }
            else
            {
                if (preferred != null)                          // if no file stated, and we have a preferred
                {
                    ap = preferred.actionprogramlist.Get(prog); // get in local program list first

                    if (ap != null)
                    {
                        return(new Tuple <ActionFile, ActionProgram>(preferred, ap));
                    }
                }

                foreach (ActionFile f in actionfiles)
                {
                    ap = f.actionprogramlist.Get(prog);

                    if (ap != null)         // gotcha
                    {
                        return(new Tuple <ActionFile, ActionProgram>(f, ap));
                    }
                }
            }

            return(null);
        }
示例#7
0
        public static string ReadFile(string filename, out ActionFile af)
        {
            af = null;
            string errlist = "";

            using (StreamReader sr = new StreamReader(filename))         // read directly from file..
            {
                string json = sr.ReadToEnd();
                sr.Close();

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

                    JObject jcond = (JObject)jo["Conditions"];
                    JObject jprog = (JObject)jo["Programs"];
                    bool    en    = (bool)jo["Enabled"];

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

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

                    ConditionLists    cond = new ConditionLists();
                    ActionProgramList prog = new ActionProgramList();

                    if (cond.FromJSON(jcond))
                    {
                        errlist = prog.FromJSONObject(jprog);

                        if (errlist.Length == 0)
                        {
                            af = new ActionFile(cond, prog, filename, Path.GetFileNameWithoutExtension(filename), en, ivars);
                        }
                    }
                    else
                    {
                        errlist = "Bad JSON in conditions";
                    }
                }
                catch (Exception ex)
                {
                    System.Diagnostics.Debug.WriteLine("Dump:" + ex.StackTrace);
                    errlist = "Bad JSON in File";
                }

                return(errlist);
            }
        }
示例#8
0
        public Tuple <ActionFile, ActionProgram> FindProgram(string packname, string progname)
        {
            ActionFile f = actionfiles.Find(x => x.name.Equals(packname));

            if (f != null)
            {
                ActionProgram ap = f.actionprogramlist.Get(progname);   // get in local program list first

                if (ap != null)
                {
                    return(new Tuple <ActionFile, ActionProgram>(f, ap));
                }
            }

            return(null);
        }
示例#9
0
        public bool EditPack(string name)            // edit pack name
        {
            List <string> jevents = JournalEntry.GetListOfEventsWithOptMethod(towords: false);

            jevents.Sort();
            List <ActionEvent> eventlist = ActionEventEDList.EventsFromNames(jevents, "Journal");

            List <string> uievents = Enum.GetNames(typeof(UITypeEnum)).ToList();

            uievents.Sort();
            eventlist.AddRange(ActionEventEDList.EventsFromNames(uievents, "UIEvents"));

            eventlist.AddRange(ActionEventEDList.events); // our ED events
            eventlist.AddRange(ActionEvent.events);       // core events

            ActionPackEditorForm frm = new ActionPackEditorForm();

            frm.AdditionalNames      += Frm_onAdditionalNames;
            frm.CreateActionPackEdit += SetPackEditorAndCondition;
            ActionFile f = actionfiles.Get(name);

            if (f != null)
            {
                string collapsestate = SQLiteConnectionUser.GetSettingString("ActionEditorCollapseState_" + name, "");  // get any collapsed state info for this pack

                frm.Init("Edit pack " + name, this.Icon, this, AppFolder, f, eventlist, collapsestate);

                frm.ShowDialog(discoveryform);                                                                    // don't care about the result, the form does all the saving

                SQLiteConnectionUser.PutSettingString("ActionEditorCollapseState_" + name, frm.CollapsedState()); // get any collapsed state info for this pack

                ActionConfigureKeys();                                                                            // kick it to load in case its changed
                VoiceLoadEvents();

                lasteditedpack = name;
                SQLiteConnectionUser.PutSettingString("ActionPackLastFile", lasteditedpack);
                return(true);
            }
            else
            {
                return(false);
            }
        }
示例#10
0
        // now = true, run it immediately, else run at end of queue.  Optionally pass in handles and dialogs in case its a sub prog

        public void Run(bool now, ActionFile fileset, ActionProgram r, ConditionVariables inputparas,
                        ConditionFileHandles fh = null, Dictionary <string, Forms.ConfigurableForm> d = null, bool closeatend = true)
        {
            if (now)
            {
                if (progcurrent != null)                    // if running, push the current one back onto the queue to be picked up
                {
                    progqueue.Insert(0, progcurrent);
                }

                progcurrent = new ActionProgramRun(fileset, r, inputparas, this, actioncontroller);   // now we run this.. no need to push to stack

                progcurrent.PrepareToRun(new ConditionVariables(progcurrent.inputvariables, actioncontroller.Globals),
                                         fh == null ? new ConditionFileHandles() : fh, d == null ? new Dictionary <string, Forms.ConfigurableForm>() : d, closeatend);              // if no filehandles, make them and close at end
            }
            else
            {
                progqueue.Add(new ActionProgramRun(fileset, r, inputparas, this, actioncontroller));
            }
        }
示例#11
0
        public string LoadFile(string filename)
        {
            ActionFile af;
            string     err = ActionFile.ReadFile(filename, out af);

            if (err.Length == 0)
            {
                int indexof = actionfiles.FindIndex(x => x.name.Equals(af.name));

                if (indexof != -1)
                {
                    actionfiles[indexof] = af;
                }
                else
                {
                    actionfiles.Add(af);
                }
            }

            return(err);
        }
示例#12
0
        public string LoadAllActionFiles()
        {
            string appfolder = Path.Combine(Tools.GetAppDataDirectory(), "Actions");

            if (!Directory.Exists(appfolder))
            {
                Directory.CreateDirectory(appfolder);
            }

            FileInfo[] allFiles = Directory.EnumerateFiles(appfolder, "*.act", SearchOption.AllDirectories).Select(f => new FileInfo(f)).OrderBy(p => p.LastWriteTime).ToArray();

            string errlist = "";

            foreach (FileInfo f in allFiles)
            {
                ActionFile af;
                string     err = ActionFile.ReadFile(f.FullName, out af);
                if (err.Length == 0)
                {
                    actionfiles.Add(af);
                }
                else
                {
                    errlist += "File " + f.FullName + " failed to load: " + Environment.NewLine + err;
                }
            }

            if (actionfiles.Count == 0)           // need a default
            {
                CreateSet("Default");
            }

            current = actionfiles.Count - 1;        // always the latest.

            return(errlist);
        }
示例#13
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) != Functions.ExpandResult.Failed)
                {
                    string cmdname    = exp[0].ToLowerInvariant();
                    string nextword   = exp.Count >= 2 ? exp[1] : null;
                    string thirdword  = exp.Count >= 3 ? exp[2] : null;
                    string fourthword = exp.Count >= 4 ? exp[3] : null;
                    string fifthword  = exp.Count >= 5 ? exp[4] : null;

                    if (cmdname == null)
                    {
                        ap.ReportError("Missing command in Perform");
                    }
                    else if (cmdname.Equals("3dmap"))
                    {
                        (ap.ActionController as ActionController).DiscoveryForm.Open3DMap(null);
                    }
                    else if (cmdname.Equals("2dmap"))
                    {
                        (ap.ActionController as ActionController).DiscoveryForm.PopOuts.PopOut(PanelInformation.PanelIDs.Map2D);
                    }
                    else if (cmdname.Equals("edsm"))
                    {
                        ActionController ac = (ap.ActionController as ActionController);

                        EliteDangerousCore.EDSM.EDSMClass edsm = new EliteDangerousCore.EDSM.EDSMClass();

                        if (edsm.ValidCredentials)
                        {
                            ac.DiscoveryForm.EDSMSend();
                        }
                        else
                        {
                            ap.ReportError("No valid EDSM Credentials");
                        }
                    }
                    else if (cmdname.Equals("refresh"))
                    {
                        (ap.ActionController as ActionController).DiscoveryForm.RefreshHistoryAsync();
                    }
                    else if (cmdname.Equals("url"))
                    {
                        if (nextword != null && nextword.StartsWith("http:", StringComparison.InvariantCultureIgnoreCase) || nextword.StartsWith("https:", StringComparison.InvariantCultureIgnoreCase))        // security..
                        {
                            System.Diagnostics.Process.Start(nextword);
                        }
                        else
                        {
                            ap.ReportError("Perform url must start with http");
                        }
                    }
                    else if (cmdname.Equals("configurevoice"))
                    {
                        (ap.ActionController as ActionController).ConfigureVoice(nextword ?? "Configure Voice Synthesis");
                    }
                    else if (cmdname.Equals("manageaddons"))
                    {
                        (ap.ActionController as ActionController).ManageAddOns();
                    }
                    else if (cmdname.Equals("editaddons"))
                    {
                        (ap.ActionController as ActionController).EditAddOns();
                    }
                    else if (cmdname.Equals("editlastpack"))
                    {
                        (ap.ActionController as ActionController).EditLastPack();
                    }
                    else if (cmdname.Equals("editpack"))
                    {
                        if (nextword != null)
                        {
                            if (!(ap.ActionController as ActionController).EditPack(nextword))
                            {
                                ap.ReportError("Pack " + nextword + " not found");
                            }
                        }
                        else
                        {
                            ap.ReportError("EditPack requires a pack name");
                        }
                    }
                    else if (cmdname.Equals("editspeechtext"))
                    {
                        (ap.ActionController as ActionController).EditSpeechText();
                    }
                    else if (cmdname.Equals("configurewave"))
                    {
                        (ap.ActionController as ActionController).ConfigureWave(nextword ?? "Configure Wave Output");
                    }
                    else if (cmdname.Equals("enableeliteinput"))
                    {
                        (ap.ActionController as ActionController).EliteInput(true, true);
                    }
                    else if (cmdname.Equals("enableeliteinputnoaxis"))
                    {
                        (ap.ActionController as ActionController).EliteInput(true, false);
                    }
                    else if (cmdname.Equals("disableeliteinput"))
                    {
                        (ap.ActionController as ActionController).EliteInput(false, false);
                    }
                    else if (cmdname.Equals("enablevoicerecognition"))
                    {
                        if (nextword != null)
                        {
                            ap["VoiceRecognitionEnabled"] = ((ap.ActionController as ActionController).VoiceReconOn(nextword)).ToStringIntValue();
                        }
                        else
                        {
                            ap.ReportError("EnableVoiceRecognition requires a culture");
                        }
                    }
                    else if (cmdname.Equals("disablevoicerecognition"))
                    {
                        (ap.ActionController as ActionController).VoiceReconOff();
                    }
                    else if (cmdname.Equals("beginvoicerecognition"))
                    {
                        (ap.ActionController as ActionController).VoiceLoadEvents();
                    }
                    else if (cmdname.Equals("voicerecognitionconfidencelevel"))
                    {
                        float?conf = nextword.InvariantParseFloatNull();
                        if (conf != null)
                        {
                            (ap.ActionController as ActionController).VoiceReconConfidence(conf.Value);
                        }
                        else
                        {
                            ap.ReportError("VoiceRecognitionConfidencelLevel requires a confidence value");
                        }
                    }
                    else if (cmdname.Equals("voicerecognitionparameters"))
                    {
                        int?babble              = nextword.InvariantParseIntNull();   // babble at end
                        int?initialsilence      = thirdword.InvariantParseIntNull();  // silence at end
                        int?endsilence          = fourthword.InvariantParseIntNull(); // unambigious timeout
                        int?endsilenceambigious = fifthword.InvariantParseIntNull();  // ambiguous timeout

                        if (babble != null && initialsilence != null && endsilence != null && endsilenceambigious != null)
                        {
                            (ap.ActionController as ActionController).VoiceReconParameters(babble.Value, initialsilence.Value, endsilence.Value, endsilenceambigious.Value);
                        }
                        else
                        {
                            ap.ReportError("VoiceRecognitionParameters requires four values");
                        }
                    }
                    else if (cmdname.Equals("voicerecognitionphrases"))
                    {
                        ap["Phrases"] = (ap.ActionController as ActionController).VoicePhrases(Environment.NewLine);
                    }
                    else if (cmdname.Equals("listeliteinput"))
                    {
                        ap["EliteInput"]      = (ap.ActionController as ActionController).EliteInputList();
                        ap["EliteInputCheck"] = (ap.ActionController as ActionController).EliteInputCheck();
                    }
                    else if (cmdname.Equals("voicenames"))
                    {
                        ap["VoiceNames"] = (ap.ActionController as ActionController).SpeechSynthesizer.GetVoiceNames().QuoteStrings();
                    }
                    else if (cmdname.Equals("bindings"))
                    {
                        ap["Bindings"] = (ap.ActionController as ActionController).FrontierBindings.ListBindings();
                    }
                    else if (cmdname.Equals("bindingvalues"))
                    {
                        ap["BindingValues"] = (ap.ActionController as ActionController).FrontierBindings.ListValues();
                    }
                    else if (cmdname.Equals("actionfile"))
                    {
                        ActionFile f = (ap.ActionController as ActionController).Get(nextword);
                        if (f != null)
                        {
                            int i = 0;
                            foreach (var x in f.EventList.Enumerable)
                            {
                                ap["Events[" + i++ + "]"]   = x.ToString(true); // list hooked events
                                ap["Events_" + x.eventname] = x.ToString(true); // list hooked events
                            }

                            i = 0;
                            foreach (string jname in Enum.GetNames(typeof(EliteDangerousCore.JournalTypeEnum)))
                            {
                                List <Condition> cl = f.EventList.GetConditionListByEventName(jname);

                                if (cl != null)
                                {
                                    int v = 0;
                                    foreach (var c in cl)
                                    {
                                        ap["JEvents[" + i++ + "]"] = c.ToString(true);
                                        ap["JEvents_" + c.eventname + "_" + v++] = c.ToString(true);
                                    }
                                }
                                else
                                {
                                    ap["JEvents[" + i++ + "]"] = jname + ", None";
                                    ap["JEvents_" + jname]     = "None";
                                }
                            }

                            i = 0;
                            foreach (string iname in Enum.GetNames(typeof(EliteDangerousCore.UITypeEnum)))
                            {
                                List <Condition> cl = f.EventList.GetConditionListByEventName("UI" + iname);

                                if (cl != null)
                                {
                                    int v = 0;
                                    foreach (var c in cl)
                                    {
                                        ap["UIEvents[" + i++ + "]"] = c.ToString(true);
                                        ap["UIEvents_" + c.eventname + "_" + v++] = c.ToString(true);
                                    }
                                }
                                else
                                {
                                    ap["UIEvents[" + i++ + "]"] = iname + ", None";
                                    ap["UIEvents_" + iname]     = "None";
                                }
                            }

                            i = 0;
                            foreach (var x in f.InstallationVariables.NameEnumuerable)
                            {
                                ap["Install[" + i++ + "]"] = x + "," + f.InstallationVariables[x];   // list hooked events
                            }
                            i = 0;
                            foreach (var x in f.FileVariables.NameEnumuerable)
                            {
                                ap["FileVar[" + i++ + "]"] = x + "," + f.FileVariables[x];   // list hooked events
                            }
                            ap["Enabled"] = f.Enabled.ToStringIntValue();
                        }
                        else
                        {
                            ap.ReportError("Action file " + nextword + " is not loaded");
                        }
                    }
                    else if (cmdname.Equals("datadownload"))
                    {
                        string gitfolder    = nextword;
                        string filewildcard = thirdword;
                        string directory    = fourthword;
                        string optclean     = fifthword;

                        if (gitfolder != null && filewildcard != null && directory != null)
                        {
                            if (System.IO.Directory.Exists(directory))
                            {
                                BaseUtils.GitHubClass ghc = new BaseUtils.GitHubClass(EDDiscovery.Properties.Resources.URLGithubDataDownload);
                                bool worked = ghc.Download(directory, gitfolder, filewildcard, optclean != null && optclean == "1");
                                ap["Downloaded"] = worked.ToStringIntValue();
                            }
                            else
                            {
                                ap.ReportError("Download folder " + directory + " does not exist");
                            }
                        }
                        else
                        {
                            ap.ReportError("Missing parameters in Perform Datadownload");
                        }
                    }
                    else if (cmdname.Equals("generateevent"))
                    {
                        if (nextword != null)
                        {
                            ActionEvent f = ActionEventEDList.EventList(excludejournal: true).Find(x => x.TriggerName.Equals(nextword));

                            if (f != null)
                            {
                                BaseUtils.Variables c = new BaseUtils.Variables();

                                for (int w = 2; w < exp.Count; w++)
                                {
                                    string vname    = exp[w];
                                    int    asterisk = vname.IndexOf('*');

                                    if (asterisk >= 0)      // pass in name* no complaining if not there
                                    {
                                        string prefix = vname.Substring(0, asterisk);

                                        foreach (string jkey in ap.variables.NameEnumuerable)
                                        {
                                            if (jkey.StartsWith(prefix))
                                            {
                                                c[jkey] = ap.variables[jkey];
                                            }
                                        }
                                    }
                                    else
                                    {
                                        if (ap.variables.Exists(vname))     // pass in explicit name
                                        {
                                            c[vname] = ap.variables[vname];
                                        }
                                        else
                                        {
                                            ap.ReportError("No such variable '" + vname + "'");
                                            return(true);
                                        }
                                    }
                                }

                                if (f.TriggerName.StartsWith("UI") || f.TriggerName.Equals("onEliteUIEvent"))
                                {
                                    c["EventClass_EventTimeUTC"] = DateTime.UtcNow.ToStringUS();
                                    c["EventClass_EventTypeID"]  = c["EventClass_EventTypeStr"] = f.TriggerName.Substring(2);
                                    c["EventClass_UIDisplayed"]  = "0";
                                    (ap.ActionController as ActionController).ActionRun(Actions.ActionEventEDList.onUIEvent, c);
                                }

                                (ap.ActionController as ActionController).ActionRun(f, c, now: true);
                            }
                            else
                            {
                                try
                                {
                                    EliteDangerousCore.JournalEntry je = EliteDangerousCore.JournalEntry.CreateJournalEntry(nextword);

                                    ap["GenerateEventName"] = je.EventTypeStr;

                                    if (je is EliteDangerousCore.JournalEvents.JournalUnknown)
                                    {
                                        ap.ReportError("Unknown journal event");
                                    }
                                    else
                                    {
                                        EliteDangerousCore.HistoryEntry he = EliteDangerousCore.HistoryEntry.FromJournalEntry(je, null);
                                        (ap.ActionController as ActionController).ActionRunOnEntry(he, Actions.ActionEventEDList.NewEntry(he), now: true);
                                    }
                                }
                                catch
                                {
                                    ap.ReportError("Journal event not in correct JSON form");
                                }
                            }
                        }
                        else
                        {
                            ap.ReportError("No journal event or event name after GenerateEvent");
                        }
                    }
                    else
                    {
                        ap.ReportError("Unknown command " + cmdname + " in Performaction");
                    }
                }
                else
                {
                    ap.ReportError(exp[0]);
                }
            }
            else
            {
                ap.ReportError("Perform command line not in correct format");
            }

            return(true);
        }
示例#14
0
        private bool Dmf_checkActionLoaded(string name)
        {
            ActionFile f = actionfiles.Get(name);

            return(f != null);
        }