public void UpdateValuesByCSV(bool log = true) { ClearAllValues(); string[, ] fileGrid = CSVReader.SplitCsvGrid(CSVFile.text); for (int i = 1; i < fileGrid.GetUpperBound(0); ++i) { if (fileGrid[i, 0] == null || fileGrid[i, 0] == "") { return; } if (fileGrid[i, 1].Split(',').Length > 2) { stringValues.Add(fileGrid[i, 0], fileGrid[i, 1]); } else if (fileGrid[i, 1] == "TRUE" || fileGrid[i, 1] == "FALSE") { boolValues.Add(fileGrid[i, 0], fileGrid[i, 1] == "TRUE" ? true : false); } else { floatValues.Add(fileGrid[i, 0], float.Parse(fileGrid[i, 1])); } } if (log) { LLLog.Log("SettingValues", "The setting game values was successful updated !"); } }
private async Task LoadLabels(int languageId, string module, string type) { using (var persistence = new PersistenceLayer()) { var translationLabelDefinition = await persistence .Get <TranslationLabelDefinition>() .Include(x => x.TranslationLabels) .Where(x => x.Module == module && x.Type == type) .ToListAsync(); var definitions = translationLabelDefinition .Select(x => new { TranslationLabelDefinition = x, TranslationLabel = x.TranslationLabels .FirstOrDefault(y => y.Language_Id == languageId) }); var dictionary = new StringValueDictionary <string>(DefaultLabelValue); foreach (var definition in definitions) { var transDef = definition.TranslationLabelDefinition; dictionary.Add($"{transDef.Module}:{transDef.Type}:{transDef.Key}", definition?.TranslationLabel?.Label ?? DefaultLabelValue); } lock (DictionaryLanguagesLock) { if (!DictionaryLanguages.ContainsKey(languageId)) { DictionaryLanguages.Add(languageId, new StringValueDictionary <StringValueDictionary <StringValueDictionary <string> > >()); } if (!DictionaryLanguages[languageId].ContainsKey(module)) { DictionaryLanguages[languageId].Add(module, new StringValueDictionary <StringValueDictionary <string> >()); } if (!DictionaryLanguages[languageId][module].ContainsKey(type)) { DictionaryLanguages[languageId][module].Add(type, new StringValueDictionary <string>(DefaultLabelValue)); } DictionaryLanguages[languageId][module][type] = dictionary; } } }