public Texture2D generateTexture(float scale, GenerationType genType) { tiles = null; switch (genType) { case GenerationType.Room: tiles = generateRooms(roomCount); break; case GenerationType.Cave: var noise = utils.normalizeMap(Simplex.Noise.Calc2D(sizeTiles.x, sizeTiles.y, scale)); tiles = noisesToTiles(noise); break; case GenerationType.Mix: noise = utils.normalizeMap(Simplex.Noise.Calc2D(sizeTiles.x, sizeTiles.y, scale)); tiles = noisesToTiles(noise); break; } HallRemoval(); return(fillTexture(tiles)); }
public static AbstractNetwork CreateNetworkByType(ModelType mt, String rName, ResearchType rType, GenerationType gType, Dictionary <ResearchParameter, object> rParams, Dictionary <GenerationParameter, object> genParams, AnalyzeOption AnalyzeOptions, ContainerMode mode) { ModelTypeInfo[] info = (ModelTypeInfo[])mt.GetType().GetField(mt.ToString()).GetCustomAttributes(typeof(ModelTypeInfo), false); Type t = Type.GetType(info[0].Implementation); Type[] constructTypes = new Type[] { typeof(String), typeof(ResearchType), typeof(GenerationType), typeof(Dictionary <ResearchParameter, object>), typeof(Dictionary <GenerationParameter, object>), typeof(AnalyzeOption), typeof(ContainerMode) }; object[] invokeParams = new object[] { rName, rType, gType, rParams, genParams, AnalyzeOptions, mode }; return((AbstractNetwork)t.GetConstructor(constructTypes).Invoke(invokeParams)); }
public IWeightedTermConstructionFlow GenerationTerm(GenerationType generationType, ICollection <string> terms) { var operand = SearchConditionNodeFactory.CreateGenerationTerm(rootOperator, generationType, terms); weightedOperands.Add(operand, null); return(this); }
public void onLoad(bool reset, GenerationType type) { Console.CursorVisible = false; ClearWorld(); ClearGround(); running = true; stop = false; ground = WorldManager.GenerateWorld(ground, worldSize, type); ClearFrameBuffer(); ClearWorld(); InitializeCollisionMap(); InitializeStairs(reset); InitializePlayer(reset); InitializeEnemies(reset); InintializePrincessAndDragon(reset); onUpdate.Add(player.Update); lastFrameDone = true; resetWorld = false; }
public void DetermineTechLevel() { int numberOfUpgradeTechs = 1; if (PluginHelper.upgradeAvailable(upgradeTechReq)) { numberOfUpgradeTechs++; } if (PluginHelper.upgradeAvailable(upgradeTechReq2)) { numberOfUpgradeTechs++; } if (numberOfUpgradeTechs == 3) { EngineGenerationType = GenerationType.Mk3; } else if (numberOfUpgradeTechs == 2) { EngineGenerationType = GenerationType.Mk2; } else { EngineGenerationType = GenerationType.Mk2; } }
public string GenerateFilename(IScope scope, string name, string extension, GenerationType type) { string result = GetStreamDirectory(scope) + name; if (extension != null && !string.Empty.Equals(extension)) { result += extension; } return result; }
public async Task <string> Generate(GenerationType type, byte len) { this.defalt_len = len; if (len < 4) { this.defalt_len = 4; } else if (len > 30) { this.defalt_len = 30; } string key = ""; switch (type) { case GenerationType.pattern: key = await pattern(); break; case GenerationType.numeric: key = await numeric(); break; case GenerationType.character: key = await character(); break; case GenerationType.symbol: key = await symbol(); break; case GenerationType.binary: key = binary(); break; } return(key); }
public string GetOutput(string outputPath, bool isNetCore, GenerationType generationType, string migrationIdentifier, string contextName) { var launchPath = isNetCore ? DropNetCoreFiles() : DropFiles(outputPath); var startInfo = new ProcessStartInfo { FileName = Path.Combine(Path.GetDirectoryName(launchPath) ?? throw new InvalidOperationException(), "efpt.exe"), Arguments = "\"" + outputPath + "\"", UseShellExecute = false, RedirectStandardOutput = true, RedirectStandardError = true, CreateNoWindow = true }; if (generationType == GenerationType.Ddl) { startInfo.Arguments = "ddl \"" + outputPath + "\""; } if (generationType == GenerationType.MigrationStatus) { startInfo.Arguments = "migrationstatus \"" + outputPath + "\""; } if (generationType == GenerationType.MigrationApply) { startInfo.Arguments = "migrate \"" + outputPath + "\" " + migrationIdentifier; } if (generationType == GenerationType.MigrationAdd) { startInfo.Arguments = "addmigration \"" + outputPath + "\" " + contextName + " " + migrationIdentifier; } if (isNetCore) { startInfo.WorkingDirectory = launchPath; startInfo.FileName = "dotnet"; startInfo.Arguments = " efpt.dll \"" + outputPath + "\""; if (generationType == GenerationType.Ddl || generationType == GenerationType.MigrationApply || generationType == GenerationType.MigrationAdd || generationType == GenerationType.MigrationStatus) { startInfo.Arguments = " efpt.dll " + startInfo.Arguments; } } var standardOutput = new StringBuilder(); using (var process = Process.Start(startInfo)) { while (process != null && !process.HasExited) { standardOutput.Append(process.StandardOutput.ReadToEnd()); } if (process != null) { standardOutput.Append(process.StandardOutput.ReadToEnd()); } } return(standardOutput.ToString()); }
public string Generate(GenerationType type, byte len) { this.defalt_len = len; if (len < 4) { this.defalt_len = 4; } else if (len > 30) { this.defalt_len = 30; } string key = ""; this.composite_string_key = ""; switch (type) { case GenerationType.pattern: key = pattern(); break; case GenerationType.numeric: key = numeric(); break; case GenerationType.character: key = character(); break; case GenerationType.symbol: key = symbol(); break; case GenerationType.emoticon: key = emoticon(); break; case GenerationType.binary: key = binary(); break; } return(key); }
private double GetMaximumTemperatureForGen(GenerationType generationType) { var generation = (int)generationType; if (generation >= (int)GenerationType.Mk6 && isGraphene) { return(RadiatorProperties.RadiatorTemperatureMk6); } if (generation >= (int)GenerationType.Mk5 && isGraphene) { return(RadiatorProperties.RadiatorTemperatureMk5); } if (generation >= (int)GenerationType.Mk4) { return(RadiatorProperties.RadiatorTemperatureMk4); } if (generation >= (int)GenerationType.Mk3) { return(RadiatorProperties.RadiatorTemperatureMk3); } if (generation >= (int)GenerationType.Mk2) { return(RadiatorProperties.RadiatorTemperatureMk2); } else { return(RadiatorProperties.RadiatorTemperatureMk1); } }
private void Enqueue <T>(GenerationType type, string[] paths, Func <string, int, T> transform, Action <T, Template> action) { var templates = _templateController.Templates.Where(m => !m.HasCompileException).ToArray(); if (!templates.Any()) { return; } Log.Debug("{0} queued {1}", type, string.Join(", ", paths)); _eventQueue.Enqueue(() => { var stopwatch = Stopwatch.StartNew(); paths.ForEach((path, i) => { var item = transform(path, i); templates.ForEach(template => action(item, template)); }); templates.GroupBy(m => m.ProjectFullName).ForEach(template => template.First().SaveProjectFile()); stopwatch.Stop(); Log.Debug("{0} processed {1} in {2}ms", type, string.Join(", ", paths), stopwatch.ElapsedMilliseconds); }); }
private void DrawConditionSection(ComponentGenerator gen) { gen.GenerateConditionType = (GenerationType)EditorGUILayout.EnumPopup("ConditionType", gen.GenerateConditionType); ClearPreviousCondition(gen, PrevConditionType); switch (gen.GenerateConditionType) { case GenerationType.Internal: gen.GenerateCondition = null; break; case GenerationType.External: gen.GenerateCondition = (GeneratorConditionComponent)EditorGUILayout.ObjectField("GenerateCondition", gen.GenerateCondition, typeof(GeneratorConditionComponent), true); EditorGUILayout.Space(); if (gen.GenerateCondition != null) { CreateEditor(gen.GenerateCondition).DrawDefaultInspector(); } break; case GenerationType.Cooldown: CooldownCondition IntervalCond = gen.gameObject.GetComponent <CooldownCondition>() ?? gen.gameObject.AddComponent <CooldownCondition>(); IntervalCond.WaitTime = EditorGUILayout.Slider("Cooldown", IntervalCond.WaitTime, 0, 100); gen.GenerateCondition = IntervalCond; break; } PrevConditionType = gen.GenerateConditionType; }
public IWeightedTermConstructionFlow GenerationTerm(GenerationType generationType, ICollection <string> terms, float weight) { EnsureWeightIsCorrect(weight); var operand = SearchConditionNodeFactory.CreateGenerationTerm(rootOperator, generationType, terms); weightedOperands.Add(operand, weight); return(this); }
public My_Constant(Schematix.FSM.Constructor_Core core) : base(core) { Gen_Type = GenerationType.Generic; Color = Color.Green; base.name = ("Constant" + core.Graph.Constants.Count.ToString()); base.label_name.Text = name + " = " + Default_Value; }
public string GenerateFilename(IScope scope, string name, string extension, GenerationType type) { string result = GetStreamDirectory(scope) + name; if(extension != null && !string.Empty.Equals(extension)) { result += extension; } return result; }
private void GenerateAll(GenerationType generateType, SqlObjectType type, Type subType, string keyword) { var subTypes = Enum.GetValues(subType); foreach (var value in subTypes) { GenerateInternal(generateType, type, value, keyword); } }
/// <summary> /// Seconde etape de l'export /// Permet de choisir quelle fonction lancer en fonction du type d'export lancé /// </summary> /// <param name="generationType">Element de l'énum <see cref="GenerationType"/></param> /// <param name="generationPath">Chemin du dossier cible pour la sauvegarde</param> private void Generation(GenerationType generationType, string generationPath) { switch (generationType) { case GenerationType.txt: GenerationTXT(generationPath); break; } }
public static void SendGeneration(GenerationType type) { ModPacket p = ServerSideCharacter.Instance.GetPacket(); p.Write((int)SSCMessageType.GenResources); p.Write((byte)Main.myPlayer); p.Write((byte)type); p.Send(); }
public void Generate(string outputPath, Project project, GenerationType generationType) { try { if (string.IsNullOrEmpty(outputPath)) { throw new ArgumentException(outputPath, nameof(outputPath)); } if (project.Properties.Item("TargetFrameworkMoniker") == null) { EnvDteHelper.ShowError("The selected project type has no TargetFrameworkMoniker"); return; } if (!project.Properties.Item("TargetFrameworkMoniker").Value.ToString().Contains(".NETFramework") && !project.Properties.Item("TargetFrameworkMoniker").Value.ToString().Contains(".NETCoreApp,Version=v2.0")) { EnvDteHelper.ShowError("Currently only .NET Framework and .NET Core 2.0 projects are supported - TargetFrameworkMoniker: " + project.Properties.Item("TargetFrameworkMoniker").Value); return; } bool isNetCore = project.Properties.Item("TargetFrameworkMoniker").Value.ToString().Contains(".NETCoreApp,Version=v2.0"); var processResult = _processLauncher.GetOutput(outputPath, isNetCore, generationType); if (processResult.StartsWith("Error:")) { throw new ArgumentException(processResult, nameof(processResult)); } switch (generationType) { case GenerationType.Dgml: GenerateDgml(processResult, project); Telemetry.TrackEvent("PowerTools.GenerateModelDgml"); break; case GenerationType.Ddl: GenerateFiles(processResult, project, ".sql"); Telemetry.TrackEvent("PowerTools.GenerateSqlCreate"); break; case GenerationType.DebugView: GenerateFiles(processResult, project, ".txt"); Telemetry.TrackEvent("PowerTools.GenerateDebugView"); break; default: break; } } catch (Exception exception) { _package.LogError(new List <string>(), exception); } }
private void EarthGenerate(GenerationType type) { float distributionC_ = type.distributionC; List <int> xStack = new List <int>(); List <int> yStack = new List <int>(); bool[,] notChosen = new bool[width, height]; for (int i = 0; i < width; i++) { for (int j = 0; j < height; j++) { notChosen[i, j] = true; } } xStack.Add(type.x); yStack.Add(type.y); notChosen[type.x, type.y] = false; for (int i = 0; i < xStack.Count; i++) { for (int k = 0; k < 6; k++) { int x_, y_; if (yStack[i] % 2 == 0) { x_ = (width + xStack[i] + hexNeighborEvenX[k]) % width; y_ = (height + yStack[i] + hexNeighborEvenY[k]) % height; } else { x_ = (width + xStack[i] + hexNeighborOddX[k]) % width; y_ = (height + yStack[i] + hexNeighborOddY[k]) % height; } if (!notChosen[x_, y_]) { continue; } if (!(distributionC_ > Random.Range(0.0f, 1.0f))) { continue; } xStack.Add(x_); yStack.Add(y_); notChosen[x_, y_] = false; distributionC_ *= 1.0f - type.distributionFriction; } } for (int i = 0; i < xStack.Count; i++) { terrain[xStack[i], yStack[i]].Properties.isDry = true; } }
protected PokeBase(int id, string name, GenerationType generationType, PokemonType firstPokemonType, PokemonType secondPokemonType = PokemonType.None) { ID = id; Name = name; GenerationType = generationType; FirstPokemonType = firstPokemonType; SecondPokemonType = secondPokemonType; }
public string GenerateFilename(IScope scope, string name, string extension, GenerationType type) { string str = this.GetStreamDirectory(scope) + name; if (!((extension == null) || string.Empty.Equals(extension))) { str = str + extension; } return(str); }
public NonRegularHierarchicNetwork(String rName, ResearchType rType, GenerationType gType, Dictionary <ResearchParameter, object> rParams, Dictionary <GenerationParameter, object> genParams, AnalyzeOption analyzeOpts, ContainerMode mode) : base(rName, rType, gType, rParams, genParams, analyzeOpts, mode) { networkGenerator = new NonRegularHierarchicNetworkGenerator(mode); networkAnalyzer = new NonRegularHierarchicNetworkAnalyzer(this); }
public BANetwork(String rName, GenerationType gType, Dictionary<ResearchParameter, object> rParams, Dictionary<GenerationParameter, object> genParams, AnalyzeOption analyzeOpts) : base(rName, gType, rParams, genParams, analyzeOpts) { networkGenerator = new BANetworkGenerator(); networkAnalyzer = new NonHierarchicAnalyzer(this); }
static void Main() { string resourceName = "VST2"; string filePath = Path.GetFullPath(@"Support Files\80211a_20M_48Mbps.tdms"); GenerationType genType = GenerationType.Continuous; NIRfsg nIRfsg = new NIRfsg(resourceName, false, false); InstrumentConfiguration instrConfig = InstrumentConfiguration.GetDefault(); instrConfig.CarrierFrequency_Hz = 2e9; ConfigureInstrument(nIRfsg, instrConfig); Waveform waveform = LoadWaveformFromTDMS(filePath); DownloadWaveform(nIRfsg, waveform); switch (genType) { // For continous generation, we can simply call this function to begin the generation case GenerationType.Continuous: ConfigureContinuousGeneration(nIRfsg, waveform); break; // For bursted generation, we need to configure the duty cycle and PA control case GenerationType.Bursted: WaveformTimingConfiguration dynamicConfig = new WaveformTimingConfiguration { DutyCycle_Percent = 20, PreBurstTime_s = 500e-9, PostBurstTime_s = 500e-9, BurstStartTriggerExport = "PXI_Trig0" }; PAENConfiguration paenConfig = new PAENConfiguration { PAEnableMode = PAENMode.Dynamic, PAEnableTriggerExportTerminal = "PFI0", PAEnableTriggerMode = RfsgMarkerEventOutputBehaviour.Toggle, CommandEnableTime_s = 0, CommandDisableTime_s = 0, }; ConfigureBurstedGeneration(nIRfsg, waveform, dynamicConfig, paenConfig, out _, out _); break; } nIRfsg.Initiate(); Console.WriteLine("Generation has now begun. Press any key to abort generation and close the example."); Console.ReadKey(); AbortGeneration(nIRfsg); CloseInstrument(nIRfsg); }
private static List<string> GenerateRandomValueList(int count, int size, string prefix, string suffix, bool toLoweCase, GenerationType type, short dashCount = 0) { string charList; switch (type) { case GenerationType.Alphanumeric: charList = Chars + Numbers; break; case GenerationType.Alphabetical: charList = Chars; break; case GenerationType.Numeric: charList = Numbers; break; default: throw new ArgumentOutOfRangeException("type"); } List<string> resultList = new List<string>(); StringBuilder builder = new StringBuilder(); for (int i = 0; i < count; i++) { builder.Clear(); if (string.IsNullOrEmpty(prefix) == false) { builder.Append(prefix); } for (int j = 0; j < size; j++) { char ch = charList[Random.Next(charList.Length)]; builder.Append(ch); if (dashCount > 0) { if ((j + 1) % dashCount == 0) { if (j < size - 1) { builder.Append("-"); } } } } if (string.IsNullOrEmpty(suffix) == false) { builder.Append(suffix); } string newItem = toLoweCase ? builder.ToString().ToLower() : builder.ToString(); resultList.Add(newItem); } return resultList; }
/// <summary> /// Sets the type of generation for specified research. /// </summary> /// <param name="id">ID of research.</param> /// <param name="generationType">Generation type to set.</param> public static void SetResearchGenerationType(Guid id, GenerationType generationType) { try { existingResearches[id].GenerationType = generationType; } catch (KeyNotFoundException) { throw new CoreException("Specified research does not exists."); } }
public Combination(int k, T[] elements, GenerationType type = GenerationType.WithoutRepetitions) { _combinationType = type; if (elements.Count() < 0 || k < 0) // normally TotalElements >= ChoosenElements { throw new Exception("Negative parameter in constructor"); } _elements = elements; TotalElements = elements.Count(); ChosenElements = k; }
public WSNetwork(String rName, ResearchType rType, GenerationType gType, TracingType tType, Dictionary <ResearchParameter, Object> rParams, Dictionary <GenerationParameter, Object> genParams, AnalyzeOption analyzeOpts) : base(rName, rType, gType, tType, rParams, genParams, analyzeOpts) { networkGenerator = new WSNetworkGenerator(); networkAnalyzer = new NonHierarchicAnalyzer(this); }
public GenerateHelpsForm(HelpComponents helpComponents, GenerationType generationType) { InitializeComponent(); _helpComponents = helpComponents; _generationType = generationType; _colorizer = new CSPro.Logic.Colorizer(Handle.ToInt32()); _projectName = new DirectoryInfo(_helpComponents.projectPath).Name; string outputPath = Path.GetFullPath(Path.Combine(_helpComponents.projectPath, "..", Constants.OutputsDirectoryName)); _temporaryFilesPath = Path.Combine(_helpComponents.projectPath, Constants.TemporaryFileDirectoryName); Directory.CreateDirectory(_temporaryFilesPath); _backgroundThread = new BackgroundWorker(); // for the CHM string outputChmPath = Path.Combine(outputPath, Constants.OutputsChmDirectoryName); Directory.CreateDirectory(outputChmPath); _outputChmFilename = Path.Combine(outputChmPath, _projectName + Constants.ChmFileExtension); File.Delete(_outputChmFilename); _outputTopicFilenames = new Dictionary <Preprocessor.TopicPreprocessor, string>(); _chmTopicCompilerSettings = new GenerateChmTopicCompilerSettings(); // for the website _outputWebsitePath = Path.Combine(outputPath, Constants.OutputsWebsiteDirectoryName, _projectName); if (Directory.Exists(_outputWebsitePath)) { Directory.Delete(_outputWebsitePath, true); } Directory.CreateDirectory(_outputWebsitePath); _websiteTopicCompilerSettings = new GenerateWebsiteTopicCompilerSettings(_helpComponents); // for the PDF string outputPdfPath = Path.Combine(outputPath, Constants.OutputsPdfDirectoryName); Directory.CreateDirectory(outputPdfPath); _outputPdfFilename = Path.Combine(outputPdfPath, _projectName + ".pdf"); File.Delete(_outputPdfFilename); _outputPdfTopicsFilename = Path.Combine(_temporaryFilesPath, "_output_pdf_topics.html"); _pdfTopicCompilerSettings = new GeneratePdfTopicCompilerSettings(); }
public async Task ImportForeignGenerationTypes(WRLDCWarehouseDbContext _context, ILogger _log, string oracleConnStr, EntityWriteOption opt) { GenerationTypeExtract genTypeExtract = new GenerationTypeExtract(); List <GenerationType> genTypes = genTypeExtract.ExtractGenTypes(oracleConnStr); LoadGenerationType loadGenType = new LoadGenerationType(); foreach (GenerationType genType in genTypes) { GenerationType insertedGenType = await loadGenType.LoadSingleAsync(_context, _log, genType, opt); } }
public SpawnerScript() { _zeroTile = null; _tileSize = Vector2.zero; _landFillLeftTile = null; _landFillTile = null; _landFillRightTile = null; _landSurfaceLeftTile = null; _landSurfaceUp2251Tile = null; _landSurfaceUp2252Tile = null; _landSurfaceUp45225Tile = null; _landSurfaceTile = null; _landSurfaceDown2251Tile = null; _landSurfaceDown2252Tile = null; _landSurfaceDown45225Tile = null; _landSurfaceRightTile = null; _waterFillTile = null; _waterFillFrontTile = null; _waterSurfaceTile = null; _animatedDriftNutTile = null; _animatedSpikesTile = null; _animatedCollectibleTile = null; _animatedChestTile = null; _treeTrunkTile = null; _canopy1LeftTile = null; _canopy1RightTile = null; _tilesHolder = null; _pitSpikesChance = 40; _pitCollectibleChance = 70; _pitChestChance = 10; _nextCollectibleChance = 100; _minimumBranchOffset = 3; _maximumBranchOffset = 4; _zeroPosition = Vector3.zero; _globalGenerationIndex = 0; _currentGenerationIndex = 0; _lastGenerationLength = 10; _lastGenerationElevation = 3; _lastGenerationType = GenerationType.Land; _currentGenerationLength = 20; _currentGenerationElevation = 3; _currentGenerationType = GenerationType.Land; _nextGenerationLength = 4; _nextGenerationElevation = 3; _nextGenerationType = GenerationType.River; _pitSpikes = false; _pitCollectible = false; _pitChest = false; _nextTreeIndex = 20; }
private void OverWriteSettings() { //============================================================ //Get Settings From Options Menu string settingOne = Setting1Dropdown.GetComponentInChildren <Text>().text; GenerationType oType = GenerationType.CompleteSentence; switch (settingOne) { case "Sentence": oType = GenerationType.CompleteSentence; break; case "Random": oType = GenerationType.FullRandom; break; default: oType = GenerationType.CompleteSentence; Debug.Log("Could not find GenType from options menu"); break; } //============================================================ //if (oType != sceneOptions.GenType) { sceneOptions.GenType = oType; try { if (File.Exists(SettingsFilePath)) { File.Delete(SettingsFilePath); } StreamWriter writer = File.CreateText(SettingsFilePath); string settingsString = "GenerationType," + sceneOptions.GenType; int count = sceneOptions.AdCount; writer.WriteLine(settingsString); writer.WriteLine("AdCount," + count); writer.Close(); Debug.Log("Setting Overwrite Complete " + count); } catch { Debug.Log("Could not overwrite settings file"); } //} }
public AbstractNetwork(String rName, GenerationType gType, Dictionary<ResearchParameter, object> rParams, Dictionary<GenerationParameter, object> genParams, AnalyzeOption AnalyzeOptions) { ResearchName = rName; GenerationType = gType; ResearchParameterValues = rParams; GenerationParameterValues = genParams; this.AnalyzeOptions = AnalyzeOptions; NetworkResult = new RealizationResult(); }
public void Enqueue(Action<GenerationEvent> action, GenerationType type, params string[] paths) { if (paths[0].EndsWith(".cs", StringComparison.InvariantCultureIgnoreCase) == false) return; lock (locker) { this.timestamp = DateTime.Now; var generationEvent = new GenerationEvent { Action = action, Type = type, Paths = paths }; if (queue.Any(e => e.Equals(generationEvent))) { return; } queue.Add(generationEvent); Log.Debug("{0} queued {1}", generationEvent.Type, string.Join(" -> ", generationEvent.Paths)); } }
public static AbstractNetwork CreateNetworkByType(ModelType mt, String rName, GenerationType gType, Dictionary<ResearchParameter, object> rParams, Dictionary<GenerationParameter, object> genParams, AnalyzeOption AnalyzeOptions) { ModelTypeInfo[] info = (ModelTypeInfo[])mt.GetType().GetField(mt.ToString()).GetCustomAttributes(typeof(ModelTypeInfo), false); Type t = Type.GetType(info[0].Implementation); Type[] constructTypes = new Type[] { typeof(String), typeof(GenerationType), typeof(Dictionary<ResearchParameter, object>), typeof(Dictionary<GenerationParameter, object>), typeof(AnalyzeOption) }; object[] invokeParams = new object[] { rName, gType, rParams, genParams, AnalyzeOptions }; return (AbstractNetwork)t.GetConstructor(constructTypes).Invoke(invokeParams); }
private void Process(GenerationType type, params string[] paths) { if (paths[0].EndsWith(".cs", StringComparison.InvariantCultureIgnoreCase) == false) return; eventQueue.Enqueue(Render, type, paths); }
/// <summary> /// Creates a research and adds to existingResearches. /// </summary> /// <param name="researchType">The type of research to create.</param> /// <param name="modelType">The model type of research to create.</param> /// <param name="researchName">The name of research.</param> /// <param name="storage">The storage type for saving results of analyze.</param> /// <param name="storageString">Connection string or file path for data storage.</param> /// <param name="tracingPath">Path, if tracing is on, and empty string otherwise.</param> /// <returns>ID of created Research.</returns> public static Guid CreateResearch(ResearchType researchType, ModelType modelType, string researchName, StorageType storage, string storageString, GenerationType generationType, string tracingPath) { AbstractResearch r = AbstractResearch.CreateResearchByType(researchType); existingResearches.Add(r.ResearchID, r); r.ModelType = modelType; r.ResearchName = researchName; r.Storage = AbstractResultStorage.CreateStorage(storage, storageString); r.GenerationType = generationType; r.TracingPath = tracingPath; return r.ResearchID; }
/// <summary> /// Returns list of generation parameters which are required for specified research. /// </summary> /// <param name="id">ID of research.</param> /// <returns>List of generation parameters.</returns> public static List<GenerationParameter> GetRequiredGenerationParameters(ResearchType rt, ModelType mt, GenerationType gt) { List<GenerationParameter> gp = new List<GenerationParameter>(); if (rt == ResearchType.Collection || rt == ResearchType.Structural) return gp; if (gt == GenerationType.Static) { gp.Add(GenerationParameter.AdjacencyMatrix); return gp; } ModelTypeInfo[] info = (ModelTypeInfo[])mt.GetType().GetField(mt.ToString()).GetCustomAttributes(typeof(ModelTypeInfo), false); Type t = Type.GetType(info[0].Implementation, true); RequiredGenerationParameter[] rRequiredGenerationParameters = (RequiredGenerationParameter[])t.GetCustomAttributes(typeof(RequiredGenerationParameter), true); for (int i = 0; i < rRequiredGenerationParameters.Length; ++i) { GenerationParameter g = rRequiredGenerationParameters[i].Parameter; if (g != GenerationParameter.AdjacencyMatrix) gp.Add(g); } return gp; }
public AvailableGenerationType(GenerationType generationType) { GenerationType = generationType; }
/// <summary> /// Creates a research and adds to existingResearches. /// </summary> /// <param name="researchType">The type of research to create.</param> /// <param name="modelType">The model type of research to create.</param> /// <param name="researchName">The name of research.</param> /// <param name="storage">The storage type for saving results of analyze.</param> /// <param name="storageString">Connection string or file path for data storage.</param> /// <param name="tracingPath">Path, if tracing is on, and empty string otherwise.</param> /// <returns>ID of created Research.</returns> public static Guid CreateResearch(ResearchType researchType, ModelType modelType, string researchName, StorageType storage, string storageString, GenerationType generationType, string tracingPath) { AbstractResearch r = CreateResearchFromType(researchType); existingResearches.Add(r.ResearchID, r); r.ModelType = modelType; r.ResearchName = researchName; r.Storage = CreateStorage(storage, storageString); r.GenerationType = generationType; r.TracingPath = tracingPath; InitializeExtendedInformationForResearch(r.ResearchID); return r.ResearchID; }
public void RandomizeHeight( GenerationType randomGenType, int smoothingPasses, bool bAdditive ) { Point randomHeight = new Point( 0, 70 ); //percentage Random random = new Random(); Editor.console.Add( "Generating Heightmap Noise." ); for( int y = 0; y < size.Y; y++ ) { for( int x = 0; x < size.X; x++ ) { float currentHeight = 0f; switch( randomGenType ) { case GenerationType.Random: currentHeight = (float)random.Next( randomHeight.X, randomHeight.Y ) * 0.01f; break; case GenerationType.PerlinNoise: currentHeight = PerlinNoise( x, y, 200 ) * 5.0f; break; case GenerationType.TestNoise: float xHeight = (float)Math.Sin( x * 1.5f ) * 0.4f; float yHeight = -(float)Math.Cos( y * 1.3f ) * 0.6f; currentHeight = ( xHeight + yHeight ); break; } if( bAdditive ) currentHeight += pColor( x, y ).Value; SetBitHeight( x + y * size.X, currentHeight ); bits[ x + y * size.X ] = new Color( new Vector3( currentHeight ) ); } } heightmap.SetData<Color>( bits ); if( smoothingPasses > 0 ) for( int i = 0; i < smoothingPasses; i++ ) SmoothHeightmap(); CalculateHeightmap(); }
public string GenerateFilename(IScope scope, string name, GenerationType type) { return GenerateFilename(scope, name, null, type); }