private FormKindSet(string names) { if (string.IsNullOrEmpty(names)) { // Empty set if null or empty kinds = Enumerable.Empty <FormKind>(); } else { if (names.Length % 4 != 0) { throw new ArgumentException("The input length must be a multiple of four."); } if (names.Length == 4) { // Single element array if single kind kinds = new FormKind[] { FormKind.FromName(names) }; } else { // Sorted set if multiple kinds, also sort names to prevent duplicates var split = Enumerable.Range(0, names.Length / 4).Select(i => names.Substring(i * 4, 4)).OrderBy(n => n); kinds = new SortedSet <FormKind>(split.Select(s => FormKind.FromName(s))); } } }
protected override IEnumerable <Form> GetHardcodedForms(byte pluginNumber) { if (pluginNumber > 0) { yield break; } // PlayerRef yield return(new Form() { FormId = 0x14, FormKind = FormKind.FromName(Names.REFR), Record = new DummyRecord() { EditorId = "PlayerRef" } }); }