public void Save(TomlTable content) { this.persistable.Save(content); this.loaded = content; this.loadedSourcesTable = this.persistable.TransformToSourceTable(this.loaded); this.loadedSourcesTable.Freeze(); }
private void WriteTomlTable(string parentKey, string key, TomlTable table) { switch (table.TableType) { case TomlTable.TableTypes.Default: this.WriteNormalTomlTable(parentKey, key, table); break; case TomlTable.TableTypes.Inline: this.WriteTomlInlineTable(parentKey, key, table); break; } }
private void WriteTableRows(string parentKey, TomlTable table) { Assert(table != null); foreach (var r in table.Rows) { this.WriteTableRow(parentKey, r); } }
public bool EnsureExists(TomlTable content) { if (!File.Exists(this.source.FilePath)) { this.Save(content); return true; } return false; }
public void Save(TomlTable content) { Assert(this.configs.Count > 0, AssertAtLeastOneConfigMsg); foreach (var c in this.configs) { var tbl = c.Load(); tbl.OverwriteWithValuesForSaveFrom(content, addNewRows: false); c.Save(tbl); } }
private void EnsureLastestTableLoaded() { if (this.loaded == null || this.persistable.WasChangedExternally()) { this.loaded = this.persistable.Load(); this.loadedSourcesTable = this.persistable.TransformToSourceTable(this.loaded); this.loaded.Freeze(); this.loadedSourcesTable.Freeze(); } }
public static TomlDocument FromFile(string fileName) { List<TomlKeyValue> rootValues = new List<TomlKeyValue>(); List<TomlTable> tables = new List<TomlTable>(); bool startedTable = false; TomlTable currTable = null; foreach (string line in File.ReadLines(fileName)) { string currentLine = line.Trim(); // Ignore empty lines if (string.IsNullOrEmpty(currentLine)) { // Check if we have a table created and if we started it // If we do and the line is empty, add it and close it. if (currTable != null && startedTable) { if (!tables.Contains(currTable)) tables.Add(currTable); startedTable = false; } continue; } // Ignore comments if (currentLine.StartsWith("#")) continue; if (currentLine.StartsWith("[")) { string[] tableName = currentLine.Substring(currentLine.IndexOf('[') + 1, currentLine.IndexOf(']') - 1).Split('.'); startedTable = true; currTable = new TomlTable(tableName, null); continue; } string keyName = currentLine.Remove(currentLine.IndexOf(" ")); string stringValue = currentLine.Remove(0, currentLine.IndexOf("=") + 1).Trim(); // Check if we have comments on the end of the line // If we do, remove them if (keyName.Contains("#")) keyName = keyName.Remove(keyName.LastIndexOf("#")).Trim(); if (stringValue.Contains("#")) stringValue = stringValue.Remove(stringValue.LastIndexOf("#")).Trim(); object keyValue = ParseValue(stringValue, GetValueType(stringValue)); if (startedTable) currTable.Values.Add(new TomlKeyValue(keyName, keyValue)); else rootValues.Add(new TomlKeyValue(keyName, keyValue)); if (currTable != null && !tables.Contains(currTable)) tables.Add(currTable); } return new TomlDocument(rootValues, tables); }
private void WriteNormalTomlTable(string parentKey, string key, TomlTable table) { this.WritePrependComments(table); this.writer.Write('['); this.writer.Write(parentKey + key); this.writer.Write(']'); this.writer.WriteLine(); this.WriteAppendComments(table); foreach (var r in table.Rows) { this.WriteTableRow(parentKey + key + ".", r); } }
public Dictionary<string, object> Convert(TomlTable table) { #if DEBUG Debug.Assert(!this.invokedConvert, "Do not reuse the TomlTable Converter. The converter can only be used once. Create a new converter instead."); this.invokedConvert = true; #endif foreach (var r in table.Rows) { this.currentKey = r.Key; r.Value.Visit(this); } return this.table; }
void ITomlObjectVisitor.Visit(TomlTable table) { this.sb.Append("{"); foreach (var r in table.Rows) { this.sb.Append("\"").Append(r.Key).Append("\":"); r.Value.Visit(this); this.sb.Append(","); } if (this.sb[this.sb.Length - 1] == ',') this.sb.Remove(this.sb.Length - 1, 1); this.sb.Append("}"); }
public static TomlTable Apply(ITomlRoot root, TokenBuffer tokens) { TomlTable inlineTable = new TomlTable(root, TomlTable.TableTypes.Inline); tokens.ExpectAndConsume(TokenType.LCurly); if (!tokens.TryExpect(TokenType.RBrac)) { var kvp = KeyValuePairProduction.Apply(root, tokens); inlineTable.Add(kvp.Item1, kvp.Item2); while (tokens.TryExpect(TokenType.Comma)) { tokens.Consume(); kvp = KeyValuePairProduction.Apply(root, tokens); inlineTable.Add(kvp.Item1, kvp.Item2); } } tokens.ExpectAndConsume(TokenType.RCurly); return inlineTable; }
public void WriteInlineTable(string key, TomlTable table) { this.WritePrependComments(table); this.writer.Write(key); this.writer.Write(" = {"); var rows = table.Rows.ToArray(); for (int i = 0; i < rows.Length - 1; i++) { this.WriteTableRow(rows[i]); this.writer.Write(", "); } if (rows.Length > 0) { this.WriteTableRow(rows[rows.Length - 1]); } this.writer.Write('}'); this.WriteAppendComments(table); }
internal static TomlTable ValuesOverwrittenFromTo(TomlTable mergeFrom, TomlTable mergeTo) { Debug.Assert(mergeFrom != null); Debug.Assert(mergeTo != null); var merged = (TomlTable)mergeTo.Clone(TomlObject.CloneModes.CloneValue); foreach (var r in mergeFrom.Rows) { TomlObject existing; if (merged.Rows.TryGetValue(r.Key, out existing)) { var mergedValue = existing.Clone(TomlObject.CloneModes.CloneValue); mergedValue.Comments.AddRange(existing.Comments); merged[r.Key] = mergedValue; } else { merged[r.Key] = r.Value; } } return merged; }
// *** Convenience method for setting values to a toml object. *** public static TomlObject Set <T>(this TomlTable tomlTable, string key, T value) { if (tomlTable is null) { throw new ArgumentNullException(nameof(tomlTable)); } if (key is null) { throw new ArgumentNullException(nameof(key)); } // I literally have no idea how to write it better with this toml library. // Note for TimeSpan: since TimeSpan as Nett (de)serializes it is not standartized we have to cast it manually TomlObject retobj = tomlTable.TryGetValue(key); if (retobj is null) { if (typeof(T) == typeof(bool)) { return(tomlTable.Add(key, (bool)(object)value).Added); } else if (typeof(T) == typeof(string)) { return(tomlTable.Add(key, (string)(object)value).Added); } else if (typeof(T) == typeof(double)) { return(tomlTable.Add(key, (double)(object)value).Added); } else if (typeof(T) == typeof(float)) { return(tomlTable.Add(key, (float)(object)value).Added); } else if (typeof(T) == typeof(ushort)) { return(tomlTable.Add(key, /*auto*/ (ushort)(object)value).Added); } else if (typeof(T) == typeof(int)) { return(tomlTable.Add(key, (int)(object)value).Added); } else if (typeof(T) == typeof(long)) { return(tomlTable.Add(key, (long)(object)value).Added); } else if (typeof(T) == typeof(ulong)) { return(tomlTable.Add(key, (long)(ulong)(object)value).Added); } else if (typeof(T) == typeof(TimeSpan)) { return(tomlTable.Add(key, SerializeTime((TimeSpan)(object)value)).Added); } else if (typeof(T) == typeof(DateTime)) { return(tomlTable.Add(key, (DateTime)(object)value).Added); } else if (typeof(T).IsEnum) { return(tomlTable.Add(key, value.ToString()).Added); } else if (value is IEnumerable <bool> enubool) { return(tomlTable.Add(key, enubool).Added); } else if (value is IEnumerable <string> enustring) { return(tomlTable.Add(key, enustring).Added); } else if (value is IEnumerable <double> enudouble) { return(tomlTable.Add(key, enudouble).Added); } else if (value is IEnumerable <float> enufloat) { return(tomlTable.Add(key, enufloat).Added); } else if (value is IEnumerable <ushort> enuushort) { return(tomlTable.Add(key, enuushort.Select(x => (int)x)).Added); } else if (value is IEnumerable <int> enuint) { return(tomlTable.Add(key, enuint).Added); } else if (value is IEnumerable <long> enulong) { return(tomlTable.Add(key, enulong).Added); } else if (value is IEnumerable <ulong> enuulong) { return(tomlTable.Add(key, enuulong.Select(x => (long)x)).Added); } else if (value is IEnumerable <TimeSpan> enuTimeSpan) { return(tomlTable.Add(key, enuTimeSpan.Select(SerializeTime)).Added); } else if (value is IEnumerable <DateTime> enuDateTime) { return(tomlTable.Add(key, enuDateTime).Added); } } else { TomlComment[] docs = null; if (retobj.Comments.Any()) { docs = retobj.Comments.ToArray(); } if (typeof(T) == typeof(bool)) { retobj = tomlTable.Update(key, (bool)(object)value).Added; } else if (typeof(T) == typeof(string)) { retobj = tomlTable.Update(key, (string)(object)value).Added; } else if (typeof(T) == typeof(double)) { retobj = tomlTable.Update(key, (double)(object)value).Added; } else if (typeof(T) == typeof(float)) { retobj = tomlTable.Update(key, (float)(object)value).Added; } else if (typeof(T) == typeof(ushort)) { retobj = tomlTable.Update(key, /*auto*/ (ushort)(object)value).Added; } else if (typeof(T) == typeof(int)) { retobj = tomlTable.Update(key, /*auto*/ (int)(object)value).Added; } else if (typeof(T) == typeof(long)) { retobj = tomlTable.Update(key, (long)(object)value).Added; } else if (typeof(T) == typeof(ulong)) { retobj = tomlTable.Update(key, (long)(ulong)(object)value).Added; } else if (typeof(T) == typeof(TimeSpan)) { retobj = tomlTable.Update(key, SerializeTime((TimeSpan)(object)value)).Added; } else if (typeof(T) == typeof(DateTime)) { retobj = tomlTable.Update(key, (DateTime)(object)value).Added; } else if (typeof(T).IsEnum) { retobj = tomlTable.Update(key, value.ToString()).Added; } else if (value is IEnumerable <bool> enubool) { return(tomlTable.Update(key, enubool).Added); } else if (value is IEnumerable <string> enustring) { return(tomlTable.Update(key, enustring).Added); } else if (value is IEnumerable <double> enudouble) { return(tomlTable.Update(key, enudouble).Added); } else if (value is IEnumerable <float> enufloat) { return(tomlTable.Update(key, enufloat).Added); } else if (value is IEnumerable <ushort> enuushort) { return(tomlTable.Update(key, enuushort.Select(x => (int)x)).Added); } else if (value is IEnumerable <int> enuint) { return(tomlTable.Update(key, enuint).Added); } else if (value is IEnumerable <long> enulong) { return(tomlTable.Update(key, enulong).Added); } else if (value is IEnumerable <ulong> enuulong) { return(tomlTable.Update(key, enuulong.Select(x => (long)x)).Added); } else if (value is IEnumerable <TimeSpan> enuTimeSpan) { return(tomlTable.Update(key, enuTimeSpan.Select(SerializeTime)).Added); } else if (value is IEnumerable <DateTime> enuDateTime) { return(tomlTable.Update(key, enuDateTime).Added); } else { throw new NotSupportedException("The type is not supported"); } if (docs != null) { retobj.AddComments(docs); } return(retobj); } throw new NotSupportedException("The type is not supported"); }
public ConversionMappingTableProxy( string rowKey, TomlTable parentTable, Type clrObjectType, Type tomlType, TomlTable objTable, ITomlConverter converter) : base(objTable.Root) { this.parentTable = parentTable; this.rowKey = rowKey; this.converter = converter; this.conversionTargetType = tomlType; this.clrObjectType = clrObjectType; foreach (var r in objTable.Rows) { var toAdd = r.Value is TomlTable t ? new ProxySubTable(t, this) : r.Value; this.AddRow(new TomlKey(r.Key), toAdd); } }
private AppConfig(DocumentSyntax validatedSyntaxTree) { _config = validatedSyntaxTree.ToModel(); }
public TomlDocument(string input) { this.document = Toml.ReadString(input); }
public void TestTableExtension() { TomlTable root = Tomen.Tomen.ReadFile("toml\\tables\\table-extension.toml"); Assert.AreEqual(true, root.Path <Boolean>("fruit.apple.texture.smooth")); }
public override void SetConfig(TomlTable toml) { base.SetConfig(toml); listen = toml.TryGetValue("local", listen); }
private static void AssertNoRowWasAdded(TomlTable r) => r.Count.Should().Be(X.Count);
private static void AssertYOnlyRowWasAddedTo(TomlTable r) { r.Count.Should().Be(X.Count + 1); r.Get <string>(YKey).Should().Be(YVal); }
internal static IRunControlTask Create(TomlTable taskSpec, IAppState appState, IAppService appService) { RequireTrue( taskSpec.ContainsKey("n_samples"), "Distribution sampling task spec has missing n_samples setting" ); RequireTrue( taskSpec.ContainsKey("distributions"), "Distribution sampling task spec has missing distributions" ); RequireTrue( taskSpec.ContainsKey("outputs"), "Distribution sampling task spec has missing outputs" ); var name = taskSpec["name"].Get <string>(); RequireNotNullEmptyWhiteSpace(name, "Invalid task name"); var nSamples = taskSpec["n_samples"].Get <int>(); RequireTrue(nSamples > 0, "Invalid n_samples"); var distributionSpecs = taskSpec["distributions"] as TomlArray; RequireNotNull( distributionSpecs, "Distribution sampling task spec has missing or misspecified distributions" ); RequireTrue( distributionSpecs.Length > 0, "Distribution sampling task spec has empty distributions" ); var distributions = distributionSpecs.Items .Select(tv => Distribution.ParseRelation(tv.Get <string>())) .ToArr(); LatinHypercubeDesign latinHypercubeDesign = LatinHypercubeDesign.Default; if (taskSpec.ContainsKey("latin_hypercube")) { var latinHypercubeSpec = taskSpec["latin_hypercube"] as TomlTable; RequireNotNull(latinHypercubeSpec, "Expecting Latin hypercube specified as table array"); RequireTrue(latinHypercubeSpec.ContainsKey("type"), "Latin hypercube missing type"); var type = latinHypercubeSpec["type"].Get <LatinHypercubeDesignType>(); var t0 = latinHypercubeSpec.ContainsKey("t0") ? latinHypercubeSpec["t0"].Get <double>() : NaN; var c = latinHypercubeSpec.ContainsKey("c") ? latinHypercubeSpec["c"].Get <double>() : NaN; var iterations = latinHypercubeSpec.ContainsKey("iter") ? latinHypercubeSpec["iter"].Get <int>() : default; var p = latinHypercubeSpec.ContainsKey("p") ? latinHypercubeSpec["p"].Get <double>() : NaN; var profile = latinHypercubeSpec.ContainsKey("profile") ? latinHypercubeSpec["profile"].Get <TemperatureDownProfile>() : default; var imax = latinHypercubeSpec.ContainsKey("imax") ? latinHypercubeSpec["imax"].Get <int>() : default; var haveDesignType = type != LatinHypercubeDesignType.None; var hasValidSA = IsNaN(t0) || (!IsNaN(c) && iterations > 0 && !IsNaN(p)); RequireTrue( !haveDesignType || hasValidSA, "Invalid Latin hypercube configuration" ); latinHypercubeDesign = new LatinHypercubeDesign(type, t0, c, iterations, p, profile, imax); } Arr <(string Parameter, Arr <double> Correlations)> correlation = default; if (taskSpec.ContainsKey("correlation")) { var correlationSpec = taskSpec["correlation"] as TomlTableArray; RequireNotNull(correlationSpec, "Expecting correlation specified as table array"); correlation = correlationSpec.Items .Cast <TomlTable>() .Select(tt => ( Parameter: tt["name"].Get <string>(), Correlations: tt["values"].Get <double[]>().ToArr())) .ToArr(); var correlationComplete = distributions.ForAll( d => correlation.Exists(c => c.Parameter == d.Variable) ); RequireTrue(correlationComplete, "Incomplete correlation matrix"); RequireTrue(correlation.Count == distributions.Count, "Unexpected data in correlation matrix"); } var outputSpecs = taskSpec["outputs"] as TomlArray; RequireNotNull( outputSpecs, "Distribution sampling task spec has missing or misspecified outputs" ); RequireTrue( outputSpecs.Length > 0, "Distribution sampling task spec has empty outputs" ); var outputNames = outputSpecs.To <string>().ToArr(); return(new DistributionSamplingTask( name, nSamples, distributions, latinHypercubeDesign, correlation, outputNames, appState, appService )); }
public void Add(TomlTable table) { this.items.Add(table); }
public static Dictionary <string, string> ToProviderDictionary(TomlTable table) => ToProviderDictionary(table, null);
public void Save(TomlTable config) { Toml.WriteFile(config, this.FilePath); this.latestFileHash = ComputeHash(this.FilePath); }
public TomlTable TransformToSourceTable(TomlTable toTransform) => toTransform.TransformToSourceTable(this.source);
private static TomlTable GetExistinOrCreateAndAdd(TomlTable tbl, string key, Func<TomlTable, TomlTable> createNewItem) { var existingTargetTable = TryGetTableEntry(tbl.TryGetValue(key)); if (existingTargetTable != null) { return existingTargetTable; } return createNewItem(tbl); }
private static void AssertSameKeyRowWasOverwritten(TomlTable r) => r.Get <string>(SameKey).Should().Be(YVal);
private static TomlTable GetTargetTable(TomlTable root, IList<string> keyChain, CreateImplicitelyType ct) { var tgt = root; for (int i = 0; i < keyChain.Count - 1; i++) { tgt = ct == CreateImplicitelyType.Table ? GetExistingOrCreateAndAddTable(tgt, keyChain[i]) : GetExistingOrCreateAndAddTableArray(tgt, keyChain[i]); } return tgt; }
private static void AssertSameKeyNotTouched(TomlTable r) => r.Get <string>(SameKey).Should().Be(XVal);
public IRunControlTask GetRunControlTask(string type, TomlTable taskSpec) => SamplingTasks.Create(type, taskSpec, _appState, _appService);
private static void AssertSubTableRowWasOverwritten(TomlTable r) => r.Get <TomlTable>(SubTableKey).Get <string>(SubTableValueKey).Should().Be(YSubTableVal);
// Method to get the preset for the UI from the Config.toml private void getConfig() { // Read from Config.toml file string path = Directory.GetCurrentDirectory(); string configData = ""; // Check if Config.toml exist, if not use Config.sample.toml if (File.Exists(path + @"\Config.toml")) { configData = path + @"\Config.toml"; } else { configData = path + @"\Config.sample.toml"; } List <string> legendaryList = new List <string>(); using (StreamReader reader = File.OpenText(@"data/boss_pokemon.json")) { string json = reader.ReadToEnd(); foreach (var item in JObject.Parse(json).Properties()) { legendaryList.Add(Utils.ConvertBossIdToBossName(item.Name)); } } List <string> nonLegendList = new List <string>(); using (StreamReader reader = File.OpenText(@"data/rental_pokemon.json")) { string json2 = reader.ReadToEnd(); foreach (var item in JObject.Parse(json2).Properties()) { nonLegendList.Add(item.Name); } } string[] ballList = { Utils.ConvertBallIdToBallName("beast-ball"), Utils.ConvertBallIdToBallName("dive-ball"), Utils.ConvertBallIdToBallName("dream-ball"), Utils.ConvertBallIdToBallName("dusk-ball"), Utils.ConvertBallIdToBallName("fast-ball"), Utils.ConvertBallIdToBallName("friend-ball"), Utils.ConvertBallIdToBallName("great-ball"), Utils.ConvertBallIdToBallName("heal-ball"), Utils.ConvertBallIdToBallName("heavy-ball"), Utils.ConvertBallIdToBallName("level-ball"), Utils.ConvertBallIdToBallName("love-ball"), Utils.ConvertBallIdToBallName("lure-ball"), Utils.ConvertBallIdToBallName("luxury-ball"), Utils.ConvertBallIdToBallName("master-ball"), Utils.ConvertBallIdToBallName("moon-ball"), Utils.ConvertBallIdToBallName("nest-ball"), Utils.ConvertBallIdToBallName("net-ball"), Utils.ConvertBallIdToBallName("poke-ball"), Utils.ConvertBallIdToBallName("premier-ball"), Utils.ConvertBallIdToBallName("quick-ball"), Utils.ConvertBallIdToBallName("repeat-ball"), Utils.ConvertBallIdToBallName("safari-ball"), Utils.ConvertBallIdToBallName("sport-ball"), Utils.ConvertBallIdToBallName("timer-ball"), Utils.ConvertBallIdToBallName("ultra-ball") }; using (StreamReader reader = new StreamReader(File.OpenRead(configData))) { TomlTable t = TOML.Parse(reader); // Create Lists for each stat +,=,- List <string> arr = new List <string>(); List <string> arr1 = new List <string>(); List <string> arr2 = new List <string>(); List <string> arr3 = new List <string>(); List <string> arr4 = new List <string>(); List <string> arr5 = new List <string>(); // Loops to get all nodes from TomlNode into the list foreach (TomlNode node in t["stats"]["ATTACK_STATS"]["positive"]) { arr.Add(node); } foreach (TomlNode node in t["stats"]["ATTACK_STATS"]["neutral"]) { arr1.Add(node); } foreach (TomlNode node in t["stats"]["ATTACK_STATS"]["negative"]) { arr2.Add(node); } foreach (TomlNode node in t["stats"]["SPEED_STATS"]["positive"]) { arr3.Add(node); } foreach (TomlNode node in t["stats"]["SPEED_STATS"]["neutral"]) { arr4.Add(node); } foreach (TomlNode node in t["stats"]["SPEED_STATS"]["negative"]) { arr5.Add(node); } // Join all strings in list and display in box boxAttackPos.Text = String.Join(",", arr); boxAttackNeut.Text = String.Join(",", arr1); boxAttackNeg.Text = String.Join(",", arr2); boxSpeedPos.Text = String.Join(",", arr3); boxSpeedNeut.Text = String.Join(",", arr4); boxSpeedNeg.Text = String.Join(",", arr5); boxPokemon.Items.AddRange(legendaryList.ToArray()); SetConfigValue(boxPokemon, Utils.ConvertBossIdToBossName(t["BOSS"]), t["BOSS"].Comment); boxBaseBall.Items.AddRange(ballList); SetConfigValue(boxBaseBall, Utils.ConvertBallIdToBallName(t["BASE_BALL"]), t["BASE_BALL"].Comment); boxLegendBall.Items.AddRange(ballList); SetConfigValue(boxLegendBall, Utils.ConvertBallIdToBallName(t["LEGENDARY_BALL"]), t["LEGENDARY_BALL"].Comment); SetConfigValue(boxMode, t["MODE"], t["MODE"].Comment); SetConfigValue(boxPathWins, t["FIND_PATH_WINS"], t["FIND_PATH_WINS"].Comment); SetConfigValue(boxComPort, t["COM_PORT"], t["COM_PORT"].Comment); // Get every Video Capture device and put it into the combobox (with right order) List <DsDevice> devices = new List <DsDevice>(DsDevice.GetDevicesOfCat(FilterCategory.VideoInputDevice)); foreach (var device in devices) { boxVideoCapture.Items.Add(device.Name); } int videoIndex = t["VIDEO_INDEX"]; if (videoIndex < devices.Count) { boxVideoCapture.Text = devices[videoIndex].Name; } SetConfigValue(boxTesseract, t["TESSERACT_PATH"], t["TESSERACT_PATH"].Comment); SetConfigValue(boxVideoScale, t["advanced"]["VIDEO_SCALE"], t["advanced"]["VIDEO_SCALE"].Comment); SetConfigValue(boxVideoDelay, t["advanced"]["VIDEO_EXTRA_DELAY"], t["advanced"]["VIDEO_EXTRA_DELAY"].Comment); boxPABotBaseHex.Checked = t["advanced"]["PABOTBASE_HEX"]; this.toolTip.SetToolTip(this.boxPABotBaseHex, t["advanced"]["PABOTBASE_HEX"].Comment); string bossIndexAsText = ""; if (t["advanced"]["BOSS_INDEX"] == 0) { bossIndexAsText = "Top"; } else if (t["advanced"]["BOSS_INDEX"] == 1) { bossIndexAsText = "Middle"; } else if (t["advanced"]["BOSS_INDEX"] == 2) { bossIndexAsText = "Bottom"; } SetConfigValue(boxBossIndex, bossIndexAsText, t["advanced"]["BOSS_INDEX"].Comment); SetConfigValue(boxDyniteOre, t["advanced"]["DYNITE_ORE"], t["advanced"]["DYNITE_ORE"].Comment); SetConfigValue(boxConsecutiveResets, t["advanced"]["CONSECUTIVE_RESETS"], t["advanced"]["CONSECUTIVE_RESETS"].Comment); boxNonLegend.Items.Add("default"); boxNonLegend.Items.AddRange(nonLegendList.ToArray()); SetConfigValue(boxNonLegend, t["advanced"]["NON_LEGEND"], t["advanced"]["NON_LEGEND"].Comment); SetConfigValue(boxMaxDynite, t["advanced"]["MAXIMUM_ORE_COST"], t["advanced"]["MAXIMUM_ORE_COST"].Comment); SetConfigValue(boxNonLegend, t["NON_LEGEND"], t["NON_LEGEND"].Comment); checkBoxDebugLogs.Checked = t["advanced"]["ENABLE_DEBUG_LOGS"]; this.toolTip.SetToolTip(this.checkBoxDebugLogs, t["advanced"]["ENABLE_DEBUG_LOGS"].Comment); boxCheckAttack.Checked = t["stats"]["CHECK_ATTACK_STAT"]; this.toolTip.SetToolTip(this.boxCheckAttack, t["CHECK_ATTACK_STAT"].Comment); boxCheckSpeed.Checked = t["stats"]["CHECK_SPEED_STAT"]; this.toolTip.SetToolTip(this.boxCheckSpeed, t["CHECK_SPEED_STAT"].Comment); SetConfigValue(boxWebhookID, t["discord"]["WEBHOOK_ID"], t["discord"]["WEBHOOK_ID"].Comment); SetConfigValue(boxWebhookToken, t["discord"]["WEBHOOK_TOKEN"], t["discord"]["WEBHOOK_TOKEN"].Comment); SetConfigValue(boxUserID, t["discord"]["USER_ID"], t["discord"]["USER_ID"].Comment); SetConfigValue(boxPingName, t["discord"]["USER_SHORT_NAME"], t["discord"]["USER_SHORT_NAME"].Comment); SetConfigValue(boxPingSettings, t["discord"]["UPDATE_LEVELS"], t["discord"]["UPDATE_LEVELS"].Comment); SetConfigValue(boxGameLanguage, t["language"]["LANGUAGE"], t["language"]["LANGUAGE"].Comment); } }
private static void AssertSubTableNotTouched(TomlTable r) => r.Get <TomlTable>(SubTableKey).Get <string>(SubTableValueKey).Should().Be(XSubTableVal);
public bool EnsureExists(TomlTable content) => this.persistable.EnsureExists(content);
protected override void load(TomlTable tb) { var serverTable = tb.getTable(nameof(server)); serverTable.autoBind(server); var appsTables = tb.getTableArray(nameof(apps)); foreach (var appTable in appsTables) { var cfgApp = new RemoteApp(); appTable.autoBind(cfgApp); // validate app if (!StringValidator.isIdentifier(cfgApp.name)) { throw new ConfigurationException(nameof(cfgApp.name), $"app name '{cfgApp.name}' is not valid"); } if (string.IsNullOrEmpty(cfgApp.secret)) { throw new ConfigurationException(nameof(cfgApp.secret), "app secret cannot be empty"); } apps.Add(cfgApp); } var groupsTables = tb.getTableArray(nameof(groups)); foreach (var groupTable in groupsTables) { var cfgGroup = new Group { name = groupTable.getField <string>(nameof(Group.name)), priority = groupTable.getField <long>(nameof(Group.priority)) }; // validate group if (!StringValidator.isIdentifier(cfgGroup.name)) { throw new ConfigurationException(nameof(cfgGroup.name), $"group name '{cfgGroup.name}' is not a valid identifier."); } // load permissions and rules cfgGroup.permissions = groupTable.getField <TomlArray>(nameof(Group.permissions)) .Select(x => new Permission(x.ToString())) .ToList(); var groupRules = groupTable.getTable(nameof(Group.rules)); foreach (var appRulesTablePair in groupRules) { var ruleApp = appRulesTablePair.Key; var rulesTable = (TomlTable)appRulesTablePair.Value; foreach (var appRule in rulesTable) { cfgGroup.rules.Add(new AccessRule(ruleApp, appRule.Key, appRule.Value.ToString())); } } groups.Add(cfgGroup); } var usersTable = tb.getTable(nameof(users)); usersTable.autoBind(users); var loggingTable = tb.getTable(nameof(logging)); loggingTable.autoBind(logging); }
private static void DowngradeMelonPreferences(string destination, bool legacy_version) { if (!legacy_version || (Program.CurrentInstalledVersion == null) || (Program.CurrentInstalledVersion.CompareTo(new Version("0.3.0")) < 0)) { return; } string userdatapath = Path.Combine(destination, "UserData"); if (!Directory.Exists(userdatapath)) { return; } string oldfilepath = Path.Combine(userdatapath, "MelonPreferences.cfg"); if (!File.Exists(oldfilepath)) { return; } string filestr = File.ReadAllText(oldfilepath); if (string.IsNullOrEmpty(filestr)) { return; } DocumentSyntax docsyn = Toml.Parse(filestr); if (docsyn == null) { return; } TomlTable model = docsyn.ToModel(); if (model.Count <= 0) { return; } string newfilepath = Path.Combine(userdatapath, "modprefs.ini"); if (File.Exists(newfilepath)) { File.Delete(newfilepath); } IniFile iniFile = new IniFile(newfilepath); foreach (KeyValuePair <string, object> keypair in model) { string category_name = keypair.Key; TomlTable tbl = (TomlTable)keypair.Value; if (tbl.Count <= 0) { continue; } foreach (KeyValuePair <string, object> tblkeypair in tbl) { string name = tblkeypair.Key; if (string.IsNullOrEmpty(name)) { continue; } TomlObject obj = TomlObject.ToTomlObject(tblkeypair.Value); if (obj == null) { continue; } switch (obj.Kind) { case ObjectKind.String: iniFile.SetString(category_name, name, ((TomlString)obj).Value); break; case ObjectKind.Boolean: iniFile.SetBool(category_name, name, ((TomlBoolean)obj).Value); break; case ObjectKind.Integer: iniFile.SetInt(category_name, name, (int)((TomlInteger)obj).Value); break; case ObjectKind.Float: iniFile.SetFloat(category_name, name, (float)((TomlFloat)obj).Value); break; default: break; } } } File.Delete(oldfilepath); }
// Start is called before the first frame update void Start() { // read input file string input_file_path = Application.dataPath + "/../input/input.toml"; Debug.Log($"input file path is {input_file_path}."); InputToml input = new InputToml(input_file_path); // generate initial particle position, velocity and system temperature TomlTable system = input.SystemTable; temperature = system.Get <TomlTable>("attributes").Get <float>("temperature"); // read particles information List <GameObject> base_particles = input.GenerateBaseParticles(m_BaseParticle, kb_scaled); // read simulator information input.GenerateIntegratorManagers(gameObject, base_particles, kb_scaled, timescale); // read boundary_shape information input.GenerateBoundaryManager(gameObject, base_particles); // read forcefields information TomlTable ff = input.ForceFieldTable; if (ff.ContainsKey("local")) { input.GenerateLocalInteractionManagers(gameObject, base_particles, timescale); } if (ff.ContainsKey("global")) { input.GenerateGlobalInteractionManagers(base_particles, timescale); } Debug.Log("ForceField initialization finished."); // Initialize SystemObserver m_SystemObserver = GetComponent <SystemObserver>(); m_SystemObserver.Init(base_particles, timescale); Debug.Log("SystemObserver initialization finished."); // set particle colors int particle_num = base_particles.Count; float color_step = 2.0f / (particle_num - 1); List <Color> color_list = new List <Color>(); float color_val = 0.0f; color_list.Add(new Color(1.0f, 0.0f, 0.0f)); foreach (GameObject base_particle in base_particles) { color_val += color_step; Material particle_material = base_particle.GetComponent <Renderer>().material; if (color_val < 1.0f) { particle_material.SetColor("_Color", new Color(1.0f, color_val, color_val)); } else { particle_material.SetColor("_Color", new Color(2.0f - color_val, 2.0f - color_val, 1.0f)); } } // Set Player position GameObject player = GameObject.Find("OVRPlayerController"); float max_radius = 0.0f; if (gameObject.GetComponent <ReflectingBoundaryManager>() != null) { foreach (GameObject base_particle in base_particles) { float radius = base_particle.transform.localScale.x; if (max_radius < radius) { max_radius = radius; } } var rb_manager = gameObject.GetComponent <ReflectingBoundaryManager>(); Vector3 upper_boundary = rb_manager.UpperBoundary; Vector3 lower_boundary = rb_manager.LowerBoundary; Vector3 box_length_half = upper_boundary - lower_boundary; Vector3 box_center = box_length_half + lower_boundary; player.transform.position = new Vector3(box_center.x, box_center.y, lower_boundary.z - box_length_half.z); } else { Vector3 upper_edge = detect_upper_edge(base_particles); Vector3 lower_edge = detect_lower_edge(base_particles); Vector3 pseudo_box_center = (upper_edge + lower_edge) * 0.5f; Vector3 pseudo_box_length_half = (upper_edge - lower_edge) * 0.5f; Vector3 upper_boundary = upper_edge + pseudo_box_length_half; Vector3 lower_boundary = lower_edge - pseudo_box_length_half; player.transform.position = new Vector3(pseudo_box_center.x, upper_boundary.y, lower_boundary.z - pseudo_box_length_half.z); player.transform.localScale = new Vector3(upper_boundary.y, upper_boundary.y, upper_boundary.y); } }
public void TestBasics() { TomlTable root = Tomen.Tomen.ReadFile("toml\\array_tables\\basics.toml"); Assert.AreEqual("Hammer", root.Path <String>("products[0].name")); }
public string Convert(TomlTable table) { table.Visit(this); return this.sb.ToString(); }
public static TomlTable Clone(this TomlTable input) => input.CloneTableFor(input.Root);
public LayerNoise(TomlTable table) { if (table.TryGetValue("innercolor", out var tomlObject)) { InnerColor = Color.FromHex(tomlObject.Get <string>()); } if (table.TryGetValue("outercolor", out tomlObject)) { OuterColor = Color.FromHex(tomlObject.Get <string>()); } if (table.TryGetValue("seed", out tomlObject)) { Seed = (uint)tomlObject.Get <int>(); } if (table.TryGetValue("persistence", out tomlObject)) { Persistence = double.Parse(tomlObject.Get <string>(), CultureInfo.InvariantCulture); } if (table.TryGetValue("lacunarity", out tomlObject)) { Lacunarity = double.Parse(tomlObject.Get <string>(), CultureInfo.InvariantCulture); } if (table.TryGetValue("frequency", out tomlObject)) { Frequency = double.Parse(tomlObject.Get <string>(), CultureInfo.InvariantCulture); } if (table.TryGetValue("octaves", out tomlObject)) { Octaves = (uint)tomlObject.Get <int>(); } if (table.TryGetValue("threshold", out tomlObject)) { Threshold = double.Parse(tomlObject.Get <string>(), CultureInfo.InvariantCulture); } if (table.TryGetValue("sourcefactor", out tomlObject)) { SrcFactor = (BlendFactor)Enum.Parse(typeof(BlendFactor), tomlObject.Get <string>()); } if (table.TryGetValue("destfactor", out tomlObject)) { DstFactor = (BlendFactor)Enum.Parse(typeof(BlendFactor), tomlObject.Get <string>()); } if (table.TryGetValue("power", out tomlObject)) { Power = double.Parse(tomlObject.Get <string>(), CultureInfo.InvariantCulture); } if (table.TryGetValue("noise_type", out tomlObject)) { switch (tomlObject.Get <string>()) { case "fbm": NoiseType = NoiseGenerator.NoiseType.Fbm; break; case "ridged": NoiseType = NoiseGenerator.NoiseType.Ridged; break; default: throw new InvalidOperationException(); } } }
private static TomlTable GetExistingOrCreateAndAddTableArray(TomlTable tbl, string key) { Func<TomlTable, TomlTable> createNew = (e) => { var array = new TomlTableArray(tbl.Root); var newTable = new TomlTable(tbl.Root); array.Add(newTable); tbl.Add(key, array); return newTable; }; return GetExistinOrCreateAndAdd(tbl, key, createNew); }
public Setter(TomlTable settings, Action flush) { _settings = settings; Flush = flush; }
public static TomlTable TryApply(TomlTable current, TomlTable.RootTable root, TokenBuffer tokens) { tokens.ConsumeAllNewlines(); var preComments = CommentProduction.TryParsePreExpressionCommenst(tokens); var expressionToken = tokens.Peek(); tokens.ConsumeAllNewlines(); var arrayKeyChain = TomlArrayTableProduction.TryApply(tokens); if (arrayKeyChain != null) { var addTo = GetTargetTable(root, arrayKeyChain, CreateImplicitelyType.Table); var arr = GetExistingOrCreateAndAdd(addTo, arrayKeyChain.Last(), errorPosition: expressionToken); arr.Comments.AddRange(preComments); arr.Comments.AddRange(CommentProduction.TryParseAppendExpressionComments(expressionToken, tokens)); var newArrayEntry = new TomlTable(root); arr.Add(newArrayEntry); return newArrayEntry; } var tableKeyChain = TomlTableProduction.TryApply(tokens); if (tableKeyChain != null) { var newTable = new TomlTable(root) { IsDefined = true }; newTable.Comments.AddRange(preComments); newTable.Comments.AddRange(CommentProduction.TryParseAppendExpressionComments(expressionToken, tokens)); var addTo = GetTargetTable(root, tableKeyChain, CreateImplicitelyType.Table); string name = tableKeyChain.Last(); var existingRow = addTo.TryGetValue(name); if (existingRow == null) { addTo.Add(name, newTable); } else { var tbl = existingRow as TomlTable; if (tbl.IsDefined) { throw new Exception($"Failed to add new table because the target table already contains a row with the key '{name}' of type '{existingRow.ReadableTypeName}'."); } else { tbl.IsDefined = true; return tbl; } } return newTable; } if (!tokens.End) { var kvp = KeyValuePairProduction.Apply(root, tokens); if (kvp != null) { kvp.Item2.Comments.AddRange(preComments); kvp.Item2.Comments.AddRange(CommentProduction.TryParseAppendExpressionComments(expressionToken, tokens)); current.Add(kvp.Item1, kvp.Item2); return current; } } root.Comments.AddRange(preComments); return null; }
private void Init() { this.transactionTable = this.persistable.Load(); this.transactionSourcesTable = this.persistable.Load(); }
private static TomlTableArray GetExistingOrCreateAndAdd(TomlTable target, string name, Token errorPosition) { TomlObject existing = target.TryGetValue(name); var typed = existing as TomlTableArray; if (existing != null && typed == null) { throw Parser.CreateParseError( errorPosition, $"Cannot create array of tables with name '{name}' because there already is an row with that key of type '{existing.ReadableTypeName}'."); } else if (typed != null) { return typed; } var newTableArray = new TomlTableArray(target.Root); target.Add(name, newTableArray); return newTableArray; }
internal void WriteToml(TomlTable table) { const string rootParentKey = ""; this.WriteTableRows(rootParentKey, table); this.writer.Flush(); }
/// <summary> /// Merge two TomlTables together. Values from overrides will replace values in original where available. /// </summary> /// <param name="original">The original values</param> /// <param name="overrides">The values to replace originals</param> /// <returns>The merged configuration</returns> private TomlTable Merge(TomlTable original, TomlTable overrides) { original.OverwriteWithValuesForLoadFrom(overrides); return(original); }
void ITomlObjectVisitor.Visit(TomlTable table) { Type tableToTypeMappingTargetType; if ((tableToTypeMappingTargetType = table.Root.Config.TryGetMappedType(this.currentKey, null)) != null) { this.table[this.currentKey] = table.Get(tableToTypeMappingTargetType); } else { var conv = new ConvertTomlTableToDictionaryConversionVisitor(); this.table[this.currentKey] = conv.Convert(table); } }
public void Save(TomlTable table, IConfigSource source) { IConfigStore cfg = this.stores.Single(c => c.CanHandleSource(source)); cfg.Save(table); }
public void Visit(TomlTable table) => Debug.Assert(false);
// Method to change the Config.toml private void setConfig() { // Read the sample to get the language settings + the paths string samplePath = Directory.GetCurrentDirectory() + @"\Config.sample.toml"; using (StreamReader reader = new StreamReader(File.OpenRead(samplePath))) { TomlTable tt = TOML.Parse(reader); // Change the table in the toml file string path = Directory.GetCurrentDirectory(); string configData = path + @"\Config.toml"; int boss = 0; if (boxBossIndex.Text == "Top") { boss = 0; } if (boxBossIndex.Text == "Middle") { boss = 1; } if (boxBossIndex.Text == "Bottom") { boss = 2; } TomlTable t = new TomlTable(); t = tt; // Get all values in a string-array string[] atkPos = boxAttackPos.Text.Split(',').ToArray(); string[] atkNeut = boxAttackNeut.Text.Split(',').ToArray(); string[] atkNeg = boxAttackNeg.Text.Split(',').ToArray(); string[] speedPos = boxSpeedPos.Text.Split(',').ToArray(); string[] speedNeut = boxSpeedNeut.Text.Split(',').ToArray(); string[] speedNeg = boxSpeedNeg.Text.Split(',').ToArray(); // General Settings t["BOSS"].AsString.Value = Utils.ConvertBossNameToBossId(boxPokemon.Text); t["BASE_BALL"].AsString.Value = Utils.ConvertBallNameToBallId(boxBaseBall.Text); t["LEGENDARY_BALL"].AsString.Value = Utils.ConvertBallNameToBallId(boxLegendBall.Text); t["MODE"].AsString.Value = boxMode.Text.ToUpper(); t["FIND_PATH_WINS"].AsInteger.Value = int.Parse(boxPathWins.Text); t["COM_PORT"].AsString.Value = boxComPort.Text; t["VIDEO_INDEX"].AsInteger.Value = boxVideoCapture.SelectedIndex; t["TESSERACT_PATH"].AsString.Value = boxTesseract.Text; // Advanced Settings t["advanced"]["VIDEO_SCALE"].AsFloat.Value = float.Parse(boxVideoScale.Text); t["advanced"]["VIDEO_EXTRA_DELAY"].AsFloat.Value = float.Parse(boxVideoDelay.Text); t["advanced"]["PABOTBASE_HEX"].AsBoolean.Value = boxPABotBaseHex.Checked; t["advanced"]["BOSS_INDEX"].AsInteger.Value = boss; t["advanced"]["DYNITE_ORE"].AsInteger.Value = int.Parse(boxDyniteOre.Text); t["advanced"]["CONSECUTIVE_RESETS"].AsInteger.Value = int.Parse(boxConsecutiveResets.Text); t["advanced"]["NON_LEGEND"].AsString.Value = boxNonLegend.Text; t["advanced"]["MAXIMUM_ORE_COST"].AsInteger.Value = int.Parse(boxMaxDynite.Text); t["advanced"]["ENABLE_DEBUG_LOGS"].AsBoolean.Value = checkBoxDebugLogs.Checked; // Stat Settings t["stats"]["CHECK_ATTACK_STAT"].AsBoolean.Value = boxCheckAttack.Checked; t["stats"]["CHECK_SPEED_STAT"].AsBoolean.Value = boxCheckSpeed.Checked; // Create TomlNodes for each stat +,=,- TomlNode node = new TomlNode[] { }; TomlNode node1 = new TomlNode[] { }; TomlNode node2 = new TomlNode[] { }; TomlNode node3 = new TomlNode[] { }; TomlNode node4 = new TomlNode[] { }; TomlNode node5 = new TomlNode[] { }; // Get all values from the array into int and add it to the node for (int i = 0; i < atkPos.Length; i++) { node.Add(int.Parse(atkPos[i])); } for (int i = 0; i < atkNeut.Length; i++) { node1.Add(int.Parse(atkNeut[i])); } for (int i = 0; i < atkNeg.Length; i++) { node2.Add(int.Parse(atkNeg[i])); } for (int i = 0; i < speedPos.Length; i++) { node3.Add(int.Parse(speedPos[i])); } for (int i = 0; i < speedNeut.Length; i++) { node4.Add(int.Parse(speedNeut[i])); } for (int i = 0; i < speedNeg.Length; i++) { node5.Add(int.Parse(speedNeg[i])); } // Stats t["stats"]["ATTACK_STATS"]["positive"] = node; t["stats"]["ATTACK_STATS"]["neutral"] = node1; t["stats"]["ATTACK_STATS"]["negative"] = node2; t["stats"]["SPEED_STATS"]["positive"] = node3; t["stats"]["SPEED_STATS"]["neutral"] = node4; t["stats"]["SPEED_STATS"]["negative"] = node5; // Discord Settings t["discord"]["WEBHOOK_ID"].AsString.Value = boxWebhookID.Text; t["discord"]["WEBHOOK_TOKEN"].AsString.Value = boxWebhookToken.Text; t["discord"]["USER_ID"].AsString.Value = boxUserID.Text; t["discord"]["USER_SHORT_NAME"].AsString.Value = boxPingName.Text; t["discord"]["UPDATE_LEVELS"].AsString.Value = boxPingSettings.Text; // Game Language Settings t["language"]["LANGUAGE"].AsString.Value = boxGameLanguage.Text; using (StreamWriter writer = new StreamWriter(File.Open(configData, FileMode.Create))) { t.WriteTo(writer); writer.Flush(); } } }
private void WriteTomlInlineTable(string parentKey, string key, TomlTable table) { var inlineWriter = new TomlInlineTableWriter(this.writer, this.config); inlineWriter.WriteInlineTable(key, table); }
public LayerPoints(TomlTable table) { if (table.TryGetValue("seed", out var tomlObject)) { Seed = tomlObject.Get <int>(); } if (table.TryGetValue("count", out tomlObject)) { PointCount = tomlObject.Get <int>(); } if (table.TryGetValue("sourcefactor", out tomlObject)) { SrcFactor = (BlendFactor)Enum.Parse(typeof(BlendFactor), tomlObject.Get <string>()); } if (table.TryGetValue("destfactor", out tomlObject)) { DstFactor = (BlendFactor)Enum.Parse(typeof(BlendFactor), tomlObject.Get <string>()); } if (table.TryGetValue("farcolor", out tomlObject)) { FarColor = Color.FromHex(tomlObject.Get <string>()); } if (table.TryGetValue("closecolor", out tomlObject)) { CloseColor = Color.FromHex(tomlObject.Get <string>()); } if (table.TryGetValue("pointsize", out tomlObject)) { PointSize = tomlObject.Get <int>(); } // Noise mask stuff. if (table.TryGetValue("mask", out tomlObject)) { Masked = tomlObject.Get <bool>(); } if (table.TryGetValue("maskseed", out tomlObject)) { MaskSeed = (uint)tomlObject.Get <int>(); } if (table.TryGetValue("maskpersistence", out tomlObject)) { MaskPersistence = double.Parse(tomlObject.Get <string>(), CultureInfo.InvariantCulture); } if (table.TryGetValue("masklacunarity", out tomlObject)) { MaskLacunarity = double.Parse(tomlObject.Get <string>(), CultureInfo.InvariantCulture); } if (table.TryGetValue("maskfrequency", out tomlObject)) { MaskFrequency = double.Parse(tomlObject.Get <string>(), CultureInfo.InvariantCulture); } if (table.TryGetValue("maskoctaves", out tomlObject)) { MaskOctaves = (uint)tomlObject.Get <int>(); } if (table.TryGetValue("maskthreshold", out tomlObject)) { MaskThreshold = double.Parse(tomlObject.Get <string>(), CultureInfo.InvariantCulture); } if (table.TryGetValue("masknoise_type", out tomlObject)) { switch (tomlObject.Get <string>()) { case "fbm": MaskNoiseType = NoiseGenerator.NoiseType.Fbm; break; case "ridged": MaskNoiseType = NoiseGenerator.NoiseType.Ridged; break; default: throw new InvalidOperationException(); } } if (table.TryGetValue("maskpower", out tomlObject)) { MaskPower = double.Parse(tomlObject.Get <string>(), CultureInfo.InvariantCulture); } }
public bool EnsureExists(TomlTable content) => this.store.EnsureExists(content);
public bool EnsureExists(TomlTable content) { Assert(this.configs.Count > 0, AssertAtLeastOneConfigMsg); return this.configs.First().EnsureExists(content); }
private static TomlObject GetTableRowOrThrowOnNotFound(string key, TomlTable tbl) => tbl.TryGetValue(key, out var val) ? val : throw new KeyNotFoundException($"Key '{key}' not found in TOML table.");
public void Save(TomlTable table, IConfigSource source) { IPersistableConfig cfg = this.configs.Single(c => c.CanHandleSource(source)); cfg.Save(table); }
public IRunControlTask GetRunControlTask(string type, TomlTable taskSpec) => throw new InvalidOperationException($"{nameof(Sensitivity)} does not support task: {type}");