public MainWindow() { DataContext = new Vm(); InitializeComponent(); }
public void Test_RunC8TestRom_ShouldReturnOKScreen() { byte[] expected = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; var vm = Vm.NewVm(null, @"Roms\c8_test.c8"); vm.EmulateCycles(512); CollectionAssert.AreEqual(expected, vm.Gfx); }
public string Part2() { var vm = new Vm(_instructions); vm.MemSet(0, 2); // Start the field vm.Run(); var partitions = vm.Output.Partition(3); var tiles = new Dictionary <(BigInteger, BigInteger), BigInteger>(); var score = 0; foreach (var p in partitions) { var key = (p[0], p[1]); var val = p[2]; if (key == (-1, 0)) { score = int.Parse(val.ToString()); continue; } if (tiles.ContainsKey(key)) { tiles[key] = val; } else { tiles.Add(key, val); } } vm.DeleteOutput(); do { partitions = vm.Output.Partition(3); foreach (var p in partitions) { var key = (p[0], p[1]); var val = p[2]; if (key == (-1, 0)) { score = int.Parse(val.ToString()); continue; } if (tiles.ContainsKey(key)) { tiles[key] = val; } else { tiles.Add(key, val); } } vm.DeleteOutput(); var ball = tiles.Where(x => x.Value == 4).First().Key; var paddle = tiles.Where(x => x.Value == 3).First().Key; var dir = ball.Item1.CompareTo(paddle.Item1); vm.AddInput(dir); vm.Run(); } while (vm.Running); return(vm.LastOutput().ToString()); }
public ServerBuilder Having(Vm vm) { _vm = vm; return(this); }
/// <summary> /// Checks if this attribute matches the specified attribute. /// </summary> /// <param name="call">The call attribute.</param> /// <returns> /// <c>true</c> if they match; otherwise <c>false</c>. /// </returns> public override bool Match(Vm.InternalCallImplAttribute call) { CompilerSupportAttribute csa = call as CompilerSupportAttribute; return (null != csa && csa.SupportFunction == supportFunction); }
private Task <bool> IsReserved(Vm vm, DateTime startTime, DateTime endTime) { return(Task.FromResult(_userVmRepository .GetAll(uv => uv.Vm.Id.Equals(vm.Id)) .Any(uv => Overlap(uv.StartTime, startTime, uv.EndTime, endTime).Result))); }
private void UpdateScreen(object sender, EventArgs e) { _items.Clear(); _items.AddRange(Vm.GetItems(_myDebts)); _listView.GetAdapter().NotifyDataSetChanged(); }
public async Task <Vm> Save(string id) { await Connect(); Vm vm = _vmCache[id]; //protect stock disks; only save a disk if it is local to the workspace //i.e. the disk folder matches the workspaceId if (vm.Name.Tag().HasValue() && !vm.DiskPath.Contains(vm.Name.Tag())) { throw new InvalidOperationException("External templates must be cloned into local templates in order to be saved."); } _logger.LogDebug($"Save: get current snap for vm {vm.Name}"); //Get the current snapshot mor ManagedObjectReference mor = null; RetrievePropertiesResponse response = await _vim.RetrievePropertiesAsync( _props, FilterFactory.VmFilter(vm.AsVim(), "snapshot")); ObjectContent[] oc = response.returnval; mor = ((VirtualMachineSnapshotInfo)oc.First().GetProperty("snapshot")).currentSnapshot as ManagedObjectReference; // if (oc.Length > 0 && oc[0].propSet.Length > 0 && oc[0].propSet[0].val != null) // mor = ((VirtualMachineSnapshotInfo)oc[0].propSet[0].val).currentSnapshot; //add new snapshot _logger.LogDebug($"Save: add new snap for vm {vm.Name}"); ManagedObjectReference task = await _vim.CreateSnapshot_TaskAsync( vm.AsVim(), "Root Snap", "Created by TopoMojo Save at " + DateTime.UtcNow.ToString("s") + "Z", false, false); TaskInfo info = await WaitForVimTask(task); //remove previous snapshot if (mor != null) { _logger.LogDebug($"Save: remove previous snap for vm {vm.Name}"); task = await _vim.RemoveSnapshot_TaskAsync(mor, false, true); await Task.Delay(500); info = await GetVimTaskInfo(task); if (info.state == TaskInfoState.error) { throw new Exception(info.error.localizedMessage); } if (info.progress < 100) { var t = new VimHostTask { Task = task, Action = "saving", WhenCreated = DateTime.UtcNow }; vm.Task = new VmTask { Name = t.Action, WhenCreated = t.WhenCreated, Progress = t.Progress }; _tasks.Add(vm.Id, t); } } _vmCache.TryUpdate(vm.Id, vm, vm); return(vm); }
private void Create() { if (!this.deposit.DBManager.DynamicProperties.SupportVM()) { throw new ContractValidateException("vm work is off, need to be opened by the committee"); } CreateSmartContract contract = ContractCapsule.GetSmartContractFromTransaction(this.transaction); if (contract == null) { throw new ContractValidateException("Cannot get CreateSmartContract from transaction"); } SmartContract new_contract = contract.NewContract; if (!contract.OwnerAddress.Equals(new_contract.OriginAddress)) { Logger.Info("OwnerAddress not equals OriginAddress"); throw new VMIllegalException("OwnerAddress is not equals OriginAddress"); } byte[] contract_name = Encoding.UTF8.GetBytes(new_contract.Name); if (contract_name.Length > VMParameter.CONTRACT_NAME_LENGTH) { throw new ContractValidateException("contractName's length cannot be greater than 32"); } long percent = contract.NewContract.ConsumeUserResourcePercent; if (percent < 0 || percent > DefineParameter.ONE_HUNDRED) { throw new ContractValidateException("percent must be >= 0 and <= 100"); } byte[] contract_address = Wallet.GenerateContractAddress(this.transaction); if (this.deposit.GetAccount(contract_address) != null) { throw new ContractValidateException( "Trying to create a contract with existing contract address: " + Wallet.AddressToBase58(contract_address)); } new_contract.ContractAddress = ByteString.CopyFrom(contract_address); long call_value = new_contract.CallValue; long token_value = 0; long token_id = 0; if (VMConfig.AllowTvmTransferTrc10) { token_value = contract.CallTokenValue; token_id = contract.TokenId; } byte[] caller_address = contract.OwnerAddress.ToByteArray(); try { long fee_limit = this.transaction.RawData.FeeLimit; if (fee_limit < 0 || fee_limit > VMConfig.MAX_FEE_LIMIT) { Logger.Info(string.Format("invalid feeLimit {0}", fee_limit)); throw new ContractValidateException( "feeLimit must be >= 0 and <= " + VMConfig.MAX_FEE_LIMIT); } AccountCapsule creator = this.deposit.GetAccount(new_contract.OriginAddress.ToByteArray()); long energy_limit = 0; if (VMConfig.EnergyLimitHardFork) { if (call_value < 0) { throw new ContractValidateException("callValue must >= 0"); } if (token_value < 0) { throw new ContractValidateException("tokenValue must >= 0"); } if (new_contract.OriginEnergyLimit <= 0) { throw new ContractValidateException("The originEnergyLimit must be > 0"); } energy_limit = GetAccountEnergyLimitWithFixRatio(creator, fee_limit, call_value); } else { energy_limit = GetAccountEnergyLimitWithFloatRatio(creator, fee_limit, call_value); } CheckTokenValueAndId(token_value, token_id); byte[] ops = new_contract.Bytecode.ToByteArray(); this.root_internal_transaction = new InternalTransaction(this.transaction, this.transaction_type); long max_cpu_time_tx = this.deposit.DBManager.DynamicProperties.GetMaxCpuTimeOfOneTx() * DefineParameter.ONE_THOUSAND; long tx_cpu_limit = (long)(max_cpu_time_tx * GetCpuLimitInUsRatio()); long vm_start = Helper.NanoTime() / DefineParameter.ONE_THOUSAND; long vm_should_end = vm_start + tx_cpu_limit; IProgramInvoke invoke = this.invoke_factory.CreateProgramInvoke(TransactionType.TX_CONTRACT_CREATION_TYPE, this.executor_type, this.transaction, token_value, token_id, this.block.Instance, this.deposit, vm_start, vm_should_end, energy_limit); this.vm = new Vm(); this.program = new Program(ops, invoke, this.root_internal_transaction, this.block); byte[] tx_id = new TransactionCapsule(this.transaction).Id.Hash; this.program.RootTransactionId = tx_id; // TODO: EventPluginLoader is not Implementation //if (this.enable_listener // && (EventPluginLoader.getInstance().isContractEventTriggerEnable() // || EventPluginLoader.getInstance().isContractLogTriggerEnable()) // && IsCheckTransaction) //{ // logInfoTriggerParser = new LogInfoTriggerParser(this.block.getNum(), this.block.getTimeStamp(), txId, callerAddress); //} } catch (Exception e) { Logger.Info(e.Message); throw new ContractValidateException(e.Message); } this.program.Result.ContractAddress = contract_address; this.deposit.CreateAccount(contract_address, new_contract.Name, AccountType.Contract); this.deposit.CreateContract(contract_address, new ContractCapsule(new_contract)); byte[] code = new_contract.Bytecode.ToByteArray(); if (!VMConfig.AllowTvmConstantinople) { deposit.SaveCode(contract_address, ProgramPrecompile.GetCode(code)); } if (call_value > 0) { MUtil.Transfer(this.deposit, caller_address, contract_address, call_value); } if (VMConfig.AllowTvmTransferTrc10) { if (token_value > 0) { MUtil.TransferToken(this.deposit, caller_address, contract_address, token_id.ToString(), token_value); } } }
public void ExecuteIn(Vm vm) { vm.Clear(); }
public MainWindow() { this.vm = new Vm(this); this.DataContext = this.vm; this.clients = new List<Client>(); this.InitializeComponent(); }
public VmOverlayNode(NodeInitInfo initInfo, long id, Vm vm) : this(initInfo.IpAddress, initInfo.Port, initInfo.OverlayLevel, id, vm) { }
public VmOverlayNode(IOverlayNode node, Vm vm) : this(node.IpAddress, node.Port, node.OverlayLevel, node.Id, vm) { }
public VmOverlayNode(string ipAddress, int port, int overlayLevel, long id, Vm vm) : base(ipAddress, port, overlayLevel, id) { OwnedVm = vm; }
public void ExecuteIn(Vm vm) { vm[var.Name] = expr.EvalInt(vm); }
void fn_bind(Vm vm) { }
private void Call() { if (!this.deposit.DBManager.DynamicProperties.SupportVM()) { Logger.Info("vm work is off, need to be opened by the committee"); throw new ContractValidateException("VM work is off, need to be opened by the committee"); } TriggerSmartContract contract = ContractCapsule.GetTriggerContractFromTransaction(this.transaction); if (contract == null) { return; } if (contract.ContractAddress == null) { throw new ContractValidateException("Cannot get contract address from TriggerContract"); } byte[] contract_address = contract.ContractAddress.ToByteArray(); ContractCapsule deployed_contract = this.deposit.GetContract(contract_address); if (null == deployed_contract) { Logger.Info("No contract or not a smart contract"); throw new ContractValidateException("No contract or not a smart contract"); } long call_value = contract.CallValue; long token_value = 0; long token_id = 0; if (VMConfig.AllowTvmTransferTrc10) { token_value = contract.CallTokenValue; token_id = contract.TokenId; } if (VMConfig.EnergyLimitHardFork) { if (call_value < 0) { throw new ContractValidateException("callValue must >= 0"); } if (token_value < 0) { throw new ContractValidateException("tokenValue must >= 0"); } } byte[] caller_address = contract.OwnerAddress.ToByteArray(); CheckTokenValueAndId(token_value, token_id); byte[] code = this.deposit.GetCode(contract_address); if (code != null && code.Length > 0) { long fee_limit = this.transaction.RawData.FeeLimit; if (fee_limit < 0 || fee_limit > VMConfig.MAX_FEE_LIMIT) { Logger.Info(string.Format("invalid feeLimit {0}", fee_limit)); throw new ContractValidateException( "feeLimit must be >= 0 and <= " + VMConfig.MAX_FEE_LIMIT); } AccountCapsule caller = this.deposit.GetAccount(caller_address); long energy_limit = 0; if (this.is_static_call) { energy_limit = DefineParameter.ENERGY_LIMIT_IN_CONSTANT_TX; } else { AccountCapsule creator = this.deposit.GetAccount(deployed_contract.Instance.OriginAddress.ToByteArray()); energy_limit = GetTotalEnergyLimit(creator, caller, contract, fee_limit, call_value); } long max_cpu_time_tx = this.deposit.DBManager.DynamicProperties.GetMaxCpuTimeOfOneTx() * DefineParameter.ONE_THOUSAND; long tx_cpu_limit = (long)(max_cpu_time_tx * GetCpuLimitInUsRatio()); long vm_start = Helper.NanoTime() / DefineParameter.ONE_THOUSAND; long vm_should_end = vm_start + tx_cpu_limit; IProgramInvoke invoke = this.invoke_factory.CreateProgramInvoke(TransactionType.TX_CONTRACT_CALL_TYPE, this.executor_type, this.transaction, token_value, token_id, this.block.Instance, this.deposit, vm_start, vm_should_end, energy_limit); if (this.is_static_call) { invoke.IsStaticCall = true; } this.vm = new Vm(); this.root_internal_transaction = new InternalTransaction(this.transaction, this.transaction_type); this.program = new Program(code, invoke, this.root_internal_transaction, this.block); byte[] tx_id = new TransactionCapsule(this.transaction).Id.Hash; this.program.RootTransactionId = tx_id; // // TODO: EventPluginLoader is not Implementation //if (enableEventLinstener && // (EventPluginLoader.getInstance().isContractEventTriggerEnable() // || EventPluginLoader.getInstance().isContractLogTriggerEnable()) // && isCheckTransaction()) //{ // logInfoTriggerParser = new LogInfoTriggerParser(this.block.getNum(), this.block.getTimeStamp(), txId, callerAddress); //} } this.program.Result.ContractAddress = contract_address; if (call_value > 0) { MUtil.Transfer(this.deposit, caller_address, contract_address, call_value); } if (VMConfig.AllowTvmTransferTrc10) { if (token_value > 0) { MUtil.TransferToken(this.deposit, caller_address, contract_address, token_id.ToString(), token_value); } } }
public override void ViewWillAppear(bool animated) { base.ViewWillAppear(animated); Vm.Init(); }
private void RegisterPage_Loaded(object sender, RoutedEventArgs e) { Vm.RegisterPage_Loaded(); }
public void TestUserAssemblyNestedReturn() { // Ensure that the stack is clean // before running each test. Vm.Memory.ClearStack(); const Registers r1 = Registers.R1; const Registers ac = Registers.AC; #region Program var lines = new[] { ".section text", "push $0xAAA", // Should remain in place once the stack is restored "push $0xC", // TESTER Argument 3 "push $0xB", // TESTER Argument 2 "push $0xA", // TESTER Argument 1 "push $3", // The number of arguments for the subroutine "call !TESTER", "mov $0x123, R1", "hlt", "TESTER:", "mov $0x34, &FP, R3", "mov $0x30, &FP, R2", "mov $0x2C, &FP, R1", "add R1, R2", "add R3, AC", "push $0xCC", // TESTER2 Argument 3 "push $0xBB", // TESTER2 Argument 2 "push $0xAA", // TESTER2 Argument 1 "push $3", // The number of arguments for the subroutine "call !TESTER2", "ret", "TESTER2:", "mov $0x34, &FP, R3", "mov $0x30, &FP, R2", "mov $0x2C, &FP, R1", "add R1, R2", "add R3, AC", "ret" }; #endregion // Program var pStr = string.Join(Environment.NewLine, lines); var program = _p.Parse(pStr).CodeSectionData.ToArray(); Vm.Run(QuickCompile.RawCompile(program)); // 0xAAA should be at the top of the stack. Assert.IsTrue(Vm.Memory.StackPopInt() == 0xAAA); Assert.IsTrue(Vm.Memory.StackPointer == Vm.Memory.StackEnd); // Ensure that the execution returns to the correct place // after the subroutine returns. Assert.IsTrue(Vm.Cpu.Registers[r1] == 0x123); // Ensure that the subroutine executed correctly. Assert.IsTrue(Vm.Cpu.Registers[ac] == 0x231); }
public void ExecuteIn(Vm vm) { vm.List(); }
private void MachineOnCpuFrameCompleted(object sender, CancelEventArgs e) { // ReSharper disable once ExplicitCallerInfoArgument Vm.RaisePropertyChanged("Machine"); }
public static Vm.Vm RunVm( Vm.Vm vm, List<SourceFile> sources, IEnumerable<Callable> userPrimitives = null, int? totalTicksQuota = null, int? ticksUntilNextNapQuota = null, int? usedCellsQuota = null) { return Vm.Vm.RunVm ( null, sources: sources, userPrimitives: userPrimitives, vm: vm, cellsQuota: usedCellsQuota, totalTicksQuota: totalTicksQuota, untilNextNapTicksQuota: ticksUntilNextNapQuota); }
public static void Main(string[] args) { Rnd = new Random(); // log4net init NReco.Logging.LogManager.Configure(new NReco.Log4Net.Logger()); // winter service provider init IComponentsConfig config = ConfigurationManager.GetSection("components") as IComponentsConfig; SrvPrv = new NReco.Winter.ServiceProvider(config); // overlay params Params = (NService.Chord.OverlayParams)SrvPrv.GetService("chordOverlayParams"); Params.FillFromConsoleArgs(args); // prepare overlay storage DbMgr = (IDbManager)SrvPrv.GetService("mongoDbManager"); DbMgr.Clear(); // init CloudSim CloudSim.init(1, JavaCalendar.getInstance(), true); // cloud datacenter CloudDatacenter = (NService.Cloud.ServiceDatacenter)SrvPrv.GetService("serviceDatacenter"); // cloud broker CloudBroker = (NService.Cloud.ServiceBroker)SrvPrv.GetService("serviceBroker"); var brokerVmList = new List<Vm>(); // create cloud and the overlay based on service descriptions var p2pServices = new List<Tuple<IOverlayNodeService, IOverlayStorageService>>(); var serviceDescriptions = GetServiceDescriptions(args[0]); foreach (var service in serviceDescriptions) { var chordService = (IOverlayNodeService)SrvPrv.GetService("chordOverlayNodeService"); var nInit = new NodeDescriptor.NodeInitInfo( Params.IpAddress, OverlayHelper.GetRandomPortNumber(null, new Random(Convert.ToInt32(service.OwnerNode.Id))), 1 ); var nodeId = (chordService as IHashKeyProvider).GetHashKey(OverlayHelper.GetNodeHashArgument(nInit)); // create a VM for the node var nodeVm = new Vm( Convert.ToInt32(nodeId), CloudBroker.getId(), 400, 1, 512, 1000, 10000, "Xen", new CloudletSchedulerTimeShared() ); brokerVmList.Add(nodeVm); chordService.Bind(new LocalNode(new VmOverlayNode( nInit, nodeId, nodeVm ))); // set real owner node for the service description service.OwnerNode = chordService.Node; foreach (var d in service.Data) { d.OwnerNode = service.OwnerNode; } // respective storage service var storageService = (IOverlayStorageService)SrvPrv.GetService("mongoDbOverlayStorageService"); storageService.Bind(new[] { chordService }.ToList()); storageService.Start(); p2pServices.Add(Tuple.Create(chordService, storageService)); } // submit all VMs to the broker CloudBroker.submitVmList(JavaUtils.ToJavaList(brokerVmList)); // create the overlay var alreadyJoinedNodesPorts = new List<int>(); foreach (var p2p in p2pServices) { var overlaySrv = p2p.Item1; if (!alreadyJoinedNodesPorts.Any()) { overlaySrv.Join(); alreadyJoinedNodesPorts.Add(overlaySrv.Node.Port); } else { var nInitLoc = new NodeDescriptor.NodeInitInfo( Params.IpAddress, alreadyJoinedNodesPorts[Rnd.Next(0, alreadyJoinedNodesPorts.Count)], 1 ); var hashPrv = (IProvider<byte[], long>)SrvPrv.GetService("sha1KeyPrv"); overlaySrv.Join(new NodeDescriptor( nInitLoc, hashPrv.Provide(OverlayHelper.GetNodeHashArgument(nInitLoc)) )); alreadyJoinedNodesPorts.Add(overlaySrv.Node.Port); } } System.Console.WriteLine("Waiting until the overlay stabilizes..."); Thread.Sleep(10000); System.Console.WriteLine("Populating the data storage..."); //populate storage foreach (var srv in serviceDescriptions) { var ownerNodeStorageSrv = p2pServices.Single(s => s.Item2.Node.Equals(srv.OwnerNode)).Item2; ownerNodeStorageSrv.PutService(srv); } CloudSim.startSimulation(); System.Console.WriteLine("Ready"); // listen for commands try { ProcessCommands(p2pServices); } finally { foreach (var srv in p2pServices) { srv.Item2.Stop(); } foreach (var srv in p2pServices) { ((ChordOverlayNodeService)srv.Item1).MaintenanceSrv.Stop(); } foreach (var srv in p2pServices) { srv.Item1.SendMessage(new OverlayNodeServiceMessage { MsgType = OverlayNodeServiceMessage.MessageType.ExitRequested, WaitForProcessing = true }); } CloudSim.stopSimulation(); } }
public static byte[] SerializeVmState(Vm.Vm vm) { var ms = Serialization.Utils.SerializeWithMd5CheckSum (str => { vm.SerializeState (str); } ); return ms.ToArray (); }
public void ExecuteIn(Vm vm) { vm.Return(); }
public static Stream SerializeVmStateToStream(Vm.Vm vm) { return Serialization.Utils.SerializeWithMd5CheckSum (str => { vm.SerializeState (str); } ); }
public void Test_RunCorax89TestRom_ShouldReturnAllOKScreen() { byte[] expected = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; var vm = Vm.NewVm(null, @"Roms\test_opcode.ch8"); vm.EmulateCycles(512); CollectionAssert.AreEqual(expected, vm.Gfx); }
public static long VmExecutedTicks(Vm.Vm vm) { return vm.ExecutedTicks; }
public static long VmExecutedTicksSinceLastNap(Vm.Vm vm) { return vm.ExecutedTicksSinceLastNap; }
public static bool VmExecutionComplete(Vm.Vm vm) { return vm.ExecutionComplete (); }
public SysModule(Vm vm) : base(vm) { RegisterMethod("bind", 0, fn_bind, 40); }
public static bool VmIsLive(Vm.Vm vm) { return vm.IsLive (); }
private Vm LoadVm(ObjectContent obj) { //create a new vm object Vm vm = new Vm(); //iterate through the retrieved properties and set values for the appropriate types foreach (DynamicProperty dp in obj.propSet) { if (dp.val.GetType() == typeof(VirtualMachineRuntimeInfo)) { VirtualMachineRuntimeInfo runtime = (VirtualMachineRuntimeInfo)dp.val; //vm.Question = GetQuestion(runtime); } if (dp.val.GetType() == typeof(VirtualMachineSnapshotInfo)) { } if (dp.val.GetType() == typeof(VirtualMachineFileLayout)) { VirtualMachineFileLayout layout = (VirtualMachineFileLayout)dp.val; if (layout != null && layout.disk != null && layout.disk.Length > 0 && layout.disk[0].diskFile.Length > 0) { //_logger.LogDebug(layout.disk[0].diskFile[0]); vm.DiskPath = layout.disk[0].diskFile[0]; } } if (dp.val.GetType() == typeof(VirtualMachineSummary)) { try { VirtualMachineSummary summary = (VirtualMachineSummary)dp.val; vm.Host = _config.Host; //vm.HostId = _config.Id; vm.Name = summary.config.name; vm.Path = summary.config.vmPathName; vm.Id = summary.config.uuid; //vm.IpAddress = summary.guest.ipAddress; //vm.Os = summary.guest.guestId; vm.State = (summary.runtime.powerState == VirtualMachinePowerState.poweredOn) ? VmPowerState.Running : VmPowerState.Off; //vm.IsPoweredOn = (summary.runtime.powerState == VirtualMachinePowerState.poweredOn); vm.Reference = summary.vm.AsString(); //summary.vm.type + "|" + summary.vm.Value; vm.Stats = String.Format("{0} | mem-{1}% cpu-{2}%", summary.overallStatus, Math.Round(((float)summary.quickStats.guestMemoryUsage / (float)summary.runtime.maxMemoryUsage) * 100, 0), Math.Round(((float)summary.quickStats.overallCpuUsage / (float)summary.runtime.maxCpuUsage) * 100, 0)); //vm.Annotations = summary.config.annotation.Lines(); //vm.ContextNumbers = vm.Annotations.FindOne("context").Value(); //vm.ContextNames = vm.Annotations.FindOne("display").Value(); //vm.HasGuestAgent = (vm.Annotations.FindOne("guestagent").Value() == "true"); vm.Question = GetQuestion(summary.runtime.question); vm.Status = "deployed"; if (_tasks.ContainsKey(vm.Id)) { var t = _tasks[vm.Id]; vm.Task = new VmTask { Name = t.Action, WhenCreated = t.WhenCreated, Progress = t.Progress }; } } catch (Exception ex) { _logger.LogDebug(ex.Message); if (!String.IsNullOrEmpty(vm.Name)) { _logger.LogDebug(String.Format("Error refreshing VirtualMachine {0} on host {1}", vm.Name, _config.Host)); } else { _logger.LogDebug(String.Format("Error refreshing host {0}", _config.Host)); } return(null); } } } if (!vm.Id.HasValue()) { _logger.LogDebug($"{this.Name} found a vm without an Id"); return(null); } _vmCache.AddOrUpdate(vm.Id, vm, (k, v) => (v = vm)); return(vm); }
public static int VmUsedCells(Vm.Vm vm) { return vm.UsedCells; }
//id, feature (iso, net, boot, guest), label, value public async Task <Vm> ReconfigureVm(string id, string feature, string label, string newvalue) { await Connect(); int index = 0; if (int.TryParse(label, out index)) { label = ""; } Vm vm = _vmCache[id]; RetrievePropertiesResponse response = await _vim.RetrievePropertiesAsync( _props, FilterFactory.VmFilter(vm.AsVim(), "config")); ObjectContent[] oc = response.returnval; VirtualMachineConfigInfo config = (VirtualMachineConfigInfo)oc[0].GetProperty("config"); VirtualMachineConfigSpec vmcs = new VirtualMachineConfigSpec(); switch (feature) { case "iso": VirtualCdrom cdrom = (VirtualCdrom)((label.HasValue()) ? config.hardware.device.Where(o => o.deviceInfo.label == label).SingleOrDefault() : config.hardware.device.OfType <VirtualCdrom>().ToArray()[index]); if (cdrom != null) { if (cdrom.backing.GetType() != typeof(VirtualCdromIsoBackingInfo)) { cdrom.backing = new VirtualCdromIsoBackingInfo(); } ((VirtualCdromIsoBackingInfo)cdrom.backing).fileName = newvalue; cdrom.connectable = new VirtualDeviceConnectInfo { connected = true, startConnected = true }; vmcs.deviceChange = new VirtualDeviceConfigSpec[] { new VirtualDeviceConfigSpec { device = cdrom, operation = VirtualDeviceConfigSpecOperation.edit, operationSpecified = true } }; } break; case "net": case "eth": VirtualEthernetCard card = (VirtualEthernetCard)((label.HasValue()) ? config.hardware.device.Where(o => o.deviceInfo.label == label).SingleOrDefault() : config.hardware.device.OfType <VirtualEthernetCard>().ToArray()[index]); if (card != null) { if (newvalue.StartsWith("_none_")) { card.connectable = new VirtualDeviceConnectInfo() { connected = false, startConnected = false, }; } else { _netman.UpdateEthernetCardBacking(card, newvalue); card.connectable.connected = true; } vmcs.deviceChange = new VirtualDeviceConfigSpec[] { new VirtualDeviceConfigSpec { device = card, operation = VirtualDeviceConfigSpecOperation.edit, operationSpecified = true } }; } break; case "boot": int delay = 0; if (Int32.TryParse(newvalue, out delay)) { vmcs.AddBootOption(delay); } break; case "guest": if (newvalue.HasValue() && !newvalue.EndsWith("\n")) { newvalue += "\n"; } vmcs.annotation = config.annotation + newvalue; if (vm.State == VmPowerState.Running && vmcs.annotation.HasValue()) { vmcs.AddGuestInfo(Regex.Split(vmcs.annotation, "\r\n|\r|\n")); } break; default: throw new Exception("Invalid change request."); //break; } ManagedObjectReference task = await _vim.ReconfigVM_TaskAsync(vm.AsVim(), vmcs); TaskInfo info = await WaitForVimTask(task); if (info.state == TaskInfoState.error) { throw new Exception(info.error.localizedMessage); } return(await GetVirtualMachine(vm.AsVim())); }
public static void WakeUpVm(Vm.Vm vm) { vm.WakeUp (); }
// Update is called once per frame void Update() { if (pj == true && player == true && camj == false) { MainCam.SetActive(true); EnemyCam.SetActive(false); StartCam.SetActive(false); camj = true; Ve.SetActive(true); oni.SetActive(true); TIME.SetActive(true); GetComponent <Text>().text = ((int)time).ToString(); } else if (pj == true && player == false && camj == false) { MainCam.SetActive(false); EnemyCam.SetActive(true); StartCam.SetActive(false); camj = true; Vm.SetActive(true); nige.SetActive(true); TIME.SetActive(true); GetComponent <Text>().text = ((int)time).ToString(); } // カメラの向き if (player == true) { if (Input.GetKey(KeyCode.UpArrow) && (Camera.main.transform.localEulerAngles.x > 335 || MainCam.transform.localEulerAngles.x < 90)) { MainCam.transform.Rotate(-4, 0, 0); } if (Input.GetKey(KeyCode.DownArrow) && (Camera.main.transform.localEulerAngles.x > 325 || MainCam.transform.localEulerAngles.x < 80)) { MainCam.transform.Rotate(4, 0, 0); } if (Input.GetKey(KeyCode.LeftArrow)) { ws.Send("L0"); } if (Input.GetKey(KeyCode.RightArrow)) { ws.Send("R0"); } } // 敵の向き if (player == false) { if (Input.GetKey(KeyCode.UpArrow) && (EnemyCam.transform.localEulerAngles.x > 335 || EnemyCam.transform.localEulerAngles.x < 90)) { EnemyCam.transform.Rotate(-4, 0, 0); } if (Input.GetKey(KeyCode.DownArrow) && (EnemyCam.transform.localEulerAngles.x > 325 || EnemyCam.transform.localEulerAngles.x < 80)) { EnemyCam.transform.Rotate(4, 0, 0); } if (Input.GetKey(KeyCode.LeftArrow)) { ws.Send("L1"); } if (Input.GetKey(KeyCode.RightArrow)) { ws.Send("R1"); } } if (l0 == true) { CamShell.transform.Rotate(0, -4, 0); l0 = false; } if (r0 == true) { CamShell.transform.Rotate(0, 4, 0); r0 = false; } if (l1 == true) { EnemyShell.transform.Rotate(0, -4, 0); l1 = false; } if (r1 == true) { EnemyShell.transform.Rotate(0, 4, 0); r1 = false; } // 移動 // Player0 camSet.transform.position += new Vector3(moveX, 0, moveZ); // Player1 EnemySet.transform.position += new Vector3(moveX1, 0, moveZ1); if ((Input.GetKeyUp(KeyCode.Space) || Input.GetKeyUp(KeyCode.Z)) && canMove0 == true && player == true) { ws.Send("M0"); } if ((Input.GetKeyUp(KeyCode.Space) || Input.GetKeyUp(KeyCode.Z)) && canMove1 == true && player == false) { ws.Send("M1"); } // Player0 if (player == true && p0m == true) { camRot = CamShell.transform.localEulerAngles.y; if (camRot > 225 && camRot < 315) { ws.Send("A0"); } else if (camRot > 135 && camRot < 225) { ws.Send("B0"); } else if (camRot > 45 && camRot < 135) { ws.Send("C0"); } else if (camRot > 315 || camRot < 45) { ws.Send("D0"); } canMove0 = false; } // Player1 if (player == false && p1m == true) { camRot = EnemyShell.transform.localEulerAngles.y; if (camRot > 225 && camRot < 315) { ws.Send("A1"); } else if (camRot > 135 && camRot < 225) { ws.Send("B1"); } else if (camRot > 45 && camRot < 135) { ws.Send("C1"); } else if (camRot > 315 || camRot < 45) { ws.Send("D1"); } canMove1 = false; } if (p0m == true) { p0m = false; } if (p1m == true) { p1m = false; } // Poison Move for (int i = 0; i < 10; i++) { if (prj1 == true) { pr [i].transform.position += new Vector3(0, 0.05f, 0); } else if (prj1 == false) { pr [i].transform.position -= new Vector3(0, 0.05f, 0); } } for (int i = 10; i < 20; i++) { if (prj2 == true) { pr [i].transform.position += new Vector3(0, 0.05f, 0); } else if (prj2 == false) { pr [i].transform.position -= new Vector3(0, 0.05f, 0); } } if (pr [0].transform.position.y >= 1.3f) { prj1 = false; prj2 = true; } else if (pr [0].transform.position.y <= -0.2f) { prj1 = true; prj2 = false; } // TIME if (pj == true && count >= 1.1f) { sCount.SetActive(true); count -= Time.deltaTime; sCount.GetComponent <Text>().text = ((int)count).ToString(); } else if (pj == true) { st = true; sCount.SetActive(false); canMove0 = true; canMove1 = true; } if (st == true) { time -= Time.deltaTime; } if (time < 1) { if (player == true) { SceneManager.LoadScene("lose"); } else { SceneManager.LoadScene("win"); } } if (time >= 11 && st == true) { TIME.SetActive(true); TIME.GetComponent <Text>().text = ((int)time).ToString(); } else if (st == true && time >= 1) { TIME.SetActive(false); eCount.SetActive(true); eCount.GetComponent <Text>().text = ((int)time).ToString(); } }
public static Value CheckStackTop(Vm.Vm vm) { return vm.CheckStackTop (); }
void OnItemClick(object sender, int e) { Vm.ShowDetails(_items [e].Name); }
private void ItemClicked(int oldPosition, View oldView, int position, View view) { Vm.ImageTapped(position); }
public void ExecuteIn(Vm vm) { vm.Run(); }
protected override void OnResume() { base.OnResume(); Vm.ViewAppeared(); }
public void ExecuteIn(Vm vm) { var s = exprList.EvalString(vm); vm.Write(s); }
protected override void InitVM() { Vm.CopyContext(this); ListVm.CopyContext(this); }
public static async Task <ServicesResponse <BackendTask> > RequestVm(Adapter adapter, Vm vm) { var response = await ApiService.PostRequestAsync <Vm, BackendTask>(adapter, vm, "vms"); return(response); }
public void ExecuteIn(Vm vm) { var lineNumber = expr.EvalInt(vm); vm.Gosub(lineNumber); }
internal static MemoryStream SerializeVmState(Vm.Vm vm) { return Utils.SerializeWithMd5CheckSum (str => { vm.SerializeState (str); } ); }
private static void ProcessCommands(IList<Tuple<IOverlayNodeService, IOverlayStorageService>> services) { Func<string, IOverlayNodeService, OverlayData[]> getStoragePutKeyValuesFromCmd = (string arg, IOverlayNodeService srv) => { var res = new List<OverlayData>(); foreach (var pair in arg.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries)) { var pairAttrVal = pair.Split(new string[] { "=" }, StringSplitOptions.RemoveEmptyEntries); // assume we have only one overlay level as for now res.Add(new OverlayData { AttrValue = new KeyValuePair<string,object>(pairAttrVal[0].Trim(), pairAttrVal[1].Trim()), OwnerNode = new NodeDescriptor(srv.Node) }); } return res.ToArray(); }; Func<string, string[]> getStorageRemoveKeysFromCmd = (string arg) => { return arg .Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries) .Select(s => s.Trim()) .ToArray(); }; while (true) { var cmd = System.Console.ReadLine(); var operatingSrv = services[Rnd.Next(0, services.Count)]; if (cmd.StartsWith("join")) { var existingNodesInOverlay = services.Select(s => s.Item1.Node).ToArray(); // chord service var nodeWhoJoinsInitInfo = new NodeDescriptor.NodeInitInfo( NetworkHelper.GetLocalIpAddress(), OverlayHelper.GetRandomPortNumber(existingNodesInOverlay.Select(n => n.Port).ToArray()), 1 ); var hashPrv = (IProvider<byte[], long>)SrvPrv.GetService("sha1KeyPrv"); var nodeWhoJoinsId = hashPrv.Provide(OverlayHelper.GetNodeHashArgument(nodeWhoJoinsInitInfo)); var nodeWhoJoinsVm = new Vm( Convert.ToInt32(nodeWhoJoinsId), CloudBroker.getId(), 400, 1, 512, 1000, 10000, "Xen", new CloudletSchedulerTimeShared() ); var nodeWhoJoins = new VmOverlayNode( nodeWhoJoinsInitInfo, nodeWhoJoinsId, nodeWhoJoinsVm ); var nodeWhoJoinsChordService = (IOverlayNodeService)SrvPrv.GetService("chordOverlayNodeService"); nodeWhoJoinsChordService.Bind(new LocalNode(nodeWhoJoins)); nodeWhoJoinsChordService.Join( existingNodesInOverlay[Rnd.Next(0, existingNodesInOverlay.Length)] ); // respective storage service var nodeWhoJoinsStorageService = (IOverlayStorageService)SrvPrv.GetService("mongoDbOverlayStorageService"); nodeWhoJoinsStorageService.Bind(new[] { nodeWhoJoinsChordService }.ToList()); nodeWhoJoinsStorageService.Start(); // add a VM to the broker CloudBroker.scheduleNow( CloudDatacenter.getName(), CloudSimTags.VM_CREATE, nodeWhoJoinsVm ); } else if (cmd == "leave") { var cmdParts = cmd.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries); var srvToLeave = services.FirstOrDefault(s => s.Item1.Node.Id == Convert.ToInt64(cmdParts[1])); if (srvToLeave != null) { srvToLeave.Item2.Stop(); srvToLeave.Item1.SendMessage(new OverlayNodeServiceMessage { MsgType = OverlayNodeServiceMessage.MessageType.ExitRequested, WaitForProcessing = true }); // remove a VM for this node CloudBroker.scheduleNow( CloudDatacenter.getName(), CloudSimTags.VM_DESTROY, ((VmOverlayNode)srvToLeave.Item1.Node).OwnedVm ); } else { System.Console.WriteLine("No such node"); } } else if (cmd == "stop") { break; } else if (cmd.StartsWith("put")) { Func<string, IOverlayNodeService, ServiceDescription> f = (string srvDescr, IOverlayNodeService overlaySrv) => { var res = new ServiceDescription { Name = srvDescr.Substring(0, srvDescr.IndexOf(":")), OwnerNode = overlaySrv.Node, Data = new List<OverlayData>() }; foreach (var pair in srvDescr.Substring(srvDescr.IndexOf(":") + 1).Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries)) { var pairAttrVal = pair.Split(new string[] { "=" }, StringSplitOptions.RemoveEmptyEntries); // assume we have only one overlay level as for now res.Data.Add( new OverlayData { AttrValue = new KeyValuePair<string,object>(pairAttrVal[0].Trim(), pairAttrVal[1].Trim()), ServiceName = res.Name, OwnerNode = res.OwnerNode } ); } return res; }; var cmdParts = cmd.Substring("put".Length).Trim().Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries); var ownerSrv = services.FirstOrDefault(s => s.Item1.Node.Id == Convert.ToInt64(cmdParts[1])); if (ownerSrv != null) { ownerSrv.Item2.PutService(f( cmdParts[1], ownerSrv.Item1 )); } else { System.Console.WriteLine("No such node"); } } else if (cmd.StartsWith("remove")) { operatingSrv.Item2.RemoveService(cmd.Substring("remove".Length).Trim()); } else if (cmd.StartsWith("update")) { var cmdParts = cmd.Substring("update".Length).Split(':', ';'); var addCmdPart = cmdParts[1]; var removeCmdPart = cmd.IndexOf(";") > 0 ? cmdParts[2] : null; operatingSrv.Item2.UpdateService( cmdParts[0].Trim(), String.IsNullOrWhiteSpace(addCmdPart) ? null : getStoragePutKeyValuesFromCmd(addCmdPart, operatingSrv.Item1), String.IsNullOrWhiteSpace(removeCmdPart) ? null : getStorageRemoveKeysFromCmd(removeCmdPart) ); } else if (cmd.StartsWith("get")) { var res = operatingSrv.Item2.GetServices(Query.FromRelex(cmd.Substring("get".Length).Trim()), true); if (res != null && res.Any()) { System.Console.WriteLine("**************************************************"); System.Console.WriteLine("RESULTS:"); foreach (var r in res) { System.Console.WriteLine("\r\n=============================================================="); System.Console.WriteLine(String.Format("Service name: {0}", r.Name)); foreach (var d in r.Data) { System.Console.WriteLine(String.Format("{0} = {1} (Responsible node: {2})", d.AttrValue.Key, d.GetFormattedValue(), d.ResponsibleNode.ToString())); } System.Console.WriteLine(String.Format("Service owner: {0}", r.OwnerNode.ToString())); System.Console.WriteLine("==============================================================\r\n"); } } else { System.Console.WriteLine("No data"); } } } }