Beispiel #1
0
    // Warning: loads from inputFiles is an array of names of files inside 'biobrickFilesPathPrefix'
    void loadDevices()
    {
        LinkedList <BioBrick> availableBioBricks = AvailableBioBricksManager.get().getAvailableBioBricks();
        LinkedList <BioBrick> allBioBricks       = AvailableBioBricksManager.get().getAllBioBricks();

        LevelInfo levelInfo = null;

        MemoryManager.get().tryGetCurrentLevelInfo(out levelInfo);

        List <Device> devices = new List <Device>();

        DeviceLoader dLoader = new DeviceLoader(availableBioBricks, allBioBricks);

        string[] filesToLoad;
        string   currentMapDevicesFilePath = MemoryManager.get().configuration.getGameMapName();

        if (null == levelInfo || !levelInfo.areAllDevicesAvailable)
        {
            filesToLoad = new string[] { currentMapDevicesFilePath };
        }
        else
        {
            List <string> fileList = new List <string>(deviceFiles);
            fileList.Add(currentMapDevicesFilePath);
            filesToLoad = fileList.ToArray();
        }
        foreach (string file in filesToLoad)
        {
            string fullPathFile = deviceFilesPathPrefix + file;
            Logger.Log("Inventory::loadDevices loads device file " + fullPathFile, Logger.Level.TRACE);
            devices.AddRange(dLoader.loadDevicesFromFile(fullPathFile));
        }
        UpdateData(devices, new List <Device>(), new List <Device>());
    }
Beispiel #2
0
        public static async Task Main(string[] args)
        {
            if (Environment.GetEnvironmentVariable("MANAGED_DEBUGGER_WAIT") == "1")
            {
                HandleDebugger();
            }

            InitializeProcess();
            var bus = new Bus();

            InitializeFlags(bus);

            if (AppFlag.GetVariable("VM_TRACE"))
            {
                DeviceLoader.OnTrace += Console.WriteLine;
            }

            DeviceLoader.AutoGrub(bus.Add);

            InitializeMemory(bus, args);


            while (bus.State.halt == 0)
            {
                bus.cpu.Step();
                await Task.Delay(1).ConfigureAwait(false);
            }

            bus.Unload();
        }
Beispiel #3
0
        public bool LoadFromFile(string taskDataFile)
        {
            if (!LoadXmlFile(taskDataFile))
            {
                return(false);
            }

            if (!VerifyIsoVersion())
            {
                return(false);
            }

            LinkedIds    = LinkListLoader.Load(this);
            Units        = UnitLoader.Load(this);
            Customers    = CustomerLoader.Load(this);
            Farms        = FarmLoader.Load(this);
            Crops        = CropLoader.Load(this);
            Fields       = FieldLoader.Load(this);
            Products     = ProductLoader.Load(this);
            ProductMixes = ProductMixLoader.Load(this);
            Workers      = WorkerLoader.Load(this);
            Comments     = CommentLoader.Load(this);
            Tasks        = TaskLoader.Load(this);

            RasterPrescriptions = PrescriptionLoader.Load(this);
            Machines            = DeviceLoader.Load(this);

            return(true);
        }
        public void DeviceOverlayLoad()
        {
            var devices       = DeviceLoader.LoadDevices();
            var minimalDevice = devices.First(device => device.deviceInfo.friendlyName == "MinimalTestDevice1");

            var screenOverlay0 = DeviceLoader.LoadOverlay(minimalDevice, 0);
            var screenOverlay1 = DeviceLoader.LoadOverlay(minimalDevice, 1);

            Assert.NotNull(screenOverlay0);
            Assert.NotNull(screenOverlay1);
        }
