public void LanguageFamily_loadFile_Garethi() { Charakter charakter = new Charakter(); String Resource = ResourceAcess.getResourceDir("TestResources_LoadLanguageFamily01_Standart"); String file = ResourceAcess.getLanguageFamilyFile("TestResources_LoadLanguageFamily01_Standart", "Garethi.xml"); ControllTalent controll = new ControllTalent(Resource); LoadFile_LanguageFamily loader = new LoadFile_LanguageFamily(); charakter.addTalent(controll.getTalentList <LanguageTalent>()); charakter.addTalent(controll.getTalentList <FontTalent>()); LanguageFamily family = loader.loadFile(file, charakter); Assert.AreEqual(family.getName(), "Garethi-Familie"); Assert.AreEqual(charakter.getTalent("Garethi"), family.getLanguageTalent(0)); Assert.AreEqual(charakter.getTalent("Bosparano"), family.getLanguageTalent(1)); Assert.AreEqual(charakter.getTalent("Aureliani"), family.getLanguageTalent(2)); Assert.AreEqual("", family.getLanguageTalent(3).getName()); Assert.AreEqual(charakter.getTalent("Kusliker Zeichen"), family.GetFontTalent(0)); Assert.AreEqual(charakter.getTalent("Kusliker Zeichen"), family.GetFontTalent(1)); Assert.AreEqual("", family.GetFontTalent(2).getName()); Assert.AreEqual(charakter.getTalent("Imperiale Schriftzeichen"), family.GetFontTalent(3)); }
public static List <LanguageFamily> LoadLanguageFamily(List <JSONTalentLanguageFamily> jsonFamilyList, List <ITalent> talentList) { if (jsonFamilyList == null) { jsonFamilyList = new List <JSONTalentLanguageFamily>(); } if (talentList == null) { talentList = new List <ITalent>(); } var ret = new List <LanguageFamily>(); foreach (var json_Family in jsonFamilyList) { var family = new LanguageFamily(json_Family.Name); foreach (var item in json_Family.Writings) { var talent = SearchTalentGeneric <TalentWriting>(item.Value, talentList); family.Writings.Add(item.Key, talent); } foreach (var item in json_Family.Languages) { var talent = SearchTalentGeneric <TalentSpeaking>(item.Value, talentList); family.Languages.Add(item.Key, talent); } ret.Add(family); } return(ret); }
internal LanguageInfo(string name, string twoLetterCode, string threeLetterCode, LanguageFamily family, LanguageType type) { Name = name; TwoLetterIsoCode = twoLetterCode; ThreeLetterIsoCode = threeLetterCode; Family = family; Type = type; }
internal Language(LanguageFamily languageFamily, string isoLanguageName, string endonym, string iso6391, string iso6392T, string iso6392B, string iso6393) { LanguageFamily = languageFamily; IsoLanguageName = isoLanguageName ?? throw new ArgumentNullException(nameof(isoLanguageName)); Endonym = endonym ?? throw new ArgumentNullException(nameof(endonym)); Iso6391 = iso6391 ?? throw new ArgumentNullException(nameof(iso6391)); Iso6392T = iso6392T ?? throw new ArgumentNullException(nameof(iso6392T)); Iso6392B = iso6392B ?? throw new ArgumentNullException(nameof(iso6392B)); Iso6393 = iso6393 ?? throw new ArgumentNullException(nameof(iso6393)); }
public async Task <IActionResult> Create(LanguageFamily model) { if (ModelState.IsValid) { await languageFamilyRepository.CreateAsync(model); return(RedirectToAction("index")); } return(View(model)); }
public void ControllClass_SimpleTest_Family() { List <String> list = controll.getFamilyList(); LanguageFamily family = controll.getFamilybyName(list[0]); LanguageTalent talent = family.getLanguageTalent(0); controll.setMotherMark("X", talent.getName()); Assert.AreEqual("X", talent.getMotherMark()); }
public void LanguageFamily_loadFile_FontTalentisLanguage() { Charakter charakter = new Charakter(); String Resource = ResourceAcess.getResourceDir("TestResources_LoadCharakter02_CorruptFiles"); String file = ResourceAcess.getLanguageFamilyFile("TestResources_LoadCharakter02_CorruptFiles", "Korrupt_Font_FontisLanguage.xml"); ControllTalent controll = new ControllTalent(Resource); LoadFile_LanguageFamily loader = new LoadFile_LanguageFamily(); charakter.addTalent(controll.getTalentList <LanguageTalent>()); charakter.addTalent(controll.getTalentList <FontTalent>()); LanguageFamily family = loader.loadFile(file, charakter); }
public async Task <bool> CreateAsync(LanguageFamily model) { context.LanguageFamilies.Add(model); try { await context.SaveChangesAsync(); } catch { return(false); } return(true); }
public void LanguageFamily_loadFileNotXML() { Charakter charakter = new Charakter(); String Resource = ResourceAcess.getResourceDir("TestResources_LoadLanguageFamily01_Standart"); String file = ResourceAcess.getLanguageFamilyFile("TestResources_LoadLanguageFamily01_Standart", "Garethi"); ControllTalent controll = new ControllTalent(Resource); LoadFile_LanguageFamily loader = new LoadFile_LanguageFamily(); charakter.addTalent(controll.getTalentList <LanguageTalent>()); charakter.addTalent(controll.getTalentList <FontTalent>()); LanguageFamily family = loader.loadFile(file, charakter); Assert.AreEqual(null, family); }
public void LanguageFamily_addRow() { LanguageFamily languageFamily = new LanguageFamily("Family"); Assert.AreEqual("Family", languageFamily.getName()); LanguageTalent lt = new LanguageTalent("lt", new List <string>()); FontTalent ft = new FontTalent("ft", new List <string>()); languageFamily.addLanguageRow(lt, ft); Assert.AreEqual(lt, languageFamily.getLanguageTalent(0)); Assert.AreEqual(ft, languageFamily.GetFontTalent(0)); Assert.AreEqual(1, languageFamily.Count()); }
public static List <ITalent> ExcelImport(string importFile, out List <LanguageFamily> familieList) { familieList = new List <LanguageFamily>(); var ret = new List <ITalent>(); var excelTalentDic = new Dictionary <string, List <ExcelTalent> >(); var talentsWithDeduction = new Dictionary <ITalent, ExcelTalent>(); var talentWithRequirements = new Dictionary <ITalent, ExcelTalent>(); #region Import der Exel Datei SpreadsheetDocument document = SpreadsheetDocument.Open(importFile, false); WorkbookPart wbPart = document.WorkbookPart; List <Sheet> sheets = wbPart.Workbook.Descendants <Sheet>().ToList(); foreach (var sheet in sheets) { var orginalPosition = 0; var contentType = sheet.Name; var currentTitle = string.Empty; var excelTalents = new List <ExcelTalent>(); WorksheetPart wsPart = (WorksheetPart)(wbPart.GetPartById(sheet.Id)); var rowList = wsPart.Worksheet.GetFirstChild <SheetData>().Elements <Row>().ToList(); var titleRowHeaders = new List <string>(); var titleRow = rowList[0]; rowList.RemoveAt(0); //Titel Leiste Entfernen foreach (var cell in titleRow.Descendants <Cell>().ToList()) { var cellValue = ExcelImportGetCellValue(wbPart, cell); titleRowHeaders.Add(cellValue); } foreach (var row in rowList) { var excelTalent = new ExcelTalent(); var celllist = row.Descendants <Cell>().ToList(); var counter = 0; excelTalent.OrginalPosition = orginalPosition++; foreach (var cell in celllist) { var cellValue = ExcelImportGetCellValue(wbPart, cell); excelTalent.AddValue(titleRowHeaders[counter], cellValue); counter++; } var excelRowType = excelTalent.ExcelRowType(); if (excelRowType == ExcleRowType.Title) { var title = excelTalent.Talent.Replace(EXCELTITLE, ""); currentTitle = title; } else if (excelRowType == ExcleRowType.ValidTalent) { excelTalent.Title = currentTitle; excelTalents.Add(excelTalent); } } excelTalentDic.Add(contentType, excelTalents); } #endregion #region Talente Erstellen foreach (var talentGroup in excelTalentDic) { LanguageFamily currentLanguageFamily = null; var talentList = talentGroup.Value; var pos = 0; foreach (var excelTalent in talentList) { var name = string.Empty; var nameExtension = string.Empty; if (excelTalent.Talent.Contains("(")) { var items = excelTalent.Talent.Split('('); name = items[0]; nameExtension = items[1].Split(')').First(); } else { name = excelTalent.Talent; } ITalent newTalent = null; if (!string.IsNullOrEmpty(name)) { newTalent = SearchTalent(name, ret, GetTypeFromString(talentGroup.Key)); if (newTalent == null) { newTalent = CreateTalent( contentType: talentGroup.Key, probe: excelTalent.GetConvertAttribute(), be: excelTalent.BE, name: name, nameExtension: nameExtension, orginalPos: excelTalent.OrginalPosition); } } #region Sprache if (talentGroup.Key == nameof(TalentSpeaking)) { TalentSpeaking talentLanguage = null; TalentWriting talentWriting = null; if (newTalent != null) { talentLanguage = (TalentSpeaking)newTalent; } if (!string.IsNullOrEmpty(excelTalent.Schrift)) { talentWriting = (TalentWriting)SearchTalent(excelTalent.Schrift, ret, typeof(TalentWriting)); if (talentWriting == null) { talentWriting = (TalentWriting)CreateTalent( contentType: nameof(TalentWriting), probe: excelTalent.GetConvertAttribute(), be: excelTalent.Komplex2, name: excelTalent.Schrift, nameExtension: nameExtension); } } if (currentLanguageFamily == null || currentLanguageFamily.Name != excelTalent.Title) { currentLanguageFamily = new LanguageFamily(excelTalent.Title); familieList.Add(currentLanguageFamily); pos = 0; } if (talentLanguage != null) { currentLanguageFamily.Languages.Add(pos, talentLanguage); } if (talentWriting != null) { currentLanguageFamily.Writings.Add(pos, talentWriting); } if (talentWriting != null && !ret.Contains(talentWriting)) { ret.Add(talentWriting); } } #endregion if (excelTalent.IsValidVerwanteFertigkeit()) { talentsWithDeduction.Add(newTalent, excelTalent); } if (excelTalent.IsValidAnforderung()) { talentWithRequirements.Add(newTalent, excelTalent); } if (newTalent != null && !ret.Contains(newTalent)) { ret.Add(newTalent); } pos++; } } ret = new List <ITalent>(ret.OrderBy(x => x.Name)); foreach (var talentwithDeduction in talentsWithDeduction) { var deductionTalentStrings = talentwithDeduction.Value.GetSplitDeduction(); foreach (var deductionString in deductionTalentStrings) { var value = deductionString; var valueint = -1; var mainReqg = new Regex("[(][+][0-9]?[0-9][)]"); var innerReqg = new Regex("[0-9]?[0-9]"); var stringTalentReqg = new Regex("[(][A-Za-zäüß]{1,}[ ]?[A-Za-zäüß]{1,}[)]"); if (mainReqg.IsMatch(deductionString)) { value = mainReqg.Split(deductionString)[0].Trim(); if (!int.TryParse(innerReqg.Match(deductionString).ToString(), out valueint)) { valueint = -1; } } if (valueint == -1) { valueint = talentwithDeduction.Key.BaseDeduction; } ITalentDeduction deduction = null; var deductionTalent = ret.Where(x => x.Name.StartsWith(value, StringComparison.CurrentCulture)); if (deductionTalent.Any()) { deduction = new TalentDeductionTalent(deductionTalent.First(), valueint, talentwithDeduction.Key.BaseDeduction); } else { var stringTalent = stringTalentReqg.Split(deductionString)[0].Trim(); var innerTalent = ret.Where(x => x.Name == stringTalent).FirstOrDefault(); if (innerTalent != null) { value = mainReqg.Split(deductionString)[0].Trim(); if (stringTalentReqg.IsMatch(value)) { var description = stringTalentReqg.Match(value).Value; description = description.Replace("(", "").Replace(")", ""); deduction = new TalentDeductionTalent(innerTalent, valueint, talentwithDeduction.Key.BaseDeduction, description); } else { deduction = new TalentDeductionFreeText(deductionString); } } else { deduction = new TalentDeductionFreeText(deductionString); } } talentwithDeduction.Key.Deductions.Add(deduction); } } foreach (var talentWithRequirement in talentWithRequirements) { var splitRequirement = talentWithRequirement.Value.GetSplitRequirement(); foreach (var requirementString in splitRequirement) { ITalentRequirement requirement; var talent = (AbstractTalentGeneral)talentWithRequirement.Key; var value = requirementString; var valueStart = -1; var valueEnd = -1; var reqTalent = ret.Where(x => x.Name.StartsWith(value, StringComparison.CurrentCulture)); var startReqg = new Regex("[0-9]?[0-9][+][:]"); var endReqg = new Regex("[ ][0-9]?[0-9]"); if (endReqg.IsMatch(value)) { if (startReqg.IsMatch(value)) { var innerStartReq = new Regex("[0-9]?[0-9]"); var startvalue = startReqg.Match(value).ToString(); var truestartValue = innerStartReq.Match(startvalue).ToString(); valueStart = Int32.Parse(truestartValue, Helper.CultureInfo); value = startReqg.Split(value)[1]; } var startSplit = startReqg.Split(value); valueEnd = Int32.Parse(endReqg.Match(value).ToString(), Helper.CultureInfo); value = endReqg.Split(value)[0].Trim(); } requirement = new TalentRequirementFreeText(requirementString); if (reqTalent.Any() && valueEnd != -1 && valueStart != -1) { requirement = new TalentRequirementTalent(reqTalent.First(), valueEnd, valueStart); } else if (reqTalent.Any() && valueEnd != -1) { var trueReqTalent = reqTalent.First(); requirement = new TalentRequirementTalent(reqTalent.First(), valueEnd); } else { requirement = new TalentRequirementFreeText(requirementString); } talent.Requirements.Add(requirement); } } #endregion return(ret); }
public void LanguageFamily_create() { LanguageFamily languageFamily = new LanguageFamily("Name"); Assert.AreEqual("Name", languageFamily.getName()); }
public IActionResult Create() { var model = new LanguageFamily(); return(View(model)); }
public void ControllClass_ExceptionTest_Family() { List <String> list = controll.getFamilyList(); LanguageFamily family = controll.getFamilybyName("FakeName"); }
public void createLangauge() { LanguageFamily newLanguageFamily = new LanguageFamily(); Manager manager = Object.FindObjectOfType <Manager>(); LanguageManager languageManager = manager.languageManager; newLanguageFamily.Name = languageManager.languageName; // Get consonants and vowels into the new language family object Phoneme[][] allPhonemes = new Phoneme[6][]; allPhonemes[0] = languageManager.consonantBoW; allPhonemes[1] = languageManager.consonantBoS; allPhonemes[2] = languageManager.consonantEoS; allPhonemes[3] = languageManager.consonantEoW; allPhonemes[4] = languageManager.vowelAS; allPhonemes[5] = languageManager.vowelUS; for (int i = 0; i < allPhonemes.Length; i++) { // Create new array of speech sounds SpeechSound[] speechSounds; if (i == 0) { newLanguageFamily.WordOnsets = new SpeechSound[allPhonemes[i].Length]; speechSounds = newLanguageFamily.WordOnsets; } else if (i == 1) { newLanguageFamily.SyllableOnsets = new SpeechSound[allPhonemes[i].Length]; speechSounds = newLanguageFamily.SyllableOnsets; } else if (i == 2) { newLanguageFamily.SyllableCodas = new SpeechSound[allPhonemes[i].Length]; speechSounds = newLanguageFamily.SyllableCodas; } else if (i == 3) { newLanguageFamily.WordCodas = new SpeechSound[allPhonemes[i].Length]; speechSounds = newLanguageFamily.WordCodas; } else if (i == 4) { newLanguageFamily.StressedVowels = new SpeechSound[allPhonemes[i].Length]; speechSounds = newLanguageFamily.StressedVowels; } else { newLanguageFamily.UnstressedVowels = new SpeechSound[allPhonemes[i].Length]; speechSounds = newLanguageFamily.UnstressedVowels; } for (int j = 0; j < allPhonemes[i].Length; j++) { Phoneme phoneme = allPhonemes[i][j]; SpeechSound ss = new SpeechSound(); if (phoneme.preceding != null) { ss.Preceded = true; ss.Successed = false; Phone glide = new Phone(); glide.converProtoPhone(phoneme.phones[0]); ss.Glide = glide; Phone[] phones = new Phone[phoneme.phones.Length - 1]; for (int ii = 0; ii < phones.Length; ii++) { Phone phone = new Phone(); phone.converProtoPhone(phoneme.phones[ii + 1]); phones[ii] = phone; } ss.Phonemes = phones; } else if (phoneme.successing != null) { ss.Preceded = false; ss.Successed = true; Phone glide = new Phone(); glide.converProtoPhone(phoneme.phones[phoneme.phones.Length - 1]); ss.Glide = glide; Phone[] phones = new Phone[phoneme.phones.Length - 1]; for (int ii = 0; ii < phones.Length; ii++) { Phone phone = new Phone(); phone.converProtoPhone(phoneme.phones[ii]); phones[ii] = phone; } ss.Phonemes = phones; } else { ss.Preceded = false; ss.Successed = false; Phone[] phones = new Phone[phoneme.phones.Length]; for (int ii = 0; ii < phones.Length; ii++) { Phone phone = new Phone(); phone.converProtoPhone(phoneme.phones[ii]); phones[ii] = phone; } ss.Phonemes = phones; } ss.Transliteration = phoneme.letters; ss.Frequency = phoneme.frequency; speechSounds[j] = ss; } } // Get accents into the new language family object Phone[] accents = new Phone[languageManager.accents.Length]; for (int i = 0; i < languageManager.accents.Length; i++) { Phone accent = new Phone(); accent.converProtoPhone(languageManager.accents[i]); } newLanguageFamily.Accents = accents; // Get all the accent rule // generalPanel, VerbPanerl, NounPanel, AdjectivePanel; // Nouns, Adjectives; newLanguageFamily.Generals = getOnePartOfSpeech(generalPanel); newLanguageFamily.Verbs = getOnePartOfSpeech(VerbPanerl); newLanguageFamily.Nouns = getOnePartOfSpeech(NounPanel); newLanguageFamily.Adjectives = getOnePartOfSpeech(AdjectivePanel); // WordOnsets, WordCodas, SyllableOnsets, SyllableCodas, StressedVowels, UnstressedVowels; //consonantBoW, consonantBoS, consonantEoS, consonantEoW; //public Phoneme[] vowelAS, vowelUS; string vocabPath = "/Files/Customization/" + newLanguageFamily.Name; Debug.Log(vocabPath); if (!System.IO.Directory.Exists(Application.dataPath + vocabPath)) { System.IO.Directory.CreateDirectory(Application.dataPath + vocabPath); } newLanguageFamily.Directory = vocabPath; SoundChange rootChange = new SoundChange(); rootChange.Name = newLanguageFamily.Name; rootChange.Directory = vocabPath + "/change_rule/"; if (!System.IO.Directory.Exists(Application.dataPath + rootChange.Directory)) { System.IO.Directory.CreateDirectory(Application.dataPath + rootChange.Directory); } rootChange.Directory = vocabPath + "/change_rule/root"; rootChange.Branches = new string[0]; rootChange.Rules = new Sandhi[0]; newLanguageFamily.Root = rootChange; string langaugeData = JsonUtility.ToJson(newLanguageFamily); System.IO.File.WriteAllText(Application.dataPath + "/Files/Customization/Languages/" + newLanguageFamily.Name + ".languageFamily", langaugeData); // Set the new language to the manager manager.currentLanguage = newLanguageFamily; // Jump to next scenes SceneManager.LoadScene("LanguageScreen"); }