public static WEAPRecord From(SSEPlugin.Record record, TES4Record plugin) { return(new WEAPRecord() { bamt = record.GetFirstField("BAMT", FormID.From), bids = record.GetFirstField("BIDS", FormID.From), cnam = record.GetFirstField("CNAM", FormID.From), crtd = record.GetFirstField("CRTD", CRDTRecord.From), data = record.GetFirstField("DATA", DATARecord.From), desc = record.GetFirstField("DESC", b => LString.From(b, plugin)), eamt = record.GetFirstField("EAMT", b => BitConverter.ToUInt16(b, 0)), edid = record.GetFirstField("EDID", ZString.From), eitm = record.GetFirstField("EITM", FormID.From), etyp = record.GetFirstField("ETYP", FormID.From), full = record.GetFirstField("FULL", b => LString.From(b, plugin)), dnam = record.GetFirstField("DNAM", DNAMRecord.From) }); }
public static LString From(byte[] bytes, TES4Record parent) { if (parent.flags.HasFlag(TES4Record.Flags.Localized)) { return(new LString() { isLocalizd = true, localizedId = BitConverter.ToUInt32(bytes, 0) }); } else { return(new LString() { isLocalizd = false, content = ZString.From(bytes) }); } }
public static async Task <SSEPlugin> Load(FileInfo pluginFile) { using var stream = pluginFile.OpenRead(); // The first record of a Plugin should be the TES4Record // which should tell use about the rest of the records var firstRecord = await Record.Read(stream); var pluginRecord = TES4Record.From(firstRecord); var groupStartOffset = stream.Position; var groups = await Group.ReadAllTopLevelGroups(stream, pluginRecord); var groupTable = new GroupLookupTable(groups, groupStartOffset); return(new SSEPlugin() { pluginFile = pluginFile, pluginRecord = pluginRecord, groupTable = groupTable, }); }