Beispiel #5
0
        public bool Initialize()
        {
            lock (action_lock)
            {
                if (!isInitialized)
                {
                    try
                    {
                        if (Process.GetProcessesByName("NZXT CAM").Length > 0)
                        {
                            Global.logger.Error("NZXT CAM is running. Ensure that it is not open and try again.");
                            return(false);
                        }
                        DeviceLoader = new DeviceLoader(false, DeviceLoadFilter.LightingControllers);
                        DeviceLoader.ThrowExceptions = false;
                        DeviceLoader.Initialize();

                        if (DeviceLoader.NumDevices == 0)
                        {
                            Global.logger.Error("NZXT device error: No devices found");
                        }
                        else
                        {
                            isInitialized = true;
                            Global.logger.Info("Starting NZXT debug information: Windows Build version: " + System.Runtime.InteropServices.RuntimeInformation.OSDescription);

                            foreach (var device in DeviceLoader.Devices)
                            {
                                if (device is NZXTSharp.KrakenX.KrakenX)
                                {
                                    Global.logger.Info("Found KrakenX, firmware version: " + (device as NZXTSharp.KrakenX.KrakenX).FirmwareVersion ?? "");
                                }
                                if (device is NZXTSharp.HuePlus.HuePlus)
                                {
                                    Global.logger.Info("Found HuePlus, firmware version: " + (device as NZXTSharp.HuePlus.HuePlus).FirmwareVersion ?? "");
                                }
                            }

                            return(true);
                        }
                    }
                    catch (Exception exc)
                    {
                        Global.logger.Error("NZXT device, Exception during Initialize. Message: " + exc);
                    }

                    isInitialized = false;
                    return(false);
                }
                return(isInitialized);
            }
        }
        private static void logNzxtSharpInfo(DeviceLoader loader)
        {
            log.Info("Discovered Devices - " + loader.NumDevices);

            INZXTDevice[] devices = loader.Devices.ToArray();
            log.Info(devices);

            foreach (INZXTDevice device in devices)
            {
                log.Info("Info for device of type: " + device.Type);
                log.Info("    Firmware Version - " + device.GetFirmwareVersion());
            }
        }
Beispiel #7
0
 public void ConfigureServices(IServiceCollection services)
 {
     foreach (var device in DeviceLoader.Load())
     {
         device.ConfigureServices(services);
     }
     services.AddScoped <ValidationFilterAttribute>();
     services.AddServiceLayer();
     services.AddPersistenceInfrastructure(_config);
     services.AddUnitOfWork();
     services.AddCqrs();
     services.AddControllersWithViews().AddRazorRuntimeCompilation();
     services.ConfigureMqttService();
     services.AddSignalR();
     services.AddHostedMqttClient(_config);
 }
        static void Main(string[] args)
        {
            Console.WriteLine("Starting NZXTSharp diagnostic utility...");
            Console.WriteLine("Some of these tests will be automated, some will " +
                              "ask for your input to verify that colors and effects are displaying properly.\n\n\n");
            DeviceLoader loader = new DeviceLoader();

            logSysInfo();
            stopCAM();
            logNzxtSharpInfo(loader);
            HuePlusTest.runAllTests(loader.HuePlus, log);
            KrakenXTest.runAllTests(loader.KrakenX, log);

            Console.WriteLine("\n\n\nAll tests complete. If anything did not work properly, please create an issue " +
                              "at github.com/akmadian/NZXTSharp. Be sure to include a pastebin (or other) link to the log file (can be found in the logs/ " +
                              "directory in the same directory as this exe.)");
            Console.WriteLine("Press any key to exit...");
            Console.ReadLine();
        }
Beispiel #9
0
        public static async Task Main(string[] args)
        {
            if (AppFlag.GetVariable("MANAGED_DEBUGGER_WAIT"))
            {
                HandleDebugger();
            }

            InitializeProcess();
            var bus = new Bus();

            InitializeFlags(bus);

            if (AppFlag.GetVariable("VM_TRACE"))
            {
                DeviceLoader.OnTrace += Console.WriteLine;
            }

            Module.Boot(bus);
            InternalVMFunctions.Boot(bus);
            DeviceLoader.Boot(bus.Add);

            if (AppFlag.GetVariable("REPL"))
            {
                Console.WriteLine("@ Ancient VM Interactive @".Pastel(Color.Green));
                InteractiveConstruction(bus);
            }
            else
            {
                InitializeMemory(bus, args);
            }

            while (bus.State.halt == 0)
            {
                bus.cpu.Step();
            }
            bus.Unload();
        }
