// Use this for initialization void Start() { controller = GameObject.FindGameObjectWithTag("GameController").GetComponent <MainGenerator> (); anim = this.GetComponent <Animator> (); gen = GameObject.Find("Spawner").GetComponent <CircleGenerator> (); rb = this.GetComponent <Rigidbody2D> (); generatedEnemies = new List <GameObject> (); }
public PlayerForm() { this.Icon = Properties.Resource1.dcssreplay; frameGenerator = new MainGenerator(); tileoverrideform = new TileOverrideForm(); Configuration.Load(this); AfterConfiguration(); Visible = true; }
public ImageView(Stream file) { Title = "Fill Rectangle"; frameGenerator = new MainGenerator(System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), @"Extra")); canvasView.PaintSurface += OnCanvasViewPaintSurface; Content = canvasView; fileStream = file; Main(); }
private static void Main(string[] args) { Console.WriteLine("==============" + AppDomain.CurrentDomain.BaseDirectory); Console.WriteLine("TypeScriptGenerator DOTNET4.5 Stated: " + DateTime.Now.ToString("HH:mm:ss")); Console.WriteLine("CommandLine: " + string.Join(" ", args)); var options = new Options(); if (Parser.Default.ParseArguments(args, options)) { Console.WriteLine("Assemblies: "); foreach (var a in options.Assemblies) { Console.WriteLine(" - " + a); } Console.WriteLine("OutputPath: " + options.OutputFilePath); if (options.AttachDebugger) { Debugger.Launch(); Debugger.Break(); } var configuration = new GenerationConfiguration(); configuration.ControllerPredicate = t => typeof(ApiController).IsAssignableFrom(t); configuration.ActionsPredicate = m => m.IsPublic; configuration.SignalRGenerator = new SignalRGenerator(); configuration.GetActionParameters = GetActionParameters; configuration.UrlGenerator = new WebApiUrlGenerator(); var mainGenerator = new MainGenerator(options, configuration); mainGenerator.SetupWorkingFolder(); mainGenerator.GenerateTypeScriptContracts(); mainGenerator.GenerateSignalrHubs(); if (options.GenerateWebApiActions) { switch (options.ActionsStyle) { case ActionsStyle.Default: mainGenerator.GenerateWebApiActions(); break; case ActionsStyle.Aurelia: mainGenerator.GenerateAureliWebApiActions(); break; default: throw new ArgumentOutOfRangeException(); } } } else { Console.WriteLine("TypeScriptGenerator: Could not parse args: " + string.Join(" ", args)); } Console.WriteLine("TypeScriptGenerator Finished: " + DateTime.Now.ToString("HH:mm:ss")); }
static void Main(string[] args) { MainGenerator generator = new MainGenerator(); Console.WriteLine("Hello World!"); Task.Run(() => generator.GenerateImage().ContinueWith((_) => { Console.WriteLine("Async magic"); return; })); Console.WriteLine("it just works"); System.Console.Read(); }
public void GenerateData() //Generierung für Simulation direkt im Testfall, wo Simulation durchgeführt wird { for (var i = 5; i < 6; i++) { var approachId = i; var generatorDbCtx = DataGeneratorContext.GetContext(testGeneratorCtxString); var approach = ApproachRepository.GetApproachById(generatorDbCtx, approachId); /*var parameterSet = ParameterSet.Create(new object[] { Dbms.GetNewMasterDataBase(false, "Master40") }); * var dataBase = parameterSet.GetOption<DataBase<ProductionDomainContext>>();*/ var dbContext = MasterDBContext.GetContext(testCtxString); var resultContext = ResultContext.GetContext(testResultCtxString); var generator = new MainGenerator(); generator.StartGeneration(approach, dbContext, resultContext, true); } Assert.True(true); }
static void Main(string[] args) { var logger = new Logger(); Parser.Default.ParseArguments <CommandLineOptions>(args).WithParsed(op => { var mainGenerator = new MainGenerator(op.FilePath, logger); if (op.GenerateTxt) { mainGenerator.AddGenerator <TxtGenerator>(); } if (op.GenerateHTML) { mainGenerator.AddGenerator <HTMLGenerator>(); } var datas = mainGenerator.Generate(); if (datas is null) { return; } foreach (var data in datas) { string filePath = string.Empty; if (!string.IsNullOrWhiteSpace(op.OutputDirectory)) { filePath = op.OutputDirectory + "/"; } filePath += $"{data.DataName}.{data.FileExtension}"; logger.Info($"Saving {filePath}..."); File.WriteAllText(filePath, data.Data); } }); }
// Use this for initialization void Start() { ((GameObject)Instantiate(particleAparicion, this.transform.position, particleAparicion.transform.rotation)).transform.SetParent(this.transform); if (!isMotherboard) { if (rb == null) { rb = this.GetComponent <Rigidbody2D> (); rb.velocity = Vector3.right * speed; } controller = GameObject.FindGameObjectWithTag("GameController").GetComponent <MainGenerator> (); } else { if (rb == null) { rb = this.GetComponent <Rigidbody2D> (); rb.velocity = Vector3.down * speed; } controller = GameObject.FindGameObjectWithTag("GameController").GetComponent <MainGenerator> (); } rend = this.GetComponent <SpriteRenderer> (); }
public void ServiceStackBlockHelperTestUsingResourceFiles() { var gen = new MainGenerator(new Options(), new GenerationConfiguration()); MainGenerator.SetupHelpers(); gen.SetupTemplates("ServiceStack_Angular"); var model = new ServiceStackApiModel(); var requestModel = new ServiceStackRequestModel { Name = "MyRequest", ReturnTypeTypeScriptName = "string" }; model.Requests.Add(requestModel); requestModel.Routes.Add(new ServiceStackRouteInfo("GET", "path", "url2", "", new List <string> { "test" })); requestModel.Routes.Add(new ServiceStackRouteInfo("GET", "path", "url", "", new List <string>())); var compiledTemplate = Handlebars.Compile("{{> main.hbs }}"); var templateOutput = compiledTemplate(model); _testOutputHelper.WriteLine(templateOutput); }
public void VerifySimulatedData(MasterDBContext dbContext, DataGeneratorContext dbGeneratorCtx, ResultContext dbResultCtx, int simNumber) { var simulation = SimulationRepository.GetSimulationById(simNumber, dbGeneratorCtx); if (simulation != null) { var approach = ApproachRepository.GetApproachById(dbGeneratorCtx, simulation.ApproachId); if (approach.TransitionMatrixInput.ExtendedTransitionMatrix) { var generator = new MainGenerator(); generator.StartGeneration(approach, dbContext, dbResultCtx); var articleCount = ArticleRepository.GetArticleNamesAndCountForEachUsedArticleInSimulation(dbResultCtx, simNumber); var articlesByNames = ArticleRepository.GetArticlesByNames(articleCount.Keys.ToHashSet(), dbContext); var capabilities = ResourceCapabilityRepository.GetParentResourceCapabilities(dbContext); var actualTransitionMatrix = new TransitionMatrix { Pi = new double[capabilities.Count + 1, capabilities.Count + 1] }; var capPosByCapId = new Dictionary <int, int>(); foreach (var cap in capabilities) { var number = cap.Name.Substring(0, cap.Name.IndexOf(" ")); var pos = AlphabeticNumbering.GetNumericRepresentation(number); capPosByCapId.Add(cap.Id, pos); } foreach (var a in articlesByNames) { var operations = a.Value.Operations.ToList(); operations.Sort((o1, o2) => o1.HierarchyNumber.CompareTo(o2.HierarchyNumber)); var operationCount = 0; var lastCapPos = 0; do { var capPos = capPosByCapId[ operations[operationCount].ResourceCapability.ParentResourceCapability.Id]; actualTransitionMatrix.Pi[lastCapPos, capPos] += articleCount[a.Key]; lastCapPos = capPos + 1; operationCount++; } while (operationCount < operations.Count); actualTransitionMatrix.Pi[lastCapPos, capabilities.Count] += articleCount[a.Key]; } for (var i = 0; i <= capabilities.Count; i++) { var sum = 0.0; for (var j = 0; j <= capabilities.Count; j++) { sum += actualTransitionMatrix.Pi[i, j]; } for (var j = 0; j <= capabilities.Count; j++) { actualTransitionMatrix.Pi[i, j] /= sum; } } var transitionMatrixGenerator = new TransitionMatrixGenerator(); ActualOrganizationDegree = transitionMatrixGenerator.CalcOrganizationDegree( actualTransitionMatrix.Pi, capabilities.Count + 1); GeneratedOrganizationDegree = transitionMatrixGenerator.CalcOrganizationDegree( generator.TransitionMatrix.Pi, capabilities.Count + 1); System.Diagnostics.Debug.WriteLine("################################# Executed work plans have an organization degree of " + ActualOrganizationDegree + " (transition matrix has " + GeneratedOrganizationDegree + "; input was " + approach.TransitionMatrixInput.DegreeOfOrganization + ")"); } } }
public PlayerForm() { generator = new MainGenerator(); savedFrame = new TerminalCharacter[80, 24]; Visible = true; }
public async Task SystemTestAsync(int approachId , int orderQuantity , int maxBucketSize , long throughput , int seed , double arrivalRate , long simulationEnd) { ResultContext ctxResult = ResultContext.GetContext(resultCon: testResultCtxString); ProductionDomainContext masterCtx = ProductionDomainContext.GetContext(testCtxString); DataGeneratorContext dataGenCtx = DataGeneratorContext.GetContext(testGeneratorCtxString); var approach = ApproachRepository.GetApproachById(dataGenCtx, approachId); var generator = new MainGenerator(); await Task.Run(() => generator.StartGeneration(approach, masterCtx, ctxResult)); var simContext = new AgentSimulation(DBContext: masterCtx, messageHub: new ConsoleHub()); var simConfig = ArgumentConverter.ConfigurationConverter(ctxResult, 1); //LogConfiguration.LogTo(TargetTypes.Debugger, TargetNames.LOG_AGENTS, LogLevel.Trace, LogLevel.Trace); LogConfiguration.LogTo(TargetTypes.Debugger, TargetNames.LOG_AGENTS, LogLevel.Info, LogLevel.Info); //LogConfiguration.LogTo(TargetTypes.Debugger, TargetNames.LOG_AGENTS, LogLevel.Debug, LogLevel.Debug); //LogConfiguration.LogTo(TargetTypes.Debugger, CustomLogger.PRIORITY, LogLevel.Warn, LogLevel.Warn); //LogConfiguration.LogTo(TargetTypes.File, CustomLogger.SCHEDULING, LogLevel.Warn, LogLevel.Warn); //LogConfiguration.LogTo(TargetTypes.File, CustomLogger.DISPOPRODRELATION, LogLevel.Debug, LogLevel.Debug); //LogConfiguration.LogTo(TargetTypes.Debugger, CustomLogger.PROPOSAL, LogLevel.Warn, LogLevel.Warn); //LogConfiguration.LogTo(TargetTypes.Debugger, CustomLogger.INITIALIZE, LogLevel.Warn, LogLevel.Warn); //LogConfiguration.LogTo(TargetTypes.Debugger, CustomLogger.JOB, LogLevel.Warn, LogLevel.Warn); //LogConfiguration.LogTo(TargetTypes.File, CustomLogger.ENQUEUE, LogLevel.Warn, LogLevel.Warn); //LogConfiguration.LogTo(TargetTypes.Debugger, CustomLogger.JOBSTATE, LogLevel.Warn, LogLevel.Warn); //LogConfiguration.LogTo(TargetTypes.File, TargetNames.LOG_AKKA, LogLevel.Trace, LogLevel.Trace); //LogConfiguration.LogTo(TargetTypes.Debugger, TargetNames.LOG_AKKA, LogLevel.Warn); var dataGenSim = new DB.GeneratorModel.Simulation(); dataGenSim.ApproachId = approachId; dataGenSim.StartTime = DateTime.Now; await Task.Run(() => { dataGenCtx.Simulations.AddRange(dataGenSim); dataGenCtx.SaveChanges(); }); // update customized Configuration simConfig.AddOption(new DBConnectionString(testResultCtxString)); simConfig.ReplaceOption(new TimeConstraintQueueLength(480)); simConfig.ReplaceOption(new OrderArrivalRate(value: arrivalRate)); simConfig.ReplaceOption(new OrderQuantity(value: orderQuantity)); simConfig.ReplaceOption(new EstimatedThroughPut(value: throughput)); simConfig.ReplaceOption(new TimePeriodForThroughputCalculation(value: 2880)); simConfig.ReplaceOption(new Seed(value: seed)); simConfig.ReplaceOption(new SettlingStart(value: 0)); simConfig.ReplaceOption(new SimulationEnd(value: simulationEnd)); simConfig.ReplaceOption(new SaveToDB(value: true)); simConfig.ReplaceOption(new MaxBucketSize(value: maxBucketSize)); simConfig.ReplaceOption(new SimulationNumber(value: dataGenSim.Id)); simConfig.ReplaceOption(new DebugSystem(value: true)); simConfig.ReplaceOption(new WorkTimeDeviation(0.0)); // anpassen der Lieferzeiten anhand der Erwarteten Durchlaufzeit. simConfig.ReplaceOption(new MinDeliveryTime(80)); simConfig.ReplaceOption(new MaxDeliveryTime(150)); await Task.Run(() => ArgumentConverter.ConvertBackAndSave(ctxResult, simConfig, dataGenSim.Id)); var simulation = await simContext.InitializeSimulation(configuration : simConfig); if (simulation.IsReady()) { // Start simulation var sim = simulation.RunAsync(); simContext.StateManager.ContinueExecution(simulation); await sim; dataGenSim.FinishTime = DateTime.Now; dataGenSim.FinishedSuccessfully = sim.IsCompletedSuccessfully; await Task.Run(() => dataGenCtx.SaveChanges()); System.Diagnostics.Debug.WriteLine("################################# Simulation has finished with number " + dataGenSim.Id); Assert.True(condition: sim.IsCompleted); } }
private void Generate() { if (string.IsNullOrWhiteSpace(ConnectionString.Text)) { WinForms.MessageBox.Show("Cannot Continue without a connection string", "No connection string", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (string.IsNullOrWhiteSpace(LocationInput.Text)) { WinForms.MessageBox.Show("Cannot continue without root folder.", "No root folder", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (string.IsNullOrWhiteSpace(ProjectNameInput.Text)) { WinForms.MessageBox.Show("Cannot continue without a project name.", "No project name", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (string.IsNullOrWhiteSpace(ProjectNamespaceInput.Text)) { WinForms.MessageBox.Show("Cannot continue without a project namespace.", "No project namespace", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } _connectionString = ConnectionString.Text; var rootDirectory = new DirectoryInfo(LocationInput.Text); try { if (rootDirectory.Exists == false) { rootDirectory.Create(); } } catch (Exception) { WinForms.MessageBox.Show("The root folder does not exists and, unable to create it", "unable to create root folder", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } DatabaseSchema schema = null; try { var reader = new DatabaseReader(_connectionString, Providername); schema = reader.ReadAll(); } catch (Exception e) { WinForms.MessageBox.Show("Unable to read the database \n\n" + e.Message.Replace(Environment.NewLine, "\t" + Environment.NewLine), "Unable to read database", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } Settings.RootDirectory = rootDirectory; Settings.ProjectNamespace = ProjectNamespaceInput.Text; Settings.ProjectName = ProjectNameInput.Text; Settings.ConnectionString = ConnectionString.Text; Settings.Save(); try { MainGenerator.Generate(schema); } catch (Exception e) { WinForms.MessageBox.Show("Unable to generate code \n\n" + e.Message.Replace(Environment.NewLine, "\t" + Environment.NewLine), "Something went wrong", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
// Use this for initialization void Start() { controller = GameObject.FindGameObjectWithTag("GameController").GetComponent <MainGenerator> (); timerEnergy = 0; energy = maxFill; }
static void Main(string[] args) { Console.WriteLine("==============" + AppDomain.CurrentDomain.BaseDirectory); Console.WriteLine("TypeScriptGenerator.Core Stated: " + DateTime.Now.ToString("HH:mm:ss")); Console.WriteLine("CommandLine: " + string.Join(" ", args)); var options = new Options(); if (CommandLine.Parser.Default.ParseArguments(args, options)) { Console.WriteLine("Assemblies: "); foreach (var a in options.Assemblies) { Console.WriteLine(" - " + a); } Console.WriteLine("OutputPath: " + options.OutputFilePath); if (options.AttachDebugger) { Debugger.Launch(); Debugger.Break(); } var configuration = new GenerationConfiguration(); configuration.ControllerPredicate = t => { // Dynamically check types, as might not be using AspNetCore (might be ServiceStack for example). Note that namespace moved in core v3 var controllerBaseType = Type.GetType("Microsoft.AspNetCore.Mvc.Core.ControllerBase, Microsoft.AspNetCore.Mvc.Core") ?? Type.GetType("Microsoft.AspNetCore.Mvc.ControllerBase, Microsoft.AspNetCore.Mvc.Core"); if (controllerBaseType == null) { return(false); } return(controllerBaseType.IsAssignableFrom(t)); }; configuration.ActionsPredicate = m => { var iActionResultType = Type.GetType("Microsoft.AspNetCore.Mvc.IActionResult, Microsoft.AspNetCore.Mvc.Abstractions"); if (iActionResultType == null) { return(false); } var genericTaskType = typeof(Task <>); var iActionResultTypeTask = genericTaskType.MakeGenericType(Type.GetType("Microsoft.AspNetCore.Mvc.IActionResult, Microsoft.AspNetCore.Mvc.Abstractions")); var actionResultTypeTask = genericTaskType.MakeGenericType(Type.GetType("Microsoft.AspNetCore.Mvc.ActionResult, Microsoft.AspNetCore.Mvc.Core")); var httpResponseMessageType = Type.GetType("System.Net.Http.HttpResponseMessage, System.Net.Http"); var httpResponseMessageTypeTask = genericTaskType.MakeGenericType(httpResponseMessageType); return(m.IsPublic && !iActionResultType.IsAssignableFrom(m.ReturnType) && !iActionResultTypeTask.IsAssignableFrom(m.ReturnType) && !actionResultTypeTask.IsAssignableFrom(m.ReturnType) && !httpResponseMessageType.IsAssignableFrom(m.ReturnType) && !httpResponseMessageTypeTask.IsAssignableFrom(m.ReturnType)); }; configuration.SignalRGenerator = new SignalRGenerator(options); configuration.GetActionParameters = WebApiUrlGenerator.GetActionParameters; configuration.UrlGenerator = new WebApiUrlGenerator(); options.SupportMomentJs = true; var mainGenerator = new MainGenerator(options, configuration); mainGenerator.SetupWorkingFolder(); try { // TODO: Inspect the <assembly>.runtimeconfig.dev.json file to find places where packages can be loaded (see DependencyContext API?) mainGenerator.GenerateTypeScriptContracts(); } catch (ReflectionTypeLoadException ex) { Console.WriteLine("Reflection errors:"); foreach (var x in ex.LoaderExceptions) { Console.WriteLine(x.Message); } Console.WriteLine("***You might be able to fix this by adding: <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies> to your csproj file, until I figure out how to " + "use the deps.json / runtimeconfig.json files to load referenced assemblies automatically."); throw; } mainGenerator.GenerateSignalrHubs(); mainGenerator.GenerateServiceCallProxies(); } else { Console.WriteLine("TypeScriptGenerator: Could not parse args: " + string.Join(" ", args)); } Console.WriteLine("TypeScriptGenerator Finished: " + DateTime.Now.ToString("HH:mm:ss")); }
static void Main(string[] args) { Console.WriteLine("==============" + AppDomain.CurrentDomain.BaseDirectory); Console.WriteLine("TypeScriptGenerator.Core Stated: " + DateTime.Now.ToString("HH:mm:ss")); Console.WriteLine("CommandLine: " + string.Join(" ", args)); var options = new Options(); if (CommandLine.Parser.Default.ParseArguments(args, options)) { Console.WriteLine("Assemblies: "); foreach (var a in options.Assemblies) { Console.WriteLine(" - " + a); } Console.WriteLine("OutputPath: " + options.OutputFilePath); if (options.AttachDebugger) { Debugger.Launch(); Debugger.Break(); } var configuration = new GenerationConfiguration(); configuration.ControllerPredicate = t => typeof(ControllerBase).IsAssignableFrom(t); configuration.ActionsPredicate = m => m.IsPublic && !typeof(IActionResult).IsAssignableFrom(m.ReturnType) && !typeof(Task <IActionResult>).IsAssignableFrom(m.ReturnType) && !typeof(Task <ActionResult>).IsAssignableFrom(m.ReturnType) && !typeof(HttpResponseMessage).IsAssignableFrom(m.ReturnType) && !typeof(Task <HttpResponseMessage>).IsAssignableFrom(m.ReturnType); configuration.SignalRGenerator = new SignalRGenerator(); configuration.GetActionParameters = GetActionParameters; configuration.UrlGenerator = new WebApiUrlGenerator(); var mainGenerator = new MainGenerator(options, configuration); mainGenerator.SetupWorkingFolder(); try { // TODO: Inspect the <assembly>.runtimeconfig.dev.json file to find places where packages can be loaded (see DependencyContext API?) mainGenerator.GenerateTypeScriptContracts(); } catch (ReflectionTypeLoadException ex) { Console.WriteLine("Reflection errors:"); foreach (var x in ex.LoaderExceptions) { Console.WriteLine(x.Message); } Console.WriteLine("***You might be able to fix this by adding: <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies> to your csproj file, until I figure out how to " + "use the deps.json / runtimeconfig.json files to load referenced assemblies automatically."); throw; } mainGenerator.GenerateSignalrHubs(); if (options.GenerateWebApiActions) { switch (options.ActionsStyle) { case ActionsStyle.Default: mainGenerator.GenerateWebApiActions(); break; case ActionsStyle.Aurelia: mainGenerator.GenerateAureliWebApiActions(); break; default: throw new ArgumentOutOfRangeException(); } } } else { Console.WriteLine("TypeScriptGenerator: Could not parse args: " + string.Join(" ", args)); } Console.WriteLine("TypeScriptGenerator Finished: " + DateTime.Now.ToString("HH:mm:ss")); }