/// <summary> /// Erzeugt eine neue Verwaltung. /// </summary> /// <param name="hardware">Das zu verwendende DVB.NET Gerät.</param> /// <param name="pid">Die gewünschte Datenstromkennung.</param> /// <param name="type">Die Art des Datenstroms.</param> /// <param name="name">Der Name dieses Eintrags.</param> /// <param name="videoType">Gesetzt, wenn es sich um ein HDTV Bildsignal handelt. Ist der /// Datenstrom kein Bildsignal, so wird <i>null</i> verwendet.</param> public StreamItem( Hardware hardware, ushort pid, StreamTypes type, string name, bool? videoType ) : base( string.Format( "{0} ({1})", name, pid ) ) { // Create rate indicator SubItems.Add( "?" ); SubItems.Add( string.Empty ); // Reset m_Total = (long) 0; // Remember m_Hardware = hardware; // Register m_ConsumerId = m_Hardware.AddConsumer( pid, type, OnData ); // Create decoder if (videoType.HasValue) if (videoType.Value) m_StreamDecoder = new HDTVStream( this, 512, true ); else m_StreamDecoder = new VideoStream( this, 512, true ); // Start it m_Hardware.SetConsumerState( m_ConsumerId, true ); }
public VolumeDescriptor(Hardware.Devices.DiskDevice disk, uint startBlock, uint numBlocks, byte[] data) : base(disk, 0, 0) { Code = (TypeCodes)data[0]; Id = ByteConverter.GetASCIIStringFromASCII(data, 1, 5); Version = data[6]; }
/// <summary> /// Changes a machine's status on the UI based on its status. /// </summary> /// <param name="hardware">The hardware to change.</param> /// <param name="hardwareStatus">The status to change to.</param> public void ChangeHardwareStatus(Hardware hardware, HardwareStatus hardwareStatus) { PictureBox pictureBox; string pictureBoxName = this.GetHardwarePictureBoxName(hardware); var pictureBoxCollection = !string.IsNullOrWhiteSpace(pictureBoxName) ? this.pnlContainer.Controls.Find(pictureBoxName, false) : null; if (pictureBoxCollection == null) { return; } pictureBox = pictureBoxCollection.FirstOrDefault(x => x.Name == pictureBoxName) as PictureBox; if (hardware == Hardware.SorterRobot || hardware == Hardware.LoaderRobot || hardware == Hardware.AssemblerRobot || hardware == Hardware.PalletiserRobot) { this.ChangeRobotPictureBox(pictureBox, hardwareStatus); } else if (hardware == Hardware.SorterCamera || hardware == Hardware.TrayVerifierCamera) { this.ChangeCameraPictureBox(pictureBox, hardwareStatus); } else if (hardware == Hardware.AssemblyConveyor) { this.ChangeAssemblyConveyorPictureBox(pictureBox, hardwareStatus); } else if (hardware == Hardware.SorterConveyor) { this.ChangeSorterConveyorPictureBox(pictureBox, hardwareStatus); } }
public void ExecuteTest() { var robot = new Hardware(2, 2); // move the robot to (1, 1) robot.Walk(); robot.TurnRight(); robot.Walk(); // just checking... Assert.AreEqual(robot.X, 1); Assert.AreEqual(robot.Y, 1); var command = new ReturnRumbaMumbaNoObstacles(); var expected = new List<Point> { new Point { X = 1, Y = 1}, new Point { X = 0, Y = 1}, new Point { X = 0, Y = 0} }; var actual = command.Execute(robot); Assert.AreEqual(expected.Count, actual.Count); for (var i = 0; i < actual.Count; i++) { Assert.AreEqual(expected[i], actual[i]); } }
public static SystemCallResults RegisterISRHandler(uint ISRNum, Hardware.Processes.ISRHanderDelegate handler) { uint Return1 = 0; uint Return2 = 0; uint Return3 = 0; uint Return4 = 0; Call(SystemCallNumbers.RegisterISRHandler, ISRNum, (uint)Utilities.ObjectUtilities.GetHandle(handler), 0, ref Return1, ref Return2, ref Return3, ref Return4); return (SystemCallResults)Return1; }
public UsbDeviceList(Hardware hardware) { InitializeComponent(); _hardware = hardware; _hardware.DeviceInterfaceChanged += Hardware_DeviceInterfaceChanged; RefreshList(); }
public ISO9660(Hardware.Devices.DiskDevice disk) { byte[] data = disk.NewBlockArray(1); VolumeDescriptor desciptor = null; uint sector = 0x10; do { disk.ReadBlock(sector, 1, data); desciptor = VolumeDescriptor.CreateDescriptor(disk, sector, 1); VolumeDescriptors.Add(desciptor); sector++; } while (desciptor.Code != VolumeDescriptor.TypeCodes.SetTerminator); }
public static VolumeDescriptor CreateDescriptor(Hardware.Devices.DiskDevice disk, uint startBlock, uint numBlocks) { byte[] data = disk.NewBlockArray(numBlocks); disk.ReadBlock(startBlock, numBlocks, data); switch ((TypeCodes)data[0]) { case TypeCodes.BootRecord: return new BootRecord(disk, startBlock, numBlocks, data); case TypeCodes.Primary: return new PrimaryVolumeDescriptor(disk, startBlock, numBlocks, data); case TypeCodes.SetTerminator: return new SetTerminatorVolumeDescriptor(disk, startBlock, numBlocks, data); default: return new VolumeDescriptor(disk, startBlock, numBlocks, data); } }
private void ComputerHardwareAdded(IHardware hardware) { if (!Exists(hardware.Identifier.ToString())) { foreach (ISensor sensor in hardware.Sensors) HardwareSensorAdded(sensor); hardware.SensorAdded += HardwareSensorAdded; hardware.SensorRemoved += HardwareSensorRemoved; Hardware hw = new Hardware(hardware); activeInstances.Add(hw); try { Instrumentation.Publish(hw); } catch (Exception) { } } foreach (IHardware subHardware in hardware.SubHardware) ComputerHardwareAdded(subHardware); }
public void ExecuteTest() { var robot = new Hardware(2, 2); var command = new CleanRumbaMumbaNoObstacles(); var expected = new List<Point> { new Point { X = 0, Y = 0}, new Point { X = 1, Y = 0}, new Point { X = 1, Y = 1}, new Point { X = 0, Y = 1} }; var actual = command.Execute(robot); Assert.AreEqual(expected.Count, actual.Count); for (var i = 0; i < actual.Count; i++) { Assert.AreEqual(expected[i], actual[i]); } }
static void Main() { var hardware = new Hardware(WIDTH, HEIGHT); var cleanCommand = new CleanRumbaMumbaNoObstacles(); var cleanPath = cleanCommand.Execute(hardware); var returnCommand = new ReturnRumbaMumbaNoObstacles(); var returnPath = returnCommand.Execute(hardware); Console.WriteLine("Cleaning Path :"); foreach (var point in cleanPath) Console.WriteLine("{0},{1}", point.X, point.Y); Console.WriteLine("Return Path : "); foreach (var point in returnPath) Console.WriteLine("{0},{1}", point.X, point.Y); Console.WriteLine("TotalMovements : {0}", hardware.TotalMovements); }
public static void RequestNote(Hardware.Timers.PIT.MusicalNote note, Hardware.Timers.PIT.MusicalNoteValue duration, uint bpm) { NoteRequest next = (NoteRequest)DeadNoteRequests.Pop(); if (next == null) { BasicConsole.WriteLine("Cannot set note request because a null object was returned from the circular buffer. Buffer may be full."); BasicConsole.DelayOutput(10); } else { next.note = note; next.duration = duration; next.bpm = (int)bpm; LiveNoteRequests.Push(next); if (OwnerThread != null) { OwnerThread._Wake(); } } }
public SetTerminatorVolumeDescriptor(Hardware.Devices.DiskDevice disk, uint startBlock, uint numBlocks, byte[] data) : base(disk, startBlock, numBlocks, data) { }
public BootRecord(Hardware.Devices.DiskDevice disk, uint startBlock, uint numBlocks, byte[] data) : base(disk, startBlock, numBlocks, data) { BootSystemIdentifier = ByteConverter.GetASCIIStringFromASCII(data, 7, 32); BootSystem = ByteConverter.GetASCIIStringFromASCII(data, 39, 32); }
/// <summary> /// Creates a new FAT32 partition that covers the entire drive. /// </summary> /// <param name="aDisk">The disk to create the partition for.</param> /// <param name="bootable">Whether to mark the partition as bootable or not.</param> /// <returns>The new partition information.</returns> public static PartitionInfo CreateFAT32PartitionInfo(Hardware.Devices.DiskDevice aDisk, bool bootable) { //Can't remember why but we have to start at 3rd logical block // - First sector (sector 0) is for the MBR // - Why do we leave a second sector empty after it? return new PartitionInfo(bootable, 0xC, 2U, (uint)(aDisk.BlockCount - 2)); }
private static void DeviceManager_DeviceAdded(FOS_System.Object state, Hardware.Device device) { ((MainShell)state)._DeviceManager_DeviceAdded(device); }
public ActionResult Editar(Hardware equipoComputoCpu, Hardware equipoComputoMonitor, Hardware equipoComputoTeclado, Hardware equipoComputoMouse, string idLaboratorio, string nombreUsuarioEquipoAEditar) { if (SecurityHelper.GetAdministradorID() > 0 && (SecurityHelper.GetAdministradorRol() == "Administrador General" || SecurityHelper.GetAdministradorRol() == "Técnico" || SecurityHelper.GetAdministradorRol() == "Practicante")) { EquipoComputoViewModel model = new EquipoComputoViewModel(); model.equipoComputoCpu = equipoComputoCpu; model.equipoComputoMonitor = equipoComputoMonitor; model.equipoComputoTeclado = equipoComputoTeclado; model.equipoComputoMouse = equipoComputoMouse; model.equipoComputoCpu.IdLaboratorio = int.Parse(idLaboratorio); model.equipoComputoMonitor.IdLaboratorio = int.Parse(idLaboratorio); model.equipoComputoTeclado.IdLaboratorio = int.Parse(idLaboratorio); model.equipoComputoMouse.IdLaboratorio = int.Parse(idLaboratorio); model.ListaEquiposComputoGetByUsuario = hardwareDataAccess.GetEquiposComputoByUsuario(nombreUsuarioEquipoAEditar); for (int i = 0; i < model.ListaEquiposComputoGetByUsuario.Count; i++) { string tipoEquipoComputo = model.ListaEquiposComputoGetByUsuario[i].TipoEquipo; if (tipoEquipoComputo.Equals("CPU")) { model.equipoComputoCpu.IdHardware = model.ListaEquiposComputoGetByUsuario[i].IdHardware; } else if (tipoEquipoComputo.Equals("MONITOR")) { model.equipoComputoMonitor.IdHardware = model.ListaEquiposComputoGetByUsuario[i].IdHardware; } else if (tipoEquipoComputo.Equals("TECLADO")) { model.equipoComputoTeclado.IdHardware = model.ListaEquiposComputoGetByUsuario[i].IdHardware; } else if (tipoEquipoComputo.Equals("MOUSE")) { model.equipoComputoMouse.IdHardware = model.ListaEquiposComputoGetByUsuario[i].IdHardware; } } List <Hardware> equiposComputoList = new List <Hardware>(); equiposComputoList.Add(model.equipoComputoCpu); equiposComputoList.Add(model.equipoComputoMonitor); equiposComputoList.Add(model.equipoComputoTeclado); equiposComputoList.Add(model.equipoComputoMouse); hardwareDataAccess.UpdateHardware(equiposComputoList); return(RedirectToAction("Index")); } else { return(RedirectToAction("Index", "Login", new { Area = "" })); } }
static void PrintInternalStates(Hardware.Structura cpu) { Console.Clear(); Console.WriteLine("Structura System v13.03"); Console.WriteLine(""); Console.WriteLine("Cycles: {0}", cycles); Console.WriteLine(""); Console.WriteLine("Register:"); Console.WriteLine("A: {0}, B: {1}, C: {2}, D: {3}, E: {4}, F: {5}, G: {6}, H: {7}, I: {8}, J: {9},", cpu.A, cpu.B, cpu.C, cpu.D, cpu.E, cpu.F, cpu.G, cpu.H, cpu.I, cpu.J); Console.WriteLine("K: {0}, L: {1}, M: {2}, N: {3}, O: {4}, P: {5}, Q: {6}, R: {7}, S: {8}, T: {9},", cpu.K, cpu.L, cpu.M, cpu.N, cpu.O, cpu.P, cpu.Q, cpu.R, cpu.S, cpu.T); Console.WriteLine("U: {0}, V: {1}, W: {2}, X: {3}, Y: {4}, Z: {5}", cpu.U, cpu.V, cpu.W, cpu.X, cpu.Y, cpu.Z); Console.WriteLine(""); Console.WriteLine("Special registers:"); Console.WriteLine("IC: {0}", cpu.IC); Console.WriteLine(""); Console.WriteLine("Flags:"); Console.WriteLine("Zero: {0}, Positive: {1}, Negative: {2}, Overflow: {3}", cpu.Zero, cpu.Positive, cpu.Negative, cpu.Overflow); }
// Update screen public void DrawElements() { Hardware.ClearScreen(); currentLevel.DrawOnHiddenScreen(); Hardware.WriteHiddenText("Score: " + score, (short)(40 + player.GetX()), 10, 0xCC, 0xCC, 0xCC, font18); Hardware.WriteHiddenText("Lifes: " + lifeCount, (short)(400 + player.GetX()), 10, 0xFF, 0x00, 0x00, font18); player.DrawOnHiddenScreen(); shoot.DrawOnHiddenScreen(); // Only for standard one by one shot method. //for (int i = 0; i < shoot.Count; i++) // Method for various shoots using lists. //{ // shoot[i].DrawOnHiddenScreen(); //} for (int i = 0; i < numEnemies; i++) { enemies[i].DrawOnHiddenScreen(); } for (int i = 0; i < numBats; i++) { bats[i].DrawOnHiddenScreen(); } for (int i = 0; i < numDemons; i++) { demons[i].DrawOnHiddenScreen(); } for (int i = 0; i < numOgres; i++) { ogres[i].DrawOnHiddenScreen(); } for (int i = 0; i < numBirds; i++) { birds[i].DrawOnHiddenScreen(); } for (int i = 0; i < numRedFlys; i++) { redFlys[i].DrawOnHiddenScreen(); } for (int i = 0; i < numBosses; i++) { bosses[i].DrawOnHiddenScreen(); } for (int i = 0; i < numObjects; i++) { objects[i].DrawOnHiddenScreen(); } Hardware.ShowHiddenScreen(); }
public CreditsScreen(Hardware hardware) : base(hardware) { background = new Image("Images/background.jpg", 1440, 1000); }
public override void CopyRelValues(Hardware other) { return; }
public static void GetGameplayInput(object rArgs) { if (CharacterHandler2d.MyCharacter == null) { return; } /* * //exit early if main gameplay not in progress * if(App.Status.LoadState < 3) * { * return; * } */ //grab old state CharacterHandler2d.MyCharacter.OldStatus = JsonConvert.DeserializeObject <CharacterEntity2d.CharacterStatus>(JsonConvert.SerializeObject(CharacterHandler2d.MyCharacter.Status)); //reset forced UserInterface.Status.MouseModeForced = ""; UserInterface.Status.KeyModeForced = ""; //exit early if user does not have control if (UserInterface.Status.KeyMode != "gameplay" || CharacterHandler2d.MyCharacter.Status.MotionState == CharacterEntity2d.MotionStates.Forced) { return; } if (!CharacterHandler2d.MyCharacter.Status.IsLiving) { return; } //reset states that need to be held by user if (CharacterHandler2d.MyCharacter.Status.ActionState == CharacterEntity2d.ActionStates.Moving) { CharacterHandler2d.MyCharacter.Status.ActionState = CharacterEntity2d.ActionStates.Idle; } if (CharacterHandler2d.MyCharacter.Status.MotionState != CharacterEntity2d.MotionStates.Forced) { CharacterHandler2d.MyCharacter.Status.MotionState = CharacterEntity2d.MotionStates.Stationary; } CharacterHandler2d.MyCharacter.Status.DirectionState = CharacterEntity2d.DirectionStates.Up; //move up if (Hardware.IsKeyDown((int)Keys.W)) { CharacterHandler2d.MyCharacter.Status.ActionState = CharacterEntity2d.ActionStates.Moving; CharacterHandler2d.MyCharacter.Status.DirectionState = CharacterEntity2d.DirectionStates.Up; CharacterHandler2d.MyCharacter.Properties.Facing = 180.0f; CharacterHandler2d.MyCharacter.Properties.Heading = 180.0f; } //move right if (Hardware.IsKeyDown((int)Keys.D)) { CharacterHandler2d.MyCharacter.Status.ActionState = CharacterEntity2d.ActionStates.Moving; CharacterHandler2d.MyCharacter.Status.DirectionState = CharacterEntity2d.DirectionStates.Right; CharacterHandler2d.MyCharacter.Properties.Facing = 90.0f; CharacterHandler2d.MyCharacter.Properties.Heading = 90.0f; } //move left if (Hardware.IsKeyDown((int)Keys.A)) { CharacterHandler2d.MyCharacter.Status.ActionState = CharacterEntity2d.ActionStates.Moving; CharacterHandler2d.MyCharacter.Status.DirectionState = CharacterEntity2d.DirectionStates.Left; CharacterHandler2d.MyCharacter.Properties.Facing = 270.0f; CharacterHandler2d.MyCharacter.Properties.Heading = 270.0f; } //move down if (Hardware.IsKeyDown((int)Keys.S)) { CharacterHandler2d.MyCharacter.Status.ActionState = CharacterEntity2d.ActionStates.Moving; CharacterHandler2d.MyCharacter.Status.DirectionState = CharacterEntity2d.DirectionStates.Down; CharacterHandler2d.MyCharacter.Properties.Facing = 0.0f; CharacterHandler2d.MyCharacter.Properties.Heading = 0.0f; } if (CharacterHandler2d.MyCharacter.Status.ActionState == CharacterEntity2d.ActionStates.Moving) { CharacterHandler2d.MyCharacter.Status.MotionState = CharacterEntity2d.MotionStates.Normal; } }
public ActionResult Crear(Hardware equipoComputoCpu, Hardware equipoComputoMonitor, Hardware equipoComputoTeclado, Hardware equipoComputoMouse, string idLaboratorio) { if (SecurityHelper.GetAdministradorID() > 0 && (SecurityHelper.GetAdministradorRol() == "Administrador General" || SecurityHelper.GetAdministradorRol() == "Técnico" || SecurityHelper.GetAdministradorRol() == "Practicante")) { EquipoComputoViewModel model = new EquipoComputoViewModel(); model.equipoComputoCpu = equipoComputoCpu; model.equipoComputoMonitor = equipoComputoMonitor; model.equipoComputoTeclado = equipoComputoTeclado; model.equipoComputoMouse = equipoComputoMouse; model.equipoComputoCpu.IdLaboratorio = int.Parse(idLaboratorio); model.equipoComputoMonitor.IdLaboratorio = int.Parse(idLaboratorio); model.equipoComputoTeclado.IdLaboratorio = int.Parse(idLaboratorio); model.equipoComputoMouse.IdLaboratorio = int.Parse(idLaboratorio); List <Hardware> equiposComputoList = new List <Hardware>(); equiposComputoList.Add(model.equipoComputoCpu); equiposComputoList.Add(model.equipoComputoMonitor); equiposComputoList.Add(model.equipoComputoTeclado); equiposComputoList.Add(model.equipoComputoMouse); hardwareDataAccess.CreateHardware(equiposComputoList); return(RedirectToAction("Index")); } else { return(RedirectToAction("Index", "Login", new { Area = "" })); } }
// Check collisions and apply game logic public void CheckCollisions() { // Check if there's a ladder collision //player.CheckSituation(currentLevel.IsValidMove(player.GetX(), player.GetY())[0], // currentLevel.IsValidMove(player.GetX(), player.GetY())[1], // currentLevel.IsValidMove(player.GetX(), player.GetY())[2]); //if (player.GetX() + player.GetWidth() >= currentLevel.GetMaxX() && // level < 3) //{ // level++; // player.SetX(currentLevel.GetMinX() + 5); // currentLevel.SetLevel(level); //} //for (int i = 0; i < enemies.Length; i++) //{ // for (int j = 0; j < shoot.Count; j++) // { // if (shoot[j].CollisionsWith(enemies[i])) // { // enemies[i].Hide(); // } // if (player.CollisionsWith(shoot[j])) // { // shoot[j].Hide(); // score += 100; // } // if (!shoot[j].IsVisible()) // shoot.Remove(shoot[j]); // } //} for (int i = 0; i < numEnemies; i++) { if (enemies[i].CollisionsWith(player)) { lifeCount--; player.Restart(); Hardware.ResetScroll(); if (lifeCount < 0) { finished = true; } } // Old method to detect collision with enemies if (shoot.CollisionsWith(enemies[i])) { enemies[i].Hide(); shoot.Hide(); score += 100; } } for (int i = 0; i < numDemons; i++) { if (demons[i].CollisionsWith(player)) { lifeCount--; player.Restart(); Hardware.ResetScroll(); if (lifeCount < 0) { finished = true; } } if (shoot.CollisionsWith(demons[i])) { shoot.Hide(); if (demonsLives == 0) { demons[i].Hide(); } } } for (int i = 0; i < numOgres; i++) { if (ogres[i].CollisionsWith(player)) { lifeCount--; player.Restart(); Hardware.ResetScroll(); if (lifeCount < 0) { finished = true; } } if (shoot.CollisionsWith(ogres[i])) { ogreLives--; shoot.Hide(); score += 400; if (ogreLives == 0) { ogres[i].Hide(); ogreLives = 2; } } } for (int i = 0; i < numBats; i++) { if (bats[i].CollisionsWith(player)) { lifeCount--; player.Restart(); Hardware.ResetScroll(); if (lifeCount < 0) { finished = true; } } if (shoot.CollisionsWith(bats[i])) { bats[i].Hide(); shoot.Hide(); score += 200; } } for (int i = 0; i < numBirds; i++) { if (birds[i].CollisionsWith(player)) { lifeCount--; player.Restart(); Hardware.ResetScroll(); if (lifeCount < 0) { finished = true; } } if (shoot.CollisionsWith(birds[i])) { birds[i].Hide(); shoot.Hide(); score += 200; } } for (int i = 0; i < numRedFlys; i++) { if (redFlys[i].CollisionsWith(player)) { lifeCount--; player.Restart(); Hardware.ResetScroll(); if (lifeCount < 0) { finished = true; } } if (shoot.CollisionsWith(redFlys[i])) { redFlysLives--; shoot.Hide(); score += 500; if (redFlysLives == 0) { redFlys[i].Hide(); } } } for (int i = 0; i < numBosses; i++) { if (bosses[i].CollisionsWith(player)) { lifeCount--; player.Restart(); Hardware.ResetScroll(); if (lifeCount < 0) { finished = true; } } if (shoot.CollisionsWith(bosses[i])) { bossLives--; shoot.Hide(); score += 1000; if (bossLives == 0) { bosses[i].Hide(); } } } for (int i = 0; i < numObjects; i++) { if (objects[i].CollisionsWith(player)) { score += 100; objects[i].Hide(); } } }
// Check input by the user public void CheckKeys() { if (Hardware.KeyPressed(Hardware.KEY_UP)) { if (Hardware.KeyPressed(Hardware.KEY_RIGHT)) { player.JumpRight(); } else if (Hardware.KeyPressed(Hardware.KEY_LEFT)) { player.JumpLeft(); } else { player.Jump(); } } else if (Hardware.KeyPressed(Hardware.KEY_RIGHT)) { player.MoveRight(); } else if (Hardware.KeyPressed(Hardware.KEY_LEFT)) { player.MoveLeft(); } //if (Hardware.KeyPressed(Hardware.KEY_DOWN)) // player.MoveDown(); if (Hardware.KeyPressed(Hardware.KEY_F) && !(shoot.IsVisible())) { if (player.GetCurrentDirection() == Sprite.RIGHT) { shoot.Appear(player.GetX() + 20, player.GetY() + 20, 20); } //shoot.Enqueue(player.GetX() + 20, player.GetY() + 20, 20); else { shoot.Appear(player.GetX() - 60, player.GetY() + 20, -20); } //shoot.Enqueue(player.GetX() + 20, player.GetY() + 20, 20); //player.LoadImage("data/ArthurTrowRight.png"); } // Shoot each time key F is pressed //if (Hardware.KeyPressed(Hardware.KEY_F)) //{ // // Make the spear appears // shoot.Add(new Shoot()); // shoot[shoot.Count - 1].Appear(player.GetX(),player.GetY(),player.GetSpeedX()); //} if (Hardware.KeyPressed(Hardware.KEY_ESC)) { finished = true; } // Hacks, move directly to the boss //if (Hardware.KeyPressed(Hardware.KEY_H)) //{ //player.SetX(6300); //player.SetY(400); //Hardware.ScrollTo(6300,0); //} }
/// <summary> /// Use WMI to get the DateTime the current user logged on. /// <para>NOTE: Depending on Windows permissions settings, this may only work when the app is run as an administrator (i.e. the app has elevated privileges).</para> /// <para>Otherwise a ManagementException will be thrown.</para> /// </summary> /// <exception cref="System.Management.ManagementException">Thrown when the current user does not have sufficient privileges to read the WMI Win32_Session class.</exception> public static DateTime?GetLastLoginDateTime() { return(Hardware.GetWmiPropertyValueAsDateTime("SELECT * FROM Win32_Session", "StartTime")); }
/// <summary> /// Steuerung der Aktivierung der Programmzeitschrift. /// </summary> /// <param name="device">Das aktuell verwendete DVB.NET Gerät.</param> private void CollectProgramGuide( Hardware device ) { // Not necessary if (!EPGProgress.HasValue) return; // Be safe try { // Load interval once if (!EPGItemCountCheckInterval.HasValue) try { // Load setting string interval = ConfigurationManager.AppSettings["CardServerProgramGuideCountCheckInterval"]; // Load data uint value; if (!string.IsNullOrEmpty( interval )) if (uint.TryParse( interval, out value )) if ((value > 0) && (value < int.MaxValue)) EPGItemCountCheckInterval = (int) value; } finally { // Load default if (!EPGItemCountCheckInterval.HasValue) EPGItemCountCheckInterval = 10; } // Time since we last checked the item count TimeSpan countDelta = DateTime.UtcNow - m_EPGLastItemCheck; // Must recheck if (countDelta.TotalSeconds >= EPGItemCountCheckInterval.Value) if (m_EPGLastItemCount == m_EPGItemCount) { // Early stop m_EPGLastTune = DateTime.MinValue; } else { // Remember item count m_EPGLastItemCheck = DateTime.UtcNow; m_EPGLastItemCount = m_EPGItemCount; } // Read the interval since the last tune TimeSpan delta = DateTime.UtcNow - m_EPGLastTune; // Check for change interval if (delta.TotalSeconds < 60) return; // Always shut down receivers device.SelectGroup( null, null ); // Get the current state int total = m_EPGGroups.Count, left = m_EPGPending.Count; // Set the progress value if (total < 1) EPGProgress = 1; else EPGProgress = 1.0 * (total - left) / total; // See if we are fully done if (left < 1) return; // Load next GroupKey next = m_EPGPending[0]; // Remove from list m_EPGPending.RemoveAt( 0 ); // Tune to transponder device.SelectGroup( next.Location, next.Group ); // See if there is something on this group if (null == device.GetGroupInformation( 5000 )) { // Push back m_EPGPending.Add( next ); // Next after a short delay return; } // Add standard EPG device.AddProgramGuideConsumer( OnStandardEPGEvent ); // Check PREMIERE Direct if (0 != (m_EPGExtensions & EPGExtensions.PREMIEREDirect)) foreach (SourceSelection selection in Profile.FindSource( DirectCIT.TriggerSource )) if (Equals( selection.Location, device.CurrentLocation )) if (Equals( selection.Group, device.CurrentGroup )) { // Register device.SetConsumerState( device.AddConsumer<DirectCIT>( OnPremiereEPGEvent ), true ); // Did it break; } // Check PREMIERE Sport if (0 != (m_EPGExtensions & EPGExtensions.PREMIERESport)) foreach (SourceSelection selection in Profile.FindSource( SportCIT.TriggerSource )) if (Equals( selection.Location, device.CurrentLocation )) if (Equals( selection.Group, device.CurrentGroup )) { // Register device.SetConsumerState( device.AddConsumer<SportCIT>( OnPremiereEPGEvent ), true ); // Did it break; } // Check FreeSat UK if (0 != (m_EPGExtensions & EPGExtensions.FreeSatUK)) foreach (SourceSelection selection in Profile.FindSource( EIT.FreeSatEPGTriggerSource )) if (Equals( selection.Location, device.CurrentLocation )) if (Equals( selection.Group, device.CurrentGroup )) { // Register Guid consumerId = device.AddConsumer<EIT>( EIT.FreeSatEPGPID, OnStandardEPGEvent ); device.SetConsumerState( consumerId, true ); // Did it break; } // Reset time m_EPGLastTune = DateTime.UtcNow; // Remember item count m_EPGLastItemCheck = DateTime.UtcNow; m_EPGLastItemCount = m_EPGItemCount; } catch { // Just go on } }
private double CalculateScore(Hardware current, List <Hardware> allOther) { List <double> score = new List <double>(); var transactionsDb = m_transactionContext.Transactions.ToList(); var currentTransactions = transactionsDb.Where(x => x.Phone == current.PhoneModel).ToList(); int currentPrice = 0; if (currentTransactions.Count > 23) { currentPrice = (int)currentTransactions.Select(x => x.Price).Average(); } foreach (Hardware other in allOther) { List <double> oneToOneScore = new List <double>(); var otherTransactions = transactionsDb.Where(x => x.Phone == other.PhoneModel).ToList(); var otherPrice = 0; if (otherTransactions.Count > 23) { otherPrice = (int)otherTransactions.Select(x => x.Price).Average(); } if (currentPrice != 0 && otherPrice != 0) { var difference = PercentDiff(currentPrice, otherPrice); if (difference > 0) { oneToOneScore.Add(50); } else { oneToOneScore.Add(-50); } } int mainStorage = current.InternalStorageSpace; int compStorage = other.InternalStorageSpace; oneToOneScore.Add(PercentDiff(mainStorage, compStorage)); int mainCpuCount = current.ProcessorCoreCount; int compCpuCount = other.ProcessorCoreCount; oneToOneScore.Add(PercentDiff(mainCpuCount, compCpuCount)); double mainCpuSpeed = current.ProcessorCoreSpeed; double compCpuSpeed = other.ProcessorCoreSpeed; oneToOneScore.Add(PercentDiff(mainCpuSpeed, compCpuSpeed)); int mainRam = current.RAM; int compRam = other.RAM; oneToOneScore.Add(PercentDiff(mainRam, compRam)); int mainFrontCameraMgpx = current.FrontCameraMegapixel; int compFrontCameraMgpx = other.FrontCameraMegapixel; oneToOneScore.Add(PercentDiff(mainFrontCameraMgpx, compFrontCameraMgpx)); int mainBackCameraMgpx = current.RearCameraMegapixel; int compBackCameraMgpx = other.RearCameraMegapixel; oneToOneScore.Add(PercentDiff(mainBackCameraMgpx, compBackCameraMgpx)); int mainRearCamera = current.RearCameraCount; int compRearCameraMgpx = other.RearCameraCount; oneToOneScore.Add(PercentDiff(mainRearCamera, compRearCameraMgpx)); // Adds a hardware-to-hardware score for the current phone. score.Add(oneToOneScore.Average()); } var finalScore = score.Average(); if (finalScore < 0) { return(0); } else { return((int)score.Average()); } }
public Hardware Create(Hardware hardware) { _applicationDbContext.Hardwares.Add(hardware); _applicationDbContext.SaveChanges(); return(hardware); }
public Screen(Hardware hardware) { this.hardware = hardware; }
public NVMeSensor(string name, int index, bool defaultHidden, SensorType sensorType, Hardware hardware, ISettings settings, GetSensorValue getValue) : base(name, index, defaultHidden, sensorType, hardware, null, settings) { _getValue = getValue; }
public void Update(IVisitor visitor) { Hardware.Accept(visitor); }
public NumaNode(Hardware hw, int id) { Cores = new List <Core>(); NodeId = id; _hw = (Amd17Cpu)hw; }
public AddMainGroupVM() { addedMainGroup = new MainGroup(); addedHardware = new Hardware(); }
private void _DeviceManager_DeviceAdded(Hardware.Device device) { if (device is Hardware.Devices.DiskDevice) { try { FileSystemManager.InitDisk((Hardware.Devices.DiskDevice)device); FileSystemManager.InitPartitions(); } catch { if (!(ExceptionMethods.CurrentException is FOS_System.Exceptions.NotSupportedException) && !(ExceptionMethods.CurrentException is Hardware.Exceptions.NoDiskException)) { console.ErrorColour(); console.WriteLine("Error initialising disk device:"); console.WriteLine(ExceptionMethods.CurrentException.Message); console.DefaultColour(); } } } else if (device is Hardware.PCI.PCIDeviceNormal) { try { Hardware.USB.USBManager.CheckDeviceForHCI((Hardware.PCI.PCIDeviceNormal)device); } catch { if (!(ExceptionMethods.CurrentException is FOS_System.Exceptions.NotSupportedException)) { console.ErrorColour(); console.WriteLine("Error initialising PCI device:"); console.WriteLine(ExceptionMethods.CurrentException.Message); console.DefaultColour(); } } } }
public void SetOutputs(EquipModel em) { float[] newTable = SetOut(); em.SetOutputs = Hardware.SetOutputs(newTable); }
/// <summary> /// Formats the specified using the specified partition informations. /// </summary> /// <param name="aDisk">The disk to format.</param> /// <param name="partitionInfos">The partition informations to use for the format.</param> public static void FormatDisk(Hardware.Devices.DiskDevice aDisk, List partitionInfos) { //Necessary to remove any trace of GPT: // Overwrite first 256 sectors with 0s (should do the trick) aDisk.WriteBlock(0UL, 256U, null); #if MBR_TRACE BasicConsole.WriteLine("Creating new MBR data..."); #endif byte[] newMBRData = new byte[512]; newMBRData[0x1FE] = 0x55; newMBRData[0x1FF] = 0xAA; #if MBR_TRACE BasicConsole.WriteLine(((FOS_System.String)"Set signature: ") + newMBRData[0x1FE] + " " + newMBRData[0x1FF]); BasicConsole.DelayOutput(1); BasicConsole.WriteLine(((FOS_System.String)"Num new partitions: ") + partitionInfos.Count); BasicConsole.DelayOutput(1); #endif uint part1Offset = 0x1BE; for (uint i = 0; i < partitionInfos.Count; i++) { PartitionInfo partInfo = (PartitionInfo)partitionInfos[(int)i]; uint partOffset = part1Offset + (0x10 * i); #if MBR_TRACE BasicConsole.WriteLine(((FOS_System.String)"Partition ") + i + " @ " + partOffset); BasicConsole.WriteLine(((FOS_System.String)"Bootable : ") + partInfo.Bootable); BasicConsole.WriteLine(((FOS_System.String)"SystemID : ") + partInfo.SystemID); BasicConsole.WriteLine(((FOS_System.String)"StartSector : ") + partInfo.StartSector); BasicConsole.WriteLine(((FOS_System.String)"SectorCount : ") + partInfo.SectorCount); BasicConsole.DelayOutput(2); #endif //Bootable / active newMBRData[partOffset + 0] = (byte)(partInfo.Bootable ? 0x81 : 0x00); //System ID newMBRData[partOffset + 4] = partInfo.SystemID; //Start sector newMBRData[partOffset + 8] = (byte)(partInfo.StartSector); newMBRData[partOffset + 9] = (byte)(partInfo.StartSector >> 8); newMBRData[partOffset + 10] = (byte)(partInfo.StartSector >> 16); newMBRData[partOffset + 11] = (byte)(partInfo.StartSector >> 24); //Sector count newMBRData[partOffset + 12] = (byte)(partInfo.SectorCount); newMBRData[partOffset + 13] = (byte)(partInfo.SectorCount >> 8); newMBRData[partOffset + 14] = (byte)(partInfo.SectorCount >> 16); newMBRData[partOffset + 15] = (byte)(partInfo.SectorCount >> 24); #if MBR_TRACE BasicConsole.WriteLine("Reading back data..."); byte bootable = newMBRData[partOffset + 0]; byte systemID = newMBRData[partOffset + 4]; UInt32 startSector = ByteConverter.ToUInt32(newMBRData, partOffset + 8); UInt32 sectorCount = ByteConverter.ToUInt32(newMBRData, partOffset + 12); BasicConsole.WriteLine(((FOS_System.String)"Bootable : ") + bootable); BasicConsole.WriteLine(((FOS_System.String)"SystemID : ") + systemID); BasicConsole.WriteLine(((FOS_System.String)"StartSector : ") + startSector); BasicConsole.WriteLine(((FOS_System.String)"SectorCount : ") + sectorCount); BasicConsole.DelayOutput(2); #endif } #if MBR_TRACE BasicConsole.WriteLine("Writing data..."); #endif aDisk.WriteBlock(0UL, 1U, newMBRData); #if MBR_TRACE BasicConsole.WriteLine("Data written."); BasicConsole.DelayOutput(1); #endif aDisk.CleanCaches(); }
public void MarkAsModified(Hardware item) { }
public PrimaryVolumeDescriptor(Hardware.Devices.DiskDevice disk, uint startBlock, uint numBlocks, byte[] data) : base(disk, startBlock, numBlocks, data) { SystemIdentifier = ByteConverter.GetASCIIStringFromASCII(data, 8, 32); VolumeIdentifier = ByteConverter.GetASCIIStringFromASCII(data, 40, 32); VolumeSpaceSize = ByteConverter.ToUInt32(data, 80); VolumeSetSize = ByteConverter.ToUInt16(data, 120); VolumeSequenceNumber = ByteConverter.ToUInt16(data, 124); LogicalBlockSize = ByteConverter.ToUInt16(data, 128); PathTableSize = ByteConverter.ToUInt32(data, 132); Location_PathTable_TypeL = ByteConverter.ToUInt32(data, 140); Location_PathTable_Optional_TypeL = ByteConverter.ToUInt32(data, 144); RootDirectory = new DirectoryRecord(data, 156, true); VolumeSetIdentifier = ByteConverter.GetASCIIStringFromASCII(data, 190, 128); PublisherIdentifier = ByteConverter.GetASCIIStringFromASCII(data, 318, 128); DataPreparerIdentifier = ByteConverter.GetASCIIStringFromASCII(data, 446, 128); ApplicationIdentifier = ByteConverter.GetASCIIStringFromASCII(data, 574, 128); CopyrightFileIdentifier = ByteConverter.GetASCIIStringFromASCII(data, 702, 38); AbstractFileIdentifier = ByteConverter.GetASCIIStringFromASCII(data, 740, 36); BibliographicFileIdentifier = ByteConverter.GetASCIIStringFromASCII(data, 776, 37); VolumeCreationDateTime = new DateTime(data, 813); VolumeModificationDateTime = new DateTime(data, 830); VolumeExpirationDateTime = new DateTime(data, 847); VolumeEffectiveDateTime = new DateTime(data, 864); FileStructureVersion = data[881]; }
// Check input by the user public void CheckKeys() { if ((Hardware.KeyPressed(Hardware.KEY_RIGHT)) && (currentLevel.IsValidMove( player.GetX() + player.GetSpeedX(), player.GetY(), player.GetX() + player.GetWidth() + player.GetSpeedX(), player.GetY() + player.GetHeight()))) { player.MoveRight(); Hardware.ScrollHorizontally((short)-player.GetSpeedX()); direction = 'R'; } if ((Hardware.KeyPressed(Hardware.KEY_LEFT)) && (currentLevel.IsValidMove( player.GetX() - player.GetSpeedX(), player.GetY(), player.GetX() + player.GetWidth() - player.GetSpeedX(), player.GetY() + player.GetHeight()))) { player.MoveLeft(); Hardware.ScrollHorizontally((short)player.GetSpeedX()); direction = 'L'; } if ((Hardware.KeyPressed(Hardware.KEY_DOWN)) && (currentLevel.IsValidMove( player.GetX(), player.GetY() + player.GetSpeedY(), player.GetX() + player.GetWidth(), player.GetY() + player.GetHeight() + player.GetSpeedY()))) { player.MoveDown(); Hardware.ScrollVertically((short)-player.GetSpeedY()); direction = 'D'; } if ((Hardware.KeyPressed(Hardware.KEY_UP)) && (currentLevel.IsValidMove( player.GetX(), player.GetY() - player.GetSpeedY(), player.GetX() + player.GetWidth(), player.GetY() + player.GetHeight() - player.GetSpeedY()))) { player.MoveUp(); Hardware.ScrollVertically((short)player.GetSpeedY()); direction = 'U'; } if ((Hardware.KeyPressed(Hardware.KEY_SPC)) && (!myShot.IsVisible()) && (!shoting)) { if (direction == 'R') { myShot = new Shot(currentLevel, player.GetX(), player.GetY(), 10, 0); } if (direction == 'L') { myShot = new Shot(currentLevel, player.GetX(), player.GetY(), -10, 0); } if (direction == 'U') { myShot = new Shot(currentLevel, player.GetX(), player.GetY(), 0, -10); } if (direction == 'D') { myShot = new Shot(currentLevel, player.GetX(), player.GetY(), 0, 10); } } if (Hardware.KeyPressed(Hardware.KEY_ESC)) { finished = true; } }
public static HardwareDto MapBackToDto(Hardware hardware) { return(Mapper.Map <Hardware, HardwareDto>(hardware)); }
public void AttachHardware(Hardware h, params byte[] ports) { foreach (var port in ports) HARDWARE[port] = h; }
public ActionResult Eliminar(Hardware hardware) { _HardwareBL.EliminarHardware(hardware.Id); return(RedirectToAction("Index")); }
public GameScreen(Hardware hardware) : base(hardware) { Console.WriteLine("Game screen created"); }
/// <summary> /// Beginnt mit der Sammlung der Daten für die elektronische Programmzeitschrift /// (EPG). /// </summary> /// <param name="device">Das zu verwendende DVB.NET Gerät.</param> /// <param name="sources">Die zu berücksichtigenden Quellen.</param> /// <param name="extensions">Spezielle Zusatzfunktionalitäten der Sammlung.</param> private void StartEPGCollection( Hardware device, SourceIdentifier[] sources, EPGExtensions extensions ) { // Check mode if (EPGProgress.HasValue) CardServerException.Throw( new EPGActiveFault() ); if (m_ScanProgress >= 0) CardServerException.Throw( new SourceUpdateActiveFault() ); // Reset lists m_EPGSources.Clear(); m_EPGGroups.Clear(); // Load all identifiers to scan if (null != sources) foreach (SourceIdentifier source in sources) AddEPGSource( source ); // Add specials if (0 != (extensions & EPGExtensions.PREMIEREDirect)) if (AddEPGGroup( DirectCIT.TriggerSource ).Length < 1) extensions &= ~EPGExtensions.PREMIEREDirect; if (0 != (extensions & EPGExtensions.PREMIERESport)) if (AddEPGGroup( SportCIT.TriggerSource ).Length < 1) extensions &= ~EPGExtensions.PREMIERESport; if (0 != (extensions & EPGExtensions.FreeSatUK)) if (AddEPGGroup( EIT.FreeSatEPGTriggerSource ).Length < 1) extensions &= ~EPGExtensions.FreeSatUK; // Stop all RemoveAll(); // Prepare m_EPGPending = new List<GroupKey>( m_EPGGroups.Keys ); m_EPGLastItemCheck = DateTime.MaxValue; m_EPGLastTune = DateTime.MinValue; m_EPGLastItemCount = -1; m_EPGItems.Clear(); m_EPGItemCount = 0; // Mark as active m_EPGExtensions = extensions; EPGProgress = 0; // Enforce start CollectProgramGuide( device ); }
/// <summary> /// Prüft, ob auf allen Datenströmen etwas empfangen wird. /// </summary> /// <param name="device">Die verwendete Hardware.</param> private void TestForRestart(Hardware device) { // No active group if (device.CurrentGroup == null) { return; } // Get the group information var info = device.GetGroupInformation(15000); if (info == null) { // See if we are already out of retries if (GroupRestart >= 3) { return; } // See if we are waiting long enough if ((DateTime.UtcNow - m_LastGroupInfoTime) <= m_GroupWatchDogInterval) { return; } // Prepare to restart all streams foreach (var stream in Streams.Values) { try { // Stop it stream.Close(); } catch { // Ignore any error } } // Count the restart m_LastGroupInfoTime = DateTime.UtcNow; GroupRestart += 1; // Get the current settings var location = device.CurrentLocation; var group = device.CurrentGroup; // Detach from source group device.SelectGroup(null, null); // Reactivate source group device.SelectGroup(location, group); // Done - code following will try to restart all streams return; } // Remember time m_LastGroupInfoTime = DateTime.UtcNow; // Check for any decrypted channel foreach (var stream in Streams.Values) { stream.TestDecryption(m_DecryptionWatchDogInterval); } }
public static SystemCallResults StartThread(Hardware.Processes.ThreadStartMethod startMethod, out uint NewThreadId) { uint Return1 = 0; uint Return2 = 0; uint Return3 = 0; uint Return4 = 0; Call(SystemCallNumbers.StartThread, (uint)Utilities.ObjectUtilities.GetHandle(startMethod), 0, 0, ref Return1, ref Return2, ref Return3, ref Return4); NewThreadId = (uint)Return2; return (SystemCallResults)Return1; }
/// <summary> /// Initialises a new GPT and attempts to read its information from the specified disk. /// </summary> /// <param name="disk">The disk to read the GPT from.</param> public GPT(Hardware.Devices.DiskDevice disk) { #if GPT_TRACE BasicConsole.WriteLine("Checking for GPT..."); BasicConsole.DelayOutput(1); #endif //Assumed block size of 512. uint blockSize = 512; //Note: The GPT format specifies a protective MBR entry (1 partition // covering the entire disk) immediately followed (byte-wise) // by the GPT. Thus the GPT must come at 512th byte. // However, some disks can have 4096 bytes per sector (/block) // so the code below might break as reading LBA 1 (2nd LBA) would // return the wrong data. We probably ought to find some way to // check the block size and just load the required amount of data. //Check for single MBR partition with 0xEE system ID byte[] blockData = new byte[blockSize]; //Read the first sector of data. disk.ReadBlock(0UL, 1U, blockData); //Attempt to read the MBR MBR TheMBR = new MBR(blockData); //If the MBR isn't valid, the protective MBR partition specified as part of GPT // isn't present / valid so this isn't a valid GPT. if (!TheMBR.IsValid) { #if GPT_TRACE BasicConsole.WriteLine("MBR invalid."); BasicConsole.DelayOutput(1); #endif return; } //Or, if there is not one and only one partition in the MBR then the // protective MBR isn't valid so this isn't a valid GPT else if (TheMBR.NumPartitions != 1) { #if GPT_TRACE BasicConsole.WriteLine("No partitions in MBR."); BasicConsole.DelayOutput(1); #endif return; } //Or, the first (/only) partition entry has the wrong ID. 0xEE is the partition // ID for a GOT formatted MBR partition. else if (TheMBR.Partitions[0].SystemID != 0xEE) { #if GPT_TRACE BasicConsole.WriteLine(((FOS_System.String)"MBR partition 0 system ID not GPT. ") + TheMBR.Partitions[0].SystemID); BasicConsole.DelayOutput(1); #endif return; } #if GPT_TRACE BasicConsole.WriteLine("GPT MBR partition detected."); BasicConsole.DelayOutput(1); #endif //Now we know this is very-likely to be GPT formatted. // But we must check the GPT header for signature etc. //Read the GPT block disk.ReadBlock(1UL, 1U, blockData); //Check for GPT signature: 0x45 0x46 0x49 0x20 0x50 0x41 0x52 0x54 bool OK = blockData[0] == 0x45; OK = OK && blockData[1] == 0x46; OK = OK && blockData[2] == 0x49; OK = OK && blockData[3] == 0x20; OK = OK && blockData[4] == 0x50; OK = OK && blockData[5] == 0x41; OK = OK && blockData[6] == 0x52; OK = OK && blockData[7] == 0x54; //If any part of the ID was wrong, this is not a valid GPT. if (!OK) { #if GPT_TRACE BasicConsole.WriteLine("GPT signature invalid."); BasicConsole.DelayOutput(1); #endif return; } //Now we know, this is a valid GPT. Whether or not the actual entries are valid // is yet to be determined. There is of course the small chance that some other // data has conflicted with GPT data and that this isn't a GPT, it just looks // like it. If that is the case, what idiot formatted the disk we are reading // because a conflict like that is impossible to detect without user input! IsValid = true; #if GPT_TRACE BasicConsole.WriteLine("Valid GPT detected."); BasicConsole.DelayOutput(5); #endif //Load-in GPT global data Revision = ByteConverter.ToUInt32(blockData, 8); HeaderSize = ByteConverter.ToUInt32(blockData, 12); HeaderCRC32 = ByteConverter.ToUInt32(blockData, 16); HeaderLBA = ByteConverter.ToUInt64(blockData, 24); HeaderBackupLBA = ByteConverter.ToUInt64(blockData, 32); FirstUsableLBAForPartitions = ByteConverter.ToUInt64(blockData, 40); LastUsableLBAForPartitions = ByteConverter.ToUInt64(blockData, 48); #if GPT_TRACE BasicConsole.WriteLine(((FOS_System.String)"Revision : ") + Revision); BasicConsole.WriteLine(((FOS_System.String)"Header size : ") + HeaderSize); BasicConsole.WriteLine(((FOS_System.String)"Header CRC32 : ") + HeaderCRC32); BasicConsole.WriteLine(((FOS_System.String)"Header LBA : ") + HeaderLBA); BasicConsole.WriteLine(((FOS_System.String)"Header Backup LBA : ") + HeaderBackupLBA); BasicConsole.WriteLine(((FOS_System.String)"First usable LBA for partitions : ") + FirstUsableLBAForPartitions); BasicConsole.WriteLine(((FOS_System.String)"Last usable LBA for partitions : ") + LastUsableLBAForPartitions); BasicConsole.DelayOutput(5); #endif //Load the disk ID DiskGUID = new byte[16]; DiskGUID[0] = blockData[56]; DiskGUID[1] = blockData[57]; DiskGUID[2] = blockData[58]; DiskGUID[3] = blockData[59]; DiskGUID[4] = blockData[60]; DiskGUID[5] = blockData[61]; DiskGUID[6] = blockData[62]; DiskGUID[7] = blockData[63]; DiskGUID[8] = blockData[64]; DiskGUID[9] = blockData[65]; DiskGUID[10] = blockData[66]; DiskGUID[11] = blockData[67]; DiskGUID[12] = blockData[68]; DiskGUID[13] = blockData[69]; DiskGUID[14] = blockData[70]; DiskGUID[15] = blockData[71]; //Load more global GPT data StartingLBAOfPartitionArray = ByteConverter.ToUInt64(blockData, 72); NumPartitionEntries = ByteConverter.ToUInt32(blockData, 80); SizeOfPartitionEntry = ByteConverter.ToUInt32(blockData, 84); PartitionArrayCRC32 = ByteConverter.ToUInt32(blockData, 88); #if GPT_TRACE BasicConsole.WriteLine(((FOS_System.String)"Start LBA of part arrray : ") + StartingLBAOfPartitionArray); BasicConsole.WriteLine(((FOS_System.String)"Num part entries : ") + NumPartitionEntries); BasicConsole.WriteLine(((FOS_System.String)"Size of part entry : ") + SizeOfPartitionEntry); BasicConsole.WriteLine(((FOS_System.String)"Part array CRC32 : ") + PartitionArrayCRC32); BasicConsole.DelayOutput(5); #endif ulong blockNum = StartingLBAOfPartitionArray; uint entriesPerBlock = blockSize / SizeOfPartitionEntry; #if GPT_TRACE BasicConsole.WriteLine("Reading partition entries..."); BasicConsole.WriteLine(((FOS_System.String)"blockNum=") + blockNum); BasicConsole.WriteLine(((FOS_System.String)"entriesPerBlock=") + entriesPerBlock); BasicConsole.DelayOutput(1); #endif //TODO: Check the CRC32 values of the header and partition table // are correct. //Note: By not checking the CRCs, we have the option to manually edit // the GPT without rejecting it if CRCs end up incorrect. //TODO: Add an override option to ignore the CRCs //TODO: Add a method to update / correct the CRCs //Read partition infos for(uint i = 0; i < NumPartitionEntries; i++) { //If we're on a block boundary, we need to load the next block // of data to parse. if (i % entriesPerBlock == 0) { #if GPT_TRACE BasicConsole.WriteLine("Reading block data..."); BasicConsole.WriteLine(((FOS_System.String)"blockNum=") + blockNum); BasicConsole.DelayOutput(1); #endif //Load the next block of data disk.ReadBlock(blockNum++, 1u, blockData); } //Calculate the offset into the current data block uint offset = (i % entriesPerBlock) * SizeOfPartitionEntry; #if GPT_TRACE BasicConsole.WriteLine("Reading entry..."); BasicConsole.WriteLine(((FOS_System.String)"offset=") + offset); #endif //Attempt to load the partition info PartitionInfo inf = new PartitionInfo(blockData, offset, SizeOfPartitionEntry); //Partitions are marked as empty by an all-zero type ID. If the partition is empty, // there is no point adding it. if (!inf.Empty) { #if GPT_TRACE BasicConsole.WriteLine("Entry not empty."); #endif //Add the non-empty partition Partitions.Add(inf); } #if GPT_TRACE else { BasicConsole.WriteLine("Entry empty."); } #endif } }
/// <summary> /// Get the name of the PictureBox which representes a selected hardware item. /// </summary> /// <param name="hardware">The selected hardware item.</param> /// <returns>The name of the PictureBox which represents the hardware.</returns> private string GetHardwarePictureBoxName(Hardware hardware) { switch (hardware) { case Hardware.SorterRobot: return this.imgSorterRobot.Name; case Hardware.AssemblerRobot: return this.imgAssemblerRobot.Name; case Hardware.LoaderRobot: return this.imgLoaderRobot.Name; case Hardware.PalletiserRobot: return this.imgPalletiserRobot.Name; case Hardware.SorterCamera: return this.imgSorterCamera.Name; case Hardware.TrayVerifierCamera: return this.imgAssemblerCamera.Name; case Hardware.SorterConveyor: return this.imgSorterConveyor.Name; case Hardware.AssemblyConveyor: return this.imgAssemblyConveyor.Name; default: return ""; } }
/// <summary> /// /// </summary> /// <param name="hd"></param> private void CreateDevices(Hardware hd) { // device // foreach (IDPU dpu in this.DPUs) { IDeviceSourceProvider deviceSourceProvider = dpu.DeviceSourceProvider; deviceSourceProvider.SourceConfigs = this.SourceConfigs; IDeviceSource[] deviceSources = deviceSourceProvider.GetDeviceSources(); foreach (IDeviceSource deviceSource in deviceSources) { IDeviceFactory factory = dpu.DeviceFactory; IDevice device = factory.Create(deviceSource); device.DeviceSource = deviceSource; // find station by device // Guid stationGuid = deviceSource.StationGuid; IStation station = hd.Stations.Find(stationGuid); if (station == null) { string s = string.Format("not find station by guid '{0}'", stationGuid); throw new Exception(s); } station.Devices.Add(device); device.Station = station; ITaskFactory taskFactory = dpu.TaskFactory; taskFactory.Create(device); } } }
public JsonConfiguration() { m_CurrentHardware = ApplicationEnv.Instance.CurrentHardware; }
/// <summary> /// Experiment type is for code that needs to know what experiment it's running on. /// </summary> //public static String ExperimentType; /// <summary> /// Initialise the environment. This code switches on computer name and /// sets up the environment accordingly. /// </summary> static Environs() { String computerName = (String)System.Environment.GetEnvironmentVariables()["COMPUTERNAME"]; switch (computerName) { case "PH-DK902": Hardware = new EDMHardware(); FileSystem = new PhkaraFileSystem(); Debug = false; //ExperimentType = "edm"; break; case "CRASH1": Hardware = new DecelerationHardware(); FileSystem = new CrashFileSystem(); Debug = false; //ExperimentType = "decelerator"; break; case "SCHNAPS": Hardware = new DecelerationHardware(); FileSystem = new SchnapsFileSystem(); //ExperimentType = "decelerator"; Info.Add("SwitchSequenceCode", "SwitchSequenceV1`"); Debug = false; break; case "SUNSHINE": Hardware = new DecelerationHardware(); FileSystem = new SunshineFileSystem(); //ExperimentType = "decelerator"; Info.Add("SwitchSequenceCode", "SwitchSequenceV1`"); Debug = false; break; case "CLAM": Hardware = new SympatheticHardware(); FileSystem = new ClamFileSystem(); Debug = true; Info.Add("SwitchSequenceCode", "WFSwitchSequenceV1`"); //ExperimentType = "decelerator"; break; case "CHROME1": Hardware = new EDMHardware(); FileSystem = new ChromeFileSystem(); Debug = false; //ExperimentType = "edm"; break; case "PIXIE": Hardware = new PXIEDMHardware(); FileSystem = new PixieFileSystem(); Debug = false; //ExperimentType = "edm"; break; case "PH-JKITE": Hardware = new EDMHardware(); FileSystem = new PHJKiteFileSystem(); Debug = true; //ExperimentType = "edm"; break; case "TURTLETAMER": Hardware = new EDMHardware(); FileSystem = new SealClubberFileSystem(); Debug = true; //ExperimentType = "edm"; break; //case "SEALCLUBBER": // Hardware = new DecelerationHardware(); // FileSystem = new SealClubberFileSystem(); // Debug = true; // ExperimentType = "decelerator"; // break; case "GANYMEDE0": Hardware = new SympatheticHardware(); FileSystem = new GanymedeFileSystem(); Debug = false; //ExperimentType = "lih"; Info.Add("SwitchSequenceCode", "WFSwitchSequenceV1`"); break; case "CARMELITE": Hardware = new BufferGasHardware(); FileSystem = new CarmeliteFileSystem(); Debug = false; //ExperimentType = "buffer"; break; case "YBF": Hardware = new EDMHardware(); FileSystem = new YBFFileSystem(); Debug = true; //ExperimentType = "edm"; break; case "PH-CDSLAP": Hardware = new BufferGasHardware(); FileSystem = new PHCDSLapFileSystem(); Debug = true; //ExperimentType = "edm"; break; case "RAINBOW": Hardware = new RainbowHardware(); FileSystem = new RainbowFileSystem(); Debug = false; break; case "PH-REQUIEM": Hardware = new PXISympatheticHardware(); FileSystem = new RequiemFileSystem(); Debug = false; break; case "PH-RAGNAROK": Hardware = new SympatheticHardware(); FileSystem = new RagnarokFileSystem(); Debug = false; break; case "PH-RHENDRIC0": Hardware = new BufferGasHardware(); FileSystem = new PHRHENDRIC0FileSystem(); Debug = false; break; case "PH-RHENDRIC-02": Hardware = new BufferClassicHardware(); FileSystem = new PHRHENDRIC02FileSystem(); Debug = false; break; case "PH-LAB10PC": Hardware = new SympatheticHardware(); FileSystem = new Lab10PCFileSystem(); Debug = false; break; case "PH-ST1809": Hardware = new EDMHardware(); FileSystem = new FileSystem(); Debug = false; break; case "PH-LAB10A": Hardware = new EDMHardware(); FileSystem = new FileSystem(); Debug = false; break; default: Hardware = new EDMHardware(); FileSystem = new FileSystem(); Debug = true; //ExperimentType = "edm"; break; } }
public Game() { font18 = new Font("data/Joystix.ttf", 18); player = new Player(); shoting = false; Hardware.ScrollTo((short)(512 - (player.GetX())), (short)(384 - player.GetY())); //Centering scroll to the character Random rnd = new Random(); numEnemies = 2; Enemy enemy; for (int i = 0; i < numEnemies; i++) { enemy = new Enemy(rnd.Next(200, 800), rnd.Next(50, 600), this); enemies.Add(enemy); } currentLevel = new Level(); finished = false; myShot = new Shot(currentLevel, player.GetX(), player.GetY(), 0, 0); myShot.Hide(); direction = 'R'; score = 0; //create object into level Door newDoor; Key newKey; Food newFood; Generator newGenerator; for (int row = 0; row < currentLevel.GetlevelHeight(); row++) { for (int col = 0; col < currentLevel.GetLevelWidth(); col++) { int xPos = currentLevel.GetLeftMargin() + col * currentLevel.GetTileWidth(); int yPos = currentLevel.GetTopMargin() + row * currentLevel.GetTileHeight(); switch (currentLevel.GetLevelDescription(col, row)) { // Q = key case 'Q': newKey = new Key(xPos, yPos); currentLevel.SetSpacePosition(row, col); keys.Add(newKey); break; case '[': newDoor = new Door(xPos, yPos, 'V'); doors.Add(newDoor); break; case '_': newDoor = new Door(xPos, yPos, 'H'); doors.Add(newDoor); break; case 'F': newFood = new Food(xPos, yPos); foods.Add(newFood); break; case 'G': newGenerator = new Generator(xPos, yPos, this); generators.Add(newGenerator); break; } } } start = DateTime.Now; }
public void RegisterHardware(List <string> args) { Hardware hardware = this.hardwareFactory.CreateHardware(args); this.hardwares[hardware.Name] = hardware; }
internal void SaveVotes(Hardware.KeyStatusValues keyStatusValues, int slideId) { var q = GetQuestionSlideConfiguration(slideId); var array = (new string[10] { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J" }).ToList(); foreach (var vote in keyStatusValues.GetValues()) { int index = array.IndexOf(vote.Value.KeyValue); if (index < q.Answers.Count) { q.Answers[index].VotesCount++; q.Answers[index].Votes.Add(new Hardware.VotesFlat(vote)); if (q.Answers[index].Time < vote.Value.Keytime) q.Answers[index].Time = vote.Value.Keytime; } } q.HasVotes = true; UpdateResults(q.SlideId); }
public void PauseTillNextFrame() { // Pause till next frame (20 ms = 50 fps) Hardware.Pause(20); }
/// <summary> /// /// </summary> /// <returns></returns> public Hardware Create() { VerifySPUs(); VerifyDPUs(); Hardware hd = new Hardware(); CreateStations(hd); CreateDevices(hd); return hd; }
public CreditsScreen(Hardware hardware, GameController languageController) : base(hardware, languageController) { }
private void CreateStations(Hardware hd) { // foreach (ISPU spu in SPUs) { IStationSourceProvider sourceProvider = spu.StationSourceProvider; if (sourceProvider == null) { } sourceProvider.SourceConfigs = this.SourceConfigs; IStationSource[] stationSources = sourceProvider.GetStationSources(); foreach (IStationSource stationSource in stationSources) { IStationFactory factory = spu.StationFactory; IStation station = factory.Create(stationSource); station.StationSource = stationSource; hd.Stations.Add(station); } } }
public override void Show() { audio.PlayMusic(0, -1); spacePressed = false; index = 1; hardware.DrawImage(bakcGround); Draw(); do { hardware.UpdateScreen(); int keyPressed = hardware.KeyPressed(); /*Two conditions to equalize the joystick movement with the * keyboard pulsations*/ if (Hardware.JoystickMovedUp()) { keyPressed = Hardware.KEY_UP; Thread.Sleep(70); } else if (Hardware.JoystickMovedDown()) { keyPressed = Hardware.KEY_DOWN; Thread.Sleep(70); } if (Hardware.JoystickPressed(0)) { keyPressed = Hardware.KEY_SPACE; Thread.Sleep(70); } else if (Hardware.JoystickPressed(1)) { keyPressed = Hardware.KEY_ESC; Thread.Sleep(70); } if (keyPressed == Hardware.KEY_UP && index < 1) { audio2.PlayWAV(0, 1, 0); hardware.ClearScreen(); index++; hardware.DrawImage(bakcGround); Draw(); } if (keyPressed == Hardware.KEY_DOWN && index > -(scoreList.Count - 15)) { audio2.PlayWAV(0, 1, 0); hardware.ClearScreen(); index--; hardware.DrawImage(bakcGround); Draw(); } if (keyPressed == Hardware.KEY_SPACE || keyPressed == Hardware.KEY_ESC) { spacePressed = true; } Thread.Sleep(10); } while (spacePressed != true); audio.StopMusic(); }