private void btnDraw_Click(object sender, EventArgs e) { PGM.bRender0G = cbSprite1.Checked; PGM.bRender1G = cbBg.Checked; PGM.bRender2G = cbSprite0.Checked; PGM.bRender3G = cbTx.Checked; Bitmap bm1 = PGM.GetAllGDI(); pictureBox1.Image = bm1; }
public async Task <Response> UpsertPgm(UpsertPgmCmd request) { ///// var existItem = await _context.PGMs.AnyAsync(x => x.Name == request.Name); if (existItem) { throw new BusinessLogicException(".این رکورد از قبل موجود می باشد"); } ///// if (!string.IsNullOrEmpty(request.Id)) { var item = await _context.PGMs.SingleOrDefaultAsync(x => x.Id == request.Id); if (item == null) { throw new BusinessLogicException("رکوردی یافت نشد"); } item.Name = request.Name; _context.PGMs.Update(item); } else { var item = new PGM { Id = Guid.NewGuid().ToString(), Name = request.Name, DepartmentId = request.DepartmentId, CreatedAt = DateTime.Now }; await _context.PGMs.AddAsync(item); } await _context.SaveChangesAsync(); return(new Response { Status = true, Message = "success" }); }
public void LoadRom() { mame.Timer.lt = new List <mame.Timer.emu_timer>(); sSelect = RomInfo.Rom.Name; Machine.FORM = this; Machine.rom = RomInfo.Rom; Machine.sName = Machine.rom.Name; Machine.sParent = Machine.rom.Parent; Machine.sBoard = Machine.rom.Board; Machine.sDirection = Machine.rom.Direction; Machine.sDescription = Machine.rom.Description; Machine.sManufacturer = Machine.rom.Manufacturer; Machine.lsParents = RomInfo.GetParents(Machine.sName); int i; switch (Machine.sBoard) { case "CPS-1": case "CPS-1(QSound)": case "CPS2": Video.nMode = 3; itemSize = new ToolStripMenuItem[Video.nMode]; for (i = 0; i < Video.nMode; i++) { itemSize[i] = new ToolStripMenuItem(); itemSize[i].Size = new Size(152, 22); itemSize[i].Click += new EventHandler(itemsizeToolStripMenuItem_Click); } itemSize[0].Text = "512x512"; itemSize[1].Text = "512x256"; itemSize[2].Text = "384x224"; resetToolStripMenuItem.DropDownItems.Clear(); resetToolStripMenuItem.DropDownItems.AddRange(itemSize); itemSelect(); cpsToolStripMenuItem.Enabled = true; neogeoToolStripMenuItem.Enabled = false; namcos1ToolStripMenuItem.Enabled = false; CPS.CPSInit(); CPS.GDIInit(); break; case "Neo Geo": Video.nMode = 1; itemSize = new ToolStripMenuItem[Video.nMode]; for (i = 0; i < Video.nMode; i++) { itemSize[i] = new ToolStripMenuItem(); itemSize[i].Size = new Size(152, 22); itemSize[i].Click += new EventHandler(itemsizeToolStripMenuItem_Click); } itemSize[0].Text = "320x224"; resetToolStripMenuItem.DropDownItems.Clear(); resetToolStripMenuItem.DropDownItems.AddRange(itemSize); Video.iMode = 0; itemSelect(); cpsToolStripMenuItem.Enabled = false; neogeoToolStripMenuItem.Enabled = true; namcos1ToolStripMenuItem.Enabled = false; Neogeo.NeogeoInit(); Neogeo.GDIInit(); break; case "Namco System 1": Video.nMode = 1; itemSize = new ToolStripMenuItem[Video.nMode]; for (i = 0; i < Video.nMode; i++) { itemSize[i] = new ToolStripMenuItem(); itemSize[i].Size = new Size(152, 22); itemSize[i].Click += new EventHandler(itemsizeToolStripMenuItem_Click); } itemSize[0].Text = "288x224"; resetToolStripMenuItem.DropDownItems.Clear(); resetToolStripMenuItem.DropDownItems.AddRange(itemSize); Video.iMode = 0; itemSelect(); cpsToolStripMenuItem.Enabled = false; neogeoToolStripMenuItem.Enabled = false; namcos1ToolStripMenuItem.Enabled = true; Namcos1.Namcos1Init(); Namcos1.GDIInit(); break; case "IGS011": Video.nMode = 1; itemSize = new ToolStripMenuItem[Video.nMode]; for (i = 0; i < Video.nMode; i++) { itemSize[i] = new ToolStripMenuItem(); itemSize[i].Size = new Size(152, 22); itemSize[i].Click += new EventHandler(itemsizeToolStripMenuItem_Click); } itemSize[0].Text = "512x240"; resetToolStripMenuItem.DropDownItems.Clear(); resetToolStripMenuItem.DropDownItems.AddRange(itemSize); Video.iMode = 0; itemSelect(); cpsToolStripMenuItem.Enabled = false; neogeoToolStripMenuItem.Enabled = false; namcos1ToolStripMenuItem.Enabled = false; IGS011.GDIInit(); IGS011.IGS011Init(); break; case "PGM": Video.nMode = 1; itemSize = new ToolStripMenuItem[Video.nMode]; for (i = 0; i < Video.nMode; i++) { itemSize[i] = new ToolStripMenuItem(); itemSize[i].Size = new Size(152, 22); itemSize[i].Click += new EventHandler(itemsizeToolStripMenuItem_Click); } itemSize[0].Text = "448x224"; resetToolStripMenuItem.DropDownItems.Clear(); resetToolStripMenuItem.DropDownItems.AddRange(itemSize); Video.iMode = 0; itemSelect(); cpsToolStripMenuItem.Enabled = false; neogeoToolStripMenuItem.Enabled = false; namcos1ToolStripMenuItem.Enabled = false; PGM.PGMInit(); PGM.GDIInit(); break; } if (Machine.bRom) { Mame.init_machine(); Generic.nvram_load(); } else { MessageBox.Show("error rom"); } }
private static int Main(string[] args) { // Test if input arguments were supplied. Parser.Default.ParseArguments <Options>(args) .WithParsed <Options>(o => { // set logger LoggingLevelSwitch levelSwitch = new LoggingLevelSwitch { MinimumLevel = LogEventLevel.Debug }; Logger log = new LoggerConfiguration() .MinimumLevel.ControlledBy(levelSwitch) .WriteTo.Console(restrictedToMinimumLevel: LogEventLevel.Debug) .WriteTo.File("backend_component_model_log-.txt", outputTemplate: "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level:u3}] {Message:lj}{NewLine}{Exception}", rollingInterval: RollingInterval.Day, restrictedToMinimumLevel: LogEventLevel.Information) .CreateLogger(); log.ForContext <MachineLearning>(); // load environmental variables // DB connection configuration JObject o1 = JObject.Parse(File.ReadAllText(@"C:\Users\Administrator\Documents\GitHub\machine-fault-diagnosis\backend\components\model\model_app\model_app\config\DBconfig.json")); Environment.SetEnvironmentVariable("DBURL", (string)o1["DBURL"]); Environment.SetEnvironmentVariable("DBUSER", (string)o1["DBUSER"]); Environment.SetEnvironmentVariable("DBPW", (string)o1["DBPW"]); // Model training configuration JObject o2 = JObject.Parse(File.ReadAllText(@"C:\Users\Administrator\Documents\GitHub\machine-fault-diagnosis\backend\components\model\model_app\model_app\config\Trainconfig.json")); Environment.SetEnvironmentVariable("ModelFile", (string)o2["ModelFile"]); Environment.SetEnvironmentVariable("DataFile", (string)o2["DataFile"]); Environment.SetEnvironmentVariable("TrainedModelFile", (string)o2["TrainedModelFile"]); Environment.SetEnvironmentVariable("TrainingLogFile", (string)o2["TrainingLogFile"]); if (o.mode == "I" || o.mode == "Interactive") { // Opens the interactive C# app } else { // Run machine learning engine in the background switch (o.ModelType) { case "ProbabilisticNetwork": log.Information("Start Probabilistic Graphical Model Engine"); Console.WriteLine("Please choose a task (Train, Inference or All)"); string t = Console.ReadLine(); string estimateStructure1; if (t != "Inference") { Console.WriteLine("Please choose whether to estimated the graph structure or not ( Yes or No)"); estimateStructure1 = Console.ReadLine(); } else { estimateStructure1 = "No"; } PGM BNEngine = new PGM(); int result = BNEngine.Run(task: t, estimateStructure: estimateStructure1); break; case "TimeSeriesAnalysis": log.Information("Start Time-series Analysis Engine"); break; case "BinaryClassification": log.Information("Start Binary Classification Engine"); string[] algorithms1 = { "AveragedPerceptronTrainer", "SdcaLogisticRegressionBinaryTrainer", "SdcaNonCalibratedBinaryTrainer", "SymbolicSgdLogisticRegressionBinaryTrainer", "LbfgsLogisticRegressionBinaryTrainer", "LightGbmBinaryTrainer", "FastTreeBinaryTrainer", "FastForestBinaryTrainer", "GamBinaryTrainer", "FieldAwareFactorizationMachineTrainer", "PriorTrainer", "LinearSvmTrainer" }; Console.WriteLine("Please choose an algorithm from below"); Console.WriteLine(algorithms1); string al1 = Console.ReadLine(); BinaryClassification bc = new BinaryClassification(al1); int bcResult = bc.Run(); break; case "MultiClassification": log.Information("Start Multi Classification Engine"); string[] algorithms2 = { "LightGbmMulticlassTrainer", "SdcaMaximumEntropyMulticlassTrainer", "SdcaNonCalibratedMulticlassTrainer", "LbfgsMaximumEntropyMulticlassTrainer", "NaiveBayesMulticlassTrainer", "OneVersusAllTrainer", "PairwiseCouplingTrainer", "ImageClassificationTrainer" }; Console.WriteLine("Please choose an algorithm from below"); Console.WriteLine(algorithms2); string al2 = Console.ReadLine(); MultiClassification mc = new MultiClassification(al2); int mcResult = mc.Run(); break; case "Regression": log.Information("Start Regression Engine"); string[] algorithms3 = { "LbfgsPoissonRegressionTrainer", "LightGbmRegressionTrainer", "SdcaRegressionTrainer", "OlsTrainer", "OnlineGradientDescentTrainer", "FastTreeRegressionTrainer", "FastTreeTweedieTrainer", "FastForestRegressionTrainer", "GamRegressionTrainer" }; Console.WriteLine("Please choose an algorithm from below"); Console.WriteLine(algorithms3); string al3 = Console.ReadLine(); Regression rg = new Regression(al3); int rgResult = rg.Run(); break; case "Clustering": log.Information("Start Clustering Engine. Use KMeans algorithm"); string al4 = "KMeans"; Clustering cluster = new Clustering(al4); int clusResult = cluster.Run(); break; case "AnomalyDetection": log.Information("Start Anomaly Detection Engine. Use Randomized PCA algorithm"); string al5 = "RandomPCA"; Anomaly ano = new Anomaly(al5); int anoResult = ano.Run(); break; case "Ranking": log.Information("Start Ranking Engine"); string[] algorithms6 = { "LightGbmRankingTrainer", "FastTreeRankingTrainer" }; Console.WriteLine("Please choose an algorithm from below"); Console.WriteLine(algorithms6); string al6 = Console.ReadLine(); Ranking rank = new Ranking(al6); int rankResult = rank.Run(); break; case "Recommendation": log.Information("Start Recommendation Engine"); string al7 = "MatrixFactorizationTrainer"; Recommendation recomm = new Recommendation(al7); int recommResult = recomm.Run(); break; case "Forecast": log.Information("Start Forecasting Engine"); string al8 = "ForecastBySsa"; Forecast forecast = new Forecast(al8); int forecastResult = forecast.Run(); break; default: log.Information("Start AutoML Engine"); break; } } } ).WithNotParsed(HandleParseError); return(0); }