// Check a given string to see if it's either a valid seed phrase or hex seed public bool validSeedString(string seedString) { bool validHex = SeedUtility.validHex(seedString); string[] wordArray = seedString.Split(null); if (seedString == "" || seedString.Length < 1) { deactivateCheckSymbols(); warningTextTMP.text = ""; validHex = false; } else if (!validHex && wordArray.Length > 1 && wordArray.Length < 12) { Debug.Log("array length: " + wordArray.Length); warningTextTMP.text = "Remember to add spaces between the words."; warningTextTMP.color = new Color32(255, 20, 20, 255); setRedWarning(); } else if (!validHex && wordArray.Length > 1 && !SeedUtility.validBip(seedString)) { warningTextTMP.text = "Make sure the words are spelled correctly."; warningTextTMP.color = new Color32(255, 20, 20, 255); setRedWarning(); } else if (!validHex) { warningTextTMP.text = "Character seeds must only contain hex characters."; warningTextTMP.color = new Color32(255, 20, 20, 255); setRedWarning(); } else if (seedString.Length < 33) { validHex = false; warningTextTMP.text = "Not enough characters!"; warningTextTMP.color = new Color32(255, 20, 20, 255); setRedWarning(); } else if (seedString.Length > 34) { validHex = false; warningTextTMP.text = "Too many characters!"; warningTextTMP.color = new Color32(255, 20, 20, 255); setRedWarning(); } return(validHex); }
//Seed Data Method public async static Task SeedDataAsync(IHost host) { using var scope = host.Services.CreateScope(); var services = scope.ServiceProvider; try { var userManager = services.GetRequiredService <UserManager <BlogUser> >(); var roleManger = services.GetRequiredService <RoleManager <IdentityRole> >(); await SeedUtility.SeedDataAsync(userManager, roleManger); } catch (Exception ex) { Console.WriteLine(ex); } }
public NebulaCheck.IGen <Test> WhenItIsEnumeratedOnce_ItWillShrinkToTheSmallestElementRepeated() => from elementGen in DomainGen.Gen() from seed in DomainGen.Seed() from size in DomainGen.Size() select Property.ForThese(() => { var elementMin = elementGen.Minimum(seed: SeedUtility.Fork(seed), size: size); var infiniteGen = elementGen.InfiniteOf().Select(enumerable => { enumerable.Take(1).ToList(); return(enumerable); }); var minimum = infiniteGen.Minimum(seed: seed, size: size); minimum.Take(10).Should().BeEquivalentTo(Enumerable.Range(0, 10).Select(_ => elementMin)); });
public void EncodeSeed() { if (GameManager.Mode == GameMode.Rehearsal) { string seedFromInput = seedInputField.text; string hexSeed = ""; if (!SeedUtility.detectHex(seedFromInput) && SeedUtility.validBip(seedFromInput)) { hexSeed = bpc.getHexFromSentence(seedFromInput); } else { hexSeed = seedFromInput; if (InteractableConfig.SeedHexLength % 2 == 1) { if (seedFromInput.Length == InteractableConfig.SeedHexLength) { string seedText = seedFromInput + "0"; char[] array = seedText.ToCharArray(); array[array.Length - 1] = array[array.Length - 2]; array[array.Length - 2] = '0'; hexSeed = new string(array); } else if (seedFromInput.Length == InteractableConfig.SeedHexLength + 1) { char[] array = seedFromInput.ToCharArray(); array[array.Length - 2] = '0'; hexSeed = new string(array); } else { Debug.Log("Seed: " + hexSeed); } } } Debug.Log("Seed: " + hexSeed); InteractablePathManager.SeedString = hexSeed; int[] siteIDs = InteractablePathManager.GetPathSiteIDs(); } }
// Check the user's input to verify that it's a valid seed public void checkInputSeed() { //Debug.Log("Hello from checkInputSeed()"); string seed = SeedUtility.removeHexPrefix(seedInputField.text); bool validSeed = validSeedString(seed); if (validSeed) { Debug.Log("Valid hex seed: " + seed); warningTextTMP.text = "Character seed detected!"; warningTextTMP.color = new Color32(81, 150, 55, 255); setGreenCheck(); } else if (SeedUtility.validBip(seedInputField.text)) { Debug.Log("Valid bip39 seed: " + seed); warningTextTMP.text = "Word seed detected!"; warningTextTMP.color = new Color32(81, 150, 55, 255); setGreenCheck(); } }