public SimpleSimulator() { Memory = new Memory(); Registers = new Registers(); Machine = new Machine(Memory, Registers); Assembler = new Assembler(); }
public void CompileArithModule() { Machine machine = new Machine(); CompileModuleFunction func = new CompileModuleFunction(machine); var result = func.Apply(machine.RootContext, new object[] { new Atom("arith") }); Assert.IsNotNull(result); Assert.IsInstanceOfType(result, typeof(Tuple)); var tuple = (Tuple)result; Assert.AreEqual(2, tuple.Arity); var elem1 = tuple.ElementAt(0); Assert.IsNotNull(elem1); Assert.IsInstanceOfType(elem1, typeof(Atom)); Assert.AreEqual("ok", ((Atom)elem1).Name); var elem2 = tuple.ElementAt(1); Assert.IsNotNull(elem2); Assert.IsInstanceOfType(elem2, typeof(Atom)); Assert.AreEqual("arith", ((Atom)elem2).Name); var result2 = machine.RootContext.GetValue("arith"); Assert.IsNotNull(result2); Assert.IsInstanceOfType(result2, typeof(Module)); Assert.AreEqual("arith", ((Module)result2).Name); }
static string ToString(Machine machine) { switch (machine) { case Machine.I386: return "x86"; case Machine.AMD64: return "x64"; default: return machine.ToString(); } }
public static void Main(string[] args) { string thing = @"if 10 equals 10 then end"; var compiler = new Compiler.Compiler(thing); // ew ew ew double compiler ew var machine = new Machine(); System.Diagnostics.Stopwatch timer = new System.Diagnostics.Stopwatch(); try { timer.Start(); CompiledProgram program = compiler.Compile(); Console.WriteLine(program.ToString()); machine.Load(program); machine.Run(); } catch (EnglangException exp) { Console.WriteLine(exp.Message); } timer.Stop(); Console.WriteLine("Done. Time: {0}", timer.Elapsed.ToString("%m\\:ss\\.ffff")); Console.ReadLine(); }
public static void GenerateVertices(Machine machine, double x, double y) { eachSide = new List<int>(); vertices = new List<Vertex>(); shapeList = new List<FrameworkElement>(); edges = new List<Edge>(); canvasHeight = y; canvasWidth = x; myMachine = machine; int i; int count = myMachine.States.Count; int rest = count - (count / 4) * 4; // остаток int onEachSide = count / 4; // количество на каждой стороне for (i = 0; i < 4; i++) { eachSide.Add(onEachSide); } for (i = 0; i < rest; i++) { eachSide[i] += 1; } GenerateVertices(); GenerateEdges(); DrawVertices(); DrawEdges(); }
public void run() { cpu = new Processor(); computer = new Machine(); os = new Os(); disk = new Disk(); bean = new ComputerBean(); bean.computerName = computer.GetComputerName; bean.computerDomain = computer.GetWorkGroupName; bean.computerRole = computer.GetRole; bean.computerModel = computer.GetComputerModel; bean.memoryTotal = computer.GetMemory; bean.logonAccount = computer.GetUserName; bean.logonTime = computer.GetLogonTime; bean.cpuClock = cpu.GetCpuClock; bean.cpuInfo = cpu.GetCpuInfo; bean.osName = os.GetOS; bean.osVersion = os.GetOsVersion; bean.C_Total = disk.GetC_Total; bean.C_Used = disk.GetC_Used; bean.C_Free = disk.GetC_Free; bean.C_FreePercent = disk.GetC_FreePercent; }
private void AllocSquares(Machine machine) { int squaresNeeded = machine.Parts.Count - squares.Count; //Fetch needed squares for(int i = 0; i < squaresNeeded; i++) { GameObject square; if(squaresPool.Count == 0) { square = Object.Instantiate(SquarePrefab) as GameObject; } else { square = squaresPool.Dequeue(); square.SetActive(true); square.hideFlags = HideFlags.None; } square.transform.SetParent (this.transform, false); squares.Add (square); } //Release unneeded squares for(int i = 0; i < -squaresNeeded; i++) { GameObject square = squares[squares.Count - 1 - i]; squaresPool.Enqueue(square); square.SetActive(false); square.hideFlags = HideFlags.HideInHierarchy; square.transform.SetParent(null); } if(squaresNeeded < 0) { squares.RemoveRange (squares.Count + squaresNeeded, -squaresNeeded); } }
static void Main(string[] args) { //var machine = new Machine(new StateInactive()); var csv = "\"ciao\",\"dvdsovnso\"\r\n"; var machine = new Machine(new StateInitial()); foreach (var c in csv) { //Console.WriteLine(""); //Console.Write(c+" -> "); var output = machine.Process(c); if (machine.Current == State.Error){Console.WriteLine("ERRORE");Console.ReadLine();return;} if (output == null) continue; if (output is string){Console.WriteLine("{" + output + "}");} if (output is string[]){ var campi = (string[])output; Console.WriteLine("{" + string.Join(", ", campi) + "}"); Console.WriteLine();} } //Console.ReadLine(); Console.WriteLine(""); Console.WriteLine("Press any key to exit."); Console.ReadKey(); }
static void Main(string[] args) { var machine = new Machine(new StateInactive()); var output = machine.Command("Input_Begin", Command.Begin); Console.WriteLine(Command.Begin.ToString() + "-> State: " + machine.Current); Console.WriteLine(output); Console.WriteLine("-------------------------------------------------"); output = machine.Command("Input_Pause", Command.Pause); Console.WriteLine(Command.Pause.ToString() + "-> State: " + machine.Current); Console.WriteLine(output); Console.WriteLine("-------------------------------------------------"); output = machine.Command("Input_End", Command.End); Console.WriteLine(Command.End.ToString() + "-> State: " + machine.Current); Console.WriteLine(output); Console.WriteLine("-------------------------------------------------"); output = machine.Command("Input_Exit", Command.Exit); Console.WriteLine(Command.End.ToString() + "-> State: " + machine.Current); Console.WriteLine(output); Console.WriteLine("-------------------------------------------------"); Console.WriteLine(""); Console.WriteLine("Press any key to exit."); Console.ReadKey(); }
public void BuiltinFunctions() { Machine machine = new Machine(); Assert.IsNotNull(machine.Environment.GetValue("len")); Assert.IsInstanceOfType(machine.Environment.GetValue("len"), typeof(LenFunction)); Assert.IsNotNull(machine.Environment.GetValue("print")); Assert.IsInstanceOfType(machine.Environment.GetValue("print"), typeof(PrintFunction)); Assert.IsNotNull(machine.Environment.GetValue("range")); Assert.IsInstanceOfType(machine.Environment.GetValue("range"), typeof(RangeFunction)); Assert.IsNotNull(machine.Environment.GetValue("eval")); Assert.IsInstanceOfType(machine.Environment.GetValue("eval"), typeof(EvalFunction)); Assert.IsNotNull(machine.Environment.GetValue("exec")); Assert.IsInstanceOfType(machine.Environment.GetValue("exec"), typeof(ExecFunction)); Assert.IsNotNull(machine.Environment.GetValue("dir")); Assert.IsInstanceOfType(machine.Environment.GetValue("dir"), typeof(DirFunction)); Assert.IsNotNull(machine.Environment.GetValue("exit")); Assert.IsInstanceOfType(machine.Environment.GetValue("exit"), typeof(ExitFunction)); Assert.IsNotNull(machine.Environment.GetValue("id")); Assert.IsInstanceOfType(machine.Environment.GetValue("id"), typeof(IdFunction)); var globals = machine.Environment.GetValue("globals"); Assert.IsNotNull(globals); Assert.IsInstanceOfType(globals, typeof(ContextFunction)); var ctxfunction = (ContextFunction)globals; Assert.IsTrue(ctxfunction.IsGlobal); Assert.AreEqual("globals", ctxfunction.Name); var locals = machine.Environment.GetValue("locals"); Assert.IsNotNull(globals); Assert.IsInstanceOfType(globals, typeof(ContextFunction)); ctxfunction = (ContextFunction)locals; Assert.IsFalse(ctxfunction.IsGlobal); Assert.AreEqual("locals", ctxfunction.Name); }
/// <summary> /// Parses given input and executes its opcodes. /// </summary> /// <param name="input">The user's input, as a string.</param> /// <param name="machine">The machine in which to execute the input.</param> public static Variable[] Execute(Machine machine, string input) { var resultsDictionary = new Dictionary<string, Variable>(); var parser = new Parser( input, machine ); try { // Execute opcodes foreach(Opcode opcode in parser.Parse()) { Variable result = opcode.Execute(); if ( result != null && !( resultsDictionary.ContainsKey( result.Name.Value ) ) ) { resultsDictionary.Add( result.Name.Value, result ); } } } finally { machine.TDS.Collect(); } // Return the vector of results var toret = new Variable[ resultsDictionary.Count ]; resultsDictionary.Values.CopyTo( toret, 0 ); return toret; }
public AppleII(CoreComm comm, GameInfo game, byte[] rom, Settings settings) { GameInfoSet = new List<GameInfo>(); var ser = new BasicServiceProvider(this); ServiceProvider = ser; CoreComm = comm; _disk1 = rom; RomSet.Add(rom); _appleIIRom = comm.CoreFileProvider.GetFirmware( SystemId, "AppleIIe", true, "The Apple IIe BIOS firmware is required"); _diskIIRom = comm.CoreFileProvider.GetFirmware( SystemId, "DiskII", true, "The DiskII firmware is required"); _machine = new Machine(_appleIIRom, _diskIIRom); _machine.BizInitialize(); //make a writeable memory stream cloned from the rom. //for junk.dsk the .dsk is important because it determines the format from that InitDisk(); //trace logger stuff Tracer = new TraceBuffer(); ser.Register<ITraceable>(Tracer); InitSaveStates(); SetupMemoryDomains(); PutSettings(settings ?? new Settings()); }
private static void Main() { Console.SetWindowSize(Console.WindowWidth * 2, Console.WindowHeight * 2); bool correct = false; List<string> code = new List<string>(); Machine machine = null; while (!correct) { Console.WriteLine("Please enter your LMC commands one line at a time. When the program is complete, enter a blank line.\n"); //Code entering while (true) { string line = Console.ReadLine(); if (line == string.Empty) { break; } code.Add(line); } //If empty restart if (code.Count == 0) { Console.Clear(); continue; } Console.WriteLine("Is this program correct? Y/N"); //Check for Y and N key presses bool cont = true; while (true) { ConsoleKey key = Console.ReadKey().Key; if (key == ConsoleKey.Y) { Console.WriteLine("\n"); break; } if (key == ConsoleKey.N) { Console.Clear(); code = new List<string>(); cont = false; break; } Console.Write("\b \b"); } if (!cont) { continue; } //Verify if code is valid machine = new Machine(code); if (!machine.Compile()) { Console.WriteLine("Code is invalid, please reenter a valid LMC command code. Press nter to restart."); Console.ReadLine(); Console.Clear(); code = new List<string>(); } else { Console.WriteLine("\nCode is verified and valid, proceeding."); correct = true; } } //Run virtual machine machine.Run(); }
/// <summary> /// Jeu /// </summary> /// <param name="ficheJeuJVC">ficheJeuJVC</param> /// <param name="genre">genre</param> public Jeu(FicheJeuJVC ficheJeuJVC, Genre genre, Machine machine) : this() { this.Titre = ficheJeuJVC.Titre; this.Developpeur.Nom = ficheJeuJVC.Developpeur; this.Editeur.Nom = ficheJeuJVC.Editeur; if (!String.IsNullOrEmpty(ficheJeuJVC.DateSortie)) { if (ficheJeuJVC.DateSortie.Length == 4) { this.DateSortie = new DateTime(Int32.Parse(ficheJeuJVC.DateSortie), 1, 1); } else { this.DateSortie = DateTime.Parse(ficheJeuJVC.DateSortie); } } this.Synopsys = ficheJeuJVC.Description; this.LeGenre = genre; this.Photo = ficheJeuJVC.NomPhoto; this.LaMachine = machine; }
static void Main() { Machine computer = new Machine("Intel"); showProcess proc = computer.Process; proc = (showProcess)Delegate.Combine(proc, new showProcess(Process)); proc("pentium"); }
public MainForm() { uiForm = new Form(); uiForm.ClientSize = new Size(640, 400); uiForm.FormBorderStyle = FormBorderStyle.FixedSingle; uiForm.MaximizeBox = false; uiForm.StartPosition = FormStartPosition.CenterScreen; uiForm.Text = "C# x86 Emulator"; timerTicks = 0; machine = new Machine(uiForm); Application.ApplicationExit += ApplicationApplicationExit; breakpoints.ItemAdded += BreakpointsItemAdded; breakpoints.ItemDeleted += BreakpointsItemDeleted; InitializeComponent(); PrintRegisters(); machineThread = new Thread(RunMachine); running = true; machineThread.Start(); machine.Start(); SetCPULabel(machine.CPU.InstructionText); PrintRegisters(); }
public void Remove(Machine machine) { if (IdExists(machine)) { lookupTable.Remove(MachineAt(IndexOf(machine))); } }
private void RangeChanged(object sender, DateTime DateStart, DateTime DateEnd) { DataTable Controlos = SGCEBL.PGGET.GetCONTROLOSinputCODCOPERACAOandDATAINIandDATAFIM("01", DateStart, DateEnd); List<ProductOrder> Cntrls = new List<ProductOrder>(); foreach (Machine item in oCal.Machines) { item.Ordens.Clear(); } foreach (DataRow iRow in Controlos.Rows) { DateTime Ini = iRow.Field<DateTime>("Data Início"); DateTime Fim = iRow.Field<DateTime>("Data Fim"); String Maq = iRow.Field<string>("Equipamento"); String txt = iRow.Field<object>("OPP").ToString() + ":" + iRow.Field<string>("CODARTIGO"); ProductOrder po = Cntrls.Find(x => x.Equipamento == Maq && x.DateStart == Ini); if (po == null)Cntrls.Add(new ProductOrder(Maq + "_" + Cntrls.Count, txt, 0, Ini, Fim, 0, Maq)); else po.Text += "+" + txt; } foreach (ProductOrder po in Cntrls) { Machine CurMac = oCal.Machines.Find(x => x.Name == po.Equipamento); if (CurMac == null) { CurMac = new Machine(po.Equipamento); oCal.Machines.Add(CurMac); } po.ItemID = CurMac.Name + "_" + CurMac.Ordens.Count; CurMac.Ordens.Add(po); } oCal.oRefresh(); }
private void dgrRemoteDesktops_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex != -1) { if (e.ColumnIndex == 0) { Machine insMachine = new Machine(); insMachine = GetRemoteDesktop(dgrRemoteDesktops.Rows[e.RowIndex].Cells["clmnRemoteDesktopConnectionName"].Value.ToString()); frmSettings frmS = new frmSettings(insMachine); frmS.openedForEdit = true; frmS.ShowDialog(); LoadGridData(); } else if (e.ColumnIndex == 1) { if (MessageBox.Show("Are you sure that you want to delete this connection setting?", "Delete Remote Desktop Connection Setting", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1) != DialogResult.No) { DeleteRemoteDesktop(dgrRemoteDesktops.Rows[e.RowIndex].Cells["clmnRemoteDesktopConnectionName"].Value.ToString()); LoadGridData(); } } } }
// // Single Machine Sale // public void machineSale(Machine machine, Product product) { int transactionID = this.newTransactionID(); this.database.Append(new Transactions(transactionID, DateTime.Now, "Checking", product.Name, product.RetailPrice)); this.database.Append(new Transactions(transactionID, DateTime.Now, machine.MachineID, product.Name, product.WholeSalePrice)); machine.removeProduct(product); }
// //Transfer product in bulk into machine // public void TransferToMachine(Machine machine, List<Product> productList) { int transactionID = this.newTransactionID(); float totalCost = 0; string productName = productList[0].Name; int repeat = productList.Count() - 1; for (int i = repeat; i >= 0; --i) { totalCost += productList[i].WholeSalePrice; machine.addProduct(productList[i]); this.database.Remove(productList[i]); } // Update Pricing of new items float highestRetailPrice = 0; List<Product> searchForHighestPrice = machine.selectAllProductByType(productName); foreach (Product product in searchForHighestPrice) { if (product.RetailPrice > highestRetailPrice) { highestRetailPrice =product.RetailPrice; } } machine.updateRetailPrice(productName, highestRetailPrice); this.database.Append(new Transactions(transactionID, DateTime.Now, "Checking", productName, totalCost)); this.database.Append(new Transactions((transactionID + 1), DateTime.Now, machine.MachineID, productName, -totalCost)); }
private void imageLoadFile_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e) { OcultarComponentes(); ZeraComponanentes(); //botão para carregar o arquivo e exibir na tela Folder diretorio = new Folder(); if (diretorio.ConteudoLido) { MostrarComponanentes(); try { //inicializa a maquina virtual maquina = new Machine(diretorio.conteudo); maquina.inicializar(); // apos inicializar carrega o grid view LinhaComandoView linhaTabela; foreach (LinhaComando linha in maquina.LinhasComando) { linhaTabela = new LinhaComandoView(linha); DataGridInstrucoes.Items.Add(linhaTabela); } } catch (Exception error) { System.Windows.MessageBox.Show(error.Message, "Erro Com o Arquivo", MessageBoxButton.OK, MessageBoxImage.Error); } } }
public void ShutdownMethodTest() { _mockShutdownMethod.SetupSet(x => x.VirtualMachineProxy = _mockMachineProxy.Object).Verifiable(); Machine m = new Machine(_mockMachineProxy.Object); // TODO: Passenden Wert initialisieren m.ShutdownMethod = _mockShutdownMethod.Object; _mockShutdownMethod.VerifyAll(); }
public STM32LTDC(Machine machine) : base(machine) { Reconfigure(format: PixelFormat.RGBX8888); IRQ = new GPIO(); this.machine = machine; internalLock = new object(); var activeWidthConfigurationRegister = new DoubleWordRegister(this); accumulatedActiveHeightField = activeWidthConfigurationRegister.DefineValueField(0, 11, FieldMode.Read | FieldMode.Write, name: "AAH"); accumulatedActiveWidthField = activeWidthConfigurationRegister.DefineValueField(16, 12, FieldMode.Read | FieldMode.Write, name: "AAW", writeCallback: (_, __) => HandleActiveDisplayChange()); var backPorchConfigurationRegister = new DoubleWordRegister(this); accumulatedVerticalBackPorchField = backPorchConfigurationRegister.DefineValueField(0, 11, FieldMode.Read | FieldMode.Write, name: "AVBP"); accumulatedHorizontalBackPorchField = backPorchConfigurationRegister.DefineValueField(16, 12, FieldMode.Read | FieldMode.Write, name: "AHBP", writeCallback: (_, __) => HandleActiveDisplayChange()); var backgroundColorConfigurationRegister = new DoubleWordRegister(this); backgroundColorBlueChannelField = backgroundColorConfigurationRegister.DefineValueField(0, 8, FieldMode.Read | FieldMode.Write, name: "BCBLUE"); backgroundColorGreenChannelField = backgroundColorConfigurationRegister.DefineValueField(8, 8, FieldMode.Read | FieldMode.Write, name: "BCGREEN"); backgroundColorRedChannelField = backgroundColorConfigurationRegister.DefineValueField(16, 8, FieldMode.Read | FieldMode.Write, name: "BCRED", writeCallback: (_, __) => HandleBackgroundColorChange()); var interruptEnableRegister = new DoubleWordRegister(this); lineInterruptEnableFlag = interruptEnableRegister.DefineFlagField(0, FieldMode.Read | FieldMode.Write, name: "LIE"); var interruptClearRegister = new DoubleWordRegister(this); interruptClearRegister.DefineFlagField(0, FieldMode.Write, name: "CLIF", writeCallback: (old, @new) => { if(@new) IRQ.Unset(); }); interruptClearRegister.DefineFlagField(3, FieldMode.Write, name: "CRRIF", writeCallback: (old, @new) => { if(@new) IRQ.Unset(); }); lineInterruptPositionConfigurationRegister = new DoubleWordRegister(this).WithValueField(0, 11, FieldMode.Read | FieldMode.Write, name: "LIPOS"); var registerMappings = new Dictionary<long, DoubleWordRegister> { { (long)Register.BackPorchConfigurationRegister, backPorchConfigurationRegister }, { (long)Register.ActiveWidthConfigurationRegister, activeWidthConfigurationRegister }, { (long)Register.BackgroundColorConfigurationRegister, backgroundColorConfigurationRegister }, { (long)Register.InterruptEnableRegister, interruptEnableRegister }, { (long)Register.InterruptClearRegister, interruptClearRegister }, { (long)Register.LineInterruptPositionConfigurationRegister, lineInterruptPositionConfigurationRegister } }; localLayerBuffer = new byte[2][]; layer = new Layer[2]; for(var i = 0; i < layer.Length; i++) { layer[i] = new Layer(this, i); var offset = 0x80 * i; registerMappings.Add(0x84 + offset, layer[i].ControlRegister); registerMappings.Add(0x88 + offset, layer[i].WindowHorizontalPositionConfigurationRegister); registerMappings.Add(0x8C + offset, layer[i].WindowVerticalPositionConfigurationRegister); registerMappings.Add(0x94 + offset, layer[i].PixelFormatConfigurationRegister); registerMappings.Add(0x98 + offset, layer[i].ConstantAlphaConfigurationRegister); registerMappings.Add(0xAC + offset, layer[i].ColorFrameBufferAddressRegister); } registers = new DoubleWordRegisterCollection(this, registerMappings); registers.Reset(); HandlePixelFormatChange(); }
private static EnvironmentConfig Add( this EnvironmentConfig config, string applicationName, string logicalInstanceName, string machineName) { var app = config.Applications.SelectByName(applicationName); if (app == null) { app = new Application(applicationName); config.Applications.Add(app); } var logicalInstance = app.LogicalInstances.SelectByName(logicalInstanceName); if (logicalInstance == null) { logicalInstance = new LogicalInstance(logicalInstanceName); app.LogicalInstances.Add(logicalInstance); } var machine = logicalInstance.Machines.SelectByName(machineName); if (machine == null) { machine = new Machine(machineName); logicalInstance.Machines.Add(machine); } return config; }
public void AvoidDuplicatedInstanceVariable() { Machine machine = new Machine(); IClass cls = machine.CreateClass("TestClass"); cls.DefineInstanceVariable("x"); cls.DefineInstanceVariable("x"); }
public void Compile() { Machine machine = new Machine(); IClass cls = machine.CreateClass("TestClass"); cls.DefineInstanceVariable("x"); cls.DefineClassVariable("count"); Block block; block = new Method(cls, "x:"); block.CompileArgument("newX"); block.CompileGet("newX"); block.CompileGet("count"); block.CompileSet("x"); Assert.AreEqual(1, block.Arity); Assert.AreEqual(0, block.NoLocals); Assert.IsNotNull(block.ByteCodes); Assert.IsTrue(block.ByteCodes.Length > 0); BlockDecompiler decompiler = new BlockDecompiler(block); var result = decompiler.Decompile(); Assert.IsNotNull(result); Assert.AreEqual(3, result.Count); Assert.AreEqual("GetArgument newX", result[0]); Assert.AreEqual("GetClassVariable count", result[1]); Assert.AreEqual("SetInstanceVariable x", result[2]); }
/// <summary> /// InsertMachine /// </summary> /// <returns>Liste supports</returns> public int InsertMachine(Machine s) { int result = -1; CustomDataSource maDataSource = new CustomDataSource(Properties.Settings.Default.CHAINE_CONNEXION); try { maDataSource.StartGlobalTransaction(); result = maDataSource.ExecuterDML(REQUETE_AJOUTER_MACHINE, true, s.Code, s.Nom, s.Historique, s.Caracteristiques, s.DateSortie); maDataSource.CommitGlobalTransaction(); } catch (Exception ex) { maDataSource.RollBackGlobalTransaction(); throw ex; } finally { } return result; }
public Machine Clone() { Machine insMachine = new Machine(); insMachine.username = this.username; insMachine.domain = this.domain; insMachine.machine = this.machine; insMachine.password = this.password; insMachine.autoconnect = true; insMachine.connectionname = this.connectionname; insMachine.savepassword = true; insMachine.sharediskdrives = this.sharediskdrives; insMachine.shareprinters = this.shareprinters; insMachine.cachebitmaps = this.cachebitmaps; insMachine.colordepth = this.colordepth; insMachine.connected = false; insMachine.connecttoconsole = this.connecttoconsole; insMachine.displaythemes = this.displaythemes; insMachine.displaywallpaper = this.displaywallpaper; insMachine.fullscreen = false; insMachine.port = this.port; insMachine.protocol = this.protocol; insMachine.sharekeys = this.sharekeys; insMachine.shareports = this.shareports; insMachine.sharesmartcards = this.sharesmartcards; insMachine.sharesound = this.sharesound; insMachine.resolution = this.resolution; insMachine.inherit_settings = this.inherit_settings; insMachine.groupid = this.groupid; return insMachine; }
public FormCoffeVendingMachine() { _coffeMachine = new Machine(); _client = new Client(); InitializeComponent(); InitializeOthers(); }
public MockRegister(Machine machine) { this.machine = machine; }
protected NullRegistrationPointPeripheralContainer(Machine machine) { Machine = machine; }
protected SimpleContainer(Machine machine) : base() { this.machine = machine; }
public ZenithPanel(SqlServerConnector sqlserver, DataRow r, Machine inspMachine) { _sqlserver = sqlserver; CreateInspectionObject(r, inspMachine); }
public override IMatched <IObject> Execute(Machine machine, IObject value) => notMatched <IObject>();//new SkipTake(value).Matched<IObject>();
public static Characteristics GetCharacteristics(Characteristics characteristics, Machine machine) { if (machine == Machine.IA64 || machine == Machine.AMD64 || machine == Machine.ARM64) { characteristics &= ~Characteristics._32BitMachine; characteristics |= Characteristics.LargeAddressAware; } else { characteristics |= Characteristics._32BitMachine; } return(characteristics); }
private void OnMakingCanceled(params object[] msg) { Machine.SetCurrentState <CharacterIdleState>(); }
public override IMatched <IObject> Execute(Machine machine, INumeric x) => Boolean.BooleanObject(x.IsZero).Matched();
void Start() { control = transform.parent.GetComponent <Machine> (); }
public EFMGPIOPort(Machine machine) : base(machine, 6 * 16) { }
public LuaTransformer(Machine m) { this.m_M = m; }
public Arm(string cpuType, Machine machine, Endianess endianness = Endianess.LittleEndian) : base(cpuType, machine, endianness) { }
protected UARTBase(Machine machine) { queue = new Queue <byte>(); innerLock = new object(); Machine = machine; }
/// <summary> /// Parses and executes the received command. /// </summary> /// <remarks> /// The possible valid commands are: /// <list> /// <listheader> /// <item>Command</item> /// <description>Description</description> /// </listheader> /// <item>GXXX</item> /// <description>XXX is a 3-digit decimal representing the target dome azimuth in degrees (range 0 to 359).</description> /// <item>GHOM</item> /// <description>Move to the HOME position.</description> /// </list> /// </remarks> private void ExecuteCommand() { var command = Machine.ReceivedChars.ToString(); switch (command) { case Constants.CmdCancelTimeout: return; case Constants.CmdClose: Transition(new StateRotatingForShutterClose(Machine)); return; case Constants.CmdFastTrack: return; case Constants.CmdGetInfo: Transition(new StateSendStatus(Machine)); return; case Constants.CmdGotoHome: Transition(new StateRotatingToHome(Machine)); return; case Constants.CmdOpen: Transition(new StateRotatingForShutterOpen(Machine)); return; case Constants.CmdPark: return; case Constants.CmdSetUserPins: // ToDo - requires special handling [this can never match] break; case Constants.CmdSlaveOff: return; case Constants.CmdSlaveOn: return; case Constants.CmdTest: return; case Constants.CmdTrain: return; case Constants.CmdUnpark: return; } // Other possibilities are: Gxxx GPnn and Csdr if (command.StartsWith("GP")) { // User pin manipulation byte pins; if (byte.TryParse(command.Substring(2, 2), NumberStyles.HexNumber, CultureInfo.InvariantCulture, out pins)) { // Successfully parsed a user I/O pin packet. Machine.HardwareStatus.UserPins = pins; Transition(new StateSendStatus(Machine)); } } else if (Machine.ReceivedChars[0] == 'G') { int targetDegrees; if (int.TryParse(command.Substring(1, 3), NumberStyles.Integer, CultureInfo.CurrentCulture, out targetDegrees)) { // Successfully recognised a rotation command. if (Machine.InDeadZone(targetDegrees)) { Transition(new StateSendStatus(Machine)); return; } Machine.TargetAzimuthDegrees = targetDegrees; Transition(new StateRotating(Machine)); } else { Log.Warn("Gxxx command had invalid numeric part (ignored)"); Transition(new StateReceivingCommand(Machine)); } } //ToDo: Smart Tracking will likely be implemented in its own state. //else if (false) // if it's a smart-tracking command //{ // //ToDo: Implement smart tracking command (maybe not) // Diagnostics.TraceWarning("Command may be 'smart tracking' but SmartTracking is not implemented."); //} else { // Anything else must be an invalid or corrupted command, so discard it. Transition(new StateReceivingCommand(Machine)); } }
IRasterizer IRasterizer.Factory.CreateRasterizer(Machine machine) { // All of our screens have empty constructors so we can just use Activator return(new MathboxRenderer(machine, ScreenManager)); }
public static void AddLineHook(this IUART uart, [AutoParameter] Machine machine, string contains, string pythonScript) { var engine = new UartPythonEngine(machine, uart, pythonScript); uart.AddLineHook(x => x.Contains(contains), engine.Hook); }
public override IMatched <IObject> Execute(Machine machine) { return(machine.PopFrame().Map(_ => notMatched <IObject>()).Recover(failedMatch <IObject>)); }
MathboxRenderer(Machine machine, ScreenManager screenManager) { Machine = machine; Memory = Machine.Mathbox.Memory16; ScreenManager = screenManager; if (!(screenManager.Game is I_Robot.Game game)) { throw new Exception("VideoInterpreter can only be used with I_Robot.Game"); } Game = game; DisplayListManager = new DisplayList.Manager(this); Object = new ObjectRenderer(this); Terrain = new TerrainRenderer(this); // create our scene buffer // this buffer has a z-buffer SceneBuffer = new RenderTarget2D( Game.GraphicsDevice, Game.GraphicsDevice.Viewport.Width, Game.GraphicsDevice.Viewport.Height, false, Game.GraphicsDevice.PresentationParameters.BackBufferFormat, DepthFormat.None, 8, RenderTargetUsage.DiscardContents); // create our two screen buffers // these buffers do not require depth sorting, they are simply raw bitmaps // however the contents need to be preserved when rendering context is reset for (int n = 0; n < ScreenBuffers.Length; n++) { ScreenBuffers[n] = new RenderTarget2D( Game.GraphicsDevice, Game.GraphicsDevice.Viewport.Width, Game.GraphicsDevice.Viewport.Height, false, Game.GraphicsDevice.PresentationParameters.BackBufferFormat, DepthFormat.None, 0, RenderTargetUsage.PreserveContents); } camTarget = new Vector3(0f, 0f, 0f); camPosition = new Vector3(0f, 0f, -1f); double scaleToMonitor = Emulation.Machine.MonitorAspectRatio / Emulation.Machine.NativeAspectRatio; projectionMatrix = Matrix.CreatePerspectiveFieldOfView( MathHelper.ToRadians(45f), (float)(Game.GraphicsDevice.Viewport.AspectRatio / scaleToMonitor), 0.1f, 65536f); // it's important to move the projection matrix down a bit, this matches what I, Robot seems to do projectionMatrix = projectionMatrix * Matrix.CreateTranslation(new Vector3(0, -0.1f, 0)); viewMatrix = Matrix.CreateLookAt(camPosition, camTarget, Vector3.Up); worldMatrix = Matrix.CreateWorld(Vector3.Zero, Vector3.Forward, Vector3.Down); basicEffect = new BasicEffect(Game.GraphicsDevice); basicEffect.Alpha = 1f; basicEffect.VertexColorEnabled = true; // Want to see the colors of the vertices, this needs to be on // Lighting requires normal information which VertexPositionColor does not have // If you want to use lighting and VPC you need to create a custom def basicEffect.LightingEnabled = false; }
public EmptyCPU(Machine machine) { this.machine = machine; }
private void RegisterResetCommand(Machine machine) { machine.MachineReset += ResetMachine; }
protected SimpleContainer(Machine machine) { this.machine = machine; ChildCollection = new Dictionary <int, T>(); }
private void UpdateLeader() { this.Leader = (Machine)this.Payload; this.Send(this.Leader, new eUpdateLeader(this.Servers)); }
/// <summary> /// Read diskarea information /// </summary> /// <param name="reader">XmlReader representing a diskarea block</param> /// <param name="machine">Machine information to pass to contained items</param> /// <param name="features">List of features from the parent part</param> /// <param name="areaname">Name of the containing area</param> /// <param name="areasize">Size of the containing area</param> /// <param name="partname">Name of the containing part</param> /// <param name="partinterface">Interface of the containing part</param> /// <param name="filename">Name of the file to be parsed</param> /// <param name="sysid">System ID for the DAT</param> /// <param name="srcid">Source ID for the DAT</param> /// <param name="keep">True if full pathnames are to be kept, false otherwise (default)</param> /// <param name="clean">True if game names are sanitized, false otherwise (default)</param> /// <param name="remUnicode">True if we should remove non-ASCII characters from output, false otherwise (default)</param> private bool ReadDiskArea( XmlReader reader, Machine machine, List <Tuple <string, string> > features, string areaname, long?areasize, string partname, string partinterface, // Standard Dat parsing string filename, int sysid, int srcid, // Miscellaneous bool keep, bool clean, bool remUnicode) { string key = ""; string temptype = reader.Name; bool containsItems = false; while (!reader.EOF) { // We only want elements if (reader.NodeType != XmlNodeType.Element) { reader.Read(); continue; } // Get the elements from the software switch (reader.Name) { case "disk": containsItems = true; DatItem disk = new Disk { Name = reader.GetAttribute("name"), MD5 = Utilities.CleanHashData(reader.GetAttribute("md5"), Constants.MD5Length), SHA1 = Utilities.CleanHashData(reader.GetAttribute("sha1"), Constants.SHA1Length), SHA256 = Utilities.CleanHashData(reader.GetAttribute("sha256"), Constants.SHA256Length), SHA384 = Utilities.CleanHashData(reader.GetAttribute("sha384"), Constants.SHA384Length), SHA512 = Utilities.CleanHashData(reader.GetAttribute("sha512"), Constants.SHA512Length), ItemStatus = Utilities.GetItemStatus(reader.GetAttribute("status")), Writable = Utilities.GetYesNo(reader.GetAttribute("writable")), AreaName = areaname, AreaSize = areasize, Features = features, PartName = partname, PartInterface = partinterface, SystemID = sysid, System = filename, SourceID = srcid, }; disk.CopyMachineInformation(machine); // Now process and add the rom key = ParseAddHelper(disk, clean, remUnicode); reader.Read(); break; default: reader.Read(); break; } } return(containsItems); }
public abstract GcSlotFlags WriteTo(StringBuilder sb, Machine machine, GcSlotFlags prevFlags);
/// <summary> /// Read part information /// </summary> /// <param name="reader">XmlReader representing a part block</param> /// <param name="machine">Machine information to pass to contained items</param> /// <param name="filename">Name of the file to be parsed</param> /// <param name="sysid">System ID for the DAT</param> /// <param name="srcid">Source ID for the DAT</param> /// <param name="keep">True if full pathnames are to be kept, false otherwise (default)</param> /// <param name="clean">True if game names are sanitized, false otherwise (default)</param> /// <param name="remUnicode">True if we should remove non-ASCII characters from output, false otherwise (default)</param> private bool ReadPart( XmlReader reader, Machine machine, // Standard Dat parsing string filename, int sysid, int srcid, // Miscellaneous bool keep, bool clean, bool remUnicode) { string key = "", areaname = "", partname = "", partinterface = ""; string temptype = reader.Name; long? areasize = null; List <Tuple <string, string> > features = new List <Tuple <string, string> >(); bool containsItems = false; while (!reader.EOF) { // We only want elements if (reader.NodeType != XmlNodeType.Element) { if (reader.NodeType == XmlNodeType.EndElement && reader.Name == "part") { partname = ""; partinterface = ""; features = new List <Tuple <string, string> >(); } if (reader.NodeType == XmlNodeType.EndElement && (reader.Name == "dataarea" || reader.Name == "diskarea")) { areaname = ""; areasize = null; } reader.Read(); continue; } // Get the elements from the software switch (reader.Name) { case "part": partname = reader.GetAttribute("name"); partinterface = reader.GetAttribute("interface"); reader.Read(); break; case "feature": features.Add(new Tuple <string, string>(reader.GetAttribute("name"), reader.GetAttribute("feature"))); reader.Read(); break; case "dataarea": areaname = reader.GetAttribute("name"); if (reader.GetAttribute("size") != null) { if (Int64.TryParse(reader.GetAttribute("size"), out long tempas)) { areasize = tempas; } } // string dataarea_width = reader.GetAttribute("width"); // (8|16|32|64) "8" // string dataarea_endianness = reader.GetAttribute("endianness"); // endianness (big|little) "little" containsItems = ReadDataArea(reader.ReadSubtree(), machine, features, areaname, areasize, partname, partinterface, filename, sysid, srcid, keep, clean, remUnicode); // Skip the dataarea now that we've processed it reader.Skip(); break; case "diskarea": areaname = reader.GetAttribute("name"); containsItems = ReadDiskArea(reader.ReadSubtree(), machine, features, areaname, areasize, partname, partinterface, filename, sysid, srcid, keep, clean, remUnicode); // Skip the diskarea now that we've processed it reader.Skip(); break; case "dipswitch": // string dipswitch_name = reader.GetAttribute("name"); // string dipswitch_tag = reader.GetAttribute("tag"); // string dipswitch_mask = reader.GetAttribute("mask"); // For every <dipvalue> element... // string dipvalue_name = reader.GetAttribute("name"); // string dipvalue_value = reader.GetAttribute("value"); // bool? dipvalue_default = Utilities.GetYesNo(reader.GetAttribute("default")); // (yes|no) "no" reader.Skip(); break; default: reader.Read(); break; } } return(containsItems); }
public ScanForIp(Machine machine) { _machine = machine; _threads = new List <Thread>(); InitializeComponent(); }
public static List <ResultDiagnostics> GetEngineResult(Machine machine) { return(model.EngineResult.Get(machine)); }
/// <summary> /// Read dataarea information /// </summary> /// <param name="reader">XmlReader representing a dataarea block</param> /// <param name="machine">Machine information to pass to contained items</param> /// <param name="features">List of features from the parent part</param> /// <param name="areaname">Name of the containing area</param> /// <param name="areasize">Size of the containing area</param> /// <param name="partname">Name of the containing part</param> /// <param name="partinterface">Interface of the containing part</param> /// <param name="filename">Name of the file to be parsed</param> /// <param name="sysid">System ID for the DAT</param> /// <param name="srcid">Source ID for the DAT</param> /// <param name="keep">True if full pathnames are to be kept, false otherwise (default)</param> /// <param name="clean">True if game names are sanitized, false otherwise (default)</param> /// <param name="remUnicode">True if we should remove non-ASCII characters from output, false otherwise (default)</param> private bool ReadDataArea( XmlReader reader, Machine machine, List <Tuple <string, string> > features, string areaname, long?areasize, string partname, string partinterface, // Standard Dat parsing string filename, int sysid, int srcid, // Miscellaneous bool keep, bool clean, bool remUnicode) { string key = ""; string temptype = reader.Name; bool containsItems = false; while (!reader.EOF) { // We only want elements if (reader.NodeType != XmlNodeType.Element) { reader.Read(); continue; } // Get the elements from the software switch (reader.Name) { case "rom": containsItems = true; // If the rom is continue or ignore, add the size to the previous rom if (reader.GetAttribute("loadflag") == "continue" || reader.GetAttribute("loadflag") == "ignore") { int index = this[key].Count - 1; DatItem lastrom = this[key][index]; if (lastrom.ItemType == ItemType.Rom) { ((Rom)lastrom).Size += Utilities.GetSize(reader.GetAttribute("size")); } this[key].RemoveAt(index); this[key].Add(lastrom); reader.Read(); continue; } DatItem rom = new Rom { Name = reader.GetAttribute("name"), Size = Utilities.GetSize(reader.GetAttribute("size")), CRC = Utilities.CleanHashData(reader.GetAttribute("crc"), Constants.CRCLength), MD5 = Utilities.CleanHashData(reader.GetAttribute("md5"), Constants.MD5Length), SHA1 = Utilities.CleanHashData(reader.GetAttribute("sha1"), Constants.SHA1Length), SHA256 = Utilities.CleanHashData(reader.GetAttribute("sha256"), Constants.SHA256Length), SHA384 = Utilities.CleanHashData(reader.GetAttribute("sha384"), Constants.SHA384Length), SHA512 = Utilities.CleanHashData(reader.GetAttribute("sha512"), Constants.SHA512Length), Offset = reader.GetAttribute("offset"), // Value = reader.GetAttribute("value"); ItemStatus = Utilities.GetItemStatus(reader.GetAttribute("status")), // LoadFlag = reader.GetAttribute("loadflag"), // (load16_byte|load16_word|load16_word_swap|load32_byte|load32_word|load32_word_swap|load32_dword|load64_word|load64_word_swap|reload|fill|continue|reload_plain|ignore) AreaName = areaname, AreaSize = areasize, Features = features, PartName = partname, PartInterface = partinterface, SystemID = sysid, System = filename, SourceID = srcid, }; rom.CopyMachineInformation(machine); // Now process and add the rom key = ParseAddHelper(rom, clean, remUnicode); reader.Read(); break; default: reader.Read(); break; } } return(containsItems); }
public static List <ResultDiagnostics> GetBearingResult(Machine machine) { return(model.BearingResult.Get(machine)); }
/// <summary> /// Read software information /// </summary> /// <param name="reader">XmlReader representing a software block</param> /// <param name="filename">Name of the file to be parsed</param> /// <param name="sysid">System ID for the DAT</param> /// <param name="srcid">Source ID for the DAT</param> /// <param name="keep">True if full pathnames are to be kept, false otherwise (default)</param> /// <param name="clean">True if game names are sanitized, false otherwise (default)</param> /// <param name="remUnicode">True if we should remove non-ASCII characters from output, false otherwise (default)</param> private void ReadSoftware( XmlReader reader, // Standard Dat parsing string filename, int sysid, int srcid, // Miscellaneous bool keep, bool clean, bool remUnicode) { // If we have an empty software, skip it if (reader == null) { return; } // Otherwise, add what is possible reader.MoveToContent(); string key = ""; string temptype = reader.Name; bool containsItems = false; // Create a new machine MachineType machineType = MachineType.NULL; if (Utilities.GetYesNo(reader.GetAttribute("isbios")) == true) { machineType |= MachineType.Bios; } if (Utilities.GetYesNo(reader.GetAttribute("isdevice")) == true) { machineType |= MachineType.Device; } if (Utilities.GetYesNo(reader.GetAttribute("ismechanical")) == true) { machineType |= MachineType.Mechanical; } Machine machine = new Machine { Name = reader.GetAttribute("name"), Description = reader.GetAttribute("name"), Supported = Utilities.GetYesNo(reader.GetAttribute("supported")), // (yes|partial|no) "yes" CloneOf = reader.GetAttribute("cloneof") ?? "", Infos = new List <Tuple <string, string> >(), MachineType = (machineType == MachineType.NULL ? MachineType.None : machineType), }; while (!reader.EOF) { // We only want elements if (reader.NodeType != XmlNodeType.Element) { reader.Read(); continue; } // Get the elements from the software switch (reader.Name) { case "description": machine.Description = reader.ReadElementContentAsString(); break; case "year": machine.Year = reader.ReadElementContentAsString(); break; case "publisher": machine.Publisher = reader.ReadElementContentAsString(); break; case "info": machine.Infos.Add(new Tuple <string, string>(reader.GetAttribute("name"), reader.GetAttribute("value"))); reader.Read(); break; case "sharedfeat": // string sharedfeat_name = reader.GetAttribute("name"); // string sharedfeat_value = reader.GetAttribute("value"); reader.Read(); break; case "part": // Contains all rom and disk information containsItems = ReadPart(reader.ReadSubtree(), machine, filename, sysid, srcid, keep, clean, remUnicode); // Skip the part now that we've processed it reader.Skip(); break; default: reader.Read(); break; } } // If no items were found for this machine, add a Blank placeholder if (!containsItems) { Blank blank = new Blank() { SystemID = sysid, System = filename, SourceID = srcid, }; blank.CopyMachineInformation(machine); // Now process and add the rom ParseAddHelper(blank, clean, remUnicode); } }