/// <summary> /// 扩展卡11-获取编码开关状态 /// </summary> /// <returns>控制命令</returns> public static string ControlCmd_StateCodingswitchExtern(EngineData Data) { ushort boardIP = Data.boardIP; //扩展卡编号 string SendData = string.Format(CMDTop[(int)CMDTopNum.ngetds] + " {0}", boardIP); return(SendData); }
public JsonResult ListaLenguaje(int index = 0) { Idiomas idiomas = new Idiomas(); idiomas = EngineData.Idiomas(index); return(Json(idiomas)); }
/// <summary> /// 扩展卡12-心跳测试 /// </summary> /// <returns>控制命令</returns> public static string ControlCmd_HeartExtern(EngineData Data) { ushort boardIP = Data.boardIP; //扩展卡编号 string SendData = string.Format(CMDTop[(int)CMDTopNum.nH]); return(SendData); }
public JsonResult NotificacionPrueba(string email) { Respuesta R = new Respuesta(); string emailCode64 = Funcion.ConvertirBase64(email); bool resultado = Funcion.EmailEsValido(email); if (!resultado) { R = Funcion.RespuestaProceso(null, null, EngineData.EmailNoValido(), email); return(Json(R)); } resultado = Metodo.InsertarClienteTest(Funcion, email); string enlaze = Funcion.CrearEnlazePrueba(Metodo, email); EstructuraMail model = new EstructuraMail(); model = Funcion.SetEstructuraMailTest(enlaze, email, model); if (!resultado) { R = Funcion.RespuestaProceso(null, email, null, "Error Registrando"); return(Json(R)); } resultado = Notificacion.EnviarMailNotificacion(model); if (resultado) { R = Funcion.RespuestaProceso(null, email, null, "Exito"); } else { R = Funcion.RespuestaProceso(null, email, null, "Error Enviando"); } return(Json(R)); }
public void GivenViewModelWithNrOfEnginesAndThrustPerEngineNotZero_WhenSettingThrustPerEngineNaN_ThenEventsFired() { // Given const int nrOfEngines = 4; var random = new Random(21); double thrustPerEngine = random.NextDouble(); var engineData = new EngineData { NrOfEngines = nrOfEngines, ThrustPerEngine = thrustPerEngine }; var viewModel = new EngineSettingsTabViewModel(engineData); var eventArgsCollection = new List <PropertyChangedEventArgs>(); viewModel.PropertyChanged += (o, e) => { eventArgsCollection.Add(e); }; // When viewModel.ThrustPerEngine = double.NaN; double totalThrust = viewModel.TotalThrust; // Then Assert.That(totalThrust, Is.NaN); CollectionAssert.AreEquivalent(new[] { "ThrustPerEngine", "TotalThrust" }, eventArgsCollection.Select(e => e.PropertyName)); }
public void NrOfFailedEngines_SettingNewValue_RaisesOnPropertyChangedEventAndSetsEngineDat() { // Setup var engineData = new EngineData(); var viewModel = new EngineSettingsTabViewModel(engineData); bool propertyChangedTriggered = false; PropertyChangedEventArgs eventArgs = null; viewModel.PropertyChanged += (o, e) => { propertyChangedTriggered = true; eventArgs = e; }; var random = new Random(21); int newValue = random.Next(); // Call viewModel.NrOfFailedEngines = newValue; // Assert Assert.That(engineData.NrOfFailedEngines, Is.EqualTo(newValue)); Assert.That(propertyChangedTriggered, Is.True); Assert.That(eventArgs.PropertyName, Is.EqualTo(nameof(EngineSettingsTabViewModel.NrOfFailedEngines))); }
/// <summary> /// This method is used to construct the file output response message /// </summary> /// <param name="json"></param> /// <param name="fileName"></param> /// <returns></returns> private string GenerateFileOutput(JObject json, string fileName) { JObject scanDetails = json["scan_results"]["scan_details"].Value <JObject>(); List <string> keys = scanDetails.Properties().Select(p => p.Name).ToList(); FileOutputData fileOutput = new FileOutputData { FileName = fileName, OverallStatus = json["scan_results"]["scan_all_result_a"].ToString(), EngineData = new List <EngineData>() }; foreach (string key in keys) { EngineData engineData = new EngineData { EngineName = key, ThreatFound = scanDetails[key]["threat_found"].ToString(), ScanTime = scanDetails[key]["scan_time"].ToString(), ScanResult_i = scanDetails[key]["scan_result_i"].ToString(), DefTime = scanDetails[key]["def_time"].ToString() }; fileOutput.EngineData.Add(engineData); } return(fileOutput.ToString()); }
override protected void triggerInternal(GameStateData previousGameState, GameStateData currentGameState) { if (engineData == null) { clearState(); } if (maxSafeWaterTemp == 0) { maxSafeWaterTemp = currentGameState.carClass.maxSafeWaterTemp; } if (maxSafeOilTemp == 0) { maxSafeOilTemp = currentGameState.carClass.maxSafeOilTemp; } if (currentGameState.SessionData.SessionRunningTime > 60 * currentGameState.EngineData.MinutesIntoSessionBeforeMonitoring) { engineData.addSample(currentGameState.EngineData.EngineOilTemp, currentGameState.EngineData.EngineWaterTemp, currentGameState.EngineData.EngineOilPressure); if (currentGameState.SessionData.SessionRunningTime > gameTimeAtLastStatusCheck + statusMonitorWindowLength) { EngineStatus currentEngineStatus = engineData.getEngineStatusFromAverage(maxSafeWaterTemp, maxSafeOilTemp); if (currentEngineStatus != lastStatusMessage) { switch (currentEngineStatus) { case EngineStatus.ALL_CLEAR: lastStatusMessage = currentEngineStatus; audioPlayer.playMessage(new QueuedMessage(folderAllClear, 0, this)); break; case EngineStatus.HOT_OIL: // don't play this if the last message was about hot oil *and* water - wait for 'all clear' if (lastStatusMessage != EngineStatus.HOT_OIL_AND_WATER) { lastStatusMessage = currentEngineStatus; audioPlayer.playMessage(new QueuedMessage(folderHotOil, 0, this)); } break; case EngineStatus.HOT_WATER: // don't play this if the last message was about hot oil *and* water - wait for 'all clear' if (lastStatusMessage != EngineStatus.HOT_OIL_AND_WATER) { lastStatusMessage = currentEngineStatus; audioPlayer.playMessage(new QueuedMessage(folderHotWater, 0, this)); } break; case EngineStatus.HOT_OIL_AND_WATER: lastStatusMessage = currentEngineStatus; audioPlayer.playMessage(new QueuedMessage(folderHotOilAndWater, 0, this)); break; } } gameTimeAtLastStatusCheck = currentGameState.SessionData.SessionRunningTime; engineData = new EngineData(); } } }
public void Create_WithArguments_ReturnsExpectedAircraftData() { // Setup var random = new Random(21); var aircraftData = new AircraftData { WingSurfaceArea = random.NextDouble(), AspectRatio = random.NextDouble(), OswaldFactor = random.NextDouble(), MaximumLiftCoefficient = random.NextDouble(), LiftCoefficientGradient = random.NextDouble(), ZeroLiftAngleOfAttack = random.NextAngle(), RestDragCoefficient = random.NextDouble(), RestDragCoefficientWithEngineFailure = random.NextDouble(), MaximumPitchAngle = random.NextAngle(), PitchGradient = random.NextAngle(), RollResistanceCoefficient = random.NextDouble(), RollResistanceWithBrakesCoefficient = random.NextDouble(), TakeOffWeight = random.NextDouble() }; var engineData = new EngineData { NrOfEngines = random.Next(), ThrustPerEngine = random.NextDouble() }; // Call KernelAircraftData data = AircraftDataFactory.Create(aircraftData, engineData); // Assert AircraftDataTestHelper.AssertAircraftData(aircraftData, engineData, data); }
/// <summary> /// 扩展卡16-设置轴IO /// </summary> /// <returns>控制命令</returns> public static string ControlCmd_SetIOIndexExtern(EngineData Data, int chose) { ushort boardIP = Data.boardIP; //扩展卡编号 string SendData = string.Format(CMDTop[(int)CMDTopNum.nsetaio] + " {0},{1},ioState", boardIP, chose); return(SendData); }
/// <summary> /// 6-获取轴位置 /// </summary> /// <param name="Data">数据集</param> /// <returns>控制命令</returns> public static string ControlCmd_GetAxlePos(EngineData Data) { ushort Axle = Data.Axle; //轴编号 string SendData = string.Format(CMDTop[(int)CMDTopNum.getpos] + " {0}", Axle); return(SendData); }
/// <summary> /// 7-设置主板输出端口 /// </summary> /// <param name="Data">数据集</param> /// <returns>控制命令</returns> public static string ControlCmd_SetMOutput(EngineData Data) { int Output = Data.MOutput; //主板输出 string SendData = string.Format(CMDTop[(int)CMDTopNum.setout] + " {0}", Output); return(SendData); }
/// <summary> /// Calculates the <see cref="BalancedFieldLengthOutput"/> based on <paramref name="calculation"/>. /// </summary> /// <param name="calculation">The <see cref="BalancedFieldLengthCalculation"/> to calculate for.</param> /// <returns>A <see cref="BalancedFieldLengthOutput"/>.</returns> /// <exception cref="ArgumentNullException">Thrown when <paramref name="calculation"/> is <c>null</c>.</exception> /// <exception cref="CreateKernelDataException">Thrown when the calculation input /// could not be created for the kernel.</exception> /// <exception cref="KernelCalculationException">Thrown when <see cref="AggregatedDistanceOutput"/> /// could not be calculated.</exception> public BalancedFieldLengthOutput Calculate(BalancedFieldLengthCalculation calculation) { if (calculation == null) { throw new ArgumentNullException(nameof(calculation)); } GeneralSimulationSettingsData generalSimulationSettings = calculation.SimulationSettings; double density = generalSimulationSettings.Density; int endVelocity = generalSimulationSettings.EndFailureVelocity; double gravitationalAcceleration = generalSimulationSettings.GravitationalAcceleration; EngineData engineData = calculation.EngineData; int nrOfFailedEngines = engineData.NrOfFailedEngines; AircraftData aircraftData = AircraftDataFactory.Create(calculation.AircraftData, engineData); var integrator = new EulerIntegrator(); var outputs = new List <AggregatedDistanceOutput>(); for (int i = 0; i < endVelocity; i++) { var calculationInput = new CalculationInput(generalSimulationSettings, i, aircraftData, integrator, nrOfFailedEngines, density, gravitationalAcceleration); AggregatedDistanceOutput output = CalculateDistances(calculationInput); outputs.Add(output); } return(BalancedFieldLengthOutputFactory.Create(outputs)); }
public JsonResult CheckProcessEditPasswordNotify(string lblTexto, string email = "") { Respuesta model = new Respuesta(); string texto = EngineData.ActualizarContraseña(); int idCliente = 0; bool resultado = Funcion.CompareString(lblTexto, texto); if (resultado) { idCliente = Metodo.ObtenerIdCliente(email, true); if (idCliente > 0) { model.RespuestaAccion = "ResetPassword"; } } else { texto = EngineData.IngreseCodigo(); resultado = Funcion.CompareString(lblTexto, texto); if (resultado) { model.RespuestaAccion = "EnterCode"; } } return(Json(model)); }
IEnumerator SendEngineData(EngineData _statblock) { //Faction //Speed //Acceleration //Boost Power //Handling string BASE_URL = "https://docs.google.com/forms/u/1/d/e/1FAIpQLSfroDYTkAwKmMXGbmHctdYf0tuFEcYyeb15J5wRRtsq1GdWLw/formResponse"; WWWForm form = new WWWForm(); form.AddField("entry.1853573029", _statblock.CurrentFaction.ToString()); form.AddField("entry.1516976851", _statblock.TopSpeed.ToString()); form.AddField("entry.737210474", _statblock.Acceleration.ToString()); form.AddField("entry.974680751", _statblock.BoostPower.ToString()); form.AddField("entry.1903627046", _statblock.Handling.ToString()); byte[] rawData = form.data; WWW www = new WWW(BASE_URL, rawData); yield return(www); }
public void GivenViewModelWithThrustPerEngineNotZero_WhenNrOfEnginesSet_ThenNotifyPropertyChangedEventsFiredAndTotalThrustUpdated() { // Given var random = new Random(21); double thrustPerEngine = random.NextDouble(); var engineData = new EngineData { ThrustPerEngine = thrustPerEngine }; var viewModel = new EngineSettingsTabViewModel(engineData); var eventArgsCollection = new List <PropertyChangedEventArgs>(); viewModel.PropertyChanged += (o, e) => { eventArgsCollection.Add(e); }; const int nrOfEngines = 4; // When viewModel.NrOfEngines = nrOfEngines; double totalThrust = viewModel.TotalThrust; int maximumNrOfFailedEngines = viewModel.MaximumNrOfFailedEngines; // Then Assert.That(maximumNrOfFailedEngines, Is.EqualTo(nrOfEngines - 1)); Assert.That(totalThrust, Is.EqualTo(nrOfEngines * thrustPerEngine).Within(1e-5)); CollectionAssert.AreEquivalent(new[] { "NrOfEngines", "TotalThrust", "MaximumNrOfFailedEngines" }, eventArgsCollection.Select(e => e.PropertyName)); }
void Awake() { try { Mpq.AddArchive("d2exp.mpq"); Mpq.AddArchive("d2data.mpq"); Mpq.AddArchive("d2char.mpq"); Mpq.AddArchive("d2sfx.mpq", optional: true); Mpq.AddArchive("d2music.mpq", optional: true); Mpq.AddArchive("d2xMusic.mpq", optional: true); Mpq.AddArchive("d2xtalk.mpq", optional: true); Mpq.AddArchive("d2speech.mpq", optional: true); } catch (System.IO.FileNotFoundException e) { string message = BuildMessage(e.Message); ScreenMessage.Show(message); return; } Datasheet.SetLocation(typeof(BodyLoc), "data/global/excel/bodylocs.txt"); Datasheet.SetLocation(typeof(SoundInfo), "data/global/excel/Sounds.txt"); EngineData.LoadAll(); Instantiate(mainMenuPrefab); }
private static void AssertEngineData(EngineSettingsTabViewModel expected, EngineData actual) { Assert.That(actual.ThrustPerEngine, Is.EqualTo(expected.ThrustPerEngine)); Assert.That(actual.NrOfEngines, Is.EqualTo(expected.NrOfEngines)); Assert.That(actual.NrOfFailedEngines, Is.EqualTo(expected.NrOfFailedEngines)); }
/// <summary> /// 扩展卡18-获取卡名称 /// </summary> /// <returns>控制命令</returns> public static string ControlCmd_GetNameExtern(EngineData Data) { ushort boardIP = Data.boardIP; //扩展卡编号 string SendData = string.Format(CMDTop[(int)CMDTopNum.ngetname] + " {0}", boardIP); return(SendData); }
public TournamentParticipant(EngineData engineData, EngineOperator engineOperator) { EngineData = engineData; EngineOperator = engineOperator; History = new List <ArchivedGame>(); Logs = new List <InfoData>(); }
public void GivenViewModelWithNrOfEnginesAndThrustPerEngineNotZero_WhenSettingSameThrustPerEngine_ThenNoEventsFired(double tolerance) { // Given const int nrOfEngines = 4; var random = new Random(21); double thrustPerEngine = random.NextDouble(); var engineData = new EngineData { NrOfEngines = nrOfEngines, ThrustPerEngine = thrustPerEngine }; var viewModel = new EngineSettingsTabViewModel(engineData); var eventArgsCollection = new List <PropertyChangedEventArgs>(); viewModel.PropertyChanged += (o, e) => { eventArgsCollection.Add(e); }; // When viewModel.ThrustPerEngine = thrustPerEngine + tolerance; // Then Assert.That(engineData.ThrustPerEngine, Is.EqualTo(thrustPerEngine)); Assert.That(eventArgsCollection, Is.Empty); }
private void Lenguaje_Click(object sender, EventArgs e) { EngineData Valor = EngineData.Instance(); ToolStripMenuItem toolStrip = sender as ToolStripMenuItem; switch (toolStrip.Name) { case (EngineData.Español): Thread.CurrentThread.CurrentUICulture = new CultureInfo(EngineData.CulturaEspañol); Valor.SetIdioma(EngineData.CulturaEspañol); Valor.SetNombreIdioma(EngineData.LenguajeEspañol); break; case (EngineData.Ingles): Thread.CurrentThread.CurrentUICulture = new CultureInfo(EngineData.CulturaIngles); Valor.SetIdioma(EngineData.CulturaIngles); Valor.SetNombreIdioma(EngineData.LenguajeIngles); break; case (EngineData.Portugues): Thread.CurrentThread.CurrentUICulture = new CultureInfo(EngineData.CulturaPortugues); Valor.SetIdioma(EngineData.CulturaPortugues); Valor.SetNombreIdioma(EngineData.LenguajePortugues); break; } AplicarIdioma(); }
public void GivenViewModelWithNrOfEnginesNotZero_WhenThrustPerEngineSet_ThenNotifyPropertyChangedEventsFiredAndTotalThrustUpdated() { // Given const int nrOfEngines = 4; var engineData = new EngineData { NrOfEngines = nrOfEngines }; var viewModel = new EngineSettingsTabViewModel(engineData); var eventArgsCollection = new List <PropertyChangedEventArgs>(); viewModel.PropertyChanged += (o, e) => { eventArgsCollection.Add(e); }; var random = new Random(21); double thrustPerEngine = random.NextDouble(); // When viewModel.ThrustPerEngine = thrustPerEngine; double totalThrust = viewModel.TotalThrust; // Then double expectedTotalThrust = nrOfEngines * thrustPerEngine; Assert.That(totalThrust, Is.EqualTo(expectedTotalThrust).Within(1e-5)); CollectionAssert.AreEquivalent(new[] { "ThrustPerEngine", "TotalThrust" }, eventArgsCollection.Select(e => e.PropertyName)); }
/// <summary> /// 扩展卡17-权限设置 /// </summary> /// <param name="Data">数据集</param> /// <returns>控制命令</returns> public static string ControlCmd_SetGradeExtern(EngineData Data) { ushort Axle = Data.Axle; //轴编号 ushort boardIP = Data.boardIP; //扩展卡编号 string SendData = string.Format(CMDTop[(int)CMDTopNum.nsetlmt] + " {0},{1},{2},{3},{4},{5}", boardIP, Axle); return(SendData); }
public override void clearState() { lastStatusMessage = EngineStatus.ALL_CLEAR; engineData = new EngineData(); gameTimeAtLastStatusCheck = 0; maxSafeOilTemp = 0; maxSafeWaterTemp = 0; }
/// <summary> /// 扩展卡7-设置主板输出端口 /// </summary> /// <param name="Data">数据集</param> /// <returns>控制命令</returns> public static string ControlCmd_SetMOutputExtern(EngineData Data) { ushort boardIP = Data.boardIP; //扩展卡编号 int Output = Data.MOutput; //位号0~8 string SendData = string.Format(CMDTop[(int)CMDTopNum.nsetout] + " {0},{1}", boardIP, Output); return(SendData); }
/// <summary> /// 10-设置目标位置 /// </summary> /// <param name="Data">数据集</param> /// <returns>控制命令</returns> public static string ControlCmd_SetTargetlocation(EngineData Data) { ushort Axle = Data.Axle; //轴编号 int Targetlocation = Data.Targetlocation; //目标位置 string SendData = string.Format(CMDTop[(int)CMDTopNum.setpos] + " {0},{1}", Axle, Targetlocation); return(SendData); }
/// <summary> /// 扩展卡6-获取轴位置 /// </summary> /// <param name="Data">数据集</param> /// <returns>控制命令</returns> public static string ControlCmd_GetAxlePosExtern(EngineData Data) { ushort boardIP = Data.boardIP; //扩展卡编号 ushort Axle = Data.Axle; //轴编号 string SendData = string.Format(CMDTop[(int)CMDTopNum.ngetpos] + " {0},{1}", boardIP, Axle); return(SendData); }
private static void SetEngineData(EngineData data) { var random = new Random(21); data.NrOfEngines = random.Next(); data.ThrustPerEngine = random.NextDouble(); data.NrOfFailedEngines = data.NrOfEngines - 1; }
public static GameObject CreateEngine(EngineData data) { GameObject newEngine = Instantiate(GetEnginePrefab(), Vector2.zero, Quaternion.identity) as GameObject; Engine engine = newEngine.GetComponent<Engine> (); engine.InitEngine (data); return newEngine; }
private void initEngine() { Item engineItem = shipData.getSlot(HullSlot.Type.ENGINE, 0).item; EngineData data = (EngineData)engineItem.itemData; engine.setEngine(data.type, data.power, data.type.rotatePower()); setEngineSprite(); }
public override void clearState() { lastStatusMessage = EngineStatus.ALL_CLEAR; engineData = new EngineData(); gameTimeAtLastStatusCheck = 0; gotBaseline = false; baselineSamples = 0; baselineOilTemp = 0; baselineWaterTemp = 0; }
static void Main() { // the project is NOT working. still to be implemented and possible errors are marked with a command for easy review. // only the 'create' and the 'status' commands are working... // thanks for reviewing my project! Wish you a nice day! :) var blob = new CreateBlobFactory(); var reader = new ConsoleReader(); var writer = new ConsoleWriter(); var data = new EngineData(); var engine = new Engine(blob, data, reader, writer); engine.Run(); //ps: i never got how to apply the behavior... }
// default engine for testing purposes private void AddPlainEngine() { EngineData plain = new EngineData(); engines.Add (Engine.CreateEngine (plain).GetComponent<Engine> ()); }
protected override void triggerInternal(Shared lastState, Shared currentState) { if (CommonData.isRaceStarted) { if (engineData == null) { clearState(); } if (!gotBaseline) { if (currentState.Player.GameSimulationTime > baselineStartSeconds && currentState.Player.GameSimulationTime < baselineFinishSeconds) { baselineSamples++; baselineWaterTemp += currentState.EngineWaterTemp; baselineOilTemp += currentState.EngineOilTemp; } else if (currentState.Player.GameSimulationTime >= baselineFinishSeconds && baselineSamples > 0) { gotBaseline = true; baselineOilTemp = baselineOilTemp / baselineSamples; baselineWaterTemp = baselineWaterTemp / baselineSamples; Console.WriteLine("Got baseline engine temps, water = " + baselineWaterTemp + ", oil = " + baselineOilTemp); } } else { if (currentState.Player.GameSimulationTime > gameTimeAtLastStatusCheck + statusMonitorWindowLength) { EngineStatus currentEngineStatus = engineData.getEngineStatus(baselineOilTemp, baselineWaterTemp); if (currentEngineStatus != lastStatusMessage) { switch (currentEngineStatus) { case EngineStatus.ALL_CLEAR: audioPlayer.queueClip(folderAllClear, 0, this); lastStatusMessage = currentEngineStatus; break; case EngineStatus.HOT_OIL: // don't play this if the last message was about hot oil *and* water - wait for 'all clear' if (lastStatusMessage != EngineStatus.HOT_OIL_AND_WATER) { audioPlayer.queueClip(folderHotOil, 0, this); lastStatusMessage = currentEngineStatus; } break; case EngineStatus.HOT_WATER: // don't play this if the last message was about hot oil *and* water - wait for 'all clear' if (lastStatusMessage != EngineStatus.HOT_OIL_AND_WATER) { audioPlayer.queueClip(folderHotWater, 0, this); lastStatusMessage = currentEngineStatus; } break; case EngineStatus.HOT_OIL_AND_WATER: audioPlayer.queueClip(folderHotOilAndWater, 0, this); lastStatusMessage = currentEngineStatus; break; case EngineStatus.LOW_OIL_PRESSURE: audioPlayer.queueClip(folderLowOilPressure, 0, this); lastStatusMessage = currentEngineStatus; break; } } gameTimeAtLastStatusCheck = currentState.Player.GameSimulationTime; engineData = new EngineData(); } engineData.addSample(currentState); if (logTemps) { Console.WriteLine(currentState.EngineWaterTemp + ", " + currentState.EngineOilTemp + ", " + currentState.EngineOilPressure); } } } }
private void InitEngine(EngineData data) { // does nothing yet besides arbitrary speed speed = 10; }