Beispiel #10
0
        Task PopulateTasksAsync()
        {
            // Missing:
            // api-diff

            testSelector.SelectTests();

            DeviceLoader.LoadAllAsync().DoNotAwait();

            var simTasksFactory = new RunSimulatorTasksFactory();
            var loadsim         = simTasksFactory.CreateAsync(this, processManager, testVariationsFactory)
                                  .ContinueWith((v) => {
                if (v.Status == TaskStatus.RanToCompletion)
                {
                    Console.WriteLine("Simulator tasks created");
                    Tasks.AddRange(v.Result);
                }
                else
                {
                    Console.WriteLine($"Failed to create simulator tasks: {v.Exception}");
                }
            });

            //Tasks.AddRange (await CreateRunSimulatorTasksAsync ());

            var crashReportSnapshotFactory = new CrashSnapshotReporterFactory(processManager);

            // all factories are enumerators \o/
            var testFactories = new IEnumerable <AppleTestTask> [] {
                new MacTestTasksEnumerable(this, processManager, crashReportSnapshotFactory, testVariationsFactory),
                new NUnitTestTasksEnumerable(this, processManager),
                new MakeTestTaskEnumerable(this, processManager)
            };

            // add all tests defined by the factory
            foreach (var f in testFactories)
            {
                Tasks.AddRange(f);
            }

            // individual special tasks
            var buildXtroTests = new MakeTask(jenkins: this, processManager: processManager)
            {
                Platform         = TestPlatform.All,
                TestName         = "Xtro",
                Target           = "wrench",
                WorkingDirectory = Path.Combine(HarnessConfiguration.RootDirectory, "xtro-sharpie"),
                Ignored          = !IncludeXtro,
                Timeout          = TimeSpan.FromMinutes(15),
            };

            var runXtroReporter = new RunXtroTask(this, buildXtroTests, processManager, crashReportSnapshotFactory)
            {
                Platform         = TestPlatform.Mac,
                TestName         = buildXtroTests.TestName,
                Ignored          = buildXtroTests.Ignored,
                WorkingDirectory = buildXtroTests.WorkingDirectory,
            };

            Tasks.Add(runXtroReporter);

            var buildDotNetGeneratorProject = new TestProject(Path.GetFullPath(Path.Combine(HarnessConfiguration.RootDirectory, "bgen", "bgen-tests.csproj")));
            var buildDotNetGenerator        = new DotNetBuildTask(jenkins: this, testProject: buildDotNetGeneratorProject, processManager: processManager)
            {
                TestProject          = new TestProject(Path.GetFullPath(Path.Combine(HarnessConfiguration.RootDirectory, "bgen", "bgen-tests.csproj"))),
                SpecifyPlatform      = false,
                SpecifyConfiguration = false,
                Platform             = TestPlatform.iOS,
            };
            var runDotNetGenerator = new DotNetTestTask(this, buildDotNetGenerator, processManager)
            {
                TestProject = buildDotNetGeneratorProject,
                Platform    = TestPlatform.iOS,
                TestName    = "Generator tests",
                Mode        = ".NET",
                Ignored     = !IncludeBtouch,
            };

            Tasks.Add(runDotNetGenerator);

            var buildDotNetTestsProject = new TestProject(Path.GetFullPath(Path.Combine(HarnessConfiguration.RootDirectory, "dotnet", "UnitTests", "DotNetUnitTests.csproj")));
            var buildDotNetTests        = new DotNetBuildTask(this, testProject: buildDotNetTestsProject, processManager: processManager)
            {
                SpecifyPlatform      = false,
                Platform             = TestPlatform.All,
                ProjectConfiguration = "Debug",
                Ignored = !IncludeDotNet,
            };
            var runDotNetTests = new DotNetTestTask(this, buildDotNetTests, processManager)
            {
                TestProject = buildDotNetTestsProject,
                Platform    = TestPlatform.All,
                TestName    = "DotNet tests",
                Timeout     = TimeSpan.FromMinutes(5),
                Ignored     = !IncludeDotNet,
            };

            Tasks.Add(runDotNetTests);

            var deviceTestFactory = new RunDeviceTasksFactory();
            var loaddev           = deviceTestFactory.CreateAsync(this, processManager, testVariationsFactory).ContinueWith((v) => {
                Console.WriteLine("Got device tasks completed");
                Tasks.AddRange(v.Result);
            });

            return(Task.WhenAll(loadsim, loaddev));
        }
