public static T CopyTo <T>(this T record, FileHandle file, bool asNew) where T : RecordBase { using var element = XEditLib.GetElement(record._cursor.ElementPath); var copy = XEditLib.CopyTo(element, file, asNew); var formId = XEditLib.GetElementUIntValue(copy, "Record Header\\FormID"); var loadOrder = XEditLib.GetFileLoadOrder(file); return((T)RecordBase.Create(new Cursor(XEditLib.LoadOrderNames[loadOrder], formId))); }
static void Main(string[] args) { Utils.LogMessages.Subscribe(msg => Console.WriteLine(msg.ToString())); XEditLib.Init(); XEditLib.SetGameMode(XEditGame.SSE); XEditLib.LoadPlugins("Skyrim.esm", "Update.esm", "Dawnguard.esm", "Hearthfires.esm", "Dragonborn.esm"); var ench = new Enchantment(new Cursor((RelativePath)"Skyrim.esm", 0x10fb7d)); using var myfile = XEditLib.AddFile((RelativePath) "myfile2.esp"); myfile.AddMaster("Skyrim.esm"); var copy = ench.CopyTo(myfile, false); copy.FullName.Value = "Im the enchanter now"; myfile.Save(@"c:\tmp\myfile2.esp"); }
public static RecordBase Create(Cursor c) { var sig = XEditLib.GetElementStringValue(c.ElementPath, "Record Header\\Signature"); return(Signatures[sig](c)); }
public void Dispose() { XEditLib.Shutdown(); }
public XEditLibTests() { XEditLib.Init(); XEditLib.SetGameMode(XEditGame.SSE); XEditLib.LoadPlugins(new [] { "Skyrim.esm", "Update.esm", "Dawnguard.esm" }.Select(e => (RelativePath)e)); }