private void HandleScriptDialog(ScriptDialog dialog, UUID fromSceneID) { foreach (KeyValuePair <UUID, RwLockedDictionary <UUID, Func <ScriptDialog, IScriptEvent> > > kvp in m_ScriptedDialogListeners) { ObjectPart part; ObjectPartInventoryItem item; if (CurrentScene.Primitives.TryGetValue(kvp.Key, out part)) { foreach (KeyValuePair <UUID, Func <ScriptDialog, IScriptEvent> > kvpinner in kvp.Value) { if (part.Inventory.TryGetValue(kvpinner.Key, out item)) { ScriptInstance instance = item.ScriptInstance; /* Translate listen event to mapped channel */ IScriptEvent ev = kvpinner.Value(dialog); if (ev != null) { instance?.PostEvent(ev); } } } } else { m_ScriptedDialogListeners.Remove(kvp.Key); } } }
public override void PostEvent(IScriptEvent e) { if (IsRunning && IsRunningAllowed && !IsAborting) { m_Events.Enqueue(e); Part.ObjectGroup.Scene.ScriptThreadPool.PostScript(this); } }
public void RemoveResult(int eventid, int rank) { Championship championship = getCurrentChampionship(); IScriptEvent Event = championship.getEvent(eventid); Event.removeResult(rank); //!**! //saveChangesToDatabase(); }
public void AddResult(int eventid, int rank, string vest, string value) { Championship championship = getCurrentChampionship(); IScriptEvent Event = championship.getEvent(eventid); ResultValue rv = AEvent.MakeNewResultsValue((AEvent)Event); rv.setResultString(System.Web.HttpUtility.UrlDecode(value)); //!**! Event.AddResult(rank, VestNumber.MakeFromString(System.Web.HttpUtility.UrlDecode(vest)), rv); //saveChangesToDatabase(); }
/// <summary> /// Parse out a script file, as one giant string /// </summary> /// <param name="scriptString">The string to parse</param> public void ParseScript(string scriptString) { // Split lines string[] commands = scriptString.Split(new char[] { ';' }); for (int i = 0; i < commands.Length; i++) { IScriptEvent ev = ParseCommand(i, commands[i]); if (ev != null) { this.m_Events.Add(ev); } } }
public void PostEvent(IScriptEvent ev) { SceneInterface scene; ObjectPart part; ObjectPartInventoryItem item; ScriptInstance instance; if (m_Scenes.TryGetValue(m_SceneID, out scene) && scene.Primitives.TryGetValue(m_PartID, out part) && part.Inventory.TryGetValue(m_ItemID, out item)) { instance = item.ScriptInstance; if (null != instance) { instance.PostEvent(ev); } } }
public string[] OpenCert(int eventid, string type) { Championship championship = getCurrentChampionship(); IScriptEvent Event = championship.getEvent(eventid); List <string> tempFiles = new List <string>(); Stopwatch sw1 = new Stopwatch(); sw1.Start( ); foreach (string s in GenerateTempCertificates((AEvent)Event, type)) { tempFiles.Add(@"\exports\" + System.IO.Path.GetFileName(s)); } sw1.Stop( ); return(tempFiles.ToArray( )); }
public void PostEvent(IScriptEvent ev) { Type evType = ev.GetType(); if (evType == typeof(CollisionEvent)) { PostCollisionEvent((CollisionEvent)ev); } else if (evType == typeof(LandCollisionEvent)) { /* relay collision events to attachment root prims */ foreach (ObjectGroup attached in Attachments.All) { ObjectPart part; if (attached.TryGetRootPart(out part)) { part.PostEvent(ev); } } } }
public void SetValue(int eventid, int rank, string value) { Championship championship = getCurrentChampionship(); IScriptEvent Event = championship.getEvent(eventid); AResult result = ((AEvent)Event).getResult(rank); if (result == null) { return; } ResultValue rv = AEvent.MakeNewResultsValue((AEvent)Event); rv.setResultString(System.Web.HttpUtility.UrlDecode(value)); result.Value = rv; result.Save( ); //!**! //saveChangesToDatabase(); }
private MemoryStream FileNeededEvent(object sender, DynamicFileRequestedEventArgs e) { if (e.FilePath.StartsWith(@"/exports/")) { string exportPath = ((App)Application.Current).CurrentChampionship.getChampionshipHomeDir(); // @"F:\Championship Solutions\Events\WSAA XC 2015-16\Testing Results\PDFs"; if (File.Exists(exportPath + e.FullPath)) { return(FileToMemoryStream(exportPath + e.FullPath)); } else { return(null); } } else if (e.FilePath.StartsWith(@"/files/")) { //CSDB context = FileIO.FConnFile.getContext(); int fileID = 0; if (int.TryParse(e.FileName.Trim(".jpg".ToCharArray()), out fileID)) { FileStorage file = FileIO.FConnFile.GetFileDetails().IO.GetAll <FileStorage>().Where(f => f.ID == fileID).FirstOrDefault(); if (file == null) { return(null); } return(new MemoryStream(file.FileData)); } } else if (e.FilePath.StartsWith(@"/reports/")) { if (e.FileName.StartsWith("report_")) { string reportName = e.FileName.Remove(0, 7); reportName = reportName.Replace(".pdf", ""); switch (reportName.ToLower()) { case "eventcard": if (e.Arguments.AllKeys.Contains("eventid")) { IScriptEvent Event = Championship.Championship.getEvent(int.Parse(e.Arguments["eventid"])); if (Event == null) { return(null); } List <AEvent> evs = new List <AEvent>(); evs.Add((AEvent)Event); string fileNames = Exports.GenerateResultEntryForms(evs, false, false, true); if (fileNames != null) { return(FileToMemoryStream(fileNames)); } } break; case "announcers": if (e.Arguments.AllKeys.Contains("eventid")) { } break; case "athleteprofile": if (e.Arguments.AllKeys.Contains("athleteid")) { Athlete athlete = Championship.Championship.getAthlete((int.Parse(e.Arguments["athleteid"]))); if (athlete == null) { return(null); } List <Athlete> evs = new List <Athlete>(); evs.Add((Athlete)athlete); string fileNames = Exports.GenerateAthleteProfile(evs, false, PrintOptions.NO_PRINT, true); if (fileNames != null) { return(FileToMemoryStream(fileNames)); } } break; } } } #region Legacy Report Generation from WSAA XC 2016 //else //{ //if (e.FileName.StartsWith("report_")) //{ // string reportName = e.FileName.Remove(0, 7); // reportName = reportName.TrimEnd((".pdf").ToCharArray()); // AReport rep; // switch (reportName) // { // case "vest": // rep = ReportLibrary["XCVestNumber"]; // if (e.Arguments.ContainsKey("vest")) // { // string tempFile = new Print().generateSingleVestNumberPDF( // MainWindow.CurrentChampionship.getCompetitor(e.Arguments["vest"]).FirstOrDefault() // , ""); // if (tempFile == null) return null; // using (FileStream file = new FileStream(tempFile, FileMode.Open, System.IO.FileAccess.Read)) // { // MemoryStream ms = new MemoryStream(); // file.CopyTo(ms); // return new MemoryStream(ms.ToArray()); // } // //File.Delete(tempFile); // } // break; // case "results": // if (e.Arguments.ContainsKey("eventid")) // { // IScriptEvent Event = MainWindow.CurrentChampionship.getEvent(int.Parse(e.Arguments["eventid"])); // if (Event == null) return null; // List<AEvent> evs = new List<AEvent>(); // evs.Add((AEvent)Event); // string[] fileNames = new Print().printResults(evs, false); // if (fileNames.Length == 1) // return FileToMemoryStream(fileNames[0]); // } // break; // case "teamresults": // if (e.Arguments.ContainsKey("eventid")) // { // IScriptEvent Event = MainWindow.CurrentChampionship.getEvent(int.Parse(e.Arguments["eventid"])); // if (Event == null) return null; // List<AEvent> evs = new List<AEvent>(); // evs.Add((AEvent)Event); // string[] fileNames = new Print().printTeamResults(evs, false); // if (fileNames.Length == 1) // return FileToMemoryStream(fileNames[0]); // } // break; // default: // return null; // } // end switch //} // end if report //} #endregion return(null); }
public abstract void PostEvent(IScriptEvent e);
public void PostEvent(IScriptEvent ev) { /* intentionally left empty */ }
public abstract void ProcessEvent(IScriptEvent ev);