public void WriteReference(uint formId, FormKindSet referencedFormKinds) { // All fields should write references via this method so problems can be detected if (formId == 0) { // Null references are normal, do not warn //Log.Warning("Writting null reference 0x{0:X8}.", formId); } else if (!context.Forms.Contains(formId)) { Log.Warning("Writting unresolved form reference 0x{0:X8}.", formId); } else if (!referencedFormKinds.IsAny) { // Verify correct reference type // if specified reference type is not FormType.None var form = context.Forms[formId]; if (!referencedFormKinds.Contains(form.FormKind)) { Log.Warning("Writting reference to {0} used where olny references to forms of following types should be: {1}", form, referencedFormKinds); } } var localFormId = ReferenceMapper.ContexToLocal(formId); Write(localFormId); }
public uint ReadReference(FormKindSet referencedFormKinds) { uint formId = ReadUInt32(); formId = ReferenceMapper.LocalToContext(formId); if (formId > 0 && !context.Forms.Contains(formId)) { //Log.Warning("Reading unresolved form referenced 0x{0:X8}.", formId); } // TODO: Verify reference type return(formId); }
public static FormKindSet FromNames(string names) { if (string.IsNullOrEmpty(names)) { return(Any); } lock (cache) { // Find predefined ro cached set if (cache.ContainsKey(names)) { return(cache[names]); } // Create new one and add to cache var set = new FormKindSet(names); cache.Add(names, set); return(set); } }
public static FormKindSet FromNames(string names) { if (string.IsNullOrEmpty(names)) return Any; lock (cache) { // Find predefined ro cached set if (cache.ContainsKey(names)) return cache[names]; // Create new one and add to cache var set = new FormKindSet(names); cache.Add(names, set); return set; } }
public ReferenceAttribute(string kinds) { ReferenceFormKinds = FormKindSet.FromNames(kinds); }
public ReferenceAttribute() { ReferenceFormKinds = FormKindSet.Any; }