public void LoadInfo() { _genParams = mProject.GenerationParams.Clone(); _projParams = mProject.Params.Clone(); generationParametersBindingSource.DataSource = _genParams; projectParametersBindingSource.DataSource = _projParams; }
private void GenerateAllSprocsFile(CslaObjectInfo info, string dir, GenerationParameters generationParams) { var selfLoad = CslaTemplateHelper.GetSelfLoad(info); StringBuilder proc = new StringBuilder(); //make sure we don't generate selects when we don't need to. if (!((info.ObjectType == CslaObjectType.EditableChildCollection || info.ObjectType == CslaObjectType.EditableChild) && !selfLoad)) { foreach (Criteria crit in info.CriteriaObjects) { if (crit.GetOptions.Procedure && !String.IsNullOrEmpty(crit.GetOptions.ProcedureName)) { proc.AppendLine(GenerateProcedure(info, crit, "SelectProcedure.cst", crit.GetOptions.ProcedureName)); } } } if (info.ObjectType != CslaObjectType.ReadOnlyObject && info.ObjectType != CslaObjectType.ReadOnlyCollection && info.ObjectType != CslaObjectType.EditableRootCollection && info.ObjectType != CslaObjectType.DynamicEditableRootCollection && info.ObjectType != CslaObjectType.EditableChildCollection && info.ObjectType != CslaObjectType.NameValueList) { //Insert if (info.InsertProcedureName != "") { proc.AppendLine(GenerateProcedure(info, null, "InsertProcedure.cst", info.InsertProcedureName)); } //update if (info.UpdateProcedureName != "") { proc.AppendLine(GenerateProcedure(info, null, "UpdateProcedure.cst", info.UpdateProcedureName)); } //delete foreach (Criteria crit in info.CriteriaObjects) { if (crit.DeleteOptions.Procedure && !String.IsNullOrEmpty(crit.DeleteOptions.ProcedureName)) { proc.AppendLine(GenerateProcedure(info, crit, "DeleteProcedure.cst", crit.DeleteOptions.ProcedureName)); } } if (_targetFramework != TargetFramework.CSLA40 && info.ObjectType == CslaObjectType.EditableChild) { proc.AppendLine(GenerateProcedure(info, null, "DeleteProcedure.cst", info.DeleteProcedureName)); } } if (proc.Length > 0) { CheckDirectory(dir + @"\sprocs"); WriteToFile(dir + @"\sprocs\" + info.ObjectName + ".sql", proc.ToString()); } }
internal void LoadInfo() { _genParams = project.GenerationParams.Clone(); _projParams = project.Params.Clone(); generationParametersBindingSource.DataSource = _genParams; projectParametersBindingSource.DataSource = _projParams; NotYetImplemented(); }
internal static void SetDefaultDbProvider(GenerationParameters generationParams) { GenerationDbProvider = null; DbProvider = null; if (!generationParams.UseDal) { SetCurrentDbProvider( GeneratorController.Current.CurrentUnit.GenerationParams.GenerationDbProviderCollection.GetActive()); } }
// Only to be called by user in editor // As not much though has been placed in here private void RegenerateMap() { oldParameters = GetParameters(); MapGenerator generator = new MapGenerator(oldParameters); MapGenerationProgress.InstantiateNew(generator); generationTask = Task.Run(() => { GridMap.Instance.GenerateMap(generator); RegenerateMeshes(); }); }
void LoadInfo() { GenerationParameters p = _unit.GenerationParams; cboTarget.SelectedItem = p.TargetFramework.ToString(); chkActiveObjects.Checked = p.ActiveObjects; chkBackUpOldSource.Checked = p.BackupOldSource; chkGenerateStoredProcedures.Checked = p.GenerateSprocs; chkSpOneFile.Checked = p.OneSpFilePerObject; chkSeparateBaseClasses.Checked = p.SeparateBaseClasses; chkSeparateNamespaces.Checked = p.SeparateNamespaces; chkUseDotDesignerFileNameConvention.Checked = p.UseDotDesignerFileNameConvention; }
void SaveInfo() { GenerationParameters p = _unit.GenerationParams; p.TargetFramework = (TargetFramework)Enum.Parse(typeof(TargetFramework), (string)cboTarget.SelectedItem); p.ActiveObjects = chkActiveObjects.Checked; p.BackupOldSource = chkBackUpOldSource.Checked; p.GenerateSprocs = chkGenerateStoredProcedures.Checked; p.OneSpFilePerObject = chkSpOneFile.Checked; p.SeparateBaseClasses = chkSeparateBaseClasses.Checked; p.SeparateNamespaces = chkSeparateNamespaces.Checked; p.UseDotDesignerFileNameConvention = chkUseDotDesignerFileNameConvention.Checked; }
/// <summary> /// generates an infinite sequence of generated values /// </summary> /// <param name="gen">generator</param> /// <typeparam name="T">generator element type</typeparam> /// <returns>an infinite sequence of generates values of type T</returns> public static IEnumerable <T> Enumerate <T>(this Gen <T> gen, GenerationParameters env) { var seed = env.InitialSeed; while (true) { if (gen(seed, out var result)) { yield return(result.Value); seed = result.Next; } } }
static void Main(string[] args) { var parameters = new GenerationParameters { Size = 9, WaterDensity = FillerDensity.Medium, MountainsDensity = FillerDensity.Low }; var worldGen = new WorldGenerator.WorldGen(parameters); var world = worldGen.GenerateWorld(); var printer = new WorldPrinter(); printer.PrintWorld(world); Console.ReadKey(); }
public static void Demo2() { var options = new JsonSerializerOptions { WriteIndented = true }; var env = new GenerationParameters(); var service = new Container(env, 10, 10, 3); foreach (var order in service.Orders) { Console.WriteLine("{0}", JsonSerializer.Serialize(order, options)); } }
void Update() { switch (state) { case State.Created: state = State.GeneratingMap; logger.Log("generating new map"); GenerationParameters parameters = GetParameters(); MapGenerator generator = new MapGenerator(parameters); MapGenerationProgress.InstantiateNew(generator); oldParameters = parameters; generationTask = Task.Run(() => GridMap.Instance.GenerateMap(generator)); break; case State.GeneratingMap: case State.LoadingMap: if (GridMap.Instance.IsGenerationDone()) { logger.Log("Map finished generation"); state = State.MapGenerated; } break; case State.MapGenerated: logger.Log("Creating meshGenerators"); BlockMeshes.LoadMeshes(); createMeshCreators(); UpdateMaxVerticalLevel(); RegenerateMeshes(); state = State.MeshGeneratorsCreated; cameraObserver = new SimpleObserver <CameraController>(mainCam, (cam) => { UpdateMaxVerticalLevel(); RegenerateMeshes(); }); break; case State.MeshGeneratorsCreated: break; } if (!oldParameters.Equals(GetParameters()) && generationTask != null && !generationTask.Status.Equals(TaskStatus.Running)) { regenerateMap = false; RegenerateMap(); } }
public static void Demo1() { var gen = from i in String(6, HexDigit()) from f in Choose("Abe", "Joe", "Bea", "Ben", "Bob", "Sue", "Sky", "Roy", "Ted") from l in Choose("Smith", "Miller", "Meyer", "Tailor", "Fisher", "Potter", "Carter", "Cooper") from y in Range(1960, 2010) select new Person(i, f, l, y); var env = new GenerationParameters(); foreach (var person in gen.Enumerate(env).Take(12).OrderBy(p => p.lastName)) { Console.WriteLine("{0}", person); } }
private bool TryGenerateNewCodes(GenerationParameters requestData) { var generationSucceeded = _codeGenerator.TryAddNewUniqueCodes(_codes, requestData.CodeLength, requestData.NumberOfCodesToGenerate, out var newCodes); if (!generationSucceeded) { return(false); } if (SaveCodesToStorage()) { return(true); } // Rollback if save to storage failed. _codes.RemoveRange(newCodes); return(false); }
public PrototypeDungeonGenerator(AbstractDungeonStructure structure, int seed, GenerationParameters generationParameters = null) { _seed = seed; _random = new Random(seed); _generationParameters = generationParameters; _loadedStructure = DungeonStructureConcretizer.ConcretizeStructure(structure, _random); _loadedRooms = RoomResourceLoader.LoadRoomPrototypes(_loadedStructure); _marginHalf = structure.StructureMetaData.MarginUnit / 2f; CollectMetaData(_loadedStructure); if (_generationParameters != null) { ParameterizeDungeon(); } if (_stepBackCounter == null) { _stepBackCounter = new StepBackCounter(DefaultMaxSteps); } }
public Container(GenerationParameters env, int productCount, int userCount, int orderCount) { // generator for Product var products = from key in String(6, HexDigit()) from nam in Word from des in Sentence select new Product(key, nam, des); // generator for Person var users = from id in Concat(Const("U-"), String(4, HexDigit())) from fi in Choose("Abe", "Joe", "Bea", "Ben", "Bob", "Sue", "Sky", "Roy", "Ted") from la in Choose("Smith", "Miller", "Meyer", "Tailor", "Fisher", "Potter", "Carter", "Cooper") from ye in Range(1960, 2010) select new Person(id, fi, la, ye); // generator for LineItem dependent on a products generator var items = Link(products, (products) => from k in Concat(Const("I-"), String(4, HexDigit())) from a in Range(1, 10) from p in Choose(products) select new LineItem(k, a, p) ); // generator for Orders var orders = Link(users, products, (users, products) => from k in Concat(Const("O-"), String(4, HexDigit())) from p in Choose(users) from n in Range(new DateTime(2015, 1, 1), DateTime.Today) from i in items(products).List(3, 7) select new Order(k, p, n, i) ); Products = products.Enumerate(env).Take(productCount).ToList(); Users = users.Enumerate(env).Take(userCount).ToList(); Orders = orders(Users, Products).Enumerate(env).Take(orderCount).ToList(); }
public ActionResult AuthUser([FromBody] GenerationParameters parameters) { // todo: put here you generator request return(Ok()); }
public MapGenerator(GenerationParameters parameters) { this.parameters = parameters; }
public void GenerateMap(GenerationParameters parameters) { if (parameters == null) { throw new System.ArgumentNullException(); } // Generate grid grid.Clear(); gridItemObject.SetActive(true); /*** Sublevels ***/ // Rescale object if required if (parameters.columns > (width - 2 * itemWidth) / itemWidth) { // Get scale factor float percentage = width / ((parameters.columns + 2) * itemWidth); // Scale width accordingly Vector3 scale = gridItemObject.transform.localScale; scale.x *= percentage; itemWidth *= percentage; gridItemObject.transform.localScale = scale; } if (parameters.lines > height / itemHeight) { // Get scale factor float percentage = height / (parameters.lines * itemHeight); // Scale width accordingly Vector3 scale = gridItemObject.transform.localScale; scale.y *= percentage; itemHeight *= percentage; gridItemObject.transform.localScale = scale; } /*** Start area ***/ if (parameters.startArea != null) { GameObject createdObject = Instantiate(gridItemObject, gridmapObject.transform); grid.Add(new GridLevelObject() { sublevel = parameters.startArea, isStartArea = true, itemObject = createdObject.GetComponent <LevelMapSystem>(), }); createdObject.transform.localPosition = new Vector2(itemWidth / 2, 0); } Vector2 offset = new Vector2(itemWidth + itemWidth / 2, (itemHeight / 2f) * (parameters.lines - 1)); Vector2 pos = Vector2.zero; Vector2 bossPos = new Vector2(width - itemWidth / 2, 0); for (int i = 0; i < parameters.lines; i++) { for (int j = 0; j < parameters.columns; j++) { int k = parameters.columns * i + j; // If max reached, exit if (k >= parameters.levelsToGenerate) { i = parameters.lines; j = parameters.columns; continue; } GameObject createdObject = Instantiate(gridItemObject, gridmapObject.transform); grid.Add(new GridLevelObject() { sublevel = parameters.sublevels[k], lineIndex = i, columnIndex = j, itemObject = createdObject.GetComponent <LevelMapSystem>(), }); createdObject.transform.localPosition = offset + pos; pos.x += itemWidth; } if (i == 0) { bossPos = new Vector2(itemWidth * 1.5f + pos.x, 0); } pos.x = 0; pos.y -= itemHeight; } /*** Boss area ***/ if (parameters.bossArea != null) { GameObject createdObject = Instantiate(gridItemObject, gridmapObject.transform); grid.Add(new GridLevelObject() { sublevel = parameters.bossArea, isBossArea = true, itemObject = createdObject.GetComponent <LevelMapSystem>(), }); createdObject.transform.localPosition = bossPos; } gridItemObject.SetActive(false); // Add OnPlayerEnter events foreach (GridLevelObject item in grid) { item.itemObject.SetVisible(false); item.itemObject.SetSeen(false); item.itemObject.SetText(item.sublevel.GetComponent <LevelSystem>().sublevelType); LevelSystem levelSystem = item.sublevel.GetComponent <LevelSystem>(); levelSystem.OnPlayerEnter += LevelMapGenerator_OnPlayerEnter; levelSystem.OnPlayerExit += LevelSystem_OnPlayerExit; } }