Beispiel #11
0
    // Warning: loads from inputFiles is an array of names of files inside 'biobrickFilesPathPrefix'
    void loadDevices()
    {
        LinkedList<BioBrick> availableBioBricks = AvailableBioBricksManager.get().getAvailableBioBricks();
        LinkedList<BioBrick> allBioBricks = AvailableBioBricksManager.get().getAllBioBricks();

        LevelInfo levelInfo = null;
        MemoryManager.get().tryGetCurrentLevelInfo(out levelInfo);

        List<Device> devices = new List<Device>();

        DeviceLoader dLoader = new DeviceLoader(availableBioBricks, allBioBricks);

        string[] filesToLoad;
        string currentMapDevicesFilePath = MemoryManager.get().configuration.getGameMapName();

        if (null == levelInfo || !levelInfo.areAllDevicesAvailable)
        {
            filesToLoad = new string[] { currentMapDevicesFilePath };
        }
        else
        {
            List<string> fileList = new List<string>(deviceFiles);
            fileList.Add(currentMapDevicesFilePath);
            filesToLoad = fileList.ToArray();
        }
        foreach (string file in filesToLoad)
        {
            string fullPathFile = deviceFilesPathPrefix + file;
            Logger.Log("Inventory::loadDevices loads device file " + fullPathFile, Logger.Level.TRACE);
            devices.AddRange(dLoader.loadDevicesFromFile(fullPathFile));
        }
        UpdateData(devices, new List<Device>(), new List<Device>());
    }
        private void LoadDevice(string fileName)
        {
            try
            {
                var loader = DeviceLoader.Load(fileName);
                deviceId          = loader.Factory;
                logDirectory      = Settings.GetDeviceDefaultLoggingDirectory(deviceId);
                logControl.Paused = false;
                Log.Status("Loaded assembly: {0}", loader.FileName);
                Log.Status("Device: {0} [Creation time: {1}]", loader.Factory, loader.CreationTime);
                Log.Status("Logging directory: {0}", logDirectory);
                Log.Status("Log settings [Auto save: {0}, Confirm deletion: {1}]", loader.AutoSaveLog, loader.ConfirmLogDeletion);

                autoSaveLogToolStripMenuItem.Checked = logControl.AutoSave = loader.AutoSaveLog;
                logControl.InitializeLogFile(logDirectory);
                confirmLogDeletion = loader.ConfirmLogDeletion;

                device = loader.Create();

                device.Profiler.Enabled = loader.Profiling;
                profilerWindow.SetDevice(device);
                commTester.Trials    = loader.Trials;
                commTester.TestDelay = loader.TestDelay;
                commTester.Master    = device.Central;

                Log.Status("Profiler: {0} (Test Trials: {1}, Test Delay: {2})",
                           loader.Profiling ? "ENABLED" : "DISABLED",
                           commTester.Trials,
                           commTester.TestDelay);

                if (device.AvailableAddress is object)
                {
                    foreach (var address in device.AvailableAddress)
                    {
                        var menuItem = new ToolStripMenuItem(address.Name)
                        {
                            Tag = address
                        };
                        menuItem.Click += (sender, e) =>
                        {
                            if (sender is ToolStripMenuItem item)
                            {
                                if (item.Tag is DeviceAddress current)
                                {
                                    device.CurrentAddress = current;
                                    Log.Status($"CURRENT ADDRESS: {current.Name} [ {current.Value} ]");
                                    UpdateAddressMenu();
                                }
                            }
                        };

                        addressMenu.DropDownItems.Add(menuItem);
                    }
                    ;

                    device.CurrentAddress = device.AvailableAddress[0];
                    UpdateAddressMenu();
                }

                UpdateProfiling();
                InitializeFunctions();
                UpdatePorts();
                UpdateAppStates(AppState.APP_STATE_INITIALIZED);
            }
            catch (Exception e)
            {
                UpdateAppStates(AppState.APP_STATE_UNINITIALIZED);
                Log.Error(e.Message);
                MessageBox.Show(e.Message, "Error loading device");
            }
        }
 public static DeviceInfo LoadDevice(string name)
 {
     return(DeviceLoader.LoadDevices().First(device => device.deviceInfo.friendlyName == name).deviceInfo);
 }